修改需求

This commit is contained in:
liuxi 2021-06-10 16:48:31 +08:00
parent 55d728f09b
commit c01ba9929a
4 changed files with 41 additions and 10 deletions

View File

@ -1,5 +1,6 @@
package com.nbclass.szxgl.mapper;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -36,6 +37,6 @@ public interface ProjectMapper extends MyMapper<Project> {
* @param status
* @return
*/
public void updateProjectStatus(String id, String contractno, int status);
public void updateProjectStatus(String id, String contractno, int status, String endTime);
}

View File

@ -64,11 +64,19 @@ public class Project {
/**
* 结束时间
*/
@NotNull(message="结束时间不能为空")
// @NotNull(message="结束时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Column(name = "_end_time")
private Date endTime;
/**
* 项目计划时间
*/
@NotNull(message="计划时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Column(name = "_plan_time")
private Date planTime;
/**
* 创建人
*/
@ -125,6 +133,7 @@ public class Project {
*/
@Column(name = "_project_clien_array")
private String projectClienArray;
// 以下是查询字段
@ -170,6 +179,8 @@ public class Project {
private String starttime;
@Transient
private String endtime;
@Transient
private String plantime;
/**
* 项目负责人userid(多个逗号分隔)
@ -268,6 +279,14 @@ public class Project {
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Date getPlanTime() {
return planTime;
}
public void setPlanTime(Date planTime) {
this.planTime = planTime;
}
public String getCreateUserId() {
return createUserId;

View File

@ -250,7 +250,7 @@ public class ProjectServiceImpl implements ProjectService {
*/
@Transactional
public String addProject(Project p, Integer isSendMsg, String[] deptIds, List<ProjectFiles> filesList) {
if (p.getStartTime().getTime() > p.getEndTime().getTime()) {
if (p.getStartTime().getTime() > p.getPlanTime().getTime()) {
throw new ParameterException("项目时间范围不对!");
}
@ -425,13 +425,14 @@ public class ProjectServiceImpl implements ProjectService {
if(p.getStartTime()==null) {
throw new ParameterException("开始时间不能为空!");
}
if(p.getEndTime()==null) {
throw new ParameterException("结束时间不能为空!");
if(p.getPlanTime()==null) {
throw new ParameterException("计划时间不能为空!");
}
if (p.getStartTime().getTime() > p.getEndTime().getTime()) {
if (p.getStartTime().getTime() > p.getPlanTime().getTime()) {
throw new ParameterException("项目时间范围不对!");
}
//修改项目不能修改结束时间
p.setEndTime(null);
String[] fzrIds = null, csrIds = null;
if(StringUtils.isNotBlank(p.getFzrIds()))fzrIds = p.getFzrIds().split(",");
if(StringUtils.isNotBlank(p.getCsrIds()))csrIds = p.getCsrIds().split(",");
@ -974,7 +975,11 @@ public class ProjectServiceImpl implements ProjectService {
if(Integer.parseInt(status)==3 && StringUtils.isBlank(contractno)) {
throw new ParameterException("合同号不能为空");
}
mapper.updateProjectStatus(id, contractno, Integer.parseInt(status));
Date endTime = null;
if (status.equals("3")){
endTime = new Date();
}
mapper.updateProjectStatus(id, contractno, Integer.parseInt(status),DateUtil.date2String(new Date(),DateUtil.PATTERN_STANDARD));
}
@Override

View File

@ -13,6 +13,7 @@
<result column="_status" jdbcType="TINYINT" property="status" />
<result column="_start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="_end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="_plan_time" jdbcType="TIMESTAMP" property="planTime" />
<result column="_create_user_id" jdbcType="CHAR" property="createUserId" />
<result column="_create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="_update_time" jdbcType="TIMESTAMP" property="updateTime" />
@ -25,7 +26,7 @@
</resultMap>
<select id="getList" parameterType="com.nbclass.szxgl.model.Project" resultType="com.nbclass.szxgl.model.Project">
SELECT p.id, p._name, p._type, p._importance, p._area, p._status, p._start_time, p._end_time,
SELECT p.id, p._name, p._type, p._importance, p._area, p._status, p._start_time, p._end_time, p._plan_time,
p._create_user_id, p._create_time, p._update_time, p._notify, p._customer, p._contractno, p._project_client_id,
p._project_clien_array,
lv1.list_value AS typeName, lv2.list_value AS importanceName,
@ -58,7 +59,9 @@
<if test="endtime != null and endtime != ''">
<![CDATA[ AND p._end_time <= #{endtime} ]]>
</if>
<if test="plantime != null and plantime != ''">
<![CDATA[ AND p._plan_time <= #{plantime} ]]>
</if>
<if test="createUserName != null and createUserName != ''">
AND (p._create_user_id=#{createUserName} or pu._table_id=#{createUserName} or ptu._user_id=#{createUserName})
</if>
@ -144,6 +147,9 @@
<if test="contractno != null and contractno != ''">
_contractno = #{contractno},
</if>
<if test="endTime != null and endTime != ''">
_end_time = NOW(),
</if>
_status = #{status} where id = #{id}
</update>