diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java index d32b590f..8df8d0bf 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java @@ -90,6 +90,15 @@ public class SltAgreementInfoController extends BaseController { return AjaxResult.success(bean); } + /** + * 结算审核 + */ + @ApiOperation(value = "结算审核") + @GetMapping("/settlementReview") + public AjaxResult settlementReview(SltAgreementApply apply) { + return toAjax(sltAgreementInfoService.settlementReview(apply)); + } + /** * 导出结算信息列表 */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java index 9c755092..f0d84ebc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java @@ -86,4 +86,10 @@ public interface SltAgreementInfoMapper { List getScrapDetailsList(@Param("taskList") List taskList); List getLoseList(SltAgreementInfo bean); + + int updateRelation(SltAgreementApply apply); + + int updateApply(SltAgreementApply apply); + + int updateMaStatus(SltAgreementInfo agreementInfo); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java index f567d857..d6529a16 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java @@ -37,6 +37,8 @@ public interface ISltAgreementInfoService { SltInfoVo getSltExamInfo(SltAgreementApply apply); + int settlementReview(SltAgreementApply apply); + /** * 新增结算信息 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java index a28fab5c..e59fcd65 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java @@ -7,6 +7,7 @@ import java.util.List; import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.settlement.domain.SltAgreementApply; import com.bonus.material.settlement.domain.SltAgreementRelation; import com.bonus.material.settlement.domain.vo.SltInfoVo; @@ -17,6 +18,7 @@ import org.springframework.stereotype.Service; import com.bonus.material.settlement.mapper.SltAgreementInfoMapper; import com.bonus.material.settlement.domain.SltAgreementInfo; import com.bonus.material.settlement.service.ISltAgreementInfoService; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; @@ -110,6 +112,43 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { return sltInfoVo; } + @Override + @Transactional + public int settlementReview(SltAgreementApply apply) { + Long userid = SecurityUtils.getLoginUser().getUserid(); + apply.setAuditor(String.valueOf(userid)); + int j; + if ("2".equals(apply.getStatus())) { + // 驳回 + int i = sltAgreementInfoMapper.updateRelation(apply); + j = sltAgreementInfoMapper.updateApply(apply); + } else { + // 通过 + int i = sltAgreementInfoMapper.updateRelation(apply); + if (i > 0) { + List relations = sltAgreementInfoMapper.getRelations(apply); + List infos = new ArrayList<>(); + for (SltAgreementRelation bean : relations) { + SltAgreementInfo info = new SltAgreementInfo(); + info.setAgreementId(Long.valueOf(bean.getAgreementId())); + infos.add(info); + } + List loseList = getLoseList(infos); + for (SltAgreementInfo agreementInfo : loseList) { + if (agreementInfo.getMaId() != null) { + agreementInfo.setStatus("103"); + sltAgreementInfoMapper.updateMaStatus(agreementInfo); + } + } + j = sltAgreementInfoMapper.updateApply(apply); + } else { + throw new ServiceException("结算审核失败"); + //throw new ServiceException(ExceptionDict.SETTLEMENT_REVIEW_ERROR_MSG,ExceptionDict.SETTLEMENT_REVIEW_ERROR); + } + } + return j; + } + /** * 新增结算信息 * diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml index bbeda490..d6008bac 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml @@ -373,4 +373,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id where sar.apply_id = #{id} + + + update slt_agreement_relation + set status = #{status} + where apply_id = #{id} + + + + update slt_agreement_apply + set status = #{status}, + auditor = #{auditor}, + audit_time = now(), + remark = #{remark} + where id = #{id} + + + + update ma_machine + set ma_status =#{status} + where ma_id = #{maId} + \ No newline at end of file