Commit 8707c12b authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

parents 07b45c66 322404dd
......@@ -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
......
......@@ -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;
}
......
......@@ -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);
}
}
......@@ -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
......
......@@ -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));
}
}
......@@ -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);
}
......@@ -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, orderId);
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, orderId);
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