Commit b42cb475 authored by fangxinjiang's avatar fangxinjiang

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

parents 92705142 dc91a10a
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;
for (TSalaryAccountItem item : saiList) {
if (SalaryConstants.ACTUAL_SALARY_SUM_JAVA.equals(item.getJavaFiedName())) {
money = item.getSalaryMoney();
}
tSalaryAccountService.saveBatch(aList);
List<TSalaryAccountItem> saveSaiList = new ArrayList<>();
for (TSalaryAccount account : aList) {
saiList = account.getSaiList();
for (TSalaryAccountItem item : saiList) {
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);
}
......@@ -1723,6 +1668,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
.eq(TSalaryAccount::getEmpIdcard,a.getEmpIdcard())
.eq(TSalaryAccount::getFormType,CommonConstants.THREE_STRING)
.eq(TSalaryAccount::getSalaryMonth,a.getSalaryMonth())
.eq(TSalaryAccount::getInvoiceTitle,a.getInvoiceTitle())
.eq(TSalaryAccount::getDeleteFlag,CommonConstants.ZERO_INT));
// 本次实发
......
......@@ -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,51 +393,164 @@ 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) {
newEmpMap.put((i + 2), newEmp);
entityMap.put(newEmp.getEmpIdcard(), entity);
otherIdCard.add(newEmp.getEmpIdcard());
}
if (emp != null) {
if (setEntityByEmpInfo(dept, ownEmployeeMap, ownDeptMap, salaryType, isIssue, errorList
, entity, emp, saiList, salaryGiveTimeFlag, isNewEmployee, empName, salaryStyle
, nowMonth, updateEmpList, checkBankInfoEmpList, i))
continue;
} else if ("3".equals(salaryType) || "4".equals(salaryType)) {
error = "第" + (i + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、手机号码!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
} else {
emp = eR.getData();
}
if (saiList != null && !saiList.isEmpty()) {
entity.setSaiList(saiList);
}
if (Common.isEmpty(entity.getSalaryStyle())) {
entity.setSalaryStyle(salaryStyle);
}
SalaryCommonUtil.setConfigSalary(configSalary, entity);
// 填充基本数据
SalaryCommonUtil.setAccountBaseInfo(salaryType, dept, entity, salaryGiveTimeFlag);
if ("3".equals(salaryType)) {
if (CommonConstants.dingleDigitStrArray[1].equals(entity.getIsDeductSocial())
|| CommonConstants.dingleDigitStrArray[1].equals(entity.getIsDeductFund())) {
error = "第" + (i + 2) + "行:劳务费不可扣社保、公积金,请去除【是否扣除社保】列,或写【否】";
errorList.add(new ErrorMessage((i + 2), error));
continue;
} else {
if ("4".equals(salaryType)) {
error = "第" + (i + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、手机号码!";
entity.setIsDeductSocial("0");
entity.setIsDeductFund("0");
}
}
//验证扣社保以及扣公积金时的关联关系
if (CommonConstants.dingleDigitStrArray[1].equals(entity.getIsDeductSocial()) && Common.isEmpty(entity.getDeduSocialMonth())) {
error = "第" + (i + 2) + "行:扣社保无社保扣缴月份";
errorList.add(new ErrorMessage((i + 2), error));
continue;
} else if (notLabour) {
error = "第" + (i + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、计税月份、手机号码!";
}
if (CommonConstants.dingleDigitStrArray[1].equals(entity.getIsDeductFund()) && Common.isEmpty(entity.getDeduProvidentMonth())) {
error = "第" + (i + 2) + "行:扣公积金无公积金扣缴月份";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
entity.setInvoiceTitle(invoiceTitle);
if (entity != null) {
tList.add(entity);
}
}
if (emp != null) {
}
// 统一处理连接查询
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();
log.error("将jsonString数据源的数据导入到list异常!");
throw new ExcelException("工资导入-将jsonString数据源的数据导入到list异常!", e);
}
this.setEntityList(tList);
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));
continue;
return true;
} else if (Common.isEmpty(empName)) {
error = "第" + (i + 2) + "行:模板-员工姓名-为空,请添加员工姓名列!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
return true;
} else if (!empName.equals(emp.getEmpName())) {
error = "第" + (i + 2) + "行:员工-姓名与身份证-不匹配,请确认薪酬人员查询处信息!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
return true;
}
if (Common.isEmpty(emp.getEmpPhone())) {
error = "第" + (i + 2) + "行:薪酬人员查询处-手机号码-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
return true;
} else if (!ValidityUtil.validateEmpPhone(emp.getEmpPhone())) {
error = "第" + (i + 2) + "行:薪酬人员查询处-手机号码格式错误,请去薪酬人员查询处更新:" + emp.getEmpPhone();
errorList.add(new ErrorMessage((i + 2), error));
continue;
return true;
}
if (Common.isEmpty(emp.getTaxMonth()) && !"3".equals(salaryType) && !"4".equals(salaryType)) {
if (Common.isNotNull(entity.getTaxMonth())) {
......@@ -449,19 +559,19 @@ public class SalaryAccountUtil implements Serializable {
} else if (entity.getTaxMonth().length() < CommonConstants.dingleDigitIntArray[6]) {
error = "第" + (i + 2) + "行:工资模板里-计税月份-长度小于6:" + entity.getTaxMonth() + ",请在工资模板修改!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
return true;
}
if (DateUtil.compareYearMonth(entity.getTaxMonth(), nowMonth)) {
error = "第" + (i + 2) + "行:工资模板里-计税月份-大于当前年月或错误,请调整:" + entity.getTaxMonth();
errorList.add(new ErrorMessage((i + 2), error));
continue;
return true;
}
emp.setTaxMonth(entity.getTaxMonth());
tSalaryEmployeeService.updateById(emp);
updateEmpList.add(emp);
} else {
error = "第" + (i + 2) + "行:薪酬人员查询处-计税月份-为空,请在工资模板填写-计税月份-列的内容!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
return true;
}
}
if (ownEmployeeMap.get(emp.getEmpIdcard()) != null
......@@ -480,14 +590,9 @@ public class SalaryAccountUtil implements Serializable {
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;
}
checkBankInfoEmpList.add(emp);
}
entity.setEmpId(emp.getId());
entity.setEmpIdcard(emp.getEmpIdcard());
entity.setEmpName(emp.getEmpName());
......@@ -496,22 +601,22 @@ public class SalaryAccountUtil implements Serializable {
if (Common.isEmpty(emp.getBankName())) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
return true;
}
if (Common.isEmpty(emp.getBankNo())) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-银行卡号-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
return true;
}
if (Common.isEmpty(emp.getBankProvince())) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行省-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
return true;
}
if (Common.isEmpty(emp.getBankCity())) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行市-为空,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
return true;
}
entity.setBankName(emp.getBankName());
entity.setBankNo(emp.getBankNo());
......@@ -551,14 +656,14 @@ public class SalaryAccountUtil implements Serializable {
} else if (emp.getTaxMonth().length() < CommonConstants.dingleDigitIntArray[6]) {
error = "第" + (i + 2) + "行:薪酬人员查询处-计税月份-长度小于6:" + entity.getTaxMonth() + ",请去薪酬人员查询处更新!在工资模板修改无效!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
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));
continue;
return true;
}
sai = new TSalaryAccountItemVo();
sai.setCnName(SalaryConstants.COST_REDUCTION);
......@@ -567,60 +672,7 @@ public class SalaryAccountUtil implements Serializable {
sai.setIsTax(CommonConstants.ZERO_INT);
saiList.add(sai);
}
} else {
if ("3".equals(salaryType) || "4".equals(salaryType)) {
error = "第" + (i + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、手机号码!";
} else {
error = "第" + (i + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、计税月份、手机号码!";
}
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
if (saiList != null && !saiList.isEmpty()) {
entity.setSaiList(saiList);
}
if (Common.isEmpty(entity.getSalaryStyle())) {
entity.setSalaryStyle(salaryStyle);
}
SalaryCommonUtil.setConfigSalary(configSalary, entity);
// 填充基本数据
SalaryCommonUtil.setAccountBaseInfo(salaryType, dept, entity, salaryGiveTimeFlag);
if ("3".equals(salaryType)) {
if (CommonConstants.dingleDigitStrArray[1].equals(entity.getIsDeductSocial())
|| CommonConstants.dingleDigitStrArray[1].equals(entity.getIsDeductFund())) {
error = "第" + (i + 2) + "行:劳务费不可扣社保、公积金,请去除【是否扣除社保】列,或写【否】";
errorList.add(new ErrorMessage((i + 2), error));
continue;
} else {
entity.setIsDeductSocial("0");
entity.setIsDeductFund("0");
}
}
//验证扣社保以及扣公积金时的关联关系
if (CommonConstants.dingleDigitStrArray[1].equals(entity.getIsDeductSocial()) && Common.isEmpty(entity.getDeduSocialMonth())) {
error = "第" + (i + 2) + "行:扣社保无社保扣缴月份";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
if (CommonConstants.dingleDigitStrArray[1].equals(entity.getIsDeductFund()) && Common.isEmpty(entity.getDeduProvidentMonth())) {
error = "第" + (i + 2) + "行:扣公积金无公积金扣缴月份";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
entity.setInvoiceTitle(invoiceTitle);
if (entity != null) {
tList.add(entity);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("将jsonString数据源的数据导入到list异常!");
throw new ExcelException("工资导入-将jsonString数据源的数据导入到list异常!", e);
}
this.setEntityList(tList);
this.setErrorInfo(errorList);
return false;
}
/**
......@@ -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
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 社保合并推送id记录表
*
* @author huyc
* @date 2023-2-9 16:11:24
*/
@Data
@TableName("t_send_ekp_error")
@Schema(description = "社保合并推送id记录表")
public class TPaymentSocialPush {
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
@Schema(description = "社保明细id拼接字符")
private String paymentIds;
@Schema(description = "结算状态0 已结算 1 未结算")
private Integer status;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 缴费库合并推送参数
* @author huyc
* @date 2023-2-10 10:01:22
*/
@Data
public class TPaymentInfoPushVo implements Serializable {
/**
* 主键
*/
@Schema(description ="主键")
private String id;
/**
* 主键拼接
*/
@Schema(description ="主键拼接")
private String ids;
/**
* 员工姓名
*/
@ExcelAttribute(name = "员工姓名" )
@Schema(description ="员工姓名")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("员工姓名")
private String empName;
/**
* 身份证号
*/
@ExcelAttribute(name = "身份证号" )
@Schema(description ="身份证号")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("身份证号")
private String empIdcard;
/**
* 客户名称
*/
@ExcelAttribute(name = "客户名称" )
@Schema(description ="客户名称")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("客户名称")
private String unitName;
/**
* 项目名称
*/
@ExcelAttribute(name = "项目名称" )
@Schema(description ="项目名称")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("项目名称")
private String settleDomainName;
/**
* 项目编码
*/
@ExcelAttribute(name = "项目编码", maxLength = 50)
@Schema(description = "项目编码" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("项目编码" )
private String settleDomainCode;
/**
* 社保户
*/
@ExcelAttribute(name = "社保户" )
@Schema(description ="社保户")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保户")
private String socialHousehold;
/**
* 社保缴纳地
*/
@ExcelAttribute(name = "社保缴纳地" )
@Schema(description ="社保缴纳地")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保缴纳地")
private String socialPayAddr;
/**
* 社保缴纳月份
*/
@ExcelAttribute(name = "社保缴纳月份")
@Schema(description ="社保缴纳月份")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保缴纳月份")
private String socialPayMonth;
/**
* 社保生成月份
*/
@ExcelAttribute(name = "社保生成月份")
@Schema(description ="社保生成月份")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保生成月份")
private String socialCreateMonth;
/**
* 总合计
*/
@ExcelAttribute(name = "总合计" )
@Schema(description ="总合计")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("总合计")
private BigDecimal sumAll;
/**
* 社保合计
*/
@ExcelAttribute(name = "社保合计" )
@Schema(description ="社保合计")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保合计")
private BigDecimal socialSum;
/**
* 单位社保合计
*/
@ExcelAttribute(name = "单位社保合计" )
@Schema(description ="单位社保合计")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("单位社保合计")
private BigDecimal unitSocialSum;
/**
* 个人社保合计
*/
@ExcelAttribute(name = "个人社保合计" )
@Schema(description ="个人社保合计")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("个人社保合计")
private BigDecimal socialSecurityPersonalSum;
/**
* 单位社保补缴利息
*/
@ExcelAttribute(name = "单位社保补缴利息" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("单位社保补缴利息")
private BigDecimal companyAccrual;
/**
* 个人社保补缴利息
*/
@ExcelAttribute(name = "个人社保补缴利息" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("个人社保补缴利息")
private BigDecimal personalAccrual;
/**
* 单位养老金额
*/
@ExcelAttribute(name = "单位养老金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("单位养老金额")
private BigDecimal unitPensionMoney;
/**
* 单位医疗金额
*/
@ExcelAttribute(name = "单位医疗金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("单位医疗金额")
private BigDecimal unitMedicalMoney;
/**
* 单位失业金额
*/
@ExcelAttribute(name = "单位失业金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("单位失业金额")
private BigDecimal unitUnemploymentMoney;
/**
* 单位工伤金额
*/
@ExcelAttribute(name = "单位工伤金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("单位工伤金额")
private BigDecimal unitInjuryMoney;
/**
* 单位生育金额
*/
@ExcelAttribute(name = "单位生育金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("单位生育金额")
private BigDecimal unitBirthMoney;
/**
* 单位大病金额
*/
@ExcelAttribute(name = "单位大病金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("单位大病金额")
private BigDecimal unitBigmailmentMoney;
/**
* 个人养老金额
*/
@ExcelAttribute(name = "个人养老金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("个人养老金额")
private BigDecimal personalPensionMoney;
/**
* 个人医疗金额
*/
@ExcelAttribute(name = "个人医疗金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("个人医疗金额")
private BigDecimal personalMedicalMoney;
/**
* 个人失业金额
*/
@ExcelAttribute(name = "个人失业金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("个人失业金额")
private BigDecimal personalUnemploymentMoney;
/**
* 个人大病金额
*/
@ExcelAttribute(name = "个人大病金额")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("个人大病金额")
private BigDecimal personalBigmailmentMoney;
/**
* 社保创建人姓名
*/
@ExcelAttribute(name = "社保创建人姓名")
@Schema(description = "社保创建人姓名")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保创建人姓名")
private String createName;
/**
* 创建时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 社保合并推送id记录表
*
* @author huyc
* @date 2023-2-9 16:11:24
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/tpaymentsocialpush")
@Tag(name = "社保合并推送id记录表")
public class TPaymentSocialPushController {
}
......@@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentBySalaryVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.UpdateSocialFoundVo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo;
......@@ -67,6 +69,20 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
*/
Integer selectCountSumPaymentInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
/**
* 缴费库简单分页查询
* @param searchVo 缴费库
* @return
*/
List<TPaymentInfoPushVo> getTPaymentInfoSumPushList(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
/**
* 缴费库合并导出查询
* @param searchVo 缴费库
* @return
*/
Integer getTPaymentInfoSumPushCount(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
/**
* 缴费库简单分页查询
* @param searchVo 缴费库
......@@ -95,6 +111,8 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
**/
TPaymentInfoVo getAllInfoById(String id);
List<TPaymentInfo> getAllPushInfoById(@Param("idStr") String idStr);
/*
* 已存在社保缴费库数据 非删除状态
* @param months
......@@ -168,14 +186,6 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
*/
List<String> getTPaymentInfoList(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
/**
* 缴费库社保推送查询
* @param searchVo 缴费库
* @return
*/
List<TPaymentInfo> getTPaymentSocialPushInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo,
@Param("userId") String userId);
/**
* 缴费库公积金推送查询
* @param searchVo 缴费库
......@@ -206,14 +216,6 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
void updateBySocialIncomeFlag(@Param("id")String id);
/**
* 缴费库社保推送查询
* @param searchVo 缴费库
* @return
*/
long getTPaymentSocialPushCount(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo,
@Param("userId") String userId);
/**
* 缴费库公积金推送查询
* @param searchVo 缴费库
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentSocialPush;
import org.apache.ibatis.annotations.Mapper;
/**
* error存储
*
* @author hgw
* @date 2022-9-7 16:28:46
*/
@Mapper
public interface TPaymentSocialPushMapper extends BaseMapper<TPaymentSocialPush> {
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentSocialPush;
/**
* 收入明细表
*
* @author huyc
* @date 2023-2-9 16:11:24
*/
public interface TPaymentSocialPushService extends IService<TPaymentSocialPush> {
}
......@@ -132,6 +132,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Autowired
private DoJointSocialTask doJointSocialTask;
@Autowired
private TPaymentSocialPushMapper pushMapper;
/**
* 缴费库简单分页查询
*
......@@ -2746,19 +2749,13 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override
public void createPaymentSocialInfo() {
//获取所有未推送的社保实缴明细数据
long count = baseMapper.selectCount(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getPushStatus, CommonConstants.ONE_STRING)
.eq(TPaymentInfo::getLockStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getSocialId));
long count = baseMapper.getTPaymentInfoSumPushCount(null);
if (count > 0) {
List<TPaymentInfo> unPushs;
List<TPaymentInfoPushVo> unPushs;
int i = (int) Math.ceil((double) count / CommonConstants.TEN_THOUSAND_INT);
Map<String, TSettleDomainSelectVo> mapSelectVo = this.getSelectVoMap();
for (int j = 0; j < i; j++) {
unPushs = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getPushStatus, CommonConstants.ONE_STRING)
.eq(TPaymentInfo::getLockStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getSocialId).last(" limit 0,10000"));
unPushs = baseMapper.getTPaymentInfoSumPushList(null);
synchronized (this) {
if (Common.isNotNull(unPushs)) {
//推送数据封装并推送
......@@ -2952,13 +2949,13 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
public void createPaymentSocialInfoReal(YifuUser user, TPaymentInfoSearchVo searchVo,
Map<String, TSettleDomainSelectVo> mapSelectVo) {
//获取所有未推送的社保实缴明细数据
searchVo.setLockStatus(CommonConstants.ONE_STRING);
long count = baseMapper.getTPaymentSocialPushCount(searchVo, user.getId());
searchVo.setCreateBy(user.getId());
long count = baseMapper.getTPaymentInfoSumPushCount(searchVo);
if (count > 0) {
List<TPaymentInfo> unPushInfo;
List<TPaymentInfoPushVo> unPushInfo;
int i = (int) Math.ceil((double) count / CommonConstants.TEN_THOUSAND_INT);
for (int j = 0; j < i; j++) {
unPushInfo = baseMapper.getTPaymentSocialPushInfo(searchVo, user.getId());
unPushInfo = baseMapper.getTPaymentInfoSumPushList(searchVo);
synchronized (this) {
if (Common.isNotNull(unPushInfo)) {
//推送数据封装并推送
......@@ -3349,12 +3346,36 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override
public Boolean updateSocialSettleStatus(List<EkpSocialViewVo> viewVoList) {
if (!viewVoList.isEmpty()) {
TPaymentInfo paymentInfo;
TForecastLibrary library;
List<TPaymentInfo> sUpdateList = new ArrayList<>();
List<TPaymentInfo> zSpdateList = new ArrayList<>();
TPaymentSocialPush socialPush;
TPaymentInfo paymentInfo;
try {
for (EkpSocialViewVo viewVo : viewVoList) {
//判断预估还是实缴
if (viewVo.getSettleFlag().contains(SocialConstants.DIFF_TYPE_THR)) {
socialPush = pushMapper.selectById(viewVo.getId());
//根据明细id更新结算状态
if (null != socialPush) {
List<TPaymentInfo> paymentList = baseMapper.getAllPushInfoById(socialPush.getPaymentIds());
if (!paymentList.isEmpty()) {
for (TPaymentInfo tPaymentInfo : paymentList) {
//判断是收入还是支出结算单号
if (CommonConstants.ZERO_STRING.equals(viewVo.getPayFlag())) {
tPaymentInfo.setIncomeSettleFlag(viewVo.getIncomeSettleFlag());
tPaymentInfo.setIncomeCollectFlag(viewVo.getIncomeCollectFlag());
sUpdateList.add(tPaymentInfo);
} else {
tPaymentInfo.setPaySettleFlag(viewVo.getPaySettleFlag());
tPaymentInfo.setPayCollectFlag(viewVo.getPayCollectFlag());
zSpdateList.add(tPaymentInfo);
}
log.info("缴费库实缴费用状态更新");
}
}
} else {
//根据明细id更新结算状态
paymentInfo = baseMapper.selectById(viewVo.getId());
if (Common.isNotNull(paymentInfo)) {
......@@ -3369,6 +3390,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
baseMapper.updateStatusById(paymentInfo);
log.info("缴费库实缴费用状态更新");
}
}
} else if (viewVo.getSettleFlag().contains(SocialConstants.DIFF_TYPE_ONE)) {
//根据明细id更新结算状态
library = tForecastLibraryMapper.selectById(viewVo.getId());
......@@ -3385,6 +3407,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
}
if (!sUpdateList.isEmpty()) {
this.updateBatchById(sUpdateList);
}
if (!zSpdateList.isEmpty()) {
this.updateBatchById(zSpdateList);
}
} catch (Exception e) {
log.error("更新社保结算状态失败", e);
return false;
......
......@@ -14,23 +14,19 @@ import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamRisk;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpPushFundParam;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpPushSocialParam;
import com.yifu.cloud.plus.v1.yifu.social.constants.SocialConstants;
import com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncome;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError;
import com.yifu.cloud.plus.v1.yifu.social.entity.*;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TForecastLibraryMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TIncomeMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TPaymentInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TPaymentSocialPushMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TSendEkpErrorService;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoPushVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 主要执行人员档案的员工类型同步更新
......@@ -63,6 +59,9 @@ public class DoJointSocialTask {
@Autowired
private TForecastLibraryMapper forecastLibraryMapper;
@Autowired
private TPaymentSocialPushMapper socialPushMapper;
@Autowired
private RedisUtil redisUtil;
......@@ -428,12 +427,14 @@ public class DoJointSocialTask {
* @return: void
**/
@Async
public void asynchronousEkpPaymentSocial(List<TPaymentInfo> unPushInfo, Map<String, TSettleDomainSelectVo> mapSelectVo) {
public void asynchronousEkpPaymentSocial(List<TPaymentInfoPushVo> unPushInfo, Map<String, TSettleDomainSelectVo> mapSelectVo) {
log.info("推送社保实缴费用到EKP-线程开始");
TSettleDomain settleDomain;
EkpPushSocialParam socialParam;
TPaymentSocialPush a;
List<EkpPushSocialParam> paramList = new ArrayList<>();
for (TPaymentInfo library : unPushInfo) {
Map<String,String> idMap = new HashMap<>();
for (TPaymentInfoPushVo library : unPushInfo) {
try {
//获取项目信息
if (Common.isNotNull(mapSelectVo)) {
......@@ -668,9 +669,14 @@ public class DoJointSocialTask {
String body = ekpSocialUtil.sendToEKP(socialParam);
if (Common.isEmpty(body) || body.length() != 32) {
paramList.add(socialParam);
idMap.put(library.getId(), library.getIds());
}
if (Common.isNotNull(body) && body.length() == 32) {
paymentInfoMapper.updateBySocialPayment(library.getId());
a = new TPaymentSocialPush();
a.setId(library.getId());
a.setPaymentIds(library.getIds());
socialPushMapper.insert(a);
} else {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
......@@ -702,6 +708,10 @@ public class DoJointSocialTask {
String body = ekpSocialUtil.sendToEKP(s);
if (Common.isNotNull(body) && body.length() == 32) {
paymentInfoMapper.updateBySocialPayment(s.getFd_3b0afbe1f94a08());
a = new TPaymentSocialPush();
a.setId(s.getFd_3b0afbe1f94a08());
a.setPaymentIds(idMap.get(s.getFd_3b0afbe1f94a08()));
socialPushMapper.insert(a);
} else {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
......@@ -727,6 +737,7 @@ public class DoJointSocialTask {
}
}
}
idMap.clear();
log.info("推送社保实缴费用到EKP结束");
}
......
......@@ -158,6 +158,36 @@
<result property="keyGroup" column="keyGroup"/>
</resultMap>
<resultMap id="tPaymentInfoSumPushMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoPushVo">
<result property="ids" column="ids"/>
<result property="id" column="ID"/>
<result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="unitName" column="UNIT_NAME"/>
<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
<result property="settleDomainCode" column="SETTLE_DOMAIN_CODE"/>
<result property="socialHousehold" column="SOCIAL_HOUSEHOLD"/>
<result property="socialPayAddr" column="SOCIAL_PAY_ADDR"/>
<result property="socialPayMonth" column="SOCIAL_PAY_MONTH"/>
<result property="socialCreateMonth" column="SOCIAL_CREATE_MONTH"/>
<result property="sumAll" column="SUM_ALL"/>
<result property="socialSum" column="SOCIAL_SUM"/>
<result property="unitSocialSum" column="UNIT_SOCIAL_SUM"/>
<result property="socialSecurityPersonalSum" column="SOCIAL_SECURITY_PERSONAL_SUM"/>
<result property="companyAccrual" column="COMPANY_ACCRUAL"/>
<result property="personalAccrual" column="PERSONAL_ACCRUAL"/>
<result property="unitPensionMoney" column="UNIT_PENSION_MONEY"/>
<result property="unitMedicalMoney" column="UNIT_MEDICAL_MONEY"/>
<result property="unitUnemploymentMoney" column="UNIT_UNEMPLOYMENT_MONEY"/>
<result property="unitInjuryMoney" column="UNIT_INJURY_MONEY"/>
<result property="unitBirthMoney" column="UNIT_BIRTH_MONEY"/>
<result property="unitBigmailmentMoney" column="UNIT_BIGMAILMENT_MONEY"/>
<result property="personalPensionMoney" column="PERSONAL_PENSION_MONEY"/>
<result property="personalMedicalMoney" column="PERSONAL_MEDICAL_MONEY"/>
<result property="personalUnemploymentMoney" column="PERSONAL_UNEMPLOYMENT_MONEY"/>
<result property="personalBigmailmentMoney" column="PERSONAL_BIGMAILMENT_MONEY"/>
</resultMap>
<resultMap id="tPaymentInfoBatchMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoBatchVo">
<result property="empName" column="EMP_NAME"/>
<result property="empNo" column="EMP_NO"/>
......@@ -612,6 +642,9 @@
<if test="tPaymentInfo.lockStatus != null and tPaymentInfo.lockStatus.trim() != ''">
AND a.LOCK_STATUS = #{tPaymentInfo.lockStatus}
</if>
<if test="tPaymentInfo.createBy != null and tPaymentInfo.createBy.trim() != ''">
AND a.CREATE_BY = #{tPaymentInfo.createBy}
</if>
</if>
</if>
</sql>
......@@ -796,7 +829,7 @@
a.ID
FROM t_payment_info a
<where>
a.LOCK_STATUS = '0' AND a.CREATE_BY = #{tPaymentInfo.createBy}
a.LOCK_STATUS = '0'
<include refid="tPaymentInfo_export_where"/>
</where>
</select>
......@@ -1015,6 +1048,59 @@
GROUP BY w.keyGroup) c
</select>
<!--tPaymentInfo合并查询-->
<select id="getTPaymentInfoSumPushList" resultMap="tPaymentInfoSumPushMap">
SELECT
a.ID,
GROUP_CONCAT("'",a.ID,"'") as ids,
a.EMP_NAME,
a.EMP_IDCARD,
a.UNIT_NAME,
a.SETTLE_DOMAIN_CODE,
a.SETTLE_DOMAIN_NAME,
a.SOCIAL_HOUSEHOLD,
a.SOCIAL_PAY_ADDR,
a.SOCIAL_PAY_MONTH,
a.SOCIAL_CREATE_MONTH,
SUM( a.SUM_ALL ) AS SUM_ALL,
SUM( a.SOCIAL_SUM ) AS SOCIAL_SUM,
SUM( a.UNIT_SOCIAL_SUM ) AS UNIT_SOCIAL_SUM,
SUM( a.SOCIAL_SECURITY_PERSONAL_SUM ) AS SOCIAL_SECURITY_PERSONAL_SUM,
SUM( a.COMPANY_ACCRUAL ) AS COMPANY_ACCRUAL,
SUM( a.PERSONAL_ACCRUAL ) AS PERSONAL_ACCRUAL,
SUM( a.UNIT_PENSION_MONEY ) AS UNIT_PENSION_MONEY,
SUM( a.UNIT_MEDICAL_MONEY ) AS UNIT_MEDICAL_MONEY,
SUM( a.UNIT_UNEMPLOYMENT_MONEY ) AS UNIT_UNEMPLOYMENT_MONEY,
SUM( a.UNIT_INJURY_MONEY ) AS UNIT_INJURY_MONEY,
SUM( a.UNIT_BIRTH_MONEY ) AS UNIT_BIRTH_MONEY,
SUM( a.UNIT_BIGMAILMENT_MONEY ) AS UNIT_BIGMAILMENT_MONEY,
SUM( a.PERSONAL_PENSION_MONEY ) AS PERSONAL_PENSION_MONEY,
SUM( a.PERSONAL_MEDICAL_MONEY ) AS PERSONAL_MEDICAL_MONEY,
SUM( a.PERSONAL_UNEMPLOYMENT_MONEY ) AS PERSONAL_UNEMPLOYMENT_MONEY,
SUM( a.PERSONAL_BIGMAILMENT_MONEY ) AS PERSONAL_BIGMAILMENT_MONEY,
a.CREATE_NAME,
a.CREATE_TIME
FROM t_payment_info a
<where>
IFNULL(a.SOCIAL_ID,'1') != '1' and a.PUSH_STATUS = '1' and a.LOCK_STAUTS = '1'
<include refid="tPaymentInfo_export_where"/>
</where>
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
limit 0,10000
</select>
<!--tPaymentInfo合并查询-->
<select id="getTPaymentInfoSumPushCount" resultType="java.lang.Integer">
SELECT
count (1)
FROM t_payment_info a
<where>
IFNULL(a.SOCIAL_ID,'1') != '1' and a.PUSH_STATUS = '1' and a.LOCK_STAUTS = '1'
<include refid="tPaymentInfo_export_where"/>
</where>
GROUP BY a.EMP_IDCARD,a.SOCIAL_PAY_MONTH,a.SOCIAL_CREATE_MONTH
</select>
<update id="updateDeleteInfo">
update t_payment_info
<trim prefix="SET" suffixOverrides=",">
......@@ -1091,6 +1177,14 @@
where a.ID = #{id}
</select>
<!--tPaymentInfo 按ID查收缴费库包含社保和公积金明细的数据查询-->
<select id="getAllPushInfoById" resultMap="tPaymentInfoMap">
SELECT
*
FROM t_payment_info a
where a.ID in (${idStr})
</select>
<select id="selectListForPaymentImport" resultMap="tPaymentInfoMap">
SELECT
<include refid="Base_Column_List"/>
......@@ -1265,18 +1359,6 @@
</foreach>
</update>
<!--tPaymentInfo社保推送查询-->
<select id="getTPaymentSocialPushInfo" resultMap="tPaymentInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_payment_info a
<where>
a.PUSH_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId}
<include refid="tPaymentInfo_export_where"/>
</where>
limit 0,10000
</select>
<!--tPaymentInfo公积金推送查询-->
<select id="getTPaymentFundPushInfo" resultMap="tPaymentInfoMap">
SELECT
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.social.mapper.TPaymentSocialPushMapper">
<resultMap id="tSendEkpErrorMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentSocialPush">
<id property="id" column="ID"/>
<result property="paymentIds" column="PAYMENT_IDS"/>
<result property="status" column="STATUS"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.PAYMENT_IDS,
a.STATUS
</sql>
<sql id="tPaymentSocialPush_where">
<if test="tPaymentSocialPush != null">
<if test="tPaymentSocialPush.id != null and tPaymentSocialPush.id.trim() != ''">
AND a.ID = #{tSendEkpError.id}
</if>
<if test="tPaymentSocialPush.paymentIds != null and tPaymentSocialPush.paymentIds.trim() != ''">
AND a.PAYMENT_IDS = #{tPaymentSocialPush.paymentIds}
</if>
<if test="tPaymentSocialPush.status == null">
AND a.STATUS = #{tPaymentSocialPush.status}
</if>
</if>
</sql>
</mapper>
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