| | |
| | | |
| | | |
| | | import com.bstek.dorado.annotation.DataProvider; |
| | | import com.bstek.dorado.annotation.DataResolver; |
| | | import com.bstek.dorado.annotation.Expose; |
| | | import com.bstek.dorado.data.provider.Page; |
| | | import com.fzzy.igds.constant.Constant; |
| | | import com.fzzy.igds.data.NoticeDto; |
| | | import com.fzzy.igds.data.NoticeParam; |
| | | import com.fzzy.igds.service.InoutNoticeService; |
| | | import com.fzzy.igds.domain.InoutNoticeIn; |
| | | import com.fzzy.igds.domain.InoutNoticeOut; |
| | |
| | | @Resource |
| | | private SysDeptService sysDeptService; |
| | | |
| | | /** |
| | | /* *//** |
| | | * inoutNoticePR#getTitle 根据报表类型,获取默认查询信息,比如表头信息等 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | *//* |
| | | @DataProvider |
| | | public Map<String, Object> getTitle(Map<String, Object> param) { |
| | | Map<String, Object> result = new HashMap<String, Object>(); |
| | |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | }*/ |
| | | |
| | | /** |
| | | * inoutNoticePR#getYearQuery 默认年份 |
| | |
| | | public InoutNoticeIn initAddIn() { |
| | | SysUser user = ContextUtil.getLoginUser(); |
| | | InoutNoticeIn data = new InoutNoticeIn(); |
| | | data.setId("RKTZD_" + ContextUtil.generateId()); |
| | | data.setId(ContextUtil.generateOrderId("RK")); |
| | | data.setName("入库通知单"); |
| | | data.setCompanyId(user.getCompanyId()); |
| | | data.setDeptId(ContextUtil.subDeptId(user)); |
| | | data.setTag(Constant.YN_Y); |
| | | data.setYear(DateFormatUtils.format(new Date(), "yyyy")); |
| | | data.setCreateBy(ContextUtil.getLoginUserName()); |
| | | data.setCreateTime(new Date()); |
| | | return data; |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public void pageQueryIn(Page<InoutNoticeIn> page, Map<String, Object> param) { |
| | | if (null == param) { |
| | | param = new HashMap<>(); |
| | | } |
| | | Map<String, Object> finalParam = param; |
| | | public void pageQueryIn(Page<InoutNoticeIn> page, NoticeParam param) { |
| | | com.baomidou.mybatisplus.extension.plugins.pagination.Page<InoutNoticeIn> corePage = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(page.getPageNo(), page.getPageSize()); |
| | | |
| | | //多参数分页查询 |
| | | Pageable pageable = PageRequest.of(0, 10000, Sort.Direction.ASC, InoutNoticeIn.SORT_PROP); |
| | | Specification<InoutNoticeIn> specification = new Specification<InoutNoticeIn>() { |
| | | private static final long serialVersionUID = 1L; |
| | | inoutNoticeService.pageQueryIn(corePage, param); |
| | | |
| | | public Predicate toPredicate(Root<InoutNoticeIn> root, CriteriaQuery<?> query, CriteriaBuilder cb) { |
| | | List<Predicate> predicates = new ArrayList<Predicate>(); //所有的断言 |
| | | |
| | | Predicate predicate1 = cb.equal(root.get("companyId"), ContextUtil.getCompanyId()); |
| | | predicates.add(predicate1); |
| | | Predicate predicate2 = cb.equal(root.get("deptId"), ContextUtil.subDeptId(null)); |
| | | predicates.add(predicate2); |
| | | |
| | | String key = String.valueOf(finalParam.get("year")); |
| | | if (StringUtils.isBlank(key)) { |
| | | Predicate predicate3 = cb.equal(root.get("year"), key); |
| | | predicates.add(predicate3); |
| | | } |
| | | key = (String) finalParam.get("id"); |
| | | if (StringUtils.isBlank(key)) { |
| | | Predicate predicate4 = cb.equal(root.get("id"), key); |
| | | predicates.add(predicate4); |
| | | } |
| | | key = (String) finalParam.get("customerName"); |
| | | if (StringUtils.isBlank(key)) { |
| | | Predicate predicate5 = cb.like(root.get("customerName"), "%" + key + "%"); |
| | | predicates.add(predicate5); |
| | | } |
| | | key = (String) finalParam.get("completeStatus"); |
| | | if (StringUtils.isBlank(key)) { |
| | | Predicate predicate6 = cb.equal(root.get("completeStatus"), key); |
| | | predicates.add(predicate6); |
| | | } |
| | | key = (String) finalParam.get("foodVariety"); |
| | | if (StringUtils.isBlank(key)) { |
| | | Predicate predicate7 = cb.equal(root.get("foodVariety"), key); |
| | | predicates.add(predicate7); |
| | | } |
| | | return cb.and(predicates.toArray(new Predicate[0])); |
| | | } |
| | | }; |
| | | org.springframework.data.domain.Page<InoutNoticeIn> japPage = inoutNoticeService.queryAllNoticeIn(specification, pageable); |
| | | page.setEntityCount((int) japPage.getTotalElements()); |
| | | page.setEntities(japPage.getContent()); |
| | | // 重新封装 |
| | | page.setEntities(corePage.getRecords()); |
| | | page.setEntityCount(Integer.parseInt(String.valueOf(corePage.getTotal()))); |
| | | } |
| | | |
| | | /** |
| | | * inoutNoticePR#saveIn 更新入库通知单 |
| | | */ |
| | | @Expose |
| | | @DataResolver |
| | | public String saveIn(InoutNoticeIn data) { |
| | | InoutNoticeIn inoutNoticeIn = new InoutNoticeIn(); |
| | | BeanUtils.copyProperties(data, inoutNoticeIn); |
| | |
| | | return cb.and(predicates.toArray(new Predicate[0])); |
| | | } |
| | | }; |
| | | org.springframework.data.domain.Page<InoutNoticeIn> japPage = inoutNoticeService.queryAllNoticeIn(specification, pageable); |
| | | //org.springframework.data.domain.Page<InoutNoticeIn> japPage = inoutNoticeService.queryAllNoticeIn(specification, pageable); |
| | | |
| | | return japPage.getContent(); |
| | | //return japPage.getContent(); |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | |
| | | return cb.and(predicates.toArray(new Predicate[0])); |
| | | } |
| | | }; |
| | | org.springframework.data.domain.Page<InoutNoticeOut> japPage = inoutNoticeService.queryAllNoticeOut(specification, pageable); |
| | | page.setEntityCount((int) japPage.getTotalElements()); |
| | | page.setEntities(japPage.getContent()); |
| | | //org.springframework.data.domain.Page<InoutNoticeOut> japPage = inoutNoticeService.queryAllNoticeOut(specification, pageable); |
| | | //page.setEntityCount((int) japPage.getTotalElements()); |
| | | //page.setEntities(japPage.getContent()); |
| | | } |
| | | |
| | | /** |
| | |
| | | return cb.and(predicates.toArray(new Predicate[0])); |
| | | } |
| | | }; |
| | | org.springframework.data.domain.Page<InoutNoticeOut> japPage = inoutNoticeService.queryAllNoticeOut(specification, pageable); |
| | | //org.springframework.data.domain.Page<InoutNoticeOut> japPage = inoutNoticeService.queryAllNoticeOut(specification, pageable); |
| | | |
| | | return japPage.getContent(); |
| | | //return japPage.getContent(); |
| | | return null; |
| | | } |
| | | |
| | | /** |