|
@@ -2,16 +2,27 @@ package org.springblade.factory.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.factory.entity.PcBladeClaim;
|
|
|
import org.springblade.factory.entity.PcBladeClaimAudit;
|
|
|
import org.springblade.factory.mapper.PcBladeClaimAuditMapper;
|
|
|
+import org.springblade.factory.mapper.PcBladeClaimMapper;
|
|
|
import org.springblade.factory.service.PcBladeClaimAuditService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
@Service
|
|
|
public class PcBladeClaimAuditServiceImpl extends BaseServiceImpl<PcBladeClaimAuditMapper, PcBladeClaimAudit> implements PcBladeClaimAuditService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PcBladeClaimMapper pcBladeClaimMapper;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public List<PcBladeClaimAudit> selectPcBladeClaimAuditList(PcBladeClaimAudit pcBladeClaimAudit) {
|
|
|
QueryWrapper<PcBladeClaimAudit> queryWrapper = new QueryWrapper<>();
|
|
@@ -24,12 +35,52 @@ public class PcBladeClaimAuditServiceImpl extends BaseServiceImpl<PcBladeClaimAu
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean insertPcBladeClaimAudit(PcBladeClaimAudit pcBladeClaimAudit) {
|
|
|
- return this.save(pcBladeClaimAudit);
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public R<String> insertPcBladeClaimAudit(PcBladeClaimAudit pcBladeClaimAudit) {
|
|
|
+ // 修改理赔表的状态
|
|
|
+ PcBladeClaim pcBladeClaim = new PcBladeClaim();
|
|
|
+ pcBladeClaim.setId(pcBladeClaimAudit.getClaimId());
|
|
|
+ PcBladeClaim pcBladeClaim1 = pcBladeClaimMapper.selectById(pcBladeClaimAudit.getClaimId());
|
|
|
+ if (pcBladeClaim1 == null) {
|
|
|
+ return R.fail("主理赔表不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!Objects.equals(pcBladeClaim1.getAuditStatus(), pcBladeClaimAudit.getAuditResult())) {
|
|
|
+ pcBladeClaim.setAuditStatus(pcBladeClaimAudit.getAuditResult());
|
|
|
+ int res = pcBladeClaimMapper.updateById(pcBladeClaim);
|
|
|
+ if (res == 0) {
|
|
|
+ return R.fail("主理赔表不存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ boolean result = this.save(pcBladeClaimAudit);
|
|
|
+ if (result) {
|
|
|
+ return R.data("成功提交审核");
|
|
|
+ } else {
|
|
|
+ return R.fail("提交审核失败");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean updatePcBladeClaimAudit(PcBladeClaimAudit pcBladeClaimAudit) {
|
|
|
- return this.updateById(pcBladeClaimAudit);
|
|
|
+ public R<String> updatePcBladeClaimAudit(PcBladeClaimAudit pcBladeClaimAudit) {
|
|
|
+ // 修改理赔表的状态
|
|
|
+ PcBladeClaim pcBladeClaim = new PcBladeClaim();
|
|
|
+ pcBladeClaim.setId(pcBladeClaimAudit.getClaimId());
|
|
|
+ PcBladeClaim pcBladeClaim1 = pcBladeClaimMapper.selectById(pcBladeClaimAudit.getClaimId());
|
|
|
+ if (pcBladeClaim1 == null) {
|
|
|
+ return R.fail("主理赔表不存在");
|
|
|
+ }
|
|
|
+ if (!Objects.equals(pcBladeClaim1.getAuditStatus(), pcBladeClaimAudit.getAuditResult())) {
|
|
|
+ pcBladeClaim.setAuditStatus(pcBladeClaimAudit.getAuditResult());
|
|
|
+ int res = pcBladeClaimMapper.updateById(pcBladeClaim);
|
|
|
+ if (res == 0) {
|
|
|
+ return R.fail("主理赔表不存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ boolean result = this.updateById(pcBladeClaimAudit);
|
|
|
+ if (result) {
|
|
|
+ return R.data("成功修改审核");
|
|
|
+ } else {
|
|
|
+ return R.fail("修改审核失败");
|
|
|
+ }
|
|
|
}
|
|
|
}
|