Commit 69520eee authored by 竹天卫's avatar 竹天卫
parents 469d8fda a9af5ea7
......@@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
......@@ -134,6 +135,7 @@ public class NormProductionController {
}
@GetMapping("/total/production")
@ApiOperation("总产值统计")
public BaseResponse production(PageQuery pageQuery, String name, String start, String end) {
Long startTime = null;
......@@ -148,5 +150,44 @@ public class NormProductionController {
return BaseResponse.okData(PageUtil.listConvertToPage(rts, pageQuery));
}
@GetMapping("/export/statistics")
@ApiOperation("导出标准产值列表")
public void exportNormProductionStatistics(String start, String end, String name, HttpServletResponse response) {
Long startTime = null;
Long endTime = null;
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).getTime();
}
iNormProductionService.exportNormProductionStatistics(startTime, endTime, name, response);
}
@GetMapping("/export/statistics/detail")
@ApiOperation("导出个人标准产值详情列表")
public void exportNormProductionDetails(Integer userId, String start,
String end, HttpServletResponse response) {
Long startTime = null;
Long endTime = null;
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).getTime();
}
iNormProductionService.exportNormProductionDetail(userId, startTime, endTime, response);
}
@GetMapping("/export/total/production")
@ApiOperation("导出总产值")
public void exportProduction(String name, String start, String end, HttpServletResponse response) {
Long startTime = null;
Long endTime = null;
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).getTime();
}
iNormProductionService.exportProduction(name, startTime, endTime, response);
}
}
......@@ -3,6 +3,7 @@ package cn.wise.sc.cement.business.controller;
import cn.wise.sc.cement.business.entity.EntrustReport;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.ReportDetailVo;
import cn.wise.sc.cement.business.model.vo.EntrustVo;
import cn.wise.sc.cement.business.service.IEntrustService;
import cn.wise.sc.cement.business.util.PageUtil;
......@@ -73,19 +74,14 @@ public class ReportController {
@GetMapping("/{entrustId}")
@ApiOperation("获取报告详情")
public BaseResponse<Page<EntrustReport>> getReportDetail(@PathVariable("entrustId") Integer entrustId, PageQuery pageQuery) {
public BaseResponse<ReportDetailVo> getReportDetail(@PathVariable("entrustId") Integer entrustId, PageQuery pageQuery) {
List<EntrustReport> entrustReports = iEntrustService.getReportDetail(entrustId);
if (entrustReports.size() != 0) {
//过滤 id==null 和 projectType != '常规项目'
List<EntrustReport> list = entrustReports.stream()
.filter(arg -> arg.getId() != null && "常规项目".equals(arg.getProjectType()))
.collect(Collectors.toList());
Page<EntrustReport> rts = PageUtil.listConvertToPage(list, pageQuery);
ReportDetailVo rts = iEntrustService.getReportDetail(entrustId);
if (rts ==null) {
return BaseResponse.errorMsg("没找到相关数据!");
}else {
return BaseResponse.okData(rts);
}
return BaseResponse.errorMsg("没找到相关数据!");
}
}
......@@ -2,6 +2,8 @@ package cn.wise.sc.cement.business.entity;
import lombok.Data;
import java.util.Date;
/**
* @description: 委托报告
* @author: qh
......@@ -25,7 +27,7 @@ public class EntrustReport {
/**
* 委托方id
*/
private Integer clintId;
private Integer clientId;
/**
* 样品id
......@@ -86,4 +88,9 @@ public class EntrustReport {
* 项目类型
*/
private String projectType;
/**
* 样品创建时间
*/
private Date sendTime;
}
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
......@@ -22,4 +23,10 @@ public interface EquipmentUseMapper extends BaseMapper<EquipmentUse> {
IPage<EquipmentUseVo> getPage(@Param("page") Page page, @Param("params") Map<String, Object> params);
/**
* 根据项目id获取使用到的设备名字
* @param entrustId 项目id
* @return list
*/
List<String> getEquipmentNamesByProjectId(@Param("param") Integer entrustId);
}
......@@ -242,7 +242,7 @@
SELECT e.id,e.project_name,e.send_name,e.client_id,e.entrust_code,e.project_type,sscct.* FROM entrust e
RIGHT JOIN
(SELECT id as sample_id,entrust_id,team_ids,method_numbers,name,scct.check_id,
scct.equipment_name,scct.user_id FROM sample s
scct.equipment_name,scct.user_id,create_time as send_time FROM sample s
RIGHT JOIN
(SELECT check_id,equipment_name,sample_id,user_id FROM sample_check_team sct
LEFT JOIN
......@@ -250,6 +250,7 @@
ON sct.check_id = sc.id) scct
ON s.sample_id = scct.sample_id) sscct
ON sscct.entrust_id = e.id AND e.id = #{entrustId}
WHERE id IS NOT NULL
</select>
<select id="getQualityDetail" resultType="cn.wise.sc.cement.business.entity.QualityDetail">
......
......@@ -24,6 +24,13 @@
<include refid="where" />
ORDER BY et.create_time ASC
</select>
<select id="getEquipmentNamesByProjectId" resultType="java.lang.String">
SELECT CONCAT(e.`name`,' (',e.`code`,')') FROM equipment_use eu
RIGHT JOIN
(SELECT `name`,id,`code` FROM equipment) e
ON eu.equipment_id = e.id AND eu.project_id = #{param}
WHERE eu.id IS NOT NULL
</select>
</mapper>
package cn.wise.sc.cement.business.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Set;
/**
* @description: 报告详情Vo
* @author: qh
* @create: 2020-10-10 09:38
**/
@Data
@ApiModel("报告首页信息")
public class ReportDetailVo implements Serializable {
private static final long serialVersionUID = 42L;
@ApiModelProperty("报告编号")
private String reportNo;
@ApiModelProperty("送样单位")
private String sendName;
@ApiModelProperty("送样人")
private String sender;
@ApiModelProperty("送样日期")
private String sendDate;
@ApiModelProperty("样品数量")
private Integer sampleNum;
@ApiModelProperty("样品名称")
private Set<String> sampleNames;
@ApiModelProperty("检测类别")
private String type="委托";
@ApiModelProperty("检测项目")
private Set<String> teamNames;
@ApiModelProperty("检测依据")
private Set<String> methodNames;
@ApiModelProperty("主要仪器设备(编号)")
private Set<String> equipmentNames;
@ApiModelProperty("项目名称")
private String projectName;
@ApiModelProperty("签发日期")
private String printDate;
}
......@@ -6,6 +6,7 @@ import cn.wise.sc.cement.business.entity.SampleDistribution;
import cn.wise.sc.cement.business.entity.SampleHandleEnclosure;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.ReportDetailVo;
import cn.wise.sc.cement.business.model.query.*;
import cn.wise.sc.cement.business.model.vo.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -86,7 +87,7 @@ public interface IEntrustService extends IService<Entrust> {
BaseResponse<Boolean> deleteById(Integer id);
List<EntrustReport> getReportDetail(Integer entrustId);
ReportDetailVo getReportDetail(Integer entrustId);
BaseResponse<IPage<EntrustVo>> getQualityPage(PageQuery pageQuery,
String startDate, String endDate,
......
......@@ -9,6 +9,7 @@ import cn.wise.sc.cement.business.model.vo.ProductionVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
......@@ -74,4 +75,31 @@ public interface INormProductionService extends IService<NormProduction> {
Long start, Long end);
List<ProductionVo> production(String name,Long start,Long end);
/**
* 导出标准统计
* @param start 开始时间
* @param end 结束时间
* @param name 人员名字
* @param response 响应体
*/
void exportNormProductionStatistics(Long start, Long end, String name, HttpServletResponse response);
/**
* 导出标准统计详情
* @param userId 用户id
* @param startTime 开始时间
* @param endTime 结束时间
* @param response 响应体
*/
void exportNormProductionDetail(Integer userId, Long startTime, Long endTime, HttpServletResponse response);
/**
* 导出产值总统计列表
* @param name 名字检索
* @param startTime 开始时间
* @param endTime 结束时间
* @param response 响应体
*/
void exportProduction(String name, Long startTime, Long endTime,HttpServletResponse response);
}
package cn.wise.sc.cement.business.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.wise.sc.cement.business.entity.*;
import cn.wise.sc.cement.business.mapper.*;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.LoginUser;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.ReportDetailVo;
import cn.wise.sc.cement.business.model.query.*;
import cn.wise.sc.cement.business.model.vo.*;
import cn.wise.sc.cement.business.service.*;
import cn.wise.sc.cement.business.util.CheckCountUtil;
import cn.wise.sc.cement.business.util.ExcelUtil;
import cn.wise.sc.cement.business.util.PageUtil;
import cn.wise.sc.cement.business.util.RedisUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -360,6 +363,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
/**
* 详情-基本信息
*
* @param id
* @return
*/
......@@ -418,10 +422,11 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
/**
* 详情-样品处理信息
*
* @param id
* @return
*/
public BaseResponse< List<SampleHandleVo>> getSampleHandleDtail(Integer id) {
public BaseResponse<List<SampleHandleVo>> getSampleHandleDtail(Integer id) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
......@@ -466,6 +471,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
/**
* 详情-检测任务信息
*
* @param id
* @return
*/
......@@ -523,12 +529,6 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
/**
* 获取样品表里最大的平行样编号
*
......@@ -581,9 +581,9 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
Entrust entrust = entrustMapper.selectById(entrustVo.getId());
//如果项目id或者项目编号为空,根据项目名称获取项目信息
if(StringUtils.isEmpty(entrust.getProjectCode())){
if (StringUtils.isEmpty(entrust.getProjectCode())) {
ProjectVo projectVo = projectMapper.getByName(entrust.getProjectName());
if(projectVo == null){
if (projectVo == null) {
return BaseResponse.errorMsg("请添加项目信息");
}
entrust.setProjectId(projectVo.getId())
......@@ -1853,25 +1853,12 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
@Override
@Transactional(rollbackFor = Exception.class)
public BaseResponse<Boolean> deleteById(Integer id) {
if (id == null || id <= 0) {
return BaseResponse.errorMsg("id编号不能为空!");
}
Entrust entrust = this.getById(id);
entrust.setIsDelete(0);
boolean b = this.updateById(entrust);
return BaseResponse.okData(b);
}
@Override
public List<EntrustReport> getReportDetail(Integer entrustId) {
public ReportDetailVo getReportDetail(Integer entrustId) {
List<EntrustReport> list = entrustMapper.getReportDetail(entrustId);
String teamKey = "CACHE:TEAM";
String methodKey = "METHOD:KEY";
String methodKey = "CACHE:METHOD";
//缓存 60s
if (!redisUtil.existsKey(teamKey)) {
......@@ -1908,16 +1895,37 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
methods.forEach(opt -> {
if (opt.getId() == id) {
if (StrUtil.isBlank(arg.getMethodName())) {
arg.setMethodName(opt.getName());
arg.setMethodName(opt.getName() + " " + opt.getStandard());
} else {
arg.setMethodName(arg.getMethodName() + "、" + opt.getName());
arg.setMethodName(arg.getMethodName() + "、" + opt.getName() + " " + opt.getStandard());
}
}
});
}
});
return list;
if (list.size() != 0) {
//过滤 id==null 和 projectType != '常规项目'
List<EntrustReport> normalList = list.stream()
.filter(arg -> arg.getId() != null && "常规项目".equals(arg.getProjectType()))
.collect(Collectors.toList());
return initReportDetailVo(normalList);
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public BaseResponse<Boolean> deleteById(Integer id) {
if (id == null || id <= 0) {
return BaseResponse.errorMsg("id编号不能为空!");
}
Entrust entrust = this.getById(id);
entrust.setIsDelete(0);
boolean b = this.updateById(entrust);
return BaseResponse.okData(b);
}
......@@ -1985,7 +1993,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return null;
}
//处理inputValue
qualityDetails.forEach(arg->arg.setInputResult(mapStringToMap(arg.getInputResult())));
qualityDetails.forEach(arg -> arg.setInputResult(mapStringToMap(arg.getInputResult())));
QualityDetail firstQualityDetail = qualityDetails.get(0);
QualityDetailVo qualityDetailVo = new QualityDetailVo();
......@@ -2065,21 +2073,81 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return JSON.toJSONString(map);
}
/**
* 根据样品检测列表获取报告管理首页
*
* @param source 样品检测
* @return ReportDetailVo
*/
private ReportDetailVo initReportDetailVo(List<EntrustReport> source) {
if (source.size() == 0) {
return null;
}
ReportDetailVo rts = new ReportDetailVo();
EntrustReport firstReportDetail = source.get(0);
//初始化标准信息
rts.setPrintDate(DateUtil.format(new Date(), "yyyy年MM月dd日"));
rts.setSender(firstReportDetail.getSendName());
rts.setSendDate(DateUtil.format(firstReportDetail.getSendTime(),"yyyy年MM月dd日"));
rts.setProjectName(firstReportDetail.getProjectName());
rts.setSendName("\\");
//获取检测项目、检测仪器、检测依据
rts.setEquipmentNames(new HashSet<>(source.size()));
rts.setSampleNames(new HashSet<>(source.size()));
rts.setMethodNames(new HashSet<>(source.size()));
rts.setTeamNames(new HashSet<>(source.size()));
source.forEach(arg -> {
//关联检测项目
if (StrUtil.isNotBlank(arg.getTeamName())) {
String[] teamSplits = arg.getTeamName().split("、");
for (String teamName : teamSplits) {
rts.getTeamNames().add(teamName);
}
}
//关联检测依据
if (StrUtil.isNotBlank(arg.getMethodName())) {
String[] methodSplits = arg.getMethodNumbers().split("、");
for (String methodName : methodSplits) {
rts.getMethodNames().add(methodName);
}
}
//关联样品名
if (StrUtil.isNotBlank(arg.getName())) {
rts.getSampleNames().add(arg.getName());
}
});
rts.setSampleNum(rts.getSampleNames().size());
//关联仪器名字 去重
List<String> equipmentNames = equipmentUseMapper.getEquipmentNamesByProjectId(firstReportDetail.getEntrustId());
equipmentNames.forEach(arg -> rts.getEquipmentNames().add(arg));
//关联送样单位名字
String clientKey = "CACHE:CLIENT";
if (!redisUtil.existsKey(clientKey)) {
List<Client> clients = clientMapper.selectList(null);
redisUtil.setString(clientKey, JSON.toJSONString(clients), 60);
}
List<Client> clients = JSON.parseArray(redisUtil.getString(clientKey) + "", Client.class);
if (clients.size() == 0) {
log.error("=================送养单位表中没有任何数据!==================");
} else {
clients.stream().filter(arg -> arg.getId().intValue() == firstReportDetail.getClientId())
.findFirst().ifPresent(arg -> rts.setSendName(arg.getName()));
}
return rts;
}
/**
* 委托列表导出
* @param startDate
* @param endDate
* @param status
* @param clientId
* @param projectName
* @param projectCode
* @param fileName
* @param response
*/
@Override
public void export(String startDate, String endDate, Integer status,
Integer clientId, String projectName, String projectCode,
String fileName, HttpServletResponse response){
String fileName, HttpServletResponse response) {
Map<String, Object> params = new HashMap<>();
params.put("startDate", startDate);
params.put("endDate", endDate);
......@@ -2087,7 +2155,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
params.put("clientId", clientId);
params.put("projectName", projectName);
params.put("projectCode", projectCode);
List<Map<String, Object>> list= entrustMapper.exportList(params);
List<Map<String, Object>> list = entrustMapper.exportList(params);
if (!CollectionUtils.isEmpty(list)) {
Map<String, Object> map = list.get(0);
......@@ -2111,14 +2179,14 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
for (int j = 0; j < headers.length; j++) {
String obj = m.get(headers[j]).toString();
//如果序号带小数点 去除.0,保留整数
if(j==0){
if (j == 0) {
obj = obj.split("\\.")[0];
}
objects[j] = obj;
}
//根据委托编号id 获取所有样品的检测项目 和 检测依据编号
Integer entrustId = Integer.valueOf(m.get("entrustId").toString());
Integer entrustId = Integer.valueOf(m.get("entrustId").toString());
System.out.println(entrustId);
QueryWrapper<SampleTmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entrust_id", entrustId);
......@@ -2151,21 +2219,13 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
datas.add(objects);
}
ExcelUtil.excelExport(
fileName == null || fileName.trim().length() <= 0 ? "委托列表": fileName, headers,
fileName == null || fileName.trim().length() <= 0 ? "委托列表" : fileName, headers,
datas, response);
}
}
}
}
package cn.wise.sc.cement.business.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
......@@ -29,14 +30,17 @@ import cn.wise.sc.cement.business.service.ISampleHandleService;
import cn.wise.sc.cement.business.service.ISysPostService;
import cn.wise.sc.cement.business.service.ISysUserService;
import cn.wise.sc.cement.business.service.ITeamGroupService;
import cn.wise.sc.cement.business.util.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
......@@ -276,6 +280,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
NormProductionStatistics productionStatistics = new NormProductionStatistics();
productionStatistics.setAccount(sysUser.getUsername());
productionStatistics.setCoefficient(coefficientMap.get(userId).intValue());
productionStatistics.setTime("/");
productionStatistics.setCount(normProductionDetails.stream()
.filter(arg -> arg.getUserId().intValue() == sysUser.getId())
.count());
......@@ -415,7 +420,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
Date finalStartDate = startDate;
Date finalEndDate = endDate;
rts.forEach(arg -> {
arg.setTime(finalStartDate == null ? "--" + finalEndDate.toString() : finalStartDate.toString() + "--" + finalEndDate.toString());
arg.setTime(finalStartDate == null ? "/" : DateUtil.format(finalStartDate, "yyyy-MM-dd") + "--" + DateUtil.format(finalEndDate, "yyyy-MM-dd"));
if (StrUtil.isBlank(arg.getUserName())) {
//关联用户信息
users.stream().filter(opt -> arg.getUserId().equals(opt.getId() + "")).findFirst()
......@@ -440,6 +445,112 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
return rts;
}
@Override
public void exportNormProductionStatistics(Long start, Long end, String name, HttpServletResponse response) {
BaseResponse<List<NormProductionStatistics>> listBaseResponse = normProductionStatistics(start, end, name);
if (listBaseResponse.getCode() == 200) {
List<NormProductionStatistics> data = listBaseResponse.getData();
if (CollectionUtil.isNotEmpty(data)) {
String[] headers = new String[8];
headers[0] = "用户编号";
headers[1] = "用户名";
headers[2] = "账号";
headers[3] = "性别";
headers[4] = "职务";
headers[5] = "统计时间";
headers[6] = "检测项目数";
headers[7] = "产值绩效";
List<Object[]> exportData = new ArrayList<>(data.size());
for (NormProductionStatistics productionStatistics : data) {
Object[] objs = new Object[8];
objs[0] = productionStatistics.getUserId();
objs[1] = productionStatistics.getUserName();
objs[2] = productionStatistics.getAccount();
objs[3] = productionStatistics.getSex();
objs[4] = productionStatistics.getPosition();
objs[5] = productionStatistics.getTime();
objs[6] = productionStatistics.getCount();
objs[7] = productionStatistics.getCoefficient();
exportData.add(objs);
}
ExcelUtil.excelExport(
"标准产值统计", headers,
exportData, response);
}
}
}
@Override
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[11];
headers[0] = "序号";
headers[1] = "名字";
headers[2] = "检测项目";
headers[3] = "所属项目";
headers[4] = "项目编号";
headers[5] = "检测时间";
headers[6] = "分析占比";
headers[7] = "分样占比";
headers[8] = "校核占比";
headers[9] = "报结果占比";
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[11];
objs[0] = count++;
objs[1] = target.getUserName();
objs[2] = target.getGroupTeamName();
objs[3] = target.getProjectName();
objs[4] = target.getEntrustCode();
objs[5] = target.getCheckTime() == null ? "/" : target.getCheckTime().format(timeFormatter);
objs[6] = target.getAnalyseRate();
objs[7] = target.getSeparateRate();
objs[8] = target.getAssessRate();
objs[9] = target.getReportedResultRate();
objs[10] = target.getWorkTimeCoefficient();
exportData.add(objs);
}
ExcelUtil.excelExport("标准产值详情—" + normProductionDetails.get(0).getUserName(), headers, exportData, response);
}
}
@Override
public void exportProduction(String name, Long startTime, Long endTime, HttpServletResponse response) {
List<ProductionVo> data = production(name, startTime, endTime);
if (CollectionUtil.isNotEmpty(data)) {
String[] headers = new String[8];
headers[0] = "序号";
headers[1] = "姓名";
headers[2] = "账户";
headers[3] = "职务";
headers[4] = "统计时间";
headers[5] = "标准产值";
headers[6] = "非标准产值";
headers[7] = "产值统计";
List<Object[]> exportData = new ArrayList<>(data.size());
int count = 0;
for (ProductionVo target : data) {
Object[] objs = new Object[8];
objs[0] = count++;
objs[1] = target.getUserName();
objs[2] = target.getAccount();
objs[3] = target.getPosition();
objs[4] = target.getTime();
objs[5] = target.getProductionValue();
objs[6] = target.getNonProductionValue();
objs[7] = target.getProductionTotalValue();
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