Merge branch 'master' of http://192.168.0.56:3000/haozq/ah_jjzhgd_service
This commit is contained in:
commit
4d7332fba1
|
|
@ -31,6 +31,8 @@ public class Constant {
|
|||
|
||||
public final static String GX_PLAN_PROGRESS = "100";
|
||||
|
||||
public final static double MAX_VALUE = 100.0;
|
||||
|
||||
public final static String XL = "线路";
|
||||
|
||||
public final static String[] BUILD_ARR = {"12A0,合肥","12B0,马鞍山","12C0,芜湖","12D0,安庆","12F0,淮南",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
|
|
@ -35,7 +36,8 @@ public class GxPlanProgressVo {
|
|||
private String bidCode;
|
||||
|
||||
@ApiModelProperty(value = "工序计划进度")
|
||||
@NotBlank(message = "工序计划进度不能为空", groups = {Query.class})
|
||||
@NotBlank(message = "进度填报不能为空", groups = {Query.class})
|
||||
@Pattern(regexp = "(?:0|[1-9][0-9]?|100)(\\.[0-9]{0,2})?",message = "进度填报值为0-100",groups = {Query.class})
|
||||
private String gxProgress;
|
||||
|
||||
@ApiModelProperty(value = "填报时间")
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@ package com.securitycontrol.entity.system.base.vo;
|
|||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
|
|
@ -17,21 +21,30 @@ public class GxPlanVo {
|
|||
private String planId;
|
||||
|
||||
@ApiModelProperty(value = "标段工程编码")
|
||||
@NotBlank(message = "标段工程编码不能为空", groups = {Query.class})
|
||||
@Length(max = 50, message = "标段工程编码字符长度不能超过50", groups = {Query.class})
|
||||
private String bidCode;
|
||||
|
||||
@ApiModelProperty(value = "工序id/杆塔ID")
|
||||
@NotBlank(message = "工序ID或杆塔ID不能为空", groups = {Query.class})
|
||||
@Length(max = 100, message = "工序ID或杆塔ID字符长度不能超过50", groups = {Query.class})
|
||||
private String gxId;
|
||||
|
||||
@ApiModelProperty(value = "工序名称/杆塔名称")
|
||||
private String gxName;
|
||||
|
||||
@ApiModelProperty(value = "工序作业权重")
|
||||
@NotBlank(message = "工序作业权重不能为空", groups = {Query.class})
|
||||
@Length(max = 100, message = "工序作业权重字符长度不能超过30", groups = {Query.class})
|
||||
@Pattern(regexp = "(?:0|[1-9][0-9]?|100)(\\.[0-9]{0,2})?",message = "工序作业权重为0-100",groups = {Query.class})
|
||||
private String gxWeight;
|
||||
|
||||
@ApiModelProperty(value = "计划开始时间")
|
||||
@NotBlank(message = "计划开始时间不能为空", groups = {Query.class})
|
||||
private String planStartTime;
|
||||
|
||||
@ApiModelProperty(value = "计划结束时间")
|
||||
@NotBlank(message = "计划结束时间不能为空", groups = {Query.class})
|
||||
private String planEndTime;
|
||||
|
||||
@ApiModelProperty(value = "实际开始时间")
|
||||
|
|
@ -50,4 +63,10 @@ public class GxPlanVo {
|
|||
@ApiModelProperty(value = "1. 新增 2.修改")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 查询条件限制
|
||||
*/
|
||||
public interface Query {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@ import com.securitycontrol.entity.system.base.dto.ProGxPlanDto;
|
|||
import com.securitycontrol.entity.system.base.vo.GxPlanVo;
|
||||
import com.securitycontrol.entity.system.base.vo.ProVo;
|
||||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
|
|
@ -188,6 +190,7 @@ public interface IProMapper {
|
|||
|
||||
/**
|
||||
* 工程是否存在
|
||||
*
|
||||
* @param vo
|
||||
* @return int
|
||||
* @description
|
||||
|
|
@ -195,4 +198,15 @@ public interface IProMapper {
|
|||
* @date 2024/3/16 18:20
|
||||
*/
|
||||
int proIsExist(ProVo vo);
|
||||
|
||||
/**
|
||||
* 获取工序计划作业权重占比
|
||||
* @param bidCode
|
||||
* @return List<Map<String, String>>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/20 9:40
|
||||
*/
|
||||
@MapKey("planId")
|
||||
List<Map<String, String>> getGxWeight(String bidCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
|
|
@ -73,23 +76,26 @@ public class ProScheduleServiceImpl implements IProScheduleService {
|
|||
return AjaxResult.error(validResult);
|
||||
}
|
||||
int result = mapper.isFirstFillingGxProgress(vo);
|
||||
if(result == 0){
|
||||
if (result == 0) {
|
||||
// 更新 工序计划开始时间
|
||||
vo.setStartTime(DateTimeHelper.getNowDate());
|
||||
vo.setType(1);
|
||||
mapper.updateGxPlanData(vo);
|
||||
mapper.updateGxPlanData(vo);
|
||||
}
|
||||
Long timestamp = DateTimeHelper.convertDateStringToTimestamp(vo.getPlanEndTime(), "yyyy-MM-dd");
|
||||
if(timestamp == null){
|
||||
if (timestamp == null) {
|
||||
return AjaxResult.error("计划结束时间格式不正确");
|
||||
}
|
||||
Long timestamp2 = DateTimeHelper.convertDateStringToTimestamp(DateTimeHelper.getNowDate(), "yyyy-MM-dd");
|
||||
if(timestamp2 < timestamp && StringUtils.isEmpty(vo.getDelaReason())){
|
||||
if (timestamp2 > timestamp && StringUtils.isEmpty(vo.getDelaReason())) {
|
||||
return AjaxResult.error("计划延期原因不能为空");
|
||||
}
|
||||
// 计划填报进度为100 更新工序计划
|
||||
if(vo.getGxProgress().contains(Constant.GX_PLAN_PROGRESS)){
|
||||
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);
|
||||
}
|
||||
|
|
@ -99,11 +105,11 @@ public class ProScheduleServiceImpl implements IProScheduleService {
|
|||
vo.setProgressId(progressId);
|
||||
mapper.addGxPlanProgress(vo);
|
||||
// 工程为线路时 更新杆塔当前工序
|
||||
if(Objects.equals(Constant.XL,vo.getProType())){
|
||||
if (Objects.equals(Constant.XL, vo.getProType())) {
|
||||
mapper.updateGtData(vo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("填报工序计划进度列表",e);
|
||||
log.error("填报工序计划进度列表", e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
|
@ -285,78 +286,78 @@ public class ProServiceImpl implements IProService {
|
|||
public List<JSONObject> getLstError(List<JSONObject> lstObj) {
|
||||
List<JSONObject> lstError = new ArrayList<>();
|
||||
for (JSONObject obj : lstObj) {
|
||||
JSONObject errorObj0 = validateData(obj, "proName", "工程名称", 50,0);
|
||||
JSONObject errorObj0 = validateData(obj, "proName", "工程名称", 50, 0);
|
||||
if (errorObj0 != null) {
|
||||
lstError.add(errorObj0);
|
||||
continue;
|
||||
}
|
||||
JSONObject errorObj = validateData(obj, "org", "建管单位", 0,0);
|
||||
JSONObject errorObj = validateData(obj, "org", "建管单位", 0, 0);
|
||||
if (errorObj != null) {
|
||||
lstError.add(errorObj);
|
||||
continue;
|
||||
}
|
||||
JSONObject errorObj2 = validateData(obj, "bidCode", "标段编码", 50,1);
|
||||
JSONObject errorObj2 = validateData(obj, "bidCode", "标段编码", 50, 1);
|
||||
if (errorObj2 != null) {
|
||||
lstError.add(errorObj2);
|
||||
continue;
|
||||
}
|
||||
|
||||
JSONObject errorObj3 = validateData(obj, "signCode", "单项编码", 50,0);
|
||||
JSONObject errorObj3 = validateData(obj, "signCode", "单项编码", 50, 0);
|
||||
if (errorObj3 != null) {
|
||||
lstError.add(errorObj3);
|
||||
continue;
|
||||
}
|
||||
JSONObject errorObj4 = validateData(obj, "proCode", "工程编码", 50,0);
|
||||
JSONObject errorObj4 = validateData(obj, "proCode", "工程编码", 50, 0);
|
||||
if (errorObj4 != null) {
|
||||
lstError.add(errorObj4);
|
||||
continue;
|
||||
}
|
||||
JSONObject errorObj5 = validateData(obj, "proCost", "工程成本", 50,0);
|
||||
JSONObject errorObj5 = validateData(obj, "proCost", "工程成本", 50, 0);
|
||||
if (errorObj5 != null) {
|
||||
lstError.add(errorObj5);
|
||||
continue;
|
||||
}
|
||||
JSONObject errorObj6 = validateData(obj, "sgUnit", "施工单位", 30,0);
|
||||
JSONObject errorObj6 = validateData(obj, "sgUnit", "施工单位", 30, 0);
|
||||
if (errorObj6 != null) {
|
||||
lstError.add(errorObj6);
|
||||
continue;
|
||||
}
|
||||
JSONObject errorObj7 = validateData(obj, "jlUnit", "监理单位", 30,0);
|
||||
JSONObject errorObj7 = validateData(obj, "jlUnit", "监理单位", 30, 0);
|
||||
if (errorObj7 != null) {
|
||||
lstError.add(errorObj7);
|
||||
continue;
|
||||
}
|
||||
JSONObject errorObj8 = validateData(obj, "proType", "工程类型", 10,0);
|
||||
JSONObject errorObj8 = validateData(obj, "proType", "工程类型", 10, 0);
|
||||
if (errorObj8 != null) {
|
||||
lstError.add(errorObj8);
|
||||
continue;
|
||||
}
|
||||
JSONObject errorObj9 = validateData(obj, "proScale", "工程规模", 300,0);
|
||||
JSONObject errorObj9 = validateData(obj, "proScale", "工程规模", 300, 0);
|
||||
if (errorObj9 != null) {
|
||||
lstError.add(errorObj9);
|
||||
continue;
|
||||
}
|
||||
JSONObject errorObj10 = validateData(obj, "manager", "项目经理", 10,0);
|
||||
JSONObject errorObj10 = validateData(obj, "manager", "项目经理", 10, 0);
|
||||
if (errorObj10 != null) {
|
||||
lstError.add(errorObj10);
|
||||
continue;
|
||||
}
|
||||
JSONObject errorObj11 = validateData(obj, "proBrief", "工程简介", 0,0);
|
||||
JSONObject errorObj11 = validateData(obj, "proBrief", "工程简介", 0, 0);
|
||||
if (errorObj11 != null) {
|
||||
lstError.add(errorObj11);
|
||||
continue;
|
||||
}
|
||||
JSONObject errorObj12 = validateData(obj, "status", "工程状态", 10,0);
|
||||
JSONObject errorObj12 = validateData(obj, "status", "工程状态", 10, 0);
|
||||
if (errorObj12 != null) {
|
||||
lstError.add(errorObj12);
|
||||
continue;
|
||||
}
|
||||
JSONObject errorObj13 = validateData(obj, "status", "计划开始时间", 0,0);
|
||||
JSONObject errorObj13 = validateData(obj, "status", "计划开始时间", 0, 0);
|
||||
if (errorObj13 != null) {
|
||||
lstError.add(errorObj13);
|
||||
continue;
|
||||
}
|
||||
JSONObject errorObj14 = validateData(obj, "planEndTime", "计划结束时间", 0,0);
|
||||
JSONObject errorObj14 = validateData(obj, "planEndTime", "计划结束时间", 0, 0);
|
||||
if (errorObj14 != null) {
|
||||
lstError.add(errorObj14);
|
||||
continue;
|
||||
|
|
@ -365,7 +366,7 @@ public class ProServiceImpl implements IProService {
|
|||
return lstError;
|
||||
}
|
||||
|
||||
public JSONObject validateData(JSONObject obj, String dataValue, String dataName, int length,int type) {
|
||||
public JSONObject validateData(JSONObject obj, String dataValue, String dataName, int length, int type) {
|
||||
if (StringUtils.isBlank(obj.getString(dataValue))) {
|
||||
JSONObject error = new JSONObject();
|
||||
error.put("errorRow", obj.getString("rowNo"));
|
||||
|
|
@ -374,7 +375,7 @@ public class ProServiceImpl implements IProService {
|
|||
error.put("errorMsg", dataName + "不能为空");
|
||||
return error;
|
||||
}
|
||||
if (StringUtils.isNotEmpty(obj.getString(dataValue)) && obj.getString(dataValue).length() > length && length > 0 ) {
|
||||
if (StringUtils.isNotEmpty(obj.getString(dataValue)) && obj.getString(dataValue).length() > length && length > 0) {
|
||||
JSONObject error = new JSONObject();
|
||||
error.put("errorRow", obj.getString("rowNo"));
|
||||
error.put("errorLine", dataName);
|
||||
|
|
@ -382,11 +383,11 @@ public class ProServiceImpl implements IProService {
|
|||
error.put("errorMsg", dataName + "字符长度不能超过" + length);
|
||||
return error;
|
||||
}
|
||||
if(StringUtils.isNotEmpty(obj.getString(dataValue)) && type > 0){
|
||||
if (StringUtils.isNotEmpty(obj.getString(dataValue)) && type > 0) {
|
||||
ProVo proVo = new ProVo();
|
||||
proVo.setBidCode(obj.getString(dataValue));
|
||||
int result = mapper.proIsExist(proVo);
|
||||
if(result > 0){
|
||||
if (result > 0) {
|
||||
JSONObject error = new JSONObject();
|
||||
error.put("errorRow", obj.getString("rowNo"));
|
||||
error.put("errorLine", dataName);
|
||||
|
|
@ -494,6 +495,17 @@ public class ProServiceImpl implements IProService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult addOrUpdateGxPlan(GxPlanVo vo) {
|
||||
try {
|
||||
String validResult = validatorsUtils.valid(vo, GxPlanVo.Query.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
List<Map<String, String>> weightList = mapper.getGxWeight(vo.getBidCode());
|
||||
if(CollectionUtils.isNotEmpty(weightList)){
|
||||
Boolean isFlag = isExceedData(weightList, vo.getPlanId(), vo.getGxWeight());
|
||||
if (isFlag) {
|
||||
return AjaxResult.error("计划作业权重超过100%");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isEmpty(vo.getPlanId())) {
|
||||
String gxPlanId = UUID.randomUUID().toString().replace("-", "");
|
||||
vo.setPlanId(gxPlanId);
|
||||
|
|
@ -510,6 +522,60 @@ public class ProServiceImpl implements IProService {
|
|||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算计划权重占比
|
||||
*
|
||||
* @param weightList
|
||||
* @param planId
|
||||
* @param gxWeightData
|
||||
* @return Boolean
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/20 9:52
|
||||
*/
|
||||
public static Boolean isExceedData(List<Map<String, String>> weightList, String planId, String gxWeightData) {
|
||||
BigDecimal data = BigDecimal.valueOf(0);
|
||||
for (Map<String, String> map : weightList) {
|
||||
String gxWeight = map.get("gxWeight");
|
||||
String id = map.get("planId");
|
||||
if (isNumeric(gxWeight)) {
|
||||
if (StringUtils.isEmpty(planId)) {
|
||||
BigDecimal value = BigDecimal.valueOf(Double.parseDouble(gxWeight));
|
||||
data = data.add(value);
|
||||
} else if(StringUtils.isNotEmpty(planId) && !Objects.equals(planId, id)) {
|
||||
BigDecimal value = BigDecimal.valueOf(Double.parseDouble(gxWeight));
|
||||
data = data.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isNumeric(gxWeightData)) {
|
||||
BigDecimal value = BigDecimal.valueOf(Double.parseDouble(gxWeightData));
|
||||
data = data.add(value);
|
||||
}
|
||||
if (data.doubleValue() > Constant.MAX_VALUE) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串是否为数字
|
||||
*
|
||||
* @param str
|
||||
* @return boolean
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/20 9:56
|
||||
*/
|
||||
public static boolean isNumeric(String str) {
|
||||
try {
|
||||
Double.parseDouble(str);
|
||||
return true;
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getGxPlanById(GxPlanDto dto) {
|
||||
GxPlanVo vo = new GxPlanVo();
|
||||
|
|
|
|||
|
|
@ -304,4 +304,11 @@
|
|||
SELECT COUNT(*) FROM tb_project tp WHERE bid_code = #{bidCode} AND pro_id != #{proId}
|
||||
</if>
|
||||
</select>
|
||||
<!--获取工序计划作业权重占比-->
|
||||
<select id="getGxWeight" resultType="java.util.Map">
|
||||
SELECT plan_id AS planId,
|
||||
gx_weight AS gxWeight
|
||||
FROM tb_gx_plan
|
||||
WHERE bid_code = #{bidCode}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
<if test="gxProgress != null and gxProgress!=''">gx_progress,</if>
|
||||
<if test="gxId != null and gxId!=''">gx_id,</if>
|
||||
<if test="createTime != null and createTime!=''">create_time,</if>
|
||||
<if test="delaReason != null and delaReason!=''">dela_reason,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="progressId != null and progressId != ''">#{progressId},</if>
|
||||
|
|
@ -17,6 +18,7 @@
|
|||
<if test="gxProgress != null and gxProgress!=''">#{gxProgress},</if>
|
||||
<if test="gxId != null and gxId!=''">#{gxId},</if>
|
||||
<if test="createTime != null and createTime!=''">#{createTime},</if>
|
||||
<if test="delaReason != null and delaReason!=''">#{delaReason},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue