| | |
| | | public TableDataInfo list(TjSampling tjSampling) { |
| | | startPage(); |
| | | List<TjSampling> list = tjSamplingService.selectTjSamplingList(tjSampling); |
| | | if(null !=list && list.size()>0 ){ |
| | | if (null != list && list.size() > 0) { |
| | | for (TjSampling sampling : list) { |
| | | TjCustomer customer = customerService.getById(sampling.getCusId()); |
| | | if(null !=customer){ |
| | | if (null != customer) { |
| | | sampling.setCustomer(customer); |
| | | } |
| | | } |
| | |
| | | @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize, |
| | | @ApiParam(value = "开始时间") @RequestParam(required = false) String beginTime, |
| | | @ApiParam(value = "结束时间") @RequestParam(required = false) String endTime) { |
| | | LambdaQueryWrapper<TjSampling>wq=new LambdaQueryWrapper<>(); |
| | | List<Map<String,Object>> arrayList=new ArrayList<>(); |
| | | LambdaQueryWrapper<TjSampling> wq = new LambdaQueryWrapper<>(); |
| | | List<Map<String, Object>> arrayList = new ArrayList<>(); |
| | | wq.orderByDesc(TjSampling::getApplicationTime); |
| | | if(null !=beginTime && !"".equals(beginTime) && null !=endTime && !"".equals(endTime)) wq.between(TjSampling::getApplicationTime,beginTime,endTime); |
| | | if(null !=tjNum){ |
| | | wq.eq(TjSampling::getTjNum,tjNum); |
| | | if (null != beginTime && !"".equals(beginTime) && null != endTime && !"".equals(endTime)) |
| | | wq.between(TjSampling::getApplicationTime, beginTime, endTime); |
| | | if (null != tjNum) { |
| | | wq.eq(TjSampling::getTjNum, tjNum); |
| | | wq.eq(TjSampling::getIsSignFor, isSignFor); |
| | | List<TjSampling> list = tjSamplingService.list(wq); |
| | | List<Map<String, Object>> extracted = extracted(arrayList, list,pageNum,pageSize); |
| | | return AjaxResult.success(extracted); |
| | | List<Map<String, Object>> extracted = extracted(arrayList, list, pageNum, pageSize); |
| | | |
| | | //________________________解决搜索数据不对 |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list", extracted); |
| | | map.put("total", arrayList.size()); |
| | | return AjaxResult.success(map); |
| | | //________________________解决搜索数据不对 |
| | | } |
| | | if(null !=name){ |
| | | wq.like(TjSampling::getCusName,name); |
| | | if (null != name) { |
| | | wq.like(TjSampling::getCusName, name); |
| | | wq.eq(TjSampling::getIsSignFor, isSignFor); |
| | | List<TjSampling> list = tjSamplingService.list(wq); |
| | | List<Map<String, Object>> extracted = extracted(arrayList, list,pageNum,pageSize); |
| | | return AjaxResult.success(extracted); |
| | | List<Map<String, Object>> extracted = extracted(arrayList, list, pageNum, pageSize); |
| | | |
| | | //________________________解决搜索数据不对 |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list", extracted); |
| | | map.put("total", arrayList.size()); |
| | | return AjaxResult.success(map); |
| | | //________________________解决搜索数据不对 |
| | | } |
| | | List<Map<String, Object>> cacheMapValue =null; |
| | | if(isSignFor==0) { |
| | | List<Map<String, Object>> cacheMapValue = null; |
| | | if (isSignFor == 0) { |
| | | cacheMapValue = redisCache.getCacheMapValue("sampling", "yqs"); |
| | | } |
| | | if(isSignFor==1) { |
| | | cacheMapValue = redisCache.getCacheMapValue("sampling", "wqs"); |
| | | if (isSignFor == 1) { |
| | | cacheMapValue = redisCache.getCacheMapValue("sampling", "wqs"); |
| | | } |
| | | asyncService.saveSampling(); |
| | | List<Map<String,Object>> collect =new ArrayList<>(); |
| | | Map<String,Object>map=new HashMap<>(); |
| | | if(null ==cacheMapValue || cacheMapValue.size()==0){ |
| | | wq.eq(TjSampling::getIsSignFor,isSignFor); |
| | | List<Map<String, Object>> collect = null; |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if (null == cacheMapValue || cacheMapValue.size() == 0) { |
| | | wq.eq(TjSampling::getIsSignFor, isSignFor); |
| | | List<TjSampling> list = tjSamplingService.list(wq); |
| | | collect = extracted(arrayList, list,pageNum,pageSize); |
| | | map.put("total",arrayList.size()); |
| | | }else { |
| | | collect = extracted(arrayList, list, pageNum, pageSize); |
| | | map.put("total", arrayList.size()); |
| | | } else { |
| | | collect = cacheMapValue.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | map.put("total",cacheMapValue.size()); |
| | | map.put("total", cacheMapValue.size()); |
| | | } |
| | | if (collect!=null){ |
| | | map.put("list",collect); |
| | | }else { |
| | | map.put("list",new ArrayList<Map<String,Object>>()); |
| | | } |
| | | map.put("list", collect); |
| | | |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | private List<Map<String,Object>> extracted(List<Map<String, Object>> arrayList, List<TjSampling> list,Integer pageNum,Integer pageSize) { |
| | | if(null != list && list.size()>0 ){ |
| | | private List<Map<String, Object>> extracted(List<Map<String, Object>> arrayList, List<TjSampling> list, Integer pageNum, Integer pageSize) { |
| | | if (null != list && list.size() > 0) { |
| | | Map<String, List<TjSampling>> stringListMap = list.stream().collect(Collectors.groupingBy(TjSampling::getCusId)); |
| | | for (Map.Entry<String, List<TjSampling>> entry : stringListMap.entrySet()) { |
| | | Map<String,Object>map=new HashMap<>(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | TjCustomer customer = customerService.getById(entry.getKey()); |
| | | if (customer==null){ |
| | | if (customer == null) { |
| | | continue; |
| | | } |
| | | customer.setCusName(MatchUtils.hideCusName(customer.getCusName())); |
| | |
| | | customer.setTjNumber(entry.getValue().get(0).getTjNum()); |
| | | customer.setApplicationTime(entry.getValue().get(0).getApplicationTime()); |
| | | List<TjSampling> samplings = entry.getValue(); |
| | | if(null !=samplings && samplings.size()>0){ |
| | | List<TjSampling> projectList=new ArrayList<>(); |
| | | if (null != samplings && samplings.size() > 0) { |
| | | List<TjSampling> projectList = new ArrayList<>(); |
| | | for (TjSampling sampling : samplings) { |
| | | sampling.setCusName(MatchUtils.hideCusName(sampling.getCusName())); |
| | | TjProject project = projectService.getById(sampling.getProId()); |
| | | if(null !=project && project.getProParentId()==0){ |
| | | if (null != project && project.getProParentId() == 0) { |
| | | projectList.add(sampling); |
| | | } |
| | | } |
| | | map.put("list",projectList); |
| | | map.put("list", projectList); |
| | | } |
| | | map.put("customer",customer); |
| | | map.put("customer", customer); |
| | | arrayList.add(map); |
| | | } |
| | | } |
| | | List<Map<String, Object>> collect =null; |
| | | if(null !=arrayList && arrayList.size()>0){ |
| | | collect = arrayList.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | List<Map<String, Object>> collect = null; |
| | | if (null != arrayList && arrayList.size() > 0) { |
| | | collect = arrayList.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | return collect; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 确认采样接口 |
| | | */ |
| | | @PostMapping("/confirmSampling") |
| | | @ApiOperation(value = "确认采样接口") |
| | | public AjaxResult confirmSampling(@RequestBody List<String> ids) { |
| | | if(null==ids || ids.size()==0){ |
| | | if (null == ids || ids.size() == 0) { |
| | | return AjaxResult.error("请选择要确认项"); |
| | | } |
| | | for (String id : ids) { |
| | | TjSampling sampling = tjSamplingService.getById(id); |
| | | if(null !=sampling){ |
| | | if (null != sampling) { |
| | | sampling.setIsSignFor("0"); |
| | | LambdaQueryWrapper<TjProject>wq=new LambdaQueryWrapper<>(); |
| | | wq.eq(TjProject::getProParentId,sampling.getProId()); |
| | | LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjProject::getProParentId, sampling.getProId()); |
| | | List<TjProject> projectList = projectService.list(wq); |
| | | List<String> collect = new ArrayList<>(); |
| | | for (TjProject project : projectList) { |
| | | Long proId = project.getProId(); |
| | | collect.add(String.valueOf(proId)); |
| | | } |
| | | LambdaQueryWrapper<TjSampling>wq1=new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjSampling::getTjNum,sampling.getTjNum()); |
| | | wq1.in(TjSampling::getProId,collect); |
| | | LambdaQueryWrapper<TjSampling> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjSampling::getTjNum, sampling.getTjNum()); |
| | | wq1.in(TjSampling::getProId, collect); |
| | | List<TjSampling> samplingList = tjSamplingService.list(wq1); |
| | | if(null !=samplingList && samplingList.size()>0){ |
| | | if (null != samplingList && samplingList.size() > 0) { |
| | | for (TjSampling tjSampling : samplingList) { |
| | | tjSampling.setIsSignFor("0"); |
| | | tjSamplingService.updateById(tjSampling); |