Commit d3cf6b33 authored by huyuchen's avatar huyuchen

申报对象优化修改

parent f7156f0e
......@@ -21,6 +21,7 @@ import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
......@@ -120,5 +121,17 @@ public class TStatisticsDeclarer {
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("不申报原因")
private String undeclareReason;
/**
* 是否0申报人员 0 是 1 否
*/
@ExcelAttribute(name = "是否0申报人员", maxLength = 1,readConverterExp = "0=是,1=否")
@Length(max = 1, message = "是否0申报人员不能超过1个字符")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("是否0申报人员")
private String isZeroDeclare;
/**
* 是否0申报人员 0 是 1 否
*/
@TableField(exist = false)
private String isZeroFlag;
}
......@@ -74,5 +74,11 @@ public class TStatisticsDeclarerVo extends RowIndex implements Serializable {
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("不申报原因")
private String undeclareReason;
/**
* 是否0申报人员 0 是 1 否
*/
@ExcelAttribute(name = "是否0申报人员", maxLength = 1,readConverterExp = "0=是,1=否")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("是否0申报人员")
private String isZeroDeclare;
}
......@@ -29,13 +29,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsDeclarer;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsDeclarerMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsDeclarerService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsDeclarerSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsDeclarerVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
......@@ -46,6 +49,7 @@ import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
* 申报对象表
*
......@@ -53,9 +57,12 @@ import java.util.List;
* @date 2022-08-11 10:56:10
*/
@Log4j2
@RequiredArgsConstructor
@Service
public class TStatisticsDeclarerServiceImpl extends ServiceImpl<TStatisticsDeclarerMapper, TStatisticsDeclarer> implements TStatisticsDeclarerService {
private final ArchivesDaprUtil archivesDaprUtil;
/**
* 申报对象表简单分页查询
* @param tStatisticsDeclarer 申报对象表
......@@ -178,8 +185,22 @@ public class TStatisticsDeclarerServiceImpl extends ServiceImpl<TStatisticsDecla
} else {
String lastMonth = DateUtil.addMonth(-1); //上月
List<TStatisticsDeclarer> stdvoList = baseMapper.doStatisticsTaxDeclarer(nowMonth,lastMonth);
for (TStatisticsDeclarer declarer : stdvoList) {
this.save(declarer);
R<TEmployeeInfo> res;
if (Common.isNotNull(stdvoList)) {
for (TStatisticsDeclarer declarer : stdvoList) {
if (CommonConstants.TWO_STRING.equals(declarer.getIsZeroDeclare())) {
res = archivesDaprUtil.getTEmployeeInfoById(declarer.getEmpIdcard());
if (Common.isNotNull(res) && Common.isNotNull(res.getData())
&& (CommonConstants.ZERO_INT == res.getData().getFileStatus())) {
declarer.setIsZeroDeclare(CommonConstants.ZERO_STRING);
} else if (CommonConstants.ONE_STRING.equals(declarer.getIsZeroFlag())) {
declarer.setIsZeroDeclare(CommonConstants.ZERO_STRING);
} else {
declarer.setIsZeroDeclare(CommonConstants.ONE_STRING);
}
}
this.save(declarer);
}
}
return R.ok();
}
......
......@@ -32,8 +32,10 @@
<result property="empPhone" column="EMP_PHONE"/>
<result property="occupationType" column="OCCUPATION_TYPE"/>
<result property="occupationMonth" column="OCCUPATION_MONTH"/>
<result property="isZeroDeclare" column="IS_ZERO_DECLARE"/>
<result property="isDeclare" column="IS_DECLARE"/>
<result property="undeclareReason" column="UNDECLARE_REASON"/>
<result property="isZeroFlag" column="IS_ZERO_FLAG"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -44,6 +46,7 @@
a.EMP_PHONE,
a.OCCUPATION_TYPE,
a.OCCUPATION_MONTH,
a.IS_ZERO_DECLARE,
a.IS_DECLARE,
a.UNDECLARE_REASON
</sql>
......@@ -73,8 +76,11 @@
<if test="tStatisticsDeclarer.occupationMonth != null and tStatisticsDeclarer.occupationMonth.trim() != ''">
AND a.OCCUPATION_MONTH = #{tStatisticsDeclarer.occupationMonth}
</if>
<if test="tStatisticsDeclarer.isZeroDeclare != null and tStatisticsDeclarer.isZeroDeclare.trim() != ''">
AND a.IS_ZERO_DECLARE = #{tStatisticsDeclarer.isZeroDeclare}
</if>
<if test="tStatisticsDeclarer.isDeclare != null and tStatisticsDeclarer.isDeclare.trim() != ''">
AND a.IS_DECLARE = #{tStatisticsDeclarer.isDeclare}
AND a.IS_DECLARE = #{tStatisticsDeclarer.isDeclare}
</if>
<if test="tStatisticsDeclarer.undeclareReason != null and tStatisticsDeclarer.undeclareReason.trim() != ''">
AND a.UNDECLARE_REASON = #{tStatisticsDeclarer.undeclareReason}
......@@ -97,15 +103,23 @@
<select id="doStatisticsTaxDeclarer" resultMap="tStatisticsDeclarerMap">
SELECT
#{nowMonth} DECLARE_MONTH,c.EMP_NAME,c.EMP_IDCARD,c.EMP_PHONE,c.INVOICE_TITLE DECLARE_UNIT,
if(c.FORM_TYPE=0,'0',if(c.FORM_TYPE=3 or c.FORM_TYPE=4,'1','-')) OCCUPATION_TYPE FROM
if(c.FORM_TYPE=0,'0',if(c.FORM_TYPE=3 or c.FORM_TYPE=4,'1','-')) OCCUPATION_TYPE,
if(c.SETTLEMENT_MONTH = #{lastMonth} ,'1',if(DATE_FORMAT(DATE_SUB(CURDATE(),
INTERVAL 1 MONTH),"%Y%m")>=DATE_FORMAT(c.CREATE_TIME,"%Y%m"),'2','0')) IS_ZERO_DECLARE,
if(DATE_FORMAT(c.CREATE_TIME,"%Y%m")>=DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 3 MONTH),"%Y%m"),'1','0') IS_ZERO_FLAG
FROM
(SELECT s.* FROM t_salary_account s,
(SELECT a.EMP_NAME,a.EMP_IDCARD,a.EMP_PHONE,a.INVOICE_TITLE,a.FORM_TYPE,MAX(CREATE_TIME) max_day,a.SETTLEMENT_MONTH,
if(a.FORM_TYPE=0,'0',if(a.FORM_TYPE=3 or a.FORM_TYPE=4,'1','-')) CUPATION_TYPE
FROM t_salary_account a WHERE a.DELETE_FLAG = '0' AND a.SETTLEMENT_MONTH = #{lastMonth}
GROUP BY a.EMP_IDCARD,a.INVOICE_TITLE,CUPATION_TYPE,a.SETTLEMENT_MONTH) b
WHERE s.DELETE_FLAG = '0' AND b.max_day = s.CREATE_TIME
AND s.EMP_IDCARD = b.EMP_IDCARD AND s.INVOICE_TITLE = b.INVOICE_TITLE
AND s.SETTLEMENT_MONTH = b.SETTLEMENT_MONTH) c
FROM t_salary_account a WHERE a.DELETE_FLAG = '0' AND
(a.SETTLEMENT_MONTH = #{lastMonth} or (a.SETTLEMENT_MONTH like concat(DATE_FORMAT(NOW(), '%Y'), '%') and DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 1 MONTH),"%Y%m")
>=DATE_FORMAT(a.CREATE_TIME,"%Y%m")))
GROUP BY a.EMP_IDCARD,a.INVOICE_TITLE,CUPATION_TYPE,a.SETTLEMENT_MONTH
ORDER BY a.CREATE_TIME asc) b
WHERE s.DELETE_FLAG = '0' AND b.max_day = s.CREATE_TIME
AND s.EMP_IDCARD = b.EMP_IDCARD AND s.INVOICE_TITLE = b.INVOICE_TITLE AND s.FORM_TYPE = b.FORM_TYPE
AND s.SETTLEMENT_MONTH = b.SETTLEMENT_MONTH) c
GROUP BY c.EMP_IDCARD,c.INVOICE_TITLE,c.SETTLEMENT_MONTH
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment