Commit dc91a10a authored by huyuchen's avatar huyuchen

Merge remote-tracking branch 'origin/MVP1.5' into MVP1.5

parents 9b16d009 3f15142c
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
......@@ -90,4 +110,6 @@ public interface TSalaryEmployeeService extends IService<TSalaryEmployee> {
**/
boolean checkBankInfo(TSalaryEmployee employee);
boolean checkBankInfoList(List<TSalaryEmployee> empList, List<ErrorMessage> errorList);
}
......@@ -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
......@@ -560,6 +635,39 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
}
}
@Override
public boolean checkBankInfoList(List<TSalaryEmployee> empList, List<ErrorMessage> errorList) {
// 批量校验 卡号与手机号
Map<String, Boolean> bankMap = new HashMap<>();
List<TCheckBankNo> bankList = new ArrayList<>();
TCheckBankNo checkBankNo;
for (TSalaryEmployee employee : empList) {
if (Common.isNotNull(employee.getBankNo())) {
checkBankNo = new TCheckBankNo();
checkBankNo.setName(employee.getEmpName());
checkBankNo.setBankNo(employee.getBankNo());
bankList.add(checkBankNo);
}
}
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();
}
for (TSalaryEmployee employee : empList) {
employee.setIssueStatus(CommonConstants.ZERO_INT);
if (bankMap.get(employee.getBankNo()) != null && Boolean.FALSE.equals(bankMap.get(employee.getBankNo()))) {
errorList.add(new ErrorMessage((employee.getLineNums() + 2), "第" + (employee.getLineNums() + 2)
+ "行:-上次代发户未校验【姓名与卡号】,本次校验结果:不匹配。请去薪酬人员查询处更新卡号信息!"));
return false;
}
}
this.saveBatch(empList);
}
return true;
}
/**
* @param vo
* @Description: 批量更新-薪资人员信息
......
......@@ -50,6 +50,7 @@ public class SalaryAccountUtil implements Serializable {
/**
* vo.jsonStr 客户原表json内容
*
* @param dept 项目
* @param configSalary 当前项目下的配置(结算月等
* @param salaryConfigMap 客户原表-工资模板配置Map
......@@ -130,10 +131,13 @@ public class SalaryAccountUtil implements Serializable {
// 是否含有年终奖 false 没有
boolean annualBonusFlag;
// 是否 不是劳务费(劳务费不用进档,不用档案信息)
boolean notLabour = true;
if (CommonConstants.THREE_STRING.equals(salaryType)) {
notLabour = false;
}
boolean notLabour = !CommonConstants.THREE_STRING.equals(salaryType);
// 连接查询的数据集合
List<TSalaryEmployee> updateEmpList = new ArrayList<>();
List<TSalaryEmployee> checkBankInfoEmpList = new ArrayList<>();
Map<Integer, TSalaryEmployee> newEmpMap = new HashMap<>();
Map<String, TSalaryAccountVo> entityMap = new HashMap<>();
List<String> otherIdCard = new ArrayList<>();
for (int i = 0; i < rows; i++) {
annualBonusFlag = false;
errorFlag = true;
......@@ -141,9 +145,12 @@ public class SalaryAccountUtil implements Serializable {
entity = new TSalaryAccountVo();
emp = null;
newEmp = new TSalaryEmployee();
newEmp.setLineNums(i);
salaryGiveTimeFlag = true;
entity.setSalaryGiveTime(CommonConstants.ZERO_STRING);
empName = null;
isNewEmployee = false;
entity.setIsNewEmployee(CommonConstants.ZERO_STRING);
saiList = new ArrayList<>();
salaryStyle = SalaryConstants.SALARY_STYLE_BANK;
relaySalary = null;
......@@ -177,7 +184,7 @@ public class SalaryAccountUtil implements Serializable {
}
if (SalaryConstants.RELAY_SALARY_JAVA.equals(scs.getJavaFiedName())) {
try {
relaySalary = new BigDecimal(cellValueStr.replace(",",""));
relaySalary = new BigDecimal(cellValueStr.replace(",", ""));
sai = new TSalaryAccountItemVo();
sai.setCnName(dbFiedName);
sai.setJavaFiedName(scs.getJavaFiedName());
......@@ -193,7 +200,7 @@ public class SalaryAccountUtil implements Serializable {
}
if (SalaryConstants.ACTUAL_SALARY_SUM_JAVA.equals(scs.getJavaFiedName())) {
try {
actualSalarySum = new BigDecimal(cellValueStr.replace(",",""));
actualSalarySum = new BigDecimal(cellValueStr.replace(",", ""));
entity.setActualSalary(actualSalarySum);
} catch (Exception e) {
errorFlag = false;
......@@ -208,7 +215,7 @@ public class SalaryAccountUtil implements Serializable {
|| SalaryConstants.ENTERPRISE_ANNUITY_UNIT_JAVA.equals(scs.getJavaFiedName())
|| scs.getJavaFiedName().contains(SalaryConstants.WITHHOLIDING)) {
try {
new BigDecimal(cellValueStr.replace(",",""));
new BigDecimal(cellValueStr.replace(",", ""));
} catch (Exception ex) {
errorFlag = false;
error = "第" + (i + 2) + "行:代扣、企业年金,只能是金额!";
......@@ -226,6 +233,7 @@ public class SalaryAccountUtil implements Serializable {
if ((SalaryConstants.IF_NEW_EMPLOYEE.equals(dbFiedName) || SalaryConstants.IS_NEW_EMPLOYEE.equals(dbFiedName))
&& SalaryConstants.IS_NEW.equals(cellValueStr)) {
isNewEmployee = true;
entity.setIsNewEmployee(CommonConstants.ONE_STRING);
}
if (SalaryConstants.ID_NUMBER.equals(dbFiedName)) {
if (checkIdNumberMap.get(cellValueStr) == null) {
......@@ -257,7 +265,7 @@ public class SalaryAccountUtil implements Serializable {
sai.setIsTax(CommonConstants.ZERO_INT);
}
try {
cellValueBig = new BigDecimal(cellValueStr.replace(",",""));
cellValueBig = new BigDecimal(cellValueStr.replace(",", ""));
cellValueBig = cellValueBig.setScale(2, BigDecimal.ROUND_HALF_UP); //四舍五入
if (cellValueBig.toString().length() > 11) {
if (cellValueBig.toString().length() > 500) {
......@@ -369,23 +377,12 @@ public class SalaryAccountUtil implements Serializable {
salaryStyle = entity.getSalaryStyle();
} else if (configSalary.getGrantType() != null) {
salaryStyle = String.valueOf(configSalary.getGrantType());
entity.setSalaryStyle(salaryStyle);
}
// 2021-8-31 hgw2.6.5新增手机号校验
if (newEmp != null && Common.isNotNull(entity.getEmpPhone()) && Common.isEmpty(newEmp.getEmpPhone())) {
newEmp.setEmpPhone(entity.getEmpPhone());
}
if (emp == null && notLabour && Common.isNotNull(newEmp.getEmpIdcard())) {
emp = tSalaryEmployeeService.getByEmpIdCard(newEmp.getEmpIdcard());
if (emp != null) {
emp.setDeptId(dept.getId());
emp.setDeptName(dept.getDepartName());
emp.setDeptNo(dept.getDepartNo());
emp.setUnitId(dept.getCustomerId());
emp.setUnitName(dept.getCustomerName());
emp.setUnitNo(dept.getCustomerCode());
tSalaryEmployeeService.updateById(emp);
}
}
newEmp.setIssueStatus(isIssue);
// 劳务费要使用人员信息
if (!notLabour) {
......@@ -396,183 +393,20 @@ public class SalaryAccountUtil implements Serializable {
continue;
} else {
emp = eR.getData();
emp.setLineNums(i);
}
} else if (emp == null) {
if (isNewEmployee) {
R<TSalaryEmployee> eR = this.getNewEmp(newEmp, i, errorList, notLabour, entity, salaryType, dept, user
, salaryStyle, salaryGiveTimeFlag, invoiceTitle, tSalaryAccountService
, tSalaryEmployeeService);
if (eR.getCode() != 200) {
continue;
} else {
emp = eR.getData();
}
} else {
if ("4".equals(salaryType)) {
error = "第" + (i + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、手机号码!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
} else if (notLabour) {
error = "第" + (i + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、计税月份、手机号码!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
}
newEmpMap.put((i + 2), newEmp);
entityMap.put(newEmp.getEmpIdcard(), entity);
otherIdCard.add(newEmp.getEmpIdcard());
}
if (emp != null) {
if (Common.isEmpty(emp.getEmpName())) {
error = "第" + (i + 2) + "行:薪酬人员查询处-员工姓名-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
} else if (Common.isEmpty(empName)) {
error = "第" + (i + 2) + "行:模板-员工姓名-为空,请添加员工姓名列!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
} else if (!empName.equals(emp.getEmpName())) {
error = "第" + (i + 2) + "行:员工-姓名与身份证-不匹配,请确认薪酬人员查询处信息!";
errorList.add(new ErrorMessage((i + 2), error));
if (setEntityByEmpInfo(dept, ownEmployeeMap, ownDeptMap, salaryType, isIssue, errorList
, entity, emp, saiList, salaryGiveTimeFlag, isNewEmployee, empName, salaryStyle
, nowMonth, updateEmpList, checkBankInfoEmpList, i))
continue;
}
if (Common.isEmpty(emp.getEmpPhone())) {
error = "第" + (i + 2) + "行:薪酬人员查询处-手机号码-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
} else if (!ValidityUtil.validateEmpPhone(emp.getEmpPhone())) {
error = "第" + (i + 2) + "行:薪酬人员查询处-手机号码格式错误,请去薪酬人员查询处更新:" + emp.getEmpPhone();
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
if (Common.isEmpty(emp.getTaxMonth()) && !"3".equals(salaryType) && !"4".equals(salaryType)) {
if (Common.isNotNull(entity.getTaxMonth())) {
if (entity.getTaxMonth().length() > CommonConstants.dingleDigitIntArray[6]) {
entity.setTaxMonth(emp.getTaxMonth().substring(0, 6));
} else if (entity.getTaxMonth().length() < CommonConstants.dingleDigitIntArray[6]) {
error = "第" + (i + 2) + "行:工资模板里-计税月份-长度小于6:" + entity.getTaxMonth() + ",请在工资模板修改!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
if (DateUtil.compareYearMonth(entity.getTaxMonth(), nowMonth)) {
error = "第" + (i + 2) + "行:工资模板里-计税月份-大于当前年月或错误,请调整:" + entity.getTaxMonth();
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
emp.setTaxMonth(entity.getTaxMonth());
tSalaryEmployeeService.updateById(emp);
} else {
error = "第" + (i + 2) + "行:薪酬人员查询处-计税月份-为空,请在工资模板填写-计税月份-列的内容!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
}
if (ownEmployeeMap.get(emp.getEmpIdcard()) != null
|| (isNewEmployee && ownDeptMap.get(dept.getId()) != null)) {
// 自有员工
entity.setOwnFlag(CommonConstants.ONE_INT);
} else {
// 普通员工
entity.setOwnFlag(CommonConstants.ZERO_INT);
}
entity.setProvince(dept.getProvince());
entity.setCity(dept.getCity());
entity.setTown(dept.getTown());
// 本次不为代发户,并且薪资人员里的代发户标记没去掉,要校验银行卡
if (isIssue == 0 && Common.isNotNull(emp.getBankNo())
&& Common.isNotNull(emp.getIssueStatus())
&& CommonConstants.ONE_INT == emp.getIssueStatus()) {
boolean bankNoIsTrue = tSalaryEmployeeService.checkBankInfo(emp);
if (!bankNoIsTrue) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard()
+ "-上次代发户未校验【姓名与卡号】,本次校验结果:不匹配。请去薪酬人员查询处更新卡号信息!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
}
entity.setEmpId(emp.getId());
entity.setEmpIdcard(emp.getEmpIdcard());
entity.setEmpName(emp.getEmpName());
entity.setEmpPhone(emp.getEmpPhone());
if (SalaryConstants.SALARY_STYLE_BANK.equals(salaryStyle) && salaryGiveTimeFlag) {
if (Common.isEmpty(emp.getBankName())) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
if (Common.isEmpty(emp.getBankNo())) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-银行卡号-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
if (Common.isEmpty(emp.getBankProvince())) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行省-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
if (Common.isEmpty(emp.getBankCity())) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行市-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
entity.setBankName(emp.getBankName());
entity.setBankNo(emp.getBankNo());
entity.setBankProvince(String.valueOf(emp.getBankProvince()));
entity.setBankCity(String.valueOf(emp.getBankCity()));
entity.setBankSubName(emp.getBankSubName());
} else {
if (Common.isNotNull(emp.getBankName())) {
entity.setBankName(emp.getBankName());
} else {
entity.setBankName(null);
}
if (Common.isNotNull(emp.getBankNo())) {
entity.setBankNo(emp.getBankNo());
} else {
entity.setBankNo(null);
}
if (Common.isNotNull(emp.getBankSubName())) {
entity.setBankSubName(emp.getBankSubName());
} else {
entity.setBankSubName(null);
}
if (Common.isNotNull(emp.getBankProvince())) {
entity.setBankProvince(String.valueOf(emp.getBankProvince()));
} else {
entity.setBankProvince(null);
}
if (Common.isNotNull(emp.getBankCity())) {
entity.setBankCity(String.valueOf(emp.getBankCity()));
} else {
entity.setBankCity(null);
}
}
if (!"3".equals(salaryType) && !"4".equals(salaryType)) {
if (emp.getTaxMonth().length() > CommonConstants.dingleDigitIntArray[6]) {
entity.setTaxMonth(emp.getTaxMonth().substring(0, 6));
} else if (emp.getTaxMonth().length() < CommonConstants.dingleDigitIntArray[6]) {
error = "第" + (i + 2) + "行:薪酬人员查询处-计税月份-长度小于6:" + entity.getTaxMonth() + ",请去薪酬人员查询处更新!在工资模板修改无效!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
} else {
entity.setTaxMonth(emp.getTaxMonth());
}
if (DateUtil.compareYearMonth(entity.getTaxMonth(), nowMonth)) {
error = "第" + (i + 2) + "行:薪酬人员查询处-计税月份-大于当前年月或错误,请调整:" + entity.getTaxMonth();
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
sai = new TSalaryAccountItemVo();
sai.setCnName(SalaryConstants.COST_REDUCTION);
sai.setJavaFiedName(SalaryConstants.COST_REDUCTION_JAVA);
sai.setSalaryMoney(DateUtil.getTaxMonthMoney(entity.getTaxMonth()));
sai.setIsTax(CommonConstants.ZERO_INT);
saiList.add(sai);
}
} else {
if ("3".equals(salaryType) || "4".equals(salaryType)) {
error = "第" + (i + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、手机号码!";
} else {
error = "第" + (i + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、计税月份、手机号码!";
}
} else if ("3".equals(salaryType) || "4".equals(salaryType)) {
error = "第" + (i + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、手机号码!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
......@@ -613,6 +447,72 @@ public class SalaryAccountUtil implements Serializable {
}
}
}
// 统一处理连接查询
tSalaryEmployeeService.updateBatchById(updateEmpList);
if (!checkBankInfoEmpList.isEmpty()) {
// 本次不为代发户,并且薪资人员里的代发户标记没去掉,要校验银行卡
tSalaryEmployeeService.checkBankInfoList(checkBankInfoEmpList, errorList);
}
Map<String, TSalaryEmployee> otherEmpMap = new HashMap<>();
if (!otherIdCard.isEmpty()) {
otherEmpMap = tSalaryEmployeeService.getByEmpIdCardList(otherIdCard);
}
TSalaryEmployee otherEmp;
List<TSalaryEmployee> saveNewEmpList = new ArrayList<>();
List<String> checkTaxMonthList = new ArrayList<>();
for (Map.Entry<Integer, TSalaryEmployee> newEmps : newEmpMap.entrySet()) {
entity = entityMap.get(newEmps.getValue().getEmpIdcard());
// 先按照身份证查询
otherEmp = otherEmpMap.get(newEmps.getValue().getEmpIdcard());
if (otherEmp == null) {
if (CommonConstants.ONE_STRING.equals(entity.getIsNewEmployee())) {
this.setNewEmpBase(newEmps.getValue(), newEmps.getKey() - 2, errorList, notLabour
, entity, salaryType, dept, user, entity.getSalaryStyle()
, CommonConstants.ZERO_STRING.equals(entity.getSalaryGiveTime()), invoiceTitle);
saveNewEmpList.add(newEmps.getValue());
checkTaxMonthList.add(newEmps.getValue().getEmpIdcard());
} else {
if ("4".equals(salaryType)) {
error = "第" + newEmps.getKey() + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、手机号码!";
errorList.add(new ErrorMessage(newEmps.getKey(), error));
} else if (notLabour) {
error = "第" + newEmps.getKey() + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、计税月份、手机号码!";
errorList.add(new ErrorMessage(newEmps.getKey(), error));
}
}
} else {
// 使用emp信息
if (setEntityByEmpInfo(dept, ownEmployeeMap, ownDeptMap, salaryType, isIssue, errorList
, entity, otherEmp, entity.getSaiList()
, CommonConstants.ZERO_STRING.equals(entity.getSalaryGiveTime())
, CommonConstants.ONE_STRING.equals(entity.getIsNewEmployee())
, otherEmp.getEmpName(), entity.getSalaryStyle()
, nowMonth, updateEmpList, checkBankInfoEmpList, newEmps.getKey() - 2)) return;
}
}
int nowYear = Integer.parseInt(nowMonth.substring(0, 4));
Map<String, String> minTaxMonthMap = tSalaryAccountService.getMinTaxMonthByNowYearAndList(checkTaxMonthList, nowYear);
String minTaxMonth;
boolean canSave = true;
for (TSalaryEmployee saveNewEmp : saveNewEmpList) {
// 新员工校验计税月
if (!"3".equals(salaryType) && !"4".equals(salaryType)) {
entity = entityMap.get(saveNewEmp.getEmpIdcard());
minTaxMonth = minTaxMonthMap.get(saveNewEmp.getEmpIdcard());
if (Common.isNotNull(minTaxMonth)
&& !minTaxMonth.equals(entity.getTaxMonth())) {
error = "第" + (saveNewEmp.getLineNums() + 2) + "行:该员工已有发薪记录,计税月份请填写:【" + minTaxMonth + "】" + ",你填写了计税月:【" + entity.getTaxMonth() + "】";
errorList.add(new ErrorMessage((saveNewEmp.getLineNums() + 2), error));
canSave = false;
}
}
}
if (canSave) {
// 新增
tSalaryEmployeeService.saveNewEmployeeList(saveNewEmpList, errorList);
}
}
} catch (Exception e) {
e.printStackTrace();
......@@ -623,6 +523,158 @@ public class SalaryAccountUtil implements Serializable {
this.setErrorInfo(errorList);
}
private boolean setEntityByEmpInfo(TSettleDomainSelectVo dept, Map<String, Integer> ownEmployeeMap
, Map<String, Integer> ownDeptMap, String salaryType, Integer isIssue, List<ErrorMessage> errorList
, TSalaryAccountVo entity, TSalaryEmployee emp, List<TSalaryAccountItemVo> saiList
, boolean salaryGiveTimeFlag, boolean isNewEmployee, String empName, String salaryStyle, String nowMonth
, List<TSalaryEmployee> updateEmpList, List<TSalaryEmployee> checkBankInfoEmpList, int i) {
TSalaryAccountItemVo sai;
String error;
if (Common.isEmpty(emp.getEmpName())) {
error = "第" + (i + 2) + "行:薪酬人员查询处-员工姓名-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
return true;
} else if (Common.isEmpty(empName)) {
error = "第" + (i + 2) + "行:模板-员工姓名-为空,请添加员工姓名列!";
errorList.add(new ErrorMessage((i + 2), error));
return true;
} else if (!empName.equals(emp.getEmpName())) {
error = "第" + (i + 2) + "行:员工-姓名与身份证-不匹配,请确认薪酬人员查询处信息!";
errorList.add(new ErrorMessage((i + 2), error));
return true;
}
if (Common.isEmpty(emp.getEmpPhone())) {
error = "第" + (i + 2) + "行:薪酬人员查询处-手机号码-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
return true;
} else if (!ValidityUtil.validateEmpPhone(emp.getEmpPhone())) {
error = "第" + (i + 2) + "行:薪酬人员查询处-手机号码格式错误,请去薪酬人员查询处更新:" + emp.getEmpPhone();
errorList.add(new ErrorMessage((i + 2), error));
return true;
}
if (Common.isEmpty(emp.getTaxMonth()) && !"3".equals(salaryType) && !"4".equals(salaryType)) {
if (Common.isNotNull(entity.getTaxMonth())) {
if (entity.getTaxMonth().length() > CommonConstants.dingleDigitIntArray[6]) {
entity.setTaxMonth(emp.getTaxMonth().substring(0, 6));
} else if (entity.getTaxMonth().length() < CommonConstants.dingleDigitIntArray[6]) {
error = "第" + (i + 2) + "行:工资模板里-计税月份-长度小于6:" + entity.getTaxMonth() + ",请在工资模板修改!";
errorList.add(new ErrorMessage((i + 2), error));
return true;
}
if (DateUtil.compareYearMonth(entity.getTaxMonth(), nowMonth)) {
error = "第" + (i + 2) + "行:工资模板里-计税月份-大于当前年月或错误,请调整:" + entity.getTaxMonth();
errorList.add(new ErrorMessage((i + 2), error));
return true;
}
emp.setTaxMonth(entity.getTaxMonth());
updateEmpList.add(emp);
} else {
error = "第" + (i + 2) + "行:薪酬人员查询处-计税月份-为空,请在工资模板填写-计税月份-列的内容!";
errorList.add(new ErrorMessage((i + 2), error));
return true;
}
}
if (ownEmployeeMap.get(emp.getEmpIdcard()) != null
|| (isNewEmployee && ownDeptMap.get(dept.getId()) != null)) {
// 自有员工
entity.setOwnFlag(CommonConstants.ONE_INT);
} else {
// 普通员工
entity.setOwnFlag(CommonConstants.ZERO_INT);
}
entity.setProvince(dept.getProvince());
entity.setCity(dept.getCity());
entity.setTown(dept.getTown());
// 本次不为代发户,并且薪资人员里的代发户标记没去掉,要校验银行卡
if (isIssue == 0 && Common.isNotNull(emp.getBankNo())
&& Common.isNotNull(emp.getIssueStatus())
&& CommonConstants.ONE_INT == emp.getIssueStatus()) {
checkBankInfoEmpList.add(emp);
}
entity.setEmpId(emp.getId());
entity.setEmpIdcard(emp.getEmpIdcard());
entity.setEmpName(emp.getEmpName());
entity.setEmpPhone(emp.getEmpPhone());
if (SalaryConstants.SALARY_STYLE_BANK.equals(salaryStyle) && salaryGiveTimeFlag) {
if (Common.isEmpty(emp.getBankName())) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
return true;
}
if (Common.isEmpty(emp.getBankNo())) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-银行卡号-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
return true;
}
if (Common.isEmpty(emp.getBankProvince())) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行省-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
return true;
}
if (Common.isEmpty(emp.getBankCity())) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行市-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
return true;
}
entity.setBankName(emp.getBankName());
entity.setBankNo(emp.getBankNo());
entity.setBankProvince(String.valueOf(emp.getBankProvince()));
entity.setBankCity(String.valueOf(emp.getBankCity()));
entity.setBankSubName(emp.getBankSubName());
} else {
if (Common.isNotNull(emp.getBankName())) {
entity.setBankName(emp.getBankName());
} else {
entity.setBankName(null);
}
if (Common.isNotNull(emp.getBankNo())) {
entity.setBankNo(emp.getBankNo());
} else {
entity.setBankNo(null);
}
if (Common.isNotNull(emp.getBankSubName())) {
entity.setBankSubName(emp.getBankSubName());
} else {
entity.setBankSubName(null);
}
if (Common.isNotNull(emp.getBankProvince())) {
entity.setBankProvince(String.valueOf(emp.getBankProvince()));
} else {
entity.setBankProvince(null);
}
if (Common.isNotNull(emp.getBankCity())) {
entity.setBankCity(String.valueOf(emp.getBankCity()));
} else {
entity.setBankCity(null);
}
}
if (!"3".equals(salaryType) && !"4".equals(salaryType)) {
if (emp.getTaxMonth().length() > CommonConstants.dingleDigitIntArray[6]) {
entity.setTaxMonth(emp.getTaxMonth().substring(0, 6));
} else if (emp.getTaxMonth().length() < CommonConstants.dingleDigitIntArray[6]) {
error = "第" + (i + 2) + "行:薪酬人员查询处-计税月份-长度小于6:" + entity.getTaxMonth() + ",请去薪酬人员查询处更新!在工资模板修改无效!";
errorList.add(new ErrorMessage((i + 2), error));
return true;
} else {
entity.setTaxMonth(emp.getTaxMonth());
}
if (DateUtil.compareYearMonth(entity.getTaxMonth(), nowMonth)) {
error = "第" + (i + 2) + "行:薪酬人员查询处-计税月份-大于当前年月或错误,请调整:" + entity.getTaxMonth();
errorList.add(new ErrorMessage((i + 2), error));
return true;
}
sai = new TSalaryAccountItemVo();
sai.setCnName(SalaryConstants.COST_REDUCTION);
sai.setJavaFiedName(SalaryConstants.COST_REDUCTION_JAVA);
sai.setSalaryMoney(DateUtil.getTaxMonthMoney(entity.getTaxMonth()));
sai.setIsTax(CommonConstants.ZERO_INT);
saiList.add(sai);
}
return false;
}
/**
* @Description: 处理表里人员相关数据
* @Author: hgw
......@@ -780,6 +832,143 @@ public class SalaryAccountUtil implements Serializable {
}
return R.ok(newEmp);
}
private boolean setNewEmpBase(TSalaryEmployee newEmp, int i, List<ErrorMessage> errorList, boolean notLabour
, TSalaryAccountVo entity, String salaryType, TSettleDomainSelectVo dept, YifuUser user, String salaryStyle
, boolean salaryGiveTimeFlag, String invoiceTitle) {
String newEmpStr = "新员工";
if (!notLabour) {
newEmpStr = "劳务费";
}
String error;
String nowMonth = DateUtil.addMonth(CommonConstants.ZERO_INT);
//增加工资人员档案:(临时使用)
if (newEmp != null) {
newEmp.setLineNums(i);
if (Common.isEmpty(newEmp.getEmpName())) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-姓名-不可为空!";
errorList.add(new ErrorMessage((i + 2), error));
return false;
}
if (Common.isEmpty(newEmp.getEmpIdcard())) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-身份证号-不可为空!";
errorList.add(new ErrorMessage((i + 2), error));
return false;
}
// 2021-8-31 hgw2.6.5新增手机号校验
if (Common.isEmpty(newEmp.getEmpPhone())) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-手机号码-不可为空!";
errorList.add(new ErrorMessage((i + 2), error));
return false;
} else if (!ValidityUtil.validateEmpPhone(newEmp.getEmpPhone())) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-手机号码格式错误:" + newEmp.getEmpPhone();
errorList.add(new ErrorMessage((i + 2), error));
return false;
}
} else {
newEmp = new TSalaryEmployee();
}
if (entity != null) {
if (!"3".equals(salaryType) && !"4".equals(salaryType)) {
if (Common.isEmpty(entity.getTaxMonth())) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-计税月份-不可为空!";
errorList.add(new ErrorMessage((i + 2), error));
return false;
} else if (entity.getTaxMonth().length() < CommonConstants.dingleDigitIntArray[6]) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-计税月份-长度小于6:" + entity.getTaxMonth();
errorList.add(new ErrorMessage((i + 2), error));
return false;
} else if (DateUtil.compareYearMonth(entity.getTaxMonth(), nowMonth)) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-计税月份-大于当前年月或错误,请调整:" + entity.getTaxMonth();
errorList.add(new ErrorMessage((i + 2), error));
return false;
} else {
newEmp.setTaxMonth(entity.getTaxMonth());
}
}
//工资发放方式(0现金/1银行)/2线下 && salaryGiveTime == true :立即发;false:暂停发:则不考虑开户行等
//银行+立即发,则考虑和开户行卡号
String areaStr;
if (SalaryConstants.SALARY_STYLE_BANK.equals(salaryStyle) && salaryGiveTimeFlag) {
if (Common.isEmpty(entity.getBankName())) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-开户行总行-不可为空!";
errorList.add(new ErrorMessage((i + 2), error));
return false;
} else {
newEmp.setBankName(entity.getBankName());
}
if (Common.isEmpty(entity.getBankProvince()) || Common.isEmpty(entity.getBankCity())) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-开户行省、市-不可为空!";
errorList.add(new ErrorMessage((i + 2), error));
return false;
} else {
areaStr = ExcelUtil.getRedisAreaValue(CacheConstants.AREA_VALUE + entity.getBankProvince().trim());
if (Common.isNotNull(areaStr)) {
newEmp.setBankProvince(areaStr);
} else {
error = "第" + (i + 2) + "行:" + newEmpStr + "-开户行省错误:" + entity.getBankProvince();
errorList.add(new ErrorMessage((i + 2), error));
return false;
}
areaStr = ExcelUtil.getRedisAreaValue(CacheConstants.AREA_VALUE + entity.getBankCity().trim()
+ CommonConstants.DOWN_LINE_STRING + entity.getBankProvince().trim());
if (Common.isNotNull(areaStr)) {
newEmp.setBankCity(areaStr);
} else {
error = "第" + (i + 2) + "行:" + newEmpStr + "-开户行市错误:" + entity.getBankCity();
errorList.add(new ErrorMessage((i + 2), error));
return false;
}
}
if (Common.isEmpty(entity.getBankNo())) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-银行卡号-不可为空!";
errorList.add(new ErrorMessage((i + 2), error));
return false;
} else {
newEmp.setBankNo(entity.getBankNo());
}
if (Common.isNotNull(entity.getBankSubName())) {
newEmp.setBankSubName(entity.getBankSubName());
}
} else {
if (Common.isNotNull(entity.getBankName())) {
newEmp.setBankName(entity.getBankName());
}
if (Common.isNotNull(entity.getBankNo())) {
newEmp.setBankNo(entity.getBankNo());
}
if (Common.isNotNull(entity.getBankSubName())) {
newEmp.setBankSubName(entity.getBankSubName());
}
if (Common.isNotNull(entity.getBankProvince())) {
areaStr = ExcelUtil.getRedisAreaValue(CacheConstants.AREA_VALUE + entity.getBankProvince().trim());
if (Common.isNotNull(areaStr)) {
newEmp.setBankProvince(areaStr);
}
if (Common.isNotNull(entity.getBankCity())) {
areaStr = ExcelUtil.getRedisAreaValue(CacheConstants.AREA_VALUE + entity.getBankCity().trim()
+ CommonConstants.DOWN_LINE_STRING + entity.getBankProvince().trim());
if (Common.isNotNull(areaStr)) {
newEmp.setBankCity(areaStr);
}
}
}
}
}
newEmp.setFileStatus(CommonConstants.ZERO_STRING); //临时
newEmp.setDeptId(dept.getId());
newEmp.setDeptName(dept.getDepartName());
newEmp.setDeptNo(dept.getDepartNo());
newEmp.setUnitId(dept.getCustomerId());
newEmp.setUnitName(dept.getCustomerName());
newEmp.setUnitNo(dept.getCustomerCode());
newEmp.setCreateBy(String.valueOf(user.getId()));
newEmp.setCreateName(user.getNickname());
newEmp.setInvoiceTitle(invoiceTitle);
return true;
}
/**
* 按类型统一返回String内容
*
......
......@@ -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