工序计划
This commit is contained in:
parent
8e06d16c37
commit
a6c466c73d
|
|
@ -36,6 +36,8 @@ public class Constant {
|
|||
public final static double MAX_VALUE = 100.0;
|
||||
|
||||
public final static String XL = "线路";
|
||||
public final static String BD = "变电";
|
||||
public final static String JX = "架线";
|
||||
|
||||
public final static String SG_SCREEN = "2";
|
||||
public final static String SG_SCREEN_NAME = "施工大屏";
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class DeviceBdChildVo {
|
|||
@ApiModelProperty(value = "设备网络")
|
||||
@NotBlank(message = "设备网络不能为空", groups = {Query.class})
|
||||
@Length(max = 20, message = "设备网络字符长度不能超过20", groups = {Query.class})
|
||||
@Pattern(regexp = "((0|1\\d{0,2}|2[0-4]\\d|25[0-5])\\.){3}(0|1\\d{0,2}|2[0-4]\\d|25[0-5])",message = "设备网络格式不正确",groups = {Query.class})
|
||||
@Pattern(regexp = "((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",message = "设备网络格式不正确",groups = {Query.class})
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
|
|
|
|||
|
|
@ -33,12 +33,10 @@ public class DeviceBdVo {
|
|||
@ApiModelProperty(value = "边带ip")
|
||||
@NotBlank(message = "边带ip不能为空", groups = {Query.class})
|
||||
@Length(max = 50, message = "边带ip字符长度不能超过50", groups = {Query.class})
|
||||
@Pattern(regexp = "((0|1\\d{0,2}|2[0-4]\\d|25[0-5])\\.){3}(0|1\\d{0,2}|2[0-4]\\d|25[0-5])",message = "ip格式不正确",groups = {Query.class})
|
||||
@Pattern(regexp = "((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",message = "ip格式不正确",groups = {Query.class})
|
||||
private String bdIp;
|
||||
|
||||
@ApiModelProperty(value = "边带型号")
|
||||
@NotBlank(message = "边带型号不能为空", groups = {Query.class})
|
||||
@Length(max = 80, message = "边带型号字符长度不能超过80", groups = {Query.class})
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String bdType;
|
||||
|
||||
|
|
@ -46,8 +44,6 @@ public class DeviceBdVo {
|
|||
private String bdTypeName;
|
||||
|
||||
@ApiModelProperty(value = "设备类型编码")
|
||||
@NotBlank(message = "设备类型编码不能为空", groups = {Query.class})
|
||||
@Length(max = 11, message = "设备类型编码字符长度不能超过11", groups = {Query.class})
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String typeCode;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public class GxPlanProgressVo {
|
|||
private String gxId;
|
||||
|
||||
@ApiModelProperty(value = "杆塔当前工序ID")
|
||||
@NotBlank(message = "当前工序不能为空", groups = {Query.class})
|
||||
private String nowGxId;
|
||||
|
||||
@ApiModelProperty(value = "计划名称")
|
||||
|
|
@ -63,6 +64,12 @@ public class GxPlanProgressVo {
|
|||
@ApiModelProperty(value = "1.更新工序计划开始时间 2.更新工序计划结束时间或者延期原因")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "工序计划当前进度")
|
||||
private double planProgress;
|
||||
|
||||
@ApiModelProperty(value = "工序名称")
|
||||
private String gxName;
|
||||
|
||||
/**
|
||||
* 查询条件限制
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ public class GxPlanVo {
|
|||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "工序计划进度")
|
||||
private String planProgress;
|
||||
|
||||
/**
|
||||
* 查询条件限制
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@
|
|||
</insert>
|
||||
<!--删除边带设备-->
|
||||
<delete id="delDeviceBdById">
|
||||
UPDATE tb_pro_bd SET del_flag = 0 WHERE id = #{id}
|
||||
UPDATE tb_pro_bd SET del_flag = 1 WHERE id = #{id}
|
||||
</delete>
|
||||
<!--删除边带设备-->
|
||||
<delete id="delDeviceBdChildById">
|
||||
|
|
|
|||
|
|
@ -213,6 +213,7 @@ public interface IProMapper {
|
|||
|
||||
/**
|
||||
* 获取工程状态
|
||||
*
|
||||
* @return Map<String, Map < String, String>>
|
||||
* @description
|
||||
* @author cwchen
|
||||
|
|
@ -220,4 +221,14 @@ public interface IProMapper {
|
|||
*/
|
||||
@MapKey("name")
|
||||
Map<String, Map<String, String>> getProStatus();
|
||||
|
||||
/**
|
||||
* 添加工序计划时杆塔是否被重复添加
|
||||
* @param vo
|
||||
* @return int
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/29 17:51
|
||||
*/
|
||||
int getTowerIsExist(GxPlanVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,11 @@ import com.securitycontrol.entity.system.base.dto.ProScheduleDto;
|
|||
import com.securitycontrol.entity.system.base.vo.GxPlanProgressVo;
|
||||
import com.securitycontrol.entity.system.base.vo.GxPlanVo;
|
||||
import com.securitycontrol.entity.system.base.vo.ProScheduleVo;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
|
|
@ -104,6 +106,7 @@ public interface IProScheduleMapper {
|
|||
|
||||
/**
|
||||
* 获取当前工序计划的填报进度
|
||||
*
|
||||
* @param vo
|
||||
* @return String
|
||||
* @description
|
||||
|
|
@ -111,4 +114,25 @@ public interface IProScheduleMapper {
|
|||
* @date 2024/3/28 14:10
|
||||
*/
|
||||
String getGxPlanProgress(GxPlanProgressVo vo);
|
||||
|
||||
/**
|
||||
* 查询该工序计划所有填报信息
|
||||
*
|
||||
* @param vo
|
||||
* @return List<Map < Object>>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/30 12:39
|
||||
*/
|
||||
@MapKey("planId")
|
||||
List<Map<String, Object>> getProgressData(GxPlanProgressVo vo);
|
||||
|
||||
/**
|
||||
* 更新工序计划进度
|
||||
* @param vo
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/30 13:05
|
||||
*/
|
||||
void updateGxPlan(GxPlanProgressVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,15 +14,17 @@ import com.securitycontrol.entity.system.base.vo.ProScheduleVo;
|
|||
import com.securitycontrol.system.base.mapper.IProScheduleMapper;
|
||||
import com.securitycontrol.system.base.service.IProScheduleService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
|
|
@ -92,48 +94,21 @@ public class ProScheduleServiceImpl implements IProScheduleService {
|
|||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
int result = mapper.isFirstFillingGxProgress(vo);
|
||||
if (result == 0) {
|
||||
// 更新 工序计划开始时间
|
||||
vo.setStartTime(DateTimeHelper.getNowDate());
|
||||
vo.setType(1);
|
||||
mapper.updateGxPlanData(vo);
|
||||
}
|
||||
// 获取当前工序计划的填报进度
|
||||
String nowGxPlanProgress = mapper.getGxPlanProgress(vo);
|
||||
if(StringUtils.isNotEmpty(nowGxPlanProgress)){
|
||||
double aDouble = Double.parseDouble(nowGxPlanProgress);
|
||||
double bDouble = Double.parseDouble(vo.getGxProgress());
|
||||
if(bDouble < aDouble){
|
||||
return AjaxResult.error("当前进度填报需大于上一次填报进度");
|
||||
}
|
||||
}
|
||||
Long timestamp = DateTimeHelper.convertDateStringToTimestamp(vo.getPlanEndTime(), "yyyy-MM-dd");
|
||||
if (timestamp == null) {
|
||||
return AjaxResult.error("计划结束时间格式不正确");
|
||||
}
|
||||
Long timestamp2 = DateTimeHelper.convertDateStringToTimestamp(DateTimeHelper.getNowDate(), "yyyy-MM-dd");
|
||||
if (timestamp2 > timestamp && StringUtils.isEmpty(vo.getDelaReason())) {
|
||||
return AjaxResult.error("计划延期原因不能为空");
|
||||
}
|
||||
// 计划填报进度为100 更新工序计划
|
||||
if (vo.getGxProgress().contains(Constant.GX_PLAN_PROGRESS)) {
|
||||
vo.setEndTime(DateTimeHelper.getNowDate());
|
||||
}
|
||||
// 计划有延期更新到工序计划
|
||||
if (StringUtils.isNotEmpty(vo.getDelaReason()) || vo.getGxProgress().contains(Constant.GX_PLAN_PROGRESS)) {
|
||||
vo.setType(2);
|
||||
mapper.updateGxPlanData(vo);
|
||||
// 验证工序计划进度数据
|
||||
AjaxResult ajaxResult = validateData(vo);
|
||||
if (ajaxResult != null) {
|
||||
return ajaxResult;
|
||||
}
|
||||
// 工序计划进度赋值
|
||||
vo = setGxPlanProgressData(vo);
|
||||
// 填报工序计划
|
||||
vo.setCreateTime(DateTimeHelper.getNowTime());
|
||||
String progressId = IdUtils.getUUId();
|
||||
vo.setProgressId(progressId);
|
||||
mapper.addGxPlanProgress(vo);
|
||||
// 工程为线路时 更新杆塔当前工序
|
||||
if (Objects.equals(Constant.XL, vo.getProType())) {
|
||||
mapper.updateGtData(vo);
|
||||
}
|
||||
// 查询该工序计划所有填报信息
|
||||
List<Map<String, Object>> progressList = mapper.getProgressData(vo);
|
||||
statisticsProgress(progressList,vo);
|
||||
} catch (Exception e) {
|
||||
log.error("填报工序计划进度列表", e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
|
|
@ -141,4 +116,99 @@ public class ProScheduleServiceImpl implements IProScheduleService {
|
|||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证进度填报
|
||||
*
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/29 18:06
|
||||
*/
|
||||
public AjaxResult validateData(GxPlanProgressVo vo) {
|
||||
// 计划结束时间不能为空
|
||||
Long timestamp = DateTimeHelper.convertDateStringToTimestamp(vo.getPlanEndTime(), "yyyy-MM-dd");
|
||||
if (timestamp == null) {
|
||||
return AjaxResult.error("计划结束时间格式不正确");
|
||||
}
|
||||
// 如果当前时间超过计划结束时间 需要填写计划延期原因
|
||||
Long timestamp2 = DateTimeHelper.convertDateStringToTimestamp(DateTimeHelper.getNowDate(), "yyyy-MM-dd");
|
||||
if (timestamp2 > timestamp && StringUtils.isEmpty(vo.getDelaReason())) {
|
||||
return AjaxResult.error("计划延期原因不能为空");
|
||||
}
|
||||
// 获取当前工序的填报进度 线路->杆塔分为 基础、组塔、架线 变电直接到工序
|
||||
String nowGxPlanProgress = mapper.getGxPlanProgress(vo);
|
||||
if (StringUtils.isNotEmpty(nowGxPlanProgress)) {
|
||||
double aDouble = Double.parseDouble(nowGxPlanProgress);
|
||||
double bDouble = Double.parseDouble(vo.getGxProgress());
|
||||
if (bDouble < aDouble) {
|
||||
return AjaxResult.error("当前工序进度填报需大于上一次工序填报进度");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进度填报赋值
|
||||
*
|
||||
* @param vo
|
||||
* @return GxPlanProgressVo
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/30 12:44
|
||||
*/
|
||||
public GxPlanProgressVo setGxPlanProgressData(GxPlanProgressVo vo) {
|
||||
// 判断计划是否是第一次填报 并更新工序计划开始时间
|
||||
int result = mapper.isFirstFillingGxProgress(vo);
|
||||
if (result == 0) {
|
||||
vo.setStartTime(DateTimeHelper.getNowDate());
|
||||
vo.setType(1);
|
||||
mapper.updateGxPlanData(vo);
|
||||
}
|
||||
// 变电 - 工序进度达到 100 更新计划结束日期
|
||||
if (Objects.equals(vo.getProType(), Constant.BD) &&
|
||||
Objects.equals(Double.parseDouble(Constant.GX_PLAN_PROGRESS), vo.getGxProgress())) {
|
||||
vo.setEndTime(DateTimeHelper.getNowDate());
|
||||
}
|
||||
// 线路 - 工序进度为架线 并且进度到100 更新计划结束日期
|
||||
if (Objects.equals(vo.getProType(), Constant.XL) &&
|
||||
Objects.equals(Double.parseDouble(Constant.GX_PLAN_PROGRESS), vo.getGxProgress()) &&
|
||||
Objects.equals(vo.getNowGxId(), Constant.JX)) {
|
||||
vo.setEndTime(DateTimeHelper.getNowDate());
|
||||
}
|
||||
// 计划有延期或者进度填报达到100时更新到工序计划
|
||||
if (StringUtils.isNotEmpty(vo.getDelaReason()) || StringUtils.isNotEmpty(vo.getEndTime())) {
|
||||
vo.setType(2);
|
||||
mapper.updateGxPlanData(vo);
|
||||
}
|
||||
// 工程为线路时 更新杆塔当前工序
|
||||
if (Objects.equals(Constant.XL, vo.getProType())) {
|
||||
mapper.updateGtData(vo);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计并更新工序计划进度
|
||||
* @param progressList
|
||||
* @param vo
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/30 12:46
|
||||
*/
|
||||
public void statisticsProgress(List<Map<String, Object>> progressList, GxPlanProgressVo vo) {
|
||||
if (CollectionUtils.isNotEmpty(progressList)) {
|
||||
BigDecimal value = new BigDecimal("0");
|
||||
BigDecimal gxNum = new BigDecimal("3");
|
||||
for (Map<String, Object> map : progressList) {
|
||||
BigDecimal dataValue = new BigDecimal(String.valueOf(map.get("gxProgress")));
|
||||
value = value.add(dataValue);
|
||||
}
|
||||
if(Objects.equals(vo.getProType(),Constant.XL)){
|
||||
value = value.divide(gxNum, 3, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
vo.setPlanProgress(value.doubleValue());
|
||||
mapper.updateGxPlan(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -548,6 +548,10 @@ public class ProServiceImpl implements IProService {
|
|||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
int result = mapper.getTowerIsExist(vo);
|
||||
if(result > 0){
|
||||
return AjaxResult.error("杆塔或工序不能重复选择");
|
||||
}
|
||||
List<Map<String, String>> weightList = mapper.getGxWeight(vo.getBidCode());
|
||||
if (CollectionUtils.isNotEmpty(weightList)) {
|
||||
Boolean isFlag = isExceedData(weightList, vo.getPlanId(), vo.getGxWeight());
|
||||
|
|
|
|||
|
|
@ -261,7 +261,8 @@
|
|||
<if test="proType == '线路'">
|
||||
tpg.gt_name AS gxName,
|
||||
</if>
|
||||
tgp.gx_id AS gxId
|
||||
tgp.gx_id AS gxId,
|
||||
tgp.plan_progress AS planProgress
|
||||
FROM tb_gx_plan tgp
|
||||
<if test="proType == '变电'">
|
||||
LEFT JOIN sys_dict sd ON sd.dict_code = tgp.gx_id
|
||||
|
|
@ -323,4 +324,8 @@
|
|||
WHERE sd.dict_code = 1200 AND sd.del_flag = 0
|
||||
ORDER BY sd2.dict_sort
|
||||
</select>
|
||||
<!--添加工序计划时杆塔是否被重复添加-->
|
||||
<select id="getTowerIsExist" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM tb_gx_plan WHERE gx_id = #{gxId} AND del_flag = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
<if test="progressId != null and progressId != ''">id,</if>
|
||||
<if test="planId != null and planId!=''">plan_id,</if>
|
||||
<if test="gxProgress != null and gxProgress!=''">gx_progress,</if>
|
||||
<if test="gxId != null and gxId!=''">gx_id,</if>
|
||||
<if test="nowGxId != null and nowGxId!=''">gx_id,</if>
|
||||
<if test="createTime != null and createTime!=''">create_time,</if>
|
||||
<if test="delaReason != null and delaReason!=''">dela_reason,</if>
|
||||
</trim>
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
<if test="progressId != null and progressId != ''">#{progressId},</if>
|
||||
<if test="planId != null and planId!=''">#{planId},</if>
|
||||
<if test="gxProgress != null and gxProgress!=''">#{gxProgress},</if>
|
||||
<if test="gxId != null and gxId!=''">#{gxId},</if>
|
||||
<if test="nowGxId != null and nowGxId!=''">#{nowGxId},</if>
|
||||
<if test="createTime != null and createTime!=''">#{createTime},</if>
|
||||
<if test="delaReason != null and delaReason!=''">#{delaReason},</if>
|
||||
</trim>
|
||||
|
|
@ -40,6 +40,10 @@
|
|||
<update id="updateGtData">
|
||||
UPDATE t_pro_gt SET now_gx = #{nowGxId} WHERE gt_id = #{gxId}
|
||||
</update>
|
||||
<!--更新工序计划进度-->
|
||||
<update id="updateGxPlan">
|
||||
UPDATE tb_gx_plan SET plan_progress = #{planProgress} WHERE plan_id = #{planId}
|
||||
</update>
|
||||
|
||||
<!--获取工程进度列表-->
|
||||
<select id="getProScheduleLists" resultType="com.securitycontrol.entity.system.base.vo.ProScheduleVo">
|
||||
|
|
@ -92,7 +96,8 @@
|
|||
<if test="proType == '线路'">
|
||||
tpg.gt_name AS gxName,
|
||||
</if>
|
||||
tgp.gx_id AS gxId
|
||||
tgp.gx_id AS gxId,
|
||||
tgp.plan_progress AS planProgress
|
||||
FROM tb_gx_plan tgp
|
||||
<if test="proType == '变电'">
|
||||
LEFT JOIN sys_dict sd ON sd.dict_code = tgp.gx_id
|
||||
|
|
@ -100,7 +105,7 @@
|
|||
<if test="proType == '线路'">
|
||||
LEFT JOIN t_pro_gt tpg ON tgp.gx_id = tpg.gt_id
|
||||
</if>
|
||||
WHERE tgp.bid_code = #{bidCode}
|
||||
WHERE tgp.bid_code = #{bidCode} AND tgp.del_flag = 0
|
||||
<if test="proType == '变电' and keyWord!='' and keyWord!=null">
|
||||
AND INSTR(sd.dict_name,#{keyWord}) > 0
|
||||
</if>
|
||||
|
|
@ -116,10 +121,13 @@
|
|||
<select id="getGxPlanProgressLists"
|
||||
resultType="com.securitycontrol.entity.system.base.vo.GxPlanProgressVo">
|
||||
SELECT tpp.gx_progress AS gxProgress,
|
||||
tpp.create_time AS createTime
|
||||
tpp.create_time AS createTime,
|
||||
sd.dict_name AS gxName
|
||||
FROM tb_project_progress tpp
|
||||
LEFT JOIN tb_gx_plan tgp ON tpp.plan_id = tgp.plan_id
|
||||
LEFT JOIN tb_gx_plan tgp ON tpp.plan_id = tgp.plan_id AND tgp.del_flag = 0
|
||||
LEFT JOIN sys_dict sd on tpp.gx_id = sd.dict_code AND sd.del_flag = 0
|
||||
WHERE tpp.plan_id = #{planId}
|
||||
ORDER BY tpp.create_time
|
||||
</select>
|
||||
<!--工序计划是否第一次填报-->
|
||||
<select id="isFirstFillingGxProgress" resultType="java.lang.Integer">
|
||||
|
|
@ -129,8 +137,16 @@
|
|||
<select id="getGxPlanProgress" resultType="java.lang.String">
|
||||
SELECT tpp.gx_progress AS gxProgress
|
||||
FROM tb_project_progress tpp
|
||||
WHERE plan_id = #{planId}
|
||||
WHERE plan_id = #{planId} AND gx_id = #{nowGxId}
|
||||
ORDER BY create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
<!--查询该工序计划所有填报信息-->
|
||||
<select id="getProgressData" resultType="java.util.Map">
|
||||
SELECT tpp.plan_id AS planId,
|
||||
tpp.gx_progress AS gxProgress
|
||||
FROM tb_project_progress tpp
|
||||
INNER JOIN (SELECT MAX( create_time ) AS create_time FROM tb_project_progress WHERE plan_id = #{planId} GROUP BY gx_id) tpp2 ON tpp.create_time = tpp2.create_time
|
||||
WHERE plan_id = #{planId}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue