Commit af1d7e1c authored by hongguangwu's avatar hongguangwu

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

parents b5a98698 5777a510
......@@ -4,12 +4,9 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
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.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
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;
......@@ -21,12 +18,8 @@ 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.salary.entity.SysMessageSalary;
import com.yifu.cloud.plus.v1.yifu.salary.entity.SysMessageSalaryTemp;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.SysMessageSalaryMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.SysMessageSalaryService;
import com.yifu.cloud.plus.v1.yifu.salary.service.SysMessageSalaryTempService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SysMessageSalaryExportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SysMessageSalarySearchVo;
import lombok.AllArgsConstructor;
......@@ -39,7 +32,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -52,10 +44,6 @@ import java.util.Map;
@AllArgsConstructor
@Service("sysMessageSalaryService")
public class SysMessageSalaryServiceImpl extends ServiceImpl<SysMessageSalaryMapper, SysMessageSalary> implements SysMessageSalaryService {
@Autowired
private TSalaryAccountService salaryAccountService;
@Autowired
private SysMessageSalaryTempService sysMessageSalaryTempService;
@Autowired
private ArchivesDaprUtil archivesDaprUtil;
......
......@@ -299,6 +299,11 @@
<where>
1=1 and ((b.IGNORE_FLAG=1 and b.TYPE=2) or (b.id is null))
<include refid="export_sql"/>
<if test="sysMessageSalary != null">
<if test="sysMessageSalary.limitStart != null">
limit #{sysMessageSalary.limitStart},#{sysMessageSalary.limitEnd}
</if>
</if>
</where>
</select>
......@@ -324,12 +329,12 @@
<!--数据权限判断-->
<if test="settleDomainIds != null">
<if test="settleDomainIds.size() > 0">
and a.SETTLE_DOMAIN_ID in
and a.DEPART_ID in
<foreach collection="settleDomainIds" item="param" index="index" open="(" close=")" separator=",">
#{param}
</foreach>
</if>
<if test="settleDomainVos.size() == 0">
<if test="settleDomainIds.size() == 0">
and 1=2
</if>
</if>
......
......@@ -218,6 +218,11 @@
<where>
1=1 and ((b.IGNORE_FLAG=1 and b.TYPE=1) or (b.id is null))
<include refid="export_where"/>
<if test="tHaveSalaryNosocial != null">
<if test="tHaveSalaryNosocial.limitStart != null">
limit #{tHaveSalaryNosocial.limitStart},#{tHaveSalaryNosocial.limitEnd}
</if>
</if>
</where>
</select>
<select id="noPageCountDiy" resultType="java.lang.Integer">
......
......@@ -109,11 +109,9 @@
#{nowMonth} DECLARE_MONTH,a.EMP_NAME,a.EMP_IDCARD,a.INVOICE_TITLE DECLARE_UNIT,
sum(annualbonus.SALARY_MONEY) ANNUAL_BONUS,sum(tax.SALARY_MONEY) BONUS_TAX
from t_salary_account a
left join t_salary_employee b on b.id = a.EMP_ID
left join t_salary_account_item annualbonus on annualbonus.SALARY_ACCOUNT_ID = a.id and annualbonus.CN_NAME='年终奖'
left join t_salary_account_item tax on tax.SALARY_ACCOUNT_ID = a.id and tax.CN_NAME='年终奖单独扣税'
left join t_salary_standard s ON s.id = a.SALARY_FORM_ID
where a.DELETE_FLAG = 0 and annualbonus.SALARY_MONEY > 0 and tax.SALARY_MONEY > 0 and s.SEND_MONTH like '${lastYear}%'
where a.DELETE_FLAG = 0 and annualbonus.SALARY_MONEY > 0 and tax.SALARY_MONEY > 0 and a.SETTLEMENT_MONTH like '${lastYear}%'
GROUP BY a.EMP_IDCARD,a.EMP_NAME
</select>
</mapper>
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Author fxj
* @Date 2022/9/1
* @Description
* @Version 1.0
*/
@Data
public class IncomeExportVo implements Serializable {
/**
* 员工姓名
*/
@NotBlank(message = "员工姓名 不能为空")
@Length(max = 32, message = "员工姓名 不能超过32 个字符")
@ExcelAttribute(name = "员工姓名", isNotEmpty = true, errorInfo = "员工姓名 不能为空", maxLength = 32)
@Schema(description = "员工姓名")
@ExcelProperty("员工姓名")
private String empName;
/**
* 身份证号
*/
@NotBlank(message = "身份证号 不能为空")
@Length(max = 32, message = "身份证号 不能超过32 个字符")
@ExcelAttribute(name = "身份证号", isNotEmpty = true, errorInfo = "身份证号 不能为空", maxLength = 32)
@Schema(description = "身份证号")
@ExcelProperty("身份证号")
private String empIdcard;
/**
* 项目名称
*/
@Length(max = 50, message = "项目名称 不能超过50 个字符")
@ExcelAttribute(name = "项目名称", maxLength = 50)
@Schema(description = "项目名称")
@ExcelProperty("项目名称")
private String deptName;
/**
* 项目编码
*/
@Length(max = 30, message = "项目编码 不能超过30 个字符")
@ExcelAttribute(name = "项目编码", maxLength = 30)
@Schema(description = "项目编码")
@ExcelProperty("项目编码")
private String deptNo;
/**
* 客户名称
*/
@Length(max = 50, message = "客户名称 不能超过50 个字符")
@ExcelAttribute(name = "客户名称", maxLength = 50)
@Schema(description = "客户名称")
@ExcelProperty("客户名称")
private String unitName;
/**
* 费用类型:1管理费2风险金
*/
@Length(max = 1, message = "费用类型:1管理费2风险金 不能超过1 个字符")
@ExcelAttribute(name = "费用类型", isDataId = true,readConverterExp = "1=管理费,2=风险金")
@Schema(description = "费用类型:1管理费2风险金")
@ExcelProperty("费用类型")
private String feeType;
/**
* 收费方式:1按比例2金额-人数3金额-人次
*/
@Length(max = 1, message = "收费方式:1按比例2金额-人数3金额-人次 不能超过1 个字符")
@ExcelAttribute(name = "收费方式", isDataId = true,readConverterExp = "1=按比例,2=金额-人数,3=金额-人次")
@Schema(description = "收费方式:1按比例2金额-人数3金额-人次")
@ExcelProperty("收费方式")
private String feeMode;
/**
* 收费标准
*/
@Length(max = 10, message = "收费标准 不能超过10 个字符")
@ExcelAttribute(name = "收费标准", maxLength = 10)
@Schema(description = "收费标准")
@ExcelProperty("收费标准")
private String charges;
/**
* 收入来源:1社保2公积金3商险4薪资
*/
@NotBlank(message = "收入来源:1社保2公积金3商险4薪资 不能为空")
@Length(max = 1, message = "收入来源:1社保2公积金3商险4薪资 不能超过1 个字符")
@ExcelAttribute(name = "收入来源", isNotEmpty = true, readConverterExp = "1=社保,2=公积金,3=商险,4=薪资")
@Schema(description = "收入来源:1社保2公积金3商险4薪资")
@ExcelProperty("收入来源")
private String sourceType;
/**
* 金额
*/
@NotBlank(message = "金额 不能为空")
@ExcelAttribute(name = "金额", isNotEmpty = true, errorInfo = "金额 不能为空")
@Schema(description = "金额")
@ExcelProperty("金额")
private BigDecimal money;
/**
* 生成月份
*/
@Length(max = 6, message = "生成月份 不能超过6 个字符")
@ExcelAttribute(name = "生成月份", maxLength = 6)
@Schema(description = "生成月份")
@ExcelProperty("生成月份")
private String createMonth;
/**
* 缴纳月份
*/
@Length(max = 6, message = "缴纳月份 不能超过6 个字符")
@ExcelAttribute(name = "缴纳月份", maxLength = 6)
@Schema(description = "缴纳月份")
@ExcelProperty("缴纳月份")
private String payMonth;
/**
* 数据生成时间
*/
@NotBlank(message = "数据生成时间 不能为空")
@ExcelAttribute(name = "数据生成时间", isNotEmpty = true, errorInfo = "数据生成时间 不能为空", isDate = true)
@Schema(description = "数据生成时间")
@ExcelProperty("数据生成时间")
private Date createTime;
/**
* 数据生成月份
*/
@Length(max = 6, message = "数据生成时间 不能超过6 个字符")
@ExcelAttribute(name = "数据生成时间", maxLength = 6)
@Schema(description = "数据生成时间")
@ExcelProperty("数据生成时间")
private String dataCreateMonth;
/**
* 推送状态:0未推送1已推送
*/
@Length(max = 1, message = "推送状态:0未推送1已推送 不能超过1 个字符")
@ExcelAttribute(name = "推送状态", isDataId = true, readConverterExp = "0=未推送,1=已推送")
@Schema(description = "推送状态:0未推送1已推送")
@ExcelProperty("推送状态")
private String pushStatus;
}
......@@ -66,19 +66,6 @@ public class TIncomeController {
return new R<>(tIncomeService.getTIncomePage(page, tIncome));
}
/**
* 不分页查询
*
* @param tIncome 收入明细表
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage")
//@PreAuthorize("@pms.hasPermission('social_tincome_get')" )
public R<List<TIncome>> getTIncomeNoPage(@RequestBody TIncomeSearchVo tIncome) {
return R.ok(tIncomeService.noPageDiy(tIncome));
}
/**
* 通过id查询收入明细表
*
......
......@@ -20,7 +20,11 @@ package com.yifu.cloud.plus.v1.yifu.social.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SysMessageSalaryExportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SysMessageSalarySearchVo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncome;
import com.yifu.cloud.plus.v1.yifu.social.vo.IncomeExportVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeSearchVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -41,6 +45,16 @@ public interface TIncomeMapper extends BaseMapper<TIncome> {
*/
IPage<TIncome> getTIncomePage(Page<TIncome> page, @Param("tIncome") TIncome tIncome);
List<IncomeExportVo> noPageDiy(@Param("tIncome") TIncomeSearchVo searchVo,
@Param("settleDomainIds")List<String> settleDomains,
@Param("idsStr") List<String> idsStr,
@Param("sql")String sql);
int noPageCountDiy(@Param("tIncome")TIncomeSearchVo searchVo,
@Param("settleDomainIds")List<String> settleDomains,
@Param("idsStr") List<String> idsStr,
@Param("sql")String sql);
List<TIncome> getTIncomeList(@Param("tIncome") TIncome tIncome);
}
......@@ -49,8 +49,6 @@ public interface TIncomeService extends IService<TIncome> {
void listExport(HttpServletResponse response, TIncomeSearchVo searchVo);
List<TIncome> noPageDiy(TIncomeSearchVo searchVo);
/**
* @Description: 新增收入明细-详情表,同时统计;
* @Author: hgw
......
......@@ -33,11 +33,14 @@ 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.salary.vo.SysMessageSalaryExportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SysMessageSalarySearchVo;
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.IncomeExportVo;
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;
......@@ -83,10 +86,10 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
*/
@Override
public void listExport(HttpServletResponse response, TIncomeSearchVo searchVo) {
String fileName = "不良记录批量导出" + DateUtil.getThisTime() + ".xlsx";
String fileName = "收入明细批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<TIncome> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
List<IncomeExportVo> list = new ArrayList<>();
long count = noPageCountDiy(searchVo,null,Common.getList(searchVo.getIds()),"");
ServletOutputStream out = null;
try {
out = response.getOutputStream();
......@@ -94,18 +97,17 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter excelWriter = EasyExcel.write(out, TIncome.class).build();
ExcelWriter excelWriter = EasyExcel.write(out, IncomeExportVo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; ) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = noPageDiy(searchVo);
list = noPageDiy(searchVo,null,Common.getList(searchVo.getIds()),"");
if (Common.isNotNull(list)) {
ExcelUtil<TIncome> util = new ExcelUtil<>(TIncome.class);
for (TIncome vo : list) {
ExcelUtil<IncomeExportVo> util = new ExcelUtil<>(IncomeExportVo.class);
for (IncomeExportVo vo : list) {
util.convertEntity(vo, null, null, null);
}
}
......@@ -141,36 +143,18 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
}
}
@Override
public List<TIncome> noPageDiy(TIncomeSearchVo searchVo) {
LambdaQueryWrapper<TIncome> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)) {
wrapper.in(TIncome::getId, idList);
}
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) {
wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd());
}
return baseMapper.selectList(wrapper);
}
private Long noPageCountDiy(TIncomeSearchVo searchVo) {
LambdaQueryWrapper<TIncome> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)) {
wrapper.in(TIncome::getId, idList);
}
return baseMapper.selectCount(wrapper);
private List<IncomeExportVo> noPageDiy(TIncomeSearchVo searchVo,
List<String> settleDomainIds,
List<String> ids,
String sql) {
return baseMapper.noPageDiy(searchVo,settleDomainIds,ids,sql);
}
private LambdaQueryWrapper buildQueryWrapper(TIncomeSearchVo entity) {
LambdaQueryWrapper<TIncome> wrapper = Wrappers.lambdaQuery();
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) {
wrapper.ge(TIncome::getCreateTime, entity.getCreateTimes()[0])
.le(TIncome::getCreateTime,
entity.getCreateTimes()[1]);
}
return wrapper;
private int noPageCountDiy(TIncomeSearchVo searchVo,
List<String> settleDomainIds,
List<String> ids,
String sql) {
return baseMapper.noPageCountDiy(searchVo,settleDomainIds,ids,sql);
}
@Override
......
......@@ -670,8 +670,10 @@
DEPT_NO = #{infoVo.settleDomainCode},
SETTLE_DOMAIN_ID = #{infoVo.settleDomainId}
where
(SALARY_SOCIAL_FLAG = '0' and SOCIAL_CREATE_MONTH >= #{infoVo.socialCreateMonth}) and DATA_PUSH = '0' and EMP_IDCARD = #{infoVo.empIdcard}
or (SALARY_FUND_FLAG = '0' and PROVIDENT_CREATE_MONTH >= #{infoVo.socialCreateMonth})
((SALARY_SOCIAL_FLAG = '0' and SOCIAL_CREATE_MONTH >= #{infoVo.socialCreateMonth})
or (SALARY_FUND_FLAG = '0' and PROVIDENT_CREATE_MONTH >= #{infoVo.socialCreateMonth}))
and DATA_PUSH = '0' and EMP_IDCARD = #{infoVo.empIdcard}
</update>
<!-- 更改预估社保推送状态 -->
......
......@@ -45,6 +45,23 @@
<result property="pushStatus" column="PUSH_STATUS"/>
<result property="redData" column="RED_DATA"/>
</resultMap>
<resultMap id="incomeExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.IncomeExportVo">
<result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="unitName" column="UNIT_NAME"/>
<result property="deptName" column="DEPT_NAME"/>
<result property="deptNo" column="DEPT_NO"/>
<result property="feeType" column="FEE_TYPE"/>
<result property="feeMode" column="FEE_MODE"/>
<result property="charges" column="CHARGES"/>
<result property="sourceType" column="SOURCE_TYPE"/>
<result property="money" column="MONEY"/>
<result property="createMonth" column="CREATE_MONTH"/>
<result property="payMonth" column="PAY_MONTH"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="dataCreateMonth" column="DATA_CREATE_MONTH"/>
<result property="pushStatus" column="PUSH_STATUS"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.EMP_NAME,
......@@ -139,6 +156,34 @@
<where>
1=1
<include refid="tIncome_where"/>
order by a.CREATE_TIME DESC
</where>
</select>
<!--noPageDiy查询-->
<select id="noPageDiy" resultMap="incomeExportMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_income a
<where>
1=1
<include refid="export_sql"/>
<if test="tIncome != null">
<if test="tIncome.limitStart != null">
limit #{tIncome.limitStart},#{tIncome.limitEnd}
</if>
</if>
</where>
</select>
<!--noPageCountDiy查询-->
<select id="noPageCountDiy" resultType="java.lang.Integer">
SELECT
count(1)
FROM t_income a
<where>
1=1
<include refid="export_sql"/>
</where>
</select>
......@@ -152,4 +197,31 @@
<include refid="tIncome_where"/>
</where>
</select>
<sql id="export_sql">
<include refid="tIncome_where"/>
<if test="idsStr != null and idsStr.size > 0">
AND a.ID in
<foreach item="items" index="index" collection="idsStr" open="(" separator="," close=")">
#{items}
</foreach>
</if>
<!--数据权限判断-->
<if test="settleDomainIds != null">
<if test="settleDomainIds.size() > 0">
and a.DEPT_ID in
<foreach collection="settleDomainIds" item="param" index="index" open="(" close=")" separator=",">
#{param}
</foreach>
</if>
<if test="settleDomainIds.size() == 0">
and 1=2
</if>
</if>
<if test="settleDomainIds == null">
and 1=1
</if>
<if test='sql != null and sql != ""'>
and <![CDATA[sql]]>
</if>
</sql>
</mapper>
......@@ -1093,8 +1093,8 @@
SETTLE_DOMAIN_CODE = #{infoVo.settleDomainCode},
SETTLE_DOMAIN_ID = #{infoVo.settleDomainId}
where
(SALARY_SOCIAL_FLAG = '0' and SOCIAL_CREATE_MONTH >= #{infoVo.socialCreateMonth}) or
(SALARY_FUND_FLAG = '0' and PROVIDENT_CREATE_MONTH >= #{infoVo.socialCreateMonth})
((SALARY_SOCIAL_FLAG = '0' and SOCIAL_CREATE_MONTH >= #{infoVo.socialCreateMonth}) or
(SALARY_FUND_FLAG = '0' and PROVIDENT_CREATE_MONTH >= #{infoVo.socialCreateMonth}))
and PUSH_STATUS = '1' and EMP_IDCARD = #{infoVo.empIdcard}
</update>
......
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