Commit 9ac0fb46 authored by huyuchen's avatar huyuchen

生成收入接口修改

parent a6597bfb
......@@ -377,6 +377,14 @@ public class TPaymentInfo extends BaseEntity {
@ExcelProperty("推送状态 0已推送 1未推送")
private String pushStatus;
/**
* 收入状态
*/
@ExcelAttribute(name = "收入状态 0已生成 1未生成" )
@Schema(description ="收入状态 0已生成 1未生成")
@ExcelProperty("收入状态 0已生成 1未生成")
private String incomeStatus;
/**
* 单位社保补缴利息
*/
......
......@@ -381,4 +381,18 @@ public class TPaymentInfoController {
public TPaymentVo getPaymentSocialAndFound(@RequestBody TPaymentInfo info) {
return tPaymentInfoService.getPaymentSocialAndFound(info);
}
/**
* @Description: 手动推送社保缴费库明细的数据
* @Author: huyc
* @Date: 2022/8/30
* @return: void
**/
@Operation(summary = "手动推送社保缴费库明细的数据", description = "手动推送社保缴费库明细的数据")
@SysLog("手动推送社保缴费库明细的数据")
@PostMapping("/pushPaymentSocialFundInfo")
public R<Boolean> pushPaymentSocialFundInfo() {
tPaymentInfoService.pushPaymentSocialFundInfo();
return R.ok();
}
}
......@@ -140,4 +140,6 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
TPaymentVo getPaymentSocialAndFound(TPaymentInfo info);
void pushPaymentSocialFundInfo();
}
......@@ -36,8 +36,10 @@ import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamRisk;
import com.yifu.cloud.plus.v1.yifu.social.constants.SocialConstants;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncome;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
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.mapper.TIncomeMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TPaymentInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeDetailService;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSendEkpErrorService;
......@@ -74,6 +76,9 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
@Autowired
private EkpIncomeUtil ekpIncomeUtil;
@Autowired
private TPaymentInfoMapper tPaymentInfoMapper;
/**
* 收入明细表简单分页查询
*
......@@ -299,6 +304,9 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
tIncomeDetail.setCreateTime(new Date());
tIncomeDetail.setDataCreateMonth(DateUtil.addMonth(0));
tIncomeDetailService.save(tIncomeDetail);
TPaymentInfo paymentInfo = tPaymentInfoMapper.selectById(tIncomeDetail.getSourceId());
paymentInfo.setIncomeStatus(CommonConstants.ZERO_STRING);
tPaymentInfoMapper.updateById(paymentInfo);
// 不存在,直接新增
if (incomeList == null || incomeList.isEmpty()) {
BeanUtil.copyProperties(tIncomeDetail, income);
......
......@@ -715,7 +715,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (Common.isNotNull(list)) {
TPaymentInfo paymentInfo = null;
TSocialFundInfo socialInfo = null;
String temp = null;
String temp;
int res = -1;
List<TSocialFundInfo> socialInfoList = socialFundInfoMapper.selectList(Wrappers.<TSocialFundInfo>query().lambda()
......@@ -1259,8 +1259,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
try {
if (Common.isNotNull(list)) {
TPaymentInfo paymentInfo = null;
TSocialFundInfo fund = null;
String temp = null;
TSocialFundInfo fund;
String temp;
int res = -1;
//获取身份证列表
......@@ -1292,7 +1292,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
, info);
}
}
String[] areaArray = null;
String[] areaArray;
for (TPaymentInfoVo infoVo : list) {
if (Common.isNotNull(infoVo.getEmpIdcard())) {
......@@ -1476,8 +1476,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
private void importTPaymentSocialHeFei(List<TPaymentHeFeiVo> list, List<ErrorMessage> errorMessageList,
String random, YifuUser user, String type, Integer rowNumber) {
HashMap<String, String> areaMap = new HashMap<String, String>();
HashMap<String, String> areaMap2 = new HashMap<String, String>();
HashMap<String, String> areaMap = new HashMap<>();
HashMap<String, String> areaMap2 = new HashMap<>();
R<AreaVo> areaListR = upmsDaprUtils.getAreaListR();
if (Common.isNotNull(areaListR)) {
AreaVo areaList = areaListR.getData();
......@@ -1485,7 +1485,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
for (SysArea area : areaList.getSysAreaList()) {
areaMap.put(Integer.toString(area.getId()), area.getAreaName());
areaMap2.put(area.getAreaName() + CommonConstants.DOWN_LINE_STRING + (null == area.getParentId() ?
"null" : (0 == area.getParentId().intValue() ? "null" : Integer.toString(
"null" : (0 == area.getParentId() ? "null" : Integer.toString(
area.getParentId()))), Integer.toString(area.getId()));
}
}
......@@ -1606,15 +1606,15 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
String sumNumKey = user.getId() + CommonConstants.DOWN_LINE_STRING + "sum_key";
Integer bfInt = (Integer) redisUtil.get(sumNumKey);
if (Common.isNotNull(bfInt)) {
if (bfInt <= rowNumber.intValue()) {
maerialRatio = numberFormat.format((float) bfInt.intValue() / (float) rowNumber.intValue() * 100);
if (bfInt <= rowNumber) {
maerialRatio = numberFormat.format((float) bfInt / (float) rowNumber * 100);
bfInt = bfInt + 100;
} else {
maerialRatio = "100";
}
}else {
if (100 <= rowNumber.intValue()) {
maerialRatio = numberFormat.format((float) 100 / (float) rowNumber.intValue() * 100);
if (100 <= rowNumber) {
maerialRatio = numberFormat.format((float) 100 / (float) rowNumber * 100);
bfInt = 100;
} else {
maerialRatio = "100";
......@@ -1729,7 +1729,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
TSocialFundInfo socialInfo = null;
String temp;
int res = -1;
List<String> idcards = Common.listObjectToStrList(list, ExcelAttributeConstants.EMPIDCARD);
List<TSocialFundInfo> socialInfoList = socialFundInfoMapper.selectList(Wrappers.<TSocialFundInfo>query().lambda()
.in(TSocialFundInfo::getEmpIdcard, Common.listObjectToStrList(list, ExcelAttributeConstants.EMPIDCARD)));
......@@ -1756,7 +1755,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
infoVo.setEmpIdcard(infoVo.getEmpIdcard().replace("x", "X"));
}
//导入校验
if (socialThreeCheckBase(random, i, errorMessageList, infoVo, type)) {
if (socialThreeCheckBase(errorMessageList, infoVo, type)) {
continue;
}
//无对应员工的社保数据
......@@ -2013,20 +2012,18 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
payExists.setSumAll(payExists.getSocialSum());
payExists.setCreateBy(user.getId());
payExists.setCreateName(user.getNickname());
if (null != payExists && Common.isEmpty(payExists.getSocialId())) {
if (Common.isEmpty(payExists.getSocialId())) {
payExists.setSocialId(UUID.randomUUID().toString());
}
if (null != payExists && Common.isNotNull(payExists.getId())) {
if (Common.isNotNull(payExists.getId())) {
res = baseMapper.updateById(payExists);
if (res < 0) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "_缴费库更新失败!"));
continue;
}
} else {
res = insertAndSTimestamp(payExists);
if (res < 0) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "_缴费库保存失败!"));
continue;
}
}
}
......@@ -2037,7 +2034,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
/**
* 导入校验
**/
private boolean socialThreeCheckBase(String random, int i, List<ErrorMessage> errorMessageList, TPaymentHeFeiVo
private boolean socialThreeCheckBase(List<ErrorMessage> errorMessageList, TPaymentHeFeiVo
infoVo, String type) {
if (!Common.isNotNull(infoVo.getSocialPayMonth())) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "社保缴纳月份不可为空!"));
......@@ -2063,12 +2060,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
/**
* 转换缴纳地址为省市县ID
**/
private TPaymentHeFeiVo initAddressThree(String[]
areaArray, HashMap<String, String> areaMap2, TPaymentHeFeiVo s) {
private TPaymentHeFeiVo initAddressThree(String[] areaArray, HashMap<String, String> areaMap2, TPaymentHeFeiVo s) {
if (null == areaArray || null == areaMap2 || null == s) {
return s;
}
String temp = null;
String temp;
if (areaArray.length >= CommonConstants.TWO_INT) {
temp = areaMap2.get(areaArray[0] + CommonConstants.DOWN_LINE_STRING + "null");
if (Common.isNotNull(temp)) {
......@@ -2226,7 +2222,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override
public void createPaymentSocialInfo() {
//获取所有未推送的社保预估明细数据
//获取所有未推送的社保实缴明细数据
List<TPaymentInfo> unPushInfo = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getPushStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getSocialId));
......@@ -2238,7 +2234,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override
public void createPaymentFundInfo() {
//获取所有未推送的社保预估明细数据
//获取所有未推送的公积金实缴明细数据
List<TPaymentInfo> unPushInfo = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getPushStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getFundId));
......@@ -2248,6 +2244,17 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
@Override
public void pushPaymentSocialFundInfo() {
YifuUser user = SecurityUtils.getUser();
//手动推送未推送的社保公积金明细数据
createPaymentSocialInfoReal(user);
createPaymentFundInfoReal(user);
//推送社保公积金收入数据
createPaymentInfoIncomeReal(user);
createPaymentFundIncomeReal(user);
}
@Override
public void createPaymentInfoIncome() {
BigDecimal sumSocial = BigDecimal.ZERO;
......@@ -2290,6 +2297,70 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
public void createPaymentSocialInfoReal(YifuUser user) {
//获取所有未推送的社保实缴明细数据
List<TPaymentInfo> unPushInfo = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getCreateBy, user.getId())
.eq(TPaymentInfo::getPushStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getSocialId));
if (Common.isNotNull(unPushInfo)) {
//推送数据封装并推送
initEkpPushSocialParam(unPushInfo);
}
}
public void createPaymentFundInfoReal(YifuUser user) {
//获取所有未推送的公积金实缴明细数据
List<TPaymentInfo> unPushInfo = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getCreateBy, user.getId())
.eq(TPaymentInfo::getPushStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getFundId));
if (Common.isNotNull(unPushInfo)) {
//推送数据封装并推送
initEkpPushFundParam(unPushInfo);
}
}
public void createPaymentInfoIncomeReal(YifuUser user) {
BigDecimal sumSocial = BigDecimal.ZERO;
//判断缴费库中社保合计和本次导入合计相加是否为0,为0则不生成收入
List<TPaymentInfo> sumList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getCreateBy, user.getId())
.eq(TPaymentInfo::getIncomeStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getSocialId));
if (Common.isNotNull(sumList)) {
List<TPaymentInfo> updateList = new ArrayList<>();
for (TPaymentInfo paymentInfo: sumList) {
//获取员工当前缴纳月总合计
List<TPaymentInfo> payInfoList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getEmpIdcard, paymentInfo.getEmpIdcard())
.eq(TPaymentInfo::getSocialPayMonth, paymentInfo.getSocialPayMonth())
.eq(TPaymentInfo::getSettleDomainId, paymentInfo.getSettleDomainId()));
if (Common.isNotNull(payInfoList)) {
for (TPaymentInfo payInfo:payInfoList)
sumSocial = BigDecimalUtils.safeAdd(sumSocial,payInfo.getSocialSum());
}
if (sumSocial.compareTo(BigDecimal.ZERO) == CommonConstants.ZERO_INT) {
continue;
}
updateList.add(paymentInfo);
}
//生成收入
createIncomeInfo(updateList,CommonConstants.ONE_STRING);
}
}
public void createPaymentFundIncomeReal(YifuUser user) {
List<TPaymentInfo> sumList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getCreateBy, user.getId())
.eq(TPaymentInfo::getIncomeStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getFundId));
if (Common.isNotNull(sumList)) {
//生成公积金收入
createIncomeInfo(sumList,CommonConstants.TWO_STRING);
}
}
@Override
public TPaymentVo getPaymentSocialAndFound(TPaymentInfo info) {
List<TPaymentInfo> sumList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
......@@ -2309,8 +2380,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
List<TSettleDomainSelectVo> settleDomainR;
R<TSettleDomainListVo> listVo;
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(library.getSettleDomainId());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
......@@ -2548,14 +2619,14 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//单个异常超过十次,保存异常内容
if (i >= 10) {
baseMapper.updatePushStatus(pushList);
for (String key: map.keySet()) {
for (Map.Entry<String,Integer> entry : map.entrySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(library.getId());
error.setTitle(key);
error.setNums(map.get(key));
error.setTitle(entry.getKey());
error.setNums(entry.getValue());
tSendEkpErrorService.save(error);
}
break;
......@@ -2589,8 +2660,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
for (TPaymentInfo library:unPushInfo) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
List<TSettleDomainSelectVo> settleDomainR;
R<TSettleDomainListVo> listVo;
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(library.getSettleDomainId());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
......@@ -2720,14 +2791,14 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//单个异常超过十次,保存异常内容
if (i >= 10) {
baseMapper.updatePushStatus(pushList);
for (String key: map.keySet()) {
for (Map.Entry<String,Integer> entry : map.entrySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(library.getId());
error.setTitle(key);
error.setNums(map.get(key));
error.setTitle(entry.getKey());
error.setNums(entry.getValue());
tSendEkpErrorService.save(error);
}
break;
......@@ -2757,23 +2828,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
public void createIncomeInfo(List<TPaymentInfo> updateList,String socialFundFlag) {
List<TIncomeDetail> detailList = new ArrayList<>();
for (TPaymentInfo paymentInfo : updateList) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(paymentInfo.getSettleDomainId());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo : settleDomainR) {
BeanUtils.copyProperties(vo, settleDomain);
}
}
}
Boolean exitFlag = false;
List<TIncomeDetail> exitIncome = new ArrayList<>();
boolean exitFlag = false;
List<TIncomeDetail> exitIncome;
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
exitIncome = detailMapper.selectList(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard, paymentInfo.getEmpIdcard())
......@@ -2803,6 +2859,21 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR;
R<TSettleDomainListVo> listVo;
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(paymentInfo.getSettleDomainId());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo : settleDomainR) {
BeanUtils.copyProperties(vo, settleDomain);
}
}
}
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
// 含有社保,则计算收入
......@@ -2925,7 +2996,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
public String dateStringInsert(String month) {
StringBuilder sb = new StringBuilder(month);
sb.insert(4, "-");
String replaceMonth = sb.toString();
return replaceMonth;
return sb.toString();
}
}
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