Commit 52feaec1 authored by hongguangwu's avatar hongguangwu

继续优化薪资导入

parent ebcfc25b
......@@ -27,13 +27,13 @@ public class SalaryConstants {
public static final int idCardLength = 18;
public static final String NON_TAX = "非扣税项";
/*
* @Description: 0待提交1待审核 3待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印
* @Description: 0待提交1待审核2已审核待推送 3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印
* @Author: hgw
* @Date: 2019/10/10 14:55
* @return:
**/
public static final Integer[] AUDIT_STATUS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
public static final String[] AUDIT_STATUS_STRING = {"待提交", "待审核", "-", "待发放", "已发放", "审核不通过", "确认不通过", "财务退回", "结算单调整待审核", "结算单调整待打印"};
public static final Integer[] AUDIT_STATUS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
public static final String[] AUDIT_STATUS_STRING = {"待提交", "待审核", "已审核待推送", "已推送待发放", "已发放", "审核不通过", "确认不通过", "财务退回", "结算单调整待审核", "结算单调整待打印", "推送失败"};
//发放失败-认领状态 0待认领1待出账2已发放3再次失败待认领
public static final Integer[] LOST_STATUS = {0, 1, 2, 3};
//申请垫付流程状态( 0:未申请 1已申请 2申请不通过 3申请已通过)
......
......@@ -135,9 +135,9 @@ public class TSalaryStandard extends BaseEntity {
/**
* 状态(0待提交1待审核2:待推送3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印)
*/
@ExcelAttribute(name = "状态(0待提交1待审核2:待推送3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印)", isNotEmpty = true, errorInfo = "状态(0待提交1待审核2:待推送3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印)不能为空")
@NotBlank(message = "状态(0待提交1待审核2:待推送3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印)不能为空")
@ExcelProperty("状态(0待提交1待审核2:待推送3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印)")
@ExcelAttribute(name = "状态(0待提交1待审核2:待推送3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印10 推送失败)", isNotEmpty = true, errorInfo = "状态(0待提交1待审核2:待推送3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印)不能为空")
@NotBlank(message = "状态(0待提交1待审核2:待推送3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印10 推送失败)不能为空")
@ExcelProperty("状态(0待提交1待审核2:待推送3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印 10 推送失败)")
private Integer status;
/**
* 提交时间
......
......@@ -97,8 +97,8 @@ public class TSalaryStandardController {
@SysLog("通过id删除标准薪酬工资表")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('salary_tsalarystandard_del')")
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(tSalaryStandardService.removeById(id));
public R<String> removeById(@PathVariable String id) {
return tSalaryStandardService.deleteSalaryById(id);
}
/**
......
......@@ -64,9 +64,9 @@ public class TSalaryStandardSetController {
* @param tSalaryStandardSet
* @return R
*/
@Operation(description = "新增或修改(wxhr:tsalarystandardset_add)")
@Operation(description = "新增或修改(tsalarystandardset_add)")
@PostMapping("/saveOrUptateSet")
@PreAuthorize("@pms.hasPermission('wxhr:tsalarystandardset_add')")
@PreAuthorize("@pms.hasPermission('tsalarystandardset_add')")
public R<TSalaryStandardSet> saveOrUptateSet(@RequestBody TSalaryStandardSet tSalaryStandardSet) {
return tSalaryStandardSetService.saveOrUpdateSet(tSalaryStandardSet);
}
......@@ -77,10 +77,10 @@ public class TSalaryStandardSetController {
* @param id
* @return R
*/
@Operation(description = "删除(wxhr:tsalarystandardset_del)")
@Operation(description = "删除(tsalarystandardset_del)")
@SysLog("删除薪资工资条配置主表")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('wxhr:tsalarystandardset_del')")
@PreAuthorize("@pms.hasPermission('tsalarystandardset_del')")
public R<Boolean> removeById(@PathVariable String id) {
tSalaryStandardSetDetailService.remove(Wrappers.<TSalaryStandardSetDetail>query().lambda().eq(TSalaryStandardSetDetail::getSetId, id));
return new R<>(tSalaryStandardSetService.removeById(id));
......
......@@ -65,4 +65,13 @@ public interface TSalaryStandardService extends IService<TSalaryStandard> {
* @return
*/
R salaryStandardAudit(String auditFlag, String AuditRemark,String id);
/**
* @Description: 删除工资表
* @Author: hgw
* @Date: 2022/8/12 16:01
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> deleteSalaryById(String id);
}
......@@ -12,7 +12,8 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.*;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSocialProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.constants.SalaryConstants;
......@@ -237,7 +238,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
if (Common.isNotNull(user.getDeptName())) {
s.setBelongDeptCode(user.getDeptName());
} else {
s.setBelongDeptCode("未获取到员工的departCode");
s.setBelongDeptCode("未获取到员工的DeptName");
}
s.setCreateTime(nowTime);
s.setDeleteFlag(SalaryConstants.NOT_DELETE);
......@@ -486,8 +487,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
} else {
deptSet = deptSetR.getData();
}
Map<String, String> bankNameMap = new HashMap<>();
String bankName, bankNameAll = "";
int size = savList.size();
TSalaryAccountItem annousSai;
// 自有员工人数
......@@ -529,16 +528,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
annousSai = null;
try {
SalaryAccountUtil.reflectionAttr(savList.get(i), a);
if (SalaryConstants.SALARY_STYLE_BANK.equals(a.getSalaryStyle()) && Common.isNotNull(a.getBankName())) {
bankName = a.getBankName();
if (bankName.contains("行")) {
bankName = bankName.substring(0, bankName.indexOf("行")) + "行";
}
if (Common.isEmpty(bankNameMap.get(bankName))) {
bankNameMap.put(bankName, "1");
bankNameAll += bankName + ";";
}
}
checkYearFinalStyle = a.getAnnualBonusType();
if (Common.isNotNull(a.getTaxMonth())) {
maxYearMonth = DateUtil.getMaxYearMonth(a.getTaxMonth());
......@@ -770,9 +759,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
}
salary.setOwnNums(ownNum);
salary.setOwnMoney(ownMoney);
/*if (Common.isNotNull(bankNameAll) && bankNameAll.length() > 1000) {
return R.failed("请检查档案的开户行与卡号是否反了,封面的开户行已超长!");
}*/
TSalaryDetailVo salaryDetailVo = new TSalaryDetailVo();
salaryDetailVo.setSalaryAccountList(aList);
......
......@@ -24,6 +24,7 @@ import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -31,11 +32,10 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TApprovalRecord;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard;
import com.yifu.cloud.plus.v1.yifu.salary.constants.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.entity.*;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryStandardMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TApprovalRecordService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardService;
import com.yifu.cloud.plus.v1.yifu.salary.service.*;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardExportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardVo;
......@@ -47,9 +47,10 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.time.LocalDateTime;
import java.util.*;
/**
* 标准薪酬工资表
......@@ -64,6 +65,15 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
@Autowired
private TApprovalRecordService approvalRecordService;
@Autowired
private TSalaryAccountService salaryAccountService;
@Autowired
private MSalaryEstimateService mSalaryEstimateService;
@Autowired
private MSalaryPaymentResService salaryPaymentResService;
/**
* 标准薪酬工资表简单分页查询
*
......@@ -265,4 +275,95 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
return R.ok();
}
@Override
public R<String> deleteSalaryById(String id) {
if (id != null) {
TSalaryStandard sf = this.getById(id);
if (sf != null && Common.isNotNull(sf.getId())) {
if (sf.getStatus() != null && !SalaryConstants.AUDIT_STATUS[0].equals(sf.getStatus())
&& !SalaryConstants.AUDIT_STATUS[5].equals(sf.getStatus())
&& !SalaryConstants.AUDIT_STATUS[7].equals(sf.getStatus())) {
return R.failed("状态为:【" + SalaryConstants.AUDIT_STATUS_STRING[sf.getStatus()] + "】,不可删除");
}
} else {
return R.failed("删除失败:未找到工资表!");
}
String deptId = sf.getDeptId();
YifuUser user = SecurityUtils.getUser();
if (null == user || null == user.getId()) {
return R.failed("删除工资表失败-获取登录人信息为空");
}
//查询结算单:T_SETTLEMENTH_FORM
if (sf.getType() == null || sf.getType() != CommonConstants.ONE_INT) {
//4:删除报账
TSalaryAccount querySalaryAccountEntity = new TSalaryAccount();
querySalaryAccountEntity.setSalaryFormId(id);
QueryWrapper<TSalaryAccount> querySalaryAccountWrapper = new QueryWrapper<>();
querySalaryAccountWrapper.setEntity(querySalaryAccountEntity);
List<TSalaryAccount> salaryAccountList = salaryAccountService.list(querySalaryAccountWrapper);
if (salaryAccountList != null && salaryAccountList.size() > CommonConstants.ZERO_INT) {
for (TSalaryAccount entity : salaryAccountList) {
entity.setDeleteFlag(SalaryConstants.DELETED);
}
salaryAccountService.updateBatchById(salaryAccountList);
//5:更新预估库结算标识为0
MSalaryEstimate salaryEstimate = new MSalaryEstimate();
salaryEstimate.setSalaryId(id);
salaryEstimate.setIsSocial(SalaryConstants.IS_SOCIAL_ZERO);
QueryWrapper<MSalaryEstimate> salaryEstimateQueryWrapper = new QueryWrapper<>();
salaryEstimateQueryWrapper.setEntity(salaryEstimate);
//社保
List<MSalaryEstimate> socialList = mSalaryEstimateService.list(salaryEstimateQueryWrapper);
salaryEstimate.setIsSocial(SalaryConstants.IS_FUND_ONE);
salaryEstimateQueryWrapper.setEntity(salaryEstimate);
//公积金
List<MSalaryEstimate> fundList = mSalaryEstimateService.list(salaryEstimateQueryWrapper);
if ((socialList != null && !socialList.isEmpty())
|| (fundList != null && !fundList.isEmpty())) {
MSalaryPaymentRes res;
Map<String, MSalaryPaymentRes> saveResMap = new HashMap<>();
if (socialList != null && !socialList.isEmpty()) {
for (MSalaryEstimate est : socialList) {
res = saveResMap.get(est.getEstimateId());
if (res == null) {
res = new MSalaryPaymentRes();
res.setId(est.getEstimateId());
res.setDeptId(deptId);
}
res.setSalarySocialFlag(CommonConstants.ZERO_STRING);
saveResMap.put(est.getEstimateId(), res);
}
}
if (fundList != null && !fundList.isEmpty()) {
for (MSalaryEstimate est : fundList) {
res = saveResMap.get(est.getEstimateId());
if (res == null) {
res = new MSalaryPaymentRes();
res.setId(est.getEstimateId());
res.setDeptId(deptId);
}
res.setSalaryFundFlag(CommonConstants.ZERO_STRING);
saveResMap.put(est.getEstimateId(), res);
}
}
// 开始更新res
if (!saveResMap.isEmpty()) {
Iterator<MSalaryPaymentRes> iter = saveResMap.values().iterator();
while (iter.hasNext()) {
res = iter.next();
salaryPaymentResService.saveOrUpdate(res);
}
}
}
}
}
//6:删除工资表
sf.setDeleteFlag(SalaryConstants.DELETED);
this.updateById(sf);
return R.ok("级联删除工资表成功");
}
return R.failed("id 不可为空");
}
}
......@@ -291,6 +291,9 @@ public class SalaryAccountUtil implements Serializable {
continue;
}
}
if (new BigDecimal("3500").equals(relaySalary) || new BigDecimal("5000").equals(relaySalary)) {
entity.setHaveSpecialFlag(CommonConstants.ONE_INT);
}
}
if (null == error) {
if (Common.isNotNull(entity.getSalaryStyle())) {
......
......@@ -478,7 +478,7 @@ public class SalaryCommonUtil implements Serializable {
**/
public static void setConfigSalary(TConfigSalary configSalary, TSalaryAccountVo entity) {
if (configSalary != null && configSalary.getId() != null) {
entity.setSalaryDate(DateUtil.addMonth(configSalary.getSalaryMonth()));
entity.setSalaryMonth(DateUtil.addMonth(configSalary.getSalaryMonth()));
entity.setSettlementMonth(DateUtil.addMonth(configSalary.getSettleMonth()));
entity.setDeduSocialMonth(DateUtil.addMonth(configSalary.getSocialMonth()));
entity.setDeduProvidentMonth(DateUtil.addMonth(configSalary.getFundMonth()));
......@@ -499,9 +499,6 @@ public class SalaryCommonUtil implements Serializable {
* @return: void
**/
public static void setAccountBaseInfo(String salaryType, TSettleDomainSelectVo dept, TSalaryAccountVo entity, boolean salaryGiveTimeFlag) {
if (Common.isEmpty(entity.getSalaryTaxFlag())) {
entity.setSalaryTaxFlag(CommonConstants.ONE_STRING); //默认扣税
}
entity.setDistributionFlag(CommonConstants.ZERO_STRING);
if (Common.isEmpty(entity.getSalaryGiveTime())) {
if (salaryGiveTimeFlag) {
......@@ -511,10 +508,10 @@ public class SalaryCommonUtil implements Serializable {
}
}
entity.setDeleteFlag(SalaryConstants.NOT_DELETE);
entity.setSettleDepartId(dept.getId());
entity.setSettleDepartNo(dept.getDepartNo());
entity.setSettleDepartName(dept.getDepartName());
entity.setSalaryType(salaryType);
entity.setDeptId(dept.getId());
entity.setDeptNo(dept.getDepartNo());
entity.setDeptName(dept.getDepartName());
entity.setFormType(salaryType);
}
/**
......
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