|
@@ -1,433 +0,0 @@
|
|
-package com.jpsoft.picc.modules.business.controller;
|
|
|
|
-
|
|
|
|
-import com.github.pagehelper.Page;
|
|
|
|
-import com.jpsoft.picc.modules.base.entity.InsuranceAgent;
|
|
|
|
-import com.jpsoft.picc.modules.base.service.InsuranceAgentService;
|
|
|
|
-import com.jpsoft.picc.modules.business.entity.InsuranceApplication;
|
|
|
|
-import com.jpsoft.picc.modules.business.service.InsuranceApplicationService;
|
|
|
|
-import com.jpsoft.picc.modules.business.service.InsurancePolicyRecordService;
|
|
|
|
-import com.jpsoft.picc.modules.common.utils.PojoUtils;
|
|
|
|
-import com.jpsoft.picc.modules.common.dto.Sort;
|
|
|
|
-import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
|
|
-import com.jpsoft.picc.modules.business.entity.InsurancePolicy;
|
|
|
|
-import com.jpsoft.picc.modules.business.service.InsurancePolicyService;
|
|
|
|
-import com.jpsoft.picc.modules.business.entity.InsurancePolicyRecord;
|
|
|
|
-import io.swagger.annotations.Api;
|
|
|
|
-import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
-import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
-import org.slf4j.Logger;
|
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
-
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
|
-import java.util.*;
|
|
|
|
-
|
|
|
|
-@RestController
|
|
|
|
-@RequestMapping("/insurancePolicy")
|
|
|
|
-@Api(description = "每月投保单")
|
|
|
|
-public class InsurancePolicyController {
|
|
|
|
- private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private InsurancePolicyService insurancePolicyService;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private InsuranceAgentService insuranceAgentService;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private InsurancePolicyRecordService insurancePolicyRecordService;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private InsuranceApplicationService insuranceApplicationService;
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="创建空记录")
|
|
|
|
- @GetMapping("create")
|
|
|
|
- public MessageResult<InsurancePolicy> create(){
|
|
|
|
- MessageResult<InsurancePolicy> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- InsurancePolicy insurancePolicy = new InsurancePolicy();
|
|
|
|
-
|
|
|
|
- msgResult.setData(insurancePolicy);
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="添加信息")
|
|
|
|
- @PostMapping("add")
|
|
|
|
- public MessageResult<InsurancePolicy> add(@RequestBody InsurancePolicy insurancePolicy,@RequestAttribute String subject){
|
|
|
|
- MessageResult<InsurancePolicy> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- insurancePolicy.setId(UUID.randomUUID().toString());
|
|
|
|
- insurancePolicy.setDelFlag(false);
|
|
|
|
- insurancePolicy.setCreateBy(subject);
|
|
|
|
- insurancePolicy.setCreateTime(new Date());
|
|
|
|
-
|
|
|
|
- int affectCount = insurancePolicyService.insert(insurancePolicy);
|
|
|
|
-
|
|
|
|
- if (affectCount > 0) {
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(insurancePolicy);
|
|
|
|
- } else {
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage("数据库添加失败");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- catch(Exception ex){
|
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage(ex.getMessage());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="获取信息")
|
|
|
|
- @GetMapping("edit/{id}")
|
|
|
|
- public MessageResult<InsurancePolicy> edit(@PathVariable("id") String id){
|
|
|
|
- MessageResult<InsurancePolicy> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- InsurancePolicy insurancePolicy = insurancePolicyService.get(id);
|
|
|
|
-
|
|
|
|
- if (insurancePolicy != null) {
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(insurancePolicy);
|
|
|
|
- } else {
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage("数据库不存在该记录!");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- catch(Exception ex){
|
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage(ex.getMessage());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="更新用户")
|
|
|
|
- @PostMapping("update")
|
|
|
|
- public MessageResult<InsurancePolicy> update(@RequestBody InsurancePolicy insurancePolicy,@RequestAttribute String subject){
|
|
|
|
- MessageResult<InsurancePolicy> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- insurancePolicy.setUpdateBy(subject);
|
|
|
|
- insurancePolicy.setUpdateTime(new Date());
|
|
|
|
-
|
|
|
|
- int affectCount = insurancePolicyService.update(insurancePolicy);
|
|
|
|
-
|
|
|
|
- if (affectCount > 0) {
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(insurancePolicy);
|
|
|
|
- } else {
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage("数据库更新失败");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- catch(Exception ex){
|
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage(ex.getMessage());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="删除")
|
|
|
|
- @PostMapping("delete/{id}")
|
|
|
|
- public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
|
|
- MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- InsurancePolicy insurancePolicy = insurancePolicyService.get(id);
|
|
|
|
- insurancePolicy.setDelFlag(true);
|
|
|
|
- insurancePolicy.setUpdateBy(subject);
|
|
|
|
- insurancePolicy.setUpdateTime(new Date());
|
|
|
|
-
|
|
|
|
- int affectCount = insurancePolicyService.update(insurancePolicy);
|
|
|
|
-
|
|
|
|
- if (affectCount > 0) {
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(affectCount);
|
|
|
|
- } else {
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage("删除失败");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- catch(Exception ex){
|
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage(ex.getMessage());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="批量删除")
|
|
|
|
- @PostMapping("batchDelete")
|
|
|
|
- public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
|
|
|
|
- MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- int affectCount = 0;
|
|
|
|
-
|
|
|
|
- for (String id : idList) {
|
|
|
|
- InsurancePolicy insurancePolicy = insurancePolicyService.get(id);
|
|
|
|
- insurancePolicy.setDelFlag(true);
|
|
|
|
- insurancePolicy.setUpdateBy(subject);
|
|
|
|
- insurancePolicy.setUpdateTime(new Date());
|
|
|
|
-
|
|
|
|
- affectCount += insurancePolicyService.update(insurancePolicy);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (affectCount > 0) {
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(affectCount);
|
|
|
|
- } else {
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage("删除失败");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- catch(Exception ex){
|
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage(ex.getMessage());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="列表")
|
|
|
|
- @RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
|
- public MessageResult<Map> pageList(
|
|
|
|
- String id,
|
|
|
|
- @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
|
- @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
|
- @RequestAttribute String subject){
|
|
|
|
-
|
|
|
|
- //当前用户ID
|
|
|
|
- System.out.println(subject);
|
|
|
|
-
|
|
|
|
- MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
-
|
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
|
- sortList.add(new Sort("create_time","desc"));
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
|
- searchParams.put("id","%" + id + "%");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Page<InsurancePolicy> page = insurancePolicyService.pageSearch(searchParams,pageIndex,pageSize,sortList);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="读取附件")
|
|
|
|
- @RequestMapping(value = "attachmentList",method = RequestMethod.POST)
|
|
|
|
- @ApiImplicitParams({
|
|
|
|
- @ApiImplicitParam(name="id",value = "每月投保单ID",required = true,paramType = "query")
|
|
|
|
- })
|
|
|
|
- public MessageResult<Map> attachmentList(String id, @RequestAttribute String subject){
|
|
|
|
-
|
|
|
|
- //当前用户ID
|
|
|
|
- System.out.println(subject);
|
|
|
|
-
|
|
|
|
- MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- Map<String,String> map = new HashMap<String,String>();
|
|
|
|
-
|
|
|
|
- InsurancePolicy insurancePolicy = insurancePolicyService.get(id);
|
|
|
|
-
|
|
|
|
- String file = insurancePolicy.getInsurancePolicyFile();
|
|
|
|
-
|
|
|
|
- String[] files = file.split(";");
|
|
|
|
-
|
|
|
|
- if(files.length==2){
|
|
|
|
- map.put("file1",files[0]);
|
|
|
|
- map.put("file2",files[1]);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(map);
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="读取推广信息")
|
|
|
|
- @RequestMapping(value = "loadInsuranceAgent",method = RequestMethod.POST)
|
|
|
|
- @ApiImplicitParams({
|
|
|
|
- @ApiImplicitParam(name="id",value = "每月投保单ID",required = true,paramType = "query")
|
|
|
|
- })
|
|
|
|
- public MessageResult<InsuranceAgent> loadInsuranceAgent(String id, @RequestAttribute String subject){
|
|
|
|
-
|
|
|
|
- //当前用户ID
|
|
|
|
- System.out.println(subject);
|
|
|
|
-
|
|
|
|
- MessageResult<InsuranceAgent> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- InsurancePolicy insurancePolicy = insurancePolicyService.get(id);
|
|
|
|
-
|
|
|
|
- String agentId = insurancePolicy.getAgentId();
|
|
|
|
-
|
|
|
|
- InsuranceAgent insuranceAgent = insuranceAgentService.get(agentId);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(insuranceAgent);
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="人才超市初审")
|
|
|
|
- @RequestMapping(value = "firstApproval",method = RequestMethod.POST)
|
|
|
|
- @ApiImplicitParams({
|
|
|
|
- @ApiImplicitParam(name="id",value = "每月投保单ID",required = true,paramType = "query"),
|
|
|
|
- @ApiImplicitParam(name="processStatus",value = "流程审核状态(正常/回退)",required = true,paramType = "query"),
|
|
|
|
- @ApiImplicitParam(name="opinion",value = "意见",required = true,paramType = "query")
|
|
|
|
- })
|
|
|
|
- public MessageResult<Integer> firstApproval(String id,String processStatus,String opinion, @RequestAttribute String subject){
|
|
|
|
-
|
|
|
|
- //当前用户ID
|
|
|
|
- System.out.println(subject);
|
|
|
|
-
|
|
|
|
- MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- int affectCount1 = approval(id,processStatus,opinion,"50",subject);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(affectCount1);
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="PICC复审")
|
|
|
|
- @RequestMapping(value = "secondApproval",method = RequestMethod.POST)
|
|
|
|
- @ApiImplicitParams({
|
|
|
|
- @ApiImplicitParam(name="id",value = "每月投保单ID",required = true,paramType = "query"),
|
|
|
|
- @ApiImplicitParam(name="processStatus",value = "流程审核状态(正常/回退)",required = true,paramType = "query"),
|
|
|
|
- @ApiImplicitParam(name="opinion",value = "意见",required = true,paramType = "query")
|
|
|
|
- })
|
|
|
|
- public MessageResult<Integer> secondApproval(String id,String processStatus,String opinion, @RequestAttribute String subject){
|
|
|
|
-
|
|
|
|
- //当前用户ID
|
|
|
|
- System.out.println(subject);
|
|
|
|
-
|
|
|
|
- MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- int affectCount1 = approval(id,processStatus,opinion,"60",subject);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(affectCount1);
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="PICC出单")
|
|
|
|
- @RequestMapping(value = "issued",method = RequestMethod.POST)
|
|
|
|
- @ApiImplicitParams({
|
|
|
|
- @ApiImplicitParam(name="id",value = "每月投保单ID",required = true,paramType = "query"),
|
|
|
|
- @ApiImplicitParam(name="processStatus",value = "流程审核状态(正常/回退)",required = true,paramType = "query"),
|
|
|
|
- @ApiImplicitParam(name="opinion",value = "意见",required = true,paramType = "query")
|
|
|
|
- })
|
|
|
|
- public MessageResult<Integer> issued(String id,String processStatus,String opinion, @RequestAttribute String subject){
|
|
|
|
-
|
|
|
|
- //当前用户ID
|
|
|
|
- System.out.println(subject);
|
|
|
|
-
|
|
|
|
- MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- int affectCount1 = approval(id,processStatus,opinion,"70",subject);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(affectCount1);
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- private Integer approval(String id,String processStatus,String opinion,String status,String subject){
|
|
|
|
-
|
|
|
|
- InsurancePolicy insurancePolicy = insurancePolicyService.get(id);
|
|
|
|
-
|
|
|
|
- insurancePolicy.setProcessStatus(processStatus);
|
|
|
|
- insurancePolicy.setStatus(status);
|
|
|
|
-
|
|
|
|
- int affectCount = insurancePolicyService.update(insurancePolicy);
|
|
|
|
-
|
|
|
|
- int affectCount1 = 0;
|
|
|
|
-
|
|
|
|
- if(affectCount > 0){
|
|
|
|
- InsurancePolicyRecord insurancePolicyRecord = new InsurancePolicyRecord();
|
|
|
|
- insurancePolicyRecord.setPolicyId(insurancePolicy.getId());
|
|
|
|
- insurancePolicyRecord.setOpinion(opinion);
|
|
|
|
- insurancePolicyRecord.setProcessStatus(processStatus);
|
|
|
|
- insurancePolicyRecord.setId(UUID.randomUUID().toString());
|
|
|
|
- insurancePolicyRecord.setDelFlag(false);
|
|
|
|
- insurancePolicyRecord.setCreateBy(subject);
|
|
|
|
- insurancePolicyRecord.setCreateTime(new Date());
|
|
|
|
-
|
|
|
|
- affectCount1 = insurancePolicyRecordService.insert(insurancePolicyRecord);
|
|
|
|
- }
|
|
|
|
- return affectCount1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="企业缴费")
|
|
|
|
- @RequestMapping(value = "pay",method = RequestMethod.POST)
|
|
|
|
- @ApiImplicitParams({
|
|
|
|
- @ApiImplicitParam(name="applicationId",value = "投保单ID",required = true,paramType = "query"),
|
|
|
|
- @ApiImplicitParam(name="policyId",value = "每月投保单ID",required = true,paramType = "query")
|
|
|
|
- })
|
|
|
|
- public MessageResult<Integer> pay(String applicationId,String policyId, @RequestAttribute String subject){
|
|
|
|
-
|
|
|
|
- //当前用户ID
|
|
|
|
- System.out.println(subject);
|
|
|
|
-
|
|
|
|
- MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- InsuranceApplication insuranceApplication = insuranceApplicationService.get(applicationId);
|
|
|
|
-
|
|
|
|
- insuranceApplication.setStatus("50");//状态改为待出单
|
|
|
|
-
|
|
|
|
- int affectCount = insuranceApplicationService.update(insuranceApplication);
|
|
|
|
-
|
|
|
|
- if(affectCount>0){
|
|
|
|
- InsurancePolicy insurancePolicy = insurancePolicyService.get(policyId);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(affectCount);
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-}
|
|
|