Commit 43354f0c authored by hongguangwu's avatar hongguangwu

MVP1.5-薪资导入优化

parent b47d3512
package com.yifu.cloud.plus.v1.check.vo;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.Map;
/**
* @Author hgw
* @Date 2023-2-9 11:18:21
*/
@Getter
@Setter
public class CheckBatchVo implements Serializable {
private Map<String, Boolean> checkMap;
}
......@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.check.entity.TCheckBankNo;
import com.yifu.cloud.plus.v1.check.service.TCheckBankNoService;
import com.yifu.cloud.plus.v1.check.vo.CheckBankNoVo;
import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
......@@ -31,6 +32,8 @@ import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 银行卡卡号 校验
......@@ -122,6 +125,20 @@ public class TCheckBankNoController {
return tCheckBankNoService.checkBankNoTwo(checkBankNo.getName(),checkBankNo.getBankNo());
}
/**
* @Description: 批量银行卡号校验
* @Author: hgw
* @Date: 2023/2/9 9:57
* @return: com.yifu.cloud.plus.v1.check.vo.CheckBankNoVo
**/
@Operation(description = "批量银行卡号校验")
@SysLog("批量银行卡号校验" )
@Inner
@PostMapping("/inner/checkBankNoBatch" )
public CheckBatchVo checkBankNoBatch(@RequestBody List<TCheckBankNo> list) {
return tCheckBankNoService.checkBankNoBatch(list);
}
/**
* @Description: 代发户调用银行卡校验--如果其他接口也要调用,加上信息
* @Author: hgw
......
......@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.check.service.TCheckMobileService;
import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -32,6 +33,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
......@@ -158,4 +160,18 @@ public class TCheckMobileController {
}
}
/**
* @Description: 批量手机号校验
* @Author: hgw
* @Date: 2023-2-9 11:23:10
* @return: com.yifu.cloud.plus.v1.check.vo.CheckBankNoVo
**/
@Operation(description = "批量手机号校验")
@SysLog("批量手机号校验" )
@Inner
@PostMapping("/inner/checkMobileBatch" )
public CheckBatchVo checkMobileBatch(@RequestBody List<String> list) {
return tCheckMobileService.checkMobileBatch(list);
}
}
......@@ -21,6 +21,9 @@ package com.yifu.cloud.plus.v1.check.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.check.entity.TCheckBankNo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 银行卡卡号 校验
......@@ -31,4 +34,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TCheckBankNoMapper extends BaseMapper<TCheckBankNo> {
List<TCheckBankNo> getListByNoList(@Param("noList") List<String> noList);
}
......@@ -20,6 +20,9 @@ package com.yifu.cloud.plus.v1.check.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 手机号码校验
......@@ -30,4 +33,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TCheckMobileMapper extends BaseMapper<TCheckMobile> {
List<TCheckMobile> getListByNoList(@Param("noList") List<String> noList);
}
......@@ -20,8 +20,11 @@ package com.yifu.cloud.plus.v1.check.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.check.entity.TCheckBankNo;
import com.yifu.cloud.plus.v1.check.vo.CheckBankNoVo;
import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.util.List;
/**
* 银行卡卡号 校验
*
......@@ -39,4 +42,14 @@ public interface TCheckBankNoService extends IService<TCheckBankNo> {
R<TCheckBankNo> checkBankNo(String name, String cardNo);
CheckBankNoVo checkBankNoTwo(String name, String cardNo);
/**
* @param list
* @Description:批量校验卡号
* @Author: hgw
* @Date: 2023/2/9 11:19
* @return: com.yifu.cloud.plus.v1.check.vo.CheckBatchVo
**/
CheckBatchVo checkBankNoBatch(List<TCheckBankNo> list);
}
......@@ -19,8 +19,10 @@ package com.yifu.cloud.plus.v1.check.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.util.List;
import java.util.Map;
/**
......@@ -34,4 +36,12 @@ public interface TCheckMobileService extends IService<TCheckMobile> {
R<Map<String,TCheckMobile>> checkMobiles(String mobiles);
TCheckMobile checkOneMobile(String mobile);
/**
* @Description: 批量手机号
* @Author: hgw
* @Date: 2023/2/9 11:24
* @return: com.yifu.cloud.plus.v1.check.vo.CheckBatchVo
**/
CheckBatchVo checkMobileBatch(List<String> list);
}
......@@ -24,6 +24,7 @@ import com.yifu.cloud.plus.v1.check.service.TCanCheckService;
import com.yifu.cloud.plus.v1.check.service.TCheckBankNoService;
import com.yifu.cloud.plus.v1.check.utils.ChecksUtil;
import com.yifu.cloud.plus.v1.check.vo.CheckBankNoVo;
import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
......@@ -32,6 +33,11 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 银行卡卡号 校验
*
......@@ -90,4 +96,57 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh
return vo;
}
}
@Override
public CheckBatchVo checkBankNoBatch(List<TCheckBankNo> list) {
CheckBatchVo vo = new CheckBatchVo();
List<String> noList = new ArrayList<>();
for (TCheckBankNo no : list) {
if (Common.isNotNull(no.getBankNo())) {
noList.add(no.getBankNo());
}
}
Map<String, TCheckBankNo> noMap = new HashMap<>();
if (!noList.isEmpty()) {
List<TCheckBankNo> checkBankNoList = baseMapper.getListByNoList(noList);
if (checkBankNoList != null && !checkBankNoList.isEmpty()) {
for (TCheckBankNo no : checkBankNoList) {
noMap.put(no.getBankNo(), no);
}
}
}
List<TCheckBankNo> noCurlist = new ArrayList<>();
TCheckBankNo cur;
Map<String, Boolean> bankMap = new HashMap<>();
for (TCheckBankNo check : list) {
cur = noMap.get(check.getBankNo());
if (cur != null && cur.getName().equals(check.getName())) {
bankMap.put(cur.getBankNo(), CommonConstants.ZERO_ONE.equals(cur.getResult()));
} else {
noCurlist.add(check);
}
}
List<TCheckBankNo> saveList = new ArrayList<>();
if (!noCurlist.isEmpty()) {
synchronized (this) {
TCheckBankNo newNo;
R<TCheckBankNo> resR;
boolean canCheck = canCheckService.getCanCheck();
for (TCheckBankNo no : noCurlist) {
resR = ChecksUtil.checkBankNoTwo(no.getName(), no.getBankNo(), canCheck);
if (Common.isNotNull(resR) && Common.isNotNull(resR.getData())) {
newNo = resR.getData();
bankMap.put(newNo.getBankNo(), CommonConstants.ZERO_ONE.equals(newNo.getResult()));
saveList.add(newNo);
}
}
if (!saveList.isEmpty()) {
this.saveBatch(saveList);
}
}
}
vo.setCheckMap(bankMap);
return vo;
}
}
......@@ -23,6 +23,7 @@ import com.yifu.cloud.plus.v1.check.mapper.TCheckMobileMapper;
import com.yifu.cloud.plus.v1.check.service.TCanCheckService;
import com.yifu.cloud.plus.v1.check.service.TCheckMobileService;
import com.yifu.cloud.plus.v1.check.utils.ChecksUtil;
import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
......@@ -31,6 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -161,4 +163,60 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh
return returnMobile;
}
@Override
public CheckBatchVo checkMobileBatch(List<String> list) {
CheckBatchVo vo = new CheckBatchVo();
Map<String, Boolean> noMap = new HashMap<>();
if (!list.isEmpty()) {
List<TCheckMobile> checkMobileList = baseMapper.getListByNoList(list);
if (checkMobileList != null && !checkMobileList.isEmpty()) {
for (TCheckMobile no : checkMobileList) {
noMap.put(no.getMobile(), CommonConstants.ONE_STRING.equals(no.getStatus())
|| CommonConstants.FOUR_STRING.equals(no.getStatus())
|| CommonConstants.FIVE_STRING.equals(no.getStatus()));
}
}
}
List<String> noCurlist = new ArrayList<>();
Boolean cur;
Map<String, Boolean> backMap = new HashMap<>();
StringBuilder phones = new StringBuilder();
for (String check : list) {
cur = noMap.get(check);
if (cur != null) {
backMap.put(check, cur);
} else {
phones.append(check).append(CommonConstants.COMMA_STRING);
noCurlist.add(check);
}
}
if (phones.length() > 0) {
phones.deleteCharAt(phones.length()-1);
}
List<TCheckMobile> saveList = new ArrayList<>();
if (!noCurlist.isEmpty() && Common.isNotNull(phones)) {
synchronized (this) {
R<Map<String, TCheckMobile>> mobileMapR = ChecksUtil.checkMobile(phones.toString(), canCheckService.getCanCheck());
if (Common.isNotNull(mobileMapR) && Common.isNotNull(mobileMapR.getData())) {
Map<String, TCheckMobile> result = mobileMapR.getData();
TCheckMobile mo;
for (String no : noCurlist) {
mo = result.get(no);
backMap.put(no, mo == null || (CommonConstants.ONE_STRING.equals(mo.getStatus())
|| CommonConstants.FOUR_STRING.equals(mo.getStatus())
|| CommonConstants.FIVE_STRING.equals(mo.getStatus())));
if (mo != null) {
saveList.add(mo);
}
}
}
if (!saveList.isEmpty()) {
this.saveBatch(saveList);
}
}
}
vo.setCheckMap(backMap);
return vo;
}
}
......@@ -41,4 +41,18 @@
<result property="name" column="name"/>
<result property="idNum" column="id_num"/>
</resultMap>
<!--获取list-->
<select id="getListByNoList" resultMap="tCheckBankNoMap">
SELECT
a.id,
a.bank_no,
a.name,
a.result
FROM t_check_bank_no a
where a.bank_no in
<foreach item="item" index="index" collection="noList" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
......@@ -38,4 +38,17 @@
<result property="status" column="status"/>
<result property="message" column="message"/>
</resultMap>
<!--获取list-->
<select id="getListByNoList" resultMap="tCheckMobileMap">
SELECT
a.id,
a.mobile,
a.status
FROM t_check_mobile a
where a.mobile in
<foreach item="item" index="index" collection="noList" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
......@@ -21,6 +21,7 @@ import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
......@@ -200,4 +201,8 @@ public class TSalaryEmployee extends BaseEntity {
@Schema(description ="代发户状态(0正常;1代发户进的数据,下次要验证银行卡)")
private Integer issueStatus;
// 导工资需要的标志:行号
@TableField(exist = false)
private Integer lineNums;
}
......@@ -78,6 +78,7 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
* @return: java.lang.String
**/
String getMinTaxMonthByNowYear(@Param("empIdCard") String empIdCard, @Param("nowYear") int nowYear);
List<TSalaryAccount> getMinTaxMonthByNowYearAndList(@Param("empIdCardList") List<String> empIdCardList, @Param("nowYear") int nowYear);
/**
* @return
......
......@@ -92,6 +92,16 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
**/
String getMinTaxMonthByNowYear(String empIdCard, int nowYear);
/**
* @param empIdCardList
* @param nowYear
* @Description: 获取最小计税月的map
* @Author: hgw
* @Date: 2023/2/8 17:19
* @return: java.util.Map<java.lang.String, java.lang.String>
**/
Map<String, String> getMinTaxMonthByNowYearAndList(List<String> empIdCardList, int nowYear);
/**
* @Author fxj
* @Description 获取有工资无社保数据 3个月的工资
......
......@@ -30,6 +30,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeSearchVo;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
/**
* 薪酬人员表
......@@ -61,6 +62,16 @@ public interface TSalaryEmployeeService extends IService<TSalaryEmployee> {
**/
String saveNewSalaryEmployee(boolean notLabour, TSalaryEmployee employee);
/**
* @param saveNewEmpList
* @param errorList
* @Description: 批量新增人员,包含批量判断,减少判断时间等
* @Author: hgw
* @Date: 2023/2/9 14:57
* @return: java.lang.String
**/
String saveNewEmployeeList(List<TSalaryEmployee> saveNewEmpList, List<ErrorMessage> errorList);
/**
* @param inputStream
* @Description: 批量更新-薪资人员信息
......@@ -81,6 +92,15 @@ public interface TSalaryEmployeeService extends IService<TSalaryEmployee> {
TSalaryEmployee getByEmpIdCard(String empIdCard);
/**
* @param idCardList
* @Description: 批量获取员工
* @Author: hgw
* @Date: 2023/2/8 14:29
* @return: java.util.Map<java.lang.String, com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee>
**/
Map<String, TSalaryEmployee> getByEmpIdCardList(List<String> idCardList);
/**
* @param employee
* @Description: 代发户的,下次校验银行卡,同时变更校验flag
......
......@@ -224,7 +224,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
// return R.ok(saList)
//薪资导入
if (CommonConstants.ZERO_STRING.equals(salaryType)) {
return this.saveAndSubmit(saList, vo);
return this.saveAndSubmit(saList, vo, dept);
}
//劳务费和稿酬导入
if (CommonConstants.THREE_STRING.equals(salaryType) || CommonConstants.FOUR_STRING.equals(salaryType)) {
......@@ -243,25 +243,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
return R.failed("导入数据不可为空");
}
/**
* @param strList list
* @Description: 返回idStr
* @Author: hgw
* @Date: 2019/10/17 14:50
* @return: java.lang.String
**/
public static String salaryEstimateListToStr(List<MSalaryEstimate> strList) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < strList.size(); i++) {
if (i == 0) {
result.append("'").append(strList.get(0).getEstimateId()).append("'");
} else {
result.append(",'").append(strList.get(i).getEstimateId()).append("'");
}
}
return result.toString();
}
/**
* @param sav 报账表vo
* @param dept 结算主体
......@@ -322,7 +303,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
* @Date: 2019/9/20 17:05
* @return: com.yifu.cloud.v1.common.core.util.R
**/
private R saveAndSubmit(List<TSalaryAccountVo> savList, SalaryUploadParamVo vo) {
private R saveAndSubmit(List<TSalaryAccountVo> savList, SalaryUploadParamVo vo, TSettleDomainSelectVo dept) {
if (Common.isNotNull(savList) && !savList.isEmpty()) {
String orderId = vo.getOrderId();
// 代发户
......@@ -331,16 +312,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
List<TSalaryStandardIssueRes> resList = vo.getResList();
TSalaryAccountVo salaryAccountVo = savList.get(0);
List<TSalaryAccountItem> saiList = null; //报账明细List
R<TSettleDomainSelectVo> sdr = HttpDaprUtil.invokeMethodPost(archivesProperties.getAppUrl(), archivesProperties.getAppId()
, "/tsettledomain/inner/getSettleDomainVoById", salaryAccountVo.getDeptId(), TSettleDomainSelectVo.class, SecurityConstants.FROM_IN);
//结算主体
TSettleDomainSelectVo dept = null;
if (sdr != null && sdr.getData() != null) {
dept = sdr.getData();
}
if (dept == null || dept.getId() == null) {
return R.failed("新建工资主表失败-获取结算主体信息为空");
}
String invoiceTitle = dept.getBusinessSubjectName();
if (Common.isEmpty(invoiceTitle)) {
return R.failed("新建工资主表失败-获取结算主体的-封面抬头-信息为空,请去<EKP系统-项目>模块,编辑封面抬头后再导入");
......@@ -502,7 +473,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
boolean modelPersonFundFlag;
boolean modelUnitSocialFlag;
boolean modelUnitFundFlag;
BigDecimal money; //初始化金额备用
Set<String> socialList = new HashSet<>(); //社保需要存储的id
Set<String> fundList = new HashSet<>(); //公积金需要存储的id
......@@ -557,10 +527,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
Map<String, List<TSalaryAccountItem>> itemMap = tSalaryAccountItemService.getAllItemVoList(idCardList, invoiceTitle);
// 是否劳务费,true:是
boolean isLabor = false;
if ("3".equals(salaryAccountVo.getFormType())) {
isLabor = true;
}
boolean isLabor = CommonConstants.THREE_STRING.equals(salaryAccountVo.getFormType());
TSalaryAccountItem sai;
for (int i = CommonConstants.ZERO_INT; i < size; i++) {
modelPersonSocialFlag = true;
......@@ -930,45 +897,23 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
mSalaryEstimateService.save(se);
}
}
TPauseSalary ps;
int i =1;
for (TSalaryAccount account : aList) {
saiList = account.getSaiList();
account.setSaiList(null);
account.setSalaryFormId(salary.getId());
account.setOrderId(salary.getOrderId());
account.setRowIndex(i);
i++;
tSalaryAccountService.save(account);
money = SalaryConstants.B_ZERO;
}
tSalaryAccountService.saveBatch(aList);
List<TSalaryAccountItem> saveSaiList = new ArrayList<>();
for (TSalaryAccount account : aList) {
saiList = account.getSaiList();
for (TSalaryAccountItem item : saiList) {
if (SalaryConstants.ACTUAL_SALARY_SUM_JAVA.equals(item.getJavaFiedName())) {
money = item.getSalaryMoney();
}
item.setSalaryAccountId(account.getId());
tSalaryAccountItemService.save(item);
}
//暂停发
if (SalaryConstants.SALARY_GIVE_TIME_VALUE.equals(account.getSalaryGiveTime())) {
ps = new TPauseSalary();
ps.setBalance(money);
ps.setName(account.getEmpName());
ps.setIdCard(account.getEmpIdcard());
ps.setBankName(account.getBankName());
ps.setBankNo(account.getBankNo());
ps.setCreateTime(nowTime);
ps.setCreateBy(user.getId());
ps.setSettleDepartId(dept.getId());
ps.setSettleDepartNo(dept.getDepartNo());
ps.setSettleDepartName(dept.getDepartName());
ps.setSalaryFormId(salary.getId());
ps.setSalaryAccountId(account.getId());
ps.setSalaryDate(account.getSalaryMonth());
ps.setSettleDate(account.getSettlementMonth());
ps.setType(SalaryConstants.PAUSE_TYPE[0]);
tPauseSalaryService.save(ps);
}
saveSaiList.addAll(saiList);
}
tSalaryAccountItemService.saveBatch(saveSaiList);
return R.ok(salaryDetailVo);
}
......
......@@ -191,6 +191,20 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
return baseMapper.getMinTaxMonthByNowYear(empIdCard, nowYear);
}
@Override
public Map<String, String> getMinTaxMonthByNowYearAndList(List<String> empIdCardList, int nowYear) {
Map<String, String> taxMonthMap = new HashMap<>();
if (empIdCardList != null && !empIdCardList.isEmpty()) {
List<TSalaryAccount> list = baseMapper.getMinTaxMonthByNowYearAndList(empIdCardList, nowYear);
if (list != null && !list.isEmpty()) {
for (TSalaryAccount a : list) {
taxMonthMap.put(a.getEmpIdcard(), a.getTaxMonth());
}
}
}
return taxMonthMap;
}
/**
* @Author fxj
* @Description 获取有工资无社保数据
......
......@@ -35,6 +35,7 @@ import com.yifu.cloud.plus.v1.check.entity.TCheckBankNo;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.check.vo.CheckBankNoVo;
import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
......@@ -290,6 +291,68 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
return null;
}
@Override
public String saveNewEmployeeList(List<TSalaryEmployee> saveNewEmpList, List<ErrorMessage> errorList) {
if (saveNewEmpList != null && !saveNewEmpList.isEmpty()) {
// 银行卡
List<TCheckBankNo> bankList = new ArrayList<>();
List<String> phoneList = new ArrayList<>();
TCheckBankNo checkBankNo;
for (TSalaryEmployee employee : saveNewEmpList) {
if (Common.isNotNull(employee.getBankNo()) && (Common.isEmpty(employee.getIssueStatus()) || employee.getIssueStatus().equals(CommonConstants.ZERO_INT))) {
checkBankNo = new TCheckBankNo();
checkBankNo.setName(employee.getEmpName());
checkBankNo.setBankNo(employee.getBankNo());
bankList.add(checkBankNo);
}
if (Common.isNotNull(employee.getEmpPhone())) {
phoneList.add(employee.getEmpPhone());
}
}
// 批量校验 卡号与手机号
Map<String, Boolean> bankMap = new HashMap<>();
Map<String, Boolean> phoneMap = new HashMap<>();
if (!bankList.isEmpty()) {
R<CheckBatchVo> checkListR = HttpDaprUtil.invokeMethodPost(checkProperties.getAppUrl(), checkProperties.getAppId()
, "/tcheckbankno/inner/checkBankNoBatch", bankList, CheckBatchVo.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
bankMap = checkListR.getData().getCheckMap();
}
}
if (!phoneList.isEmpty()) {
R<CheckBatchVo> phoneR = HttpDaprUtil.invokeMethodPost(checkProperties.getAppUrl(), checkProperties.getAppId()
, "/tcheckmobile/inner/checkMobileBatch", phoneList, CheckBatchVo.class, SecurityConstants.FROM_IN);
if (phoneR != null && phoneR.getData() != null) {
phoneMap = phoneR.getData().getCheckMap();
}
}
for (TSalaryEmployee employee : saveNewEmpList) {
if (bankMap.get(employee.getBankNo()) != null) {
if (Boolean.FALSE.equals(bankMap.get(employee.getBankNo()))) {
errorList.add(new ErrorMessage((employee.getLineNums() + 2), "第" + (employee.getLineNums() + 2) + "行:该员工新建时校验卡号错误"));
return null;
}
} else {
errorList.add(new ErrorMessage((employee.getLineNums() + 2), "第" + (employee.getLineNums() + 2) + "行:该员工新建时校验卡号错误:【" + SalaryConstants.CHECK_NO_RESPONSE + "】"));
return null;
}
if (phoneMap.get(employee.getEmpPhone()) != null) {
if (Boolean.FALSE.equals(phoneMap.get(employee.getEmpPhone()))) {
errorList.add(new ErrorMessage((employee.getLineNums() + 2), "第" + (employee.getLineNums() + 2) + "行:该员工新建时校验手机号错误"));
return null;
}
} else {
errorList.add(new ErrorMessage((employee.getLineNums() + 2), "第" + (employee.getLineNums() + 2) + "行:该员工新建时校验手机号错误:【" + SalaryConstants.CHECK_NO_RESPONSE + "】"));
return null;
}
}
this.saveBatch(saveNewEmpList);
}
return null;
}
/**
* @param employee
* @Description: 校验卡号与手机号
......@@ -530,6 +593,18 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
return baseMapper.getByEmpIdCard(empIdCard);
}
@Override
public Map<String, TSalaryEmployee> getByEmpIdCardList(List<String> idCardList) {
List<TSalaryEmployee> empList = baseMapper.getListByIdCard(idCardList);
Map<String, TSalaryEmployee> map = new HashMap<>();
if (empList != null && !empList.isEmpty()) {
for (TSalaryEmployee e : empList) {
map.put(e.getEmpIdcard(), e);
}
}
return map;
}
/**
* @param employee
* @Description: 代发户的,下次校验银行卡,同时变更校验flag
......
......@@ -516,6 +516,20 @@
and a.FORM_TYPE != '3' and a.FORM_TYPE != '4'
</select>
<!-- 获取当前年最小计税月 -->
<select id="getMinTaxMonthByNowYearAndList" resultMap="tSalaryAccountMap">
select
a.EMP_IDCARD,concat(min(a.TAX_MONTH - 0),'') TAX_MONTH
from t_salary_account a
where a.EMP_IDCARD in
<foreach collection="empIdCardList" item="ids" open="(" separator="," close=")">
#{ids}
</foreach>
and a.DELETE_FLAG = 0 and a.SETTLEMENT_MONTH like concat(#{nowYear},"%")
and a.FORM_TYPE != '3' and a.FORM_TYPE != '4'
group by a.EMP_IDCARD
</select>
<select id="getLastMonthTHaveSalaryNosocial" resultType="com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial">
select a.EMP_ID employee_id
, a.EMP_IDCARD employee_id_card
......
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