Commit 04526494 authored by huyuchen's avatar huyuchen

fdd 代码修改

parent 8d9ba881
...@@ -248,10 +248,10 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -248,10 +248,10 @@ public class TEmployeeInfo extends BaseEntity {
private String remark; private String remark;
/** /**
* 人员档案来源(字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬) * 人员档案来源(字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬、6电子签
* 1=社保、公积金派单,2=人员发薪,3=商险派单,4=档案新建,5=批量导入 * 1=社保、公积金派单,2=人员发薪,3=商险派单,4=档案新建,5=批量导入,6=电子签
*/ */
@Schema(description = "人员档案来源(字典:1=社保、公积金派单,2=人员发薪,3=商险派单,4=档案新建,5=批量导入)") @Schema(description = "人员档案来源(字典:1=社保、公积金派单,2=人员发薪,3=商险派单,4=档案新建,5=批量导入、6电子签)")
private String fileSource; private String fileSource;
/** /**
......
...@@ -232,9 +232,9 @@ public class TEmployeeProject extends BaseEntity { ...@@ -232,9 +232,9 @@ public class TEmployeeProject extends BaseEntity {
private String tryPeriod; private String tryPeriod;
/** /**
* 项目档案来源(字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬) * 项目档案来源(字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬、6批量导入、7电子签
*/ */
@Schema(description ="项目档案来源(字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬)") @Schema(description ="项目档案来源(字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬、6批量导入、7电子签)")
private String projectSource; private String projectSource;
/** /**
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
<result property="empIdcard" column="EMP_IDCARD"/> <result property="empIdcard" column="EMP_IDCARD"/>
<result property="contractName" column="CONTRACT_NAME"/> <result property="contractName" column="CONTRACT_NAME"/>
<result property="contractType" column="CONTRACT_TYPE"/> <result property="contractType" column="CONTRACT_TYPE"/>
<result property="contractStart" column="CONTRACT_START"/>
<result property="contractEnd" column="CONTRACT_END"/> <result property="contractEnd" column="CONTRACT_END"/>
<result property="subjectDepart" column="SUBJECT_DEPART"/> <result property="subjectDepart" column="SUBJECT_DEPART"/>
<result property="subjectUnit" column="SUBJECT_UNIT"/> <result property="subjectUnit" column="SUBJECT_UNIT"/>
...@@ -65,8 +64,8 @@ ...@@ -65,8 +64,8 @@
<result property="warnEmailUserId" column="WARN_EMAIL_USER_ID"/> <result property="warnEmailUserId" column="WARN_EMAIL_USER_ID"/>
<result property="fddFlag" column="FDD_FLAG"/> <result property="fddFlag" column="FDD_FLAG"/>
<result property="isSign" column="IS_SIGN"/> <result property="isSign" column="IS_SIGN"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createName" column="CREATE_NAME"/> <result property="createName" column="CREATE_NAME"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createTime" column="CREATE_TIME"/> <result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/> <result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/> <result property="updateTime" column="UPDATE_TIME"/>
......
...@@ -667,8 +667,7 @@ ...@@ -667,8 +667,7 @@
FROM FROM
t_employee_project t_employee_project
WHERE WHERE
DELETE_FLAG = '0' id not like '%abc'
and id not like '%abc'
and and
EMP_NO LIKE CONCAT( EMP_NO LIKE CONCAT(
( (
......
...@@ -53,6 +53,11 @@ ...@@ -53,6 +53,11 @@
<artifactId>yifu-archives-api</artifactId> <artifactId>yifu-archives-api</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
</dependency> </dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-insurances-api</artifactId>
<version>1.0.0</version>
</dependency>
<!--必备:swagger--> <!--必备:swagger-->
<dependency> <dependency>
<groupId>com.yifu.cloud.plus.v1</groupId> <groupId>com.yifu.cloud.plus.v1</groupId>
......
...@@ -20,8 +20,14 @@ package com.yifu.cloud.plus.v1.yifu.social.controller; ...@@ -20,8 +20,14 @@ package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.constants.PreDispatchConstants;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPreDispatchInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TPreDispatchInfo;
import com.yifu.cloud.plus.v1.yifu.social.service.TPreDispatchInfoService; import com.yifu.cloud.plus.v1.yifu.social.service.TPreDispatchInfoService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
...@@ -32,6 +38,8 @@ import lombok.RequiredArgsConstructor; ...@@ -32,6 +38,8 @@ import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -185,4 +193,48 @@ public class TPreDispatchInfoController { ...@@ -185,4 +193,48 @@ public class TPreDispatchInfoController {
public R<Boolean> dispatchById(@RequestParam(value = "id",required = true)String id) { public R<Boolean> dispatchById(@RequestParam(value = "id",required = true)String id) {
return tPreDispatchInfoService.dispatchById(id); return tPreDispatchInfoService.dispatchById(id);
} }
/**
* 预派单批量新增派增
*
* @param jsonString
* @param houseId 社保户ID
* @param departId 结算主体ID
* @return
* @Author fxj
* @Date 2019-09-29
**/
@Operation(summary = "预派单批量新增派增", description = "预派单批量新增派增")
@SysLog("预派单批量新增派增")
@PostMapping("/analysisJsonStringImportAdd")
@PreAuthorize("@pms.hasPermission('social:tpredispatchinfo_importAddList')")
public R analysisJsonStringImportAdd(@RequestBody String jsonString,
@RequestParam(value = "houseId",required = true) String houseId,
@RequestParam(value = "departId",required = true) String departId) {
YifuUser user = SecurityUtils.getUser();
if (null == user || null == user.getId()) {
return R.failed(CommonConstants.USER_FAIL);
}
ExcelUtil<TPreDispatchInfo> util1 = null;
try {
jsonString = URLDecoder.decode(jsonString, CommonConstants.UTF8).replace("=", "");
util1 = new ExcelUtil<>(TPreDispatchInfo.class);
util1.getJsonStringToList(jsonString, null);
List<TPreDispatchInfo> listInfo = util1.getEntityList();
//用于返回错误信息
List<ErrorMessage> errorInfo = new ArrayList<>();
if (null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty()) {
return R.failed(util1.getErrorInfo(),PreDispatchConstants.DATA_CHECK);
} else {
if (null != listInfo && !listInfo.isEmpty()) {
errorInfo = tPreDispatchInfoService.batchSavePreDisPatchAdd(listInfo, user,houseId,departId);
} else {
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
return R.ok(errorInfo,"");
}
} catch (Exception e) {
return R.failed(PreDispatchConstants.DATA_IMPORT_ANALYSIS_ERROR);
}
}
} }
...@@ -20,9 +20,13 @@ package com.yifu.cloud.plus.v1.yifu.social.service; ...@@ -20,9 +20,13 @@ package com.yifu.cloud.plus.v1.yifu.social.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPreDispatchInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TPreDispatchInfo;
import java.util.List;
/** /**
* 预派单记录 * 预派单记录
* *
...@@ -83,4 +87,16 @@ public interface TPreDispatchInfoService extends IService<TPreDispatchInfo> { ...@@ -83,4 +87,16 @@ public interface TPreDispatchInfoService extends IService<TPreDispatchInfo> {
* @return * @return
**/ **/
R update(TPreDispatchInfo tPreDispatchInfo); R update(TPreDispatchInfo tPreDispatchInfo);
/**
* 预派单批量新增派增
* @Author huyc
* @Date 2022-07-18
* @param listInfo
* @param user
* @param houseId
* @param departId
* @return
**/
List<ErrorMessage> batchSavePreDisPatchAdd(List<TPreDispatchInfo> listInfo, YifuUser user, String houseId, String departId);
} }
...@@ -18,18 +18,24 @@ package com.yifu.cloud.plus.v1.yifu.social.service.impl; ...@@ -18,18 +18,24 @@ package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.*; import com.yifu.cloud.plus.v1.yifu.common.core.constant.*;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.social.constants.PreDispatchConstants; import com.yifu.cloud.plus.v1.yifu.social.constants.PreDispatchConstants;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TDispatchDayConf;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPreDispatchInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TPreDispatchInfo;
import com.yifu.cloud.plus.v1.yifu.social.mapper.SysBaseSetInfoMapper; import com.yifu.cloud.plus.v1.yifu.social.mapper.SysBaseSetInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TDispatchDayConfMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TPreDispatchInfoMapper; import com.yifu.cloud.plus.v1.yifu.social.mapper.TPreDispatchInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TPreDispatchInfoService; import com.yifu.cloud.plus.v1.yifu.social.service.TPreDispatchInfoService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -37,6 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -37,6 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -54,6 +61,12 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -54,6 +61,12 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
@Autowired @Autowired
private SysBaseSetInfoMapper sysBaseSetInfoMapper; private SysBaseSetInfoMapper sysBaseSetInfoMapper;
@Autowired
private TDispatchDayConfMapper dispatchDayConfMapper;
@Autowired
private ArchivesDaprUtil archivesDaprUtil;
/** /**
* 预派单记录简单分页查询 * 预派单记录简单分页查询
* *
...@@ -299,16 +312,16 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -299,16 +312,16 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
if (Common.isEmpty(id)) { if (Common.isEmpty(id)) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR); return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
} }
// R<List<TSettleDomainSelectVo>> settleDomainR = null; R<List<TSettleDomainSelectVo>> settleDomainR = null;
//结算主体名称map key:结算主体id value:结算主体名称 //结算主体名称map key:结算主体id value:结算主体名称
Map<String, String> settleDomainNameMap = new HashMap<>(); Map<String, String> settleDomainNameMap = new HashMap<>();
//客户名称map key:客户id value:客户名称 //客户名称map key:客户id value:客户名称
Map<String, String> customerNameMap = new HashMap<>(); Map<String, String> customerNameMap = new HashMap<>();
//结算主体客户关系map key:结算主体id value:客户id //结算主体客户关系map key:结算主体id value:客户id
Map<String, String> settleIdAndCustomerIdMap = new HashMap<>(); Map<String, String> settleIdAndCustomerIdMap = new HashMap<>();
// settleDomainR = remoteTSettleDomainService.selectAllSettleDomainSelectVos(SecurityConstants.FROM_IN); settleDomainR = archivesDaprUtil.selectAllSettleDomainSelectVos();
//map数据封装 //map数据封装
// initSettleDomainMaps(settleDomainR, settleDomainNameMap, customerNameMap, settleIdAndCustomerIdMap); initSettleDomainMaps(settleDomainR, settleDomainNameMap, customerNameMap, settleIdAndCustomerIdMap);
return R.ok(); return R.ok();
} }
...@@ -359,10 +372,10 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -359,10 +372,10 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
if (Common.isEmpty(tPreDispatchInfo.getTelOne())) { if (Common.isEmpty(tPreDispatchInfo.getTelOne())) {
return R.failed(PreDispatchConstants.TEL_NOT_EMPTY); return R.failed(PreDispatchConstants.TEL_NOT_EMPTY);
} }
//TODO
// if (ValidityUtil.checkInvalidEmpPhone(tPreDispatchInfo.getTelOne())){ if (ValidityUtil.checkInvalidEmpPhone(tPreDispatchInfo.getTelOne())){
// return R.failed(PreDispatchConstants.TEL_INVALID); return R.failed(PreDispatchConstants.TEL_INVALID);
// } }
} }
if (CommonConstants.ONE_STRING.equals(tPreDispatchInfo.getType())) { if (CommonConstants.ONE_STRING.equals(tPreDispatchInfo.getType())) {
initLeaveReason(tPreDispatchInfo); initLeaveReason(tPreDispatchInfo);
...@@ -379,6 +392,69 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -379,6 +392,69 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
return R.ok(); return R.ok();
} }
@Override
public List<ErrorMessage> batchSavePreDisPatchAdd(List<TPreDispatchInfo> listInfo, YifuUser user, String houseId, String departId) {
List<ErrorMessage> errorList = new ArrayList<>();
R<TSettleDomainSelectVo> domainR = archivesDaprUtil.getSettleDomainSelectVoById(departId);
TSettleDomainSelectVo selectVo = domainR.getData();
// 获取区域数据MAP
HashMap<String, SysArea> areaHashMap = new HashMap<>(CommonConstants.SIXTEEN_INT);
HashMap<String,SysArea> areaIdMap = new HashMap<>(CommonConstants.SIXTEEN_INT);
if (dataCheck(listInfo, errorList,areaHashMap,areaIdMap)) {
return errorList;
}
if (dataCheckDepart(errorList,domainR)) {
return errorList;
}
// 获取基数配置信息
HashMap<String, SysBaseSetInfo> baseSocialSetMap = new HashMap<>();
HashMap<String, SysBaseSetInfo> baseFundSetMap = new HashMap<>();
HashMap<String, TPreDispatchInfo> baseSocialTimeMap = new HashMap<>();
HashMap<String, TPreDispatchInfo> baseFundTimeMap = new HashMap<>();
initSocialAndFundBaseSet(listInfo, baseSocialSetMap, baseFundSetMap, baseSocialTimeMap, baseFundTimeMap);
// 查询当月对应身份证是否已经派增或派减了 后面做判重处理
HashMap<String,TPreDispatchInfo> existsMap = new HashMap<>();
initExistsMapByIdCards(listInfo,existsMap,CommonConstants.ZERO_STRING);
// 获取所有地市的最迟派单日限制
HashMap<String,Integer> dayConfMap = new HashMap<>();
initDayConfMap(dayConfMap);
int i=1;
for (TPreDispatchInfo info:listInfo){
i++;
// 1.验重
if (checkAddRepeat(errorList, existsMap, i, info)){
continue;
}
// 基础封装 其他
initBaseInfo(houseId,selectVo, info);
// 2.先校验已有数据
checkBatchSave(info,CommonConstants.ZERO_STRING);
// 3.封装 社保缴纳地 公积金缴纳地
initBatchAreaAdd(areaHashMap, areaIdMap, info);
// 4.验证缴纳地和补缴日期是否符合政策
if (Common.isEmpty(info.getExceptionContent())){
checkStartTime(baseSocialSetMap, baseFundSetMap, null, info);
}
// 5.封装地市派单限制日
initDayLimit(dayConfMap, info);
// 6.保存 有异常也保存 要标识
info.setCreateTime(LocalDateTime.now());
info.setUserDeptName(selectVo.getDepartName());
info.setPreStatus(CommonConstants.ZERO_STRING);
// 为验重添加到MAP
existsMap.put(info.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+info.getPayAddress(),info);
if (Common.isEmpty(info.getExceptionContent())){
errorList.add(new ErrorMessage(i, "保存成功!",CommonConstants.GREEN));
}else {
info.setPreStatus(CommonConstants.ONE_STRING);
errorList.add(new ErrorMessage(i, "保存成功!" +
info.getExceptionContent(),CommonConstants.RED));
}
baseMapper.insert(info);
}
return null;
}
private static boolean isaBoolean(LocalDateTime temp, LocalDateTime now) { private static boolean isaBoolean(LocalDateTime temp, LocalDateTime now) {
return temp.getYear() == now.getYear() && temp.getMonthValue() < now.getMonthValue(); return temp.getYear() == now.getYear() && temp.getMonthValue() < now.getMonthValue();
} }
...@@ -424,6 +500,41 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -424,6 +500,41 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
} }
} }
/**
* 初始化基础数据 如 各种状态 合同数据等
* @Author fxj
* @Date 2020-12-31
* @param houseId
* @param selectVo
* @param info
* @return
**/
private void initBaseInfo(String houseId, TSettleDomainSelectVo selectVo, TPreDispatchInfo info) {
info.setType(CommonConstants.ZERO_STRING);
info.setDataSubStatus(CommonConstants.ONE_STRING);
info.setStatus(CommonConstants.ZERO_STRING);
info.setPreStatus(CommonConstants.ZERO_STRING);
// 默认社保代理 4
info.setEmpTypeAdd(CommonConstants.FOUR_STRING);
info.setPositionAdd(PreDispatchConstants.POSITION);
info.setDepartIdAdd(selectVo.getId());
info.setDepartNameAdd(selectVo.getDepartName());
info.setUnitIdAdd(selectVo.getCustomerId());
info.setUnitNameAdd(selectVo.getCustomerName());
// 默认合同名称为代理社保 合同类型为固定期限1
info.setContractNameAdd(PreDispatchConstants.CONTRACT_NAME);
info.setContractTypeAdd(CommonConstants.ONE_STRING);
info.setContractStartAdd(info.getContractStart());
// 默认为开始时间后的两年时间
info.setContractEndAdd(info.getContractEnd());
// 默认合同期限2年
info.setContractTermAdd(Integer.toString(Common.getYearOfTime(info.getContractStart(),info.getContractEnd())));
// 默认工时制 综合工时制2
info.setWorkingHoursAdd(CommonConstants.TWO_STRING);
info.setSocialHouseAdd(houseId);
info.setFundHouseAdd(houseId);
}
/** /**
* 校验修改派增派减 * 校验修改派增派减
* *
...@@ -484,10 +595,9 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -484,10 +595,9 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
if (Common.isEmpty(tPreDispatchInfo.getTelOne())) { if (Common.isEmpty(tPreDispatchInfo.getTelOne())) {
return PreDispatchConstants.TEL_NOT_EMPTY; return PreDispatchConstants.TEL_NOT_EMPTY;
} }
//TODO if (ValidityUtil.checkInvalidEmpPhone(tPreDispatchInfo.getTelOne())){
// if (ValidityUtil.checkInvalidEmpPhone(tPreDispatchInfo.getTelOne())){ return PreDispatchConstants.TEL_INVALID;
// return PreDispatchConstants.TEL_INVALID; }
// }
if (Common.isEmpty(tPreDispatchInfo.getPensionAddress()) && if (Common.isEmpty(tPreDispatchInfo.getPensionAddress()) &&
Common.isEmpty(tPreDispatchInfo.getFundAddress())) { Common.isEmpty(tPreDispatchInfo.getFundAddress())) {
return PreDispatchConstants.NO_SOCIAL_FUND_ADDRESS_ADD; return PreDispatchConstants.NO_SOCIAL_FUND_ADDRESS_ADD;
...@@ -836,4 +946,388 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -836,4 +946,388 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
return false; return false;
} }
/**
* 验证数据完整性
* @Author huyc
* @Date 2022-07-18
* @param listInfo
* @param errorList
* @return
**/
private boolean dataCheck(List<TPreDispatchInfo> listInfo, List<ErrorMessage> errorList,
Map<String, SysArea> areaHashMap,
Map<String,SysArea> areaIdMap) {
return dataCheckSub(listInfo, errorList, areaHashMap, areaIdMap);
}
/**
* 初始化区域 及验证 待处理数据是否空
* @Author huyc
* @Date 2022-07-18
* @param listInfo
* @param errorList
* @param areaHashMap
* @param areaIdMap
* @return
**/
private boolean dataCheckSub(List<TPreDispatchInfo> listInfo, List<ErrorMessage> errorList,
Map<String, SysArea> areaHashMap, Map<String, SysArea> areaIdMap) {
if (null == listInfo || listInfo.isEmpty()){
errorList.add(new ErrorMessage(-1, CommonConstants.DATA_CAN_NOT_EMPTY));
return true;
}
R<List<SysArea>> areaListR = UpmsDaprUtils.getAreaListR();
if (null == areaListR || areaListR.getCode() != CommonConstants.SUCCESS){
errorList.add(new ErrorMessage(-1, PreDispatchConstants.GET_AREA_INFO));
return true;
}
// 封装区域MAP数据
initAreaMap(areaHashMap, areaIdMap, areaListR);
return false;
}
private boolean dataCheckDepart(List<ErrorMessage> errorList,R<TSettleDomainSelectVo> domainR) {
if (null == domainR || null == domainR.getData()){
errorList.add(new ErrorMessage(-1, "访问员工基础服务异常:"));
return true;
}
return false;
}
/**
* 派增验重
* @Author huyc
* @Date 2022-07-18
* @param errorList
* @param existsMap
* @param i
* @param info
* @return
**/
private boolean checkAddRepeat(List<ErrorMessage> errorList, HashMap<String, TPreDispatchInfo> existsMap, int i, TPreDispatchInfo info) {
TPreDispatchInfo exists;
exists = existsMap.get(info.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+info.getPayAddress());
if (null != exists){
errorList.add(new ErrorMessage(i, PreDispatchConstants.EXISTS_SAME_EMPIDCARD_ADD));
return true;
}
return false;
}
/**
* 一大波校验 有问题的标记派单
* @Author huyc
* @Date 2022-07-18
* @param info
* @param type 0 派增校验 1 派减校验
* @return
**/
private String checkBatchSave(TPreDispatchInfo info, String type) {
String res = null;
res = updateOrSaveBaseCheck(info);
// 姓名 身份证 缴费地 必填验证 有问题标记异常
if (res != null) {
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent(res);
return res;
}
if (CommonConstants.ZERO_STRING.equals(type)){
// 派增验证
res = checkAddPreDispatch(info);
if (res != null) {
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent(res);
return res;
}
}
if (CommonConstants.ONE_STRING.equals(type)){
// 派减验证
res = checkReducePreDispatch(info);
if (res != null) {
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent(res);
return res;
}
}
return null;
}
private void initBatchAreaAdd(HashMap<String, SysArea> areaHashMap, HashMap<String, SysArea> areaIdMap, TPreDispatchInfo info) {
R<Boolean> x;
x = handleSocialAreaAdd(areaHashMap,areaIdMap,info,info.getPensionAddress());
if (null != x){
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent(x.getMsg());
return;
}
x = handleFundAreaAdd(areaHashMap,areaIdMap,info, info.getFundAddress());
if (null != x){
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent(x.getMsg());
}
}
/**
* 批量新增 区域数据封装
* @Author huyc
* @Date 2022-07-18
* @param areaMap
* @param areaIdMap
* @param entity
* @return
**/
private R<Boolean> handleSocialAreaAdd(Map<String, SysArea> areaMap,
Map<String,SysArea> areaIdMap, TPreDispatchInfo entity,String address) {
// 为空由更新语句清空缴纳地 不为空且有变化的要重新获取数据
if (Common.isNotNull(address)){
return initSocialArea(areaMap, areaIdMap, entity,address.trim());
}
return null;
}
/**
* 处理公积金的地市数据
* @Author huyc
* @Date 2022-07-18
* @param areaMap
* @param areaIdMap
* @param entity
* @return
**/
private R<Boolean> handleFundAreaAdd(Map<String, SysArea> areaMap,
Map<String, SysArea> areaIdMap, TPreDispatchInfo entity,String address) {
// 为空由更新语句清空缴纳地 不为空且有变化的要重新获取数据
if (Common.isNotNull(address)){
return initFundArea(areaMap, areaIdMap, entity,address.trim());
}
return null;
}
/**
* 初始化地市派单日
* @Author huyc
* @Date 2022-07-18
* @param dayConfMap
* @param info
* @return
**/
private void initDayLimit(HashMap<String, Integer> dayConfMap, TPreDispatchInfo info) {
if (Common.isNotNull(info.getSocialProvince())){
info.setDayLimit(dayConfMap.get(Common.isBlankToNullString(info.getSocialProvince())+
CommonConstants.DOWN_LINE_STRING+ Common.isBlankToNullString(info.getSocialCity())+
CommonConstants.DOWN_LINE_STRING+ Common.isBlankToNullString(info.getSocialTown())));
}else if (Common.isNotNull(info.getFundProvince())){
info.setDayLimit(dayConfMap.get(Common.isBlankToNullString(info.getFundProvince())+
CommonConstants.DOWN_LINE_STRING+ Common.isBlankToNullString(info.getFundCity())+
CommonConstants.DOWN_LINE_STRING+ Common.isBlankToNullString(info.getFundTown())));
}
}
/**
* 检查缴纳地对应的补缴时间是否合法
* @Author huyc
* @Date 2022-07-18
* @param baseSocialSetMap
* @param baseFundSetMap
* @param temp
* @param info
* @return
**/
private void checkStartTime(Map<String, SysBaseSetInfo> baseSocialSetMap,
Map<String, SysBaseSetInfo> baseFundSetMap,
TPreDispatchInfo temp, TPreDispatchInfo info) {
if (CommonConstants.ZERO_STRING.equals(info.getType())){
// 社保地址或缴纳时间变更 要重新校验
checkSocialStartTime(baseSocialSetMap, temp, info);
// 公积金缴纳地或缴纳时间变更 要重新校验
checkFundStartTime(baseFundSetMap, temp, info);
}
}
/**
* 校验社保起缴时间
* @Author huyc
* @Date 2022-07-18
* @param baseSocialSetMap
* @param temp
* @param info
*/
private void checkSocialStartTime(Map<String, SysBaseSetInfo> baseSocialSetMap, TPreDispatchInfo temp, TPreDispatchInfo info) {
boolean flag;
LocalDateTime dateTime;
SysBaseSetInfo socialBaseSetInfo;
String str;
flag = Common.isNotNull(info.getPensionAddress()) &&
Common.isNotNull(info.getPensionStart()) &&
Common.isNotNull(baseSocialSetMap);
if (null != temp){
flag = flag && (!info.getPensionAddress().equals(temp.getPensionAddress()) ||
!info.getPensionStart().equals(temp.getPensionStart()));
}
if (flag){
dateTime = LocalDateTimeUtils.dateOfYearAndMonth(info.getPensionStart(),LocalDateTimeUtils.DATE_SHORT_PATTERN);
if (null != dateTime){
socialBaseSetInfo = baseSocialSetMap.get(LocalDateTimeUtils.formatTime(dateTime, ValidityConstants.DATEFORMAT3_PATTERN)
+ CommonConstants.DOWN_LINE_STRING + info.getSocialHouseAdd()
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getSocialProvince())
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getSocialCity())
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getSocialTown()));
str = checkSocialStartDate(info,socialBaseSetInfo);
if (null != str) {
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent(str);
}
}
}
}
/**
* 公积金缴纳地或缴纳时间变更要重新校验
* @Author huyc
* @Date 2022-07-18
* @param baseFundSetMap
* @param temp
* @param info
* @return
**/
private void checkFundStartTime(Map<String, SysBaseSetInfo> baseFundSetMap, TPreDispatchInfo temp, TPreDispatchInfo info) {
boolean flag;
LocalDateTime dateTime;
SysBaseSetInfo fundBaseSetIfno;
String str;
flag = Common.isNotNull(info.getFundStart()) &&
Common.isNotNull(info.getFundAddress()) &&
Common.isNotNull(baseFundSetMap);
if (null != temp){
flag = flag && (!info.getFundAddress().equals(temp.getFundAddress()) ||
!info.getFundStart().equals(temp.getFundStart()));
}
if (flag){
dateTime = LocalDateTimeUtils.dateOfYearAndMonth(info.getFundStart(),LocalDateTimeUtils.DATE_SHORT_PATTERN);
if (null != dateTime){
fundBaseSetIfno = baseFundSetMap.get(LocalDateTimeUtils.formatTime(dateTime, ValidityConstants.DATEFORMAT3_PATTERN)
+ CommonConstants.DOWN_LINE_STRING + info.getFundHouseAdd()
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getFundProvince())
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getFundCity())
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getFundTown()));
str = checkFundStartDate(info,fundBaseSetIfno);
if (null != str) {
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent(str);
}
}
}
}
private void initDayConfMap(HashMap<String, Integer> dayConfMap) {
List<TDispatchDayConf> dayConfList = dispatchDayConfMapper.selectList(Wrappers.<TDispatchDayConf>query().lambda());
if (Common.isNotNull(dayConfList)){
for (TDispatchDayConf conf:dayConfList){
dayConfMap.put(Common.isBlankToNullString(conf.getProvince())+
CommonConstants.DOWN_LINE_STRING+Common.isBlankToNullString(conf.getCity())+
CommonConstants.DOWN_LINE_STRING+Common.isBlankToNullString(conf.getTown()),conf.getDay());
}
}
}
/**
* 通过身份证+派单类型 确定是否唯一(创建时间为当月的)
* @Author huyc
* @Date 2022-07-18
* @param listInfo
* @param existsMap
* @param type 0 派增 1 派减
* @return
**/
private void initExistsMapByIdCards(List<TPreDispatchInfo> listInfo,
Map<String,TPreDispatchInfo> existsMap,String type) {
List<String> idcards = new ArrayList<>();
if (Common.isNotNull(listInfo)) {
for (TPreDispatchInfo info:listInfo){
idcards.add(info.getEmpIdcard());
}
}
// 初始化要更新的数据MAP
initExistsMapByIdCards(existsMap, idcards,type);
}
private void initExistsMapByIdCards(Map<String, TPreDispatchInfo> existsMap, List<String> idcards, String type) {
if (Common.isNotNull(idcards)){
List<TPreDispatchInfo> preDispatchInfoList = baseMapper.selectList(Wrappers.<TPreDispatchInfo>query()
.lambda().in(TPreDispatchInfo::getEmpIdcard,idcards)
.eq(TPreDispatchInfo::getStatus,CommonConstants.ZERO_STRING)
.ne(TPreDispatchInfo::getPreStatus,CommonConstants.TWO_STRING)
.eq(TPreDispatchInfo::getType,type)
.ge(TPreDispatchInfo::getCreateTime,LocalDateTimeUtils.firstdayOfMonth(LocalDateTime.now())));
if (Common.isNotNull(preDispatchInfoList)){
for (TPreDispatchInfo info:preDispatchInfoList){
existsMap.put(info.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+info.getPayAddress(),info);
}
}
}
}
/**
* 初始化社保公积金基数
* @Author huyc
* @Date 2022-07-18
* @param listInfo
* @param baseSocialSetMap
* @param baseFundSetMap
* @param baseSocialTimeMap
* @param baseFundTimeMap
* @return
**/
private void initSocialAndFundBaseSet(List<TPreDispatchInfo> listInfo,
Map<String, SysBaseSetInfo> baseSocialSetMap,
Map<String, SysBaseSetInfo> baseFundSetMap,
Map<String, TPreDispatchInfo> baseSocialTimeMap,
Map<String, TPreDispatchInfo> baseFundTimeMap) {
List<String> idList = new ArrayList<>();
if (Common.isNotNull(listInfo)) {
for (TPreDispatchInfo info:listInfo){
if (Common.isNotNull(info.getPensionStart())){
baseSocialTimeMap.put(info.getPensionStart(),info);
}
if (Common.isNotNull(info.getFundStart())){
baseFundTimeMap.put(info.getFundStart(),info);
}
idList.add(info.getId());
}
}
// 初始化社保和公积金配置数据
initBaseSetMap(baseSocialTimeMap,baseFundTimeMap,baseSocialSetMap,baseFundSetMap);
}
/**
* map数据封装
* @Author huyc
* @Date 2022-07-18
* @param settleDomainR
* @param settleDomainNameMap
* @param customerNameMap
* @param settleIdAndCustomerIdMap
* @return
**/
private void initSettleDomainMaps(R<List<TSettleDomainSelectVo>> settleDomainR,
Map<String, String> settleDomainNameMap,
Map<String, String> customerNameMap,
Map<String, String> settleIdAndCustomerIdMap) {
List<TSettleDomainSelectVo> settleDomainList;
if(null != settleDomainR){
settleDomainList = settleDomainR.getData();
//map数据封装
if(Common.isNotNull(settleDomainList)){
for (TSettleDomainSelectVo settleDomainSelectVo:settleDomainList){
settleDomainNameMap.put(settleDomainSelectVo.getId(),settleDomainSelectVo.getDepartName());
settleIdAndCustomerIdMap.put(settleDomainSelectVo.getId(),settleDomainSelectVo.getCustomerId());
if(!customerNameMap.containsKey(settleDomainSelectVo.getCustomerName())){
customerNameMap.put(settleDomainSelectVo.getCustomerId(),settleDomainSelectVo.getCustomerName());
}
}
}
}
}
} }
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