工程进度填报

This commit is contained in:
cwchen 2024-03-16 16:06:27 +08:00
parent 6fa52ce60a
commit ae86ef6d33
13 changed files with 527 additions and 93 deletions

View File

@ -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;

View File

@ -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<String> getWeekList() {
List<String> 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<String> getWeekList() {
List<String> 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<String> getWeekDataList(String time){
public static List<String> getWeekDataList(String time) {
List<String> week = new ArrayList<String>();
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();
}
}

View File

@ -1,6 +1,7 @@
package com.securitycontrol.entity.system.base.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @authorcwchen
@ -8,8 +9,15 @@ import io.swagger.annotations.ApiModelProperty;
* @version1.0
* @description工程进度-dto
*/
@Data
public class ProScheduleDto {
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value = "标段编码")
private String bidCode;
@ApiModelProperty(value = "工序计划ID")
private String planId;
}

View File

@ -0,0 +1,69 @@
package com.securitycontrol.entity.system.base.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @authorcwchen
* @date2024-03-16-14:23
* @version1.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 {
}
}

View File

@ -16,6 +16,9 @@ public class GxPlanVo {
@ApiModelProperty(value = "计划ID")
private String planId;
@ApiModelProperty(value = "工序计划名称")
private String planName;
@ApiModelProperty(value = "标段工程编码")
private String bidCode;

View File

@ -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<ProScheduleVo> 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<GxPlanVo> 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<GxPlanProgressVo> 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);
}
}

View File

@ -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);
}

View File

@ -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<ProScheduleVo> getProScheduleLists(ProScheduleDto dto);
/**
* 获取工序计划列表
*
* @param dto
* @return List<GxPlanVo>
* @description
* @author cwchen
* @date 2024/3/16 13:42
*/
List<GxPlanVo> getGxPlanLists(GxPlanDto dto);
/**
* 工序计划延期提醒
*
* @param dto
* @return List<String>
* @description
* @author cwchen
* @date 2024/3/16 14:04
*/
List<String> getGxPlansIsDela(ProScheduleDto dto);
/**
* 获取工序计划进度列表
*
* @param dto
* @return List<GxPlanProgressVo>
* @description
* @author cwchen
* @date 2024/3/16 14:26
*/
List<GxPlanProgressVo> 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);
}

View File

@ -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<ProScheduleVo> getProScheduleLists(ProScheduleDto dto);
/**
* 获取工序计划列表
*
* @param dto
* @return List<GxPlanVo>
* @description
* @author cwchen
* @date 2024/3/16 13:40
*/
List<GxPlanVo> getGxPlanLists(GxPlanDto dto);
/**
* 工序计划延期提醒
*
* @param dto
* @return AjaxResult
* @description
* @author cwchen
* @date 2024/3/16 14:03
*/
AjaxResult getGxPlansIsDela(ProScheduleDto dto);
/**
* 获取工序计划进度列表
*
* @param dto
* @return List<GxPlanProgressVo>
* @description
* @author cwchen
* @date 2024/3/16 14:21
*/
List<GxPlanProgressVo> getGxPlanProgressLists(ProScheduleDto dto);
/**
* @param vo
* @return AjaxResult
* @description
* @author cwchen
* @date 2024/3/16 14:48
*/
AjaxResult fillingGxProgress(GxPlanProgressVo vo);
}

View File

@ -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.*;
/**
* @authorcwchen
@ -24,10 +33,80 @@ public class ProScheduleServiceImpl implements IProScheduleService {
@Resource(name = "IProScheduleMapper")
private IProScheduleMapper mapper;
@Resource(name = "ValidatorsUtils")
private ValidatorsUtils validatorsUtils;
@Override
public List<ProScheduleVo> getProScheduleLists(ProScheduleDto dto) {
List<ProScheduleVo> list = new ArrayList<>();
list = mapper.getProScheduleLists(dto);
return list;
}
@Override
public List<GxPlanVo> getGxPlanLists(GxPlanDto dto) {
List<GxPlanVo> list = new ArrayList<>();
list = mapper.getGxPlanLists(dto);
return list;
}
@Override
public AjaxResult getGxPlansIsDela(ProScheduleDto dto) {
List<String> list = new ArrayList<>();
list = mapper.getGxPlansIsDela(dto);
return AjaxResult.success(list);
}
@Override
public List<GxPlanProgressVo> getGxPlanProgressLists(ProScheduleDto dto) {
List<GxPlanProgressVo> 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();
}
}

View File

@ -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);

View File

@ -244,7 +244,8 @@
<!--获取工序列表-->
<select id="getGxPlanLists" resultType="com.securitycontrol.entity.system.base.vo.GxPlanVo">
SELECT tgp.plan_id AS planId,
gx_weight AS gxWeight,
tgp.plan_name AS planName,
tgp.gx_weight AS gxWeight,
tgp.plan_start_time AS planStartTime,
tgp.plan_end_time AS planEndTime,
tgp.start_time AS startTime,
@ -256,7 +257,10 @@
LEFT JOIN sys_dict sd ON sd.dict_code = tgp.gx_id
WHERE tgp.bid_code = #{bidCode}
<if test="keyWord!=null and keyWord!=''">
AND INSTR(gx_weight,#{keyWord}) > 0
AND (
INSTR(tgp.gx_weight,#{keyWord}) > 0 OR
INSTR(tgp.plan_name,#{keyWord}) > 0
)
</if>
</select>
<!--工序计划详情-->
@ -276,4 +280,8 @@
<select id="isHasGxPlan" resultType="java.lang.Integer">
SELECT COUNT(*) FROM tb_gx_plan WHERE bid_code = #{bidCode}
</select>
<!--当前工序计划是否存在进度填报数据-->
<select id="hasGxProgress" resultType="java.lang.Integer">
SELECT COUNT(*) FROM tb_project_progress WHERE plan_id = #{planId}
</select>
</mapper>

View File

@ -1,6 +1,43 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.securitycontrol.system.base.mapper.IProScheduleMapper">
<!--填报工序计划进度-->
<insert id="addGxPlanProgress">
INSERT INTO tb_project_progress
<trim prefix="(" suffix=")" suffixOverrides=",">
<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="createTime != null and createTime!=''">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<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="createTime != null and createTime!=''">#{createTime},</if>
</trim>
</insert>
<!--更新工序计划信息-->
<update id="updateGxPlanData">
<if test="type == 1">
UPDATE tb_gx_plan SET start_time = #{startTime} WHERE plan_id = #{planId}
</if>
<if test="type == 2">
UPDATE tb_gx_plan
<set>
<if test="endTime != null and endTime != ''">end_time = #{endTime},</if>
<if test="delaReason != null and delaReason != ''">dela_reason = #{delaReason},</if>
</set>
WHERE plan_id = #{planId}
</if>
</update>
<!--工程为线路时 更新杆塔当前工序-->
<update id="updateGtData">
UPDATE t_pro_gt SET now_gx = #{nowGxId} WHERE gt_id = #{gxId}
</update>
<!--获取工程进度列表-->
<select id="getProScheduleLists" resultType="com.securitycontrol.entity.system.base.vo.ProScheduleVo">
@ -35,4 +72,46 @@
</if>
</where>
</select>
<!--获取工序计划列表-->
<select id="getGxPlanLists" resultType="com.securitycontrol.entity.system.base.vo.GxPlanVo">
SELECT tgp.plan_id AS planId,
tgp.plan_name AS planName,
tgp.gx_weight AS gxWeight,
tgp.plan_start_time AS planStartTime,
tgp.plan_end_time AS planEndTime,
tgp.start_time AS startTime,
tgp.end_time AS endTime,
tgp.dela_reason AS delaReason,
tgp.bid_code AS bidCode,
sd.dict_name AS gxName,
tgp.bid_code AS bidCode,
tgp.gx_id AS gxId
FROM tb_gx_plan tgp
LEFT JOIN sys_dict sd ON sd.dict_code = tgp.gx_id
WHERE tgp.bid_code = #{bidCode}
<if test="keyWord!=null and keyWord!=''">
AND (
INSTR(tgp.gx_weight,#{keyWord}) > 0 OR
INSTR(tgp.plan_name,#{keyWord}) > 0
)
</if>
</select>
<!--工序计划延期提醒-->
<select id="getGxPlansIsDela" resultType="java.lang.String">
SELECT plan_name FROM tb_gx_plan WHERE bid_code = #{bidCode} AND end_time IS NULL AND plan_end_time = CURRENT_DATE
</select>
<!--获取工序计划进度列表-->
<select id="getGxPlanProgressLists"
resultType="com.securitycontrol.entity.system.base.vo.GxPlanProgressVo">
SELECT tgp.plan_name AS planName,
tpp.gx_progress AS gxProgress,
tpp.create_time AS createTime
FROM tb_project_progress tpp
LEFT JOIN tb_gx_plan tgp ON tpp.plan_id = tgp.plan_id
WHERE tpp.plan_id = #{planId}
</select>
<!--工序计划是否第一次填报-->
<select id="isFirstFillingGxProgress" resultType="java.lang.Integer">
SELECT COUNT(*) FROM tb_project_progress WHERE plan_id = #{planId}
</select>
</mapper>