소스 검색

逻辑完善。

tomatozq 5 년 전
부모
커밋
f2dce36dc6

+ 12 - 1
picc-admin-server/src/main/java/com/jpsoft/picc/modules/business/controller/InsuranceApplicationController.java

@@ -68,6 +68,9 @@ public class InsuranceApplicationController {
     @Autowired
     private DataDictionaryService dataDictionaryService;
 
+    @Autowired
+    private JpCloudUserService jpCloudUserService;
+
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
     public MessageResult<InsuranceApplication> create(){
@@ -460,11 +463,19 @@ public class InsuranceApplicationController {
                 promoter = company.getPromoter();
             }
 
+            List<JpCloudUser> promoterList = jpCloudUserService.findUserByNames(Arrays.asList(promoter));
+
             InsurancePolicy insurancePolicy = insurancePolicyService.get(policyId);
 
             InsuranceAgent insuranceAgent = insurancePolicy.getAgent();
 
-            promoterAndAgentDto.setPromoter(promoter);
+            if (promoterList.size()>0){
+                JpCloudUser jpCloudUser = promoterList.get(0);
+                promoterAndAgentDto.setPromoter(jpCloudUser.getName() + "," + jpCloudUser.getRealName() + "," + jpCloudUser.getPhone());
+            }
+            else {
+                promoterAndAgentDto.setPromoter(promoter);
+            }
 
             String agentName = "";
 

+ 3 - 3
picc-admin-server/src/main/java/com/jpsoft/picc/modules/business/controller/InsurancePolicyController.java

@@ -645,9 +645,8 @@ public class InsurancePolicyController {
                     insurancePolicy = insurancePolicyService.get(policyId);
                 }
                 else{
-                    List<ApplicationPolicy> applicationPolicyList = applicationPolicyService.findByApplicationId(applicationId);
-                    ApplicationPolicy applicationPolicy = applicationPolicyList.get(0);
-                    insurancePolicy = applicationPolicy.getPolicy();
+                    insurancePolicy = applicationPolicyService.findFirstPolicyByApplicationId(applicationId);
+                    policyId = insurancePolicy.getId();
                 }
 
                 PolicyStatus srcPolicyStatus = PolicyStatus.valueOf(Integer.valueOf(insurancePolicy.getStatus()));
@@ -760,6 +759,7 @@ public class InsurancePolicyController {
         destPolicy.setUpdateBy(null);
         destPolicy.setUpdateTime(null);
         destPolicy.setFinishTime(null);
+        destPolicy.setInsurancePolicyFile(null);
 
         //todo 如果有则判断关联当前投保单的下月投保记录是否存在
         boolean exist = insurancePolicyService.existByApplicationIdAndEffectiveDate(applicationId, destPolicy.getEffectiveDate());

+ 2 - 1
picc-admin-server/src/main/java/com/jpsoft/picc/modules/business/controller/InsurancePolicyRecordController.java

@@ -1,6 +1,7 @@
 package com.jpsoft.picc.modules.business.controller;
 
 import com.github.pagehelper.Page;
+import com.jpsoft.picc.modules.base.service.JpCloudUserService;
 import com.jpsoft.picc.modules.common.utils.PojoUtils;
 import com.jpsoft.picc.modules.common.dto.Sort;
 import com.jpsoft.picc.modules.common.dto.MessageResult;
@@ -214,7 +215,7 @@ public class InsurancePolicyRecordController {
         Map<String,Object> searchParams = new HashMap<>();
 
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("create_time","desc"));
+        sortList.add(new Sort("create_time","asc"));
 
         if (StringUtils.isNotEmpty(policyId)) {
             searchParams.put("policyId",policyId);

+ 11 - 4
picc-admin-server/src/main/resources/application.yml

@@ -94,12 +94,19 @@ pagehelper:
   supportMethodsArguments: true
   params: count=countSql
 
+#oss:
+#  accessKeyId: LTAILGOo7bwpkvnq
+#  accessKeySecret: ZGsaTO5klbSHxULr2Q3s2PiqKDzN15
+#  endpoint: http://oss-cn-hangzhou.aliyuncs.com
+#  bucketName: wzzgh2out
+#  urlPrefix: http://vod.wzgh.org
+#  objectPre: picc
 oss:
-  accessKeyId: LTAILGOo7bwpkvnq
-  accessKeySecret: ZGsaTO5klbSHxULr2Q3s2PiqKDzN15
+  accessKeyId: LTAIXIyrXmjgOXQa
+  accessKeySecret: B0RS3zHLct8OKKIDu2HREaVx6RXgWL
   endpoint: http://oss-cn-hangzhou.aliyuncs.com
-  bucketName: wzzgh2out
-  urlPrefix: http://vod.wzgh.org
+  bucketName: rccs
+  urlPrefix: http://rccs.oss-cn-hangzhou.aliyuncs.com
   objectPre: picc
 
 pdf:

+ 12 - 9
picc-common/src/main/java/com/jpsoft/picc/modules/base/service/impl/JpCloudUserSeriveImpl.java

@@ -14,6 +14,7 @@ import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
@@ -37,12 +38,11 @@ public class JpCloudUserSeriveImpl implements JpCloudUserService {
     @Autowired
     private RestTemplate restTemplate;
 
-    public <T> MsgResult<T> post(String url,HashMap<String,Object> searchParams){
-        MsgResult<T> msgResult = null;
+    public MsgResult<List<JpCloudUser>> post(String url,HashMap<String,Object> searchParams){
+        MsgResult<List<JpCloudUser>> msgResult = null;
 
         try {
-            ParameterizedTypeReference ref = new ParameterizedTypeReference<MsgResult<T>>() {
-            };
+            ParameterizedTypeReference ref = new ParameterizedTypeReference<MsgResult<List<JpCloudUser>>>() {};
 
             HttpHeaders headers = new HttpHeaders();
             headers.add("Accept", MediaType.APPLICATION_JSON.toString());
@@ -58,7 +58,7 @@ public class JpCloudUserSeriveImpl implements JpCloudUserService {
 
             HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<>(paramMap, headers);
 
-            ResponseEntity<MsgResult<T>> responseEntity =
+            ResponseEntity<MsgResult<List<JpCloudUser>>> responseEntity =
                     restTemplate.exchange(url, HttpMethod.POST, formEntity, ref);
 
             if (responseEntity.getStatusCode() == HttpStatus.OK) {
@@ -74,6 +74,7 @@ public class JpCloudUserSeriveImpl implements JpCloudUserService {
 
     @Override
     public List<JpCloudUser> findUserByNames(List<String> nameList) {
+        List<JpCloudUser> list = new ArrayList<>();
         String names = nameList.stream().collect(Collectors.joining(","));
 
         HashMap<String,Object> searchParams = new HashMap<>();
@@ -83,14 +84,16 @@ public class JpCloudUserSeriveImpl implements JpCloudUserService {
         MsgResult<List<JpCloudUser>> msgResult = post(findMemberByNamesUrl,searchParams);
 
         if(msgResult!=null && msgResult.isSuccess()) {
-            return msgResult.getData();
+            list = msgResult.getData();
         }
 
-        return null;
+        return list;
     }
 
     @Override
     public List<JpCloudUser> findUser(String name, String realName, String telephone) {
+        List<JpCloudUser> list = new ArrayList<>();
+
         HashMap<String,Object> searchParams = new HashMap<>();
         searchParams.put("name",name);
         searchParams.put("realName",realName);
@@ -100,9 +103,9 @@ public class JpCloudUserSeriveImpl implements JpCloudUserService {
         MsgResult<List<JpCloudUser>> msgResult = post(findMemberUrl,searchParams);
 
         if(msgResult!=null && msgResult.isSuccess()) {
-            return msgResult.getData();
+            list = msgResult.getData();
         }
 
-        return null;
+        return list;
     }
 }

+ 3 - 3
picc-common/src/main/java/com/jpsoft/picc/modules/common/utils/ItextPDFUtil.java

@@ -209,7 +209,7 @@ public class ItextPDFUtil {
         table.addCell(PdfTable.createCell("名    称", textfont, Element.ALIGN_CENTER,1,1,BaseColor.WHITE,false));
         table.addCell(PdfTable.createCell(insuranceApplication.getInsuredName(), textfont, Element.ALIGN_CENTER,3,1,BaseColor.WHITE,false));
         table.addCell(PdfTable.createCell("营业性质", textfont, Element.ALIGN_CENTER,1,1,BaseColor.WHITE,false));
-        table.addCell(PdfTable.createCell(insuranceApplication.getBusinessNature(), textfont, Element.ALIGN_CENTER,1,1,BaseColor.WHITE,false));
+        table.addCell(PdfTable.createCell(insuranceApplication.getBusinessNatureN(), textfont, Element.ALIGN_CENTER,1,1,BaseColor.WHITE,false));
 
         table.addCell(PdfTable.createCell("证件类型", textfont, Element.ALIGN_CENTER,1,1,BaseColor.WHITE,false));
         table.addCell(PdfTable.createCell("√组织机构代码证\n" +"□税务登记证\n" +"□工商登记证\n"+"□营业执照", textfont, Element.ALIGN_LEFT,3,1,BaseColor.WHITE,false));
@@ -418,9 +418,9 @@ public class ItextPDFUtil {
         for (int i =0;i<list.size();i++){
             table4.addCell(PdfTable.createCell(String.valueOf(i+1), textfont, Element.ALIGN_CENTER, 1,1,BaseColor.WHITE, true));
             table4.addCell(PdfTable.createCell(list.get(i).getCompanyMember().getName(), textfont, Element.ALIGN_CENTER, 1,1,BaseColor.WHITE, true));
-            table4.addCell(PdfTable.createCell(list.get(i).getCompanyMember().getCardType(), textfont, Element.ALIGN_CENTER, 1,1,BaseColor.WHITE, true));
+            table4.addCell(PdfTable.createCell(list.get(i).getCompanyMember().getCardTypeN(), textfont, Element.ALIGN_CENTER, 1,1,BaseColor.WHITE, true));
             table4.addCell(PdfTable.createCell(list.get(i).getCompanyMember().getCardNo(), textfont, Element.ALIGN_CENTER, 1,1,BaseColor.WHITE, true));
-            table4.addCell(PdfTable.createCell(list.get(i).getCompanyMember().getSex()==true?"男":"女", textfont, Element.ALIGN_CENTER, 1,1,BaseColor.WHITE, true));
+            table4.addCell(PdfTable.createCell(list.get(i).getCompanyMember().getSex()?"男":"女", textfont, Element.ALIGN_CENTER, 1,1,BaseColor.WHITE, true));
             table4.addCell(PdfTable.createCell(String.valueOf(list.get(i).getCompanyMember().getAge()), textfont, Element.ALIGN_CENTER, 1,1,BaseColor.WHITE, true));
             table4.addCell(PdfTable.createCell(list.get(i).getCompanyMember().getJobName(), textfont, Element.ALIGN_CENTER, 1,1,BaseColor.WHITE, true));
             table4.addCell(PdfTable.createCell(list.get(i).getCompanyMember().getHealthStatus(), textfont, Element.ALIGN_CENTER, 1,1,BaseColor.WHITE, true));

+ 2 - 1
picc-enterprise-server/src/main/java/com/jpsoft/picc/modules/auth/controller/InsuranceApplicationController.java

@@ -456,10 +456,11 @@ public class InsuranceApplicationController {
 
                 insuranceApplication.setDelFlag(false);
                 insuranceApplication.setCreateBy(principal.getName());
+                insuranceApplication.setCombinePolicyId(null);
 
                 DateTime createTime = DateTime.now();
                 insuranceApplication.setCreateTime(createTime.toDate());
-                insuranceApplication.setPolicyNo(createTime.toString("yyyyMMddHHmmss") + "-01");
+                insuranceApplication.setPolicyNo(createTime.toString("yyyyMMddHHmmssSSS") + "-01");
 
                 affectCount = insuranceApplicationService.insert(insuranceApplication);
             }else {

+ 3 - 1
picc-enterprise-server/src/main/java/com/jpsoft/picc/modules/auth/controller/InsurancePolicyController.java

@@ -401,7 +401,6 @@ public class InsurancePolicyController {
         InsuranceApplicationDTO insuranceApplicationDTO = new InsuranceApplicationDTO();
 
         InsurancePolicy insurancePolicy = insurancePolicyService.get(policyId);
-        insuranceApplicationDTO.setInsuredNumber(insurancePolicy.getNumber());
 
         try {
             InsuranceApplication insuranceApplication = null;
@@ -428,6 +427,9 @@ public class InsurancePolicyController {
                 insuranceApplicationDTO.setMonthNumber(Months.monthsBetween(startTime, endTime).getMonths());
             }
 
+            //设置参保人数为当前月投保单人数
+            insuranceApplicationDTO.setInsuredNumber(insurancePolicy.getNumber());
+
             msgResult.setData(insuranceApplicationDTO);
 
             msgResult.setResult(true);

+ 2 - 0
picc-enterprise-server/src/main/java/com/jpsoft/picc/modules/auth/dto/InsuranceApplicationDTO.java

@@ -62,4 +62,6 @@ public class InsuranceApplicationDTO {
     private String policyId;
     @ApiModelProperty(value = "要合并的每月投保单编号")
     private String combinePolicyId;
+    @ApiModelProperty(value = "投保单内部编号")
+    private String policyNo;
 }

+ 27 - 20
picc-enterprise-server/src/main/java/com/jpsoft/picc/modules/pub/controller/PayController.java

@@ -7,14 +7,8 @@ import com.jpsoft.picc.modules.base.entity.CompanyUser;
 import com.jpsoft.picc.modules.base.entity.Message;
 import com.jpsoft.picc.modules.base.entity.TransactionRecord;
 import com.jpsoft.picc.modules.base.service.*;
-import com.jpsoft.picc.modules.business.entity.ApplicationPolicy;
-import com.jpsoft.picc.modules.business.entity.InsuranceApplication;
-import com.jpsoft.picc.modules.business.entity.InsurancePolicy;
-import com.jpsoft.picc.modules.business.entity.InsurancePolicyMember;
-import com.jpsoft.picc.modules.business.service.ApplicationPolicyService;
-import com.jpsoft.picc.modules.business.service.InsuranceApplicationService;
-import com.jpsoft.picc.modules.business.service.InsurancePolicyMemberService;
-import com.jpsoft.picc.modules.business.service.InsurancePolicyService;
+import com.jpsoft.picc.modules.business.entity.*;
+import com.jpsoft.picc.modules.business.service.*;
 import com.jpsoft.picc.modules.common.constant.PolicyStatus;
 import com.jpsoft.picc.modules.common.dto.MessageResult;
 import com.jpsoft.picc.modules.common.utils.SignUtil;
@@ -76,6 +70,9 @@ public class PayController {
     @Autowired
     private MessageService messageService;
 
+    @Autowired
+    private InsurancePolicyRecordService insurancePolicyRecordService;
+
     @PostMapping(value = "/orderNotifyBack")
     @ResponseBody
     @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
@@ -133,10 +130,26 @@ public class PayController {
                     insuranceApplicationService.update(insuranceApplication);
                 }
 
-                //todo 发送微信模板消息
-                InsurancePolicy insurancePolicy = applicationPolicyService.findFirstPolicyByApplicationId(insuranceApplication.getId());
+                InsurancePolicy firstPolicy = applicationPolicyService.findFirstPolicyByApplicationId(insuranceApplication.getId());
+
+                DecimalFormat df = new DecimalFormat("0.00");
+
+                String opinion = "投保单号:" + insuranceApplication.getPolicyNo() + "已缴费成功,共计:"
+                        + df.format(insuranceApplication.getInsuranceFee()) + "元。";
+
+                //todo 记录;流程历史
+                InsurancePolicyRecord insurancePolicyRecord = new InsurancePolicyRecord();
+                insurancePolicyRecord.setId(UUID.randomUUID().toString());
+                insurancePolicyRecord.setPolicyId(firstPolicy.getId());
+                insurancePolicyRecord.setStatus(PolicyStatus.PendingPay.getValue() + "");
+                insurancePolicyRecord.setOpinion(opinion);
+                insurancePolicyRecord.setDelFlag(false);
+                insurancePolicyRecord.setCreateTime(new Date());
 
-                templateMessageService.sendTemplateMessage(insurancePolicy.getId(),PolicyStatus.PendingPay,PolicyStatus.PendingMakePolicy);
+                insurancePolicyRecordService.insert(insurancePolicyRecord);
+
+                //todo 发送微信模板消息
+                templateMessageService.sendTemplateMessage(firstPolicy.getId(),PolicyStatus.PendingPay,PolicyStatus.PendingMakePolicy);
 
                 //todo 发送站内消息通知企业用户(正常缴费荆鹏云会发短信消息给企业用户)
                 CompanyUser companyUser = companyUserService.findByCompanyId(insuranceApplication.getCompanyId());
@@ -146,11 +159,7 @@ public class PayController {
 
                     siteMessage.setId(UUID.randomUUID().toString());
                     siteMessage.setTitle("缴费成功通知");
-
-                    DecimalFormat df = new DecimalFormat("0.00");
-
-                    siteMessage.setContent("投保单号:" + insuranceApplication.getPolicyNo() + "已缴费成功,共计:"
-                            + df.format(insuranceApplication.getInsuranceFee()) + "元。");
+                    siteMessage.setContent(opinion);
 
                     siteMessage.setCreateTime(new Date());
                     siteMessage.setRecipientId(companyUser.getId());
@@ -160,7 +169,7 @@ public class PayController {
                 }
 
                 //todo 处理合并投保单(会将当前投保单设为假删除,放最后处理)
-                processCombinePolicy(insuranceApplication);
+                processCombinePolicy(insuranceApplication,firstPolicy);
 
                 message = "订单已支付";
                 status = "success";
@@ -181,9 +190,7 @@ public class PayController {
         return retMap;
     }
 
-    private void processCombinePolicy(InsuranceApplication insuranceApplication) {
-        InsurancePolicy firstPolicy = applicationPolicyService.findFirstPolicyByApplicationId(insuranceApplication.getId());
-
+    private void processCombinePolicy(InsuranceApplication insuranceApplication,InsurancePolicy firstPolicy ) {
         if (firstPolicy != null) {
             //先更新状态为待制单
             firstPolicy.setStatus(PolicyStatus.PendingMakePolicy.getValue() + "");

+ 11 - 4
picc-enterprise-server/src/main/resources/application.yml

@@ -96,10 +96,17 @@ cas:
   # 如果不设则无法获取用户扩展信息
   validation-type: cas
 
+#oss:
+#  accessKeyId: LTAILGOo7bwpkvnq
+#  accessKeySecret: ZGsaTO5klbSHxULr2Q3s2PiqKDzN15
+#  endpoint: http://oss-cn-hangzhou.aliyuncs.com
+#  bucketName: wzzgh2out
+#  urlPrefix: http://vod.wzgh.org
+#  objectPre: picc
 oss:
-  accessKeyId: LTAILGOo7bwpkvnq
-  accessKeySecret: ZGsaTO5klbSHxULr2Q3s2PiqKDzN15
+  accessKeyId: LTAIXIyrXmjgOXQa
+  accessKeySecret: B0RS3zHLct8OKKIDu2HREaVx6RXgWL
   endpoint: http://oss-cn-hangzhou.aliyuncs.com
-  bucketName: wzzgh2out
-  urlPrefix: http://vod.wzgh.org
+  bucketName: rccs
+  urlPrefix: http://rccs.oss-cn-hangzhou.aliyuncs.com
   objectPre: picc