Commit f666a56f authored by mengbali153's avatar mengbali153

标准产值

parent 29e2b3a1
...@@ -89,7 +89,7 @@ public class NormProductionController { ...@@ -89,7 +89,7 @@ public class NormProductionController {
@GetMapping("/statistics") @GetMapping("/statistics")
@ApiOperation("标准产值统计") @ApiOperation("标准产值统计")
public BaseResponse<Page<NormProductionStatistics>> normProductionStatistics(String start, String end, String name, PageQuery pageQuery) { public BaseResponse<Page<NormProductionStatistics>> normProductionStatistics(String start, String end, String name,Integer groupId, PageQuery pageQuery) {
Long startTime = null; Long startTime = null;
Long endTime = null; Long endTime = null;
...@@ -97,9 +97,10 @@ public class NormProductionController { ...@@ -97,9 +97,10 @@ public class NormProductionController {
startTime = DateUtil.parseDate(start).getTime(); startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).getTime(); endTime = DateUtil.parseDate(end).getTime();
} }
//将list拆分成分页 //将list拆分成分页
BaseResponse<List<NormProductionStatistics>> baseResponse = iNormProductionService BaseResponse<List<NormProductionStatistics>> baseResponse = iNormProductionService
.normProductionStatistics(startTime, endTime, name); .normProductionStatistics(startTime, endTime, name, groupId);
if (baseResponse.getCode() == 200) { if (baseResponse.getCode() == 200) {
List<NormProductionStatistics> data = baseResponse.getData(); List<NormProductionStatistics> data = baseResponse.getData();
if (data.size() != 0) { if (data.size() != 0) {
...@@ -147,14 +148,14 @@ public class NormProductionController { ...@@ -147,14 +148,14 @@ public class NormProductionController {
@PostMapping("/export/statistics") @PostMapping("/export/statistics")
@ApiOperation("导出标准产值列表") @ApiOperation("导出标准产值列表")
public void exportNormProductionStatistics(String start, String end, String name, HttpServletResponse response) { public void exportNormProductionStatistics(String start, String end, String name,Integer groupId, HttpServletResponse response) {
Long startTime = null; Long startTime = null;
Long endTime = null; Long endTime = null;
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) { if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime(); startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).getTime(); endTime = DateUtil.parseDate(end).getTime();
} }
iNormProductionService.exportNormProductionStatistics(startTime, endTime, name, response); iNormProductionService.exportNormProductionStatistics(startTime, endTime, name, groupId, response);
} }
@PostMapping("/export/statistics/detail") @PostMapping("/export/statistics/detail")
......
...@@ -30,4 +30,6 @@ public class NormProductionStatistics implements Serializable { ...@@ -30,4 +30,6 @@ public class NormProductionStatistics implements Serializable {
private Integer coefficient; private Integer coefficient;
private Integer groupId;
} }
...@@ -50,5 +50,5 @@ public class NonStandardValueVo { ...@@ -50,5 +50,5 @@ public class NonStandardValueVo {
private Integer userId; private Integer userId;
@ApiModelProperty("部门") @ApiModelProperty("部门")
private String groups; private Integer groups;
} }
...@@ -91,4 +91,10 @@ public class NormProductionVo { ...@@ -91,4 +91,10 @@ public class NormProductionVo {
@ApiModelProperty("检测组名字") @ApiModelProperty("检测组名字")
private String assessName; private String assessName;
/**
* 部门id
*/
@ApiModelProperty("部门id")
private Integer groupId;
} }
...@@ -36,4 +36,6 @@ public class ProductionVo implements Serializable { ...@@ -36,4 +36,6 @@ public class ProductionVo implements Serializable {
private Double nonProductionValue = 0D; private Double nonProductionValue = 0D;
@ApiModelProperty("总产值") @ApiModelProperty("总产值")
private Double productionTotalValue = 0D; private Double productionTotalValue = 0D;
@ApiModelProperty("部门id")
private Integer groupId;
} }
...@@ -59,9 +59,10 @@ public interface INormProductionService extends IService<NormProduction> { ...@@ -59,9 +59,10 @@ public interface INormProductionService extends IService<NormProduction> {
* *
* @param start 开始时间 * @param start 开始时间
* @param end 结束时间 * @param end 结束时间
* @param groupId 部门id
* @return BaseResponse * @return BaseResponse
*/ */
BaseResponse<List<NormProductionStatistics>> normProductionStatistics(Long start, Long end, String name); BaseResponse<List<NormProductionStatistics>> normProductionStatistics(Long start, Long end, String name, Integer groupId);
/** /**
* 标准产值统计 单人详情 * 标准产值统计 单人详情
...@@ -74,6 +75,14 @@ public interface INormProductionService extends IService<NormProduction> { ...@@ -74,6 +75,14 @@ public interface INormProductionService extends IService<NormProduction> {
List<NormProduction.NormProductionDetail> normProductionDetails(Integer userId, List<NormProduction.NormProductionDetail> normProductionDetails(Integer userId,
Long start, Long end); Long start, Long end);
/**
* 总产值统计
*
* @param name 用户
* @param start 开始时间
* @param end 结束时间
* @return 详细信息
*/
List<ProductionVo> production(String name,Long start,Long end); List<ProductionVo> production(String name,Long start,Long end);
/** /**
...@@ -81,9 +90,10 @@ public interface INormProductionService extends IService<NormProduction> { ...@@ -81,9 +90,10 @@ public interface INormProductionService extends IService<NormProduction> {
* @param start 开始时间 * @param start 开始时间
* @param end 结束时间 * @param end 结束时间
* @param name 人员名字 * @param name 人员名字
* @param groupId 部门id
* @param response 响应体 * @param response 响应体
*/ */
void exportNormProductionStatistics(Long start, Long end, String name, HttpServletResponse response); void exportNormProductionStatistics(Long start, Long end,String name,Integer groupId, HttpServletResponse response);
/** /**
* 导出标准统计详情 * 导出标准统计详情
......
...@@ -83,7 +83,7 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap ...@@ -83,7 +83,7 @@ public class NonStandardValueServiceImpl extends ServiceImpl<NonStandardValueMap
finalNonStandardValue.setUserId(nonStandardValue.getUserId()); finalNonStandardValue.setUserId(nonStandardValue.getUserId());
finalNonStandardValue.setName(nonStandardValue.getName()); finalNonStandardValue.setName(nonStandardValue.getName());
finalNonStandardValue.setAccount(nonStandardValue.getAccount()); finalNonStandardValue.setAccount(nonStandardValue.getAccount());
finalNonStandardValue.setGroups(nonStandardValue.getId()); finalNonStandardValue.setGroups(nonStandardValue.getGroups());
Integer newId=finalNonStandardValue.getId()+1; Integer newId=finalNonStandardValue.getId()+1;
finalNonStandardValue.setId(newId); finalNonStandardValue.setId(newId);
......
...@@ -234,7 +234,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -234,7 +234,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
} }
@Override @Override
public BaseResponse<List<NormProductionStatistics>> normProductionStatistics(Long start, Long end, String name) { public BaseResponse<List<NormProductionStatistics>> normProductionStatistics(Long start, Long end, String name, Integer groupId) {
//统计分样处理的详情 //统计分样处理的详情
List<NormProduction.NormProductionDetail> normProductionDetails = List<NormProduction.NormProductionDetail> normProductionDetails =
...@@ -288,6 +288,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -288,6 +288,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
productionStatistics.setSex(sysUser.getSex() == 0 ? "女" : "男"); productionStatistics.setSex(sysUser.getSex() == 0 ? "女" : "男");
productionStatistics.setUserId(sysUser.getId() + ""); productionStatistics.setUserId(sysUser.getId() + "");
productionStatistics.setUserName(sysUser.getName()); productionStatistics.setUserName(sysUser.getName());
productionStatistics.setGroupId(sysUser.getGroupId());
SysPost sysPost = sysPosts.stream() SysPost sysPost = sysPosts.stream()
.filter(arg -> arg.getId().intValue() == sysUser.getPostId()). .filter(arg -> arg.getId().intValue() == sysUser.getPostId()).
...@@ -301,6 +302,13 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -301,6 +302,13 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
List<NormProductionStatistics> collect = rts.stream().filter(arg -> arg.getUserName().contains(name)).collect(Collectors.toList()); List<NormProductionStatistics> collect = rts.stream().filter(arg -> arg.getUserName().contains(name)).collect(Collectors.toList());
return BaseResponse.okData(collect); return BaseResponse.okData(collect);
} }
//过滤部门id
if (groupId != null){
List<NormProductionStatistics> collect = rts.stream().filter(arg -> arg.getGroupId().equals(groupId)).collect(Collectors.toList());
return BaseResponse.okData(collect);
}
return BaseResponse.okData(rts); return BaseResponse.okData(rts);
} }
...@@ -361,6 +369,10 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -361,6 +369,10 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
.filter(opt -> opt.getId().intValue() == arg.getUserId()) .filter(opt -> opt.getId().intValue() == arg.getUserId())
.findFirst() .findFirst()
.ifPresent(sysUser -> arg.setUserName(sysUser.getName()))); .ifPresent(sysUser -> arg.setUserName(sysUser.getName())));
rts.forEach(arg -> users.stream()
.filter(opt -> opt.getId().intValue() == arg.getUserId())
.findFirst()
.ifPresent(sysUser -> arg.setGroupId(sysUser.getGroupId())));
return rts; return rts;
} }
...@@ -382,7 +394,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -382,7 +394,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
//非标准产值 //非标准产值
List<NonStandardValue> nonStandardValues = iNonStandardValueService.nonValue(startDate, endDate ,group).getData(); List<NonStandardValue> nonStandardValues = iNonStandardValueService.nonValue(startDate, endDate ,group).getData();
//标准产值 //标准产值
List<NormProductionStatistics> productionStatistics = this.normProductionStatistics(start, end, name).getData(); List<NormProductionStatistics> productionStatistics = this.normProductionStatistics(start, end, name, group).getData();
//以userId找关系 //以userId找关系
Set<String> userIds = new HashSet<>(); Set<String> userIds = new HashSet<>();
nonStandardValues.forEach(arg -> userIds.add(arg.getUserId() + "")); nonStandardValues.forEach(arg -> userIds.add(arg.getUserId() + ""));
...@@ -424,6 +436,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -424,6 +436,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
arg.setUserName(opt.getName()); arg.setUserName(opt.getName());
arg.setAccount(opt.getUsername()); arg.setAccount(opt.getUsername());
arg.setPositionId(opt.getPostId()); arg.setPositionId(opt.getPostId());
arg.setGroupId(opt.getGroupId());
}); });
//关联职务 //关联职务
sysPosts.stream().filter(opt -> arg.getPositionId().intValue() == opt.getId()) sysPosts.stream().filter(opt -> arg.getPositionId().intValue() == opt.getId())
...@@ -443,12 +456,12 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -443,12 +456,12 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
@Override @Override
public void exportNormProductionStatistics(Long start, Long end, String name, HttpServletResponse response) { public void exportNormProductionStatistics(Long start, Long end, String name,Integer groupId, HttpServletResponse response) {
BaseResponse<List<NormProductionStatistics>> listBaseResponse = normProductionStatistics(start, end, name); BaseResponse<List<NormProductionStatistics>> listBaseResponse = normProductionStatistics(start, end, name, groupId);
if (listBaseResponse.getCode() == 200) { if (listBaseResponse.getCode() == 200) {
List<NormProductionStatistics> data = listBaseResponse.getData(); List<NormProductionStatistics> data = listBaseResponse.getData();
if (CollectionUtil.isNotEmpty(data)) { if (CollectionUtil.isNotEmpty(data)) {
String[] headers = new String[8]; String[] headers = new String[9];
headers[0] = "用户编号"; headers[0] = "用户编号";
headers[1] = "用户名"; headers[1] = "用户名";
headers[2] = "账号"; headers[2] = "账号";
...@@ -457,10 +470,11 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -457,10 +470,11 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
headers[5] = "统计时间"; headers[5] = "统计时间";
headers[6] = "检测项目数"; headers[6] = "检测项目数";
headers[7] = "产值绩效"; headers[7] = "产值绩效";
headers[8] = "部门id";
List<Object[]> exportData = new ArrayList<>(data.size()); List<Object[]> exportData = new ArrayList<>(data.size());
for (NormProductionStatistics productionStatistics : data) { for (NormProductionStatistics productionStatistics : data) {
Object[] objs = new Object[8]; Object[] objs = new Object[9];
objs[0] = productionStatistics.getUserId(); objs[0] = productionStatistics.getUserId();
objs[1] = productionStatistics.getUserName(); objs[1] = productionStatistics.getUserName();
objs[2] = productionStatistics.getAccount(); objs[2] = productionStatistics.getAccount();
...@@ -469,6 +483,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper, ...@@ -469,6 +483,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
objs[5] = productionStatistics.getTime(); objs[5] = productionStatistics.getTime();
objs[6] = productionStatistics.getCount(); objs[6] = productionStatistics.getCount();
objs[7] = productionStatistics.getCoefficient(); objs[7] = productionStatistics.getCoefficient();
objs[8] = productionStatistics.getGroupId();
exportData.add(objs); exportData.add(objs);
} }
ExcelUtil.excelExport( ExcelUtil.excelExport(
......
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