Commit 0510fbff authored by 查济's avatar 查济

Merge branch 'feature-zhaji' into 'develop'

Feature zhaji

See merge request !249
parents 54f5b359 45abf238
......@@ -328,6 +328,8 @@ public interface CommonConstants {
String PARAM_IS_NOT_ERROR = "传参异常,请检查参数";
int EXCEL_EXPORT_LIMIT = 60000;
String USER = "用户";
/**
* multipart/form-data
* @Author fxj
......
......@@ -69,6 +69,8 @@ public class ValidityConstants {
/** 最多200位 规则 */
public static final String PATTERN_200 = "[\\s\\S]{1,200}$";
public static String NUMBER_OF_DECIMAL_PLACE= "^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$";
/** 不超过两位小数的正数 */
public static final String POSITIVE_INTEGER_PATTERN_TWO_FLOAT = "^[+]?([0-9]+(.[0-9]{1,2})?)$";
/** 身份证规则(x只能大写) */
......
......@@ -38,28 +38,19 @@ public class EkpInsuranceUtil {
* 注意key的书写格式,类似EL表达式的方式,属性关系用'.', 列表和数组关系用[],Map关系用["xxx"]
*/
public String sendToEkp(EkpInteractiveParam param){
log.info("推送EKP开始");
RestTemplate yourRestTemplate = new RestTemplate();
EKPInsurancePushParam pushParam = insuranceDetail2PushParam(param);
try{
String formValues = new ObjectMapper().writeValueAsString(pushParam);
log.info("formValues:"+formValues);
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
JSONObject loginName = new JSONObject();
loginName.append("LoginName",ekpInsuranceProperties.getInsuranceLoginName());
String loginData = new ObjectMapper().writeValueAsString(loginName);
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
//wholeForm.add("docSubject", new String(docSubject.getBytes("UTF-8"),"ISO-8859-1") );
wholeForm.add("docSubject",ekpInsuranceProperties.getInsuranceFocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
//wholeForm.add("docCreator", loginData);
wholeForm.add("docStatus", ekpInsuranceProperties.getInsuranceDocStatus());
wholeForm.add("fdModelId", ekpInsuranceProperties.getInsuranceFdModelId());
wholeForm.add("fdFlowId", ekpInsuranceProperties.getInsuranceFdFlowId());
//wholeForm.add("formValues", new String(formValues.getBytes("UTF-8"),"ISO-8859-1"));
wholeForm.add("formValues", formValues);
//wholeForm.add("formValues", new String("{\"fd_3adfe6af71a1cc\":\"王五\", \"fd_3adfe658c6229e\":\"2019-03-26\", \"fd_3adfe6592b4158\":\"这里内容\"}".getBytes("UTF-8"),"ISO-8859-1") );
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
......@@ -67,14 +58,14 @@ public class EkpInsuranceUtil {
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<MultiValueMap<String,Object>>(wholeForm,headers);
//有返回值的情况 VO可以替换成具体的JavaBean
log.info("推送EKP开始,formValues:"+formValues);
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpInsuranceProperties.getInsuranceUrl(), HttpMethod.POST, entity, String.class);
log.info("obj:"+obj);
String body = obj.getBody();
if (StringUtils.isBlank(body)){
log.error("交易失败"+body);
log.error("交易失败:"+obj);
return null;
}else{
log.info("交易成功:"+body);
log.info("交易成功:"+obj);
return body;
}
}catch (Exception e){
......
......@@ -1096,6 +1096,26 @@ public class InsurancesConstants {
*/
public static final String SETTLE_ID_ATYPISM = "结算id不一致";
/**
* 获取项目信息失败
*/
public static final String GET_DEPT_DETAIL_ERROR = "获取项目信息失败:";
/**
* 获取项目信息失败
*/
public static final String ERROR_LIST = "errorList";
/**
* 获取项目信息失败
*/
public static final String SUCCESS_LIST = "successList";
/**
* OSS文件上传接口异常:
*/
public static final String OSS_ERROR = "OSS文件上传接口异常:";
......
package com.yifu.cloud.plus.v1.yifu.insurances.util;
import com.google.common.base.Optional;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants;
import java.math.BigDecimal;
import java.util.regex.Matcher;
......@@ -13,7 +15,6 @@ import java.util.regex.Pattern;
* @Description 提供精确的浮点数运算(包括加、减、乘、除、四舍五入)工具类
**/
public class BigDecimalUtils {
static Pattern p= Pattern.compile("^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$");
/**
* BigDecimal的加法运算封装
* @author : shijing
......@@ -50,7 +51,7 @@ public class BigDecimalUtils {
Integer r = b1;
if (null != bn) {
for (Integer b : bn) {
r += Optional.fromNullable(b).or(0);
r += Optional.fromNullable(b).or(CommonConstants.ZERO_INT);
}
}
return r > 0 ? r : 0;
......@@ -87,7 +88,7 @@ public class BigDecimalUtils {
r = r.subtract((null == b ? BigDecimal.ZERO : b));
}
}
return isZero ? (r.compareTo(BigDecimal.ZERO) == -1 ? BigDecimal.ZERO : r) : r;
return isZero ? (r.compareTo(BigDecimal.ZERO) == CommonConstants.ONE_INT_NEGATE ? BigDecimal.ZERO : r) : r;
}
/**
......@@ -105,10 +106,10 @@ public class BigDecimalUtils {
Integer r = b1;
if (null != bn) {
for (Integer b : bn) {
r -= Optional.fromNullable(b).or(0);
r -= Optional.fromNullable(b).or(CommonConstants.ZERO_INT);
}
}
return null != r && r > 0 ? r : 0;
return null != r && r > CommonConstants.ZERO_INT ? r : CommonConstants.ZERO_INT;
}
/**
......@@ -151,7 +152,7 @@ public class BigDecimalUtils {
return defaultValue;
}
try {
return BigDecimal.valueOf(b1.doubleValue()).divide(BigDecimal.valueOf(b2.doubleValue()), 2, BigDecimal.ROUND_HALF_UP);
return BigDecimal.valueOf(b1.doubleValue()).divide(BigDecimal.valueOf(b2.doubleValue()), CommonConstants.TWO_INT, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) {
return defaultValue;
}
......@@ -190,7 +191,7 @@ public class BigDecimalUtils {
if (null == b1 || null == b2) {
return BigDecimal.ZERO;
}
return BigDecimal.valueOf(b1.doubleValue()).multiply(BigDecimal.valueOf(b2.doubleValue())).setScale(2, BigDecimal.ROUND_HALF_UP);
return BigDecimal.valueOf(b1.doubleValue()).multiply(BigDecimal.valueOf(b2.doubleValue())).setScale( CommonConstants.TWO_INT, BigDecimal.ROUND_HALF_UP);
}
public static <T extends Number> BigDecimal safeMultiply(T b1, T b2, T b3) {
if (null == b1 || null == b2 || null == b3) {
......@@ -249,7 +250,7 @@ public class BigDecimalUtils {
if (null == bigDecimal){
return true;
}
if (bigDecimal.compareTo(BigDecimal.ZERO) == 0){
if (bigDecimal.compareTo(BigDecimal.ZERO) == CommonConstants.ZERO_INT){
return true;
}
return false;
......@@ -265,7 +266,7 @@ public class BigDecimalUtils {
if (null == b1) {
return BigDecimal.ZERO;
}
return BigDecimal.valueOf(b1.doubleValue()).setScale(2, BigDecimal.ROUND_HALF_UP);
return BigDecimal.valueOf(b1.doubleValue()).setScale(CommonConstants.TWO_INT, BigDecimal.ROUND_HALF_UP);
}
/**
......@@ -274,16 +275,16 @@ public class BigDecimalUtils {
* @return
*/
public static boolean isBigDecimal(String str){
if(str==null || str.trim().length() == 0){
if(str==null || str.trim().length() == CommonConstants.ZERO_INT){
return false;
}
char[] chars = str.toCharArray();
int sz = chars.length;
int i = (chars[0] == '-') ? 1 : 0;
int i = (chars[CommonConstants.ZERO_INT] == '-') ? CommonConstants.ONE_INT : CommonConstants.ZERO_INT;
if(i == sz){
return false;
}
if(chars[i] == '.'){
if(chars[i] == CommonConstants.SPOT_CHAR){
//除了负号,第一位不能为'小数点'
return false;
}
......@@ -333,6 +334,7 @@ public class BigDecimalUtils {
* @return double
*/
public static BigDecimal getNumberOfDecimalPlace(String str, int point) {
Pattern p= Pattern.compile(ValidityConstants.NUMBER_OF_DECIMAL_PLACE);
Matcher m=p.matcher(str);
boolean b=m.matches();
if(b){
......
......@@ -122,7 +122,7 @@ public class ValidityUtil {
* @param email 邮箱(电子邮件)
* @return boolean
*/
public static boolean validateEamil(final String email){
public static boolean validateEmail(final String email){
if(Common.isEmpty(email)){
return Boolean.FALSE ;
}
......@@ -169,11 +169,11 @@ public class ValidityUtil {
return Boolean.FALSE ;
}
BigDecimal bigDecimalMoney= new BigDecimal(money);
boolean max = bigDecimalMoney.compareTo(CommonConstants.MONEY_MAX) >0;
boolean max = bigDecimalMoney.compareTo(CommonConstants.MONEY_MAX) >CommonConstants.ZERO_INT;
if(max){
return Boolean.FALSE ;
}
boolean min = bigDecimalMoney.compareTo(CommonConstants.MONEY_MIN) <=0;
boolean min = bigDecimalMoney.compareTo(CommonConstants.MONEY_MIN) <=CommonConstants.ZERO_INT;
if(min){
return Boolean.FALSE ;
}
......@@ -202,7 +202,7 @@ public class ValidityUtil {
*/
public static boolean validateMoneyMax(final String money) {
BigDecimal bigDecimalMoney= new BigDecimal(money);
boolean max = bigDecimalMoney.compareTo(CommonConstants.MONEY_MAX) >0;
boolean max = bigDecimalMoney.compareTo(CommonConstants.MONEY_MAX) >CommonConstants.ZERO_INT;
if(max){
return Boolean.FALSE ;
}
......@@ -345,7 +345,7 @@ public class ValidityUtil {
if (!validateMobile(phone)){
return Boolean.FALSE;
}
String initializeInfo = "用户".concat(phone.substring(phone.length()-6, phone.length()));
String initializeInfo = CommonConstants.USER.concat(phone.substring(phone.length()-CommonConstants.SIX_INT, phone.length()));
if (!str.trim().equals(initializeInfo)){
return Boolean.FALSE;
}
......@@ -393,13 +393,13 @@ public class ValidityUtil {
return false;
}
if(numStr==""){
if(CommonConstants.EMPTY_STRING.equals(numStr)){
return false;
}
//验证是否是float型
if(numStr.contains(".")){
if(numStr.indexOf('.')==numStr.lastIndexOf('.')){
StringTokenizer st=new StringTokenizer(numStr,".");
if(numStr.contains(CommonConstants.SPOT)){
if(numStr.indexOf(CommonConstants.SPOT_CHAR)==numStr.lastIndexOf(CommonConstants.SPOT_CHAR)){
StringTokenizer st=new StringTokenizer(numStr,CommonConstants.SPOT);
while(st.hasMoreElements()){
String splitStr= st.nextToken();
for(int i=splitStr.length();--i>=0;){
......@@ -429,15 +429,15 @@ public class ValidityUtil {
return false;
}
if(numStr==""){
if(CommonConstants.EMPTY_STRING.equals(numStr)){
return false;
}
//验证是否是float型
if(numStr.contains(".")){
if(numStr.contains(CommonConstants.SPOT)){
return false;
}else{
//验证是否是int型
for(int i=numStr.length();--i>=0;){
for(int i=numStr.length();--i>=CommonConstants.ZERO_INT;){
if(!Character.isDigit(numStr.charAt(i))){
return false;
}
......
......@@ -967,16 +967,24 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (CollectionUtils.isNotEmpty(list)){
//根据项目编码获取项目名称
List<String> collectList = list.stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodesList = archivesDaprUtil.getSetInfoByCodes(collectList);
if (null != setInfoByCodesList && setInfoByCodesList.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodesList.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodesList.getData().getProjectSetInfoVoMap();
for (InsuranceExportListVO record : list) {
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject){
record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
record.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitleInsurance()).orElse(""));
try{
R<SetInfoVo> setInfoByCodesList = archivesDaprUtil.getSetInfoByCodes(collectList);
if (null != setInfoByCodesList && setInfoByCodesList.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodesList.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodesList.getData().getProjectSetInfoVoMap();
for (InsuranceExportListVO record : list) {
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject){
record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
record.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitleInsurance()).orElse(""));
}
}
}
}catch (Exception e){
for (InsuranceExportListVO record : list) {
record.setProjectName(CommonConstants.EMPTY_STRING);
record.setInvoiceTitle(CommonConstants.EMPTY_STRING);
}
log.error(InsurancesConstants.GET_DEPT_DETAIL_ERROR+e);
}
insuranceExportList.removeAll(listVOS);
insuranceExportList.addAll(crossMerger(list,listVOS));
......@@ -996,6 +1004,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @author licancan
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceListVO>> rollBackInsurance(YifuUser user, List<InsuranceHandleParam> paramList) {
//解析参数里的商险id
List<String> idList = paramList.stream().map(e -> e.getId()).distinct().collect(Collectors.toList());
......@@ -1163,12 +1172,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @author licancan
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceHandleImportParam>> insuranceHandleImport(YifuUser user, List<InsuranceHandleImportParam> param) {
Map<String, List<InsuranceHandleImportParam>> map = insuranceChangeCheck(param, user,false);
//检验成功的数据
List<InsuranceHandleImportParam> successList = map.get("successList");
List<InsuranceHandleImportParam> successList = map.get(InsurancesConstants.SUCCESS_LIST);
//校验失败的数据
List<InsuranceHandleImportParam> errorList = map.get("errorList");
List<InsuranceHandleImportParam> errorList = map.get(InsurancesConstants.ERROR_LIST);
if (CollectionUtils.isNotEmpty(successList)){
//投保成功的数据
List<InsuranceHandleImportParam> collectSuccess = successList.stream().filter(e -> InsurancesConstants.SUCCESS.equals(e.getHandType())).collect(Collectors.toList());
......@@ -1211,6 +1221,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @author licancan
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceListVO>> successfulInsurance(YifuUser user, List<InsuranceHandleParam> paramList) {
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(50, 50, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10));
//解析参数里的商险id
......@@ -1496,10 +1507,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
});
}
//如果当前实缴信息已推送,且金额与本次不一致,则推送实缴更新
if(settle.getIsActualPush() == CommonConstants.ONE_INT
&& (new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) != 0)){
BigDecimal bigDecimal = new BigDecimal(success.getActualPremium());
boolean b = bigDecimal.compareTo(detail.getActualPremium()) == CommonConstants.ZERO_INT;
if(CommonConstants.ONE_INT == settle.getIsActualPush() && b){
//推送保费更新
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setActualPremium(bigDecimal);
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
......@@ -1513,15 +1525,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettleService.updateById(settle);
}
});
}else if(settle.getIsActualPush() == CommonConstants.ONE_INT
&& (new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) == 0)){
}else{
//推送保费更新
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setActualPremium(bigDecimal);
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调EKP更新实际保费
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
detail.setActualPremium(bigDecimal);
threadPool.execute(() ->{
String s = pushEstimate(detail,CommonConstants.FOUR_INT);
if(StringUtils.isNotBlank(s)){
......@@ -1876,7 +1887,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//根据项目编码查询项目是否存在
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getDeptNo()));
try{
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
if (MapUtils.isEmpty(data)){
......@@ -1902,6 +1914,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
}catch (Exception e){
log.error(InsurancesConstants.GET_DEPT_DETAIL_ERROR+e);
param.setErrorMessage(InsurancesConstants.GET_DEPT_DETAIL_ERROR);
listResult.add(param);
continue;
}
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getDeptNo()))){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_IN_USER_DEPT_LIST);
......@@ -2240,32 +2258,40 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//根据项目编码查询项目是否存在
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
if (MapUtils.isEmpty(data)){
param.setErrorMessage(InsurancesConstants.DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
ProjectSetInfoVo projectSetInfoVo = data.get(param.getDeptNo());
if (null == projectSetInfoVo){
try{
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
if (MapUtils.isEmpty(data)){
param.setErrorMessage(InsurancesConstants.DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
//结算类型,根据项目编码获取,并冗余到明细记录中
String settleType = projectSetInfoVo.getInsuranceSettleType();
if (StringUtils.isEmpty(settleType)){
param.setErrorMessage(InsurancesConstants.PROJECT_NOT_FIND_SETTLE_TYPE);
ProjectSetInfoVo projectSetInfoVo = data.get(param.getDeptNo());
if (null == projectSetInfoVo){
param.setErrorMessage(InsurancesConstants.DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
param.setSettleType(Integer.parseInt(settleType));
//结算类型,根据项目编码获取,并冗余到明细记录中
String settleType = projectSetInfoVo.getInsuranceSettleType();
if (StringUtils.isEmpty(settleType)){
param.setErrorMessage(InsurancesConstants.PROJECT_NOT_FIND_SETTLE_TYPE);
listResult.add(param);
continue;
}else {
param.setSettleType(Integer.parseInt(settleType));
}
}
}
}
}catch (Exception e){
log.error("查询项目信息出错:"+e);
param.setErrorMessage(InsurancesConstants.GET_DEPT_DETAIL_ERROR);
listResult.add(param);
continue;
}
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getDeptNo()))){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_IN_USER_DEPT_LIST);
......@@ -2614,33 +2640,39 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue;
}
//根据项目编码查询项目是否存在
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getReplaceDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
if (MapUtils.isEmpty(data)){
param.setErrorMessage(InsurancesConstants.REPLACE_DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
ProjectSetInfoVo projectSetInfoVo = data.get(param.getReplaceDeptNo());
if (null == projectSetInfoVo){
try{
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getReplaceDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
if (MapUtils.isEmpty(data)){
param.setErrorMessage(InsurancesConstants.REPLACE_DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
//结算类型,根据项目编码获取,并冗余到明细记录中
String settleType = projectSetInfoVo.getInsuranceSettleType();
if (StringUtils.isEmpty(settleType)){
param.setErrorMessage(InsurancesConstants.REPLACE_PROJECT_NOT_FIND_SETTLE_TYPE);
ProjectSetInfoVo projectSetInfoVo = data.get(param.getReplaceDeptNo());
if (null == projectSetInfoVo){
param.setErrorMessage(InsurancesConstants.REPLACE_DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
param.setSettleType(Integer.parseInt(settleType));
//结算类型,根据项目编码获取,并冗余到明细记录中
String settleType = projectSetInfoVo.getInsuranceSettleType();
if (StringUtils.isEmpty(settleType)){
param.setErrorMessage(InsurancesConstants.REPLACE_PROJECT_NOT_FIND_SETTLE_TYPE);
listResult.add(param);
continue;
}else {
param.setSettleType(Integer.parseInt(settleType));
}
}
}
}
}catch (Exception e){
log.error("查询项目信息出错:"+e);
param.setErrorMessage(InsurancesConstants.GET_DEPT_DETAIL_ERROR);
listResult.add(param);
continue;
}
//原数据查重校验:姓名 + 身份证号 + 项目编码 + 保险公司 + 险种名称 + 保单开始时间 + 保单结束时间
TInsuranceDetail detail = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, param.getEmpName())
......@@ -3082,6 +3114,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
private void setProjectNameByDeptNo(List<InsuranceListVO> insuranceList) {
if (CollectionUtils.isNotEmpty(insuranceList)){
List<String> collect = insuranceList.stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
try{
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
......@@ -3092,6 +3125,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
}catch (Exception e){
for (InsuranceListVO record : insuranceList) {
record.setProjectName(CommonConstants.EMPTY_STRING);
}
}
}
}
......@@ -3105,7 +3143,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param displayFlag 是否显示 0不显示/1显示
* @return void
*/
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public void addOperate(List<TInsuranceDetail> detailList,YifuUser user,String operateDesc,String remark,Integer displayFlag){
if (CollectionUtils.isNotEmpty(detailList)){
List<TInsuranceOperate> operateList = new ArrayList<>();
......@@ -3229,7 +3266,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
Map<String, List<InsuranceRefundCheck>> refundMap = checkInsuranceRefundList(insuranceRefundCheckList,user);
List<InsuranceRefundCheck> successList = refundMap.get("successList");
List<InsuranceRefundCheck> successList = refundMap.get(InsurancesConstants.SUCCESS_LIST);
List<TInsuranceOperate> operateList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(successList)){
for (InsuranceRefundCheck refund : successList){
......@@ -3267,7 +3304,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
tInsuranceOperateService.saveBatch(operateList);
List<InsuranceRefundCheck> errorList = refundMap.get("errorList");
List<InsuranceRefundCheck> errorList = refundMap.get(InsurancesConstants.ERROR_LIST);
return R.ok(errorList,"校验完成");
}
......@@ -3304,6 +3341,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
}
return insuranceList;
}
......@@ -3324,7 +3362,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.ok(insuredList);
}
param.setDeptNoList(deptList);
param.setDeptNoList(deptList);
insuredList = this.baseMapper.getInsuredList(param);
if (CollectionUtils.isNotEmpty(insuredList)){
if(insuredList.size() > CommonConstants.EXPORT_TWENTY_THOUSAND){
......@@ -3332,18 +3369,24 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//根据项目编码获取项目名称
List<String> collect = insuredList.stream().map(InsuredListVo::getDeptNo).distinct().collect(Collectors.toList());
try{
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (InsuredListVo record : insuredList) {
//购买月数
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(),record.getPolicyEnd().toString()));
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject){
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(), record.getPolicyEnd().toString()));
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject) {
record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
}
}
}
}catch (Exception e){
for (InsuredListVo record : insuredList) {
record.setProjectName(CommonConstants.EMPTY_STRING);
}
}
}
return R.ok(insuredList);
}
......@@ -3368,18 +3411,23 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (CollectionUtils.isNotEmpty(insuranceRefundPageList.getRecords())){
//根据项目编码获取项目名称
List<String> collect = insuranceRefundPageList.getRecords().stream().map(InsuranceRefundListVo::getDeptNo).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (InsuranceRefundListVo record : insuranceRefundPageList.getRecords()) {
//购买月数
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(),record.getPolicyEnd().toString()));
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject){
record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
try {
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (InsuranceRefundListVo record : insuranceRefundPageList.getRecords()) {
//购买月数
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(),record.getPolicyEnd().toString()));
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject){
record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
}
}
}
}catch (Exception e){
log.error(InsurancesConstants.GET_DEPT_DETAIL_ERROR+e);
}
}
return R.ok(insuranceRefundPageList);
}
......@@ -3636,8 +3684,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
Map<String, List<InsuranceHandleImportParam>> map = insuranceChangeCheck(insuranceRefundImportList, user,true);
List<InsuranceHandleImportParam> successList = map.get("successList");
List<InsuranceHandleImportParam> errorList = map.get("errorList");
List<InsuranceHandleImportParam> successList = map.get(InsurancesConstants.SUCCESS_LIST);
List<InsuranceHandleImportParam> errorList = map.get(InsurancesConstants.ERROR_LIST);
//减员退回
List<TInsuranceOperate> operateList =new ArrayList<>(16);
if (CollectionUtils.isNotEmpty(successList)) {
......@@ -3701,8 +3749,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
Map<String, List<SettleMonthChangeCheckParam>> map = settleMonthChangeCheck(settleMonthCheckList, user);
List<SettleMonthChangeCheckParam> successList = map.get("successList");
List<SettleMonthChangeCheckParam> errorList = map.get("errorList");
List<SettleMonthChangeCheckParam> successList = map.get(InsurancesConstants.SUCCESS_LIST);
List<SettleMonthChangeCheckParam> errorList = map.get(InsurancesConstants.ERROR_LIST);
List<SettleMonthChangeCheckParam> ekpList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(successList)){
for (SettleMonthChangeCheckParam settleMonthChangeCheckParam : successList) {
......@@ -3788,7 +3836,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
Map<String, List<DeptChangeCheckParam>> stringListMap = deptChangeCheck(deptChangeCheckList,user);
List<DeptChangeCheckParam> successList = stringListMap.get("successList");
List<DeptChangeCheckParam> successList = stringListMap.get(InsurancesConstants.SUCCESS_LIST);
List<TInsuranceOperate> operateList = new ArrayList<>(16);
if(CollectionUtils.isNotEmpty(successList)){
threadPool.execute(() -> {
......@@ -4507,7 +4555,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
});
}
tInsuranceOperateService.saveBatch(operateList);
List<DeptChangeCheckParam> errorList = stringListMap.get("errorList");
List<DeptChangeCheckParam> errorList = stringListMap.get(InsurancesConstants.ERROR_LIST);
return R.ok(errorList,InsurancesConstants.IMPORT_SUCCESS);
}
......@@ -4597,7 +4645,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
public R updateRefundMoney(List<RefundMoneyParam> paramList) {
YifuUser user = SecurityUtils.getUser();
Map<String, List<RefundMoneyParam>> map = refundMoneyCheck(paramList);
List<RefundMoneyParam> successList = map.get("successList");
List<RefundMoneyParam> successList = map.get(InsurancesConstants.SUCCESS_LIST);
if (CollectionUtils.isNotEmpty(successList)){
for (RefundMoneyParam param : successList) {
TInsuranceRefund insuranceRefund = new TInsuranceRefund();
......@@ -4610,7 +4658,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceRefundService.updateRefundMoney(insuranceRefund);
}
}
return R.ok(map.get("errorList"));
return R.ok(map.get(InsurancesConstants.ERROR_LIST));
}
/**
......@@ -4792,8 +4840,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
successList.add(param);
}
}
map.put("successList",successList);
map.put("errorList",errorList);
map.put(InsurancesConstants.SUCCESS_LIST,successList);
map.put(InsurancesConstants.ERROR_LIST,errorList);
return map;
};
/**
......@@ -4856,8 +4904,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setId(tInsuranceRefundDetail.getInsDetailId());
successList.add(param);
}
map.put("errorList",errorList);
map.put("successList",successList);
map.put(InsurancesConstants.ERROR_LIST,errorList);
map.put(InsurancesConstants.SUCCESS_LIST,successList);
return map;
}
/**
......@@ -5067,8 +5115,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setId(insuranceDetail.getId());
successList.add(param);
}
map.put("errorList",errorList);
map.put("successList",successList);
map.put(InsurancesConstants.ERROR_LIST,errorList);
map.put(InsurancesConstants.SUCCESS_LIST,successList);
return map;
}
......@@ -5289,8 +5337,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setId(detailId);
successList.add(param);
}
map.put("successList",successList);
map.put("errorList",errorList);
map.put(InsurancesConstants.SUCCESS_LIST,successList);
map.put(InsurancesConstants.ERROR_LIST,errorList);
return map;
}
......@@ -5596,8 +5644,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setId(insuranceDetail.getId());
successList.add(param);
}
map.put("errorList",errorList);
map.put("successList",successList);
map.put(InsurancesConstants.ERROR_LIST,errorList);
map.put(InsurancesConstants.SUCCESS_LIST,successList);
return map;
}
......@@ -5710,7 +5758,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<InsuranceListByIdCardVo> records = insuranceListByIdCard.getRecords();
if (CollectionUtils.isNotEmpty(records)){
for (InsuranceListByIdCardVo record : records) {
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(),record.getPolicyEnd().toString()));
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(), record.getPolicyEnd().toString()));
}
insuranceListByIdCard.setRecords(records);
}
......@@ -5719,6 +5767,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceAddParam>> addOrderInsurance(InsuranceListOrderParam paramList) {
String orderNo = paramList.getOrderNo();
if (StringUtils.isBlank(orderNo)) {
......@@ -5728,6 +5777,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceBatchParam>> batchOrderInsurance(InsuranceOrderBatchParam paramList) {
String orderNo = paramList.getOrderNo();
if (StringUtils.isBlank(orderNo)) {
......@@ -5737,6 +5787,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceReplaceParam>> replaceOrderInsurance(InsuranceOrderReplaceParam paramList) {
String orderNo = paramList.getOrderNo();
if (StringUtils.isBlank(orderNo)) {
......
......@@ -63,15 +63,14 @@ public class TInsuranceEnclosureServiceImpl extends ServiceImpl<TInsuranceEnclos
if (file.getSize() > (CommonConstants.FIFTY_INT*CommonConstants.BYTE*CommonConstants.BYTE)){
return R.failed(InsurancesConstants.INSURANCE_ENCLOSURE_SIZE_ERROR);
}
String enclosureName = Objects.requireNonNull(file.getOriginalFilename()).substring(0,file.getOriginalFilename().lastIndexOf("."));
String fileName = System.currentTimeMillis() + "_" + file.getOriginalFilename();
String fileName = System.currentTimeMillis() + CommonConstants.DOWN_LINE_STRING + file.getOriginalFilename();
//filePath不传默认存储空间的根目录
//支持的附件格式
String key = "";
if (!Common.isNotNull(filePath)) {
key = fileName;
} else {
key = filePath + "/" + fileName;
key = filePath + CommonConstants.SLASH_SPLIT_LINE_STRING + fileName;
}
boolean flag = ossUtil.uploadFileByStream(file.getInputStream(), key, null);
if (flag) {
......@@ -92,7 +91,7 @@ public class TInsuranceEnclosureServiceImpl extends ServiceImpl<TInsuranceEnclos
try {
this.save(insuranceEnclosure);
} catch (Exception e) {
log.error("OSS文件上传接口异常:" + e.getMessage());
log.error(InsurancesConstants.OSS_ERROR + e.getMessage());
ossUtil.deleteObject(null, key);
return R.failed("failed:" + e.getMessage());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment