|
@@ -1,8 +1,11 @@
|
|
package com.jpsoft.picc.modules.auth.controller;
|
|
package com.jpsoft.picc.modules.auth.controller;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
-import com.jpsoft.picc.modules.base.entity.Company;
|
|
|
|
-import com.jpsoft.picc.modules.base.service.CompanyService;
|
|
|
|
|
|
+import com.jpsoft.picc.modules.auth.dto.AcceptInsuranceDTO;
|
|
|
|
+import com.jpsoft.picc.modules.auth.dto.InsuranceApplicationDTO;
|
|
|
|
+import com.jpsoft.picc.modules.auth.dto.InsuranceJobsDTO;
|
|
|
|
+import com.jpsoft.picc.modules.base.entity.*;
|
|
|
|
+import com.jpsoft.picc.modules.base.service.*;
|
|
import com.jpsoft.picc.modules.business.entity.*;
|
|
import com.jpsoft.picc.modules.business.entity.*;
|
|
import com.jpsoft.picc.modules.business.service.*;
|
|
import com.jpsoft.picc.modules.business.service.*;
|
|
import com.jpsoft.picc.modules.common.constant.PolicyStatus;
|
|
import com.jpsoft.picc.modules.common.constant.PolicyStatus;
|
|
@@ -13,21 +16,26 @@ import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.jasig.cas.client.authentication.AttributePrincipal;
|
|
import org.jasig.cas.client.authentication.AttributePrincipal;
|
|
|
|
+import org.joda.time.DateTime;
|
|
|
|
+import org.joda.time.Interval;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import org.springframework.format.annotation.DateTimeFormat;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.security.Policy;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
-@Api(description="每月投保单")
|
|
|
|
|
|
+@Slf4j
|
|
|
|
+@Api(description="下月投保单")
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/auth/insurancePolicy")
|
|
@RequestMapping("/auth/insurancePolicy")
|
|
public class InsurancePolicyController {
|
|
public class InsurancePolicyController {
|
|
@@ -51,63 +59,17 @@ public class InsurancePolicyController {
|
|
@Autowired
|
|
@Autowired
|
|
private ApplicationPolicyService applicationPolicyService;
|
|
private ApplicationPolicyService applicationPolicyService;
|
|
|
|
|
|
- @ApiOperation(value="每月投保单列表")
|
|
|
|
- @RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
|
- @ApiImplicitParams({
|
|
|
|
- @ApiImplicitParam(name = "applicationId",value = "投保申请ID", required = true, paramType = "form",dataType = "String")
|
|
|
|
- })
|
|
|
|
- public MessageResult<Map> pageList(
|
|
|
|
- @RequestParam(value="applicationId",defaultValue="") String applicationId,
|
|
|
|
- @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
|
- @RequestParam(value="pageSize",defaultValue="20") int pageSize){
|
|
|
|
- MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
- searchParams.put("delFlag",false);
|
|
|
|
-
|
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
|
- sortList.add(new Sort("id_","asc"));
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotEmpty(applicationId)) {
|
|
|
|
- searchParams.put("applicationId",applicationId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Page<InsurancePolicy> page = insurancePolicyService.pageSearch(searchParams,pageIndex,pageSize,sortList);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="每月投保单详情")
|
|
|
|
- @RequestMapping(value = "detail",method = RequestMethod.POST)
|
|
|
|
- @ApiImplicitParams({
|
|
|
|
- @ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form",dataType = "String")
|
|
|
|
- })
|
|
|
|
- public MessageResult<InsurancePolicy> detail(@RequestParam(value="id",defaultValue="") String id){
|
|
|
|
- MessageResult<InsurancePolicy> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- InsurancePolicy insurancePolicy = insurancePolicyService.get(id);
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private InsuranceJobsService insuranceJobsService;
|
|
|
|
|
|
- if (insurancePolicy != null) {
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(insurancePolicy);
|
|
|
|
- } else {
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage("数据库不存在该记录!");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- catch(Exception ex){
|
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private InsuranceDefinitionLimitService insuranceDefinitionLimitService;
|
|
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage(ex.getMessage());
|
|
|
|
- }
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private InsuranceDefinitionService insuranceDefinitionService;
|
|
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private JobsService jobsService;
|
|
|
|
|
|
@ApiOperation(value="查看附件")
|
|
@ApiOperation(value="查看附件")
|
|
@RequestMapping(value = "attachmentList",method = RequestMethod.POST)
|
|
@RequestMapping(value = "attachmentList",method = RequestMethod.POST)
|
|
@@ -138,35 +100,6 @@ public class InsurancePolicyController {
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="投保历史记录")
|
|
|
|
- @RequestMapping(value = "historyPageList",method = RequestMethod.POST)
|
|
|
|
- public MessageResult<Map> historyPageList(
|
|
|
|
- @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
|
- @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
|
- HttpServletRequest request){
|
|
|
|
- AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
|
|
|
|
- Company company = companyService.findByCreateBy(principal.getName());
|
|
|
|
-
|
|
|
|
- MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
- searchParams.put("status",String.valueOf(PolicyStatus.SendOutPolicy.getValue()));
|
|
|
|
-
|
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
|
- sortList.add(new Sort("id_","asc"));
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotEmpty(company.getId())) {
|
|
|
|
- searchParams.put("companyId",company.getId());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Page<InsuranceApplication> page = insuranceApplicationService.pageSearch(searchParams,pageIndex,pageSize,sortList);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@ApiOperation(value="查看退回理由")
|
|
@ApiOperation(value="查看退回理由")
|
|
@RequestMapping(value = "backReason",method = RequestMethod.POST)
|
|
@RequestMapping(value = "backReason",method = RequestMethod.POST)
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@@ -179,7 +112,7 @@ public class InsurancePolicyController {
|
|
searchParams.put("policyId",policyId);
|
|
searchParams.put("policyId",policyId);
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
List<Sort> sortList = new ArrayList<>();
|
|
- sortList.add(new Sort("id_","asc"));
|
|
|
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
|
|
|
Page<InsurancePolicyRecord> page = insurancePolicyRecordService.pageSearch(searchParams,1,100,sortList);
|
|
Page<InsurancePolicyRecord> page = insurancePolicyRecordService.pageSearch(searchParams,1,100,sortList);
|
|
|
|
|
|
@@ -189,9 +122,75 @@ public class InsurancePolicyController {
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="下月投保单查询")
|
|
|
|
- @RequestMapping(value = "nextMonthList",method = RequestMethod.POST)
|
|
|
|
- public MessageResult<Map> nextMonthList(
|
|
|
|
|
|
+ @PostMapping(value="historyList")
|
|
|
|
+ @ApiOperation(value = "根据投保单号查询每月投保单")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "applicationId",value = "参保单编号", required = true, paramType = "form"),
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> historyList(String applicationId,
|
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize){
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ //todo
|
|
|
|
+ Page<InsurancePolicy> page = applicationPolicyService.findPolicyByApplicationId(applicationId,pageIndex,pageSize);
|
|
|
|
+
|
|
|
|
+ Map dataMap = PojoUtils.pageWrapper(page);
|
|
|
|
+
|
|
|
|
+ List<Map> mapList = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+
|
|
|
|
+ Date now = new Date();
|
|
|
|
+
|
|
|
|
+ for (InsurancePolicy policy : page.getResult()) {
|
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ map.put("applicationId",applicationId);
|
|
|
|
+ map.put("policyId",policy.getId());
|
|
|
|
+ map.put("startTime",sdf.format(policy.getStartTime()));
|
|
|
|
+ map.put("endTime",sdf.format(policy.getEndTime()));
|
|
|
|
+ map.put("definitionName",policy.getDefinitionName());
|
|
|
|
+
|
|
|
|
+ if (now.before(policy.getStartTime())){
|
|
|
|
+ map.put("status","未生效");
|
|
|
|
+ }
|
|
|
|
+ else if(now.after(policy.getEndTime())){
|
|
|
|
+ map.put("status","已过期");
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ map.put("status","保障中");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ mapList.add(map);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dataMap.put("data",mapList);
|
|
|
|
+
|
|
|
|
+ messageResult.setData(dataMap);
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex){
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="下月投保单分页查询")
|
|
|
|
+ @RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "status",value = "状态:待调整10/已退回15/待初审20/待复审30/待制单50/待出单60/已出单70", required = true, paramType = "form",dataType = "String"),
|
|
|
|
+ @ApiImplicitParam(name = "definitionId",value = "险种编号", required = false, paramType = "form",dataType = "String"),
|
|
|
|
+ @ApiImplicitParam(name = "startTime",value = "险种编号", required = false, paramType = "form",dataType = "String"),
|
|
|
|
+ @ApiImplicitParam(name = "endTime",value = "险种编号", required = false, paramType = "form",dataType = "String"),
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> pageList(
|
|
|
|
+ String status,String definitionId,
|
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
|
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime,
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
HttpServletRequest request){
|
|
HttpServletRequest request){
|
|
@@ -199,90 +198,54 @@ public class InsurancePolicyController {
|
|
Company company = companyService.findByCreateBy(principal.getName());
|
|
Company company = companyService.findByCreateBy(principal.getName());
|
|
|
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
- List<String> policyIds = new ArrayList<>();
|
|
|
|
|
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
|
- sortList.add(new Sort("id_","asc"));
|
|
|
|
-
|
|
|
|
- Map<String,Object> searchParamsInsuranceApplication = new HashMap<>();
|
|
|
|
- searchParamsInsuranceApplication.put("status",String.valueOf(PolicyStatus.SendOutPolicy.getValue()));
|
|
|
|
- searchParamsInsuranceApplication.put("companyId",company.getId());
|
|
|
|
- Page<InsuranceApplication> pageInsuranceApplication = insuranceApplicationService.pageSearch(searchParamsInsuranceApplication,1,1000,sortList);
|
|
|
|
- for(InsuranceApplication insuranceApplication : pageInsuranceApplication.getResult()){
|
|
|
|
- Map<String,Object> searchParamsInsurancePolicy = new HashMap<>();
|
|
|
|
- searchParamsInsurancePolicy.put("applicationId",insuranceApplication.getId());
|
|
|
|
- searchParamsInsurancePolicy.put("status",String.valueOf(PolicyStatus.SendOutPolicy.getValue()));
|
|
|
|
- Page<InsurancePolicy> pageInsurancePolicy = insurancePolicyService.pageSearch(searchParamsInsurancePolicy,1,1000,sortList);
|
|
|
|
- for(InsurancePolicy insurancePolicy : pageInsurancePolicy.getResult()){
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
|
|
|
|
- Calendar allEnd = Calendar.getInstance();
|
|
|
|
- allEnd.setTime(insuranceApplication.getEndTime());
|
|
|
|
- Calendar startTime = Calendar.getInstance();
|
|
|
|
- startTime.setTime(insurancePolicy.getStartTime());
|
|
|
|
- startTime.add(Calendar.MONTH,1);
|
|
|
|
- Calendar endTime = Calendar.getInstance();
|
|
|
|
- endTime.setTime(insurancePolicy.getEndTime());
|
|
|
|
- endTime.add(Calendar.MONTH,1);
|
|
|
|
- if(endTime.before(allEnd)){
|
|
|
|
- //增加每月投保单
|
|
|
|
- InsurancePolicy newInsurancePolicy = new InsurancePolicy();
|
|
|
|
- newInsurancePolicy.setId(UUID.randomUUID().toString());
|
|
|
|
- newInsurancePolicy.setInsuranceFee(insurancePolicy.getInsuranceFee());
|
|
|
|
- newInsurancePolicy.setStartTime(startTime.getTime());
|
|
|
|
- newInsurancePolicy.setEndTime(endTime.getTime());
|
|
|
|
- newInsurancePolicy.setNumber(insurancePolicy.getNumber());
|
|
|
|
- newInsurancePolicy.setNo(insurancePolicy.getNo()+1);
|
|
|
|
- newInsurancePolicy.setEffectiveDate(sdf.format(startTime));
|
|
|
|
- newInsurancePolicy.setDelFlag(false);
|
|
|
|
- newInsurancePolicy.setCreateBy(principal.getName());
|
|
|
|
- newInsurancePolicy.setCreateTime(new Date());
|
|
|
|
- insurancePolicyService.insert(newInsurancePolicy);
|
|
|
|
-
|
|
|
|
- //增加投保单与每月投保单关联
|
|
|
|
- ApplicationPolicy newApplicationPolicy = new ApplicationPolicy();
|
|
|
|
- newApplicationPolicy.setId(UUID.randomUUID().toString());
|
|
|
|
- newApplicationPolicy.setApplicationId(insuranceApplication.getId());
|
|
|
|
- newApplicationPolicy.setPolicyId(newInsurancePolicy.getId());
|
|
|
|
- applicationPolicyService.insert(newApplicationPolicy);
|
|
|
|
-
|
|
|
|
- //增加花名册
|
|
|
|
- Map<String,Object> searchParamsInsurancePolicyMember = new HashMap<>();
|
|
|
|
- searchParamsInsurancePolicyMember.put("policyId",insurancePolicy.getId());
|
|
|
|
- Page<InsurancePolicyMember> pageInsurancePolicyMember = insurancePolicyMemberService.pageSearch(searchParamsInsurancePolicyMember,1,1000,sortList);
|
|
|
|
- for(InsurancePolicyMember insurancePolicyMember : pageInsurancePolicyMember.getResult()){
|
|
|
|
- InsurancePolicyMember newinsurancePolicyMember = new InsurancePolicyMember();
|
|
|
|
- newinsurancePolicyMember.setId(UUID.randomUUID().toString());
|
|
|
|
- newinsurancePolicyMember.setPolicyId(newInsurancePolicy.getId());
|
|
|
|
- newinsurancePolicyMember.setMemberId(insurancePolicyMember.getMemberId());
|
|
|
|
- newinsurancePolicyMember.setDelFlag(false);
|
|
|
|
- newinsurancePolicyMember.setCreateBy(principal.getName());
|
|
|
|
- newinsurancePolicyMember.setCreateTime(new Date());
|
|
|
|
- insurancePolicyMemberService.insert(newinsurancePolicyMember);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //记录投保单ID
|
|
|
|
- policyIds.add(newInsurancePolicy.getId());
|
|
|
|
- }
|
|
|
|
|
|
+ try {
|
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
+ sortList.add(new Sort("create_time", "desc"));
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotEmpty(company.getId())) {
|
|
|
|
+ searchParams.put("companyId", company.getId());
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- //按ID重新读取每月投保单
|
|
|
|
- Map<String,Object> searchParamsInsurancePolicy = new HashMap<>();
|
|
|
|
- searchParamsInsurancePolicy.put("ids",policyIds);
|
|
|
|
- Page<InsurancePolicy> pageInsurancePolicy = insurancePolicyService.pageSearch(searchParamsInsurancePolicy,1,1000,sortList);
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(definitionId)) {
|
|
|
|
+ searchParams.put("definitionId", definitionId);
|
|
|
|
+ }
|
|
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(PojoUtils.pageWrapper(pageInsurancePolicy));
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
|
+ searchParams.put("status", status);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (startTime != null) {
|
|
|
|
+ searchParams.put("startTime", startTime);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (endTime != null) {
|
|
|
|
+ searchParams.put("endTime", endTime);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Page<InsurancePolicy> page = insurancePolicyService.nextMonthPageList(searchParams, pageIndex, pageSize,sortList);
|
|
|
|
+
|
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ }
|
|
|
|
+ catch(Exception ex){
|
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="显示参保人员列表")
|
|
|
|
- @RequestMapping(value = "pageListPolicyMember",method = RequestMethod.POST)
|
|
|
|
|
|
+ @ApiOperation(value="显示下月参保人员列表")
|
|
|
|
+ @RequestMapping(value = "memberPageList",method = RequestMethod.POST)
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParam(name = "policyId",value = "每月投保单编号", required = true, paramType = "form",dataType = "String")
|
|
@ApiImplicitParam(name = "policyId",value = "每月投保单编号", required = true, paramType = "form",dataType = "String")
|
|
})
|
|
})
|
|
- public MessageResult<Map> pageListPolicyMember(
|
|
|
|
|
|
+ public MessageResult<Map> memberPageList(
|
|
@RequestParam(value="policyId",defaultValue="") String policyId,
|
|
@RequestParam(value="policyId",defaultValue="") String policyId,
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize){
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize){
|
|
@@ -301,7 +264,7 @@ public class InsurancePolicyController {
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="提交花名册")
|
|
|
|
|
|
+ @ApiOperation(value="提交下月花名册")
|
|
@RequestMapping(value = "submitRoster",method = RequestMethod.POST)
|
|
@RequestMapping(value = "submitRoster",method = RequestMethod.POST)
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParam(name = "policyId",value = "每月投保单编号", required = true, paramType = "form",dataType = "String")
|
|
@ApiImplicitParam(name = "policyId",value = "每月投保单编号", required = true, paramType = "form",dataType = "String")
|
|
@@ -314,7 +277,7 @@ public class InsurancePolicyController {
|
|
try {
|
|
try {
|
|
InsurancePolicy insurancePolicy = insurancePolicyService.get(policyId);
|
|
InsurancePolicy insurancePolicy = insurancePolicyService.get(policyId);
|
|
|
|
|
|
- insurancePolicy.setStatus(String.valueOf(PolicyStatus.PendingMakePolicy.getValue()));
|
|
|
|
|
|
+ insurancePolicy.setStatus(String.valueOf(PolicyStatus.PendingTrial.getValue()));
|
|
insurancePolicy.setUpdateBy(principal.getName());
|
|
insurancePolicy.setUpdateBy(principal.getName());
|
|
insurancePolicy.setUpdateTime(new Date());
|
|
insurancePolicy.setUpdateTime(new Date());
|
|
|
|
|
|
@@ -331,4 +294,235 @@ public class InsurancePolicyController {
|
|
|
|
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="获取投保信息")
|
|
|
|
+ @RequestMapping(value = "insureDetail",method = RequestMethod.GET)
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "policyId",value = "每月投保编号", required = true, paramType = "query",dataType = "String")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<InsuranceApplicationDTO> insureDetail(String policyId,
|
|
|
|
+ HttpServletRequest request){
|
|
|
|
+ MessageResult<InsuranceApplicationDTO> msgResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ InsuranceApplicationDTO insuranceApplicationDTO = new InsuranceApplicationDTO();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ InsuranceApplication insuranceApplication = null;
|
|
|
|
+
|
|
|
|
+ List<InsuranceApplication> appList = applicationPolicyService.findApplicationByPolicyId(policyId);
|
|
|
|
+
|
|
|
|
+ if(appList.size()>0){
|
|
|
|
+ insuranceApplication = appList.get(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (insuranceApplication != null) {
|
|
|
|
+ PojoUtils.map(insuranceApplication, insuranceApplicationDTO);
|
|
|
|
+ insuranceApplicationDTO.setApplicationId(insuranceApplication.getId());
|
|
|
|
+
|
|
|
|
+ DateTime endTime = new DateTime(insuranceApplication.getEndTime());
|
|
|
|
+ DateTime startTime = new DateTime(insuranceApplication.getStartTime());
|
|
|
|
+ Interval interval = new Interval(startTime, endTime);
|
|
|
|
+
|
|
|
|
+ insuranceApplicationDTO.setMonthNumber(interval.toPeriod().getMonths());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ msgResult.setData(insuranceApplicationDTO);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ }
|
|
|
|
+ catch(Exception ex){
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return msgResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<InsuranceJobs> findByDefinitionId(String definitionId){
|
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
+ searchParams.put("definitionId",definitionId);
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
+ sortList.add(new Sort("create_time","asc"));
|
|
|
|
+ Page<InsuranceJobs> insuranceJobsPage = insuranceJobsService.pageSearch(searchParams,1,100,sortList);
|
|
|
|
+
|
|
|
|
+ return insuranceJobsPage.getResult();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="获取承保信息")
|
|
|
|
+ @RequestMapping(value = "acceptDetail",method = RequestMethod.GET)
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "policyId",value = "每月投保单ID", required = true,paramType = "query",dataType = "String"),
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<AcceptInsuranceDTO> acceptDetail(String policyId){
|
|
|
|
+ MessageResult<AcceptInsuranceDTO> msgResult = new MessageResult<>();
|
|
|
|
+ AcceptInsuranceDTO acceptInsuranceDTO = new AcceptInsuranceDTO();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ //投保单
|
|
|
|
+ InsuranceApplication insuranceApplication = null;
|
|
|
|
+
|
|
|
|
+ List<InsuranceApplication> appList = applicationPolicyService.findApplicationByPolicyId(policyId);
|
|
|
|
+
|
|
|
|
+ if(appList.size()>0){
|
|
|
|
+ insuranceApplication = appList.get(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //险种
|
|
|
|
+ InsuranceDefinition insuranceDefinition = insuranceDefinitionService.get(insuranceApplication.getDefinitionId());
|
|
|
|
+
|
|
|
|
+ //险种名称
|
|
|
|
+ acceptInsuranceDTO.setInsuranceDefName(insuranceDefinition.getName());
|
|
|
|
+
|
|
|
|
+ //险种关联限额
|
|
|
|
+ List<InsuranceDefinitionLimit> insuranceDefinitionLimits = insuranceDefinitionLimitService.findByDefinitionId(insuranceApplication.getDefinitionId());
|
|
|
|
+
|
|
|
|
+ acceptInsuranceDTO.setInsuranceDefLimitList(insuranceDefinitionLimits);
|
|
|
|
+
|
|
|
|
+ //关联岗位
|
|
|
|
+ List<InsuranceJobs> InsuranceJobsList = findByDefinitionId(insuranceApplication.getDefinitionId());
|
|
|
|
+
|
|
|
|
+ DateTime endTime = new DateTime(insuranceApplication.getEndTime());
|
|
|
|
+ acceptInsuranceDTO.setEndTime(insuranceApplication.getEndTime());
|
|
|
|
+
|
|
|
|
+ DateTime startTime = new DateTime(insuranceApplication.getStartTime());
|
|
|
|
+ acceptInsuranceDTO.setStartTime(insuranceApplication.getStartTime());
|
|
|
|
+
|
|
|
|
+ Interval interval = new Interval(startTime, endTime);
|
|
|
|
+
|
|
|
|
+ //投保总月份
|
|
|
|
+ int months = interval.toPeriod().getMonths();
|
|
|
|
+
|
|
|
|
+ BigDecimal totalAmount = new BigDecimal(0);
|
|
|
|
+ int totalNumber = 0;
|
|
|
|
+
|
|
|
|
+ List<InsuranceJobsDTO> insuranceJobsList = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ //查询不同岗位,参保费用
|
|
|
|
+ for(InsuranceJobs insuranceJobs : InsuranceJobsList){
|
|
|
|
+ Jobs jobs = jobsService.get(insuranceJobs.getJobsId());
|
|
|
|
+
|
|
|
|
+ InsuranceJobsDTO insuranceJobsDTO = new InsuranceJobsDTO();
|
|
|
|
+
|
|
|
|
+ insuranceJobsDTO.setJobs(jobs);
|
|
|
|
+
|
|
|
|
+ long memberCount = insurancePolicyMemberService.countByPolicyIdAndJobsId(policyId,insuranceJobs.getJobsId());
|
|
|
|
+
|
|
|
|
+ insuranceJobsDTO.setCharges(insuranceJobs.getCharges());
|
|
|
|
+ insuranceJobsDTO.setChargesY(insuranceJobs.getCharges().multiply(new BigDecimal(12)));
|
|
|
|
+ insuranceJobsDTO.setNumber(Long.valueOf(memberCount).intValue());
|
|
|
|
+
|
|
|
|
+ insuranceJobsDTO.setMoney(insuranceJobsDTO.getCharges()
|
|
|
|
+ .multiply(new BigDecimal(months))
|
|
|
|
+ .multiply(new BigDecimal(insuranceJobsDTO.getNumber())));
|
|
|
|
+
|
|
|
|
+ totalAmount = totalAmount.add(insuranceJobsDTO.getMoney());
|
|
|
|
+ totalNumber += memberCount;
|
|
|
|
+
|
|
|
|
+ insuranceJobsList.add(insuranceJobsDTO);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ acceptInsuranceDTO.setInsuranceJobsList(insuranceJobsList);
|
|
|
|
+ acceptInsuranceDTO.setTotalAmount(totalAmount);
|
|
|
|
+
|
|
|
|
+ msgResult.setData(acceptInsuranceDTO);
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ }
|
|
|
|
+ catch(Exception ex){
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return msgResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping(value="generateNextMonthPolicy")
|
|
|
|
+ @ApiOperation(value = "生成下月投保单")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "applicationId",value = "投保单编号", required = true, paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "policyId",value = "本月投保单编号", required = true, paramType = "form"),
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<String> generateNextMonthPolicy(
|
|
|
|
+ String applicationId,String policyId,
|
|
|
|
+ HttpServletRequest request){
|
|
|
|
+ MessageResult<String> messageResult = new MessageResult<>();
|
|
|
|
+ AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ generatePolicyInTrans(applicationId, policyId, principal);
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex){
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ private void generatePolicyInTrans(String applicationId, String policyId, AttributePrincipal principal) throws Exception {
|
|
|
|
+ //添加下月投保单
|
|
|
|
+ InsurancePolicy srcPolicy = insurancePolicyService.get(policyId);
|
|
|
|
+ srcPolicy.setStatus(PolicyStatus.SendOutPolicy.getValue() + "");
|
|
|
|
+ srcPolicy.setUpdateTime(new Date());
|
|
|
|
+
|
|
|
|
+ insurancePolicyService.update(srcPolicy);
|
|
|
|
+
|
|
|
|
+ InsurancePolicy destPolicy = new InsurancePolicy();
|
|
|
|
+
|
|
|
|
+ PojoUtils.map(srcPolicy,destPolicy);
|
|
|
|
+
|
|
|
|
+ DateTime startTime = new DateTime(srcPolicy.getEndTime()).plusDays(1);
|
|
|
|
+
|
|
|
|
+ destPolicy.setStartTime(startTime.toDate());
|
|
|
|
+ destPolicy.setEndTime(startTime.plusMonths(1).toDate());
|
|
|
|
+
|
|
|
|
+ destPolicy.setEffectiveDate(startTime.toString("yyyyMM"));
|
|
|
|
+
|
|
|
|
+ boolean exist = insurancePolicyService.existByApplicationIdAndEffectiveDate(applicationId,destPolicy.getEffectiveDate());
|
|
|
|
+
|
|
|
|
+ if (exist){
|
|
|
|
+ throw new Exception(destPolicy.getEffectiveDate() + "投保单已存在!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ destPolicy.setNo(srcPolicy.getNo()+1);
|
|
|
|
+ destPolicy.setId(UUID.randomUUID().toString());
|
|
|
|
+ destPolicy.setStatus(PolicyStatus.Draft.getValue() + "");
|
|
|
|
+ destPolicy.setCreateBy(principal.getName());
|
|
|
|
+ destPolicy.setCreateTime(new Date());
|
|
|
|
+ destPolicy.setUpdateBy(principal.getName());
|
|
|
|
+ destPolicy.setUpdateTime(new Date());
|
|
|
|
+
|
|
|
|
+ insurancePolicyService.insert(destPolicy);
|
|
|
|
+
|
|
|
|
+ //关联投保单及每月投保单
|
|
|
|
+ ApplicationPolicy applicationPolicy = new ApplicationPolicy();
|
|
|
|
+ applicationPolicy.setId(UUID.randomUUID().toString());
|
|
|
|
+ applicationPolicy.setApplicationId(applicationId);
|
|
|
|
+ applicationPolicy.setPolicyId(destPolicy.getId());
|
|
|
|
+
|
|
|
|
+ applicationPolicyService.insert(applicationPolicy);
|
|
|
|
+
|
|
|
|
+ //关联参保人员
|
|
|
|
+ List<InsurancePolicyMember> memberList = insurancePolicyMemberService.findByPolicyId(policyId);
|
|
|
|
+
|
|
|
|
+ for (InsurancePolicyMember srcMember : memberList) {
|
|
|
|
+ InsurancePolicyMember destMember = new InsurancePolicyMember();
|
|
|
|
+
|
|
|
|
+ destMember.setId(UUID.randomUUID().toString());
|
|
|
|
+ destMember.setPolicyId(destPolicy.getId());
|
|
|
|
+ destMember.setMemberId(srcMember.getMemberId());
|
|
|
|
+ destMember.setDelFlag(false);
|
|
|
|
+ destMember.setCreateBy(principal.getName());
|
|
|
|
+ destMember.setCreateTime(new Date());
|
|
|
|
+ destMember.setStatus(srcMember.getStatus());
|
|
|
|
+
|
|
|
|
+ insurancePolicyMemberService.insert(destMember);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|