|
@@ -1,6 +1,14 @@
|
|
|
package com.jpsoft.picc.modules.auth.controller;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.picc.modules.base.entity.Company;
|
|
|
+import com.jpsoft.picc.modules.base.entity.InsuranceDefinition;
|
|
|
+import com.jpsoft.picc.modules.base.entity.InsuranceDefinitionLimit;
|
|
|
+import com.jpsoft.picc.modules.base.entity.InsuranceJobs;
|
|
|
+import com.jpsoft.picc.modules.base.service.CompanyService;
|
|
|
+import com.jpsoft.picc.modules.base.service.InsuranceDefinitionLimitService;
|
|
|
+import com.jpsoft.picc.modules.base.service.InsuranceDefinitionService;
|
|
|
+import com.jpsoft.picc.modules.base.service.InsuranceJobsService;
|
|
|
import com.jpsoft.picc.modules.business.entity.InsuranceApplication;
|
|
|
import com.jpsoft.picc.modules.business.service.InsuranceApplicationService;
|
|
|
import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
@@ -11,6 +19,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.jasig.cas.client.authentication.AttributePrincipal;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -19,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -33,6 +43,18 @@ public class InsuranceApplicationController {
|
|
|
@Autowired
|
|
|
private InsuranceApplicationService insuranceApplicationService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private InsuranceDefinitionService insuranceDefinitionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private InsuranceDefinitionLimitService insuranceDefinitionLimitService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private InsuranceJobsService insuranceJobsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CompanyService companyService;
|
|
|
+
|
|
|
@ApiOperation(value="投保单列表")
|
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
@ApiImplicitParams({
|
|
@@ -66,19 +88,65 @@ public class InsuranceApplicationController {
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form",dataType = "String")
|
|
|
})
|
|
|
- public MessageResult<InsuranceApplication> insureDetail(@RequestParam(value="id",defaultValue="") String id){
|
|
|
- MessageResult<InsuranceApplication> msgResult = new MessageResult<>();
|
|
|
+ public MessageResult<Map<String,Object>> insureDetail(@RequestParam(value="id",defaultValue="") String id,
|
|
|
+ HttpServletRequest request){
|
|
|
+ AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
|
|
|
+ Company company = companyService.findByCreateBy(principal.getName());
|
|
|
+
|
|
|
+ MessageResult<Map<String,Object>> msgResult = new MessageResult<>();
|
|
|
+ Map<String,Object> objectMap = new HashMap<>();
|
|
|
|
|
|
try {
|
|
|
InsuranceApplication insuranceApplication = insuranceApplicationService.get(id);
|
|
|
|
|
|
if (insuranceApplication != null) {
|
|
|
- msgResult.setResult(true);
|
|
|
- msgResult.setData(insuranceApplication);
|
|
|
+ insuranceApplication = insuranceApplicationService.get(id);
|
|
|
} else {
|
|
|
- msgResult.setResult(false);
|
|
|
- msgResult.setMessage("数据库不存在该记录!");
|
|
|
+ insuranceApplication = new InsuranceApplication();
|
|
|
}
|
|
|
+
|
|
|
+ objectMap.put("insuranceApplication",insuranceApplication);
|
|
|
+ objectMap.put("company",company);
|
|
|
+
|
|
|
+ msgResult.setData(objectMap);
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="获取承保信息")
|
|
|
+ @RequestMapping(value = "acceptDetail",method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "id",value = "编号", required = true, paramType = "form",dataType = "String")
|
|
|
+ })
|
|
|
+ public MessageResult<Map<String,Object>> acceptDetail(@RequestParam(value="id",defaultValue="") String id){
|
|
|
+ MessageResult<Map<String,Object>> msgResult = new MessageResult<>();
|
|
|
+ Map<String,Object> objectMap = new HashMap<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ InsuranceApplication insuranceApplication = insuranceApplicationService.get(id);
|
|
|
+
|
|
|
+ InsuranceDefinition insuranceDefinition = insuranceDefinitionService.get(insuranceApplication.getDefinitionId());
|
|
|
+
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+ searchParams.put("definitionId",insuranceApplication.getDefinitionId());
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("id_","asc"));
|
|
|
+
|
|
|
+ Page<InsuranceDefinitionLimit> insuranceDefinitionLimitPage = insuranceDefinitionLimitService.pageSearch(searchParams,1,100,sortList);
|
|
|
+ insuranceDefinition.setLimits(insuranceDefinitionLimitPage.getResult());
|
|
|
+ Page<InsuranceJobs> insuranceJobsPage = insuranceJobsService.pageSearch(searchParams,1,100,sortList);
|
|
|
+
|
|
|
+ objectMap.put("insuranceDefinition",insuranceDefinition);
|
|
|
+ objectMap.put("insuranceJobs",insuranceJobsPage.getResult());
|
|
|
+
|
|
|
+ msgResult.setData(objectMap);
|
|
|
}
|
|
|
catch(Exception ex){
|
|
|
logger.error(ex.getMessage(),ex);
|