履职清单优化升级
This commit is contained in:
parent
f75c066fc5
commit
15a3e4f625
|
|
@ -16,16 +16,21 @@ public class ChangeFactorDto {
|
||||||
@ApiModelProperty(value = "岗位id",required = true)
|
@ApiModelProperty(value = "岗位id",required = true)
|
||||||
private String listperformid;
|
private String listperformid;
|
||||||
|
|
||||||
@NotNull(message = "年份不能为空")
|
@ApiModelProperty(value = "年份")
|
||||||
@ApiModelProperty(value = "年份",required = true)
|
|
||||||
private String sysyear;
|
private String sysyear;
|
||||||
|
|
||||||
|
@ApiModelProperty("开始时间")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("结束时间")
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
@NotNull(message = "清单内容不能为空")
|
@NotNull(message = "清单内容不能为空")
|
||||||
@ApiModelProperty(value = "清单内容",required = true)
|
@ApiModelProperty(value = "清单内容",required = true)
|
||||||
private String factorcnt;
|
private String factorcnt;
|
||||||
|
|
||||||
@NotNull(message = "考核指标不能为空")
|
@NotNull(message = "考核指标不能为空")
|
||||||
@ApiModelProperty(value = "考核指标 1:每年 2:每半年 4:每季度 12:每月",required = true)
|
@ApiModelProperty(value = "考核指标 1:每年 2:每半年 4:每季度 12:每月 0:自定义",required = true)
|
||||||
private Integer checkstandard;
|
private Integer checkstandard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -35,6 +40,21 @@ public class ChangeFactorDto {
|
||||||
@ApiModelProperty(value = "频率",required = true)
|
@ApiModelProperty(value = "频率",required = true)
|
||||||
private Integer frequency;
|
private Integer frequency;
|
||||||
|
|
||||||
|
public String getStartTime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTime(String startTime) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime(String endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
public String getListfactorid() {
|
public String getListfactorid() {
|
||||||
return listfactorid;
|
return listfactorid;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.rzyc.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考核指标 1:每年 2:每半年 4:每季度 12:每月 0:自定义
|
||||||
|
* @version v1.0
|
||||||
|
* @author dong
|
||||||
|
* @date 2023/11/1 10:04
|
||||||
|
*/
|
||||||
|
public enum Checkstandard {
|
||||||
|
|
||||||
|
YEAR(1),
|
||||||
|
HALF_YEAR(2),
|
||||||
|
QUARTER(4),
|
||||||
|
MONTH(12),
|
||||||
|
CUSTOM(0)
|
||||||
|
;
|
||||||
|
|
||||||
|
private Integer standard;
|
||||||
|
|
||||||
|
Checkstandard(Integer standard) {
|
||||||
|
this.standard = standard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStandard() {
|
||||||
|
return standard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStandard(Integer standard) {
|
||||||
|
this.standard = standard;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -38,11 +38,17 @@ public class ListFactor implements Serializable {
|
||||||
|
|
||||||
private String sysyear;
|
private String sysyear;
|
||||||
|
|
||||||
|
@ApiModelProperty("清单开始时间")
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("清单结束时间")
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
@ApiModelProperty("清单内容")
|
@ApiModelProperty("清单内容")
|
||||||
private String factorcnt;
|
private String factorcnt;
|
||||||
|
|
||||||
@NotNull(message = "考核指标不能为空")
|
@NotNull(message = "考核指标不能为空")
|
||||||
@ApiModelProperty(value = "考核指标 1:每年 2:每半年 4:每季度 12:每月",required = true)
|
@ApiModelProperty(value = "考核指标 1:每年 2:每半年 4:每季度 12:每月 0:自定义",required = true)
|
||||||
private Integer checkstandard;
|
private Integer checkstandard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -111,6 +117,21 @@ public class ListFactor implements Serializable {
|
||||||
*/
|
*/
|
||||||
private Integer delState;
|
private Integer delState;
|
||||||
|
|
||||||
|
public Date getStartTime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTime(Date startTime) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime(Date endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getDelState() {
|
public Integer getDelState() {
|
||||||
return delState;
|
return delState;
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,7 @@
|
||||||
and lf.del_state = 1
|
and lf.del_state = 1
|
||||||
and ot.del_state = 1
|
and ot.del_state = 1
|
||||||
AND lf.`ListPerformId` = #{listPerformId}
|
AND lf.`ListPerformId` = #{listPerformId}
|
||||||
AND lf.`SysYear` = #{sysYear}
|
and find_in_set(#{sysYear},lf.`SysYear`)
|
||||||
<if test="null != isFinish and '' != isFinish">
|
<if test="null != isFinish and '' != isFinish">
|
||||||
AND ot.IsFinish = #{isFinish}
|
AND ot.IsFinish = #{isFinish}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@
|
||||||
<result column="SysRemark" jdbcType="VARCHAR" property="sysremark" />
|
<result column="SysRemark" jdbcType="VARCHAR" property="sysremark" />
|
||||||
<result column="SortId" jdbcType="INTEGER" property="sortid" />
|
<result column="SortId" jdbcType="INTEGER" property="sortid" />
|
||||||
<result column="SysYear" jdbcType="VARCHAR" property="sysyear" />
|
<result column="SysYear" jdbcType="VARCHAR" property="sysyear" />
|
||||||
|
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
|
||||||
|
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
|
||||||
<result column="yellowAlert" jdbcType="VARCHAR" property="yellowAlert" />
|
<result column="yellowAlert" jdbcType="VARCHAR" property="yellowAlert" />
|
||||||
<result column="redAlert" jdbcType="VARCHAR" property="redAlert" />
|
<result column="redAlert" jdbcType="VARCHAR" property="redAlert" />
|
||||||
<result column="factorIsFinish" jdbcType="VARCHAR" property="factorIsFinish" />
|
<result column="factorIsFinish" jdbcType="VARCHAR" property="factorIsFinish" />
|
||||||
|
|
@ -128,7 +130,7 @@
|
||||||
<insert id="insert" parameterType="com.rzyc.model.user.ListFactor">
|
<insert id="insert" parameterType="com.rzyc.model.user.ListFactor">
|
||||||
insert into ListFactor (ListFactorId, ListPerformId, SysUserId,
|
insert into ListFactor (ListFactorId, ListPerformId, SysUserId,
|
||||||
ChkbillName, ListNum, SysRemark,
|
ChkbillName, ListNum, SysRemark,
|
||||||
SortId, SysYear, yellowAlert,
|
SortId, SysYear,start_time, end_time,yellowAlert,
|
||||||
redAlert,
|
redAlert,
|
||||||
type,
|
type,
|
||||||
factorIsFinish,
|
factorIsFinish,
|
||||||
|
|
@ -141,6 +143,8 @@
|
||||||
#{chkbillname,jdbcType=VARCHAR}, #{listnum,jdbcType=VARCHAR}, #{sysremark,jdbcType=VARCHAR},
|
#{chkbillname,jdbcType=VARCHAR}, #{listnum,jdbcType=VARCHAR}, #{sysremark,jdbcType=VARCHAR},
|
||||||
#{sortid,jdbcType=INTEGER},
|
#{sortid,jdbcType=INTEGER},
|
||||||
#{sysyear,jdbcType=VARCHAR},
|
#{sysyear,jdbcType=VARCHAR},
|
||||||
|
#{startTime,jdbcType=TIMESTAMP},
|
||||||
|
#{endTime,jdbcType=TIMESTAMP},
|
||||||
#{yellowAlert,jdbcType=VARCHAR},
|
#{yellowAlert,jdbcType=VARCHAR},
|
||||||
#{redAlert,jdbcType=VARCHAR},
|
#{redAlert,jdbcType=VARCHAR},
|
||||||
#{type,jdbcType=INTEGER},
|
#{type,jdbcType=INTEGER},
|
||||||
|
|
@ -479,6 +483,8 @@
|
||||||
<result column="SysRemark" jdbcType="VARCHAR" property="sysremark" />
|
<result column="SysRemark" jdbcType="VARCHAR" property="sysremark" />
|
||||||
<result column="SortId" jdbcType="INTEGER" property="sortid" />
|
<result column="SortId" jdbcType="INTEGER" property="sortid" />
|
||||||
<result column="SysYear" jdbcType="VARCHAR" property="sysyear" />
|
<result column="SysYear" jdbcType="VARCHAR" property="sysyear" />
|
||||||
|
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
|
||||||
|
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
|
||||||
<result column="yellowAlert" jdbcType="VARCHAR" property="yellowAlert" />
|
<result column="yellowAlert" jdbcType="VARCHAR" property="yellowAlert" />
|
||||||
<result column="redAlert" jdbcType="VARCHAR" property="redAlert" />
|
<result column="redAlert" jdbcType="VARCHAR" property="redAlert" />
|
||||||
<result column="factorIsFinish" jdbcType="VARCHAR" property="factorIsFinish" />
|
<result column="factorIsFinish" jdbcType="VARCHAR" property="factorIsFinish" />
|
||||||
|
|
@ -507,7 +513,23 @@
|
||||||
LEFT JOIN list_relation lr ON lf.ListFactorId = lr.`target_id` AND lr.`target_type` = 1
|
LEFT JOIN list_relation lr ON lf.ListFactorId = lr.`target_id` AND lr.`target_type` = 1
|
||||||
LEFT JOIN listdetail ld ON lr.`detail_id` = ld.`ListDetailId` AND ld.`del_state` = 1
|
LEFT JOIN listdetail ld ON lr.`detail_id` = ld.`ListDetailId` AND ld.`del_state` = 1
|
||||||
WHERE lf.`ListPerformId` = #{listPerformId}
|
WHERE lf.`ListPerformId` = #{listPerformId}
|
||||||
|
<if test="null != time and '' != time">
|
||||||
|
and FIND_IN_SET(#{time},lf.SysYear)
|
||||||
|
</if>
|
||||||
|
and lf.del_state = 1
|
||||||
|
ORDER BY lf.`SortId` ASC ,lf.`ListNum` ASC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--用户履职档案-->
|
||||||
|
<select id="userListFactorV1" resultMap="FactorResultMap">
|
||||||
|
SELECT ld.`CreatedOn` changeTime,ld.`ListDetailId` relation_id, lf.*
|
||||||
|
FROM ListFactor lf
|
||||||
|
LEFT JOIN list_relation lr ON lf.ListFactorId = lr.`target_id` AND lr.`target_type` = 1
|
||||||
|
LEFT JOIN listdetail ld ON lr.`detail_id` = ld.`ListDetailId` AND ld.`del_state` = 1
|
||||||
|
WHERE lf.`ListPerformId` = #{listPerformId}
|
||||||
|
<if test="null != time and '' != time">
|
||||||
and lf.SysYear = #{time}
|
and lf.SysYear = #{time}
|
||||||
|
</if>
|
||||||
and lf.del_state = 1
|
and lf.del_state = 1
|
||||||
ORDER BY lf.`SortId` ASC ,lf.`ListNum` ASC
|
ORDER BY lf.`SortId` ASC ,lf.`ListNum` ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -537,8 +559,9 @@
|
||||||
|
|
||||||
<!--可计算履职进度的履职清单-->
|
<!--可计算履职进度的履职清单-->
|
||||||
<select id="findByFactorIsFinish" resultMap="BaseResultMap">
|
<select id="findByFactorIsFinish" resultMap="BaseResultMap">
|
||||||
SELECT * FROM ListFactor lf WHERE lf.`ListPerformId` = #{listPerformId}
|
SELECT * FROM ListFactor lf
|
||||||
and lf.SysYear = #{time}
|
WHERE lf.`ListPerformId` = #{listPerformId}
|
||||||
|
AND FIND_IN_SET(#{time},lf.SysYear)
|
||||||
and lf.del_state = 1
|
and lf.del_state = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -599,6 +622,21 @@
|
||||||
|
|
||||||
<!--履职清单分页-->
|
<!--履职清单分页-->
|
||||||
<select id="factorPage" resultMap="BaseResultMap">
|
<select id="factorPage" resultMap="BaseResultMap">
|
||||||
|
SELECT * FROM ListFactor lf
|
||||||
|
WHERE lf.`ListPerformId` = #{listPerformId}
|
||||||
|
<if test="null != year and '' != year">
|
||||||
|
AND FIND_IN_SET(#{year},lf.SysYear)
|
||||||
|
</if>
|
||||||
|
<if test="type!=null">
|
||||||
|
AND lf.type = #{type}
|
||||||
|
</if>
|
||||||
|
AND lf.`FactorCnt` LIKE #{condition}
|
||||||
|
AND lf.`del_state` = 1
|
||||||
|
ORDER BY lf.`SortId` ASC ,lf.`ListNum` ASC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--履职清单分页-->
|
||||||
|
<select id="factorPageV1" resultMap="BaseResultMap">
|
||||||
SELECT * FROM ListFactor lf
|
SELECT * FROM ListFactor lf
|
||||||
WHERE lf.`ListPerformId` = #{listPerformId}
|
WHERE lf.`ListPerformId` = #{listPerformId}
|
||||||
<if test="null != year and '' != year">
|
<if test="null != year and '' != year">
|
||||||
|
|
|
||||||
|
|
@ -1502,7 +1502,11 @@ public class BaseController {
|
||||||
|
|
||||||
//需完成数量
|
//需完成数量
|
||||||
Integer factorNum = 0;
|
Integer factorNum = 0;
|
||||||
|
if(Checkstandard.CUSTOM.getStandard() == listFactor.getCheckstandard()){
|
||||||
|
factorNum = listFactor.getFrequency();
|
||||||
|
}else{
|
||||||
factorNum = listFactor.getCheckstandard() * listFactor.getFrequency();
|
factorNum = listFactor.getCheckstandard() * listFactor.getFrequency();
|
||||||
|
}
|
||||||
total+=factorNum;
|
total+=factorNum;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1989,7 +1993,12 @@ public class BaseController {
|
||||||
System.out.println("Frequency -> "+listFactor.getFrequency());
|
System.out.println("Frequency -> "+listFactor.getFrequency());
|
||||||
|
|
||||||
//需要完成的总次数
|
//需要完成的总次数
|
||||||
Integer factorTotal = listFactor.getCheckstandard() * listFactor.getFrequency();
|
Integer factorTotal = 0;
|
||||||
|
if(Checkstandard.CUSTOM.getStandard() == listFactor.getCheckstandard()){
|
||||||
|
factorTotal = listFactor.getFrequency();
|
||||||
|
}else{
|
||||||
|
factorTotal = listFactor.getCheckstandard() * listFactor.getFrequency();
|
||||||
|
}
|
||||||
listFactor.setFactorTotal(factorTotal);
|
listFactor.setFactorTotal(factorTotal);
|
||||||
|
|
||||||
//已完成次数
|
//已完成次数
|
||||||
|
|
@ -2495,14 +2504,16 @@ public class BaseController {
|
||||||
public void addFactorTask(ListFactor listFactor,String sysUserId)throws Exception{
|
public void addFactorTask(ListFactor listFactor,String sysUserId)throws Exception{
|
||||||
//任务列表
|
//任务列表
|
||||||
List<OATask> oaTasks = new ArrayList<>();
|
List<OATask> oaTasks = new ArrayList<>();
|
||||||
if(1 == listFactor.getCheckstandard()){
|
if(Checkstandard.YEAR.getStandard() == listFactor.getCheckstandard()){
|
||||||
oaTasks = this.getYearTask(listFactor,sysUserId);
|
oaTasks = this.getYearTask(listFactor,sysUserId);
|
||||||
}else if(2 == listFactor.getCheckstandard()){
|
}else if(Checkstandard.HALF_YEAR.getStandard() == listFactor.getCheckstandard()){
|
||||||
oaTasks = this.getHalfYearTask(listFactor,sysUserId);
|
oaTasks = this.getHalfYearTask(listFactor,sysUserId);
|
||||||
}else if(4 == listFactor.getCheckstandard()){
|
}else if(Checkstandard.QUARTER.getStandard() == listFactor.getCheckstandard()){
|
||||||
oaTasks = this.getQuarterTask(listFactor,sysUserId);
|
oaTasks = this.getQuarterTask(listFactor,sysUserId);
|
||||||
}else if(12 == listFactor.getCheckstandard()){
|
}else if(Checkstandard.MONTH.getStandard() == listFactor.getCheckstandard()){
|
||||||
oaTasks = this.getMonthTask(listFactor,sysUserId);
|
oaTasks = this.getMonthTask(listFactor,sysUserId);
|
||||||
|
}else if(Checkstandard.CUSTOM.getStandard() == listFactor.getCheckstandard()){
|
||||||
|
oaTasks = this.getCustomTask(listFactor,sysUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(null != oaTasks && oaTasks.size() > 0){
|
if(null != oaTasks && oaTasks.size() > 0){
|
||||||
|
|
@ -2588,6 +2599,35 @@ public class BaseController {
|
||||||
return oaTasks;
|
return oaTasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取自定义任务
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private List<OATask> getCustomTask(ListFactor listFactor,String sysUserId)throws Exception{
|
||||||
|
List<OATask> oaTasks = new ArrayList<>();
|
||||||
|
OATask oaTask = new OATask();
|
||||||
|
String startTime = DateUtils.parseDate2String(listFactor.getStartTime(),"yyyy-MM-dd");
|
||||||
|
String endTime = DateUtils.parseDate2String(listFactor.getEndTime(),"yyyy-MM-dd");
|
||||||
|
|
||||||
|
String subject = "工作任务("+startTime+"至"+endTime+"):"+listFactor.getFactorcnt();
|
||||||
|
oaTask.setSubject(subject);
|
||||||
|
oaTask.setFrequency(0l);
|
||||||
|
oaTask.setIsfinish("否");
|
||||||
|
oaTask.setOtcid(listFactor.getListfactorid());
|
||||||
|
oaTask.setOataskid(RandomNumber.getUUid());
|
||||||
|
oaTask.setTasktype("履职任务");
|
||||||
|
oaTask.setStartdate(listFactor.getStartTime());
|
||||||
|
oaTask.setPlanenddate(listFactor.getEndTime());
|
||||||
|
oaTask.setDelState(DelState.NOT_DEL.getState());
|
||||||
|
oaTask.setCreatedby(sysUserId);
|
||||||
|
oaTask.setCreatedon(new Date());
|
||||||
|
oaTask.setModifiedby(sysUserId);
|
||||||
|
oaTask.setModifiedon(new Date());
|
||||||
|
oaTasks.add(oaTask);
|
||||||
|
return oaTasks;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取年任务信息
|
* 获取年任务信息
|
||||||
* @return
|
* @return
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ import com.rzyc.model.user.*;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.apache.catalina.User;
|
import org.apache.catalina.User;
|
||||||
import org.apache.commons.beanutils.BeanUtils;
|
import org.apache.commons.beanutils.BeanUtils;
|
||||||
|
import org.apache.commons.beanutils.ConvertUtils;
|
||||||
|
import org.apache.commons.beanutils.converters.DateConverter;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -2088,9 +2090,12 @@ public class PcPersonalController extends com.rzyc.controller.BaseController {
|
||||||
@ApiOperation(value = "修改新增履职清单", notes = "修改新增履职清单")
|
@ApiOperation(value = "修改新增履职清单", notes = "修改新增履职清单")
|
||||||
@PostMapping(value = "changeFactor")
|
@PostMapping(value = "changeFactor")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@Transactional
|
||||||
public SingleResult<String> changeFactor(@Valid ChangeFactorDto changeFactorDto)throws Exception{
|
public SingleResult<String> changeFactor(@Valid ChangeFactorDto changeFactorDto)throws Exception{
|
||||||
SingleResult<String> result = new SingleResult<>();
|
SingleResult<String> result = new SingleResult<>();
|
||||||
ListFactor listFactor = new ListFactor();
|
ListFactor listFactor = new ListFactor();
|
||||||
|
|
||||||
|
ConvertUtils.register(new DateConverter(null), java.util.Date.class);
|
||||||
BeanUtils.copyProperties(listFactor,changeFactorDto);
|
BeanUtils.copyProperties(listFactor,changeFactorDto);
|
||||||
|
|
||||||
String userId = getUserId();
|
String userId = getUserId();
|
||||||
|
|
@ -2100,6 +2105,9 @@ public class PcPersonalController extends com.rzyc.controller.BaseController {
|
||||||
listFactor.setCreatedon(new Date());
|
listFactor.setCreatedon(new Date());
|
||||||
listFactor.setModifiedon(new Date());
|
listFactor.setModifiedon(new Date());
|
||||||
|
|
||||||
|
listFactor.setStartTime(DateUtils.parseString2Date(changeFactorDto.getStartTime(),"yyyy-MM-dd"));
|
||||||
|
listFactor.setEndTime(DateUtils.parseString2Date(changeFactorDto.getEndTime(),"yyyy-MM-dd"));
|
||||||
|
|
||||||
//清单提醒时间
|
//清单提醒时间
|
||||||
listFactor.setYellowAlert(5+"");
|
listFactor.setYellowAlert(5+"");
|
||||||
listFactor.setRedAlert(2+"");
|
listFactor.setRedAlert(2+"");
|
||||||
|
|
@ -2107,6 +2115,22 @@ public class PcPersonalController extends com.rzyc.controller.BaseController {
|
||||||
//清单类型
|
//清单类型
|
||||||
listFactor.setType(1);
|
listFactor.setType(1);
|
||||||
|
|
||||||
|
if(StringUtils.isNotBlank(changeFactorDto.getSysyear())){
|
||||||
|
//不跨年的清单
|
||||||
|
listFactor.setSysyear(changeFactorDto.getSysyear());
|
||||||
|
}else{
|
||||||
|
//跨年的清单
|
||||||
|
String sysyear = "";
|
||||||
|
List<String> yearList = DateUtils.getYearBetweenDate(changeFactorDto.getStartTime(),changeFactorDto.getEndTime());
|
||||||
|
for (String str : yearList){
|
||||||
|
if(StringUtils.isNotBlank(sysyear)){
|
||||||
|
sysyear = sysyear +","+str;
|
||||||
|
}else{
|
||||||
|
sysyear = str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
listFactor.setSysyear(sysyear);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//数据初始
|
//数据初始
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.common.utils;
|
package com.common.utils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -348,8 +350,8 @@ public final class DateUtils {
|
||||||
try {
|
try {
|
||||||
int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
|
int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
|
||||||
System.out.println(month);
|
System.out.println(month);
|
||||||
String result = DateUtils.getMonthLastDay(2019,2)+"";
|
List<String> yearList = getYearBetweenDate("2021-01-01","2023-05-01");
|
||||||
System.out.println(result);
|
System.out.println("yearList --> "+JSONArray.toJSONString(yearList));
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
@ -525,4 +527,41 @@ public final class DateUtils {
|
||||||
return cal.getTime();
|
return cal.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取两个日期之间的所有年
|
||||||
|
* @version v1.0
|
||||||
|
* @author dong
|
||||||
|
* @date 2023/11/1 9:51
|
||||||
|
*/
|
||||||
|
public static List<String> getYearBetweenDate(String startTime, String endTime) {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
|
||||||
|
// 声明保存日期集合
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
// 转化成日期类型
|
||||||
|
Date startDate = sdf.parse(startTime);
|
||||||
|
Date endDate = sdf.parse(endTime);
|
||||||
|
|
||||||
|
//用Calendar 进行日期比较判断
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
while (startDate.getTime() <= endDate.getTime()) {
|
||||||
|
|
||||||
|
// 把日期添加到集合
|
||||||
|
list.add(sdf.format(startDate));
|
||||||
|
|
||||||
|
// 设置日期
|
||||||
|
calendar.setTime(startDate);
|
||||||
|
|
||||||
|
//把年数增加 1
|
||||||
|
calendar.add(Calendar.YEAR, 1);
|
||||||
|
|
||||||
|
// 获取增加后的日期
|
||||||
|
startDate = calendar.getTime();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user