Commit 745fd89b authored by 李灿灿's avatar 李灿灿

Merge branch 'develop' into feature-licancan

parents 808aee3a 8707c12b
package com.yifu.cloud.plus.v1.yifu.ekp.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* @Author fxj
* @Description 薪资明细对接
* @Date 11:57 2022/8/22
* @Param
* @return
**/
@Data
@Component
@PropertySource("classpath:ekpIncomeConfig.properties")
@ConfigurationProperties(value = "income", ignoreInvalidFields = false)
public class EkpIncomeProperties {
String url;
String fdModelId;
String fdFlowId;
String docStatus;
String LoginName;
String docSubject;
}
package com.yifu.cloud.plus.v1.yifu.ekp.util;
import cn.hutool.json.JSONObject;
import com.yifu.cloud.plus.v1.yifu.ekp.config.EkpIncomeProperties;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParam;
import io.micrometer.core.instrument.util.StringUtils;
import lombok.extern.log4j.Log4j2;
import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.http.*;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
/**
* @Author hgw
* @Date 2022-8-31 12:00:07
* @Description
* @Version 1.0
*/
@Log4j2
@EnableConfigurationProperties(EkpIncomeProperties.class)
public class EkpIncomeUtil {
@Autowired
private EkpIncomeProperties ekpProperties;
public String sendToEKP(EkpIncomeParam param) {
log.info("推送EKP开始--收入明细数据");
RestTemplate yourRestTemplate = new RestTemplate();
try {
String formValues = new ObjectMapper().writeValueAsString(param);
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
JSONObject loginName = new JSONObject();
loginName.append("LoginName", ekpProperties.getLoginName());
MultiValueMap<String, Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("docSubject", ekpProperties.getDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docStatus", ekpProperties.getDocStatus());
wholeForm.add("fdModelId", ekpProperties.getFdModelId());
wholeForm.add("fdFlowId", ekpProperties.getFdFlowId());
wholeForm.add("formValues", formValues);
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword") 是VO,则使用APPLICATION_JSON
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity<MultiValueMap<String, Object>> entity = new HttpEntity<>(wholeForm, headers);
//有返回值的情况 VO可以替换成具体的JavaBean
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpProperties.getUrl(), HttpMethod.POST, entity, String.class);
String body = obj.getBody();
if (StringUtils.isBlank(body)) {
log.error(EkpConstants.SEND_FAILED);
return null;
} else {
log.info(EkpConstants.SEND_SUCCESS + body);
return body;
}
} catch (Exception e) {
log.info(e.getMessage());
return null;
}
}
}
......@@ -60,7 +60,6 @@ public class EkpInsuranceUtil {
//wholeForm.add("formValues", new String(formValues.getBytes("UTF-8"),"ISO-8859-1"));
wholeForm.add("formValues", formValues);
//wholeForm.add("formValues", new String("{\"fd_3adfe6af71a1cc\":\"王五\", \"fd_3adfe658c6229e\":\"2019-03-26\", \"fd_3adfe6592b4158\":\"这里内容\"}".getBytes("UTF-8"),"ISO-8859-1") );
//System.out.println("wholeForm:"+wholeForm);
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
......
package com.yifu.cloud.plus.v1.yifu.ekp.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @Author hgw
* @Date 2022-8-31 12:02:06
* @Description 收入明细对应参数
* @Version 1.0
*/
@Data
public class EkpIncomeParam implements Serializable {
/**
* 项目编码
**/
private String fd_3adfedf98ccba2;
/**
* 项目名称
**/
private String fd_3adfedf9d2bf1c;
/**
* 单号
**/
private String fd_3adfedfa4410aa;
/**
* 客户编码
**/
private String fd_3adfedfacd65d6;
/**
* 客户名称
**/
private String fd_3adfedfb174068;
/**
* 姓名
**/
private String fd_3adfedfb5a68a2;
/**
* 身份证号
**/
private String fd_3adfedfb8f76d4;
/**
* 手机号
**/
private String fd_3adfedfbd23ab8;
/**
* 银行卡号
**/
private String fd_3adfedfcb17f1e;
/**
* 开户行
**/
private String fd_3adfedfc453cc4;
/**
* 工资月份
**/
private String fd_3adfee063acff0;
/**
* 结算月份
**/
private String fd_3adfee0690737c;
/**
* 是否薪资扣税
**/
private String fd_3adfee01668666;
/**
* 社保优先级
**/
private String fd_3adfedfed8bb28;
/**
* 公积金优先级
**/
private String fd_3adfedff3a7430;
/**
* 是否自有员工
**/
private String fd_3adfee0009d070;
/**
* 年终奖扣税方案
**/
private String fd_3adfee01dea2fa;
/**
* 应发工资
**/
private String fd_3adfee12cb8840;
/**
* 个人代扣
**/
private String fd_3adfee1374ed7a;
/**
* 单位社保
**/
private String fd_3adfee1e2b2f78;
/**
* 个人社保
**/
private String fd_3adfee1e88723e;
/**
* 单位公积金
**/
private String fd_3adfee1ee24680;
/**
* 个人公积金
**/
private String fd_3adfee1f32fa24;
/**
* 个税
**/
private String fd_3adfee1f901c46;
/**
* 企业年金单位
**/
private String fd_3adfee1ff1ca6a;
/**
* 企业年金个人
**/
private String fd_3adfee203f86b2;
/**
* 实发合计
**/
private String fd_3adfee20fe5ba4;
/**
* 应收
**/
private String fd_3adfee21802434;
/**
* 收入结算状态
**/
private String fd_3adfee4ba5ad36;
/**
* 收款状态
**/
private String fd_3adfee4c0c59ee;
/**
* 收入结算单号
**/
private String fd_3adfee5dd14866;
/**
* 收款单号
**/
private String fd_3adfee5e3d1638;
/**
* 代扣费用应支出
**/
private String fd_3adfeeb34ea0ea;
/**
* 代扣费用结算状态
**/
private String fd_3adfeededfb5a6;
/**
* 代扣费用付款状态
**/
private String fd_3adfeed3a20598;
/**
* 代扣费用结算单号
**/
private String fd_3aea30866d0c30;
/**
* 代扣费用付款单号
**/
private String fd_3aea309696d32e;
/**
* 个税应支出
**/
private String fd_3adfeec6db8766;
/**
* 个税结算状态
**/
private String fd_3adfeef8ef38fc;
/**
* 个税付款状态
**/
private String fd_3adfeedd08222c;
/**
* 个税支出结算单号
**/
private String fd_3aeadede4cea84;
/**
* 个税支出付款单号
**/
private String fd_3aeadee1cf1266;
/**
* 实发合计应支出
**/
private String fd_3adfeec730ec44;
/**
* 工资实发结算状态
**/
private String fd_3adfeef9440ab2;
/**
* 实发合计付款状态
**/
private String fd_3adfeedd5f3cb2;
/**
* 实发结算单号
**/
private String fd_3aeadf17522642;
/**
* 实发付款单号
**/
private String fd_3aeadf17b7d03a;
/**
* 企业年金单位应支出
**/
private String fd_3adfeec782070a;
/**
* 企业年金单位应结算状态
**/
private String fd_3adfeef9b9fb3e;
/**
* 企业年金单位付款状态
**/
private String fd_3adfeeddacf6d4;
/**
* 年金单位结算单号
**/
private String fd_3aeadf182ef6a2;
/**
* 年金单位付款单号
**/
private String fd_3aeadf1892fdb2;
/**
* 企业年金个人应支出
**/
private String fd_3adfeec7ccdd1c;
/**
* 企业年金个人结算状态
**/
private String fd_3adfeefa1eba32;
/**
* 企业年金个人付款状态
**/
private String fd_3adfeede08d430;
/**
* 年金个人结算单号
**/
private String fd_3aeadf191c62a0;
/**
* 年金个人付款单号
**/
private String fd_3aeadf1992544c;
/**
* 暂停发
**/
private String fd_3af9d49d165e90;
/**
* 税务主体
**/
private String fd_3afab1895feea2;
}
ekp.url=http://119.96.227.251:8080/api/sys-modeling/appModelRestService/addModel
ekp.fdModelId=181d7633ff8bc797276d0d3a54e80ad6
ekp.fdFlowId=182b40249c1bc940d7226b941c7a4183
ekp.docStatus=20
ekp.LoginName=admin
ekp.docSubject=\u6536\u5165\u660E\u7EC6\u6570\u636E\u63A5\u53E3
......@@ -1026,14 +1026,14 @@ public class InsurancesConstants {
/**
* 预估
* 预估
*/
public static final String ESTIMATE_SETTLE_BILL = "预估";
public static final String ESTIMATE_SETTLE_BILL = "预估";
/**
* 实缴
* 实缴
*/
public static final String ACTUAL_SETTLE_BILL = "实缴";
public static final String ACTUAL_SETTLE_BILL = "实缴";
/**
* 新增结算单
......@@ -1041,15 +1041,20 @@ public class InsurancesConstants {
public static final String NEW_SETTLE_BILL = "新增结算单";
/**
* 结算中
* 更新结算单信息
*/
public static final String UPDATE_SETTLE_BILL = "更新结算单信息";
/**
* 结算中
* 作废结算单信息
*/
public static final String ABOLISH_SETTLE_BILL = "作废结算单信息";
/**
* 红冲结算单信息
*/
public static final String CORRECT_SETTLE_BILL = "红冲结算单信息";
}
......@@ -1257,7 +1257,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
updateBatchById(successList);
if (CollectionUtils.isNotEmpty(successList)){
threadPool.execute(() -> {
//threadPool.execute(() -> {
//根据结算类型是合并结算,推送预估保费到ekp(上面已经算好,这里直接判断有预估保费的就推送)
for (TInsuranceDetail tInsuranceDetail : successList) {
Integer settleType = tInsuranceDetail.getSettleType();
......@@ -1275,7 +1275,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
});
//});
}
//根据项目编码获取项目名称
setProjectNameByDeptNo(errorList);
......@@ -2033,16 +2033,15 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}else {
param.setInsuranceHandleCity(Integer.parseInt(redisHandleCityName));
}
//保单开始日期、结束日期,由系统根据保单号关联查询投保状态为 "已投保" 的商险记录的任意一条
TInsuranceDetail limitOne = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
TInsuranceDetail limitOne = getOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getPolicyNo, param.getPolicyNo())
.eq(TInsuranceDetail::getBuyHandleStatus, CommonConstants.THREE_INT)
//有效
.and(
/*.and(
wrapper -> wrapper.eq(TInsuranceDetail::getIsEffect,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsEffect)
)
)*/
//未过期
.and(
wrapper -> wrapper.eq(TInsuranceDetail::getIsOverdue,CommonConstants.ZERO_INT)
......@@ -3360,7 +3359,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.SETTLE_MONTH_CHANGE_LIST_IS_EMPTY);
}
Map<String, List<SettleMonthChangeCheckParam>> map = settleMonthChangeCheck(settleMonthCheckList, user);
//todo 生成EKP通知,通知ekp变更结算月份
List<SettleMonthChangeCheckParam> successList = map.get("successList");
List<SettleMonthChangeCheckParam> errorList = map.get("errorList");
List<SettleMonthChangeCheckParam> ekpList = new ArrayList<>();
......@@ -3394,6 +3392,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
threadPool.execute(()->{
List<EkpInteractiveParam> deptDetail = getDeptDetail(ekpList);
for (EkpInteractiveParam ekpInteractiveParam : deptDetail) {
TInsuranceDetail byId = getById(ekpInteractiveParam.getDetailId());
BeanCopyUtils.copyProperties(byId,ekpInteractiveParam);
ekpInteractiveParam.setInteractiveType(InsurancesConstants.UPDATE_SETTLE_BILL);
String body = eKPInsuranceUtil.sendToEkp(ekpInteractiveParam);
if (!StringUtils.isBlank(body)){
TInsuranceOperate insuranceOperate = new TInsuranceOperate();
......@@ -3452,6 +3453,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
EkpInteractiveParam interactiveParam = new EkpInteractiveParam();
TInsuranceDetail one = getOne(lambdaQuery().getWrapper().eq(TInsuranceDetail::getId, success.getId()));
BeanCopyUtils.copyProperties(one,interactiveParam);
interactiveParam.setDetailId(success.getId());
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
Integer oldSettleType = success.getOldSettleType();
Integer newSettleType = success.getNewSettleType();
......@@ -5375,7 +5377,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if(null != byId.getActualPremium()){
param.setActualPremium(byId.getActualPremium().negate());
}
param.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
param.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
pushType = CommonConstants.FIVE_INT;
}
......
......@@ -8,14 +8,24 @@ spring:
redis:
host: 127.0.0.1
port: 6379
password:
password: '@yf_2017'
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: yf_zsk
url: jdbc:mysql://192.168.1.65:22306/mvp_order?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
hikari:
driver-class-name: ${spring.datasource.driver-class-name}
jdbc-url: ${spring.datasource.url}
username: ${spring.datasource.username}
password: ${spring.datasource.password}
pool-name: AmytangHikariCP
minimum-idle: 10 # 最小空闲连接数量
idle-timeout: 60000 # 空闲连接存活最大时间,默认600000(10分钟)
maximum-pool-size: 12 # 连接池最大连接数,默认是10
auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime: 0 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
......
......@@ -150,6 +150,7 @@ public class TSalaryStandardController {
@Operation(description = "简单分页查询")
@GetMapping("/auditPage")
public R<IPage<TSalaryStandard>> getTSalaryStandardAuditPage(Page<TSalaryStandard> page, TSalaryStandardSearchVo tSalaryStandard) {
tSalaryStandard.setStatus(CommonConstants.ONE_INT);
return new R<>(tSalaryStandardService.getTSalaryStandardAuditPage(page, tSalaryStandard));
}
......
......@@ -23,7 +23,6 @@ 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.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsCurrentReport;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsCurrentReportService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsCurrentReportSearchVo;
......@@ -107,18 +106,4 @@ public class TStatisticsCurrentReportController {
return R.ok(tStatisticsCurrentReportService.removeById(id));
}
/**
* @param
* @Description: 生成本期申报
* @Author: hgw
* @Date: 2022-8-19 17:03:20
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@Inner
@Operation(description = "生成本期申报")
@PostMapping("/inner/doStatisticsCurrentReport")
public R<String> doStatisticsCurrentReport() {
return tStatisticsCurrentReportService.doStatisticsCurrentReportAuto();
}
}
......@@ -114,8 +114,9 @@ public class TStatisticsTaxSalaryController {
@Operation(description = "定时任务-年度报账+工资薪金+本期申报")
@PostMapping("/inner/doRefreshStatisticsTaxAuto")
public void doRefreshStatisticsTaxAuto() {
String settleMonth = DateUtil.addMonth(-1);
tStatisticsTaxSalaryTwoService.doRefreshStatisticsTaxAuto(settleMonth);
// 2022-8-31 16:04:22同徐梅、简洁改为申报月,实际数据为上个结算月的数据
String declareMonth = DateUtil.addMonth(0);
tStatisticsTaxSalaryTwoService.doRefreshStatisticsTaxAuto(declareMonth);
}
/**
......@@ -129,6 +130,7 @@ public class TStatisticsTaxSalaryController {
@PostMapping("/doRefreshStatisticsTaxAll")
@PreAuthorize("@pms.hasPermission('salary_tstatisticstaxsalary_refresh')")
public R<String> doRefreshStatisticsTaxAll(@RequestParam String settleMonth) {
// 2022-8-31 16:04:22同徐梅、简洁改为申报月,实际数据为上个结算月的数据
return tStatisticsTaxSalaryService.doRefreshStatisticsTaxAll(settleMonth);
}
......
......@@ -38,8 +38,8 @@ public interface TStatisticsCurrentReportMapper extends BaseMapper<TStatisticsCu
*/
IPage<TStatisticsCurrentReport> getTStatisticsCurrentReportPage(Page<TStatisticsCurrentReport> page, @Param("tStatisticsCurrentReport") TStatisticsCurrentReport tStatisticsCurrentReport);
int insertStatisticsCurrentReport(@Param("nowMonth") String nowMonth
, @Param("lastMonth") String lastMonth, @Param("nowYear") String nowYear);
int insertStatisticsCurrentReport(@Param("declareMonth") String declareMonth
, @Param("lastTwoMonth") String lastTwoMonth, @Param("lastTwoYear") String lastTwoYear);
/**
* @param yearMonth
......
......@@ -38,8 +38,8 @@ public interface TStatisticsTaxSalaryMapper extends BaseMapper<TStatisticsTaxSal
*/
IPage<TStatisticsTaxSalary> getTStatisticsTaxSalaryPage(Page<TStatisticsTaxSalary> page, @Param("tStatisticsTaxSalary") TStatisticsTaxSalary tStatisticsTaxSalary);
int insertStatisticsTaxSalaryByTableName(@Param("tableName") String tableName
, @Param("nowMonth") String nowMonth, @Param("lastYear") String lastYear);
int insertStatisticsTaxSalaryByTableName(@Param("tableName") String tableName, @Param("declareMonth") String declareMonth
, @Param("lastMonth") String lastMonth, @Param("lastYear") String lastYear);
/**
* @param yearMonth
......
......@@ -29,11 +29,11 @@ import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount2022;
*/
public interface TSalaryAccount2022Service extends IService<TSalaryAccount2022> {
/**
* @param settleMonth
* @param lastMonth 上月
* @Description: 根据结算月手动刷新
* @Author: hgw
* @Date: 2022/2/23 10:02
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
R<String> doRefreshSalaryAccountByMonth(String tableName, String settleMonth);
R<String> doRefreshSalaryAccountByMonth(String tableName, String lastMonth);
}
......@@ -20,14 +20,11 @@ package com.yifu.cloud.plus.v1.yifu.salary.service;
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.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsCurrentReport;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsCurrentReportSearchVo;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
/**
* 统计-本期申报
......@@ -51,24 +48,6 @@ public interface TStatisticsCurrentReportService extends IService<TStatisticsCur
**/
void listExport(HttpServletResponse response, TStatisticsCurrentReportSearchVo searchVo);
/**
* @param
* @Description: 生成-本期申报
* @Author: hgw
* @Date: 2020-6-15 18:02:35
* @return: com.yifu.cloud.v1.common.core.util.R
**/
R<String> doStatisticsCurrentReport(int monthNums);
/**
* @param
* @Description: 自动生成
* @Author: hgw
* @Date: 2022/2/21 17:53
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
R<String> doStatisticsCurrentReportAuto();
/**
* @param yearMonth
* @Description: 删除-按申报月份
......@@ -79,11 +58,11 @@ public interface TStatisticsCurrentReportService extends IService<TStatisticsCur
int deleteByYearMonth(String yearMonth);
/**
* @param settleMonth
* @param declareMonth
* @Description: 按结算月刷新本期申报
* @Author: hgw
* @Date: 2022/2/23 15:10
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
R<String> doRefreshStatisticsCurrentReport(String settleMonth);
R<String> doRefreshStatisticsCurrentReport(String declareMonth, String lastTwoMonth);
}
......@@ -43,12 +43,12 @@ public interface TStatisticsTaxSalaryService extends IService<TStatisticsTaxSala
void listExport(HttpServletResponse response, TStatisticsTaxSalarySearchVo searchVo);
/**
* @param settleMonth 结算
* @param declareMonth 申报
* @Description: 手动刷新-年度报账+工资薪金+本期申报
* @Author: hgw
* @Date: 2022/2/22 16:22
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
R<String> doRefreshStatisticsTaxAll(String settleMonth);
R<String> doRefreshStatisticsTaxAll(String declareMonth);
}
......@@ -14,21 +14,22 @@ public interface TStatisticsTaxSalaryTwoService extends IService<TStatisticsTaxS
/**
* @param tableName
* @param settleMonth
* @param declareMonth
* @Description: 生成工资薪金
* @Author: hgw
* @Date: 2022/2/25 10:30
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
R<String> doStatisticsTaxSalary(String tableName, String settleMonth);
R<String> doStatisticsTaxSalary(String tableName, String declareMonth, String lastMonth);
/**
* @param settleMonth
* @param declareMonth 申报月
* 2022-8-31 16:04:22同徐梅、简洁改为申报月,实际数据为上个结算月的数据
* @Description:
* @Author: hgw
* @Date: 2022/8/23 17:55
* @return: void
**/
void doRefreshStatisticsTaxAuto(String settleMonth);
void doRefreshStatisticsTaxAuto(String declareMonth);
}
......@@ -43,14 +43,14 @@ public class TSalaryAccount2022ServiceImpl extends ServiceImpl<TSalaryAccount202
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
@Override
public R<String> doRefreshSalaryAccountByMonth(String tableName, String settleMonth) {
public R<String> doRefreshSalaryAccountByMonth(String tableName, String lastMonth) {
if (Common.isEmpty(tableName)) {
tableName = "t_salary_account_" + settleMonth.substring(0, 4);
tableName = "t_salary_account_" + lastMonth.substring(0, 4);
}
baseMapper.createAccountYear(tableName);
int firstDelete = baseMapper.deleteSalaryAccountYearByMonth(tableName, settleMonth);
int firstDelete = baseMapper.deleteSalaryAccountYearByMonth(tableName, lastMonth);
if (firstDelete != -1) {
int firstCreate = baseMapper.insertIntoSalaryAccountYear(tableName, settleMonth);
int firstCreate = baseMapper.insertIntoSalaryAccountYear(tableName, lastMonth);
if (firstCreate != -1) {
return R.ok("已生成【年度报账】!");
} else {
......
......@@ -16,13 +16,8 @@
*/
package com.yifu.cloud.plus.v1.yifu.salary.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -30,19 +25,20 @@ 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.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
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.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsCurrentReport;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsCurrentReportMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsCurrentReportService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsCurrentReportSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsCurrentReportVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
......@@ -157,68 +153,25 @@ public class TStatisticsCurrentReportServiceImpl extends ServiceImpl<TStatistics
return wrapper;
}
@Override
public R<String> doStatisticsCurrentReportAuto() {
String firstMonth = DateUtil.addMonth(0); //本月
int firstDelete = baseMapper.deleteByYearMonth(firstMonth);
String secondMonth = DateUtil.addMonth(-1); //上月
int secondDelete = baseMapper.deleteByYearMonth(secondMonth);
if (firstDelete != -2 && secondDelete != -2) {
this.doStatisticsCurrentReport(0);
this.doStatisticsCurrentReport(-1);
return R.ok("已生成!");
} else {
return R.failed("删除失败!");
}
}
@Override
public R<String> doStatisticsCurrentReport(int monthNums) {
String nowMonth = DateUtil.addMonth(monthNums); //本月
String nowYear = nowMonth.substring(0, 4); //年份
//关联减少的——回盘数据月份
String lastMonth = DateUtil.addMonth(monthNums - 1); //上上月(例:当前202007:工资薪金为1~6月数据,回盘数据应为5月)
baseMapper.insertStatisticsCurrentReport(nowMonth, lastMonth, nowYear);
return R.ok("已生成!");
}
@Override
public int deleteByYearMonth(String yearMonth) {
return baseMapper.deleteByYearMonth(yearMonth);
}
@Override
public R<String> doRefreshStatisticsCurrentReport(String settleMonth) {
int firstDelete = baseMapper.deleteByYearMonth(settleMonth);
public R<String> doRefreshStatisticsCurrentReport(String declareMonth, String lastTwoMonth) {
int firstDelete = baseMapper.deleteByYearMonth(declareMonth);
if (firstDelete != -2) {
baseMapper.insertStatisticsCurrentReport(settleMonth, this.getMonthCur(settleMonth), settleMonth.substring(0, 4));
String mons = declareMonth.substring(4, 6);
String lastTwoYear = lastTwoMonth.substring(0, 4);
if ("02".equals(mons)) {
lastTwoYear = "-";
}
baseMapper.insertStatisticsCurrentReport(declareMonth, lastTwoMonth, lastTwoYear);
return R.ok("已生成完毕!");
} else {
return R.failed("删除本期申报失败!");
}
}
/**
* @param settleMonth
* @Description: 根据年月,获取上个月
* @Author: hgw
* @Date: 2022/3/4 17:05
* @return: java.lang.String
**/
private String getMonthCur(String settleMonth) {
String years = settleMonth.substring(0, 4);
String mons = settleMonth.substring(4, 6);
int lastMons = Integer.parseInt(mons) - 1;
String lastYearMonth;
if (lastMons == 0) {
lastYearMonth = (Integer.parseInt(years) - 1) + "12";
} else if (lastMons < 10) {
lastYearMonth = years + "0" + lastMons;
} else {
lastYearMonth = years + lastMons;
}
return lastYearMonth;
}
}
......@@ -32,12 +32,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.salary.entity.TStatisticsDeclarer;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsLabor;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsDeclarerMapper;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsLaborMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsLaborService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsLaborSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsLaborVo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPreDispatchInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
......@@ -58,7 +61,11 @@ import java.util.stream.Collectors;
*/
@Log4j2
@Service
@RequiredArgsConstructor
public class TStatisticsLaborServiceImpl extends ServiceImpl<TStatisticsLaborMapper, TStatisticsLabor> implements TStatisticsLaborService {
private final TStatisticsDeclarerMapper declarerMapper;
/**
* 本期劳务费申报表简单分页查询
*
......@@ -275,8 +282,15 @@ public class TStatisticsLaborServiceImpl extends ServiceImpl<TStatisticsLaborMap
}
String lastMonth = DateUtil.addMonthByYearMonth(-1,declareMonth); //上月
List<TStatisticsLabor> stdvoList = baseMapper.doStatisticsLabor(declareMonth,lastMonth);
for (TStatisticsLabor declarer : stdvoList) {
this.save(declarer);
for (TStatisticsLabor labor : stdvoList) {
TStatisticsDeclarer declarer = declarerMapper.selectOne(Wrappers.<TStatisticsDeclarer>query().lambda()
.eq(TStatisticsDeclarer::getDeclareMonth,declareMonth)
.eq(TStatisticsDeclarer::getEmpIdcard,labor.getEmpIdcard())
.eq(TStatisticsDeclarer::getDeclareUnit,labor.getDeclareUnit())
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(declarer) && CommonConstants.ZERO_STRING.equals(declarer.getIsDeclare())) {
this.save(labor);
}
}
return R.ok();
}
......
......@@ -30,11 +30,14 @@ 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.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsDeclarer;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsLabor;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsRemuneration;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsDeclarerMapper;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsRemunerationMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsRemunerationService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsRemunerationSearchVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
......@@ -54,7 +57,11 @@ import java.util.stream.Collectors;
*/
@Log4j2
@Service
@RequiredArgsConstructor
public class TStatisticsRemunerationServiceImpl extends ServiceImpl<TStatisticsRemunerationMapper, TStatisticsRemuneration> implements TStatisticsRemunerationService {
private final TStatisticsDeclarerMapper declarerMapper;
/**
* 本期稿酬申报表简单分页查询
*
......@@ -178,7 +185,14 @@ public class TStatisticsRemunerationServiceImpl extends ServiceImpl<TStatisticsR
String lastMonth = DateUtil.addMonthByYearMonth(-1,declareMonth); //上月
List<TStatisticsRemuneration> stdvoList = baseMapper.doStatisticsRemuneration(declareMonth,lastMonth);
for (TStatisticsRemuneration remuneration : stdvoList) {
this.save(remuneration);
TStatisticsDeclarer declarer = declarerMapper.selectOne(Wrappers.<TStatisticsDeclarer>query().lambda()
.eq(TStatisticsDeclarer::getDeclareMonth,declareMonth)
.eq(TStatisticsDeclarer::getEmpIdcard,remuneration.getEmpIdcard())
.eq(TStatisticsDeclarer::getDeclareUnit,remuneration.getDeclareUnit())
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(declarer) && CommonConstants.ZERO_STRING.equals(declarer.getIsDeclare())) {
this.save(remuneration);
}
}
return R.ok();
}
......
......@@ -173,14 +173,14 @@ public class TStatisticsTaxSalaryServiceImpl extends ServiceImpl<TStatisticsTaxS
}
/**
* @param settleMonth 结算
* @param declareMonth 申报
* @Description: 手动刷新-年度报账+工资薪金+本期申报
* @Author: hgw
* @Date: 2022/8/19 17:18
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> doRefreshStatisticsTaxAll(String settleMonth) {
public R<String> doRefreshStatisticsTaxAll(String declareMonth) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
......@@ -203,13 +203,13 @@ public class TStatisticsTaxSalaryServiceImpl extends ServiceImpl<TStatisticsTaxS
rules.setCanRefreshNums(10);
rules.setCreateTime(LocalDateTime.now());
rules.setCreateBy(String.valueOf(user.getId()));
rules.setSettleMonth(settleMonth);
rules.setSettleMonth(declareMonth);
rules.setYearMonthDay(yearMonthDay);
tStatisticsTaxSalaryRuleService.save(rules);
}
// 异步执行
doStatisticsTask.doRefreshCore(settleMonth);
doStatisticsTask.doRefreshCore(declareMonth);
return R.ok("正在生成中,请稍后查看!");
}
......
......@@ -2,6 +2,8 @@ package com.yifu.cloud.plus.v1.yifu.salary.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsTaxSalary;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsTaxSalaryMapper;
......@@ -29,39 +31,48 @@ public class TStatisticsTaxSalaryTwoServiceImpl extends ServiceImpl<TStatisticsT
private final TStatisticsCurrentReportService tStatisticsCurrentReportService;
/**
* @param tableName
* @param settleMonth
* @param declareMonth 申报月
* @param lastMonth 上个月的结算数据
* @Description: 刷新工资薪金
* @Author: hgw
* @Date: 2022/2/23 15:12
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
@Override
public R<String> doStatisticsTaxSalary(String tableName, String settleMonth) {
int deletes = baseMapper.deleteByYearMonth(settleMonth);
public R<String> doStatisticsTaxSalary(String tableName, String declareMonth, String lastMonth) {
int deletes = baseMapper.deleteByYearMonth(declareMonth);
if (deletes != -1) {
String settleYear = settleMonth.substring(0, 4);
baseMapper.insertStatisticsTaxSalaryByTableName(tableName, settleMonth, settleYear);
String settleYear = lastMonth.substring(0, 4);
baseMapper.insertStatisticsTaxSalaryByTableName(tableName, declareMonth, lastMonth, settleYear);
return R.ok("刷新工资薪金成功!");
}
return R.failed("刷新工资薪金失败!");
}
@Override
public void doRefreshStatisticsTaxAuto(String settleMonth) {
String tableName = "t_salary_account_" + settleMonth.substring(0, 4);
// 刷新对应结算月的 年度报账
R<String> accountR = tSalaryAccount2020Service.doRefreshSalaryAccountByMonth(tableName, settleMonth);
if (accountR != null && accountR.getCode() == CommonConstants.SUCCESS) {
// 刷新对应结算月的 工资薪金
R<String> taxR = this.doStatisticsTaxSalary(tableName, settleMonth);
if (taxR.getCode() == CommonConstants.SUCCESS) {
// 刷新对应结算月的 本期申报
tStatisticsCurrentReportService.doRefreshStatisticsCurrentReport(settleMonth);
public void doRefreshStatisticsTaxAuto(String declareMonth) {
// 2022-8-31 16:26 本期申报变更:徐梅、简洁确认修改最终:
// 年度报账表,拉取上月数据(结算月为上月)
// 工资薪金表,申报月为当月,结算月为上月,上月的年数据
// 本期申报: 申报月为当月,减去上上月的回盘,拉取当月的申报对象
String lastMonth = DateUtil.addMonthByString(declareMonth, -1);
String lastTwoMonth = DateUtil.addMonthByString(declareMonth, -2);
if (Common.isNotNull(lastMonth)) {
String tableName = "t_salary_account_" + lastMonth.substring(0, 4);
// 刷新对应结算月的 年度报账
R<String> accountR = tSalaryAccount2020Service.doRefreshSalaryAccountByMonth(tableName, lastMonth);
if (accountR != null && accountR.getCode() == CommonConstants.SUCCESS) {
// 刷新对应结算月的 工资薪金
R<String> taxR = this.doStatisticsTaxSalary(tableName, declareMonth, lastMonth);
if (taxR.getCode() == CommonConstants.SUCCESS) {
// 刷新对应结算月的 本期申报
tStatisticsCurrentReportService.doRefreshStatisticsCurrentReport(declareMonth, lastTwoMonth);
} else {
log.error(taxR.getMsg());
}
} else {
log.error(taxR.getMsg());
log.error(accountR == null ? "刷新对应结算月的 年度报账-失败!" : accountR.getMsg());
}
} else {
log.error(accountR == null ? "刷新对应结算月的 年度报账-失败!" : accountR.getMsg());
}
}
......
......@@ -21,15 +21,15 @@ public class DoStatisticsTask {
private TStatisticsTaxSalaryTwoService tStatisticsTaxSalaryTwoService;
/**
* @param settleMonth
* @param declareMonth 申报月(实际数据为上个结算月)
* @Description: 核心刷新-年度报账、工资薪金、本期申报
* @Author: hgw
* @Date: 2022-2-25 10:29:28
* @return: void
**/
@Async
public void doRefreshCore(String settleMonth) {
tStatisticsTaxSalaryTwoService.doRefreshStatisticsTaxAuto(settleMonth);
public void doRefreshCore(String declareMonth) {
tStatisticsTaxSalaryTwoService.doRefreshStatisticsTaxAuto(declareMonth);
}
}
......@@ -73,7 +73,7 @@
AND a.SETTLEMENT_ORGAN_NO LIKE CONCAT('%', #{tHaveSalaryNosocial.settlementOrganNo},'%')
</if>
<if test="tHaveSalaryNosocial.month != null">
AND a.month = #{tHaveSalaryNosocial.month}
AND a.month like concat('%', #{tHaveSalaryNosocial.month}, '%')
</if>
<if test="tHaveSalaryNosocial.createMonth != null">
AND a.CREATE_MONTH = #{tHaveSalaryNosocial.createMonth}
......
......@@ -307,6 +307,7 @@
AND a.STATUS = #{tSalaryStandard.status}
</if>
</if>
ORDER BY CREATE_TIME DESC
</where>
</select>
<resultMap id="salaryStandardExportMap" type="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardExportVo">
......
......@@ -208,7 +208,7 @@
<insert id="insertStatisticsCurrentReport">
insert into t_statistics_current_report (
select
concat(s.id,#{nowMonth}) id,
concat(s.id,#{declareMonth}) id,
s.INVOICE_TITLE,
s.SETTLE_DEPART_ID,
s.SETTLE_DEPART_NO,
......@@ -251,15 +251,16 @@
sum(ifnull(m.PERSONAL_UNEMPLOYMENT_MONEY,0)) PERSONAL_UNEMPLOYMENT_MONEY,
sum(ifnull(m.PERSONAL_PROVIDENT_FEE,0)) PERSONAL_PROVIDENT_FEE,
sum(ifnull(m.enterprise_annuity,0)) enterprise_annuity,
sum(if(m.declare_MONTH = #{lastMonth},all_income,0)) all_income,
sum(if(m.declare_MONTH = #{lastMonth},all_tax_prepaid,0)) all_tax_prepaid,
sum(if(m.declare_MONTH = #{lastMonth},all_tax_payable,0)) all_tax_payable
sum(if(m.declare_MONTH = #{lastTwoMonth},all_income,0)) all_income,
sum(if(m.declare_MONTH = #{lastTwoMonth},all_tax_prepaid,0)) all_tax_prepaid,
sum(if(m.declare_MONTH = #{lastTwoMonth},all_tax_payable,0)) all_tax_payable
from t_statistics_current_report_market m
where m.declare_MONTH <![CDATA[<=]]> #{lastMonth} and m.declare_MONTH like '${nowYear}%'
where m.declare_MONTH <![CDATA[<=]]> #{lastTwoMonth} and m.declare_MONTH like '${lastTwoYear}%'
GROUP BY m.EMP_IDCARD,m.INVOICE_TITLE
) m on m.EMP_IDCARD=s.EMP_IDCARD and m.INVOICE_TITLE = s.INVOICE_TITLE
left join t_statistics_declarer d on d.EMP_IDCARD=s.EMP_IDCARD and d.DECLARE_MONTH=#{lastMonth}
where s.DECLARE_MONTH = #{nowMonth} and (d.id is null or d.IS_DECLARE = '0')
left join t_statistics_declarer d on d.EMP_IDCARD=s.EMP_IDCARD and d.DECLARE_UNIT=s.INVOICE_TITLE
and d.OCCUPATION_TYPE='0' and d.DECLARE_MONTH=#{declareMonth}
where s.DECLARE_MONTH = #{declareMonth} and (d.id is null or d.IS_DECLARE = '0')
)
</insert>
......
......@@ -91,7 +91,7 @@
<!--统计-->
<select id="doStatisticsLabor" resultMap="tStatisticsLaborMap">
select
#{nowMonth} DECLARE_MONTH,a.EMP_NAME,a.EMP_IDCARD,sum(a.SALARY_TAX + a.SALARY_TAX_UNIT) PERSONAL_TAX,sum(a.RELAY_SALARY_UNIT) INCOME,
#{nowMonth} DECLARE_MONTH,a.EMP_NAME,a.EMP_IDCARD,sum(IFNULL(a.SALARY_TAX,0) + IFNULL(a.SALARY_TAX_UNIT,0)) PERSONAL_TAX,sum(a.RELAY_SALARY_UNIT) INCOME,
a.INVOICE_TITLE DECLARE_UNIT,'一般劳务报酬所得' INCOME_ITEM,'居民身份证' CARD_TYPE
from t_salary_account a
where a.DELETE_FLAG = 0 and a.SETTLEMENT_MONTH = #{lastMonth} and a.FORM_TYPE = '3'
......
......@@ -219,8 +219,8 @@
a.EMP_PHONE
from (
SELECT
concat(a.id,#{nowMonth}) id,
#{nowMonth} DECLARE_MONTH,
concat(a.id,#{declareMonth}) id,
#{declareMonth} DECLARE_MONTH,
a.INVOICE_TITLE,
a.EMP_ID,
a.EMP_NAME,
......@@ -258,7 +258,7 @@
a.CREATE_MONTH,
a.EMP_PHONE
FROM ${tableName} a
where a.SETTLEMENT_MONTH <![CDATA[ <= ]]> #{nowMonth} and a.SETTLEMENT_MONTH like concat(#{lastYear},'%')
where a.SETTLEMENT_MONTH <![CDATA[ <= ]]> #{lastMonth} and a.SETTLEMENT_MONTH like concat(#{lastYear},'%')
GROUP BY a.EMP_IDCARD,a.INVOICE_TITLE ORDER BY a.settle_depart_id asc
) a
left join t_salary_tax_config c on c.MIN_INCOME <![CDATA[ < ]]> a.taxable and c.MAX_INCOME >= a.taxable and c.TYPE=0
......
......@@ -251,8 +251,8 @@ public class TDispatchInfoController {
@SysLog("派单信息记录表 批量导入-派减")
@PostMapping("/importListReduce")
//@PreAuthorize("@pms.hasPermission('demo_tdispatchinfo-batch-reduce')")
public R<List<ErrorMessage>> importListReduce(@RequestBody MultipartFile file){
return tDispatchInfoService.importReduceDiy(file.getInputStream());
public R<List<ErrorMessage>> importListReduce(@RequestBody MultipartFile file, @RequestParam(required = false)String orderId){
return tDispatchInfoService.importReduceDiy(file.getInputStream(),orderId);
}
/**
......
......@@ -23,6 +23,7 @@ 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.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncome;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeService;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeSearchVo;
import io.swagger.v3.oas.annotations.Operation;
......@@ -160,4 +161,18 @@ public class TIncomeController {
public void export(HttpServletResponse response, @RequestBody TIncomeSearchVo searchVo) {
tIncomeService.listExport(response, searchVo);
}
/**
* @Description: 新增收入明细-详情表,同时统计;
* @Author: hgw
* @Date: 2022/8/31 16:34
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
@Operation(summary = "新增收入明细-详细表,同时统计", description = "新增收入明细表")
@SysLog("新增收入明细-详细表,同时统计")
@PostMapping("/saveDetail")
public R<Boolean> saveDetail(@RequestBody TIncomeDetail tIncomeDetail) {
return R.ok(tIncomeService.saveDetail(tIncomeDetail));
}
}
......@@ -58,11 +58,11 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> {
List<ErrorMessage> errorMessageList,
YifuUser user, String orderId);
R<List<ErrorMessage>> importReduceDiy(InputStream inputStream);
R<List<ErrorMessage>> importReduceDiy(InputStream inputStream, String orderId);
@Transactional
@ShardingTransactionType(TransactionType.BASE)
void batchReduceDispatch(List<TDispatchReduceVo> excelVOList, List<ErrorMessage> errorMessageList, YifuUser user);
void batchReduceDispatch(List<TDispatchReduceVo> excelVOList, List<ErrorMessage> errorMessageList, YifuUser user, String orderId);
R<Boolean> removeByIdDiy(String id);
......
......@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
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.social.entity.TIncome;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeSearchVo;
import javax.servlet.http.HttpServletResponse;
......@@ -49,4 +50,13 @@ public interface TIncomeService extends IService<TIncome> {
void listExport(HttpServletResponse response, TIncomeSearchVo searchVo);
List<TIncome> noPageDiy(TIncomeSearchVo searchVo);
/**
* @Description: 新增收入明细-详情表,同时统计;
* @Author: hgw
* @Date: 2022/8/31 16:31
* @return: boolean
**/
boolean saveDetail(TIncomeDetail tIncomeDetail);
}
......@@ -2312,7 +2312,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
@Override
public R<List<ErrorMessage>> importReduceDiy(InputStream inputStream) {
public R<List<ErrorMessage>> importReduceDiy(InputStream inputStream, String orderId) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
R.failed(CommonConstants.USER_FAIL);
......@@ -2361,7 +2361,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
batchReduceDispatch(cachedDataList, errorMessageList,user);
batchReduceDispatch(cachedDataList, errorMessageList,user,orderId);
log.info("存储数据库成功!");
}
}).sheet().doRead();
......@@ -2375,7 +2375,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
@Override
@Transactional(rollbackFor = Exception.class)
@ShardingTransactionType(TransactionType.BASE)
public void batchReduceDispatch(List<TDispatchReduceVo> excelVOList, List<ErrorMessage> errorMessageList, YifuUser user) {
public void batchReduceDispatch(List<TDispatchReduceVo> excelVOList, List<ErrorMessage> errorMessageList, YifuUser user, String orderId) {
if (!Common.isNotNull(excelVOList)){
return;
}
......@@ -2424,6 +2424,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 初始化派单 和 社保公积金查询信息
dispatch = getDispatchInfo(empVo, excel, socialFund,setInfoVo,user);
try {
dispatch.setOrderId(orderId);
dispatch.setApplyNo(getApplyCode());
dispatch.setStatus(CommonConstants.ONE_STRING);
baseMapper.insert(dispatch);
......
......@@ -32,12 +32,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.UpmsDaprUtils;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncome;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TIncomeMapper;
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.vo.TIncomeSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
......@@ -46,6 +50,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -57,6 +62,10 @@ import java.util.List;
@Log4j2
@Service
public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> implements TIncomeService {
@Autowired
private TIncomeDetailService tIncomeDetailService;
/**
* 收入明细表简单分页查询
*
......@@ -244,4 +253,20 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
BeanUtil.copyProperties(excel, insert);
this.save(insert);
}
/**
* @Description: 新增收入明细-详情表,同时统计;
* @Author: hgw
* @Date: 2022/8/31 16:34
* @return: boolean
**/
@Override
public boolean saveDetail(TIncomeDetail tIncomeDetail) {
tIncomeDetail.setCreateTime(new Date());
tIncomeDetail.setDataCreateMonth(DateUtil.addMonth(0));
tIncomeDetailService.save(tIncomeDetail);
// TODO-获取对应信息的统计表,根据项目配置,判断是否可以加一条统计:
return true;
}
}
......@@ -432,7 +432,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
dispatchReduceVo.setRowIndex(CommonConstants.ONE_INT);
List<TDispatchReduceVo> dispatchImportList = new ArrayList<>();
dispatchImportList.add(dispatchReduceVo);
dispatchInfoService.batchReduceDispatch(dispatchImportList, errorMessageList, user);
dispatchInfoService.batchReduceDispatch(dispatchImportList, errorMessageList, user, null);
// 处理派减结果
errorMessage = handleDispatchAddRes(preInfo,errorMessageList);
if (null != errorMessage){
......@@ -623,7 +623,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
dispatchReduce(dispatchReduceVo, pre);
List<TDispatchReduceVo> dispatchImportList = new ArrayList<>();
dispatchImportList.add(dispatchReduceVo);
dispatchInfoService.batchReduceDispatch(dispatchImportList, errorMessageList, user);
dispatchInfoService.batchReduceDispatch(dispatchImportList, errorMessageList, user, null);
//处理派减结果
handleDispatchAddRes(pre, errorMessageList);
......
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