Commit 675377ff authored by 竹天卫's avatar 竹天卫
parents 18f5a84e 42a11c15
......@@ -145,7 +145,7 @@ public class NormProductionController {
}
@GetMapping("/export/statistics")
@PostMapping("/export/statistics")
@ApiOperation("导出标准产值列表")
public void exportNormProductionStatistics(String start, String end, String name, HttpServletResponse response) {
Long startTime = null;
......@@ -157,7 +157,7 @@ public class NormProductionController {
iNormProductionService.exportNormProductionStatistics(startTime, endTime, name, response);
}
@GetMapping("/export/statistics/detail")
@PostMapping("/export/statistics/detail")
@ApiOperation("导出个人标准产值详情列表")
public void exportNormProductionDetails(Integer userId, String start,
String end, HttpServletResponse response) {
......@@ -170,7 +170,7 @@ public class NormProductionController {
iNormProductionService.exportNormProductionDetail(userId, startTime, endTime, response);
}
@GetMapping("/export/total/production")
@PostMapping("/export/total/production")
@ApiOperation("导出总产值")
public void exportProduction(String name, String start, String end, HttpServletResponse response) {
Long startTime = null;
......
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.vo.EntrustVo;
import cn.wise.sc.cement.business.model.vo.QualityDetailVo;
import cn.wise.sc.cement.business.service.IEntrustService;
import cn.wise.sc.cement.business.util.PageUtil;
import cn.wise.sc.cement.business.service.IQualityApplyService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -19,6 +17,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
......@@ -34,9 +33,12 @@ public class QualityController {
final
IEntrustService iEntrustService;
final
IQualityApplyService iQualityApplyService;
public QualityController(IEntrustService iEntrustService) {
public QualityController(IEntrustService iEntrustService, IQualityApplyService iQualityApplyService) {
this.iEntrustService = iEntrustService;
this.iQualityApplyService = iQualityApplyService;
}
@ApiOperation(value = "质量检测分页列表")
......@@ -50,13 +52,34 @@ public class QualityController {
@GetMapping("/getPage")
public BaseResponse<IPage<EntrustVo>> page(PageQuery pageQuery, String startDate, String endDate,
Integer clientId, String projectName, String projectCode) {
return iEntrustService.getQualityPage(pageQuery, startDate, endDate, clientId, projectName, projectCode);
BaseResponse<IPage<EntrustVo>> baseResponse = iEntrustService.getQualityPage(
pageQuery, startDate, endDate, clientId, projectName, projectCode);
//判断是否已经评审过
if (baseResponse.getCode() == 200) {
List<EntrustVo> records = baseResponse.getData().getRecords();
if (records.size() == 0) {
return BaseResponse.errorMsg("没找到相关数据!");
}
List<Integer> projectIds = records.stream().map(EntrustVo::getProjectId).collect(Collectors.toList());
Set<Integer> qualityApplyIds = iQualityApplyService.selectQualityApplyStatusByProIds(projectIds);
records.forEach(arg->{
if (qualityApplyIds.contains(arg.getProjectId())){
arg.setStatusValue("审核完成");
arg.setStatus(10);
}else {
arg.setStatusValue("待审核");
arg.setStatus(9);
}
});
}
return baseResponse;
}
@GetMapping("/{entrustId}")
@ApiOperation("获取质量详情")
public BaseResponse<QualityDetailVo> getReportDetail(@PathVariable("entrustId") Integer entrustId) {
return BaseResponse.okData(iEntrustService.getQualityDetail(entrustId));
}
......
......@@ -12,6 +12,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -30,6 +31,7 @@ import java.util.Set;
**/
@Api(tags = "报告管理")
@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/business/report")
public class ReportController {
......@@ -73,8 +75,8 @@ public class ReportController {
return iEntrustService.deleteById(id);
}
@GetMapping("/{entrustId}")
@ApiOperation("获取报告详情")
@PostMapping("/{entrustId}")
@ApiOperation("导出报告封面和首页")
public void getReportDetail(@PathVariable("entrustId") Integer entrustId,
HttpServletResponse response) {
......
......@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
/**
* @description: 质量检测详情
......@@ -15,7 +16,6 @@ import java.io.Serializable;
public class QualityDetail implements Serializable {
private static final long serialVersionUID = 42L;
@ApiModelProperty("样品名字")
private String sampleName;
@ApiModelProperty("检测数据")
......@@ -40,8 +40,18 @@ public class QualityDetail implements Serializable {
private Integer userId;
@ApiModelProperty("样品数量")
private Integer sampleNum;
@ApiModelProperty("送检单位id")
private Integer clientId;
@ApiModelProperty("用户名")
private String userName;
@ApiModelProperty("送检单位名字")
private String clientName;
@ApiModelProperty("委托创建时间")
private LocalDate createTime;
@ApiModelProperty("来样编号")
private String sampleCode;
@ApiModelProperty("样品状态")
private String sampleForm;
@ApiModelProperty("本所编号")
private String cementCode;
}
......@@ -254,15 +254,15 @@
</select>
<select id="getQualityDetail" resultType="cn.wise.sc.cement.business.entity.QualityDetail">
SELECT s.sample_name,esscct.* FROM (SELECT sscct.*,client_id,entrust_code,project_name,sample_num,send_name,send_phone FROM entrust e
SELECT s.sample_name,s.cement_code,s.sample_form,s.sample_code,esscct.* FROM (SELECT sscct.*,client_id,entrust_code,project_name,sample_num,send_name,send_phone,create_time FROM entrust e
RIGHT JOIN
(SELECT sct.input_result,sample_id,entrust_id,team_group_name,team_group_id,user_id FROM sample_check sc
(SELECT count_result as input_result,sample_id,entrust_id,team_group_name,team_group_id,user_id FROM sample_check sc
RIGHT JOIN
(SELECT * FROM sample_check_team) sct
ON sct.check_id = sc.id WHERE sc.entrust_id = #{entrustId}) sscct
ON e.id = sscct.entrust_id) esscct
LEFT JOIN
(SELECT name as sample_name,id FROM sample) s
(SELECT name as sample_name,id,cement_code,sample_form,sample_code FROM sample) s
ON esscct.sample_id = s.id
</select>
......
......@@ -20,18 +20,25 @@ public class QualityDetailVo implements Serializable {
private Integer sampleNum;
private String sendName;
private String sendPhone;
private String createTime;
private String entrustId;
List<QualityTeamGroup> qualityTeamGroups = new ArrayList<>();
@Data
public static class QualityTeamGroup {
private String teamGroupName;
private Integer teamGroupId;
private List<QualitySample> qualitySamples = new ArrayList<>();
}
@Data
public static class QualitySample {
private String sampleName;
private Integer sampleId;
private String sampleForm;
private String cementCode;
private String sampleCode;
private List<SampleOriginal> sampleOriginals = new ArrayList<>();
}
......
......@@ -468,6 +468,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
return BaseResponse.okData(sampleHandleList);
}
/**
* 详情-样品处理信息-附件列表
*
......@@ -567,7 +568,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
Object obj = redisUtil.getString("maxCementCode");
String maxCementCode = "";
String regex = "[0-9]{2}\\-[0-9]{4}";
if (obj == null || !obj.toString().matches(regex) ) {
if (obj == null || !obj.toString().matches(regex)) {
maxCementCode = sampleMapper.getMaxCementCode();
} else {
maxCementCode = obj.toString();
......@@ -584,7 +585,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
maxCementCode = yesrString + "-0000";
}
}
System.out.println("redis获取最大值时的最大本所编号*******************************************"+maxCementCode);
System.out.println("redis获取最大值时的最大本所编号*******************************************" + maxCementCode);
redisUtil.setString("maxCementCode", maxCementCode);
return BaseResponse.okData(maxCementCode);
}
......@@ -679,7 +680,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
sampleService.saveBatch(sampleList);
//最大的平行样编号放入redis
System.out.println("审批时的最大本所编号*******************************************"+maxCementCode);
System.out.println("审批时的最大本所编号*******************************************" + maxCementCode);
redisUtil.setString("maxCementCode", maxCementCode);
}
entrust.setStatus(1).setProjectType(query.getProjectType());
......@@ -1015,7 +1016,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if (sampleHandle == null) {
return BaseResponse.errorMsg("信息错误");
}
if (sampleHandle.getStatus() != 1 && sampleHandle.getStatus() != 2 ) {
if (sampleHandle.getStatus() != 1 && sampleHandle.getStatus() != 2) {
return BaseResponse.errorMsg("状态错误");
}
if (loginUser.getId() != sampleHandle.getUserId()) {
......@@ -1489,10 +1490,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
//检测人员只能看到自己则的检测内容
if (sampleList1.size() == 2) {
List<SampleDistributionTeamVo> sampleDistributionTeamVoList2 = distributionMapper.getDistributionTeamList(sampleList1.get(1).getId(), null);
if(sampleDistributionTeamVoList2.size() == sampleDistributionTeamVoList.size()){
for(int i=0; i<sampleDistributionTeamVoList.size(); i++){
if (sampleDistributionTeamVoList2.size() == sampleDistributionTeamVoList.size()) {
for (int i = 0; i < sampleDistributionTeamVoList.size(); i++) {
SampleDistributionTeamVo sdtvo = sampleDistributionTeamVoList.get(i);
sdtvo.setUserName(sdtvo.getUserName()+"、"+sampleDistributionTeamVoList2.get(i).getUserName());
sdtvo.setUserName(sdtvo.getUserName() + "、" + sampleDistributionTeamVoList2.get(i).getUserName());
}
} else {
sampleDistributionTeamVoList =
......@@ -1955,7 +1956,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
String methodNumbers = arg.getMethodNumbers();
String[] methodSplit = methodNumbers.split("、");
for (String idStr : methodSplit) {
String id = Integer.parseInt(idStr) +"";
String id = Integer.parseInt(idStr) + "";
methods.forEach(opt -> {
if (id.equals(opt.getNumber())) {
if (StrUtil.isBlank(arg.getMethodName())) {
......@@ -2095,11 +2096,12 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
QualityDetailVo.QualityTeamGroup qualityTeamGroup = new QualityDetailVo.QualityTeamGroup();
qualityTeamGroup.setTeamGroupName(arg);
qualityDetailVo.getQualityTeamGroups().add(qualityTeamGroup);
qualityDetails.stream()
List<QualityDetail> collect = qualityDetails.stream()
//找到当前检测组下的是要样品
.filter(opt -> opt.getTeamGroupName().equals(arg))
.collect(Collectors.toList())
.stream()
.collect(Collectors.toList());
collect.forEach(opt -> qualityTeamGroup.setTeamGroupId(opt.getTeamGroupId()));
collect.stream()
.map(QualityDetail::getSampleName)
.collect(Collectors.toSet())
.forEach(opt -> {
......@@ -2116,6 +2118,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
sampleOriginal.setTeamValues(param.getInputResult());
sampleOriginal.setUserName(param.getUserName());
qualitySample.getSampleOriginals().add(sampleOriginal);
qualitySample.setCementCode(param.getCementCode());
qualitySample.setSampleCode(param.getSampleCode());
qualitySample.setSampleForm(param.getSampleForm());
qualitySample.setSampleId(param.getSampleId());
}
});
});
......@@ -2130,8 +2136,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
String[] strs = str.split(",");
Map<String, String> map = new HashMap<>(strs.length);
for (String string : strs) {
String key = string.split("=")[0];
String value = string.split("=")[1];
String key = string.split(":")[0];
String value = string.split(":")[1];
map.put(key, value);
}
return JSON.toJSONString(map);
......@@ -2154,7 +2160,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
//初始化标准信息
rts.setPrintDate(DateUtil.format(new Date(), "yyyy年MM月dd日"));
rts.setSender(firstReportDetail.getSendName());
rts.setSendDate(DateUtil.format(firstReportDetail.getSendTime(),"yyyy年MM月dd日"));
rts.setSendDate(DateUtil.format(firstReportDetail.getSendTime(), "yyyy年MM月dd日"));
rts.setProjectName(firstReportDetail.getProjectName());
rts.setSendName("\\");
//获取检测项目、检测仪器、检测依据
......@@ -2223,7 +2229,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if (!CollectionUtils.isEmpty(list)) {
Map<String, Object> map = list.get(0);
String[] headers = new String[map.size()+1];
String[] headers = new String[map.size() + 1];
headers[0] = "序号";
headers[1] = "委托编号";
headers[2] = "是否加急";
......@@ -2239,65 +2245,65 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
List<Object[]> datas = new ArrayList<>(headers.length);
for (Map<String, Object> m : list) {
//获取委托单的检测项目 检测依据编号
//根据委托编号id 获取所有样品的检测项目 和 检测依据编号
Integer entrustId = Integer.valueOf(m.get("entrustId").toString());
System.out.println(entrustId);
QueryWrapper<SampleTmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entrust_id", entrustId);
List<SampleTmp> sampleTmpList = sampleTmpService.list(queryWrapper);
//获取委托单的检测项目 检测依据编号
//根据委托编号id 获取所有样品的检测项目 和 检测依据编号
Integer entrustId = Integer.valueOf(m.get("entrustId").toString());
System.out.println(entrustId);
QueryWrapper<SampleTmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entrust_id", entrustId);
List<SampleTmp> sampleTmpList = sampleTmpService.list(queryWrapper);
// String sampleNames = "";
/**
* 检测项目名称
* 格式:
* 样品1:Mad、Vad、Cao
* 样品2:Mad、Vad、Cao
* 样品3:Mad、Vad、Cao
*/
String checkTeamStr = "";
/**
* 检测依据编号
* 格式:
* 样品1:0012、0013
* 样品2:0014、0015
* 样品3:0016、0017
*/
String checkMethodStr = "";
if (sampleTmpList != null && sampleTmpList.size() > 0) {
//样品名称 列表中的拼接
for (SampleTmp sampleTmp : sampleTmpList) {
/**
* 检测项目名称
* 格式:
* 样品1:Mad、Vad、Cao
* 样品2:Mad、Vad、Cao
* 样品3:Mad、Vad、Cao
*/
String checkTeamStr = "";
/**
* 检测依据编号
* 格式:
* 样品1:0012、0013
* 样品2:0014、0015
* 样品3:0016、0017
*/
String checkMethodStr = "";
if (sampleTmpList != null && sampleTmpList.size() > 0) {
//样品名称 列表中的拼接
for (SampleTmp sampleTmp : sampleTmpList) {
// sampleNames = sampleNames.equals("") ? sampleTmp.getName() : (sampleNames + "、" + sampleTmp.getName());
String teamIds = sampleTmp.getTeamIds();
String checkTeam = "";
String checkMethod = "";
if (teamIds != null) {
String[] teamIdS = teamIds.split("、");
for (String teamId : teamIdS) {
Team team = teamMapper.selectById(Integer.valueOf(teamId));
if (team != null && team.getQualifications() ==1) {
checkTeam = checkTeam.equals("") ? team.getName() : (checkTeam + "、" + team.getName());
Method method = methodMapper.selectById(team.getMethodId());
if(method != null){
checkMethod = checkMethod.equals("") ? method.getNumber() : (checkMethod + "、" + method.getNumber());
}
}
}
}
String spampe_checkTeam = sampleTmp.getName()+":"+checkTeam;
checkTeamStr = checkTeamStr.equals("") ? spampe_checkTeam : (checkTeamStr + "\n" + spampe_checkTeam);
String spampe_checkMethod = sampleTmp.getName()+":"+checkMethod;
checkMethodStr = checkMethodStr.equals("") ? spampe_checkMethod : (checkMethodStr + "\n" + spampe_checkMethod);
}
}
String teamIds = sampleTmp.getTeamIds();
String checkTeam = "";
String checkMethod = "";
if (teamIds != null) {
String[] teamIdS = teamIds.split("、");
for (String teamId : teamIdS) {
Team team = teamMapper.selectById(Integer.valueOf(teamId));
if (team != null && team.getQualifications() == 1) {
checkTeam = checkTeam.equals("") ? team.getName() : (checkTeam + "、" + team.getName());
Method method = methodMapper.selectById(team.getMethodId());
if (method != null) {
checkMethod = checkMethod.equals("") ? method.getNumber() : (checkMethod + "、" + method.getNumber());
}
}
}
}
String spampe_checkTeam = sampleTmp.getName() + ":" + checkTeam;
checkTeamStr = checkTeamStr.equals("") ? spampe_checkTeam : (checkTeamStr + "\n" + spampe_checkTeam);
String spampe_checkMethod = sampleTmp.getName() + ":" + checkMethod;
checkMethodStr = checkMethodStr.equals("") ? spampe_checkMethod : (checkMethodStr + "\n" + spampe_checkMethod);
}
}
Object[] objects = new Object[headers.length];
for (int j = 0; j < headers.length; j++) {
String obj = "";
if(j == 9){
if (j == 9) {
obj = checkTeamStr;
}else if(j == 10){
} else if (j == 10) {
obj = checkMethodStr;
}else{
} else {
obj = m.get(headers[j]).toString();
//如果序号带小数点 去除.0,保留整数
if (j == 0) {
......
......@@ -162,27 +162,21 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
List<TeamGroup> finalTeamGroups = teamGroups;
List<Handle> finalHandles = handles;
normProductions.forEach(arg -> {
NormProductionVo normProductionVo = new NormProductionVo();
BeanUtil.copyProperties(arg, normProductionVo);
normProductionVo.setAssessName("/");
if (arg.getType() == 1) {
finalTeamGroups.stream()
.filter(opt -> opt.getId().intValue() == arg.getAssessId())
.findFirst()
.ifPresent(opt -> {
NormProductionVo normProductionVo = new NormProductionVo();
BeanUtil.copyProperties(arg, normProductionVo);
normProductionVo.setAssessName(opt.getName());
records.add(normProductionVo);
});
.ifPresent(opt -> normProductionVo.setAssessName(opt.getName()));
} else {
finalHandles.stream()
.filter(opt -> opt.getId().intValue() == arg.getAssessId())
.findFirst()
.ifPresent(opt -> {
NormProductionVo normProductionVo = new NormProductionVo();
BeanUtil.copyProperties(arg, normProductionVo);
normProductionVo.setAssessName(opt.getName());
records.add(normProductionVo);
});
.ifPresent(opt -> normProductionVo.setAssessName(opt.getName()));
}
records.add(normProductionVo);
});
rts.setRecords(records);
return BaseResponse.okData(rts);
......@@ -219,6 +213,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
} else {
return BaseResponse.errorMsg("修改失败!");
}
}
@Override
......
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