维修报废功能修改

This commit is contained in:
mashuai 2025-01-17 15:53:14 +08:00
parent a649d4f520
commit f986162a4c
8 changed files with 89 additions and 36 deletions

View File

@ -162,6 +162,16 @@ public class RepairInputDetails extends BaseEntity {
@ApiModelProperty(value = "操作后库存数量") @ApiModelProperty(value = "操作后库存数量")
private BigDecimal postStoreNum; private BigDecimal postStoreNum;
@ApiModelProperty(value = "审核人id")
private Long auditBy;
@ApiModelProperty(value = "审核人")
private String auditByName;
@ApiModelProperty(value = "审核时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date auditTime;
@ApiModelProperty(value = "编码列表") @ApiModelProperty(value = "编码列表")
private List<RepairInputDetails> maCodeList; private List<RepairInputDetails> maCodeList;

View File

@ -78,7 +78,7 @@ public class ArchivesController extends BaseController {
* @return * @return
*/ */
@ApiOperation(value = "新增电子档案右侧类型") @ApiOperation(value = "新增电子档案右侧类型")
//@PreventRepeatSubmit @PreventRepeatSubmit
//@RequiresPermissions("archives:type:add") //@RequiresPermissions("archives:type:add")
@PostMapping("/addDetails") @PostMapping("/addDetails")
public AjaxResult addDetails(@RequestBody ArchivesVo archivesVo) public AjaxResult addDetails(@RequestBody ArchivesVo archivesVo)

View File

@ -338,7 +338,7 @@ public class ArchivesServiceImpl implements ArchivesService {
String suffix = fileName.substring(dotIndex); String suffix = fileName.substring(dotIndex);
// 拼接最终的文件名 // 拼接最终的文件名
String extractedFileName = namePart + suffix; String extractedFileName = namePart + suffix;
String savePath = System.getProperty("user.home") + File.separator + extractedFileName; String savePath = "D:/" + extractedFileName;
// 检查文件保存路径是否可写 // 检查文件保存路径是否可写
Path path = Paths.get(savePath); Path path = Paths.get(savePath);
if (Files.isWritable(path.getParent())) { if (Files.isWritable(path.getParent())) {
@ -347,7 +347,7 @@ public class ArchivesServiceImpl implements ArchivesService {
// 将文件添加到压缩包 // 将文件添加到压缩包
fileToZip(savePath, fileName, zipOut); fileToZip(savePath, fileName, zipOut);
// 将临时文件删除 // 将临时文件删除
//new File(savePath).delete(); new File(savePath).delete();
} else { } else {
System.err.println("保存文件的路径不可写: " + savePath); System.err.println("保存文件的路径不可写: " + savePath);
} }
@ -366,7 +366,7 @@ public class ArchivesServiceImpl implements ArchivesService {
inputStream.close(); inputStream.close();
//下载完成之后删掉这个zip包 //下载完成之后删掉这个zip包
File fileTempZip = new File(zipSavePath); File fileTempZip = new File(zipSavePath);
//fileTempZip.delete(); fileTempZip.delete();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -379,7 +379,11 @@ public class ArchivesServiceImpl implements ArchivesService {
* @param savePath * @param savePath
*/ */
private void downloadFile(String fileUrl, String savePath) throws IOException { private void downloadFile(String fileUrl, String savePath) throws IOException {
URL url = new URL(fileUrl); //处理中文文件名的问题
String fileName = fileUrl.substring(fileUrl.lastIndexOf('/') + 1);
String encodedFileName = URLEncoder.encode(fileName, "UTF-8");
String newPath = fileUrl.substring(0, fileUrl.lastIndexOf('/') + 1) + encodedFileName;
URL url = new URL(newPath);
HttpURLConnection connection = (HttpURLConnection) url.openConnection(); HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// 设置请求方法为 GET // 设置请求方法为 GET
connection.setRequestMethod("GET"); connection.setRequestMethod("GET");
@ -393,8 +397,8 @@ public class ArchivesServiceImpl implements ArchivesService {
// 假设需要添加认证信息添加 Authorization 根据实际情况修改 // 假设需要添加认证信息添加 Authorization 根据实际情况修改
connection.setRequestProperty("Authorization", "Bearer your_access_token"); connection.setRequestProperty("Authorization", "Bearer your_access_token");
// 延长连接超时和读取超时时间 // 延长连接超时和读取超时时间
connection.setConnectTimeout(50000); connection.setConnectTimeout(10000);
connection.setReadTimeout(50000); connection.setReadTimeout(10000);
try { try {
int responseCode = connection.getResponseCode(); int responseCode = connection.getResponseCode();
if (responseCode == 200) { if (responseCode == 200) {

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
@ -61,4 +62,14 @@ public class MaCodeVo {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
@ApiModelProperty(value = "审核人")
private String auditByName;
@ApiModelProperty(value = "审核时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date auditTime;
@ApiModelProperty(value = "驳回数量")
private BigDecimal rejectNum;
} }

View File

@ -578,10 +578,20 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
List<Integer> statusList = repairAuditDetailsByTaskId.stream() List<Integer> statusList = repairAuditDetailsByTaskId.stream()
.map(scrapApplyDetail -> Integer.parseInt(scrapApplyDetail.getStatus())) .map(scrapApplyDetail -> Integer.parseInt(scrapApplyDetail.getStatus()))
.collect(Collectors.toList()); .collect(Collectors.toList());
if (!statusList.contains(RepairTaskStatusEnum.TASK_STATUS_PROCESSING.getStatus())) { if (!CollectionUtils.isEmpty(statusList)) {
result += taskMapper.updateTaskStatus(auditDetails1.getTaskId().toString(), RepairTaskStatusEnum.TASK_STATUS_REVIEW.getStatus()); boolean notContainsNoFinished =!statusList.contains(RepairTaskStatusEnum.TASK_STATUS_PROCESSING.getStatus());
} else if (statusList.stream().allMatch(newStatus -> newStatus.equals(RepairTaskStatusEnum.TASK_STATUS_NO_REVIEW.getStatus()))){ boolean allReject = true;
result += taskMapper.updateTaskStatus(auditDetails1.getTaskId().toString(), RepairTaskStatusEnum.TASK_STATUS_NO_REVIEW.getStatus()); for (Integer newStatus : statusList) {
if (!newStatus.equals(RepairTaskStatusEnum.TASK_STATUS_NO_REVIEW.getStatus())) {
allReject = false;
break;
}
}
if (notContainsNoFinished && !allReject) {
taskMapper.updateTaskStatus(auditDetails1.getTaskId().toString(), RepairTaskStatusEnum.TASK_STATUS_REVIEW.getStatus());
} else if (notContainsNoFinished && allReject) {
taskMapper.updateTaskStatus(auditDetails1.getTaskId().toString(), RepairTaskStatusEnum.TASK_STATUS_NO_REVIEW.getStatus());
}
} }
} }
return result; return result;
@ -609,14 +619,16 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
if (null != details.getMaId()) { if (null != details.getMaId()) {
repairAuditDetailsMapper.updateMachine(details); repairAuditDetailsMapper.updateMachine(details);
} }
final RepairInputDetails inputVo = new RepairInputDetails(); if (details.getRepairedNum().compareTo(BigDecimal.ZERO) > 0) {
BeanUtils.copyProperties(details, inputVo); final RepairInputDetails inputVo = new RepairInputDetails();
inputVo.setRepairNum(details.getRepairedNum()); BeanUtils.copyProperties(details, inputVo);
inputVo.setAuditId(details.getId()); inputVo.setRepairNum(details.getRepairedNum());
inputVo.setStatus("0"); inputVo.setAuditId(details.getId());
inputVo.setTaskId(newTaskId); inputVo.setStatus("0");
inputVo.setCreateBy(String.valueOf(SecurityUtils.getUserId())); inputVo.setTaskId(newTaskId);
inputList.add(inputVo); inputVo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
inputList.add(inputVo);
}
if (details.getScrapNum().compareTo(BigDecimal.ZERO) > 0) { if (details.getScrapNum().compareTo(BigDecimal.ZERO) > 0) {
ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails(); ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails();
scrapApplyDetails.setTaskId(newScrapTaskId); scrapApplyDetails.setTaskId(newScrapTaskId);
@ -632,7 +644,9 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
} }
} }
// 插入维修入库明细 // 插入维修入库明细
repairInputDetailsMapper.batchInsertRepairInputDetails(inputList); if (!CollectionUtils.isEmpty(inputList)) {
repairInputDetailsMapper.batchInsertRepairInputDetails(inputList);
}
} }
/** /**

View File

@ -333,8 +333,10 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
inputDetails.setMaId(repairInputInfo.getMaId() == null ? null : repairInputInfo.getMaId()); inputDetails.setMaId(repairInputInfo.getMaId() == null ? null : repairInputInfo.getMaId());
inputDetails.setTaskId(repairInputInfo.getTaskId()); inputDetails.setTaskId(repairInputInfo.getTaskId());
inputDetails.setTypeId(repairInputInfo.getTypeId()); inputDetails.setTypeId(repairInputInfo.getTypeId());
inputDetails.setUpdateBy(SecurityUtils.getUsername()); inputDetails.setUpdateBy(SecurityUtils.getUserId().toString());
inputDetails.setUpdateTime(DateUtils.getNowDate()); inputDetails.setUpdateTime(DateUtils.getNowDate());
inputDetails.setAuditBy(SecurityUtils.getUserId());
inputDetails.setAuditTime(DateUtils.getNowDate());
result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails); result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails);
if ("0".equals(repairInputInfo.getManageType())) { if ("0".equals(repairInputInfo.getManageType())) {
@ -360,7 +362,7 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
//根据任务id查询退料id //根据任务id查询退料id
Long backId = repairInputDetailsMapper.selectBackIdByTaskId(repairInputDetails.getTaskId()); Long backId = repairInputDetailsMapper.selectBackIdByTaskId(repairInputDetails.getTaskId());
repairInputDetails.setCreateBy(SecurityUtils.getUsername()); repairInputDetails.setCreateBy(SecurityUtils.getUsername());
repairInputDetails.setUpdateBy(SecurityUtils.getUsername()); repairInputDetails.setUpdateBy(SecurityUtils.getUserId().toString());
repairInputDetails.setUpdateTime(DateUtils.getNowDate()); repairInputDetails.setUpdateTime(DateUtils.getNowDate());
repairInputDetails.setBackId(backId); repairInputDetails.setBackId(backId);
// 编码类型驳回 // 编码类型驳回
@ -389,11 +391,13 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
inputDetails.setTaskId(repairInputDetails.getTaskId()); inputDetails.setTaskId(repairInputDetails.getTaskId());
inputDetails.setTypeId(repairInputDetails.getTypeId()); inputDetails.setTypeId(repairInputDetails.getTypeId());
inputDetails.setRejectNum(BigDecimal.valueOf(1)); inputDetails.setRejectNum(BigDecimal.valueOf(1));
inputDetails.setUpdateBy(SecurityUtils.getUsername()); inputDetails.setUpdateBy(SecurityUtils.getUserId().toString());
inputDetails.setUpdateTime(DateUtils.getNowDate()); inputDetails.setUpdateTime(DateUtils.getNowDate());
inputDetails.setCreateBy(SecurityUtils.getUsername()); inputDetails.setCreateBy(SecurityUtils.getUsername());
inputDetails.setRejectReason(repairInputDetails.getRejectReason()); inputDetails.setRejectReason(repairInputDetails.getRejectReason());
inputDetails.setBackId(repairInputDetails.getBackId()); inputDetails.setBackId(repairInputDetails.getBackId());
inputDetails.setAuditBy(SecurityUtils.getUserId());
inputDetails.setAuditTime(DateUtils.getNowDate());
result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails); result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails);
inputDetails.setStatus(MaMachineStatusEnum.BACK_REPAIR.getStatus().toString()); inputDetails.setStatus(MaMachineStatusEnum.BACK_REPAIR.getStatus().toString());
updateRepairInputInfo(inputDetails); updateRepairInputInfo(inputDetails);
@ -413,6 +417,8 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
private int processQuantityTypeReject(RepairInputDetails repairInputDetails) { private int processQuantityTypeReject(RepairInputDetails repairInputDetails) {
int result = 0; int result = 0;
repairInputDetails.setStatus(repairInputDetails.getRejectNum().equals(repairInputDetails.getPendingInputNum()) ? "2" : "0"); repairInputDetails.setStatus(repairInputDetails.getRejectNum().equals(repairInputDetails.getPendingInputNum()) ? "2" : "0");
repairInputDetails.setAuditBy(SecurityUtils.getUserId());
repairInputDetails.setAuditTime(DateUtils.getNowDate());
result += repairInputDetailsMapper.updateRepairInputDetails(repairInputDetails); result += repairInputDetailsMapper.updateRepairInputDetails(repairInputDetails);
if (result > 0) { if (result > 0) {
updateTaskStatus(repairInputDetails); updateTaskStatus(repairInputDetails);
@ -505,7 +511,7 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
throw new ServiceException("入库数量不能大于预入库数量"); throw new ServiceException("入库数量不能大于预入库数量");
} }
} }
repairInputDetails.setUpdateBy(SecurityUtils.getUsername()); repairInputDetails.setUpdateBy(SecurityUtils.getUserId().toString());
repairInputDetails.setUpdateTime(DateUtils.getNowDate()); repairInputDetails.setUpdateTime(DateUtils.getNowDate());
// 编码类型入库 // 编码类型入库
@ -554,8 +560,10 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
inputDetails.setTaskId(repairInputDetails.getTaskId()); inputDetails.setTaskId(repairInputDetails.getTaskId());
inputDetails.setTypeId(repairInputDetails.getTypeId()); inputDetails.setTypeId(repairInputDetails.getTypeId());
inputDetails.setInputNum(BigDecimal.valueOf(1)); inputDetails.setInputNum(BigDecimal.valueOf(1));
inputDetails.setUpdateBy(SecurityUtils.getUsername()); inputDetails.setUpdateBy(SecurityUtils.getUserId().toString());
inputDetails.setUpdateTime(DateUtils.getNowDate()); inputDetails.setUpdateTime(DateUtils.getNowDate());
inputDetails.setAuditBy(SecurityUtils.getUserId());
inputDetails.setAuditTime(DateUtils.getNowDate());
result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails); result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails);
inputDetails.setStatus(MaMachineStatusEnum.IN_STORE.getStatus().toString()); inputDetails.setStatus(MaMachineStatusEnum.IN_STORE.getStatus().toString());
updateRepairInputInfo(inputDetails); updateRepairInputInfo(inputDetails);
@ -574,6 +582,8 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
private int processQuantityTypeStorage(RepairInputDetails repairInputDetails) { private int processQuantityTypeStorage(RepairInputDetails repairInputDetails) {
int result = 0; int result = 0;
repairInputDetails.setStatus(repairInputDetails.getInputNum().equals(repairInputDetails.getPendingInputNum()) ? "1" : "0"); repairInputDetails.setStatus(repairInputDetails.getInputNum().equals(repairInputDetails.getPendingInputNum()) ? "1" : "0");
repairInputDetails.setAuditBy(SecurityUtils.getUserId());
repairInputDetails.setAuditTime(DateUtils.getNowDate());
result += repairInputDetailsMapper.updateRepairInputDetails(repairInputDetails); result += repairInputDetailsMapper.updateRepairInputDetails(repairInputDetails);
if (result > 0) { if (result > 0) {
updateTaskStatus(repairInputDetails); updateTaskStatus(repairInputDetails);
@ -668,6 +678,8 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
inputDetails.setMaId(repairInputInfo.getMaId() == null ? null : repairInputInfo.getMaId()); inputDetails.setMaId(repairInputInfo.getMaId() == null ? null : repairInputInfo.getMaId());
inputDetails.setTaskId(repairInputInfo.getTaskId()); inputDetails.setTaskId(repairInputInfo.getTaskId());
inputDetails.setTypeId(repairInputInfo.getTypeId()); inputDetails.setTypeId(repairInputInfo.getTypeId());
inputDetails.setAuditBy(SecurityUtils.getUserId());
inputDetails.setAuditTime(DateUtils.getNowDate());
result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails); result += repairInputDetailsMapper.updateRepairInputDetails(inputDetails);
if ("1".equals(repairInputInfo.getManageType())) { if ("1".equals(repairInputInfo.getManageType())) {

View File

@ -159,15 +159,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
// TODO: 报废审核二级页面通过 // TODO: 报废审核二级页面通过
int result = 0; int result = 0;
if (scrapApplyDetails != null) { if (scrapApplyDetails != null) {
/*if (scrapApplyDetails.getId() != null) { if (CollectionUtils.isNotEmpty(scrapApplyDetails.getScrapApplyDetailsList())) {
scrapApplyDetails.setStatus("1");
scrapApplyDetails.setAuditBy(SecurityUtils.getUserId());
scrapApplyDetails.setAuditTime(DateUtils.getNowDate());
result = scrapApplyDetailsMapper.updateStatus(scrapApplyDetails);
if (result > 0) {
updateTaskStatus(scrapApplyDetails);
}
} else */if (CollectionUtils.isNotEmpty(scrapApplyDetails.getScrapApplyDetailsList())) {
for (ScrapApplyDetails applyDetails : scrapApplyDetails.getScrapApplyDetailsList()) { for (ScrapApplyDetails applyDetails : scrapApplyDetails.getScrapApplyDetailsList()) {
applyDetails.setStatus("1"); applyDetails.setStatus("1");
applyDetails.setAuditBy(SecurityUtils.getUserId()); applyDetails.setAuditBy(SecurityUtils.getUserId());

View File

@ -94,8 +94,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(SUM(IFNULL(rid.repair_num, 0)) - SUM(IFNULL(rid.input_num, 0)) - SUM(IFNULL(rid.reject_num, 0))) (SUM(IFNULL(rid.repair_num, 0)) - SUM(IFNULL(rid.input_num, 0)) - SUM(IFNULL(rid.reject_num, 0)))
AS pendingInputNum, AS pendingInputNum,
SUM(IFNULL(rid.reject_num, 0)) as rejectNum, SUM(IFNULL(rid.reject_num, 0)) as rejectNum,
rid.create_by as createBy, su.nick_name as createBy,
rid.create_time as createTime, rid.create_time as createTime,
su1.nick_name as auditBy,
rid.audit_time as auditTime,
rid.remark as remark, rid.remark as remark,
mt1.type_name AS typeName, mt1.type_name AS typeName,
mt.type_name AS typeModelName, mt.type_name AS typeModelName,
@ -108,6 +110,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt on rid.type_id = mt.type_id and mt.del_flag = '0' LEFT JOIN ma_type mt on rid.type_id = mt.type_id and mt.del_flag = '0'
LEFT JOIN ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0' LEFT JOIN ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0'
LEFT JOIN tm_task_agreement tta ON rid.task_id = tta.task_id LEFT JOIN tm_task_agreement tta ON rid.task_id = tta.task_id
LEFT JOIN sys_user su on rid.create_by = su.user_id
LEFT JOIN sys_user su1 on rid.audit_by = su1.user_id
where rid.task_id = #{taskId} where rid.task_id = #{taskId}
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
AND ( AND (
@ -130,7 +134,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_name as materialName, mt.type_name as materialName,
mm.ma_code as maCode, mm.ma_code as maCode,
mm.ma_status as maStatus, mm.ma_status as maStatus,
rid.reject_reason as rejectReason rid.reject_reason as rejectReason,
su.nick_name as auditByName,
rid.audit_time as auditTime,
rid.reject_num as rejectNum
FROM FROM
repair_input_details rid repair_input_details rid
LEFT JOIN ma_machine mm ON rid.ma_id = mm.ma_id LEFT JOIN ma_machine mm ON rid.ma_id = mm.ma_id
@ -138,6 +145,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mt.del_flag = '0' AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
AND mt1.del_flag = '0' AND mt1.del_flag = '0'
LEFT JOIN sys_user su on rid.audit_by = su.user_id
WHERE WHERE
rid.task_id = #{taskId} rid.task_id = #{taskId}
AND rid.type_id = #{typeId} AND rid.type_id = #{typeId}
@ -370,6 +378,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rejectReason != null and rejectReason != ''">reject_reason = #{rejectReason},</if> <if test="rejectReason != null and rejectReason != ''">reject_reason = #{rejectReason},</if>
update_by = #{updateBy}, update_by = #{updateBy},
update_time = #{updateTime}, update_time = #{updateTime},
audit_by = #{auditBy},
audit_time = #{auditTime},
status = #{status} status = #{status}
WHERE task_id = #{taskId} WHERE task_id = #{taskId}
and type_id = #{typeId} and type_id = #{typeId}