Commit a9018979 authored by qinhu's avatar qinhu

产值条件判断

parent 7fd10547
package cn.wise.sc.cement.business.controller; package cn.wise.sc.cement.business.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.wise.sc.cement.business.entity.NormProduction; import cn.wise.sc.cement.business.entity.NormProduction;
...@@ -118,7 +119,7 @@ public class NormProductionController { ...@@ -118,7 +119,7 @@ public class NormProductionController {
return BaseResponse.okData(rts); return BaseResponse.okData(rts);
} }
} }
return BaseResponse.errorMsg("没有找到相关数据!"); return BaseResponse.okData(null);
} }
@GetMapping("/statistics/detail") @GetMapping("/statistics/detail")
...@@ -141,7 +142,7 @@ public class NormProductionController { ...@@ -141,7 +142,7 @@ public class NormProductionController {
Page<NormProduction.NormProductionDetail> rts = PageUtil.listConvertToPage(collect, pageQuery); Page<NormProduction.NormProductionDetail> rts = PageUtil.listConvertToPage(collect, pageQuery);
return BaseResponse.okData(rts); return BaseResponse.okData(rts);
} }
return BaseResponse.errorMsg("没有找到相关数据!"); return BaseResponse.okData(null);
} }
@GetMapping("/total/production") @GetMapping("/total/production")
...@@ -156,7 +157,7 @@ public class NormProductionController { ...@@ -156,7 +157,7 @@ public class NormProductionController {
} }
List<ProductionVo> rts = iNormProductionService.production(name, startTime, endTime, groupId); List<ProductionVo> rts = iNormProductionService.production(name, startTime, endTime, groupId);
if (!rts.isEmpty()) { if (!CollectionUtil.isEmpty(rts)) {
Set<Integer> ids = new HashSet<>(); Set<Integer> ids = new HashSet<>();
for (ProductionVo productionVo : rts) { for (ProductionVo productionVo : rts) {
Integer groupId1 = productionVo.getGroupId(); Integer groupId1 = productionVo.getGroupId();
......
...@@ -61,7 +61,7 @@ public class QualityController { ...@@ -61,7 +61,7 @@ public class QualityController {
List<EntrustVo> records = baseResponse.getData().getRecords(); List<EntrustVo> records = baseResponse.getData().getRecords();
if (records.size() == 0) { if (records.size() == 0) {
return BaseResponse.errorMsg("没找到相关数据!"); return BaseResponse.okData(null);
} }
List<Integer> projectIds = records.stream().map(EntrustVo::getId).collect(Collectors.toList()); List<Integer> projectIds = records.stream().map(EntrustVo::getId).collect(Collectors.toList());
Set<Integer> qualityApplyIds = iQualityApplyService.selectQualityApplyStatusByProIds(projectIds); Set<Integer> qualityApplyIds = iQualityApplyService.selectQualityApplyStatusByProIds(projectIds);
......
...@@ -250,7 +250,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -250,7 +250,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
normProductionDetails(null, start, end); normProductionDetails(null, start, end);
if (normProductionDetails.size() == 0) { if (normProductionDetails.size() == 0) {
BaseResponse<List<NormProductionStatistics>> rts = BaseResponse.errorMsg("没找到相关数据!"); BaseResponse<List<NormProductionStatistics>> rts = BaseResponse.okData(null);
rts.setData(new ArrayList<>()); rts.setData(new ArrayList<>());
return rts; return rts;
} }
...@@ -435,6 +435,9 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -435,6 +435,9 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
//处理非标准产值没有用名职位信息 //处理非标准产值没有用名职位信息
QueryWrapper<SysUser> qw = new QueryWrapper<>(); QueryWrapper<SysUser> qw = new QueryWrapper<>();
qw.in("id", userIds); qw.in("id", userIds);
if(CollectionUtil.isEmpty(userIds)){
return null;
}
List<SysUser> users = iSysUserService.list(qw); List<SysUser> users = iSysUserService.list(qw);
List<SysPost> sysPosts = iSysPostService.list(); List<SysPost> sysPosts = iSysPostService.list();
List<SysGroup> sysGroups = iSysGroupService.list(); List<SysGroup> sysGroups = iSysGroupService.list();
......
package cn.wise.sc.cement.business.util; package cn.wise.sc.cement.business.util;
import cn.hutool.core.collection.CollectionUtil;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -13,6 +14,9 @@ import java.util.List; ...@@ -13,6 +14,9 @@ import java.util.List;
public class PageUtil { public class PageUtil {
public static <T> Page<T> listConvertToPage(List<T> list, PageQuery pageQuery) { public static <T> Page<T> listConvertToPage(List<T> list, PageQuery pageQuery) {
if (CollectionUtil.isEmpty(list)){
return null;
}
int start = pageQuery.getPageNo() > 0 ? pageQuery.getPageNo() : 1; int start = pageQuery.getPageNo() > 0 ? pageQuery.getPageNo() : 1;
int pageSize = pageQuery.getPageSize() > 0 ? pageQuery.getPageSize() : 10; int pageSize = pageQuery.getPageSize() > 0 ? pageQuery.getPageSize() : 10;
int end = Math.min((start * pageSize), list.size()); int end = Math.min((start * pageSize), list.size());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment