Commit 3e9bac5a authored by huyuchen's avatar huyuchen

申报对象修改

parent fd994954
......@@ -133,5 +133,6 @@ public class TStatisticsDeclarer {
* 是否0申报人员 0 是 1 否
*/
@TableField(exist = false)
@ExcelIgnore
private String isZeroFlag;
}
......@@ -47,4 +47,11 @@ public interface TStatisticsDeclarerMapper extends BaseMapper<TStatisticsDeclare
* @return:
**/
List<TStatisticsDeclarer> doStatisticsTaxDeclarer(@Param("nowMonth") String nowMonth, @Param("lastMonth") String lastYear);
/**
* @param
* @Description: 统计
* @return:
**/
List<TStatisticsDeclarer> doStatisticsTaxDeclarerYear(@Param("nowMonth") String nowMonth);
}
......@@ -183,11 +183,18 @@ public class TStatisticsDeclarerServiceImpl extends ServiceImpl<TStatisticsDecla
if (num > 0) {
return R.failed("上月数据已生成,不可重复生成!");
} else {
String lastMonth = DateUtil.addMonth(-1); //上月
List<TStatisticsDeclarer> stdvoList = baseMapper.doStatisticsTaxDeclarer(nowMonth,lastMonth);
R<TEmployeeInfo> res;
String lastMonth = DateUtil.addMonth(-1); //上月
List<TStatisticsDeclarer> stdvoList = baseMapper.doStatisticsTaxDeclarer(nowMonth, lastMonth);
if (Common.isNotNull(stdvoList)) {
for (TStatisticsDeclarer declarer : stdvoList) {
this.save(declarer);
}
}
List<TStatisticsDeclarer> stdvoYearList = baseMapper.doStatisticsTaxDeclarerYear(nowMonth);
if (Common.isNotNull(stdvoYearList)) {
R<TEmployeeInfo> res;
for (TStatisticsDeclarer declarer : stdvoYearList) {
if (CommonConstants.TWO_STRING.equals(declarer.getIsZeroDeclare())) {
res = archivesDaprUtil.getTEmployeeInfoById(declarer.getEmpIdcard());
if (Common.isNotNull(res) && Common.isNotNull(res.getData())
......
......@@ -103,23 +103,36 @@
<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,
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
if(c.FORM_TYPE=0,'0',if(c.FORM_TYPE=3 or c.FORM_TYPE=4,'1','-')) OCCUPATION_TYPE,
'1' IS_ZERO_DECLARE,
'0' IS_ZERO_FLAG
FROM
(SELECT s.* FROM t_salary_account s,
(SELECT a.EMP_NAME,a.EMP_IDCARD,a.EMP_PHONE,a.INVOICE_TITLE,a.FORM_TYPE,MAX(CREATE_TIME) max_day,a.SETTLEMENT_MONTH,
if(a.FORM_TYPE=0,'0',if(a.FORM_TYPE=3 or a.FORM_TYPE=4,'1','-')) CUPATION_TYPE
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
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.FORM_TYPE = b.FORM_TYPE
AND s.SETTLEMENT_MONTH = b.SETTLEMENT_MONTH) c
GROUP BY c.EMP_IDCARD,c.INVOICE_TITLE,c.SETTLEMENT_MONTH
GROUP BY c.EMP_IDCARD,c.INVOICE_TITLE,c.SETTLEMENT_MONTH,OCCUPATION_TYPE
</select>
<select id="doStatisticsTaxDeclarerYear" resultMap="tStatisticsDeclarerMap">
SELECT
#{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,
'2' 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 EMP_NAME,EMP_IDCARD,EMP_PHONE,a.INVOICE_TITLE,a.FORM_TYPE,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'
GROUP BY EMP_IDCARD,INVOICE_TITLE,CUPATION_TYPE
having a.SETTLEMENT_MONTH like concat(DATE_FORMAT(NOW(), '%Y'), '%') and DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 1 MONTH),"%Y%m")
>DATE_FORMAT(max(a.CREATE_TIME),"%Y%m")) 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) c
GROUP BY c.EMP_IDCARD,c.INVOICE_TITLE,OCCUPATION_TYPE
</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