Commit 02ad1b5e authored by fangxinjiang's avatar fangxinjiang

Merge branch 'develop' into feature/MVP1.0

parents cedbdd12 f7435bd3
......@@ -122,6 +122,20 @@ public class TEmployeeInfo extends BaseEntity {
@Max(value = 200, message = "年龄不可超过200")
private Integer empAge;
/**
* 年龄查询开始
*/
@Schema(description = "年龄查询开始")
@TableField(exist = false)
private int empAgeStart;
/**
* 年龄查询结束
*/
@Schema(description = "年龄查询结束")
@TableField(exist = false)
private int empAgeEnd;
/**
* 婚姻状态
*/
......
......@@ -71,6 +71,11 @@ public class EmployeeExportVO extends BaseEntity {
@DateTimeFormat("yyyy-MM-dd")
private LocalDateTime validityEnd;
@ExcelProperty(value = "年龄")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelAttribute(name = "年龄")
private Integer empAge;
@ExcelAttribute(name = "婚姻状况", isDataId = true,dataType = ExcelAttributeConstants.EMP_MARRIED)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "婚姻状况")
......
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;
......@@ -241,6 +239,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获取结算主体及单位部分信息
......
......@@ -76,4 +76,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;
......@@ -81,6 +78,8 @@ public interface TSettleDomainService extends IService<TSettleDomain> {
SetInfoVo getSetInfoByCodes(List<String> codes);
TSettleDomainListVo getSettleInfoByCodes(List<String> codes);
/**
* 通过id获取项目及单位部分信息
* @param
......
......@@ -328,6 +328,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 项目权限,已有权限不做删除处理
......
......@@ -82,6 +82,7 @@
<result property="empNatrue" column="EMP_NATRUE"/>
<result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="empAge" column="EMP_AGE"/>
<result property="validityStart" column="VALIDITY_START"/>
<result property="validityEnd" column="VALIDITY_END"/>
<result property="empMarriStatus" column="EMP_MARRI_STATUS"/>
......@@ -329,8 +330,11 @@
<if test="tEmployeeInfo.empBirthday != null">
AND a.EMP_BIRTHDAY = #{tEmployeeInfo.empBirthday}
</if>
<if test="tEmployeeInfo.empAge != null">
AND a.EMP_AGE = #{tEmployeeInfo.empAge}
<if test="tEmployeeInfo.empAgeStart >0">
AND a.EMP_AGE >= #{tEmployeeInfo.empAgeStart}
</if>
<if test="tEmployeeInfo.empAgeEnd >0">
AND a.EMP_AGE <![CDATA[ <= ]]> #{tEmployeeInfo.empAgeEnd}
</if>
<if test="tEmployeeInfo.empMarriStatus != null and tEmployeeInfo.empMarriStatus.trim() != ''">
AND a.EMP_MARRI_STATUS = #{tEmployeeInfo.empMarriStatus}
......@@ -952,6 +956,7 @@
a.EMP_NATRUE,
a.EMP_NAME,
a.EMP_IDCARD,
a.EMP_AGE,
a.VALIDITY_START,
a.VALIDITY_END,
a.EMP_MARRI_STATUS,
......
......@@ -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>
......@@ -41,17 +41,17 @@ public class AsyncConfig implements AsyncConfigurer {
* <!-- 允许的空闲时间,当线程空闲时间达到keepAliveTime时,线程会退出,直到线程数量=corePoolSize -->
* <!-- 如果allowCoreThreadTimeout=true,则会直到线程数量=0 -->
*/
taskExecutor.setKeepAliveSeconds(200);
taskExecutor.setKeepAliveSeconds(60);
/**
* <!-- 线程池维护线程的最大数量 -->
* <!-- 当线程数>=corePoolSize,且任务队列已满时。线程池会创建新线程来处理任务 -->
* <!-- 当线程数=maxPoolSize,且任务队列已满时,线程池会拒绝处理任务而抛出异常,异常见下
*/
taskExecutor.setMaxPoolSize(50);
taskExecutor.setMaxPoolSize(100);
/**
* <!-- 缓存队列(阻塞队列)当核心线程数达到最大时,新任务会放在队列中排队等待执行 -->
*/
taskExecutor.setQueueCapacity(100);
taskExecutor.setQueueCapacity(600);
/**
* 建议配置threadNamePrefix属性,出问题时可以更方便的进行排查。
**/
......
......@@ -156,6 +156,10 @@ public interface CommonConstants {
* number 5000
*/
int FIVES_INT = 5000;
/**
* number 5000
*/
int TEN_THOUSAND_INT = 10000;
/**
* number 1
......@@ -200,7 +204,7 @@ public interface CommonConstants {
* @Author pwang
* @Date 2019-08-02 16:39
**/
int[] dingleDigitIntArray = {0,1,2,3,4,5,6,7,8,9};
int[] dingleDigitIntArray = {0,1,2,3,4,5,6,7,8,9,10,11,12};
/**
* 个位数字串(阿里编码规约不允许直接使用‘魔法值’)
* @Author pwang
......
......@@ -514,6 +514,10 @@ public interface ErrorCodes {
*/
String EMP_DISPATCH_SOCIAL_PAYMENT_TYPE_NOT_SAME = "emp.dispatch.social.payment.type.same";
String SOCIAL_HOLD_IS_EMPTY = "social.hold.is.empty";
String FUND_HOLD_IS_EMPTY = "fund.hold.is.empty";
String ARCHIVES_IMPORT_EMP_TRUE = "archives.import.emp.true";
/**
......
......@@ -723,7 +723,7 @@ public class ExcelUtil <T> implements Serializable {
} else {
return errorInfo(attr, "_必须为数字且最多两位小数", i);
}
} else if (attr.min() == 0) {
} /*else if (attr.min() == 0) {
if (Common.isNumber(c)) {
if (attr.isFloat()){
if (Float.valueOf(c).compareTo(attr.min()) < CommonConstants.ZERO_INT) {
......@@ -731,7 +731,7 @@ public class ExcelUtil <T> implements Serializable {
}
}
}
}
}*/
}
return null;
}
......
......@@ -205,6 +205,10 @@ emp.dispatch.emp.contract.sub.name.not.empty=\u6D3E\u589E\u5F02\u5E38\uFF1A \u54
emp.dispatch.social.record.base.not.exist=\u6D3E\u589E\u5F02\u5E38\uFF1A\u5907\u6848\u57FA\u6570\u4E0D\u53EF\u4E3A\u7A7A
social.hold.is.empty=\u793E\u4FDD\u6237\u4E0D\u80FD\u4E3A\u7A7A
fund.hold.is.empty=\u516C\u79EF\u91D1\u6237\u4E0D\u80FD\u4E3A\u7A7A
......
......@@ -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,4 +246,13 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
List<TInsuranceDetail> selectByIdCardList(@Param("idCardList") List<String> idCardList
, @Param("idList") List<String> idList);
/**
* @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,
......@@ -1020,8 +1025,8 @@
<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
and a.INSURANCE_COMPANY_NAME = #{param.insuranceCompanyName}
</if>
<if test="param.createBy != null and param.createBy.trim() != ''">
and refund.UPDATE_BY = #{param.createBy}
<if test="param.updateBy != null and param.updateBy.trim() != ''">
and refund.UPDATE_BY = #{param.updateBy}
</if>
<if test="param.authSql != null and param.authSql.trim() != ''">
${param.authSql}
......@@ -1194,11 +1199,14 @@
FROM
t_insurance_detail
where
DELETE_FLAG = 0 AND EMP_IDCARD_NO in
DELETE_FLAG = 0
<if test="idCardList != null and idCardList.size > 0">
AND EMP_IDCARD_NO in
<foreach item="item" index="index" collection="idCardList" open="(" separator="," close=")">
#{item}
</foreach>
<if test="idList != null">
</if>
<if test="idList != null and idList.size > 0">
AND id not in
<foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
#{item}
......@@ -1206,4 +1214,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("------------定时任务标识根据项目不需要生成收入的数据-定时任务结束------------");
}
}
......@@ -148,12 +148,12 @@ public class TSalaryStandard extends BaseEntity {
@ExcelProperty("款项来源(0客户到款/1垫付)")
private Integer moneyFrom;
/**
* 状态(0待提交1待审核2:待推送3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印)
* 状态(0待提交1待审核2:待推送3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印 10 推送失败 11 推送收入中12推送收入失败
*/
@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 推送失败)不能为空")
@ExcelAttribute(name = "状态(0待提交1待审核2:待推送明细3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印10 推送失败 11 已审核生成收入中12已审核生成收入失败)", 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 推送失败 11 已审核生成收入中12已审核生成收入失败)不能为空")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("状态(0待提交1待审核2:待推送3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印 10 推送失败)")
@ExcelProperty("状态(0待提交1待审核2:待推送明细3已推送待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印 10 推送失败 11 已审核生成收入中12已审核生成收入失败)")
private Integer status;
/**
* 提交时间
......@@ -415,6 +415,22 @@ public class TSalaryStandard extends BaseEntity {
@ExcelIgnore
private String bpoFlag;
/**
* 生成、推送收入的开始时间
*/
@ExcelAttribute(name = "生成、推送收入的开始时间", isDate = true)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("生成、推送收入的开始时间")
private Date incomeStartTime;
/**
* 生成、推送收入的完成时间
*/
@ExcelAttribute(name = "生成、推送收入的完成时间", isDate = true)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("生成、推送收入的完成时间")
private Date incomeEndTime;
/**
* 工资月份-起
*/
......
......@@ -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;
}
......@@ -26,7 +26,7 @@ public class TSalaryStandardExportVo implements Serializable {
/**
* 状态0待提交 1待审核 2审核通过 3发送成功 5审核不通过 10 发送失败
*/
@ExcelAttribute(name = "状态", isDataId = true, readConverterExp = "0=待提交,1=待审核,2=审核通过,3=发送成功,5=审核不通过,6=确认不通过,10=发送失败")
@ExcelAttribute(name = "状态", isDataId = true, readConverterExp = "0=待提交,1=待审核,2=待推送明细,3=发送成功,5=审核不通过,6=确认不通过,10=发送失败,11=已审核生成收入中,12=已审核生成收入失败")
@NotBlank(message = "状态(0待提交 1待审核 2审核通过 3发送成功 5审核不通过 10 发送失败)不能为空")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("薪酬状态")
......
......@@ -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;
}
......@@ -229,4 +229,14 @@ public class TSalaryStandardController {
public R<String> backSalaryByApplyNo(@RequestParam String applyNo) {
return tSalaryStandardService.backSalaryByApplyNo(applyNo);
}
/**
* @param id
* @return
*/
@Operation(description = "重新生成收入")
@GetMapping("/salaryDoIncome")
public R<String> salaryDoIncome(@RequestParam String id) {
return tSalaryStandardService.salaryDoIncome(id);
}
}
......@@ -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);
}
......@@ -63,6 +63,15 @@ public interface TSalaryStandardService extends IService<TSalaryStandard> {
*/
R<String> salaryStandardAudit(String auditFlag, String auditRemark,String id);
/**
* @param id 工资表id
* @Description: 重新生成收入
* @Author: hgw
* @Date: 2022/11/29 17:49
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> salaryDoIncome(String id);
/**
* @Description: 删除工资表
* @Author: hgw
......
......@@ -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;
}
}
......@@ -75,6 +75,8 @@
<result property="orderId" column="ORDER_ID"/>
<result property="bpoFlag" column="BPO_FLAG"/>
<result property="applyNo" column="APPLY_NO"/>
<result property="incomeStartTime" column="INCOME_START_TIME"/>
<result property="incomeEndTime" column="INCOME_END_TIME"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -128,7 +130,9 @@
a.INVOICE_TITLE,
a.ORDER_ID,
a.BPO_FLAG,
a.APPLY_NO
a.APPLY_NO,
a.INCOME_START_TIME,
a.INCOME_END_TIME
</sql>
<sql id="tSalaryStandard_where">
<if test="tSalaryStandard != null">
......
......@@ -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;
/**
* 是否导入重复标识
*/
......
......@@ -17,6 +17,7 @@ import java.time.LocalDateTime;
public class TPreDispatchExportVo implements Serializable {
@ExcelAttribute(name = "主键", needExport = true)
@ExcelProperty("主键")
private String id;
/**
......
......@@ -168,7 +168,19 @@ public class TIncomeController {
@Inner
@PostMapping("/inner/saveDetail")
public Boolean saveDetail(@RequestBody TIncomeDetail tIncomeDetail) {
return tIncomeService.saveDetail(tIncomeDetail);
return tIncomeService.saveDetail(tIncomeDetail,true);
}
/**
* @Description: 薪资新增收入明细-详情表,同时统计;采用同步操作,因为薪资本身就是异步
* @Author: hgw
* @Date: 2022-11-29 17:29:29
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
@Inner
@PostMapping("/inner/saveSalaryDetail")
public Boolean saveSalaryDetail(@RequestBody TIncomeDetail tIncomeDetail) {
return tIncomeService.saveDetail(tIncomeDetail,false);
}
/**
......
......@@ -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);
}
......@@ -169,31 +169,68 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
* @param searchVo 缴费库
* @return
*/
List<TPaymentInfo> getTPaymentSocialPushInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
List<TPaymentInfo> getTPaymentSocialPushInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo,
@Param("userId") String userId);
/**
* 缴费库公积金推送查询
* @param searchVo 缴费库
* @return
*/
List<TPaymentInfo> getTPaymentFundPushInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
List<TPaymentInfo> getTPaymentFundPushInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo,
@Param("userId") String userId);
/**
* 缴费库社保收入推送查询
* @param searchVo 缴费库
* @return
*/
List<TPaymentInfo> getTPaymentSocialIncomeInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
List<TPaymentInfo> getTPaymentSocialIncomeInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo,
@Param("userId") String userId);
/**
* 缴费库公积金收入推送查询
* @param searchVo 缴费库
* @return
*/
List<TPaymentInfo> getTPaymentFundIncomeInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
List<TPaymentInfo> getTPaymentFundIncomeInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo,
@Param("userId") String userId);
void updateBySocialPayment(@Param("id")String id);
void updateBySocialIncomePayment(@Param("id")String id);
void updateBySocialIncomeFlag(@Param("id")String id);
/**
* 缴费库社保推送查询
* @param searchVo 缴费库
* @return
*/
long getTPaymentSocialPushCount(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo,
@Param("userId") String userId);
/**
* 缴费库公积金推送查询
* @param searchVo 缴费库
* @return
*/
long getTPaymentFundPushCount(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo,
@Param("userId") String userId);
/**
* 缴费库社保收入推送查询
* @param searchVo 缴费库
* @return
*/
long getTPaymentSocialIncomeCount(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo,
@Param("userId") String userId);
/**
* 缴费库公积金收入推送查询
* @param searchVo 缴费库
* @return
*/
long getTPaymentFundIncomeCount(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo,
@Param("userId") String userId);
}
......@@ -128,8 +128,8 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
void createForecastInfo();
void createForecastFundInfo();
void pushForecastInfo(List<TForecastLibrary> library);
void pushForecastInfo(List<TForecastLibrary> library, boolean synFlag);
void pushForecastFundInfo(List<TForecastLibrary> library);
void pushForecastFundInfo(List<TForecastLibrary> library, boolean synFlag);
}
......@@ -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);
}
......@@ -58,7 +58,7 @@ public interface TIncomeService extends IService<TIncome> {
* @Date: 2022/8/31 16:31
* @return: boolean
**/
boolean saveDetail(TIncomeDetail tIncomeDetail);
boolean saveDetail(TIncomeDetail tIncomeDetail,boolean synFlag);
/**
* @Description: 新增收入明细-详情表,同时统计;
......
......@@ -146,6 +146,8 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
void createPaymentInfoIncome();
void createPaymentFundIncome();
void signPaymentNoIncomeFlag();
TPaymentVo getPaymentSocialAndFound(TPaymentInfo info);
void pushPaymentSocialFundInfo(TPaymentInfoSearchVo searchVo);
......
......@@ -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;
}
......
......@@ -2347,7 +2347,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
importVo.setPost(preInfo.getPositionAdd());
importVo.setWorkingHours(preInfo.getWorkingHoursAdd());
importVo.setEmpNational(CommonConstants.ONE_STRING);
importVo.setEducationName(CommonConstants.FIVE_STRING);
importVo.setEducationName("大专");
importVo.setTrustRemark("预派单");
if (null != preInfo.getPensionBase()){
importVo.setRecordBase(preInfo.getPensionBase());
......@@ -2406,7 +2406,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
**/
private void initDispatchContractVo(TPreDispatchInfo preInfo, TDispatchImportVo importVo) {
if (Common.isNotNull(preInfo.getContractNameAdd())){
importVo.setContractName(preInfo.getContractTypeAdd());
importVo.setContractName("其他");
if (Common.isNotNull(preInfo.getContractStartAdd())){
importVo.setContractStart(DateUtil.stringToDate(ServiceUtil.
replaceSeparator(preInfo.getContractStartAdd(),CommonConstants.CENTER_SPLIT_LINE_STRING,
......
......@@ -102,6 +102,44 @@ public class DoJointSocialTask {
}
log.info("推送收入到EKP结束");
}
public void asynchronousEkpIncomeAsso(TIncome income) {
log.info("推送收入到EKP-线程开始");
try {
String sendBack = this.getSendBack(income);
if (Common.isEmpty(sendBack) || sendBack.length() != 32) {
sendBack = this.getSendBack(income);
}
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
incomeMapper.updateById(income);
} else {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FOUR_STRING);
error.setCreateUserName("收入表推送");
error.setLinkId(income.getId());
error.setTitle(sendBack);
error.setNums(CommonConstants.ONE_INT);
tSendEkpErrorService.saveError(error);
}
} catch (Exception e) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FOUR_STRING);
error.setCreateUserName("收入表推送");
error.setLinkId(income.getId());
error.setTitle(e.getMessage());
error.setNums(CommonConstants.ONE_INT);
tSendEkpErrorService.saveError(error);
log.error("推送收入到EKP错误", e);
}
log.info("推送收入到EKP结束");
}
/**
* @Description: 合同-批量更换负责人
......@@ -401,6 +439,13 @@ public class DoJointSocialTask {
**/
@Async
public void asynchronousEkpForecastSocial(EkpPushSocialParam socialParam, TForecastLibrary library) {
ekpForecastSocial(socialParam, library);
}
public void asynchronousEkpForecastSocialAsso(EkpPushSocialParam socialParam, TForecastLibrary library) {
ekpForecastSocial(socialParam, library);
}
private void ekpForecastSocial(EkpPushSocialParam socialParam, TForecastLibrary library) {
log.info("推送社保预估费用到EKP-线程开始");
try {
String body = ekpSocialUtil.sendToEKP(socialParam);
......@@ -444,6 +489,11 @@ public class DoJointSocialTask {
**/
@Async
public void asynchronousEkpForecastFund(EkpPushFundParam fundParam, TForecastLibrary library) {
initEkpForecastFund(fundParam, library);
}
private void initEkpForecastFund(EkpPushFundParam fundParam, TForecastLibrary library) {
initEkpForecastFund(fundParam, library);
log.info("推送公积金预估费用到EKP-线程开始");
try {
String body = ekpFundUtil.sendToEKP(fundParam);
......@@ -478,4 +528,8 @@ public class DoJointSocialTask {
}
log.info("推送公积金预估费用到EKP结束");
}
public void asynchronousEkpForecastFundAsso(EkpPushFundParam fundParam, TForecastLibrary library) {
initEkpForecastFund(fundParam, library);
}
}
package com.yifu.cloud.plus.v1.yifu.social.util;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
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.util.BigDecimalUtils;
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.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSendEkpErrorMapper;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @Author fxj
* @Date 2022/11/28
* @Description 批量办理异步处理
* @Version 1.0
*/
@Slf4j
@Component
public class DoSocialTask {
@Autowired
private TForecastLibraryService forecastLibraryService;
@Autowired
private TIncomeDetailService detailService;
@Autowired
private ArchivesDaprUtil archivesDaprUtil;
@Autowired
private TIncomeService incomeService;
@Autowired
private TSendEkpErrorMapper sendEkpErrorMapper;
/**
* @Author fxj
* @Description 异步处理相关信息
* @Date 11:23 2022/11/28
* @param type=0 updateForecastLibaryByDispatchReduce type=1 updateForecastLibaryByDispatch type=2 pushForecastFundInfo createIncomeInfo(library);
**/
@Async
public void asynchronousDisPatchHandle(TSocialFundInfo sf, int forecastFlag,List< TForecastLibrary > libs,TForecastLibrary library,int type) {
synchronized (this){
R<String> res;
String linkId = null;
try {
// 派单减少变更预估库-派减
if (type == CommonConstants.ZERO_INT){
linkId = sf.getId();
res = forecastLibraryService.updateForecastLibaryByDispatchReduce(sf, forecastFlag);
if (Common.isEmpty(res) || CommonConstants.SUCCESS != res.getCode()){
initSendError(library.getId(), res.getMsg(),"updateForecastLibaryByDispatchReduce:");
}
}
// 派单变更预估库
if (type == CommonConstants.ONE_INT){
linkId = sf.getId();
res = forecastLibraryService.updateForecastLibaryByDispatch(sf);
if (Common.isEmpty(res) || CommonConstants.SUCCESS != res.getCode()){
initSendError(sf.getId(), res.getMsg(),"updateForecastLibaryByDispatch:");
}
}
// 获取预估库数据并推送
if (type == CommonConstants.TWO_INT){
if (Common.isNotNull(libs)){
for (TForecastLibrary lib:libs){
if (Common.isEmpty(linkId)){
linkId = lib.getId();
}else {
linkId = linkId + CommonConstants.COMMA_CHAR + lib.getId();
}
}
}
forecastLibraryService.pushForecastFundInfo(libs,false);
}
// 获取预估库数据并推送
if (type == CommonConstants.THREE_INT){
linkId = library.getId();
createIncomeInfo(library);
}
}catch (Exception e){
initSendError(linkId, e.getMessage(),"asynchronousDisPatchHandle:");
}
}
}
private void initSendError(String linkId, String msg,String title) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.TWO_STRING);
error.setCreateUserName("社保预估费用推送");
error.setLinkId(linkId);
error.setTitle(title+ msg);
error.setNums(CommonConstants.ONE_INT);
this.saveError(error);
log.error("推送社保预估费用到EKP错误", msg);
}
private boolean saveError(TSendEkpError tSendEkpError) {
// 类型、创建日不可为空
if (Common.isEmpty(tSendEkpError.getType()) || Common.isEmpty(tSendEkpError.getCreateDay())) {
return false;
}
TSendEkpError error = sendEkpErrorMapper.getByTitleTypeDay(tSendEkpError);
if (error == null) {
return sendEkpErrorMapper.insert(tSendEkpError) > 0;
} else {
if (Common.isEmpty(tSendEkpError.getNums())) {
tSendEkpError.setNums(CommonConstants.ONE_INT);
}
error.setNums(error.getNums() + tSendEkpError.getNums());
return sendEkpErrorMapper.updateById(error) >= 0;
}
}
public void createIncomeInfo(TForecastLibrary library) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(library.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 isExist = false;
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setEmpIdcard(library.getEmpIdcard());
incomeDetail.setPayMonth(library.getProvidentPayMonth());
incomeDetail.setDeptNo(library.getDeptNo());
incomeDetail.setSourceType(CommonConstants.TWO_STRING);
List<TIncomeDetail> detailList = detailService.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailList)) {
BigDecimal sumMoney = BigDecimal.ZERO;
for (TIncomeDetail income : detailList) {
sumMoney = BigDecimalUtils.safeAdd(income.getMoney(),sumMoney);
}
if (sumMoney.compareTo(BigDecimal.ZERO) > 0) {
isExist = true;
}
}
if (Common.isNotNull(settleDomain)) {
// 含有社保,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && settleDomain.getManageServerItem()
.contains(CommonConstants.TWO_STRING) && !isExist &&
CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag()) &&
CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
//预估模式
//预估模式只有按人次和人数收费
createIncomeInsurance(library, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
settleDomain.getManagementFee());
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && settleDomain.getRiskServerItem()
.contains(CommonConstants.TWO_STRING) && !isExist &&
CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag()) &&
CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
//预估模式
createIncomeInsurance(library, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee());
}
}
}
public void createIncomeInsurance(TForecastLibrary library, TSettleDomain settleDomain, String feeType,
String charges, String feeMode, BigDecimal money) {
//生成收入数据
TIncomeDetail detail = new TIncomeDetail();
detail.setCreateTime(DateUtil.getCurrentDateTime());
detail.setDeptName(settleDomain.getDepartName());
detail.setDeptNo(settleDomain.getDepartNo());
detail.setDeptId(settleDomain.getId());
detail.setEmpIdcard(library.getEmpIdcard());
detail.setEmpName(library.getEmpName());
detail.setUnitNo(settleDomain.getCustomerNo());
detail.setUnitId(settleDomain.getCustomerId());
detail.setUnitName(settleDomain.getCustomerName());
detail.setDataCreateMonth(DateUtil.addMonth(0));
detail.setSourceId(library.getId());
detail.setSourceType(CommonConstants.TWO_STRING);
detail.setCreateMonth(library.getProvidentCreateMonth());
detail.setPayMonth(library.getProvidentPayMonth());
detail.setMoney(money);
detail.setFeeType(feeType);
detail.setFeeMode(feeMode);
detail.setCharges(charges);
detail.setMrSettleType(settleDomain.getMrSettleType());
detail.setRedData(CommonConstants.ZERO_STRING);
detail.setId(CommonConstants.NULL);
// 批量办理成功 收入不异步推送
incomeService.saveDetail(detail,false);
}
}
......@@ -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"/>
......@@ -1242,9 +1243,10 @@
<include refid="Base_Column_List"/>
FROM t_payment_info a
<where>
a.PUSH_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL
a.PUSH_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId}
<include refid="tPaymentInfo_export_where"/>
</where>
limit 0,10000
</select>
<!--tPaymentInfo公积金推送查询-->
......@@ -1253,9 +1255,10 @@
<include refid="Base_Column_List"/>
FROM t_payment_info a
<where>
a.PUSH_STATUS = '1' AND a.FUND_ID IS NOT NULL
a.PUSH_STATUS = '1' AND a.FUND_ID IS NOT NULL AND a.CREATE_BY = #{userId}
<include refid="tPaymentInfo_export_where"/>
</where>
limit 0,10000
</select>
<!--tPaymentInfo社保收入推送查询-->
......@@ -1264,9 +1267,10 @@
<include refid="Base_Column_List"/>
FROM t_payment_info a
<where>
a.INCOME_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL
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
</select>
<!--tPaymentInfo公积金收入推送查询-->
......@@ -1275,9 +1279,10 @@
<include refid="Base_Column_List"/>
FROM t_payment_info a
<where>
a.INCOME_STATUS = '1' AND a.FUND_ID IS NOT NULL
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
</select>
<!-- 更改社保公积金推送状态 -->
......@@ -1295,4 +1300,54 @@
where
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)
FROM t_payment_info a
<where>
a.PUSH_STATUS = '1' AND a.SOCIAL_ID IS NOT NULL AND a.CREATE_BY = #{userId}
<include refid="tPaymentInfo_export_where"/>
</where>
</select>
<!--tPaymentInfo公积金推送查询-->
<select id="getTPaymentFundPushCount" resultType="java.lang.Long">
SELECT
count(1)
FROM t_payment_info a
<where>
a.PUSH_STATUS = '1' AND a.FUND_ID IS NOT NULL AND a.CREATE_BY = #{userId}
<include refid="tPaymentInfo_export_where"/>
</where>
</select>
<!--tPaymentInfo社保收入推送查询-->
<select id="getTPaymentSocialIncomeCount" resultType="java.lang.Long">
SELECT
count(1)
FROM t_payment_info a
<where>
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>
<!--tPaymentInfo公积金收入推送查询-->
<select id="getTPaymentFundIncomeCount" resultType="java.lang.Long">
SELECT
count(1)
FROM t_payment_info a
<where>
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>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment