|
@@ -7,10 +7,13 @@ import com.gree.mall.manager.bean.admin.AdminUserCom;
|
|
|
import com.gree.mall.manager.bean.policy.PolicyDetail;
|
|
|
import com.gree.mall.manager.bean.policy.PolicyVo;
|
|
|
import com.gree.mall.manager.commonmapper.PolicyCMapper;
|
|
|
+import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
|
+import com.gree.mall.manager.plus.entity.AdminWebsit;
|
|
|
import com.gree.mall.manager.plus.entity.Policy;
|
|
|
import com.gree.mall.manager.plus.entity.PolicyRange;
|
|
|
import com.gree.mall.manager.plus.entity.PolicyWebsit;
|
|
|
+import com.gree.mall.manager.plus.service.AdminWebsitService;
|
|
|
import com.gree.mall.manager.plus.service.PolicyRangeService;
|
|
|
import com.gree.mall.manager.plus.service.PolicyService;
|
|
|
import com.gree.mall.manager.plus.service.PolicyWebsitService;
|
|
@@ -40,6 +43,9 @@ public class PolicyLogic {
|
|
|
@Autowired
|
|
|
PolicyWebsitService policyWebsitService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ AdminWebsitService adminWebsitService;
|
|
|
+
|
|
|
|
|
|
|
|
|
public IPage<PolicyVo> list(Page page, ZfireParamBean zfireParam) {
|
|
@@ -76,6 +82,9 @@ public class PolicyLogic {
|
|
|
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
|
|
|
+ if (policyService.lambdaQuery().eq(Policy::getPolicyName,policyDetail.getPolicyName()).count() > 0)
|
|
|
+ throw new RemoteServiceException("保险名称不能重复");
|
|
|
+
|
|
|
policyDetail.setCompanyWechatId(adminUser.getCompanyWechatId());
|
|
|
policyDetail.setCompanyWechatName(adminUser.getCompanyName());
|
|
|
|
|
@@ -86,7 +95,13 @@ public class PolicyLogic {
|
|
|
}
|
|
|
|
|
|
for (PolicyWebsit policyWebsit : policyDetail.getPolicyWebsits()) {
|
|
|
+
|
|
|
+ AdminWebsit adminWebsit = adminWebsitService.getById(policyWebsit.getWebsitId());
|
|
|
+
|
|
|
policyWebsit.setPolicyId(policyDetail.getId());
|
|
|
+ policyWebsit.setWebsitName(adminWebsit.getName());
|
|
|
+ policyWebsit.setBelongCompany(adminWebsit.getBelongCompany());
|
|
|
+ policyWebsit.setBelongCompanyCode(adminWebsit.getBelongCompanyCode());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -97,6 +112,10 @@ public class PolicyLogic {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void update(PolicyDetail policyDetail) {
|
|
|
|
|
|
+ if (policyService.lambdaQuery().eq(Policy::getPolicyName,policyDetail.getPolicyName())
|
|
|
+ .ne(Policy::getId,policyDetail.getId()).count() > 0)
|
|
|
+ throw new RemoteServiceException("保险名称不能重复");
|
|
|
+
|
|
|
policyDetail.updateById();
|
|
|
|
|
|
policyRangeService.lambdaUpdate().eq(PolicyRange::getPolicyId,policyDetail.getId()).remove();
|
|
@@ -107,7 +126,12 @@ public class PolicyLogic {
|
|
|
}
|
|
|
|
|
|
for (PolicyWebsit policyWebsit : policyDetail.getPolicyWebsits()) {
|
|
|
+ AdminWebsit adminWebsit = adminWebsitService.getById(policyWebsit.getWebsitId());
|
|
|
+
|
|
|
policyWebsit.setPolicyId(policyDetail.getId());
|
|
|
+ policyWebsit.setWebsitName(adminWebsit.getName());
|
|
|
+ policyWebsit.setBelongCompany(adminWebsit.getBelongCompany());
|
|
|
+ policyWebsit.setBelongCompanyCode(adminWebsit.getBelongCompanyCode());
|
|
|
}
|
|
|
|
|
|
|