|
@@ -11,6 +11,7 @@ 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.constant.PolicyStatus;
|
|
|
import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.picc.modules.common.dto.Sort;
|
|
|
import com.jpsoft.picc.modules.common.utils.PojoUtils;
|
|
@@ -23,10 +24,7 @@ import org.jasig.cas.client.authentication.AttributePrincipal;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
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.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.*;
|
|
@@ -55,12 +53,16 @@ public class InsuranceApplicationController {
|
|
|
@ApiOperation(value="投保单列表")
|
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String")
|
|
|
+// @ApiImplicitParam(name = "status",value = "状态:草稿10/待初审20/待复审30/待缴费40/待制单50/待出单60/已出单70/已过期100", required = true, paramType = "form",dataType = "String")
|
|
|
})
|
|
|
public MessageResult<Map> pageList(
|
|
|
- @RequestParam(value="companyId",defaultValue="") String companyId,
|
|
|
+// @RequestParam(value="status",defaultValue="") String status,
|
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
- @RequestParam(value="pageSize",defaultValue="20") int pageSize){
|
|
|
+ @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<>();
|
|
@@ -68,8 +70,8 @@ public class InsuranceApplicationController {
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("id_","asc"));
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(companyId)) {
|
|
|
- searchParams.put("companyId",companyId);
|
|
|
+ if (StringUtils.isNotEmpty(company.getId())) {
|
|
|
+ searchParams.put("companyId",company.getId());
|
|
|
}
|
|
|
|
|
|
Page<InsuranceApplication> page = insuranceApplicationService.pageSearch(searchParams,pageIndex,pageSize,sortList);
|
|
@@ -87,10 +89,17 @@ public class InsuranceApplicationController {
|
|
|
})
|
|
|
public MessageResult<Map<String,Object>> insureDetail(@RequestParam(value="id",defaultValue="") String id,
|
|
|
HttpServletRequest request){
|
|
|
+ MessageResult<Map<String,Object>> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
|
|
|
Company company = companyService.findByCreateBy(principal.getName());
|
|
|
+ if(company == null){
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("请先完善企业信息!");
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
|
|
|
- MessageResult<Map<String,Object>> msgResult = new MessageResult<>();
|
|
|
Map<String,Object> objectMap = new HashMap<>();
|
|
|
|
|
|
try {
|
|
@@ -100,10 +109,29 @@ public class InsuranceApplicationController {
|
|
|
insuranceApplication = insuranceApplicationService.get(id);
|
|
|
} else {
|
|
|
insuranceApplication = new InsuranceApplication();
|
|
|
+// insuranceApplication.setCompanyId();
|
|
|
+// insuranceApplication.setDefinitionId();
|
|
|
+
|
|
|
+// insuranceApplication.setStartTime();
|
|
|
+// insuranceApplication.setEndTime();
|
|
|
+//
|
|
|
+// insuranceApplication.setInsuredName();
|
|
|
+// insuranceApplication.setInsuredTel();
|
|
|
+// insuranceApplication.setCompanyName();
|
|
|
+// //business_nature
|
|
|
+// insuranceApplication.setUsccCode();
|
|
|
+// insuranceApplication.setBusinessScope();
|
|
|
+// insuranceApplication.setIndustryType();
|
|
|
+// insuranceApplication.setEmployeesNumber();
|
|
|
+// insuranceApplication.setInsuredNumber();
|
|
|
+// //tel_
|
|
|
+// //mail_
|
|
|
+// insuranceApplication.setCompanyAddress();
|
|
|
+// insuranceApplication.setLossInRecentYears();
|
|
|
}
|
|
|
|
|
|
objectMap.put("insuranceApplication",insuranceApplication);
|
|
|
- objectMap.put("company",company);
|
|
|
+ objectMap.put("business_nature",company);
|
|
|
|
|
|
msgResult.setData(objectMap);
|
|
|
}
|
|
@@ -169,7 +197,7 @@ public class InsuranceApplicationController {
|
|
|
try {
|
|
|
InsuranceApplication insuranceApplication = insuranceApplicationService.get(id);
|
|
|
|
|
|
- insuranceApplication.setStatus("20");
|
|
|
+ insuranceApplication.setStatus(String.valueOf(PolicyStatus.PendingTrial.getValue()));
|
|
|
insuranceApplication.setUpdateBy(principal.getName());
|
|
|
insuranceApplication.setUpdateTime(new Date());
|
|
|
int affectCount = insuranceApplicationService.update(insuranceApplication);
|
|
@@ -185,4 +213,48 @@ public class InsuranceApplicationController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="保存草稿")
|
|
|
+ @RequestMapping(value = "saveDraft",method = RequestMethod.POST)
|
|
|
+ public MessageResult<InsuranceApplication> saveDraft(@ModelAttribute InsuranceApplication insuranceApplication,
|
|
|
+ HttpServletRequest request){
|
|
|
+ AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
|
|
|
+ Company company = companyService.findByCreateBy(principal.getName());
|
|
|
+
|
|
|
+ MessageResult<InsuranceApplication> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ int affectCount = 0;
|
|
|
+ if(insuranceApplication.getId() == null){
|
|
|
+ insuranceApplication.setId(UUID.randomUUID().toString());
|
|
|
+ insuranceApplication.setCompanyId(company.getId());
|
|
|
+ insuranceApplication.setStatus(String.valueOf(PolicyStatus.Draft));
|
|
|
+ insuranceApplication.setDelFlag(false);
|
|
|
+ insuranceApplication.setCreateBy(principal.getName());
|
|
|
+ insuranceApplication.setCreateTime(new Date());
|
|
|
+
|
|
|
+ affectCount = insuranceApplicationService.insert(insuranceApplication);
|
|
|
+ }else {
|
|
|
+ insuranceApplication.setUpdateBy(principal.getName());
|
|
|
+ insuranceApplication.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ affectCount = insuranceApplicationService.update(insuranceApplication);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(affectCount > 0) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(insuranceApplication);
|
|
|
+ }else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|