jz.kai 5 years ago
parent
commit
e6b2c136f9

+ 234 - 79
picc-admin-server/src/main/java/com/jpsoft/picc/modules/base/controller/StudentInsuranceController.java

@@ -45,11 +45,11 @@ public class StudentInsuranceController {
     @Autowired
     @Autowired
     private StudentApplicationRecordService studentApplicationRecordService;
     private StudentApplicationRecordService studentApplicationRecordService;
 
 
-    @ApiOperation(value="获取信息")
+    @ApiOperation(value="获取保险信息")
     @PostMapping("detail")
     @PostMapping("detail")
 
 
     @ApiImplicitParams({
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "id",value = "险种编号", required = false, paramType = "form")
+            @ApiImplicitParam(name = "id",value = "险种编号", required = true, paramType = "form")
     })
     })
     public MessageResult<Map> detail(String id){
     public MessageResult<Map> detail(String id){
         MessageResult<Map> msgResult = new MessageResult<>();
         MessageResult<Map> msgResult = new MessageResult<>();
@@ -115,88 +115,147 @@ public class StudentInsuranceController {
     @ApiOperation(value="添加信息")
     @ApiOperation(value="添加信息")
     @PostMapping("save")
     @PostMapping("save")
     @ApiImplicitParams({
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "insuredId",value = "学生编号", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "insuredName",value = "学生姓名", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "insuredSex",value = "学生性别", required = false,paramType="form"),
-            @ApiImplicitParam(name = "insuredSchoolId",value = "学校编号", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "insuredSchoolName",value = "学校", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "companyId",value = "班级编号", required = false,paramType="form"),
-            @ApiImplicitParam(name = "companyName",value = "班级", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "insuredCard",value = "学生身份证号", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "haveMedicare",value = "有无医保", required = false,paramType="form"),
-            @ApiImplicitParam(name = "attachId",value = "家长编号", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "attachName",value = "家长姓名", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "relationship",value = "亲属关系", required = false,paramType="form"),
-            @ApiImplicitParam(name = "attachTel",value = "家长电话", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "definitionId",value = "保障方案编号", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "definitionName",value = "保障方案", required = false,paramType="form"),
-            @ApiImplicitParam(name = "startTime",value = "生效时间", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "endTime",value = "失效时间", required = false, paramType = "form")
+            @ApiImplicitParam(name = "id",value = "编号", required = false, paramType = "query"),
+            @ApiImplicitParam(name = "insuredId",value = "学生编号", required = false, paramType = "query"),
+            @ApiImplicitParam(name = "insuredName",value = "学生姓名", required = false, paramType = "query"),
+            @ApiImplicitParam(name = "insuredSex",value = "学生性别", required = false,paramType="query"),
+            @ApiImplicitParam(name = "insuredSchoolId",value = "学校编号", required = false, paramType = "query"),
+            @ApiImplicitParam(name = "insuredSchoolName",value = "学校", required = false, paramType = "query"),
+            @ApiImplicitParam(name = "companyId",value = "班级编号", required = false,paramType="query"),
+            @ApiImplicitParam(name = "companyName",value = "班级", required = false, paramType = "query"),
+            @ApiImplicitParam(name = "insuredCard",value = "学生身份证号", required = false, paramType = "query"),
+            @ApiImplicitParam(name = "haveMedicare",value = "有无医保", required = false,paramType="query"),
+            @ApiImplicitParam(name = "attachId",value = "家长编号", required = false, paramType = "query"),
+            @ApiImplicitParam(name = "attachName",value = "家长姓名", required = false, paramType = "query"),
+            @ApiImplicitParam(name = "relationship",value = "亲属关系", required = false,paramType="query"),
+            @ApiImplicitParam(name = "attachTel",value = "家长电话", required = false, paramType = "query"),
+            @ApiImplicitParam(name = "definitionId",value = "保障方案编号", required = false, paramType = "query"),
+            @ApiImplicitParam(name = "definitionName",value = "保障方案", required = false,paramType="query"),
+            @ApiImplicitParam(name = "startTime",value = "生效时间", required = false, paramType = "query"),
+            @ApiImplicitParam(name = "endTime",value = "失效时间", required = false, paramType = "query")
     })
     })
     public MessageResult<String> save(
     public MessageResult<String> save(
-            String insuredId,String insuredName,String insuredSex,String insuredSchoolId,String insuredSchoolName,String companyId,String companyName,String insuredCard,Boolean haveMedicare,
+            String id,String insuredId,String insuredName,String insuredSex,String insuredSchoolId,String insuredSchoolName,String companyId,String companyName,String insuredCard,Boolean haveMedicare,
             String attachId,String attachName,String relationship,String attachTel,
             String attachId,String attachName,String relationship,String attachTel,
             String definitionId,String definitionName,
             String definitionId,String definitionName,
             String startTime,String endTime,
             String startTime,String endTime,
             @RequestAttribute String subject){
             @RequestAttribute String subject){
         MessageResult<String> msgResult = new MessageResult<>();
         MessageResult<String> msgResult = new MessageResult<>();
         SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
         SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+        StudentApplication studentApplication = null;
+        InsuranceDefinition insuranceDefinition = insuranceDefinitionService.get(definitionId);
 
 
         try {
         try {
-            StudentApplication studentApplication = new StudentApplication();
-            studentApplication.setId(UUID.randomUUID().toString());
-            studentApplication.setInsuredId(insuredId);
-            studentApplication.setInsuredName(insuredName);
-            studentApplication.setInsuredSex(insuredSex);
-            studentApplication.setSchoolId(insuredSchoolId);
-            studentApplication.setSchoolName(insuredSchoolName);
-            studentApplication.setCompanyId(companyId);
-            studentApplication.setCompanyName(companyName);
-            studentApplication.setInsuredCard(insuredCard);
-            studentApplication.setHaveMedicare(haveMedicare);
-            studentApplication.setAttachId(attachId);
-            studentApplication.setAttachName(attachName);
-            studentApplication.setAttachRelationship(relationship);
-            studentApplication.setAttachTel(attachTel);
-            studentApplication.setDefinitionId(definitionId);
-            studentApplication.setDefinitionName(definitionName);
-            String num = sdf.format(new Date());
-            studentApplication.setPolicyNo(num + "," + (Integer.parseInt(num) + 1));
-            if(definitionId.equals("b318c3ac-c460-4d93-aa92-78b57efba125")) {
-                studentApplication.setHaveAttach(true);
-            }else{
-                studentApplication.setHaveAttach(false);
-            }
-            studentApplication.setStartTime(sdf.parse(startTime));
-            studentApplication.setEndTime(sdf.parse(endTime));
-            studentApplication.setDelFlag(false);
-            studentApplication.setCreateBy(subject);
-            studentApplication.setCreateTime(new Date());
-            studentApplication.setStatus(String.valueOf(StudentPolicyStatus.PendingPay.getValue()));
-
-            int affectCount = studentApplicationService.insert(studentApplication);
-
-            if (affectCount > 0) {
-                StudentApplicationRecord studentApplicationRecord = new StudentApplicationRecord();
-                studentApplicationRecord.setId(UUID.randomUUID().toString());
-                studentApplicationRecord.setApplicationId(studentApplication.getId());
-                studentApplicationRecord.setProcessStatus("正常");
-                studentApplicationRecord.setStatus(String.valueOf(StudentPolicyStatus.PendingPay.getValue()));
-                studentApplicationRecord.setDelFlag(false);
-                studentApplicationRecord.setCreateBy(subject);
-                studentApplicationRecord.setCreateTime(new Date());
-                studentApplicationRecordService.insert(studentApplicationRecord);
-
+            if(StringUtils.isEmpty(id)) {
+                studentApplication = new StudentApplication();
+                studentApplication.setId(UUID.randomUUID().toString());
+                studentApplication.setInsuredId(insuredId);
+                studentApplication.setInsuredName(insuredName);
+                studentApplication.setInsuredSex(insuredSex);
+                studentApplication.setSchoolId(insuredSchoolId);
+                studentApplication.setSchoolName(insuredSchoolName);
+                studentApplication.setCompanyId(companyId);
+                studentApplication.setCompanyName(companyName);
+                studentApplication.setInsuredCard(insuredCard);
+                studentApplication.setHaveMedicare(haveMedicare);
+                studentApplication.setAttachId(attachId);
+                studentApplication.setAttachName(attachName);
+                studentApplication.setAttachRelationship(relationship);
+                studentApplication.setAttachTel(attachTel);
+                studentApplication.setDefinitionId(definitionId);
+                studentApplication.setDefinitionName(definitionName);
+                if (insuranceDefinition.getHaveAttach()) {
+                    studentApplication.setHaveAttach(true);
+
+                    String num = sdf.format(new Date());
+                    studentApplication.setPolicyNo(num + "," + (Integer.parseInt(num) + 1));
+                } else {
+                    studentApplication.setHaveAttach(false);
+
+                    String num = sdf.format(new Date());
+                    studentApplication.setPolicyNo(num);
+                }
+                studentApplication.setStartTime(sdf.parse(startTime));
+                studentApplication.setEndTime(sdf.parse(endTime));
+                studentApplication.setDelFlag(false);
+                studentApplication.setCreateBy(subject);
+                studentApplication.setCreateTime(new Date());
+                studentApplication.setStatus(String.valueOf(StudentPolicyStatus.PendingPay.getValue()));
+                studentApplication.setProcessStatus("正常");
+
+                int affectCount = studentApplicationService.insert(studentApplication);
+
+                if (affectCount > 0) {
+                    StudentApplicationRecord studentApplicationRecord = new StudentApplicationRecord();
+                    studentApplicationRecord.setId(UUID.randomUUID().toString());
+                    studentApplicationRecord.setApplicationId(studentApplication.getId());
+                    studentApplicationRecord.setProcessStatus("正常");
+                    studentApplicationRecord.setStatus(String.valueOf(StudentPolicyStatus.PendingPay.getValue()));
+                    studentApplicationRecord.setDelFlag(false);
+                    studentApplicationRecord.setCreateBy(subject);
+                    studentApplicationRecord.setCreateTime(new Date());
+                    studentApplicationRecordService.insert(studentApplicationRecord);
+
+                    msgResult.setResult(true);
+                    msgResult.setData(studentApplication.getId());
+                } else {
+                    msgResult.setResult(false);
+                    msgResult.setMessage("数据库添加失败");
+                }
+            }else {
+                studentApplication = studentApplicationService.get(id);
+                studentApplication.setInsuredId(insuredId);
+                studentApplication.setInsuredName(insuredName);
+                studentApplication.setInsuredSex(insuredSex);
+                studentApplication.setSchoolId(insuredSchoolId);
+                studentApplication.setSchoolName(insuredSchoolName);
+                studentApplication.setCompanyId(companyId);
+                studentApplication.setCompanyName(companyName);
+                studentApplication.setInsuredCard(insuredCard);
+                studentApplication.setHaveMedicare(haveMedicare);
+                studentApplication.setAttachId(attachId);
+                studentApplication.setAttachName(attachName);
+                studentApplication.setAttachRelationship(relationship);
+                studentApplication.setAttachTel(attachTel);
+                studentApplication.setDefinitionId(definitionId);
+                studentApplication.setDefinitionName(definitionName);
+                if (insuranceDefinition.getHaveAttach()) {
+                    studentApplication.setHaveAttach(true);
+
+                    String num = sdf.format(new Date());
+                    studentApplication.setPolicyNo(num + "," + (Integer.valueOf(num) + 1));
+                } else {
+                    studentApplication.setHaveAttach(false);
+
+                    String num = sdf.format(new Date());
+                    studentApplication.setPolicyNo(num);
+                }
+                studentApplication.setStartTime(sdf.parse(startTime));
+                studentApplication.setEndTime(sdf.parse(endTime));
+                studentApplication.setDelFlag(false);
+                studentApplication.setUpdateBy(subject);
+                studentApplication.setUpdateTime(new Date());
+                studentApplication.setStatus(String.valueOf(StudentPolicyStatus.PendingPay.getValue()));
+                if(studentApplication.getProcessStatus().equals("退回")){
+                    studentApplication.setProcessStatus("正常");
+
+                    StudentApplicationRecord studentApplicationRecord = new StudentApplicationRecord();
+                    studentApplicationRecord.setId(UUID.randomUUID().toString());
+                    studentApplicationRecord.setApplicationId(studentApplication.getId());
+                    studentApplicationRecord.setProcessStatus("正常");
+                    studentApplicationRecord.setStatus(String.valueOf(StudentPolicyStatus.PendingPay.getValue()));
+                    studentApplicationRecord.setDelFlag(false);
+                    studentApplicationRecord.setCreateBy(subject);
+                    studentApplicationRecord.setCreateTime(new Date());
+                    studentApplicationRecordService.insert(studentApplicationRecord);
+                }
+                studentApplicationService.update(studentApplication);
 
 
                 msgResult.setCode(200);
                 msgResult.setCode(200);
                 msgResult.setResult(true);
                 msgResult.setResult(true);
                 msgResult.setData(studentApplication.getId());
                 msgResult.setData(studentApplication.getId());
                 msgResult.setMessage("成功");
                 msgResult.setMessage("成功");
-            } /*else {
-                msgResult.setCode(400);
-                msgResult.setResult(false);
-                msgResult.setMessage("数据库添加失败");
-            }*/
+            }
         }
         }
         catch(Exception ex){
         catch(Exception ex){
             logger.error(ex.getMessage(),ex);
             logger.error(ex.getMessage(),ex);
@@ -212,12 +271,10 @@ public class StudentInsuranceController {
     @ApiOperation(value="保单列表")
     @ApiOperation(value="保单列表")
     @RequestMapping(value = "list",method = RequestMethod.POST)
     @RequestMapping(value = "list",method = RequestMethod.POST)
     @ApiImplicitParams({
     @ApiImplicitParams({
-            @ApiImplicitParam(name="name",value = "名称",paramType = "query")
+            @ApiImplicitParam(name="insuredCard",value = "投保人身份证",paramType = "query")
     })
     })
     public MessageResult<Map> list(
     public MessageResult<Map> list(
-            String name,
-            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
-            @RequestParam(value="pageSize",defaultValue="20") int pageSize,
+            String insuredCard,
             @RequestAttribute String subject){
             @RequestAttribute String subject){
 
 
         //当前用户ID
         //当前用户ID
@@ -226,19 +283,117 @@ public class StudentInsuranceController {
         MessageResult<Map> msgResult = new MessageResult<>();
         MessageResult<Map> msgResult = new MessageResult<>();
 
 
         Map<String,Object> searchParams = new HashMap<>();
         Map<String,Object> searchParams = new HashMap<>();
+        searchParams.put("delFlag",false);
+        if (StringUtils.isNotEmpty(insuredCard)) {
+            searchParams.put("insuredCard",insuredCard);
+        }
 
 
         List<Sort> sortList = new ArrayList<>();
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("create_time","desc"));
+        sortList.add(new Sort("a.create_time","desc"));
 
 
-        if (StringUtils.isNotEmpty(name)) {
-            searchParams.put("name","%" + name + "%");
-        }
-
-        Page<InsuranceDefinition> page = insuranceDefinitionService.pageSearch(searchParams,pageIndex,pageSize,sortList);
+        Page<StudentApplication> page = studentApplicationService.pageSearch(searchParams,1,1000,false,sortList);
 
 
         msgResult.setResult(true);
         msgResult.setResult(true);
         msgResult.setData(PojoUtils.pageWrapper(page));
         msgResult.setData(PojoUtils.pageWrapper(page));
 
 
         return msgResult;
         return msgResult;
     }
     }
+
+    @ApiOperation(value="获取订单信息")
+    @PostMapping("detailStudentApplication")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form")
+    })
+    public MessageResult<StudentApplication> detailStudentApplication(String id){
+        MessageResult<StudentApplication> msgResult = new MessageResult<>();
+
+        try {
+            StudentApplication studentApplication = studentApplicationService.get(id);
+
+            msgResult.setResult(true);
+            msgResult.setData(studentApplication);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="获取订单信息")
+    @PostMapping("delete")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form")
+    })
+    public MessageResult<StudentApplication> delete(String id,@RequestAttribute String subject){
+        MessageResult<StudentApplication> msgResult = new MessageResult<>();
+
+        try {
+            StudentApplication studentApplication = studentApplicationService.get(id);
+            studentApplication.setDelFlag(true);
+            studentApplication.setUpdateBy(subject);
+            studentApplication.setUpdateTime(new Date());
+            studentApplicationService.update(studentApplication);
+
+            msgResult.setResult(true);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="电子签名")
+    @PostMapping("signature")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "url",value = "图片路径", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "number",value = "第几次签名", required = true, paramType = "form")
+    })
+    public MessageResult<StudentApplication> signature(String id,String url,Integer number,
+                                                       @RequestAttribute String subject){
+        MessageResult<StudentApplication> msgResult = new MessageResult<>();
+
+        try {
+            StudentApplication studentApplication = studentApplicationService.get(id);
+
+            switch (number){
+                case 1:
+                    studentApplication.setSignature(url);
+                    break;
+                case 2:
+                    studentApplication.setSignature2(url);
+                    break;
+                case 3:
+                    studentApplication.setSignature3(url);
+                    break;
+                default:
+                    msgResult.setResult(false);
+                    msgResult.setMessage("超出签名次数。");
+                    return msgResult;
+            }
+
+            studentApplication.setDelFlag(true);
+            studentApplication.setUpdateBy(subject);
+            studentApplication.setUpdateTime(new Date());
+            studentApplicationService.update(studentApplication);
+
+            msgResult.setResult(true);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }
 }

+ 3 - 0
picc-common/src/main/resources/mapper/base/InsuranceDefinition.xml

@@ -141,6 +141,9 @@
             <if test="searchParams.name != null">
             <if test="searchParams.name != null">
                 and name_ like #{searchParams.name}
                 and name_ like #{searchParams.name}
             </if>
             </if>
+            <if test="searchParams.idCard != null">
+                and name_ like #{searchParams.idCard}
+            </if>
         </where>
         </where>
         <foreach item="sort" collection="sortList" open="order by" separator=",">
         <foreach item="sort" collection="sortList" open="order by" separator=",">
             ${sort.name} ${sort.order}
             ${sort.name} ${sort.order}

+ 3 - 0
picc-common/src/main/resources/mapper/business/StudentApplication.xml

@@ -256,6 +256,9 @@
 			<if test="searchParams.tabStatus != null">
 			<if test="searchParams.tabStatus != null">
 				and a.status_ = #{searchParams.tabStatus}
 				and a.status_ = #{searchParams.tabStatus}
 			</if>
 			</if>
+			<if test="searchParams.insuredCard != null">
+				and a.insured_card = #{searchParams.insuredCard}
+			</if>
 		</where>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 	        ${sort.name} ${sort.order}
 	        ${sort.name} ${sort.order}