diff --git a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/Constant.java b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/Constant.java index 7437e70..48f530e 100644 --- a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/Constant.java +++ b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/Constant.java @@ -26,6 +26,10 @@ public class Constant { public final static String PRO_IMPORT_VO = "ProImportVo"; + public final static String GX_PLAN_PROGRESS = "100"; + + public final static String XL = "线路"; + public final static Integer CELL_1 = 1; public final static Integer CELL_2 = 2; public final static Integer CELL_3 = 3; diff --git a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/DateTimeHelper.java b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/DateTimeHelper.java index 9375b2e..24c5d9d 100644 --- a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/DateTimeHelper.java +++ b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/DateTimeHelper.java @@ -1,20 +1,10 @@ package com.securitycontrol.common.core.utils.aes; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.time.DateFormatUtils; + import java.text.*; import java.time.*; import java.util.*; -import java.lang.management.ManagementFactory; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.util.Calendar; -import java.util.Date; import static org.apache.commons.lang3.time.DateUtils.parseDate; @@ -26,7 +16,6 @@ import static org.apache.commons.lang3.time.DateUtils.parseDate; public class DateTimeHelper { - private static String[] parsePatterns = { "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", @@ -61,11 +50,11 @@ public class DateTimeHelper { } - public static String dateTimeNow(final String format) { + public static String dateTimeNow(final String format) { return parseDateToStr(format, new Date()); } - public static String parseDateToStr(final String format, final Date date) { + public static String parseDateToStr(final String format, final Date date) { return new SimpleDateFormat(format).format(date); } @@ -122,20 +111,18 @@ public class DateTimeHelper { } - public static String getNowYmd() { return new SimpleDateFormat("yyyyMMdd").format(new Date()); } - public static String getNowDay() { return new SimpleDateFormat("yyyy-MM-dd").format(new Date()); } - public static String getTimesUpDown(String time){ + public static String getTimesUpDown(String time) { try { - if(StringHelper.isEmpty(time)){ + if (StringHelper.isEmpty(time)) { return time; } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -155,7 +142,8 @@ public class DateTimeHelper { } return time; } - public static String getNextDay(){ + + public static String getNextDay() { Calendar calendar = Calendar.getInstance(); // 对日期进行加1天的操作 calendar.add(Calendar.DAY_OF_MONTH, 1); @@ -164,7 +152,7 @@ public class DateTimeHelper { // 注意:月份从0开始计算 int month = calendar.get(Calendar.MONTH) + 1; int day = calendar.get(Calendar.DAY_OF_MONTH); - return year+"-"+month+"-"+day; + return year + "-" + month + "-" + day; } @@ -192,6 +180,7 @@ public class DateTimeHelper { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(date); } + @SuppressWarnings("static-access") public static String getQtDay() { Date date = new Date(); @@ -331,34 +320,36 @@ public class DateTimeHelper { } } - private static String[] digits = { "零","一", "二", "三", "四", "五", "六", "七", "八", "九"}; + private static String[] digits = {"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"}; + public static String getWeekTimes(String time) { - try{ - int month=Integer.parseInt(time.split("-")[1].trim()); + try { + int month = Integer.parseInt(time.split("-")[1].trim()); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date date = df.parse(time); Calendar cal = Calendar.getInstance(); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.setTime(date); int weekOfMonth = cal.get(Calendar.WEEK_OF_MONTH); - String msg=digits[weekOfMonth]; - return month+"月" +msg+"周"; - }catch (Exception e){ - log.error(e.toString(),e); + String msg = digits[weekOfMonth]; + return month + "月" + msg + "周"; + } catch (Exception e) { + log.error(e.toString(), e); } return null; } /** * 获取七周日期 + * * @return */ - public static List getWeekList() { - List list=new ArrayList<>(); - String time= DateTimeHelper.getNowDay(); - int max=6; - for (int i=max;i>=1;i--) { - String timess = getDayAddOrReduce(time,-7*i); + public static List getWeekList() { + List list = new ArrayList<>(); + String time = DateTimeHelper.getNowDay(); + int max = 6; + for (int i = max; i >= 1; i--) { + String timess = getDayAddOrReduce(time, -7 * i); list.add(timess); } list.add(time); @@ -371,8 +362,6 @@ public class DateTimeHelper { } - - /** * 得到前一个月 * @@ -513,9 +502,10 @@ public class DateTimeHelper { /** * 获取前一周的开始和结束时间 + * * @return */ - public static String getPrevWeek(){ + public static String getPrevWeek() { Date date = getBeginDayOfPrevWeek(); String time = format(date, "yyyy-MM-dd"); Date date2 = getEndDayOfPrevWeek(); @@ -526,6 +516,7 @@ public class DateTimeHelper { /** * 获取前一周的开始时间 + * * @return */ public static Date getBeginDayOfPrevWeek() { @@ -550,16 +541,16 @@ public class DateTimeHelper { } - /** * 获取指定时间 当前周的周一至周日的时间 + * * @return */ - public static List getWeekDataList(String time){ + public static List getWeekDataList(String time) { List week = new ArrayList(); - try{ - if(StringHelper.isEmpty(time)){ - time=DateTimeHelper.getNowDay(); + try { + if (StringHelper.isEmpty(time)) { + time = DateTimeHelper.getNowDay(); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date dataTime = sdf.parse(time); @@ -567,61 +558,63 @@ public class DateTimeHelper { calendar.setTime(dataTime); // 如果是周日 if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { - calendar.add(Calendar.DAY_OF_YEAR,-1); + calendar.add(Calendar.DAY_OF_YEAR, -1); } // 获取当前日期是当周的第i天 int i = calendar.get(Calendar.DAY_OF_WEEK) - 1; // 获取当前日期所在周的第一天 - calendar.add(Calendar.DATE , -i+1); - int max=7; + calendar.add(Calendar.DATE, -i + 1); + int max = 7; for (int j = 0; j < max; j++) { - if(j >0){ - calendar.add(Calendar.DATE , 1); + if (j > 0) { + calendar.add(Calendar.DATE, 1); } week.add(sdf.format(calendar.getTime())); System.err.println(sdf.format(calendar.getTime())); } return week; - }catch (Exception e){ - log.error(e.toString(),e); + } catch (Exception e) { + log.error(e.toString(), e); } return week; } /** * 仁义日期加减 + * * @return */ - public static String getDayAddOrReduce(String time,int num){ - String returnTime=null; - try{ + public static String getDayAddOrReduce(String time, int num) { + String returnTime = null; + try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date dataTime = sdf.parse(time); Calendar calendar = Calendar.getInstance(); calendar.setTime(dataTime); // 如果是周日 if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { - calendar.add(Calendar.DAY_OF_YEAR,-1); + calendar.add(Calendar.DAY_OF_YEAR, -1); } - calendar.add(Calendar.DATE , num); + calendar.add(Calendar.DATE, num); return sdf.format(calendar.getTime()); - }catch (Exception e){ - log.error(e.toString(),e); + } catch (Exception e) { + log.error(e.toString(), e); } return returnTime; } /** * 周开始和周结束时间 + * * @param time * @param isStart * @return */ - public static String getWeekStartOrEndTime(String time,boolean isStart){ - String returnTime=null; - try{ - if(StringHelper.isEmpty(time)){ - time=DateTimeHelper.getNowDay(); + public static String getWeekStartOrEndTime(String time, boolean isStart) { + String returnTime = null; + try { + if (StringHelper.isEmpty(time)) { + time = DateTimeHelper.getNowDay(); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); @@ -630,33 +623,35 @@ public class DateTimeHelper { calendar.setTime(dataTime); // 如果是周日 if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { - calendar.add(Calendar.DAY_OF_YEAR,-1); + calendar.add(Calendar.DAY_OF_YEAR, -1); } // 获取当前日期是当周的第i天 int i = calendar.get(Calendar.DAY_OF_WEEK) - 1; // 获取当前日期所在周的第一天 - calendar.add(Calendar.DATE , -i+1); - if(isStart){ + calendar.add(Calendar.DATE, -i + 1); + if (isStart) { return sdf.format(calendar.getTime()); - }else{ - calendar.add(Calendar.DATE , 6); + } else { + calendar.add(Calendar.DATE, 6); return sdf.format(calendar.getTime()); } - }catch (Exception e){ - log.error(e.toString(),e); + } catch (Exception e) { + log.error(e.toString(), e); } return returnTime; } + /** * 获取当前日期是多少周 周 + * * @return */ - public static int getNowWeeks(String time){ - try{ + public static int getNowWeeks(String time) { + try { Date date = new Date(); - if(StringHelper.isNotEmpty(time)){ + if (StringHelper.isNotEmpty(time)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); date = sdf.parse(time); } @@ -664,17 +659,14 @@ public class DateTimeHelper { calendar.setTime(date); // 获取一年中的第几周 int weekOfYear = calendar.get(Calendar.WEEK_OF_YEAR); - return weekOfYear; - } catch (Exception e){ - log.error(e.toString(),e); + return weekOfYear; + } catch (Exception e) { + log.error(e.toString(), e); return 0; } } - - - /** * 获取前一天的日期 * @@ -766,43 +758,66 @@ public class DateTimeHelper { /** * 小时差 + * * @param endTime * @param startTime * @return * @throws ParseException */ public static Double getTimeHours(String endTime, String startTime) throws ParseException { - try{ + try { SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date st = simpleFormat.parse(startTime); Date et = simpleFormat.parse(endTime); - long time = et.getTime()-st.getTime(); + long time = et.getTime() - st.getTime(); DecimalFormat decimalFormat = new DecimalFormat("0.00"); String format = decimalFormat.format(time * 1.0 / 3600000 * 1.0); return Double.valueOf(format); - }catch (Exception e){ + } catch (Exception e) { return 0.0; } } /** * 分钟差 + * * @param endTime * @param startTime * @return * @throws ParseException */ public static Long getTimeMine(String endTime, String startTime) throws ParseException { - try{ + try { SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date st = simpleFormat.parse(startTime); Date et = simpleFormat.parse(endTime); - long time = et.getTime()-st.getTime(); - double times=Double.parseDouble(time+""); - double b=times/1000/60; - return time/1000/60; - }catch (Exception e){ + long time = et.getTime() - st.getTime(); + double times = Double.parseDouble(time + ""); + double b = times / 1000 / 60; + return time / 1000 / 60; + } catch (Exception e) { return 0L; } } + + /** + * 日期解析为时间戳 + * @param dateString + * @param format + * @return Long + * @description + * @author cwchen + * @date 2024/3/16 15:11 + */ + public static Long convertDateStringToTimestamp(String dateString, String format) throws Exception { + Date date = null; + try { + SimpleDateFormat sdf = new SimpleDateFormat(format); + date = sdf.parse(dateString); + } catch (ParseException e) { + log.error("日期解析为时间戳异常", e); + return null; + } + return date.getTime(); + } } diff --git a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/system/base/dto/ProScheduleDto.java b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/system/base/dto/ProScheduleDto.java index 46e7198..8602745 100644 --- a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/system/base/dto/ProScheduleDto.java +++ b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/system/base/dto/ProScheduleDto.java @@ -1,6 +1,7 @@ package com.securitycontrol.entity.system.base.dto; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; /** * @author:cwchen @@ -8,8 +9,15 @@ import io.swagger.annotations.ApiModelProperty; * @version:1.0 * @description:工程进度-dto */ +@Data public class ProScheduleDto { @ApiModelProperty(value = "关键字") private String keyWord; + + @ApiModelProperty(value = "标段编码") + private String bidCode; + + @ApiModelProperty(value = "工序计划ID") + private String planId; } diff --git a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/system/base/vo/GxPlanProgressVo.java b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/system/base/vo/GxPlanProgressVo.java new file mode 100644 index 0000000..a7af350 --- /dev/null +++ b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/system/base/vo/GxPlanProgressVo.java @@ -0,0 +1,69 @@ +package com.securitycontrol.entity.system.base.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author:cwchen + * @date:2024-03-16-14:23 + * @version:1.0 + * @description:工序计划进度-vo + */ +@Data +public class GxPlanProgressVo { + + @ApiModelProperty(value = "进度ID") + private String progressId; + + @ApiModelProperty(value = "计划ID") + @NotBlank(message = "工序计划ID不能为空", groups = {Query.class}) + private String planId; + + @ApiModelProperty(value = "工序ID/杆塔ID") + @NotBlank(message = "工序ID/杆塔ID不能为空", groups = {Query.class}) + private String gxId; + + @ApiModelProperty(value = "杆塔当前工序ID") + private String nowGxId; + + @ApiModelProperty(value = "计划名称") + private String planName; + + @ApiModelProperty(value = "标段编码") + private String bidCode; + + @ApiModelProperty(value = "工序计划进度") + @NotBlank(message = "工序计划进度不能为空", groups = {Query.class}) + private String gxProgress; + + @ApiModelProperty(value = "填报时间") + private String createTime; + + @ApiModelProperty(value = "计划结束时间") + @NotBlank(message = "计划结束时间不能为空", groups = {Query.class}) + private String planEndTime; + + @ApiModelProperty(value = "计划实际开始时间") + private String startTime; + + @ApiModelProperty(value = "计划实际结束时间") + private String endTime; + + @ApiModelProperty(value = "延期原因") + private String delaReason; + + @ApiModelProperty(value = "变电 线路") + @NotBlank(message = "工程类型不能为空", groups = {Query.class}) + private String proType; + + @ApiModelProperty(value = "1.更新工序计划开始时间 2.更新工序计划结束时间或者延期原因") + private Integer type; + + /** + * 查询条件限制 + */ + public interface Query { + } +} diff --git a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/system/base/vo/GxPlanVo.java b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/system/base/vo/GxPlanVo.java index 7e871c6..26dfaf2 100644 --- a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/system/base/vo/GxPlanVo.java +++ b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/system/base/vo/GxPlanVo.java @@ -16,6 +16,9 @@ public class GxPlanVo { @ApiModelProperty(value = "计划ID") private String planId; + @ApiModelProperty(value = "工序计划名称") + private String planName; + @ApiModelProperty(value = "标段工程编码") private String bidCode; diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/controller/ProScheduleController.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/controller/ProScheduleController.java index 82a9558..547d8c7 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/controller/ProScheduleController.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/controller/ProScheduleController.java @@ -1,16 +1,18 @@ package com.securitycontrol.system.base.controller; import com.securitycontrol.common.core.web.controller.BaseController; +import com.securitycontrol.common.core.web.domain.AjaxResult; import com.securitycontrol.common.core.web.page.TableDataInfo; import com.securitycontrol.common.log.annotation.Log; import com.securitycontrol.common.log.enums.OperationType; +import com.securitycontrol.entity.system.base.dto.GxPlanDto; 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 com.securitycontrol.system.base.service.IProScheduleService; import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; @@ -30,10 +32,41 @@ public class ProScheduleController extends BaseController { @ApiOperation(value = "获取工程进度列表") @GetMapping("getProScheduleLists") - @Log(title = "基础管理", menu = "基础管理->工程管理管理", grade = OperationType.QUERY_BUSINESS, details = "查询工程进度", type = "业务日志") + @Log(title = "基础管理", menu = "基础管理->工程进度管理", grade = OperationType.QUERY_BUSINESS, details = "查询工程进度", type = "业务日志") public TableDataInfo getProScheduleLists(ProScheduleDto dto) { startPage(); List list = service.getProScheduleLists(dto); return getDataTable(list); } + + @ApiOperation(value = "获取工序计划列表") + @GetMapping("getGxPlanLists") + @Log(title = "基础管理", menu = "基础管理->工程进度管理", grade = OperationType.QUERY_BUSINESS, details = "查询工序计划", type = "业务日志") + public TableDataInfo getGxPlanLists(GxPlanDto dto) { + startPage(); + List list = service.getGxPlanLists(dto); + return getDataTable(list); + } + + @ApiOperation(value = "工序计划延期提醒") + @GetMapping("getGxPlansIsDela") + public AjaxResult getGxPlansIsDela(ProScheduleDto dto){ + return service.getGxPlansIsDela(dto); + } + + @ApiOperation(value = "获取工序计划进度列表") + @GetMapping("getGxPlanProgressLists") + @Log(title = "基础管理", menu = "基础管理->工程进度管理", grade = OperationType.QUERY_BUSINESS, details = "查询工序计划进度列表", type = "业务日志") + public TableDataInfo getGxPlanProgressLists(ProScheduleDto dto) { + startPage(); + List list = service.getGxPlanProgressLists(dto); + return getDataTable(list); + } + + @ApiOperation(value = "填报工序计划进度列表") + @PostMapping("fillingGxProgress") + @Log(title = "基础管理", menu = "基础管理->工程进度管理", grade = OperationType.ADD_BUSINESS, details = "填报工序计划进度", type = "业务日志") + public AjaxResult fillingGxProgress(@RequestBody GxPlanProgressVo vo){ + return service.fillingGxProgress(vo); + } } diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/IProMapper.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/IProMapper.java index a882e57..cb504e0 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/IProMapper.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/IProMapper.java @@ -174,4 +174,14 @@ public interface IProMapper { * @date 2024/3/13 16:34 */ int isHasGxPlan(ProDto dto); + + /** + * 当前工序计划是否存在进度填报数据 + * @param dto + * @return int + * @description + * @author cwchen + * @date 2024/3/16 15:56 + */ + int hasGxProgress(GxPlanDto dto); } diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/IProScheduleMapper.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/IProScheduleMapper.java index e6954be..3941506 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/IProScheduleMapper.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/IProScheduleMapper.java @@ -1,6 +1,9 @@ package com.securitycontrol.system.base.mapper; +import com.securitycontrol.entity.system.base.dto.GxPlanDto; 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.springframework.stereotype.Repository; @@ -24,4 +27,77 @@ public interface IProScheduleMapper { * @date 2024/3/13 19:20 */ List getProScheduleLists(ProScheduleDto dto); + + /** + * 获取工序计划列表 + * + * @param dto + * @return List + * @description + * @author cwchen + * @date 2024/3/16 13:42 + */ + List getGxPlanLists(GxPlanDto dto); + + /** + * 工序计划延期提醒 + * + * @param dto + * @return List + * @description + * @author cwchen + * @date 2024/3/16 14:04 + */ + List getGxPlansIsDela(ProScheduleDto dto); + + /** + * 获取工序计划进度列表 + * + * @param dto + * @return List + * @description + * @author cwchen + * @date 2024/3/16 14:26 + */ + List getGxPlanProgressLists(ProScheduleDto dto); + + /** + * 工序计划是否第一次填报 + * + * @param vo + * @return int + * @description + * @author cwchen + * @date 2024/3/16 14:53 + */ + int isFirstFillingGxProgress(GxPlanProgressVo vo); + + /** + * 更新工序计划信息 + * + * @param vo + * @description + * @author cwchen + * @date 2024/3/16 14:55 + */ + void updateGxPlanData(GxPlanProgressVo vo); + + /** + * 填报工序计划进度 + * + * @param vo + * @description + * @author cwchen + * @date 2024/3/16 15:25 + */ + void addGxPlanProgress(GxPlanProgressVo vo); + + /** + * 工程为线路时 更新杆塔当前工序 + * @param vo + * @description + * @author cwchen + * @date 2024/3/16 15:40 + */ + void updateGtData(GxPlanProgressVo vo); } diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/IProScheduleService.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/IProScheduleService.java index 59b421b..4c3f8c3 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/IProScheduleService.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/IProScheduleService.java @@ -1,6 +1,10 @@ package com.securitycontrol.system.base.service; +import com.securitycontrol.common.core.web.domain.AjaxResult; +import com.securitycontrol.entity.system.base.dto.GxPlanDto; 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 java.util.List; @@ -22,4 +26,46 @@ public interface IProScheduleService { * @date 2024/3/13 19:19 */ List getProScheduleLists(ProScheduleDto dto); + + /** + * 获取工序计划列表 + * + * @param dto + * @return List + * @description + * @author cwchen + * @date 2024/3/16 13:40 + */ + List getGxPlanLists(GxPlanDto dto); + + /** + * 工序计划延期提醒 + * + * @param dto + * @return AjaxResult + * @description + * @author cwchen + * @date 2024/3/16 14:03 + */ + AjaxResult getGxPlansIsDela(ProScheduleDto dto); + + /** + * 获取工序计划进度列表 + * + * @param dto + * @return List + * @description + * @author cwchen + * @date 2024/3/16 14:21 + */ + List getGxPlanProgressLists(ProScheduleDto dto); + + /** + * @param vo + * @return AjaxResult + * @description + * @author cwchen + * @date 2024/3/16 14:48 + */ + AjaxResult fillingGxProgress(GxPlanProgressVo vo); } diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProScheduleServiceImpl.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProScheduleServiceImpl.java index 79d730c..5ff9ead 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProScheduleServiceImpl.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProScheduleServiceImpl.java @@ -1,15 +1,24 @@ package com.securitycontrol.system.base.service.impl; +import com.securitycontrol.common.core.constant.Constant; +import com.securitycontrol.common.core.utils.StringUtils; +import com.securitycontrol.common.core.utils.aes.DateTimeHelper; +import com.securitycontrol.common.core.web.domain.AjaxResult; +import com.securitycontrol.common.security.utils.ValidatorsUtils; +import com.securitycontrol.entity.system.base.dto.GxPlanDto; 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 com.securitycontrol.system.base.mapper.IProScheduleMapper; import com.securitycontrol.system.base.service.IProScheduleService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; +import java.util.*; /** * @author:cwchen @@ -24,10 +33,80 @@ public class ProScheduleServiceImpl implements IProScheduleService { @Resource(name = "IProScheduleMapper") private IProScheduleMapper mapper; + @Resource(name = "ValidatorsUtils") + private ValidatorsUtils validatorsUtils; + @Override public List getProScheduleLists(ProScheduleDto dto) { List list = new ArrayList<>(); list = mapper.getProScheduleLists(dto); return list; } + + @Override + public List getGxPlanLists(GxPlanDto dto) { + List list = new ArrayList<>(); + list = mapper.getGxPlanLists(dto); + return list; + } + + @Override + public AjaxResult getGxPlansIsDela(ProScheduleDto dto) { + List list = new ArrayList<>(); + list = mapper.getGxPlansIsDela(dto); + return AjaxResult.success(list); + } + + @Override + public List getGxPlanProgressLists(ProScheduleDto dto) { + List list = new ArrayList<>(); + list = mapper.getGxPlanProgressLists(dto); + return list; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult fillingGxProgress(GxPlanProgressVo vo) { + try { + String validResult = validatorsUtils.valid(vo, GxPlanProgressVo.Query.class); + 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); + } + 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()); + vo.setType(2); + mapper.updateGxPlanData(vo); + } + // 填报工序计划 + vo.setCreateTime(DateTimeHelper.getNowDate()); + String progressId = UUID.randomUUID().toString().replace("-", ""); + vo.setProgressId(progressId); + mapper.addGxPlanProgress(vo); + // 工程为线路时 更新杆塔当前工序 + if(Objects.equals(Constant.XL,vo.getProType())){ + mapper.updateGtData(vo); + } + } catch (Exception e) { + log.error("填报工序计划进度列表",e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error(); + } + return AjaxResult.success(); + } } diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProServiceImpl.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProServiceImpl.java index 84dd095..249e7d2 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProServiceImpl.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProServiceImpl.java @@ -386,6 +386,10 @@ public class ProServiceImpl implements IProService { @Transactional(rollbackFor = Exception.class) public AjaxResult delGxPlanById(GxPlanDto dto) { try { + int result = mapper.hasGxProgress(dto); + if(result > 0){ + return AjaxResult.error("当前工序计划存在填报进度"); + } mapper.delGxPlanById(dto); } catch (Exception e) { log.error("工序计划", e); diff --git a/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProMapper.xml b/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProMapper.xml index c1540aa..bcb736d 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProMapper.xml +++ b/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProMapper.xml @@ -244,7 +244,8 @@ @@ -276,4 +280,8 @@ + + \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProScheduleMapper.xml b/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProScheduleMapper.xml index 5714633..86381cd 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProScheduleMapper.xml +++ b/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProScheduleMapper.xml @@ -1,6 +1,43 @@ + + + INSERT INTO tb_project_progress + + id, + plan_id, + gx_progress, + gx_id, + create_time, + + + #{progressId}, + #{planId}, + #{gxProgress}, + #{gxId}, + #{createTime}, + + + + + + + UPDATE tb_gx_plan SET start_time = #{startTime} WHERE plan_id = #{planId} + + + UPDATE tb_gx_plan + + end_time = #{endTime}, + dela_reason = #{delaReason}, + + WHERE plan_id = #{planId} + + + + + UPDATE t_pro_gt SET now_gx = #{nowGxId} WHERE gt_id = #{gxId} + + + + + + + + + \ No newline at end of file