Commit cd8e18c0 authored by mengbali153's avatar mengbali153

标准产值

parent fc0eef77
......@@ -164,6 +164,7 @@ public class NormProductionController {
finalNormProduction.setPosition(productionVo.getPosition());
finalNormProduction.setTime(productionVo.getTime());
finalNormProduction.setGroupId(productionVo.getGroupId());
finalNormProduction.setGroupName(productionVo.getGroupName());
Double newFinalValue=productionVo.getProductionTotalValue()+finalNormProduction.getProductionTotalValue();
finalNormProduction.setProductionTotalValue(newFinalValue);
......
......@@ -120,7 +120,6 @@ public class NormProduction implements Serializable {
private BigDecimal workTimeCoefficient;
private Integer type;
private String groupTeamName;
private Integer groupId;
}
}
......@@ -38,4 +38,6 @@ public class ProductionVo implements Serializable {
private Double productionTotalValue = 0D;
@ApiModelProperty("部门id")
private Integer groupId;
@ApiModelProperty("部门名")
private String groupName;
}
......@@ -5,17 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.wise.sc.cement.business.entity.EntrustSample;
import cn.wise.sc.cement.business.entity.Handle;
import cn.wise.sc.cement.business.entity.NonStandardValue;
import cn.wise.sc.cement.business.entity.NormProduction;
import cn.wise.sc.cement.business.entity.NormProductionStatistics;
import cn.wise.sc.cement.business.entity.SampleCheckTeam;
import cn.wise.sc.cement.business.entity.SampleDistribution;
import cn.wise.sc.cement.business.entity.SampleHandle;
import cn.wise.sc.cement.business.entity.SysPost;
import cn.wise.sc.cement.business.entity.SysUser;
import cn.wise.sc.cement.business.entity.TeamGroup;
import cn.wise.sc.cement.business.entity.*;
import cn.wise.sc.cement.business.mapper.NormProductionMapper;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
......@@ -261,13 +251,19 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
qw.in("id", userIds);
List<SysUser> users = iSysUserService.list(qw);
List<SysPost> sysPosts = iSysPostService.list();
List<SysGroup> sysGroups = iSysGroupService.list();
for (Integer userId : coefficientMap.keySet()) {
SysUser sysUser = users.stream()
.filter(arg -> arg.getId().intValue() == userId)
.findFirst().orElse(null);
SysGroup sysGroup = sysGroups.stream().filter(arg -> arg.getId().intValue() == userId)
.findFirst().orElse(null);
if (sysUser == null) {
continue;
}
if (sysGroup == null) {
continue;
}
NormProductionStatistics productionStatistics = new NormProductionStatistics();
productionStatistics.setAccount(sysUser.getUsername());
productionStatistics.setCoefficient(coefficientMap.get(userId).doubleValue());
......@@ -285,11 +281,17 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
productionStatistics.setUserId(sysUser.getId() + "");
productionStatistics.setUserName(sysUser.getName());
productionStatistics.setGroupId(sysUser.getGroupId());
productionStatistics.setGroupName(sysGroup.getName());
SysPost sysPost = sysPosts.stream()
.filter(arg -> arg.getId().intValue() == sysUser.getPostId()).
findFirst().orElse(null);
SysGroup sysGroup1 = sysGroups.stream()
.filter(arg -> arg.getId().intValue() == sysGroup.getId()).
findFirst().orElse(null);
productionStatistics.setPosition(sysPost == null ? "职务一" : sysPost.getName());
productionStatistics.setGroupName(sysGroup == null ? "部门名" : sysGroup.getName());
rts.add(productionStatistics);
}
......@@ -357,6 +359,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
List<Integer> userIds = rts.stream()
.map(NormProduction.NormProductionDetail::getUserId)
.collect(Collectors.toList());
if (userIds.size() == 0) {
return new ArrayList<>();
}
......@@ -365,10 +368,6 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
.filter(opt -> opt.getId().intValue() == arg.getUserId())
.findFirst()
.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;
}
......@@ -406,6 +405,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
productionVo.setPosition(opt.getPosition());
productionVo.setAccount(opt.getAccount());
productionVo.setGroupId(opt.getGroupId());
productionVo.setGroupName(opt.getGroupName());
}
});
//找到标准产值里面的数据
......@@ -421,6 +421,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
qw.in("id", userIds);
List<SysUser> users = iSysUserService.list(qw);
List<SysPost> sysPosts = iSysPostService.list();
List<SysGroup> sysGroups = iSysGroupService.list();
Date finalStartDate = startDate;
Date finalEndDate = endDate;
rts.forEach(arg -> {
......@@ -438,6 +439,10 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
sysPosts.stream().filter(opt -> arg.getPositionId().intValue() == opt.getId())
.findFirst()
.ifPresent(opt -> arg.setPosition(opt.getName()));
sysGroups.stream().filter(opt -> arg.getGroupId().intValue() == opt.getId())
.findFirst()
.ifPresent(opt -> arg.setGroupName(opt.getName()));
}
arg.setProductionTotalValue(arg.getNonProductionValue() + arg.getProductionValue());
});
......@@ -463,7 +468,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
if (listBaseResponse.getCode() == 200) {
List<NormProductionStatistics> data = listBaseResponse.getData();
if (CollectionUtil.isNotEmpty(data)) {
String[] headers = new String[9];
String[] headers = new String[10];
headers[0] = "用户编号";
headers[1] = "用户名";
headers[2] = "账号";
......@@ -473,10 +478,11 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
headers[6] = "检测项目数";
headers[7] = "产值绩效";
headers[8] = "部门id";
headers[9] = "部门名";
List<Object[]> exportData = new ArrayList<>(data.size());
for (NormProductionStatistics productionStatistics : data) {
Object[] objs = new Object[9];
Object[] objs = new Object[10];
objs[0] = productionStatistics.getUserId();
objs[1] = productionStatistics.getUserName();
objs[2] = productionStatistics.getAccount();
......@@ -486,6 +492,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
objs[6] = productionStatistics.getCount();
objs[7] = productionStatistics.getCoefficient();
objs[8] = productionStatistics.getGroupId();
objs[9] = productionStatistics.getGroupName();
exportData.add(objs);
}
ExcelUtil.excelExport(
......@@ -499,7 +506,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
public void exportNormProductionDetail(Integer userId, Long startTime, Long endTime, HttpServletResponse response) {
List<NormProduction.NormProductionDetail> normProductionDetails = normProductionDetails(userId, startTime, endTime);
if (CollectionUtil.isNotEmpty(normProductionDetails)) {
String[] headers = new String[12];
String[] headers = new String[13];
headers[0] = "序号";
headers[1] = "名字";
headers[2] = "检测项目";
......@@ -510,13 +517,12 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
headers[7] = "分样占比";
headers[8] = "校核占比";
headers[9] = "报结果占比";
headers[10] = "部门id";
headers[11] = "合计";
headers[10] = "合计";
List<Object[]> exportData = new ArrayList<>(normProductionDetails.size());
int count = 0;
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日 hh:mm:ss");
for (NormProduction.NormProductionDetail target : normProductionDetails) {
Object[] objs = new Object[12];
Object[] objs = new Object[13];
objs[0] = count++;
objs[1] = target.getUserName();
objs[2] = target.getGroupTeamName();
......@@ -527,8 +533,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
objs[7] = target.getSeparateRate();
objs[8] = target.getAssessRate();
objs[9] = target.getReportedResultRate();
objs[10] = target.getGroupId();
objs[11] = target.getWorkTimeCoefficient();
objs[10] = target.getWorkTimeCoefficient();
exportData.add(objs);
}
ExcelUtil.excelExport("标准产值详情—" + normProductionDetails.get(0).getUserName(), headers, exportData, response);
......@@ -539,7 +544,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
public void exportProduction(String name, Long startTime, Long endTime,Integer groupId, HttpServletResponse response) {
List<ProductionVo> data = production(name, startTime, endTime,groupId);
if (CollectionUtil.isNotEmpty(data)) {
String[] headers = new String[9];
String[] headers = new String[10];
headers[0] = "序号";
headers[1] = "姓名";
headers[2] = "账户";
......@@ -549,10 +554,11 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
headers[6] = "非标准产值";
headers[7] = "产值统计";
headers[8] = "部门id";
headers[9] = "部门名";
List<Object[]> exportData = new ArrayList<>(data.size());
int count = 0;
for (ProductionVo target : data) {
Object[] objs = new Object[9];
Object[] objs = new Object[10];
objs[0] = count++;
objs[1] = target.getUserName();
objs[2] = target.getAccount();
......@@ -562,6 +568,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
objs[6] = target.getNonProductionValue();
objs[7] = target.getProductionTotalValue();
objs[8] = target.getGroupId();
objs[9] = target.getGroupName();
exportData.add(objs);
}
ExcelUtil.excelExport("产值统计", headers, exportData, response);
......
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