Commit 6a24545e by zhangxingmin

Merge remote-tracking branch 'origin/test' into test

parents ebae537a d9a5b15c
...@@ -579,21 +579,7 @@ public class ApiPolicyFollowController { ...@@ -579,21 +579,7 @@ public class ApiPolicyFollowController {
} }
// 修改逻辑 // 修改逻辑
try { policyFollowService.changePolicyFollowStatus(changePolicyFollowStatusRequest, policyFollow);
policyFollowService.changePolicyFollowStatus(changePolicyFollowStatusRequest, policyFollow);
} catch (DataIntegrityViolationException e) {
log.info("修改跟进状态失败:{}", e.getMessage());
// 判断是否为唯一索引冲突
String message = e.getMessage();
if (StringUtils.isNotBlank(message) && message.contains("idx_policy_no")) {
return Result.fail("保单号已存在,请勿重复添加");
} else {
return Result.fail("修改跟进状态失败");
}
} catch (Exception e) {
log.info("修改跟进状态失败:{}", e.getMessage());
return Result.fail("修改跟进状态失败");
}
// 修改为生效时需要同步预计发佣 // 修改为生效时需要同步预计发佣
if (PolicyFollowStatusEnum.EFFECTIVE.equals(currentStatusEnum)) { if (PolicyFollowStatusEnum.EFFECTIVE.equals(currentStatusEnum)) {
......
...@@ -460,7 +460,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService ...@@ -460,7 +460,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
private void updateHkdAmountBatch(List<ExpectedFortune> expectedFortuneList, String policyCurrency, List<ApiAnnouncementCommissionRatioListResponse> announcementRatioList) { public void updateHkdAmountBatch(List<ExpectedFortune> expectedFortuneList, String policyCurrency, List<ApiAnnouncementCommissionRatioListResponse> announcementRatioList) {
log.info("------------------------开始计算默认结算汇率、港币金额----------------------"); log.info("------------------------开始计算默认结算汇率、港币金额----------------------");
......
...@@ -770,6 +770,8 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune> ...@@ -770,6 +770,8 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
ExpectedFortune updateObj = new ExpectedFortune(); ExpectedFortune updateObj = new ExpectedFortune();
updateObj.setId(expectedFortune.getId()); updateObj.setId(expectedFortune.getId());
updateObj.setHkdAmount(expectedFortune.getHkdAmount().add(hkdAmount)); updateObj.setHkdAmount(expectedFortune.getHkdAmount().add(hkdAmount));
updateObj.setUnpaidAmount(hkdAmount.add(expectedFortune.getUnpaidAmount()));
updateObj.setUnpaidRatio(updateObj.getUnpaidAmount().divide(updateObj.getHkdAmount(), 4, RoundingMode.HALF_UP));
// 根据预计出账币种计算 expectedFortune.getAmount() 字段 // 根据预计出账币种计算 expectedFortune.getAmount() 字段
BigDecimal originalAmount = fortune.getAmount(); // 原始币种金额 BigDecimal originalAmount = fortune.getAmount(); // 原始币种金额
......
...@@ -40,6 +40,7 @@ import org.apache.commons.lang3.ObjectUtils; ...@@ -40,6 +40,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -194,12 +195,12 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol ...@@ -194,12 +195,12 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
public Boolean updatePolicyFollowDto(PolicyFollowDto policyFollowDto) { public Boolean updatePolicyFollowDto(PolicyFollowDto policyFollowDto) {
// 校验参数 // 校验参数
if (StringUtils.isBlank(policyFollowDto.getPolicyBizId())) { if (StringUtils.isBlank(policyFollowDto.getPolicyBizId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), "policyBizId不能为空"); throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "policyBizId不能为空");
} }
String policyBizId = policyFollowDto.getPolicyBizId(); String policyBizId = policyFollowDto.getPolicyBizId();
PolicyFollow policyFollow = getByPolicyBizId(policyBizId); PolicyFollow policyFollow = getByPolicyBizId(policyBizId);
if (policyFollow == null) { if (policyFollow == null) {
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR.getCode(), "新单跟进记录不存在"); throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "新单跟进记录不存在");
} }
// 复制属性,排除系统字段 // 复制属性,排除系统字段
...@@ -224,17 +225,31 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol ...@@ -224,17 +225,31 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
policyFollow.setUpdaterId(loginUserId); policyFollow.setUpdaterId(loginUserId);
policyFollow.setUpdateTime(new Date()); policyFollow.setUpdateTime(new Date());
boolean result = updateById(policyFollow); try {
boolean result = updateById(policyFollow);
} catch (DataIntegrityViolationException e) {
log.info("修改跟进信息失败:{}", e.getMessage());
// 判断是否为唯一索引冲突
String message = e.getMessage();
if (StringUtils.isNotBlank(message) && message.contains("idx_policy_no")) {
throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "保单号已存在,请勿重复添加");
} else {
throw new BusinessException(ResultCode.FAIL.getCode(), "修改跟进信息失败");
}
} catch (Exception e) {
log.info("修改跟进信息失败:{}", e.getMessage());
throw new BusinessException(ResultCode.FAIL.getCode(), "修改跟进信息失败");
}
// 如果保单号从空变为有值,更新关联的FNA状态为"签单完成" // 如果保单号从空变为有值,更新关联的FNA状态为"签单完成"
if (isPolicyNoUpdated && result) { if (isPolicyNoUpdated) {
fnaService.lambdaUpdate() fnaService.lambdaUpdate()
.eq(Fna::getFnaBizId, policyFollow.getFnaBizId()) .eq(Fna::getFnaBizId, policyFollow.getFnaBizId())
.set(Fna::getStatus, FnaStatusEnum.SIGNED_COMPLETED.getItemValue()) .set(Fna::getStatus, FnaStatusEnum.SIGNED_COMPLETED.getItemValue())
.update(); .update();
} }
return result; return true;
} }
private void setPolicyMailing(PolicyFollow policyFollow, PolicyMailing policyMailing) { private void setPolicyMailing(PolicyFollow policyFollow, PolicyMailing policyMailing) {
......
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