Commit a6943c59 authored by qinhu's avatar qinhu

委托单导出

parent d089079d
...@@ -2,10 +2,13 @@ package cn.wise.sc.cement.business.controller; ...@@ -2,10 +2,13 @@ package cn.wise.sc.cement.business.controller;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.FileExt;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.ReportDetailVo; import cn.wise.sc.cement.business.model.ReportDetailVo;
import cn.wise.sc.cement.business.model.query.*; import cn.wise.sc.cement.business.model.query.*;
import cn.wise.sc.cement.business.model.vo.EntrustVo; import cn.wise.sc.cement.business.model.vo.EntrustVo;
import cn.wise.sc.cement.business.model.vo.SampleDistributionTeamVo;
import cn.wise.sc.cement.business.model.vo.SampleVo;
import cn.wise.sc.cement.business.service.IEntrustService; import cn.wise.sc.cement.business.service.IEntrustService;
import cn.wise.sc.cement.business.util.WordUtil; import cn.wise.sc.cement.business.util.WordUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -19,426 +22,457 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -19,426 +22,457 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
* 前端控制器 * 前端控制器
* </p> * </p>
* *
* @author ztw * @author ztw
* @since 2020-08-24 * @since 2020-08-24
*/ */
@Api(tags="委托管理") @Api(tags = "委托管理")
@RestController @RestController
@RequestMapping("/business/entrust") @RequestMapping("/business/entrust")
public class EntrustController { public class EntrustController {
private static final Logger log = LoggerFactory.getLogger("EntrustController"); private static final Logger log = LoggerFactory.getLogger("EntrustController");
@Autowired @Autowired
private IEntrustService entrustService; private IEntrustService entrustService;
@ApiOperation(value = "委托分页列表") @ApiOperation(value = "委托分页列表")
@ApiImplicitParams(value = { @ApiImplicitParams(value = {
@ApiImplicitParam(name = "startDate", value = "开始日期", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "startDate", value = "开始日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "status", @ApiImplicitParam(name = "status",
value = "状态(0未评审,1已通过,2未通过," + value = "状态(0未评审,1已通过,2未通过," +
"3样品处理中,4样品处理完成," + "3样品处理中,4样品处理完成," +
"5样品检测中,6样品检测完成," + "5样品检测中,6样品检测完成," +
"7校核中,8校核完成)", paramType = "query", dataType = "Integer"), "7校核中,8校核完成)", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "clientId", value = "委托单位id", paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "clientId", value = "委托单位id", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "projectCode", value = "项目编号", paramType = "query", dataType = "String") @ApiImplicitParam(name = "projectCode", value = "项目编号", paramType = "query", dataType = "String")
}) })
@GetMapping("/getPage") @GetMapping("/getPage")
public BaseResponse getPage(PageQuery pageQuery, String startDate, String endDate, Integer status, public BaseResponse getPage(PageQuery pageQuery, String startDate, String endDate, Integer status,
Integer clientId, String projectName, String projectCode) { Integer clientId, String projectName, String projectCode) {
try { try {
return entrustService.getPage(pageQuery, startDate, endDate, status, clientId, projectName, projectCode); return entrustService.getPage(pageQuery, startDate, endDate, status, clientId, projectName, projectCode);
} catch (Exception e) { } catch (Exception e) {
log.debug("委托分页列表{}", e); log.debug("委托分页列表{}", e);
} }
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@ApiOperation("委托列表导出") @ApiOperation("委托列表导出")
@PostMapping("/export") @PostMapping("/export")
public void export(String startDate, String endDate, Integer status, public void export(String startDate, String endDate, Integer status,
Integer clientId, String projectName, String projectCode, Integer clientId, String projectName, String projectCode,
String fileName, HttpServletResponse response) { String fileName, HttpServletResponse response) {
try { try {
entrustService.export(startDate, endDate, status, entrustService.export(startDate, endDate, status,
clientId, projectName, projectCode, clientId, projectName, projectCode,
fileName, response); fileName, response);
} catch (Exception e) { } catch (Exception e) {
log.debug("委托列表导出{}", e); log.debug("委托列表导出{}", e);
} }
} }
@ApiOperation(value = "置顶取消置顶 (createTime = updateTime显示置顶,否则显示取消置顶)") @ApiOperation(value = "置顶取消置顶 (createTime = updateTime显示置顶,否则显示取消置顶)")
@PostMapping("/setTopping") @PostMapping("/setTopping")
public BaseResponse setTopping(Integer id) { public BaseResponse setTopping(Integer id) {
try { try {
return entrustService.setTopping(id); return entrustService.setTopping(id);
}catch (Exception e) { } catch (Exception e) {
log.debug("置顶取消置顶{}",e); log.debug("置顶取消置顶{}", e);
} }
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@ApiOperation(value = "新增委托") @ApiOperation(value = "新增委托")
@PostMapping("/create") @PostMapping("/create")
public BaseResponse create(@RequestBody EntrustQuery query) { public BaseResponse create(@RequestBody EntrustQuery query) {
try { try {
return entrustService.create(query); return entrustService.create(query);
}catch (Exception e) { } catch (Exception e) {
log.debug("新增委托{}",e); log.debug("新增委托{}", e);
} }
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@ApiOperation(value = "委托详情") @ApiOperation(value = "委托详情")
@GetMapping("/{id}") @GetMapping("/{id}")
public BaseResponse getDtail(@PathVariable Integer id){ public BaseResponse getDtail(@PathVariable Integer id) {
try { try {
return entrustService.getDtail(id); return entrustService.getDtail(id);
}catch (Exception e){ } catch (Exception e) {
log.debug("委托详情{}",e); log.debug("委托详情{}", e);
} }
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@PostMapping("/export/{entrustId}") @PostMapping("/export/{entrustId}")
@ApiOperation("导出委托单") @ApiOperation("导出委托单")
public void getReportDetail(@PathVariable("entrustId") Integer entrustId, public void getReportDetail(@PathVariable("entrustId") Integer entrustId,
HttpServletResponse response) { HttpServletResponse response) {
// ReportDetailVo rts = iEntrustService.getReportDetail(entrustId); EntrustVo entrustVo = entrustService.getDetailCapacity(entrustId).getData();
EntrustVo entrustVo = entrustService.getDtail(entrustId).getData(); if (entrustVo == null){
Map<String, Object> beanParams = new HashMap<>(7); return;
beanParams.put("clientName", entrustVo.getClientName()); }
beanParams.put("entrustCode", entrustVo.getEntrustCode()); Map<String, Object> beanParams = new HashMap<>(7);
beanParams.put("userName", entrustVo.getUserName()); beanParams.put("clientName", entrustVo.getClientName());
beanParams.put("userPhone", entrustVo.getUserPhone()); beanParams.put("entrustCode", entrustVo.getEntrustCode());
beanParams.put("userFax", entrustVo.getUserFax()); beanParams.put("userName", entrustVo.getUserName());
beanParams.put("projectName", entrustVo.getProjectName()); beanParams.put("userPhone", entrustVo.getUserPhone());
beanParams.put("sampleNum", entrustVo.getSampleNum()); beanParams.put("userFax", entrustVo.getUserFax());
beanParams.put("projectName", entrustVo.getProjectName());
WordUtil.writeWordReport(entrustVo.getProjectName() + "(委托单)", "entrust.ftl", beanParams.put("sampleNum", entrustVo.getSampleNum());
beanParams, response);
//获取委托单样品列表(不包含平行样)
} List<SampleVo> sampleList = new ArrayList<>(entrustVo.getSampleList().size());
entrustVo.getSampleList()
@ApiOperation(value = "获取样品表里最大的本所编号") .stream()
@GetMapping("/getMaxCementCode") .filter(arg -> arg.getIsParallel() == 0)
public BaseResponse getMaxCementCode(){ .forEach(arg -> {
try { List<SampleDistributionTeamVo> teamVoList = arg.getSampleDistributionTeamVoList();
return entrustService.getMaxCementCode(); arg.setTeamName(getTeamName(teamVoList));
}catch (Exception e){ sampleList.add(arg);
log.debug("获取样品表里最大的本所编号{}",e); });
} beanParams.put("list", sampleList);
return BaseResponse.errorMsg("失败!");
} WordUtil.writeWordReport(entrustVo.getProjectName() + "(委托单)", "entrust2.ftl",
beanParams, response, FileExt.DOC);
@ApiOperation(value = "委托评审")
@PostMapping("/approval") }
public BaseResponse approval(@RequestBody ApprovalQuery query) {
try { @ApiOperation(value = "获取样品表里最大的本所编号")
return entrustService.approval(query); @GetMapping("/getMaxCementCode")
}catch (Exception e) { public BaseResponse getMaxCementCode() {
log.debug("委托评审{}",e); try {
} return entrustService.getMaxCementCode();
return BaseResponse.errorMsg("失败!"); } catch (Exception e) {
} log.debug("获取样品表里最大的本所编号{}", e);
}
@ApiOperation(value = "发送样品处理任务") return BaseResponse.errorMsg("失败!");
@PostMapping("/handle") }
public BaseResponse handle(@RequestBody HandleQuery query) {
try { @ApiOperation(value = "委托评审")
return entrustService.handle(query); @PostMapping("/approval")
}catch (Exception e) { public BaseResponse approval(@RequestBody ApprovalQuery query) {
log.debug("发送样品处理任务{}",e); try {
} return entrustService.approval(query);
return BaseResponse.errorMsg("失败!"); } catch (Exception e) {
} log.debug("委托评审{}", e);
}
@ApiOperation(value = "样品处理任务分页") return BaseResponse.errorMsg("失败!");
@ApiImplicitParams(value = { }
@ApiImplicitParam(name = "projectCode", value = "项目编号", paramType = "query", dataType = "String")
}) @ApiOperation(value = "发送样品处理任务")
@GetMapping("/getSampleHandlePage") @PostMapping("/handle")
public BaseResponse getSampleHandlePage(PageQuery pageQuery, String projectCode) { public BaseResponse handle(@RequestBody HandleQuery query) {
try { try {
return entrustService.getSampleHandlePage(pageQuery,projectCode); return entrustService.handle(query);
} catch (Exception e) { } catch (Exception e) {
log.debug("样品处理任务分页{}", e); log.debug("发送样品处理任务{}", e);
} }
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@ApiOperation(value = "样品处理任务列表") @ApiOperation(value = "样品处理任务分页")
@GetMapping("/getSampleHandleList") @ApiImplicitParams(value = {
public BaseResponse getSampleHandleList(Integer id) { @ApiImplicitParam(name = "projectCode", value = "项目编号", paramType = "query", dataType = "String")
try { })
return entrustService.getSampleHandleList(id); @GetMapping("/getSampleHandlePage")
} catch (Exception e) { public BaseResponse getSampleHandlePage(PageQuery pageQuery, String projectCode) {
log.debug("样品处理任务列表{}", e); try {
} return entrustService.getSampleHandlePage(pageQuery, projectCode);
return BaseResponse.errorMsg("失败!"); } catch (Exception e) {
} log.debug("样品处理任务分页{}", e);
}
@ApiOperation(value = "接受样品处理任务") return BaseResponse.errorMsg("失败!");
@PostMapping("/acceptHandle") }
public BaseResponse acceptHandle(@RequestBody Integer[] ids) {
try { @ApiOperation(value = "样品处理任务列表")
return entrustService.acceptHandle(ids); @GetMapping("/getSampleHandleList")
}catch (Exception e) { public BaseResponse getSampleHandleList(Integer id) {
log.debug("接受样品处理任务{}",e); try {
} return entrustService.getSampleHandleList(id);
return BaseResponse.errorMsg("失败!"); } catch (Exception e) {
} log.debug("样品处理任务列表{}", e);
}
@ApiOperation(value = "数据上传列表") return BaseResponse.errorMsg("失败!");
@GetMapping("/getSampleHandleEnclosureList") }
public BaseResponse getSampleHandleEnclosureList(Integer sampleHandleId) {
try { @ApiOperation(value = "接受样品处理任务")
return entrustService.getSampleHandleEnclosureList(sampleHandleId); @PostMapping("/acceptHandle")
} catch (Exception e) { public BaseResponse acceptHandle(@RequestBody Integer[] ids) {
log.debug("数据上传列表{}", e); try {
} return entrustService.acceptHandle(ids);
return BaseResponse.errorMsg("失败!"); } catch (Exception e) {
} log.debug("接受样品处理任务{}", e);
}
@ApiOperation(value = "样品处理数据上传附件") return BaseResponse.errorMsg("失败!");
@PostMapping("/uploadEnclosureCL") }
public BaseResponse uploadEnclosureCL(SampleHandleEnclosureQuery query) {
try { @ApiOperation(value = "数据上传列表")
return entrustService.uploadEnclosureCL(query); @GetMapping("/getSampleHandleEnclosureList")
}catch (Exception e) { public BaseResponse getSampleHandleEnclosureList(Integer sampleHandleId) {
log.debug("样品处理数据上传附件{}",e); try {
} return entrustService.getSampleHandleEnclosureList(sampleHandleId);
return BaseResponse.errorMsg("失败!"); } catch (Exception e) {
} log.debug("数据上传列表{}", e);
}
@ApiOperation(value = "样品处理详情") return BaseResponse.errorMsg("失败!");
@GetMapping("/getHandleDtail/{id}") }
public BaseResponse getHandleDtail(@PathVariable Integer id){
try { @ApiOperation(value = "样品处理数据上传附件")
return entrustService.getHandleDtail(id); @PostMapping("/uploadEnclosureCL")
}catch (Exception e){ public BaseResponse uploadEnclosureCL(SampleHandleEnclosureQuery query) {
log.debug("样品处理详情{}",e); try {
} return entrustService.uploadEnclosureCL(query);
return BaseResponse.errorMsg("失败!"); } catch (Exception e) {
} log.debug("样品处理数据上传附件{}", e);
}
@ApiOperation(value = "完成样品处理任务") return BaseResponse.errorMsg("失败!");
@PostMapping("/finishHandle") }
public BaseResponse finishHandle(@RequestBody Integer[] ids) {
try { @ApiOperation(value = "样品处理详情")
return entrustService.finishHandle(ids); @GetMapping("/getHandleDtail/{id}")
}catch (Exception e) { public BaseResponse getHandleDtail(@PathVariable Integer id) {
log.debug("完成样品处理任务{}",e); try {
} return entrustService.getHandleDtail(id);
return BaseResponse.errorMsg("失败!"); } catch (Exception e) {
} log.debug("样品处理详情{}", e);
}
@ApiOperation(value = "派发检测项目任务") return BaseResponse.errorMsg("失败!");
@PostMapping("/distribution") }
public BaseResponse distribution(@RequestBody DistributionQuery query) {
try { @ApiOperation(value = "完成样品处理任务")
return entrustService.distribution(query); @PostMapping("/finishHandle")
}catch (Exception e) { public BaseResponse finishHandle(@RequestBody Integer[] ids) {
log.debug("派发检测项目任务{}",e); try {
} return entrustService.finishHandle(ids);
return BaseResponse.errorMsg("失败!"); } catch (Exception e) {
} log.debug("完成样品处理任务{}", e);
}
@ApiOperation(value = "派发任务分页列表") return BaseResponse.errorMsg("失败!");
@ApiImplicitParams(value = { }
@ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "projectCode", value = "项目编号", paramType = "query", dataType = "String") @ApiOperation(value = "派发检测项目任务")
}) @PostMapping("/distribution")
@GetMapping("/getSampleDistributionPage") public BaseResponse distribution(@RequestBody DistributionQuery query) {
public BaseResponse getSampleDistributionPage(PageQuery pageQuery, String projectName, try {
String projectCode) { return entrustService.distribution(query);
try { } catch (Exception e) {
return entrustService.getSampleDistributionPage(pageQuery, projectName, projectCode); log.debug("派发检测项目任务{}", e);
} catch (Exception e) { }
log.debug("派发任务分页列表{}", e); return BaseResponse.errorMsg("失败!");
} }
return BaseResponse.errorMsg("失败!");
} @ApiOperation(value = "派发任务分页列表")
@ApiImplicitParams(value = {
@ApiOperation(value = "检测通知单详情") @ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType = "String"),
@GetMapping("/getSampleDistributionList/{id}") @ApiImplicitParam(name = "projectCode", value = "项目编号", paramType = "query", dataType = "String")
public BaseResponse getSampleDistributionList(@PathVariable Integer id){ })
try { @GetMapping("/getSampleDistributionPage")
return entrustService.getSampleDistributionList(id); public BaseResponse getSampleDistributionPage(PageQuery pageQuery, String projectName,
}catch (Exception e){ String projectCode) {
log.debug("检测通知单详情{}",e); try {
} return entrustService.getSampleDistributionPage(pageQuery, projectName, projectCode);
return BaseResponse.errorMsg("失败!"); } catch (Exception e) {
} log.debug("派发任务分页列表{}", e);
}
@ApiOperation(value = "详情-基本信息") return BaseResponse.errorMsg("失败!");
@GetMapping("/getBaseDtail/{id}") }
public BaseResponse getBaseDtail(@PathVariable Integer id){
try { @ApiOperation(value = "检测通知单详情")
return entrustService.getBaseDtail(id); @GetMapping("/getSampleDistributionList/{id}")
}catch (Exception e){ public BaseResponse getSampleDistributionList(@PathVariable Integer id) {
log.debug("详情-基本信息{}",e); try {
} return entrustService.getSampleDistributionList(id);
return BaseResponse.errorMsg("失败!"); } catch (Exception e) {
} log.debug("检测通知单详情{}", e);
@ApiOperation(value = "详情-样品处理信息") }
@GetMapping("/getSampleHandleDtail/{id}") return BaseResponse.errorMsg("失败!");
public BaseResponse getSampleHandleDtail(@PathVariable Integer id){ }
try {
return entrustService.getSampleHandleDtail(id); @ApiOperation(value = "详情-基本信息")
}catch (Exception e){ @GetMapping("/getBaseDtail/{id}")
log.debug("详情-样品处理信息{}",e); public BaseResponse getBaseDtail(@PathVariable Integer id) {
} try {
return BaseResponse.errorMsg("失败!"); return entrustService.getBaseDtail(id);
} } catch (Exception e) {
@ApiOperation(value = "详情-样品处理信息-附件列表") log.debug("详情-基本信息{}", e);
@GetMapping("/getSampleHandleDtailEnclosureList") }
public BaseResponse getSampleHandleDtailEnclosureList(Integer sampleHandleId) { return BaseResponse.errorMsg("失败!");
try { }
return entrustService.getSampleHandleDtailEnclosureList(sampleHandleId);
} catch (Exception e) { @ApiOperation(value = "详情-样品处理信息")
log.debug("详情-样品处理信息-附件列表{}", e); @GetMapping("/getSampleHandleDtail/{id}")
} public BaseResponse getSampleHandleDtail(@PathVariable Integer id) {
return BaseResponse.errorMsg("失败!"); try {
} return entrustService.getSampleHandleDtail(id);
@ApiOperation(value = "详情-检测任务信息") } catch (Exception e) {
@GetMapping("/getSampleCheckDtail/{id}") log.debug("详情-样品处理信息{}", e);
public BaseResponse getSampleCheckDtail(@PathVariable Integer id){ }
try { return BaseResponse.errorMsg("失败!");
return entrustService.getSampleCheckDtail(id); }
}catch (Exception e){
log.debug("详情-检测任务信息{}",e); @ApiOperation(value = "详情-样品处理信息-附件列表")
} @GetMapping("/getSampleHandleDtailEnclosureList")
return BaseResponse.errorMsg("失败!"); public BaseResponse getSampleHandleDtailEnclosureList(Integer sampleHandleId) {
} try {
return entrustService.getSampleHandleDtailEnclosureList(sampleHandleId);
} catch (Exception e) {
@ApiOperation(value = "接受检测项目任务") log.debug("详情-样品处理信息-附件列表{}", e);
@PostMapping("/acceptDistribution") }
public BaseResponse acceptDistribution(@RequestBody Integer[] ids) { return BaseResponse.errorMsg("失败!");
try { }
return entrustService.acceptDistribution(ids);
}catch (Exception e) { @ApiOperation(value = "详情-检测任务信息")
log.debug("接受检测项目任务{}",e); @GetMapping("/getSampleCheckDtail/{id}")
} public BaseResponse getSampleCheckDtail(@PathVariable Integer id) {
return BaseResponse.errorMsg("失败!"); try {
} return entrustService.getSampleCheckDtail(id);
} catch (Exception e) {
@ApiOperation(value = "检测项目上传附件") log.debug("详情-检测任务信息{}", e);
@PostMapping("/uploadEnclosurePF") }
public BaseResponse uploadEnclosurePF(SampleDistributionEnclosureQuery query) { return BaseResponse.errorMsg("失败!");
try { }
return entrustService.uploadEnclosurePF(query);
}catch (Exception e) {
log.debug("检测项目上传附件{}",e); @ApiOperation(value = "接受检测项目任务")
} @PostMapping("/acceptDistribution")
return BaseResponse.errorMsg("失败!"); public BaseResponse acceptDistribution(@RequestBody Integer[] ids) {
} try {
return entrustService.acceptDistribution(ids);
} catch (Exception e) {
@ApiOperation(value = "完成检测项目任务") log.debug("接受检测项目任务{}", e);
@PostMapping("/finishDistribution") }
public BaseResponse finishDistribution(@RequestBody Integer[] ids) { return BaseResponse.errorMsg("失败!");
try { }
return entrustService.finishDistribution(ids);
}catch (Exception e) { @ApiOperation(value = "检测项目上传附件")
log.debug("完成检测项目任务{}",e); @PostMapping("/uploadEnclosurePF")
} public BaseResponse uploadEnclosurePF(SampleDistributionEnclosureQuery query) {
return BaseResponse.errorMsg("失败!"); try {
} return entrustService.uploadEnclosurePF(query);
} catch (Exception e) {
@ApiOperation(value = "数据校核分页") log.debug("检测项目上传附件{}", e);
@ApiImplicitParams(value = { }
@ApiImplicitParam(name = "startDate", value = "开始日期", paramType = "query", dataType = "String"), return BaseResponse.errorMsg("失败!");
@ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", dataType = "String"), }
@ApiImplicitParam(name = "status",
value = "状态(6样品检测完成,7校核中,8校核完成)", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "clientId", value = "委托单位id", paramType = "query", dataType = "Integer"), @ApiOperation(value = "完成检测项目任务")
@ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType = "String"), @PostMapping("/finishDistribution")
@ApiImplicitParam(name = "projectCode", value = "项目编号", paramType = "query", dataType = "String") public BaseResponse finishDistribution(@RequestBody Integer[] ids) {
}) try {
@GetMapping("/getCheckPage") return entrustService.finishDistribution(ids);
public BaseResponse getCheckPage(PageQuery pageQuery, String startDate, String endDate, Integer status, } catch (Exception e) {
Integer clientId, String projectName, String projectCode) { log.debug("完成检测项目任务{}", e);
try { }
return entrustService.getCheckPage(pageQuery, startDate, endDate, status, clientId, projectName, projectCode); return BaseResponse.errorMsg("失败!");
} catch (Exception e) { }
log.debug("数据校核分页{}", e);
} @ApiOperation(value = "数据校核分页")
return BaseResponse.errorMsg("失败!"); @ApiImplicitParams(value = {
} @ApiImplicitParam(name = "startDate", value = "开始日期", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", dataType = "String"),
@ApiOperation(value = "数据校核详情列表") @ApiImplicitParam(name = "status",
@GetMapping("/getCheckList/{id}") value = "状态(6样品检测完成,7校核中,8校核完成)", paramType = "query", dataType = "Integer"),
public BaseResponse getCheckList(@PathVariable Integer id){ @ApiImplicitParam(name = "clientId", value = "委托单位id", paramType = "query", dataType = "Integer"),
try { @ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType = "String"),
return entrustService.getCheckList(id); @ApiImplicitParam(name = "projectCode", value = "项目编号", paramType = "query", dataType = "String")
}catch (Exception e){ })
log.debug("数据校核详情列表{}",e); @GetMapping("/getCheckPage")
} public BaseResponse getCheckPage(PageQuery pageQuery, String startDate, String endDate, Integer status,
return BaseResponse.errorMsg("失败!"); Integer clientId, String projectName, String projectCode) {
} try {
return entrustService.getCheckPage(pageQuery, startDate, endDate, status, clientId, projectName, projectCode);
@ApiOperation(value = "样品检测项校核详情") } catch (Exception e) {
@GetMapping("/getCheckDetail") log.debug("数据校核分页{}", e);
public BaseResponse getCheckDetail(String cementCode){ }
try { return BaseResponse.errorMsg("失败!");
return entrustService.getCheckDetail(cementCode); }
}catch (Exception e){
log.debug("样品检测项校核详情{}",e); @ApiOperation(value = "数据校核详情列表")
} @GetMapping("/getCheckList/{id}")
return BaseResponse.errorMsg("失败!"); public BaseResponse getCheckList(@PathVariable Integer id) {
} try {
return entrustService.getCheckList(id);
@ApiOperation(value = "查询任务检测附件信息") } catch (Exception e) {
@GetMapping("/getEnclosureList") log.debug("数据校核详情列表{}", e);
public BaseResponse getEnclosureList(Integer sampleId, Integer teamGroupId, Integer userId){ }
try { return BaseResponse.errorMsg("失败!");
return entrustService.getEnclosureList(sampleId, teamGroupId, userId); }
}catch (Exception e){
log.debug("查询任务检测附件信息{}",e); @ApiOperation(value = "样品检测项校核详情")
} @GetMapping("/getCheckDetail")
return BaseResponse.errorMsg("失败!"); public BaseResponse getCheckDetail(String cementCode) {
} try {
return entrustService.getCheckDetail(cementCode);
@ApiOperation(value = "校核计算") } catch (Exception e) {
@PostMapping("/checkCount") log.debug("样品检测项校核详情{}", e);
public BaseResponse checkCount(@RequestBody CheckCountQuery query) { }
try { return BaseResponse.errorMsg("失败!");
return entrustService.checkCount(query); }
}catch (Exception e) {
log.debug("校核计算{}",e); @ApiOperation(value = "查询任务检测附件信息")
} @GetMapping("/getEnclosureList")
return BaseResponse.errorMsg("失败!"); public BaseResponse getEnclosureList(Integer sampleId, Integer teamGroupId, Integer userId) {
} try {
return entrustService.getEnclosureList(sampleId, teamGroupId, userId);
} catch (Exception e) {
@ApiOperation(value = "数据校核") log.debug("查询任务检测附件信息{}", e);
@PostMapping("/check") }
public BaseResponse check(@RequestBody CheckQuery query) { return BaseResponse.errorMsg("失败!");
try { }
return entrustService.check(query);
}catch (Exception e) { @ApiOperation(value = "校核计算")
log.debug("数据校核{}",e); @PostMapping("/checkCount")
} public BaseResponse checkCount(@RequestBody CheckCountQuery query) {
return BaseResponse.errorMsg("失败!"); try {
} return entrustService.checkCount(query);
} catch (Exception e) {
log.debug("校核计算{}", e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "数据校核")
@PostMapping("/check")
public BaseResponse check(@RequestBody CheckQuery query) {
try {
return entrustService.check(query);
} catch (Exception e) {
log.debug("数据校核{}", e);
}
return BaseResponse.errorMsg("失败!");
}
private String getTeamName(List<SampleDistributionTeamVo> teamVos) {
if (teamVos.size() == 0) {
return "";
}
StringBuffer rts = new StringBuffer();
teamVos.forEach(arg -> {
rts.append(arg.getTeamName()).append("、");
});
return rts.substring(0, rts.toString().length() - 1);
}
} }
package cn.wise.sc.cement.business.controller; package cn.wise.sc.cement.business.controller;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.FileExt;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.ReportDetailVo; import cn.wise.sc.cement.business.model.ReportDetailVo;
import cn.wise.sc.cement.business.model.SixElementKey; import cn.wise.sc.cement.business.model.SixElementKey;
...@@ -111,8 +112,8 @@ public class ReportController { ...@@ -111,8 +112,8 @@ public class ReportController {
beanParams.put("list1", al2o3AndTio2List); beanParams.put("list1", al2o3AndTio2List);
beanParams.put("list2", al2o3SplitTio2List); beanParams.put("list2", al2o3SplitTio2List);
WordUtil.writeWordReport(rts.getProjectName() + "(报告).xls", "report.ftl", WordUtil.writeWordReport(rts.getProjectName() + "(报告)", "report.ftl",
beanParams, response); beanParams, response, FileExt.EXCL);
} }
......
package cn.wise.sc.cement.business.model;
/**
* @description: 文件扩展名
* @author: qh
* @create: 2020-10-16 13:40
**/
public enum FileExt {
//office后缀名
DOC(".doc"),
EXCL(".xls");
private String name;
FileExt(String name){
this.name = name;
}
public String getName() {
return name;
}
}
...@@ -3,7 +3,6 @@ package cn.wise.sc.cement.business.model.vo; ...@@ -3,7 +3,6 @@ package cn.wise.sc.cement.business.model.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/** /**
* @description: * @description:
* @author: ztw * @author: ztw
...@@ -49,13 +48,4 @@ public class SampleDistributionTeamVo { ...@@ -49,13 +48,4 @@ public class SampleDistributionTeamVo {
@ApiModelProperty("扩展名") @ApiModelProperty("扩展名")
private String extName; private String extName;
} }
...@@ -35,6 +35,7 @@ public interface IEntrustService extends IService<Entrust> { ...@@ -35,6 +35,7 @@ public interface IEntrustService extends IService<Entrust> {
BaseResponse<Entrust> create(EntrustQuery query); BaseResponse<Entrust> create(EntrustQuery query);
BaseResponse<EntrustVo> getDtail(Integer id); BaseResponse<EntrustVo> getDtail(Integer id);
BaseResponse<EntrustVo> getDetailCapacity(Integer id);
BaseResponse<String> getMaxCementCode(); BaseResponse<String> getMaxCementCode();
......
...@@ -378,6 +378,98 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -378,6 +378,98 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return BaseResponse.okData(entrustVo); return BaseResponse.okData(entrustVo);
} }
@Override
public BaseResponse<EntrustVo> getDetailCapacity(Integer id) {
if (id == null) {
return BaseResponse.errorMsg("参数错误");
}
EntrustVo entrustVo = entrustMapper.getDetail(id);
if (entrustVo.getStatus() != 0) {
QueryWrapper<Sample> sampleWrapper = new QueryWrapper<>();
sampleWrapper.eq("entrust_id", entrustVo.getId());
sampleWrapper.orderByAsc("id");
List<Sample> sampleList = sampleService.list(sampleWrapper);
List<SampleVo> sampleVoList = new ArrayList<>();
List<SampleVo> sampleHandleVoList = new ArrayList<>();
if (sampleList != null && sampleList.size() > 0) {
for (Sample sample : sampleList) {
SampleVo sampleVo = new SampleVo();
BeanUtils.copyProperties(sample, sampleVo);
String teamIds = sample.getTeamIds();
String teamName = "";
List<SampleDistributionTeamVo> sampleNoDistributionTeamVoList = new ArrayList<>();
if (teamIds != null) {
String[] teamIdS = teamIds.split("、");
for (String teamId : teamIdS) {
TeamVo teamVo = teamMapper.getDetail(Integer.valueOf(teamId));
if (teamVo != null && "1".equals(teamVo.getQualifications())) {
teamName = teamName.equals("") ? teamVo.getName() : (teamName + "、" + teamVo.getName());
SampleDistributionTeamVo distributionTeamVo = new SampleDistributionTeamVo();
distributionTeamVo.setTeamGroupId(teamVo.getGroupId());
distributionTeamVo.setTeamGroupName(teamVo.getGroupName());
distributionTeamVo.setTeamId(teamVo.getId());
distributionTeamVo.setTeamName(teamVo.getName());
sampleNoDistributionTeamVoList.add(distributionTeamVo);
}
}
}
sampleVo.setTeamName(teamName);
//评审人员可以查看所有的检测项内容
List<SampleDistributionTeamVo> sampleDistributionTeamVoList =
distributionMapper.getDistributionTeamList(sample.getId(), null);
if (sampleDistributionTeamVoList != null && sampleDistributionTeamVoList.size() > 0) {
sampleVo.setSampleDistributionTeamVoList(sampleDistributionTeamVoList);
} else {
sampleVo.setSampleDistributionTeamVoList(sampleNoDistributionTeamVoList);
}
sampleVoList.add(sampleVo);
//样品处理列表只展示
if (sample.getIsParallel() == 1) {
if (sample.getCementCode().equals(sample.getParallelCode())) {
sampleHandleVoList.add(sampleVo);
}
} else {
sampleHandleVoList.add(sampleVo);
}
}
}
entrustVo.setSampleList(sampleVoList);//样品列表(展示平行样样品)
entrustVo.setSampleHandleList(sampleHandleVoList);//处理样品列表(不展示平行样样品)
} else {
QueryWrapper<SampleTmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entrust_id", entrustVo.getId());
List<SampleTmp> sampleTmpList = sampleTmpService.list(queryWrapper);
List<SampleTmpVo> sampleTmpVoList = new ArrayList<>();
if (sampleTmpList != null && sampleTmpList.size() > 0) {
for (SampleTmp sampleTmp : sampleTmpList) {
SampleTmpVo sampleTmpVo = new SampleTmpVo();
BeanUtils.copyProperties(sampleTmp, sampleTmpVo);
String teamIds = sampleTmp.getTeamIds();
String teamName = "";
if (teamIds != null) {
String[] teamIdS = teamIds.split("、");
for (String teamId : teamIdS) {
Team team = teamMapper.selectById(Integer.valueOf(teamId));
if (team != null && "1".equals(team.getQualifications())) {
team.getName();
teamName = teamName.equals("") ? team.getName() : (teamName + "、" + team.getName());
}
}
}
sampleTmpVo.setTeamName(teamName);
sampleTmpVoList.add(sampleTmpVo);
}
}
entrustVo.setSampleTmpList(sampleTmpVoList);
}
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
}
userMessageService.checkMessage(loginUser.getId(), id, SysUserMessage.MessageType.ENTRUST);
return BaseResponse.okData(entrustVo);
}
/** /**
* 详情-基本信息 * 详情-基本信息
* *
......
package cn.wise.sc.cement.business.util; package cn.wise.sc.cement.business.util;
import cn.wise.sc.cement.business.model.FileExt;
import freemarker.template.Configuration; import freemarker.template.Configuration;
import freemarker.template.Template; import freemarker.template.Template;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -45,7 +46,8 @@ public class WordUtil { ...@@ -45,7 +46,8 @@ public class WordUtil {
String templeName, String templeName,
String templateFileName, String templateFileName,
Map<String, Object> beanParams, Map<String, Object> beanParams,
HttpServletResponse response) { HttpServletResponse response,
FileExt fileExt) {
Writer out = null; Writer out = null;
File file = null; File file = null;
try { try {
...@@ -74,7 +76,7 @@ public class WordUtil { ...@@ -74,7 +76,7 @@ public class WordUtil {
response.setCharacterEncoding(StandardCharsets.UTF_8.toString()); response.setCharacterEncoding(StandardCharsets.UTF_8.toString());
response.setContentType("application/octet-stream"); response.setContentType("application/octet-stream");
templeName = new String((templeName).getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1); templeName = new String((templeName).getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1);
response.setHeader("Content-Disposition", "attachment;filename=" + templeName + ".xls"); response.setHeader("Content-Disposition", "attachment;filename=" + templeName + fileExt.getName());
outputStream.write(buffer); outputStream.write(buffer);
outputStream.flush(); outputStream.flush();
outputStream.close(); outputStream.close();
......
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Version>16.00</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>12650</WindowHeight>
<WindowWidth>22260</WindowWidth>
<WindowTopX>32767</WindowTopX>
<WindowTopY>32767</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="等线" x:CharSet="134" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s63">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
<Font ss:FontName="等线" x:CharSet="134" ss:Size="11" ss:Color="#000000"
ss:Bold="1"/>
</Style>
<Style ss:ID="s64">
<Font ss:FontName="等线" x:CharSet="134" ss:Size="11" ss:Color="#000000"/>
</Style>
</Styles>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="8" x:FullColumns="1"
x:FullRows="1" ss:DefaultColumnWidth="52" ss:DefaultRowHeight="14">
<Column ss:AutoFitWidth="0" ss:Width="116.5"/>
<Column ss:AutoFitWidth="0" ss:Width="117"/>
<Row>
<Cell ss:MergeAcross="1" ss:StyleID="s63"><Data ss:Type="String">中国水泥发展中心物化检测所检测委托单</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">委托单位</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${clientName}</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">委托编号</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${entrustCode}</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">委托人</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${userName}</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">电话</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${userPhone}</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">传真</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${userFax}</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">项目名称</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${projectName}</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">样品数量</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${sampleNum}</Data></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<Print>
<ValidPrinterInfo/>
<PaperSizeIndex>9</PaperSizeIndex>
<HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution>
</Print>
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>9</ActiveRow>
<ActiveCol>4</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>
This source diff could not be displayed because it is too large. You can view the blob instead.
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