台账审核
This commit is contained in:
parent
52b233f067
commit
cf65ca7a08
|
|
@ -9,6 +9,7 @@ import com.bonus.common.core.utils.ServletUtils;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
||||||
|
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -55,6 +56,34 @@ public class ScrapApplyDetailsController extends BaseController {
|
||||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账任务列表
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询报废台账任务列表")
|
||||||
|
// @RequiresPermissions("scrap:details:list")
|
||||||
|
@GetMapping("/getTotalList")
|
||||||
|
public AjaxResult getTotalList(ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||||
|
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||||
|
List<ScrapTotalListVo> list = scrapApplyDetailsService.selectTotalScrapApplyDetailsList(scrapApplyDetails);
|
||||||
|
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账审核总费用
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询报废台账审核总费用")
|
||||||
|
// @RequiresPermissions("scrap:details:list")
|
||||||
|
@GetMapping("/getTotalPrice")
|
||||||
|
public AjaxResult getTotalPrice(ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
ScrapTotalListVo list = scrapApplyDetailsService.getTotalPrice(scrapApplyDetails);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询报废任务详细列表--根据任务ID
|
* 查询报废任务详细列表--根据任务ID
|
||||||
*/
|
*/
|
||||||
|
|
@ -90,6 +119,17 @@ public class ScrapApplyDetailsController extends BaseController {
|
||||||
return scrapApplyDetailsService.approve(scrapApplyDetails);
|
return scrapApplyDetailsService.approve(scrapApplyDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报废台账审核通过
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "报废台账审核通过")
|
||||||
|
@PostMapping("/ledgerApprove")
|
||||||
|
public AjaxResult ledgerApprove(@RequestBody ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
return scrapApplyDetailsService.ledgerApprove(scrapApplyDetails);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报废审核驳回
|
* 报废审核驳回
|
||||||
* @param scrapApplyDetails
|
* @param scrapApplyDetails
|
||||||
|
|
@ -101,6 +141,17 @@ public class ScrapApplyDetailsController extends BaseController {
|
||||||
return scrapApplyDetailsService.reject(scrapApplyDetails);
|
return scrapApplyDetailsService.reject(scrapApplyDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报废台账审核驳回
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "报废台账审核驳回")
|
||||||
|
@PostMapping("/ledgerReject")
|
||||||
|
public AjaxResult ledgerReject(@RequestBody ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
return scrapApplyDetailsService.ledgerReject(scrapApplyDetails);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取报废任务详细详细信息
|
* 获取报废任务详细详细信息
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,15 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
public class ScrapApplyDetails extends BaseEntity {
|
public class ScrapApplyDetails extends BaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ids结果集")
|
||||||
|
private List<Long> idList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务id结果集")
|
||||||
|
private List<Long> taskIdList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "驳回原因")
|
||||||
|
private String rejectReason;
|
||||||
|
|
||||||
/** id */
|
/** id */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
|
@ -140,12 +149,22 @@ public class ScrapApplyDetails extends BaseEntity {
|
||||||
@ApiModelProperty(value = "审核人id")
|
@ApiModelProperty(value = "审核人id")
|
||||||
private Long auditBy;
|
private Long auditBy;
|
||||||
|
|
||||||
|
/** 报废台账审核人id */
|
||||||
|
@ApiModelProperty(value = "报废台账审核人id")
|
||||||
|
private Long ledgerBy;
|
||||||
|
|
||||||
/** 审核时间 */
|
/** 审核时间 */
|
||||||
@ApiModelProperty(value = "审核时间")
|
@ApiModelProperty(value = "审核时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date auditTime;
|
private Date auditTime;
|
||||||
|
|
||||||
|
/** 报废台账审核时间 */
|
||||||
|
@ApiModelProperty(value = "报废台账审核时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "报废台账审核时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date ledgerTime;
|
||||||
|
|
||||||
/** 审核备注 */
|
/** 审核备注 */
|
||||||
@Excel(name = "审核备注")
|
@Excel(name = "审核备注")
|
||||||
@ApiModelProperty(value = "审核备注")
|
@ApiModelProperty(value = "审核备注")
|
||||||
|
|
@ -179,4 +198,7 @@ public class ScrapApplyDetails extends BaseEntity {
|
||||||
|
|
||||||
@ApiModelProperty(value = "结束时间")
|
@ApiModelProperty(value = "结束时间")
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "台账审核状态 0待审核,1已审核,2驳回")
|
||||||
|
private String ledgerStatus;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ public class ScrapTaskListVo {
|
||||||
@Excel(name = "备注")
|
@Excel(name = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "关键字")
|
||||||
private String keyWord;
|
private String keyWord;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
package com.bonus.material.scrap.domain.vo;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报废台账返回实体类
|
||||||
|
* @author ma_sh
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ScrapTotalListVo {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ids结果集")
|
||||||
|
private String ids;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务id结果集")
|
||||||
|
private String taskIds;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ids结果集")
|
||||||
|
private List<Long> idList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务id结果集")
|
||||||
|
private List<Long> taskIdList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "物资类型名称")
|
||||||
|
@Excel(name = "类型名称")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/** 规格ID */
|
||||||
|
@ApiModelProperty(value = "规格ID")
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规格型号名称")
|
||||||
|
@Excel(name = "规格型号")
|
||||||
|
private String typeModelName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "单位")
|
||||||
|
@Excel(name = "计量单位")
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
/** 报废数量 */
|
||||||
|
@Excel(name = "报废数量")
|
||||||
|
@ApiModelProperty(value = "报废数量")
|
||||||
|
private BigDecimal scrapNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "费用合计")
|
||||||
|
@Excel(name = "报废费用(万元)")
|
||||||
|
private BigDecimal totalCost;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "购置价")
|
||||||
|
private BigDecimal buyPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "报废类型")
|
||||||
|
@Excel(name = "报废类型")
|
||||||
|
private String scrapStyle;
|
||||||
|
|
||||||
|
/** (0自然,1人为) */
|
||||||
|
@Excel(name = "损坏类型", readConverterExp = "0=自然损坏,1=人为损坏")
|
||||||
|
private String scrapType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务创建人昵称")
|
||||||
|
@Excel(name = "提交人")
|
||||||
|
private String createName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "本次审核周期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM")
|
||||||
|
@Excel(name = "本次审核周期")
|
||||||
|
private String month;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "台账审核状态 0待审核,1已审核,2驳回")
|
||||||
|
@Excel(name = "状态", readConverterExp = "0=待审核,1=已审核,2=驳回")
|
||||||
|
private String ledgerStatus;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@ import com.bonus.material.repair.domain.RepairAuditDetails;
|
||||||
import com.bonus.material.repair.domain.RepairRecord;
|
import com.bonus.material.repair.domain.RepairRecord;
|
||||||
import com.bonus.material.scrap.domain.ScrapApplyDetails;
|
import com.bonus.material.scrap.domain.ScrapApplyDetails;
|
||||||
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
||||||
|
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报废任务详细Mapper接口
|
* 报废任务详细Mapper接口
|
||||||
|
|
@ -100,4 +101,25 @@ public interface ScrapApplyDetailsMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int insertRad(ScrapApplyDetails applyDetails);
|
int insertRad(ScrapApplyDetails applyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账任务列表
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ScrapTotalListVo> selectTotalScrapApplyDetailsList(ScrapApplyDetails scrapApplyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务id查询报废详情
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ScrapApplyDetails> selectScrapByTaskId(RepairAuditDetails dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 台账审核
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int ledgerApprove(ScrapApplyDetails scrapApplyDetails);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.material.scrap.domain.ScrapApplyDetails;
|
import com.bonus.material.scrap.domain.ScrapApplyDetails;
|
||||||
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
||||||
|
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报废任务详细Service接口
|
* 报废任务详细Service接口
|
||||||
|
|
@ -83,4 +84,32 @@ public interface IScrapApplyDetailsService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult reject(ScrapApplyDetails scrapApplyDetails);
|
AjaxResult reject(ScrapApplyDetails scrapApplyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账任务列表
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ScrapTotalListVo> selectTotalScrapApplyDetailsList(ScrapApplyDetails scrapApplyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报废台账审核通过
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult ledgerApprove(ScrapApplyDetails scrapApplyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报废台账审核驳回
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult ledgerReject(ScrapApplyDetails scrapApplyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账审核总费用
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ScrapTotalListVo getTotalPrice(ScrapApplyDetails scrapApplyDetails);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
package com.bonus.material.scrap.service.impl;
|
package com.bonus.material.scrap.service.impl;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -17,10 +19,12 @@ import com.bonus.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.common.biz.domain.BmFileInfo;
|
import com.bonus.common.biz.domain.BmFileInfo;
|
||||||
import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
||||||
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
|
||||||
|
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;
|
||||||
import com.bonus.material.task.domain.TmTask;
|
import com.bonus.material.task.domain.TmTask;
|
||||||
import com.bonus.material.task.domain.TmTaskAgreement;
|
import com.bonus.material.task.domain.TmTaskAgreement;
|
||||||
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
|
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
|
||||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.material.scrap.mapper.ScrapApplyDetailsMapper;
|
import com.bonus.material.scrap.mapper.ScrapApplyDetailsMapper;
|
||||||
import com.bonus.material.scrap.domain.ScrapApplyDetails;
|
import com.bonus.material.scrap.domain.ScrapApplyDetails;
|
||||||
|
|
@ -36,6 +40,7 @@ import javax.annotation.Resource;
|
||||||
* @date 2024-10-16
|
* @date 2024-10-16
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
@Resource
|
@Resource
|
||||||
private ScrapApplyDetailsMapper scrapApplyDetailsMapper;
|
private ScrapApplyDetailsMapper scrapApplyDetailsMapper;
|
||||||
|
|
@ -104,11 +109,10 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ScrapApplyDetails> selectRepairQuestListByTaskId(ScrapApplyDetails scrapApplyDetails) {
|
public List<ScrapApplyDetails> selectRepairQuestListByTaskId(ScrapApplyDetails scrapApplyDetails) {
|
||||||
BigDecimal totalCost = BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
List<ScrapApplyDetails> list = scrapApplyDetailsMapper.selectRepairQuestListByTaskId(scrapApplyDetails);
|
List<ScrapApplyDetails> list = scrapApplyDetailsMapper.selectRepairQuestListByTaskId(scrapApplyDetails);
|
||||||
if (CollectionUtils.isNotEmpty(list)) {
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
for (ScrapApplyDetails applyDetails : list) {
|
for (ScrapApplyDetails applyDetails : list) {
|
||||||
totalCost = totalCost.add(applyDetails.getScrapNum().multiply(applyDetails.getBuyPrice()));
|
BigDecimal totalCost = applyDetails.getScrapNum().multiply(applyDetails.getBuyPrice());
|
||||||
applyDetails.setTotalCost(totalCost);
|
applyDetails.setTotalCost(totalCost);
|
||||||
BmFileInfo bmFileInfo = new BmFileInfo();
|
BmFileInfo bmFileInfo = new BmFileInfo();
|
||||||
bmFileInfo.setModelId(applyDetails.getRepairId());
|
bmFileInfo.setModelId(applyDetails.getRepairId());
|
||||||
|
|
@ -327,6 +331,142 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账任务列表
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ScrapTotalListVo> selectTotalScrapApplyDetailsList(ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
List<ScrapTotalListVo> list = scrapApplyDetailsMapper.selectTotalScrapApplyDetailsList(scrapApplyDetails);
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
for (ScrapTotalListVo applyDetails : list) {
|
||||||
|
BigDecimal totalCost = applyDetails.getScrapNum().multiply(applyDetails.getBuyPrice()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_UP);
|
||||||
|
applyDetails.setTotalCost(totalCost);
|
||||||
|
List<String> asList = Arrays.asList(applyDetails.getIds().split(","));
|
||||||
|
List<Long> longList = asList.stream()
|
||||||
|
.map(Long::parseLong)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<String> taskList = Arrays.asList(applyDetails.getTaskIds().split(","));
|
||||||
|
List<Long> longTaskList = taskList.stream()
|
||||||
|
.map(Long::parseLong)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
applyDetails.setIdList(longList);
|
||||||
|
applyDetails.setTaskIdList(longTaskList);
|
||||||
|
applyDetails.setScrapStyle("维修报废");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报废台账审核通过
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult ledgerApprove(ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
if (scrapApplyDetails == null || CollectionUtils.isEmpty(scrapApplyDetails.getIdList())) {
|
||||||
|
return AjaxResult.error("参数为空");
|
||||||
|
}
|
||||||
|
// 根据传参修改报废状态
|
||||||
|
int result = 0;
|
||||||
|
for (Long id : scrapApplyDetails.getIdList()) {
|
||||||
|
scrapApplyDetails.setId(id);
|
||||||
|
scrapApplyDetails.setLedgerStatus("1");
|
||||||
|
scrapApplyDetails.setLedgerBy(SecurityUtils.getUserId());
|
||||||
|
scrapApplyDetails.setLedgerTime(DateUtils.getNowDate());
|
||||||
|
result += scrapApplyDetailsMapper.ledgerApprove(scrapApplyDetails);
|
||||||
|
}
|
||||||
|
if (result > 0) {
|
||||||
|
return AjaxResult.success("审核通过");
|
||||||
|
}
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报废台账审核驳回
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult ledgerReject(ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
if (scrapApplyDetails == null || CollectionUtils.isEmpty(scrapApplyDetails.getIdList()) || CollectionUtils.isEmpty(scrapApplyDetails.getTaskIdList())) {
|
||||||
|
return AjaxResult.error("参数为空");
|
||||||
|
}
|
||||||
|
int result = 0;
|
||||||
|
try {
|
||||||
|
// 将taskId进行去重
|
||||||
|
List<Long> taskIdList = scrapApplyDetails.getTaskIdList().stream()
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<Long> idList = scrapApplyDetails.getIdList();
|
||||||
|
for (Long taskId : taskIdList) {
|
||||||
|
// 根据taskId查询协议id
|
||||||
|
Long agreementId = taskAgreementMapper.selectAgreementIdByTaskId(taskId);
|
||||||
|
scrapApplyDetails.setTaskId(taskId);
|
||||||
|
List<ScrapApplyDetails> scrapApplyDetailsList = scrapApplyDetailsMapper.selectRepairQuestListByTaskId(scrapApplyDetails);
|
||||||
|
scrapApplyDetails.setAgreementId(agreementId);
|
||||||
|
//插入任务表
|
||||||
|
Long newTaskId = insertTt(taskId);
|
||||||
|
result += insertTta(newTaskId, scrapApplyDetails);
|
||||||
|
if (CollectionUtils.isNotEmpty(scrapApplyDetailsList)) {
|
||||||
|
for (ScrapApplyDetails applyDetails : scrapApplyDetailsList) {
|
||||||
|
if (idList.contains(applyDetails.getId())) {
|
||||||
|
applyDetails.setLedgerStatus("2");
|
||||||
|
applyDetails.setLedgerBy(SecurityUtils.getUserId());
|
||||||
|
applyDetails.setLedgerTime(DateUtils.getNowDate());
|
||||||
|
applyDetails.setRejectReason(scrapApplyDetails.getRejectReason());
|
||||||
|
result = scrapApplyDetailsMapper.ledgerApprove(applyDetails);
|
||||||
|
if (applyDetails.getMaId() != null) {
|
||||||
|
applyDetails.setStatus(MaMachineStatusEnum.BACK_REPAIR.getStatus().toString());
|
||||||
|
result += scrapApplyDetailsMapper.updateMaStatus(applyDetails);
|
||||||
|
}
|
||||||
|
Long backId = scrapApplyDetailsMapper.selectBackIdByTaskId(applyDetails.getParentId());
|
||||||
|
applyDetails.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
applyDetails.setCreateTime(DateUtils.getNowDate());
|
||||||
|
applyDetails.setBackId(backId);
|
||||||
|
applyDetails.setNewTaskId(newTaskId);
|
||||||
|
result += insertWxTask(applyDetails);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("驳回失败", e);
|
||||||
|
throw new RuntimeException("驳回失败");
|
||||||
|
}
|
||||||
|
if (result > 0) {
|
||||||
|
return AjaxResult.success("驳回成功");
|
||||||
|
}
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报废台账审核总费用
|
||||||
|
* @param scrapApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ScrapTotalListVo getTotalPrice(ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
ScrapTotalListVo scrapTotalListVo = new ScrapTotalListVo();
|
||||||
|
BigDecimal totalCost = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
|
||||||
|
List<ScrapTotalListVo> list = scrapApplyDetailsMapper.selectTotalScrapApplyDetailsList(scrapApplyDetails);
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
for (ScrapTotalListVo item : list) {
|
||||||
|
totalCost = totalCost.add(item.getScrapNum().multiply(item.getBuyPrice()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_UP));
|
||||||
|
}
|
||||||
|
String result = list.stream()
|
||||||
|
.map(ScrapTotalListVo::getMonth) // 提取 month 属性
|
||||||
|
.distinct() // 去重
|
||||||
|
.collect(Collectors.joining(",")); // 用逗号拼接
|
||||||
|
scrapTotalListVo.setTotalCost(totalCost);
|
||||||
|
scrapTotalListVo.setMonth(result);
|
||||||
|
}
|
||||||
|
return scrapTotalListVo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增维修单
|
* 新增维修单
|
||||||
* @param applyDetails
|
* @param applyDetails
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN repair_apply_record rar on rar.task_id = ra.task_id
|
LEFT JOIN repair_apply_record rar on rar.task_id = ra.task_id
|
||||||
and (case when mt.manage_type = 0 then rar.ma_id = ra.ma_id
|
and (case when mt.manage_type = 0 then rar.ma_id = ra.ma_id
|
||||||
when mt.manage_type = 1 then rar.type_id = ra.type_id
|
when mt.manage_type = 1 then rar.type_id = ra.type_id
|
||||||
else false end)
|
else false end) and rar.repair_type = '3'
|
||||||
where
|
where
|
||||||
sad.task_id = #{taskId}
|
sad.task_id = #{taskId}
|
||||||
<if test="keyWord != null and keyWord != ''">
|
<if test="keyWord != null and keyWord != ''">
|
||||||
|
|
@ -282,6 +282,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where ma_id = #{maId}
|
where ma_id = #{maId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="ledgerApprove">
|
||||||
|
update scrap_apply_details
|
||||||
|
set ledger_status = #{ledgerStatus},
|
||||||
|
ledger_by = #{ledgerBy},
|
||||||
|
ledger_time = #{ledgerTime},
|
||||||
|
reject_reason = #{rejectReason}
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteScrapApplyDetailsById" parameterType="Long">
|
<delete id="deleteScrapApplyDetailsById" parameterType="Long">
|
||||||
delete from scrap_apply_details where id = #{id}
|
delete from scrap_apply_details where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
@ -319,6 +328,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
group by scrap_type
|
group by scrap_type
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectBackIdByTaskId" resultType="java.lang.Long">
|
<select id="selectBackIdByTaskId" resultType="java.lang.Long">
|
||||||
SELECT
|
SELECT
|
||||||
ra.back_id
|
ra.back_id
|
||||||
|
|
@ -330,5 +340,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
sad.parent_id = #{parentId}
|
sad.parent_id = #{parentId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectScrapByTaskId" resultType="com.bonus.material.scrap.domain.ScrapApplyDetails">
|
||||||
|
SELECT
|
||||||
|
task_id as taskId,
|
||||||
|
ma_id as maId,
|
||||||
|
type_id as typeId,
|
||||||
|
GROUP_CONCAT(DISTINCT scrap_reason) AS scrapReason,
|
||||||
|
GROUP_CONCAT(DISTINCT scrap_type) AS scrapType
|
||||||
|
FROM
|
||||||
|
repair_apply_record
|
||||||
|
WHERE repair_type = '3' and task_id = #{taskId} and type_id = #{typeId}
|
||||||
|
<if test="maId != null">
|
||||||
|
and ma_id = #{maId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTotalScrapApplyDetailsList"
|
||||||
|
resultType="com.bonus.material.scrap.domain.vo.ScrapTotalListVo">
|
||||||
|
SELECT
|
||||||
|
GROUP_CONCAT( sad.id ) AS ids,
|
||||||
|
GROUP_CONCAT( sad.task_id ) AS taskIds,
|
||||||
|
mt2.type_name AS typeName,
|
||||||
|
mt.type_id AS typeId,
|
||||||
|
mt.type_name AS typeModelName,
|
||||||
|
mt.unit_name AS unitName,
|
||||||
|
mt.manage_type AS manageType,
|
||||||
|
sum( sad.scrap_num ) AS scrapNum,
|
||||||
|
mt.buy_price AS buyPrice,
|
||||||
|
sad.scrap_type AS scrapType,
|
||||||
|
GROUP_CONCAT( DISTINCT sad.create_by ) AS createName,
|
||||||
|
DATE_FORMAT( sad.create_time, '%Y-%m' ) AS month,
|
||||||
|
sad.ledger_status AS ledgerStatus
|
||||||
|
FROM
|
||||||
|
scrap_apply_details sad
|
||||||
|
LEFT JOIN ma_type mt ON sad.type_id = mt.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||||
|
WHERE sad.`status` = '1' and sad.ledger_status = '0'
|
||||||
|
<if test="keyWord != null and keyWord != ''">
|
||||||
|
AND (
|
||||||
|
mt2.type_name like concat('%', #{keyWord}, '%') or
|
||||||
|
mt.type_name like concat('%', #{keyWord}, '%') or
|
||||||
|
sad.scrap_type like concat('%', #{keyWord}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
|
<![CDATA[
|
||||||
|
AND DATE_FORMAT( sad.create_time, '%Y-%m' ) BETWEEN DATE_FORMAT(#{startTime}, '%Y-%m') AND DATE_FORMAT(#{endTime}, '%Y-%m')
|
||||||
|
]]>
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
sad.type_id,
|
||||||
|
sad.scrap_type,
|
||||||
|
DATE_FORMAT(
|
||||||
|
sad.create_time,
|
||||||
|
'%Y-%m')
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue