Commit f9402c13 authored by huyuchen's avatar huyuchen

收入生成打标修改

parent 4c067a75
......@@ -59,7 +59,20 @@ public class ArchivesDaprUtil {
}
return res;
}
/**
* @Author huyc
* @Description 通过项目编码获取项目及客户信息
* @Date 21:18 2022/7/20
* @Param
* @return
**/
public R<TSettleDomainListVo> getSettleInfoByCodes(List<String> codes){
R<TSettleDomainListVo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/tsettledomain/getSettleInfoByCodes",JSON.toJSONString(codes), TSettleDomainSelectVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("通过项目编码获取项目及客户信息失败!");
}
return res;
}
/**
* @Author fxj
* @Description 获取派单校验需要的档案信息
......
......@@ -132,4 +132,17 @@ public class SocialTask {
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tincome/inner/pushDetail","", Object.class, SecurityConstants.FROM_IN);
log.info("------------定时任务生成统计表数据-定时任务结束------------");
}
/**
* @Description: 定时任务标识根据项目不需要生成收入的数据
* @Author: huyc
* @Date: 2022/8/30
* @return: void
**/
public void signPaymentNoIncomeFlag() {
log.info("------------定时任务标识根据项目不需要生成收入的数据-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tpaymentinfo/inner/signPaymentNoIncomeFlag","", Object.class, SecurityConstants.FROM_IN);
log.info("------------定时任务标识根据项目不需要生成收入的数据-定时任务结束------------");
}
}
......@@ -632,6 +632,13 @@ public class TPaymentInfo extends BaseEntity {
@ExcelProperty("工资公积金结算状态")
private String salaryFundFlag;
/**
* 是否需要生成收入
*/
@Schema(description ="是否需要生成收入 0需要 1不需要")
@ExcelIgnore
private String isIncomeStatus;
/**
* 是否导入重复标识
*/
......
......@@ -19,7 +19,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.ErrorDetailVO;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
......@@ -381,6 +380,20 @@ public class TPaymentInfoController {
tPaymentInfoService.createPaymentFundIncome();
}
/**
* @Description: 定时任务标识根据项目不需要生成收入的数据
* @Author: huyc
* @Date: 2022/8/30
* @return: void
**/
@Operation(summary = "定时任务标识根据项目不需要生成收入的数据", description = "定时任务标识根据项目不需要生成收入的数据")
@SysLog("定时任务标识根据项目不需要生成收入的数据")
@Inner
@PostMapping("/inner/signPaymentNoIncomeFlag")
public void signPaymentNoIncomeFlag() {
tPaymentInfoService.signPaymentNoIncomeFlag();
}
/**
* @param info
* @Description: 查询缴费库
......
......@@ -200,6 +200,8 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
void updateBySocialIncomePayment(@Param("id")String id);
void updateBySocialIncomeFlag(@Param("id")String id);
/**
* 缴费库社保推送查询
* @param searchVo 缴费库
......
......@@ -146,6 +146,8 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
void createPaymentInfoIncome();
void createPaymentFundIncome();
void signPaymentNoIncomeFlag();
TPaymentVo getPaymentSocialAndFound(TPaymentInfo info);
void pushPaymentSocialFundInfo(TPaymentInfoSearchVo searchVo);
......
......@@ -2601,6 +2601,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
long count = baseMapper.selectCount(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getIncomeStatus,CommonConstants.ONE_STRING)
.eq(TPaymentInfo::getLockStatus,CommonConstants.ONE_STRING)
.eq(TPaymentInfo::getIsIncomeStatus,CommonConstants.ZERO_STRING)
.isNotNull(TPaymentInfo::getSocialId));
if (count > 0) {
List<TPaymentInfo> sumList;
......@@ -2626,6 +2627,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
long count = baseMapper.selectCount(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getIncomeStatus,CommonConstants.ONE_STRING)
.eq(TPaymentInfo::getLockStatus,CommonConstants.ONE_STRING)
.eq(TPaymentInfo::getIsIncomeStatus,CommonConstants.ZERO_STRING)
.isNotNull(TPaymentInfo::getFundId));
if (count > 0) {
List<TPaymentInfo> sumList;
......@@ -2645,6 +2647,30 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
@Override
public void signPaymentNoIncomeFlag() {
//标识根据项目不需要生成收入的数据
long count = baseMapper.selectCount(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getIncomeStatus,CommonConstants.ONE_STRING)
.eq(TPaymentInfo::getLockStatus,CommonConstants.ONE_STRING));
if (count > 0) {
List<TPaymentInfo> unPushInfo;
int i = (int) Math.ceil((double) count / CommonConstants.TEN_THOUSAND_INT);
for (int j = 0; j < i; j++) {
unPushInfo = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getIncomeStatus, CommonConstants.ONE_STRING)
.eq(TPaymentInfo::getLockStatus, CommonConstants.ONE_STRING)
.last(" limit 0,10000"));
synchronized (this) {
if (Common.isNotNull(unPushInfo)) {
//判断是否需要生成收入并标识
signIncomeFlag(unPushInfo);
}
}
}
}
}
public void createPaymentSocialInfoReal(YifuUser user,TPaymentInfoSearchVo searchVo) {
//获取所有未推送的社保实缴明细数据
searchVo.setLockStatus(CommonConstants.ONE_STRING);
......@@ -3099,10 +3125,51 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
public void signIncomeFlag(List<TPaymentInfo> updateList) {
//获取所有的项目编码
List<String> deptNoList = updateList.stream().map(TPaymentInfo::getSettleDomainCode).collect(Collectors.toList());
//获取对应项目信息
Map<String, TSettleDomain> data = new HashMap<>();
TSettleDomain settleDomain;
try {
R<TSettleDomainListVo> infoByCodes = archivesDaprUtil.getSettleInfoByCodes(deptNoList);
if (null != infoByCodes && Common.isNotNull(infoByCodes.getData())) {
data = infoByCodes.getData().getMapVO();
}
if (Common.isNotNull(data)) {
for (TPaymentInfo paymentInfo : updateList) {
settleDomain = data.get(paymentInfo.getSettleDomainCode());
boolean isIncomeFlag = false;
if (Common.isNotNull(settleDomain)) {
if (Common.isNotNull(settleDomain.getManageServerItem()) && ((settleDomain.getManageServerItem().contains(CommonConstants.ONE_STRING)
&& Common.isNotNull(paymentInfo.getSocialId())) || (settleDomain.getManageServerItem().contains(CommonConstants.TWO_STRING)
&& Common.isNotNull(paymentInfo.getFundId()))) && CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag()) &&
CommonConstants.TWO_STRING.equals(settleDomain.getMrSettleType())) {
//实缴模式
isIncomeFlag = true;
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && ((settleDomain.getRiskServerItem().contains(CommonConstants.ONE_STRING)
&& Common.isNotNull(paymentInfo.getSocialId())) || (settleDomain.getRiskServerItem().contains(CommonConstants.TWO_STRING)
&& Common.isNotNull(paymentInfo.getFundId()))) && CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag()) &&
CommonConstants.TWO_STRING.equals(settleDomain.getMrSettleType())) {
//实缴模式
isIncomeFlag = true;
}
}
if (!isIncomeFlag) {
baseMapper.updateBySocialIncomeFlag(paymentInfo.getId());
}
}
}
}catch (Exception e) {
log.error("标识是否需要生成收入异常",e);
}
}
public void createIncomeInfo(List<TPaymentInfo> updateList, String socialFundFlag) {
List<TIncomeDetail> exitIncome;
for (TPaymentInfo paymentInfo : updateList) {
boolean exitFlag = false;
List<TIncomeDetail> exitIncome;
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
exitIncome = detailMapper.selectList(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard, paymentInfo.getEmpIdcard())
......@@ -3149,6 +3216,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
boolean isIncomeFlag = false;
// 含有社保,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && ((settleDomain.getManageServerItem().contains(CommonConstants.ONE_STRING)
&& CommonConstants.ONE_STRING.equals(socialFundFlag)) || (settleDomain.getManageServerItem().contains(CommonConstants.TWO_STRING)
......@@ -3173,6 +3241,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
if (!exitFlag || isSum == 1) {
isIncomeFlag = true;
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
gMoney, socialFundFlag);
......@@ -3203,12 +3272,16 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
if (!exitFlag || isSum == 2) {
isIncomeFlag = true;
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
money, socialFundFlag);
}
}
}
if (!isIncomeFlag) {
baseMapper.updateBySocialIncomeFlag(paymentInfo.getId());
}
}
}
}
......
......@@ -100,6 +100,7 @@
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="incomeStatus" column="INCOME_STATUS"/>
<result property="isIncomeStatus" column="IS_INCOME_STATUS"/>
</resultMap>
<resultMap id="tPaymentInfoSumMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoExportVo">
<result property="empName" column="EMP_NAME"/>
......@@ -1266,7 +1267,7 @@
<include refid="Base_Column_List"/>
FROM t_payment_info a
<where>
a.INCOME_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId}
a.INCOME_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId} AND a.IS_INCOME_STATUS = '0'
<include refid="tPaymentInfo_export_where"/>
</where>
limit 0,10000
......@@ -1278,7 +1279,7 @@
<include refid="Base_Column_List"/>
FROM t_payment_info a
<where>
a.INCOME_STATUS = '1' AND a.FUND_ID IS NOT NULL AND a.CREATE_BY = #{userId}
a.INCOME_STATUS = '1' AND a.FUND_ID IS NOT NULL AND a.CREATE_BY = #{userId} AND a.IS_INCOME_STATUS = '0'
<include refid="tPaymentInfo_export_where"/>
</where>
limit 0,10000
......@@ -1300,6 +1301,13 @@
ID = #{id}
</update>
<update id="updateBySocialIncomeFlag">
update t_payment_info
set IS_INCOME_STATUS = '1'
where
ID = #{id}
</update>
<select id="getTPaymentSocialPushCount" resultType="java.lang.Long">
SELECT
count(1)
......@@ -1327,7 +1335,7 @@
count(1)
FROM t_payment_info a
<where>
a.INCOME_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId}
a.INCOME_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId} AND a.IS_INCOME_STATUS = '0'
<include refid="tPaymentInfo_export_where"/>
</where>
</select>
......@@ -1338,7 +1346,7 @@
count(1)
FROM t_payment_info a
<where>
a.INCOME_STATUS = '1' AND a.FUND_ID IS NOT NULL AND a.CREATE_BY = #{userId}
a.INCOME_STATUS = '1' AND a.FUND_ID IS NOT NULL AND a.CREATE_BY = #{userId} AND a.IS_INCOME_STATUS = '0'
<include refid="tPaymentInfo_export_where"/>
</where>
</select>
......
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