Commit 3d821375 authored by fangxinjiang's avatar fangxinjiang

Merge branch 'develop'

# Conflicts:
#	yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/mapper/insurances/TInsuranceDetailMapper.java
#	yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryStandardServiceImpl.java
#	yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/util/DoJointSalaryAsyncTask.java
#	yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/mapper/TPaymentInfoMapper.java
#	yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TDispatchInfoServiceImpl.java
#	yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TIncomeServiceImpl.java
#	yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TPaymentInfoServiceImpl.java
#	yifu-social/yifu-social-biz/src/main/resources/mapper/TPaymentInfoMapper.xml
parents a2691322 1ec442a9
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import lombok.Data;
import java.util.List;
......@@ -14,6 +15,9 @@ public class TSettleDomainListVo {
private List<TSettleDomainSelectVo> listSelectVO;
private Map<String,TSettleDomainSelectVo> mapSlectVo;
private Map<String,TSettleDomain> mapVO;
/**
* 合同主体IDS
*/
......
......@@ -22,7 +22,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.archives.entity.TCustomerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TDepartSettlementInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.service.TDepartSettlementInfoService;
......@@ -42,7 +41,6 @@ import org.springframework.web.bind.annotation.*;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -229,6 +227,21 @@ public class TSettleDomainController {
return tSettleDomainService.getSetInfoByCodes(codes);
}
/**
* @Author fxj
* @Description 通过项目编码获取项目及客户信息
* @Date 10:49 2022/7/20
* @Param
* @return
**/
@Operation(description = "通过项目编码获取项目及客户信息")
@SysLog("通过项目编码获取项目及客户信息")
@Inner
@PostMapping("/getSettleInfoByCodes")
public TSettleDomainListVo getSettleInfoByCodes(@RequestBody List<String> codes) {
return tSettleDomainService.getSettleInfoByCodes(codes);
}
/**
* @param id 项目主键
* @Description: 通过id获取结算主体及单位部分信息
......@@ -267,7 +280,7 @@ public class TSettleDomainController {
/**
* 修改项目表--EKP调用接口
* @author hyc
* @param list 项目表
* @param jsonStr 项目表
* @return R
*/
@Operation(summary = "修改项目表--EKP调用接口", description = "修改项目表--EKP调用接口")
......
......@@ -74,4 +74,6 @@ public interface TSettleDomainMapper extends BaseMapper<TSettleDomain> {
* @return
**/
List<ProjectSetInfoVo> getSetInfoByCodes(@Param(value = "codes") List<String> codes);
List<TSettleDomain> getSettleInfoByCodes(@Param(value = "codes") List<String> codes);
}
......@@ -21,10 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.IdNameNoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.SetInfoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainEkpVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
......@@ -64,6 +61,8 @@ public interface TSettleDomainService extends IService<TSettleDomain> {
SetInfoVo getSetInfoByCodes(List<String> codes);
TSettleDomainListVo getSettleInfoByCodes(List<String> codes);
/**
* 通过id获取项目及单位部分信息
* @param
......
......@@ -323,6 +323,16 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
return setMap;
}
@Override
public TSettleDomainListVo getSettleInfoByCodes(List<String> codes) {
List<TSettleDomain> voList = baseMapper.getSettleInfoByCodes(codes);
TSettleDomainListVo setMap = new TSettleDomainListVo();
if (Common.isNotNull(voList)){
setMap.setMapVO(voList.stream().collect(Collectors.toMap(TSettleDomain::getDepartNo, k->k)));
}
return setMap;
}
/**
* @Author fxj
* @Description 更新EKP对应MVP 项目权限,已有权限不做删除处理
......
......@@ -297,4 +297,18 @@
</if>
</select>
<select id="getSettleInfoByCodes" resultMap="tSettleDomainMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_settle_domain a
where 1=1
and a.DELETE_FLAG = '0'
<if test="codes != null and codes.size() > 0">
and a.DEPART_NO in
<foreach collection="codes" item="param" index="index" open="(" close=")" separator=",">
#{param}
</foreach>
</if>
</select>
</mapper>
......@@ -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), TSettleDomainListVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("通过项目编码获取项目及客户信息失败!");
}
return res;
}
/**
* @Author fxj
* @Description 获取派单校验需要的档案信息
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* @author huyc
* @description 发票号更新VO
* @date 2022-11-29 10:23:17
*/
@Data
@Schema(description = "发票号更新VO")
public class InsuranceUpdateVO implements Serializable {
private static final long serialVersionUID = 628032758008497542L;
/**
* 主键
*/
@Schema(description = "主键")
private String id;
/**
* 发票号
*/
@Schema(description = "发票号")
private String invoiceNo;
/**
* 保单号
*/
@Schema(description = "保单号")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "保单号")
private String policyNo;
}
......@@ -83,7 +83,7 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
* @param details
* @return void
*/
void updatePolicyNoBatch(@Param("details") List<TInsuranceDetail> details);
void updatePolicyNoBatch(@Param("details") List<InsuranceUpdateVO> details);
/**
* 批量更新发票号
......@@ -92,7 +92,7 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
* @param details
* @return void
*/
void updateInvoiceNoBatch(@Param("details") List<TInsuranceDetail> details);
void updateInvoiceNoBatch(@Param("details") List<InsuranceUpdateVO> details);
/***********************减员办理********************************/
......@@ -246,5 +246,13 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
List<TInsuranceDetail> selectByIdCardList(@Param("idCardList") List<String> idCardList
, @Param("idList") List<String> idList);
List<TInsuranceDetail> selectPushList();
/**
* @param ids
* @Description: 根据id查找所有商险
* @Author: huyc
* @Date: 2022/11/29 10:17
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail>
**/
List<InsuranceUpdateVO> selectByIds(@Param("ids") List<String> ids);
}
......@@ -4,6 +4,9 @@ package com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author licancan
......@@ -13,4 +16,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TInsuranceOperateMapper extends BaseMapper<TInsuranceOperate> {
int saveOperateInfo(@Param("list") List<TInsuranceOperate> list);
}
......@@ -4,6 +4,8 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service.insurance;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
import java.util.List;
/**
* @author licancan
* @description 针对表【t_insurance_operate(商险操作表)】的数据库操作Service
......@@ -11,4 +13,5 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
*/
public interface TInsuranceOperateService extends IService<TInsuranceOperate> {
int saveOperateInfo(List<TInsuranceOperate> list);
}
......@@ -6,6 +6,8 @@ import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsuranceOperat
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceOperateService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author licancan
......@@ -15,4 +17,8 @@ import org.springframework.stereotype.Service;
@Service
public class TInsuranceOperateServiceImpl extends ServiceImpl<TInsuranceOperateMapper, TInsuranceOperate> implements TInsuranceOperateService {
@Override
public int saveOperateInfo(List<TInsuranceOperate> list) {
return baseMapper.saveOperateInfo(list);
}
}
package com.yifu.cloud.plus.v1.yifu.insurances.util;
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.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpInsuranceUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceEkp;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceSettle;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceSettleCancel;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceEkpService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceSettleCancelService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceSettleService;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInteractiveParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDateTime;
/**
* 主要执行商险的异步推送
* @author huyc
* @Date 2022-11-30
* @Description 多线程的执行
*/
@Slf4j
@Component
public class DoJointInsuranceTask {
@Resource
private TInsuranceSettleService tInsuranceSettleService;
@Autowired
private EkpInsuranceUtil eKPInsuranceUtil;
@Autowired
private TInsuranceEkpService tInsuranceEkpService;
@Autowired
private ArchivesDaprUtil archivesDaprUtil;
@Autowired
private TInsuranceSettleCancelService tInsuranceSettleCancelService;
/**
* @Description: 商险明细推送
* @Author: huyc
* @Date: 2022-11-30
* @return: void
**/
@Async
public void asynchronousEkpInfo(TInsuranceDetail detail, TInsuranceSettle settle, Integer type) {
log.info("推送商险明细到EKP-线程开始");
try {
String s = pushEstimate(detail,type);
if(StringUtils.isNotBlank(s)){
if (type == CommonConstants.ONE_INT) {
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
} else {
settle.setIsActualPush(CommonConstants.ONE_INT);
settle.setActualPushTime(LocalDateTime.now());
}
tInsuranceSettleService.updateById(settle);
}
} catch (Exception e) {
log.error("推送商险明细到EKP错误", e);
}
log.info("推送商险明细到EKP结束");
}
/**
* 推送EKP
*
* @author zhaji
* @param
* @return {@link String}
*/
private String pushEstimate(TInsuranceDetail tInsuranceDetail,Integer type){
YifuUser user = SecurityUtils.getUser();
Integer pushType = null;
//1,推送预估保费,2,推送实际保费,3推送预估冲正保费,4更新实际保费
EkpInteractiveParam param = new EkpInteractiveParam();
TInsuranceSettleCancel cancel = new TInsuranceSettleCancel();
BeanCopyUtils.copyProperties(tInsuranceDetail,param);
param.setDetailId(tInsuranceDetail.getId());
Integer settleType = tInsuranceDetail.getSettleType();
if(CommonConstants.ZERO_INT == settleType){
param.setEstimateStatus(EkpConstants.HAVE);
}else {
param.setEstimateStatus(EkpConstants.NOTHING);
}
if (Common.isNotNull(tInsuranceDetail.getUnitName())) {
param.setCustomerName(tInsuranceDetail.getUnitName());
}
if (Common.isNotNull(tInsuranceDetail.getUnitNo())) {
param.setCustomerCode(tInsuranceDetail.getUnitNo());
}
//1,推送预估保费(用户办理成功,推送预估保费)
if(CommonConstants.ONE_INT == type){
param.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
pushType = CommonConstants.ONE_INT;
}
//2,推送实际保费(用于登记保单保费未推送过实缴保费)
if(CommonConstants.TWO_INT == type){
param.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
pushType = CommonConstants.TWO_INT;
}
//3推送预估冲正保费(用于投保退回场景)
if(CommonConstants.THREE_INT == type){
String defaultSettleId = tInsuranceDetail.getDefaultSettleId();
TInsuranceSettle byId = tInsuranceSettleService.getById(defaultSettleId);
//冲正取负数
if(null != byId.getEstimatePremium()){
param.setEstimatePremium(byId.getEstimatePremium());
}
param.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
pushType = CommonConstants.FIVE_INT;
}
//6推送实缴红冲(用于投保退回场景)
if(CommonConstants.SIX_INT == type){
String defaultSettleId = tInsuranceDetail.getDefaultSettleId();
TInsuranceSettle byId = tInsuranceSettleService.getById(defaultSettleId);
//冲正取负数
if(null != byId.getActualPremium()){
param.setActualPremium(byId.getActualPremium());
}
param.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
pushType = CommonConstants.SIX_INT;
}
//4更新实际保费(用于登记保单保费场景推送过实缴保费)
if(CommonConstants.FOUR_INT == type){
param.setInteractiveType(InsurancesConstants.UPDATE_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
pushType = CommonConstants.THREE_INT;
}
//作废
if(CommonConstants.FIVE_INT == type){
cancel.setDeptNo(tInsuranceDetail.getDeptNo());
cancel.setInsDetailId(tInsuranceDetail.getId());
cancel.setSettleId(tInsuranceDetail.getDefaultSettleId());
cancel.setCreateUesr(user.getId());
cancel.setCreateTime(LocalDateTime.now());
cancel.setDeptName(param.getDeptName());
cancel.setIsCancelPush(CommonConstants.ZERO_INT);
tInsuranceSettleCancelService.save(cancel);
param.setInteractiveType(InsurancesConstants.ABOLISH_SETTLE_BILL);
param.setSettleType(CommonConstants.EMPTY_STRING);
pushType = CommonConstants.FOUR_INT;
}
String s = eKPInsuranceUtil.sendToEkp(param);
if(StringUtils.isBlank(s)){
saveInsuranceEkp(param,pushType);
return null;
}else {
return s;
}
}
/**
* 保存失败信息
*
* @author zhaji
* @param
* @return {@link String}
*/
private void saveInsuranceEkp(EkpInteractiveParam param, Integer pushType){
TInsuranceEkp ekp = new TInsuranceEkp();
BeanCopyUtils.copyProperties(param,ekp);
ekp.setId(null);
ekp.setCreateTime(LocalDateTime.now());
ekp.setPushType(pushType);
tInsuranceEkpService.save(ekp);
}
}
......@@ -63,6 +63,11 @@
<result property="unitName" column="UNIT_NAME" jdbcType="VARCHAR"/>
<result property="unitNo" column="UNIT_NO" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="UpdateMap" type="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceUpdateVO">
<id property="id" column="ID" jdbcType="VARCHAR"/>
<result property="invoiceNo" column="INVOICE_NO" jdbcType="VARCHAR"/>
<result property="policyNo" column="POLICY_NO" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
ID,EMP_NAME,
EMP_IDCARD_NO,DEPT_NO,POST,INSURANCE_COMPANY_NAME,INSURANCE_TYPE_NAME,
......@@ -1213,4 +1218,18 @@
</if>
</select>
<select id="selectByIds" resultMap="UpdateMap">
SELECT
a.ID,
a.INVOICE_NO,
a.POLICY_NO
FROM
t_insurance_detail a
where
a.ID in
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
......@@ -19,4 +19,22 @@
ID,INSURANCE_DETAIL_ID,OPERATE_DESC,REMARK,
CREATE_BY,CREATE_NAME,CREATE_TIME
</sql>
<insert id="saveOperateInfo" parameterType="java.util.List">
insert into t_insurance_operate
(ID,REMARK,DISPLAY_FLAG,CREATE_BY,CREATE_TIME,CREATE_NAME,OPERATE_DESC,INSURANCE_DETAIL_ID)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.id},
#{item.remark},
#{item.displayFlag},
#{item.createBy},
#{item.createTime},
#{item.createName},
#{item.operateDesc},
#{item.insuranceDetailId}
)
</foreach>
</insert>
</mapper>
......@@ -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("------------定时任务标识根据项目不需要生成收入的数据-定时任务结束------------");
}
}
......@@ -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;
......@@ -120,5 +121,18 @@ public class TStatisticsDeclarer {
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("不申报原因")
private String undeclareReason;
/**
* 是否0申报人员 0 是 1 否
*/
@ExcelAttribute(name = "是否0申报人员", maxLength = 1,readConverterExp = "0=是,1=否")
@Length(max = 1, message = "是否0申报人员不能超过1个字符")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("是否0申报人员")
private String isZeroDeclare;
/**
* 是否0申报人员 0 是 1 否
*/
@TableField(exist = false)
@ExcelIgnore
private String isZeroFlag;
}
......@@ -74,5 +74,11 @@ public class TStatisticsDeclarerVo extends RowIndex implements Serializable {
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("不申报原因")
private String undeclareReason;
/**
* 是否0申报人员 0 是 1 否
*/
@ExcelAttribute(name = "是否0申报人员", maxLength = 1,readConverterExp = "0=是,1=否")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("是否0申报人员")
private String isZeroDeclare;
}
......@@ -47,4 +47,11 @@ public interface TStatisticsDeclarerMapper extends BaseMapper<TStatisticsDeclare
* @return:
**/
List<TStatisticsDeclarer> doStatisticsTaxDeclarer(@Param("nowMonth") String nowMonth, @Param("lastMonth") String lastYear);
/**
* @param
* @Description: 统计
* @return:
**/
List<TStatisticsDeclarer> doStatisticsTaxDeclarerYear(@Param("nowMonth") String nowMonth);
}
......@@ -29,13 +29,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
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.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsDeclarer;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsDeclarerMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsDeclarerService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsDeclarerSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsDeclarerVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
......@@ -46,6 +49,7 @@ import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
* 申报对象表
*
......@@ -53,9 +57,12 @@ import java.util.List;
* @date 2022-08-11 10:56:10
*/
@Log4j2
@RequiredArgsConstructor
@Service
public class TStatisticsDeclarerServiceImpl extends ServiceImpl<TStatisticsDeclarerMapper, TStatisticsDeclarer> implements TStatisticsDeclarerService {
private final ArchivesDaprUtil archivesDaprUtil;
/**
* 申报对象表简单分页查询
* @param tStatisticsDeclarer 申报对象表
......@@ -177,10 +184,31 @@ public class TStatisticsDeclarerServiceImpl extends ServiceImpl<TStatisticsDecla
return R.failed("上月数据已生成,不可重复生成!");
} else {
String lastMonth = DateUtil.addMonth(-1); //上月
List<TStatisticsDeclarer> stdvoList = baseMapper.doStatisticsTaxDeclarer(nowMonth,lastMonth);
List<TStatisticsDeclarer> stdvoList = baseMapper.doStatisticsTaxDeclarer(nowMonth, lastMonth);
if (Common.isNotNull(stdvoList)) {
for (TStatisticsDeclarer declarer : stdvoList) {
this.save(declarer);
}
}
List<TStatisticsDeclarer> stdvoYearList = baseMapper.doStatisticsTaxDeclarerYear(nowMonth);
if (Common.isNotNull(stdvoYearList)) {
R<TEmployeeInfo> res;
for (TStatisticsDeclarer declarer : stdvoYearList) {
if (CommonConstants.TWO_STRING.equals(declarer.getIsZeroDeclare())) {
res = archivesDaprUtil.getTEmployeeInfoByIdcard(declarer.getEmpIdcard());
if (Common.isNotNull(res) && Common.isNotNull(res.getData())
&& (CommonConstants.ZERO_INT == res.getData().getFileStatus())) {
declarer.setIsZeroDeclare(CommonConstants.ZERO_STRING);
} else if (CommonConstants.ONE_STRING.equals(declarer.getIsZeroFlag())) {
declarer.setIsZeroDeclare(CommonConstants.ZERO_STRING);
} else {
declarer.setIsZeroDeclare(CommonConstants.ONE_STRING);
}
}
this.save(declarer);
}
}
return R.ok();
}
}
......
package com.yifu.cloud.plus.v1.yifu.salary.util;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.BigDecimalUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
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.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryStandardMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardService;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeDetailReturnVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.*;
/**
* @author hgw
* @Date 2022-11-29 16:31:09
* @Description 异步执行薪资
*/
@Slf4j
@Component
@AllArgsConstructor
@EnableConfigurationProperties({DaprSocialProperties.class})
public class DoJointSalaryAsyncTask {
private final DaprSocialProperties socialProperties;
private final TSalaryStandardMapper salaryStandardMapper;
/**
* @Description: 收入
* @Author: hgw
* @Date: 2022-11-29 17:28:494
**/
@Async
public void doIncomeDetail(TSettleDomainSelectVo dept, List<TSalaryAccount> salaryAccountList, String id, TSalaryStandard tSalaryStandard) {
log.info("推送收入到EKP-线程开始");
if (salaryAccountList != null && !salaryAccountList.isEmpty()) {
List<String> idCardList = new ArrayList<>();
for (TSalaryAccount account : salaryAccountList) {
idCardList.add(account.getEmpIdcard());
}
Map<String, Integer> detailMap = new HashMap<>();
boolean isTrue = true;
TSalaryStandard s = salaryStandardMapper.selectById(id);
try {
// 收入相关
R<String> failed1 = getIncomeDetailMap(tSalaryStandard, dept, idCardList, detailMap);
if (failed1 != null) {
isTrue = false;
} else {
// 含有薪资,则计算收入
// 管理费
if (Common.isNotNull(dept.getManageServerItem()) && dept.getManageServerItem().contains(CommonConstants.FOUR_STRING)
&& CommonConstants.ZERO_STRING.equals(dept.getManagementTag())) {
// 金额-人数
if (CommonConstants.TWO_STRING.equals(dept.getManagementType())) {
// 保存明细
isTrue = saveIncomeDetail(salaryAccountList, tSalaryStandard, dept, detailMap, dept.getManagementType(), CommonConstants.ONE_STRING);
} else {
// 保存明细
isTrue = saveIncomeDetail(salaryAccountList, tSalaryStandard, dept, new HashMap<>(), dept.getManagementType(), CommonConstants.ONE_STRING);
}
}
// 风险金
if (isTrue && Common.isNotNull(dept.getRiskServerItem()) && dept.getRiskServerItem().contains(CommonConstants.FOUR_STRING)
&& CommonConstants.ZERO_STRING.equals(dept.getRiskFundTag())) {
// 金额-人数
if (CommonConstants.TWO_STRING.equals(dept.getRiskFundType())) {
// 保存明细
isTrue = saveIncomeDetail(salaryAccountList, tSalaryStandard, dept, detailMap, dept.getRiskFundType(), CommonConstants.TWO_STRING);
} else {
// 保存明细
isTrue = saveIncomeDetail(salaryAccountList, tSalaryStandard, dept, new HashMap<>(), dept.getRiskFundType(), CommonConstants.TWO_STRING);
}
}
}
} catch (Exception e) {
isTrue = false;
log.error(e.getMessage());
}
if (s != null
&& (s.getStatus() == CommonConstants.dingleDigitIntArray[11]
|| s.getStatus() == CommonConstants.dingleDigitIntArray[12])) {
s.setIncomeEndTime(new Date());
if (isTrue) {
s.setStatus(CommonConstants.TWO_INT);
salaryStandardMapper.updateById(s);
} else {
s.setStatus(CommonConstants.dingleDigitIntArray[12]);
salaryStandardMapper.updateById(s);
}
}
}
log.info("推送收入到EKP结束");
}
/**
* @Description: 获取收入信息
* @Author: hgw
* @Date: 2022/9/6 10:39
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
private R<String> getIncomeDetailMap(TSalaryStandard tSalaryStandard, TSettleDomainSelectVo dept, List<String> idCardList, Map<String, Integer> detailMap) {
TIncomeDetail detail = new TIncomeDetail();
detail.setApplyNo(tSalaryStandard.getApplyNo());
detail.setPayMonth(tSalaryStandard.getSalaryMonth());
detail.setIdCardList(idCardList);
detail.setDeptId(dept.getId());
R<TIncomeDetailReturnVo> detailR = HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tincomedetail/inner/getTIncomeDetailList", detail
, TIncomeDetailReturnVo.class, SecurityConstants.FROM_IN);
Integer value;
if (detailR != null) {
if (detailR.getData() != null && detailR.getData().getDetailList() != null && !detailR.getData().getDetailList().isEmpty()) {
TIncomeDetailReturnVo vo = detailR.getData();
List<TIncomeDetail> detailList = vo.getDetailList();
for (TIncomeDetail incomeDetail : detailList) {
value = detailMap.get(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getDeptId() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + incomeDetail.getSourceType());
if (Common.isEmpty(value)) {
value = CommonConstants.ZERO_INT;
}
if (CommonConstants.ZERO_STRING.equals(incomeDetail.getRedData())) {
value++;
} else {
value--;
}
detailMap.put(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getDeptId() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getFeeType() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getSourceType(), value);
}
}
} else {
return R.failed("获取收入明细的详情出错,请联系管理员!");
}
return null;
}
/**
* @param feeType 1按比例2金额-人数3金额-人次
* @param isManage 1 管理费2 风险金
* @Description: 保存明细
* @Author: hgw
* @Date: 2022/9/2 17:25
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
private boolean saveIncomeDetail(List<TSalaryAccount> salaryAccountList, TSalaryStandard tSalaryStandard
, TSettleDomainSelectVo dept, Map<String, Integer> detailMap, String feeType, String isManage) {
TIncomeDetail detail;
Integer value;
BigDecimal money;
for (TSalaryAccount account : salaryAccountList) {
value = detailMap.get(account.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
+ account.getDeptId() + CommonConstants.DOWN_LINE_STRING + isManage
+ CommonConstants.DOWN_LINE_STRING
+ CommonConstants.FOUR_STRING);
if (Common.isEmpty(value) || value == 0) {
detail = new TIncomeDetail();
detail.setPayMonth(account.getSalaryMonth());
detail.setDeptId(account.getDeptId());
detail.setDeptName(account.getDeptName());
detail.setDeptNo(account.getDeptNo());
detail.setUnitId(tSalaryStandard.getUnitId());
detail.setUnitName(tSalaryStandard.getUnitName());
detail.setUnitNo(tSalaryStandard.getUnitNo());
detail.setCreateMonth(account.getSalaryMonth());
detail.setEmpIdcard(account.getEmpIdcard());
detail.setEmpName(account.getEmpName());
detail.setFeeMode(dept.getManagementType());
detail.setFeeType(isManage);
detail.setCharges(String.valueOf(dept.getManagementFee()));
money = dept.getManagementFee();
if (CommonConstants.TWO_STRING.equals(isManage)) {
money = dept.getRiskFundFee();
detail.setCharges(String.valueOf(dept.getRiskFundFee()));
detail.setFeeMode(dept.getRiskFundType());
}
if (CommonConstants.ONE_STRING.equals(feeType)) {
money = BigDecimalUtils.safeMultiply(account.getRelaySalary(), money, CommonConstants.ONE_OF_PERCENT);
}
detail.setMoney(money);
detail.setMrSettleType(dept.getMrSettleType());
detail.setRedData(CommonConstants.ZERO_STRING);
detail.setSourceId(account.getId());
detail.setSourceType(CommonConstants.FOUR_STRING);
detail.setApplyNo(tSalaryStandard.getApplyNo());
R<Boolean> saveR = HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tincome/inner/saveSalaryDetail", detail, Boolean.class, SecurityConstants.FROM_IN);
if (saveR == null || saveR.getCode() == CommonConstants.ONE_INT || Boolean.FALSE.equals(saveR.getData())) {
return false;
}
}
}
return true;
}
}
......@@ -32,8 +32,10 @@
<result property="empPhone" column="EMP_PHONE"/>
<result property="occupationType" column="OCCUPATION_TYPE"/>
<result property="occupationMonth" column="OCCUPATION_MONTH"/>
<result property="isZeroDeclare" column="IS_ZERO_DECLARE"/>
<result property="isDeclare" column="IS_DECLARE"/>
<result property="undeclareReason" column="UNDECLARE_REASON"/>
<result property="isZeroFlag" column="IS_ZERO_FLAG"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -44,6 +46,7 @@
a.EMP_PHONE,
a.OCCUPATION_TYPE,
a.OCCUPATION_MONTH,
a.IS_ZERO_DECLARE,
a.IS_DECLARE,
a.UNDECLARE_REASON
</sql>
......@@ -73,6 +76,9 @@
<if test="tStatisticsDeclarer.occupationMonth != null and tStatisticsDeclarer.occupationMonth.trim() != ''">
AND a.OCCUPATION_MONTH = #{tStatisticsDeclarer.occupationMonth}
</if>
<if test="tStatisticsDeclarer.isZeroDeclare != null and tStatisticsDeclarer.isZeroDeclare.trim() != ''">
AND a.IS_ZERO_DECLARE = #{tStatisticsDeclarer.isZeroDeclare}
</if>
<if test="tStatisticsDeclarer.isDeclare != null and tStatisticsDeclarer.isDeclare.trim() != ''">
AND a.IS_DECLARE = #{tStatisticsDeclarer.isDeclare}
</if>
......@@ -97,7 +103,10 @@
<select id="doStatisticsTaxDeclarer" resultMap="tStatisticsDeclarerMap">
SELECT
#{nowMonth} DECLARE_MONTH,c.EMP_NAME,c.EMP_IDCARD,c.EMP_PHONE,c.INVOICE_TITLE DECLARE_UNIT,
if(c.FORM_TYPE=0,'0',if(c.FORM_TYPE=3 or c.FORM_TYPE=4,'1','-')) OCCUPATION_TYPE FROM
if(c.FORM_TYPE=0,'0',if(c.FORM_TYPE=3 or c.FORM_TYPE=4,'1','-')) OCCUPATION_TYPE,
'1' IS_ZERO_DECLARE,
'0' IS_ZERO_FLAG
FROM
(SELECT s.* FROM t_salary_account s,
(SELECT a.EMP_NAME,a.EMP_IDCARD,a.EMP_PHONE,a.INVOICE_TITLE,a.FORM_TYPE,MAX(CREATE_TIME) max_day,a.SETTLEMENT_MONTH,
if(a.FORM_TYPE=0,'0',if(a.FORM_TYPE=3 or a.FORM_TYPE=4,'1','-')) CUPATION_TYPE
......@@ -106,6 +115,22 @@
WHERE s.DELETE_FLAG = '0' AND b.max_day = s.CREATE_TIME
AND s.EMP_IDCARD = b.EMP_IDCARD AND s.INVOICE_TITLE = b.INVOICE_TITLE
AND s.SETTLEMENT_MONTH = b.SETTLEMENT_MONTH) c
GROUP BY c.EMP_IDCARD,c.INVOICE_TITLE,c.SETTLEMENT_MONTH
GROUP BY c.EMP_IDCARD,c.INVOICE_TITLE,c.SETTLEMENT_MONTH,OCCUPATION_TYPE
</select>
<select id="doStatisticsTaxDeclarerYear" resultMap="tStatisticsDeclarerMap">
select b.DECLARE_MONTH,b.EMP_NAME,b.EMP_IDCARD,b.EMP_PHONE,b.DECLARE_UNIT,
b.OCCUPATION_TYPE,
b.IS_ZERO_DECLARE,
b.IS_ZERO_FLAG from (
SELECT
#{nowMonth} DECLARE_MONTH,c.EMP_NAME,c.EMP_IDCARD,c.EMP_PHONE,c.INVOICE_TITLE DECLARE_UNIT,
if(c.FORM_TYPE=0 or c.FORM_TYPE=1 or c.FORM_TYPE=2,'0',if(c.FORM_TYPE=3 or c.FORM_TYPE=4,'1','-')) OCCUPATION_TYPE,
'2' IS_ZERO_DECLARE,
if(DATE_FORMAT(max(c.CREATE_TIME),"%Y%m")>=DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 3 MONTH),"%Y%m"),'1','0') IS_ZERO_FLAG
FROM t_salary_account c WHERE c.DELETE_FLAG = '0' and c.SETTLEMENT_MONTH like concat(DATE_FORMAT(NOW(), '%Y'), '%')
GROUP BY c.EMP_IDCARD
having DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 1 MONTH),"%Y%m")
>DATE_FORMAT(max(c.CREATE_TIME),"%Y%m")) b
group by b.EMP_IDCARD,b.DECLARE_UNIT,b.OCCUPATION_TYPE
</select>
</mapper>
......@@ -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: 查询缴费库
......
......@@ -33,4 +33,12 @@ import java.util.List;
@Mapper
public interface TIncomeDetailMapper extends BaseMapper<TIncomeDetail> {
List<TIncomeDetail> getTIncomeDetailList(@Param("tIncomeDetail") TIncomeDetail tIncomeDetail);
/**
* @Description: 获取重复性
* @Author: hgw
* @Date: 2022/12/5 11:16
* @return: int
**/
int getTIncomeDetailRepeat(@Param("tIncomeDetail") TIncomeDetail detail);
}
......@@ -200,6 +200,8 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
void updateBySocialIncomePayment(@Param("id")String id);
void updateBySocialIncomeFlag(@Param("id")String id);
/**
* 缴费库社保推送查询
* @param searchVo 缴费库
......
......@@ -30,4 +30,13 @@ import java.util.List;
*/
public interface TIncomeDetailService extends IService<TIncomeDetail> {
List<TIncomeDetail> getTIncomeDetailList(TIncomeDetail detail);
/**
* @Description: 获取重复性
* @Author: hgw
* @Date: 2022/12/5 11:16
* @return: int
**/
int getTIncomeDetailRepeat(TIncomeDetail detail);
}
......@@ -146,6 +146,8 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
void createPaymentInfoIncome();
void createPaymentFundIncome();
void signPaymentNoIncomeFlag();
TPaymentVo getPaymentSocialAndFound(TPaymentInfo info);
void pushPaymentSocialFundInfo(TPaymentInfoSearchVo searchVo);
......
......@@ -53,6 +53,7 @@ import com.yifu.cloud.plus.v1.yifu.social.service.TDispatchInfoService;
import com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService;
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.util.DoSocialTask;
import com.yifu.cloud.plus.v1.yifu.social.util.ServiceUtil;
import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import lombok.RequiredArgsConstructor;
......@@ -64,6 +65,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -117,6 +119,10 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
ExcelUtil<Object> excelUtil = new ExcelUtil<>(Object.class);
@Autowired
private DoSocialTask socialTask;
/**
* 派单信息记录表简单分页查询
*
......@@ -3126,7 +3132,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
&& CommonConstants.ONE_INT == flag){
// 更新预估数据 -- 失败项重新派单审核不通过不处理预估
if (!flagTemp){
forecastLibraryService.updateForecastLibaryByDispatchReduce(sf, forecastFlag);
socialTask.asynchronousDisPatchHandle(sf, forecastFlag,null,null,CommonConstants.ZERO_INT);
}
// 更新人员档案和项目档案的社保公积金状态
UpProjectSocialFundVo vo = new UpProjectSocialFundVo();
......@@ -3272,6 +3278,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
int forecastFlag = CommonConstants.ZERO_INT;
// auditFlag 表示社保办理无办理项是不保存
boolean auditFlag = true;
boolean partSuccess = false;
for (TDispatchInfo dis : disList) {
auditFlag = true;
if (CommonConstants.ZERO_STRING.equals(typeSub)) {
......@@ -3287,6 +3294,21 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
errorList.add(new ErrorMessage(-1, "找不到员工社保公积金查询数据:" + dis.getEmpName()));
continue;
}
partSuccess = Common.isNotNull(sf) && Common.isNotNull(dis.getSocialId())
&& (CommonConstants.ONE_STRING.equals(sf.getPensionHandle())
|| CommonConstants.ONE_STRING.equals(sf.getMedicalHandle())
|| CommonConstants.ONE_STRING.equals(sf.getWorkInjuryHandle())
|| CommonConstants.ONE_STRING.equals(sf.getBirthHandle())
|| CommonConstants.ONE_STRING.equals(sf.getUnemployHandle())
|| (CommonConstants.ONE_STRING.equals(sf.getBigailmentHandle())
&& CommonConstants.ZERO_STRING.equals(sf.getIsIllness())))
&& !(CommonConstants.ONE_STRING.equals(sf.getPensionHandle())
&& CommonConstants.ONE_STRING.equals(sf.getMedicalHandle())
&& CommonConstants.ONE_STRING.equals(sf.getWorkInjuryHandle())
&& CommonConstants.ONE_STRING.equals(sf.getBirthHandle())
&& CommonConstants.ONE_STRING.equals(sf.getUnemployHandle())
&& (CommonConstants.ONE_STRING.equals(sf.getBigailmentHandle())
&& CommonConstants.ZERO_STRING.equals(sf.getIsIllness())));
if (!CommonConstants.TWO_STRING.equals(dis.getStatus())) {
errorList.add(new ErrorMessage(-1, "派单审核通过后才可以办理:" + dis.getEmpName()));
continue;
......@@ -3386,13 +3408,13 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (Common.isNotNull(libraryFundInfoList)) {
for (TForecastLibrary library :libraryFundInfoList) {
//办理成功生成收入
createIncomeInfo(library);
socialTask.asynchronousDisPatchHandle(null,0,null,library,CommonConstants.THREE_INT);
if (CommonConstants.ZERO_INT == library.getDataPush()) {
libraryFundInfoList1.add(library);
}
}
if (Common.isNotNull(libraryFundInfoList1)) {
forecastLibraryService.pushForecastFundInfo(libraryFundInfoList1);
socialTask.asynchronousDisPatchHandle(null,0,libraryFundInfoList1,null,CommonConstants.TWO_INT);
}
}
}
......@@ -3571,21 +3593,25 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
&& (CommonConstants.FIVE_STRING.equals(sf.getSocialStatus())
|| CommonConstants.FOUR_STRING.equals(sf.getFundStatus()))){
// 派增办理,全部失败 同步预估库数据
forecastLibraryService.updateForecastLibaryByDispatchReduce(sf, forecastFlag);
socialTask.asynchronousDisPatchHandle(sf, forecastFlag,null,null,CommonConstants.ZERO_INT);
}
// 社保办理只要办理成功就刷新预估数据 公积金办理不用处理
if (Common.isNotNull(dis.getSocialId())
&& CommonConstants.FOUR_STRING.equals(sf.getSocialStatus())
|| CommonConstants.TWO_STRING.equals(sf.getSocialStatus())
|| CommonConstants.THREE_STRING.equals(sf.getSocialStatus())){
if (partSuccess){
forecastLibraryService.updateForecastLibaryByDispatch(sf);
}else {
socialTask.asynchronousDisPatchHandle(sf, 0,null,null,CommonConstants.ONE_INT);
}
}
}
// 2.派减办理成功 处理预估 (不管社保还是公积金办理失败)
if (CommonConstants.ONE_STRING.equals(dis.getType())
&& CommonConstants.ZERO_INT == flag){
// 同步预估库数据
forecastLibraryService.updateForecastLibaryByDispatchReduce(sf, forecastFlag);
socialTask.asynchronousDisPatchHandle(sf, forecastFlag,null,null,CommonConstants.ZERO_INT);
}
// 派减办理失败不同步档案的相关字段信息
if (!(CommonConstants.ONE_STRING.equals(dis.getType()) && CommonConstants.ONE_INT == flag)){
......
......@@ -39,4 +39,15 @@ public class TIncomeDetailServiceImpl extends ServiceImpl<TIncomeDetailMapper, T
public List<TIncomeDetail> getTIncomeDetailList(TIncomeDetail detail) {
return baseMapper.getTIncomeDetailList(detail);
}
/**
* @Description: 获取重复性
* @Author: hgw
* @Date: 2022/12/5 11:16
* @return: int
**/
@Override
public int getTIncomeDetailRepeat(TIncomeDetail detail) {
return baseMapper.getTIncomeDetailRepeat(detail);
}
}
......@@ -251,8 +251,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
* @Date: 2022/8/31 16:34
* @return: boolean
**/
@Override
public boolean saveDetail(TIncomeDetail tIncomeDetail) {
public boolean saveDetail(TIncomeDetail tIncomeDetail,boolean synFlag) {
if (Common.isEmpty(tIncomeDetail.getEmpIdcard())
|| Common.isEmpty(tIncomeDetail.getDeptId())
|| Common.isEmpty(tIncomeDetail.getPayMonth())) {
......@@ -274,10 +273,10 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
tIncomeDetailService.save(tIncomeDetail);
// 不存在,直接新增
if (incomeList == null || incomeList.isEmpty()) {
return this.saveIncome(tIncomeDetail);
return this.saveIncome(tIncomeDetail,synFlag);
} else {
// 核心判断
return this.copyCore(tIncomeDetail, incomeList, detailList,null);
return this.copyCore(tIncomeDetail, incomeList, detailList,null,synFlag);
}
}
......@@ -313,7 +312,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return this.savePaymentIncome(tIncomeDetail,paymentInfo);
} else {
// 核心判断
return this.copyCore(tIncomeDetail, incomeList, detailList,paymentInfo);
return this.copyCore(tIncomeDetail, incomeList, detailList,paymentInfo,true);
}
}
......@@ -401,14 +400,18 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
}
// 复制并保存
private boolean saveIncome(TIncomeDetail tIncomeDetail) {
private boolean saveIncome(TIncomeDetail tIncomeDetail,boolean synFlag) {
TIncome income = new TIncome();
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
income.setApplyNo(tIncomeDetail.getApplyNo());
this.save(income);
long start = System.currentTimeMillis();
if (synFlag){
doJointSocialTask.asynchronousEkpIncome(income);
}else {
doJointSocialTask.asynchronousEkpIncomeAsso(income);
}
log.error("线程执行耗时:"+ (System.currentTimeMillis()-start));
return true;
}
......@@ -571,13 +574,26 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
* @return: boolean
**/
private boolean copyCore(TIncomeDetail tIncomeDetail, List<TIncome> incomeList, List<TIncomeDetail> detailList,
TPaymentInfo paymentInfo) {
TPaymentInfo paymentInfo,boolean synFlag) {
if (Common.isNotNull(tIncomeDetail.getSourceId())) {
// 如果该id、该类型的金额已存在,则不允许重复生成推送
TIncomeDetail a = new TIncomeDetail();
a.setId(tIncomeDetail.getId());
a.setSourceId(tIncomeDetail.getSourceId());
a.setMoney(tIncomeDetail.getMoney());
a.setRedData(tIncomeDetail.getRedData());
a.setFeeType(tIncomeDetail.getFeeType());
int repeatNums = tIncomeDetailService.getTIncomeDetailRepeat(a);
if (repeatNums > CommonConstants.ZERO_INT) {
return true;
}
}
// 判断,比例,直接加
if (CommonConstants.ONE_STRING.equals(tIncomeDetail.getFeeMode())) {
if (Common.isNotNull(paymentInfo)) {
return this.savePaymentIncome(tIncomeDetail,paymentInfo);
} else {
return this.saveIncome(tIncomeDetail);
return this.saveIncome(tIncomeDetail,synFlag);
}
} else {
Map<String, Integer> numMap = new HashMap<>();
......@@ -633,7 +649,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if (Common.isNotNull(paymentInfo)) {
return this.savePaymentIncome(tIncomeDetail,paymentInfo);
} else {
return this.saveIncome(tIncomeDetail);
return this.saveIncome(tIncomeDetail,synFlag);
}
}
} else {
......@@ -642,7 +658,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if (Common.isNotNull(paymentInfo)) {
return this.savePaymentIncome(tIncomeDetail,paymentInfo);
} else {
return this.saveIncome(tIncomeDetail);
return this.saveIncome(tIncomeDetail,synFlag);
}
}
}
......@@ -655,7 +671,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if (Common.isNotNull(paymentInfo)) {
return this.savePaymentIncome(tIncomeDetail,paymentInfo);
} else {
return this.saveIncome(tIncomeDetail);
return this.saveIncome(tIncomeDetail,synFlag);
}
}
} else {
......@@ -663,13 +679,13 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if (Common.isNotNull(paymentInfo)) {
return this.savePaymentIncome(tIncomeDetail,paymentInfo);
} else {
return this.saveIncome(tIncomeDetail);
return this.saveIncome(tIncomeDetail,synFlag);
}
}
}
} else {
// 各个模式累加逻辑:
return this.judgeMixModel(tIncomeDetail, numMap, incomeMap);
return this.judgeMixModel(tIncomeDetail, numMap, incomeMap,synFlag);
}
} else {
// 薪资。收费方式:2金额-人数
......@@ -679,13 +695,13 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if (Common.isNotNull(paymentInfo)) {
return this.savePaymentIncome(tIncomeDetail,paymentInfo);
} else {
return this.saveIncome(tIncomeDetail);
return this.saveIncome(tIncomeDetail,synFlag);
}
}
} else {
// 3金额-人次
// 各个模式累加逻辑:
return this.judgeMixModel(tIncomeDetail, numMap, incomeMap);
return this.judgeMixModel(tIncomeDetail, numMap, incomeMap,synFlag);
}
}
}
......@@ -742,7 +758,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
* @Date: 2022/9/1 18:17
* @return: boolean
**/
private boolean judgeMixModel(TIncomeDetail tIncomeDetail, Map<String, Integer> numMap, Map<String, Integer> incomeMap) {
private boolean judgeMixModel(TIncomeDetail tIncomeDetail, Map<String, Integer> numMap, Map<String, Integer> incomeMap,boolean synFlag) {
String month = tIncomeDetail.getPayMonth();
if (CommonConstants.THREE_STRING.equals(tIncomeDetail.getSourceType())) {
month = tIncomeDetail.getDataCreateMonth();
......@@ -753,11 +769,11 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
Integer maxNum = incomeMap.get(month + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
// 当明细的次数大于总次数,才可以新增统计
if (Common.isEmpty(maxNum) || ifNullToZero(nums) >= maxNum) {
return this.saveIncome(tIncomeDetail);
return this.saveIncome(tIncomeDetail,synFlag);
}
} else {
// 红冲判断:当本类型是最大值,才可以红冲
if (this.redDateJudge(tIncomeDetail, numMap)) return this.saveIncome(tIncomeDetail);
if (this.redDateJudge(tIncomeDetail, numMap)) return this.saveIncome(tIncomeDetail,synFlag);
}
return true;
}
......
......@@ -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()) && Common.isNotNull(infoByCodes.getData().getMapVO())) {
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());
}
}
}
}
......
......@@ -156,4 +156,16 @@
</where>
</select>
<!-- 获取重复性 -->
<select id="getTIncomeDetailRepeat" resultType="java.lang.Integer">
SELECT
count(1)
FROM t_income_detail a
where a.ID != #{tIncomeDetail.id}
AND a.SOURCE_ID = #{tIncomeDetail.sourceId}
AND a.MONEY = #{tIncomeDetail.money}
AND a.RED_DATA = #{tIncomeDetail.redData}
AND a.FEE_TYPE = #{tIncomeDetail.feeType}
</select>
</mapper>
......@@ -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