工程进度更新
This commit is contained in:
parent
ca03e22d0f
commit
7c189b97f2
|
|
@ -3,17 +3,20 @@ package com.bonus.digitalSignage.backstage.controller;
|
|||
import com.bonus.digitalSignage.annotation.DecryptAndVerify;
|
||||
import com.bonus.digitalSignage.annotation.LogAnnotation;
|
||||
import com.bonus.digitalSignage.backstage.entity.dto.QueryParamDto;
|
||||
import com.bonus.digitalSignage.backstage.entity.vo.ProProgressVo;
|
||||
import com.bonus.digitalSignage.backstage.service.ProProgressService;
|
||||
import com.bonus.digitalSignage.system.vo.EncryptedReq;
|
||||
import com.bonus.digitalSignage.utils.ServerResponse;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @className:ProProgressController
|
||||
|
|
@ -34,8 +37,56 @@ public class ProProgressController {
|
|||
@PostMapping(value = "getList")
|
||||
@DecryptAndVerify(decryptedClass = QueryParamDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "综合查询-工程进度更新", operation = "查询列表", operDesc = "系统级事件",operType="查询")
|
||||
// @PreAuthorize("@pms.hasPermission('comprehensive:data:query')")
|
||||
public ServerResponse getList(EncryptedReq<QueryParamDto> dto) {
|
||||
PageHelper.startPage(dto.getData().getPageNum(), dto.getData().getPageSize());
|
||||
return service.getList(dto.getData());
|
||||
}
|
||||
|
||||
@ApiOperation("工程进度更新-导出列表")
|
||||
@PostMapping("downloadExcel")
|
||||
@DecryptAndVerify(decryptedClass = QueryParamDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "工程进度更新-工程进度更新", operation = "导出列表", operDesc = "系统级事件",operType="导出")
|
||||
// @PreAuthorize("@pms.hasPermission('comprehensive:data:export')")
|
||||
public void downloadExcel(HttpServletResponse response, EncryptedReq<QueryParamDto> dto) {
|
||||
service.downloadExcel(dto.getData(),response);
|
||||
}
|
||||
|
||||
@ApiOperation("工程进度更新-更新进度-详情")
|
||||
@PostMapping("detailQuery")
|
||||
@DecryptAndVerify(decryptedClass = QueryParamDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "工程进度更新-更新进度", operation = "查询详情", operDesc = "系统级事件",operType="查询")
|
||||
// @PreAuthorize("@pms.hasPermission('comprehensive:data:detailQuery')")
|
||||
public ServerResponse detailQuery(HttpServletResponse response, EncryptedReq<QueryParamDto> dto) {
|
||||
return service.detailQuery(dto.getData());
|
||||
}
|
||||
|
||||
@ApiOperation("工程进度更新-更新进度-项目进度")
|
||||
@PostMapping(value = "getProProgress")
|
||||
@DecryptAndVerify(decryptedClass = QueryParamDto.class)//加解密统一管理
|
||||
public ServerResponse getProProgress(EncryptedReq<QueryParamDto> dto) {
|
||||
PageHelper.startPage(dto.getData().getPageNum(), dto.getData().getPageSize());
|
||||
return service.getProProgress(dto.getData());
|
||||
}
|
||||
|
||||
@ApiOperation("工程进度更新-更新进度-更新记录")
|
||||
@PostMapping("updateRecord")
|
||||
@DecryptAndVerify(decryptedClass = QueryParamDto.class)//加解密统一管理
|
||||
public ServerResponse updateRecord(HttpServletResponse response, EncryptedReq<QueryParamDto> dto) {
|
||||
return service.updateRecord(dto.getData());
|
||||
}
|
||||
|
||||
@ApiOperation("工程进度更新-更新进度-查询更新项目工序数据")
|
||||
@PostMapping("getGxData")
|
||||
@DecryptAndVerify(decryptedClass = QueryParamDto.class)//加解密统一管理
|
||||
public ServerResponse getGxData(EncryptedReq<QueryParamDto> dto) {
|
||||
return service.getGxData(dto.getData());
|
||||
}
|
||||
|
||||
@ApiOperation("工程进度更新-更新进度-更新数据")
|
||||
@PostMapping("updateProgressData")
|
||||
@DecryptAndVerify(decryptedClass = ProProgressVo.UpdateRecordVo.class)//加解密统一管理
|
||||
public ServerResponse updateProgressData(EncryptedReq<ProProgressVo.UpdateRecordVo> dto) {
|
||||
return service.updateProgressData(dto.getData());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,94 @@ public interface ProProgressDao {
|
|||
* @date 2025/4/21 17:46
|
||||
*/
|
||||
List<ProProgressVo> getList(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 工程进度更新-更新进度-详情
|
||||
* @param dto
|
||||
* @return ProDetailVo
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 10:43
|
||||
*/
|
||||
ProProgressVo.ProDetailVo detailQuery(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 工程进度更新-更新进度-项目进度
|
||||
* @param dto
|
||||
* @return List<TowerDetailVo>
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 11:11
|
||||
*/
|
||||
List<ProProgressVo.TowerDetailVo> getProProgress(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 查询工程杆塔进度
|
||||
* @param dto
|
||||
* @return TowerDetailVo
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 11:20
|
||||
*/
|
||||
ProProgressVo.ProDetailVo getTowerProgress(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 工程进度更新-更新进度-更新记录
|
||||
* @param dto
|
||||
* @return List<UpdateRecordVo>
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 13:06
|
||||
*/
|
||||
List<ProProgressVo.UpdateRecordVo> getUpdateRecord(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 工程进度更新-更新进度-查询更新项目工序数据
|
||||
* @param dto
|
||||
* @return List<TowerDetailVo>
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 13:16
|
||||
*/
|
||||
List<ProProgressVo.TowerDetailVo> getGxData(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 查询杆塔进度是否被重复更新
|
||||
* @param vo
|
||||
* @return int
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 14:20
|
||||
*/
|
||||
int getIsRepeatUpdate(ProProgressVo.UpdateRecordVo vo);
|
||||
|
||||
/**
|
||||
* 查询当前工程进度和杆塔数量
|
||||
* @param vo
|
||||
* @return Integer
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 14:25
|
||||
*/
|
||||
List<Long> getNowProProgress(ProProgressVo.UpdateRecordVo vo);
|
||||
|
||||
/**
|
||||
* 更新杆塔进度
|
||||
* @param vo
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 14:41
|
||||
*/
|
||||
void addProgress(ProProgressVo.UpdateRecordVo vo);
|
||||
|
||||
/**
|
||||
* 更新杆塔进度关系表
|
||||
* @param vo
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 15:03
|
||||
*/
|
||||
void addTowerProgress(ProProgressVo.UpdateRecordVo vo);
|
||||
|
||||
/**
|
||||
* 更新工程整体进度
|
||||
* @param vo
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 15:03
|
||||
*/
|
||||
void updateProProgress(ProProgressVo.UpdateRecordVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ import java.util.List;
|
|||
public class QueryParamDto {
|
||||
|
||||
private Long id;
|
||||
private Long departId;
|
||||
private String keyWord;
|
||||
private int type;
|
||||
/**权限层级*/
|
||||
private String level = UserUtil.getAuthLevel();
|
||||
/**项目部权限*/
|
||||
|
|
|
|||
|
|
@ -1,10 +1,18 @@
|
|||
package com.bonus.digitalSignage.backstage.entity.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.bonus.digitalSignage.system.vo.LoginUser;
|
||||
import com.bonus.digitalSignage.utils.UserUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @className:ProProgressVo
|
||||
|
|
@ -19,17 +27,200 @@ public class ProProgressVo {
|
|||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String keyWord;
|
||||
|
||||
@Excel(name = "序号", width = 10.0, orderNum = "0")
|
||||
private Long id;
|
||||
/**工程名称*/
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "工程名称", width = 30.0, orderNum = "1")
|
||||
private String proName;
|
||||
/**电压等级*/
|
||||
/**
|
||||
* 电压等级
|
||||
*/
|
||||
@Excel(name = "电压等级", width = 30.0, orderNum = "2")
|
||||
private String voltageLevel;
|
||||
/**项目进度*/
|
||||
/**
|
||||
* 项目进度
|
||||
*/
|
||||
@Excel(name = "项目进度", width = 30.0, orderNum = "3")
|
||||
private double proProgress;
|
||||
/**更新时间*/
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Excel(name = "更新时间", width = 30.0, orderNum = "4")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
/**更新人*/
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@Excel(name = "更新人", width = 30.0, orderNum = "5")
|
||||
private String updateUserName;
|
||||
|
||||
/**
|
||||
* 项目部id
|
||||
*/
|
||||
private Long departId;
|
||||
|
||||
@Data
|
||||
public static class ProDetailVo {
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String proName;
|
||||
/**
|
||||
* 所属分公司
|
||||
*/
|
||||
private String companyName;
|
||||
/**
|
||||
* 项目状态
|
||||
*/
|
||||
private String proStatus;
|
||||
/**
|
||||
* 电压等级
|
||||
*/
|
||||
private String voltageLevel;
|
||||
/**
|
||||
* 线路长度
|
||||
*/
|
||||
private String lineLength;
|
||||
/**
|
||||
* 杆塔数量
|
||||
*/
|
||||
private int towerNum;
|
||||
/**
|
||||
* 项目计划开始时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date planStartTime;
|
||||
/**
|
||||
* 项目计划结束时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date planEndTime;
|
||||
/**
|
||||
* 最后更新
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 项目进度
|
||||
*/
|
||||
private double proProgress;
|
||||
/**
|
||||
* 基础开挖
|
||||
*/
|
||||
private int num;
|
||||
/**
|
||||
* 基础开挖完成
|
||||
*/
|
||||
private int num2;
|
||||
/**
|
||||
* 基础浇筑完成
|
||||
*/
|
||||
private int num3;
|
||||
/**
|
||||
* 铁塔组立
|
||||
*/
|
||||
private int num4;
|
||||
/**
|
||||
* 铁塔组立完成
|
||||
*/
|
||||
private int num5;
|
||||
/**
|
||||
* 架线施工完成
|
||||
*/
|
||||
private int num6;
|
||||
/**
|
||||
* 附件安装完成
|
||||
*/
|
||||
private int num7;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class TowerDetailVo {
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 杆塔名称
|
||||
*/
|
||||
private String towerName;
|
||||
/**
|
||||
* 杆塔完成进度 1.基础开挖 2.基础开挖完成 3.基础浇筑完成 4.铁塔组立 5.铁塔组立完成 6.架线施工完成 7.附件安装完成
|
||||
*/
|
||||
private int towerProgress;
|
||||
|
||||
/**
|
||||
* 1.可选择 0.不可选择
|
||||
*/
|
||||
private int chooseStatus;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class UpdateRecordVo {
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
@NotNull(message = "工程id不能为空", groups = {Update.class})
|
||||
private Long id;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Long dataId;
|
||||
|
||||
private String userName;
|
||||
/**
|
||||
* 更新说明
|
||||
*/
|
||||
@NotBlank(message = "更新说明不能为空", groups = {Update.class})
|
||||
private String updateDesc;
|
||||
/**
|
||||
* 更新进度
|
||||
*/
|
||||
private double finishProgress;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date updateDate;
|
||||
|
||||
/**
|
||||
* 工序类型 1.基础开挖 2.基础开挖完成 3.基础浇筑完成 4.铁塔组立 5.铁塔组立完成 6.架线施工完成 7.附件安装完成
|
||||
*/
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private int progressType;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Long createUserId = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getId).orElse(0L);
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Long updateUserId = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getId).orElse(0L);
|
||||
|
||||
/**
|
||||
* 杆塔id集合
|
||||
*/
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
@NotNull(message = "选择杆塔不能为空", groups = {Update.class})
|
||||
@Size(min = 1, message = "至少选择一个杆塔数据", groups = {Update.class})
|
||||
private List<Long> towerIds;
|
||||
|
||||
/**
|
||||
* 修改条件限制
|
||||
*/
|
||||
public interface Update {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
package com.bonus.digitalSignage.backstage.service;
|
||||
|
||||
import com.bonus.digitalSignage.backstage.entity.dto.QueryParamDto;
|
||||
import com.bonus.digitalSignage.backstage.entity.vo.ProProgressVo;
|
||||
import com.bonus.digitalSignage.utils.ServerResponse;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @className:ProProgress
|
||||
* @author:cwchen
|
||||
|
|
@ -19,4 +22,59 @@ public interface ProProgressService {
|
|||
* @date 2025/4/21 17:41
|
||||
*/
|
||||
ServerResponse getList(QueryParamDto data);
|
||||
|
||||
/**
|
||||
* 工程进度更新-导出列表
|
||||
* @param data
|
||||
* @param response
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 10:22
|
||||
*/
|
||||
void downloadExcel(QueryParamDto data, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 工程进度更新-更新进度-详情
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 10:39
|
||||
*/
|
||||
ServerResponse detailQuery(QueryParamDto data);
|
||||
|
||||
/**
|
||||
* 工程进度更新-更新进度-项目进度
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 11:06
|
||||
*/
|
||||
ServerResponse getProProgress(QueryParamDto data);
|
||||
|
||||
/**
|
||||
* 工程进度更新-更新进度-更新记录
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 13:02
|
||||
*/
|
||||
ServerResponse updateRecord(QueryParamDto data);
|
||||
|
||||
/**
|
||||
* 工程进度更新-更新进度-查询更新项目工序数据
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 13:15
|
||||
*/
|
||||
ServerResponse getGxData(QueryParamDto data);
|
||||
|
||||
/**
|
||||
* 工程进度更新-更新进度-更新数据
|
||||
* @param vo
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 13:38
|
||||
*/
|
||||
ServerResponse updateProgressData(ProProgressVo.UpdateRecordVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
package com.bonus.digitalSignage.backstage.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import com.bonus.digitalSignage.advice.ValidatorsUtils;
|
||||
import com.bonus.digitalSignage.backstage.dao.ProProgressDao;
|
||||
import com.bonus.digitalSignage.backstage.entity.dto.QueryParamDto;
|
||||
import com.bonus.digitalSignage.backstage.entity.vo.ProProgressVo;
|
||||
|
|
@ -7,11 +11,19 @@ import com.bonus.digitalSignage.backstage.service.ProProgressService;
|
|||
import com.bonus.digitalSignage.utils.ServerResponse;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @className:ProProgressServiceImpl
|
||||
|
|
@ -27,15 +39,143 @@ public class ProProgressServiceImpl implements ProProgressService {
|
|||
@Resource(name = "ProProgressDao")
|
||||
private ProProgressDao dao;
|
||||
|
||||
@Resource(name = "ValidatorsUtils")
|
||||
private ValidatorsUtils validatorsUtils;
|
||||
|
||||
@Override
|
||||
public ServerResponse getList(QueryParamDto dto) {
|
||||
List<ProProgressVo> list = null;
|
||||
try {
|
||||
list = Optional.ofNullable(dao.getList(dto)).orElseGet(ArrayList::new);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
PageInfo<ProProgressVo> pageInfo = new PageInfo<>(list);
|
||||
return ServerResponse.createSuccessPage(pageInfo, dto.getPageNum(), dto.getPageSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadExcel(QueryParamDto dto, HttpServletResponse response) {
|
||||
try {
|
||||
List<ProProgressVo> list = list = Optional.ofNullable(dao.getList(dto)).orElseGet(ArrayList::new);
|
||||
final Long[] num = {1L};
|
||||
list.forEach(vo -> {
|
||||
vo.setId(num[0]);
|
||||
num[0]++;
|
||||
});
|
||||
ExportParams exportParams = new ExportParams("工程进度更新", "工程进度更新", ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, ProProgressVo.class, list);
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("工程进度更新" + ".xlsx", "UTF-8"));
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
outputStream.close();
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerResponse detailQuery(QueryParamDto dto) {
|
||||
try {
|
||||
ProProgressVo.ProDetailVo vo = Optional.ofNullable(dao.detailQuery(dto)).orElseGet(ProProgressVo.ProDetailVo::new);
|
||||
ProProgressVo.ProDetailVo vo2 = Optional.ofNullable(dao.getTowerProgress(dto)).orElseGet(ProProgressVo.ProDetailVo::new);
|
||||
vo.setNum(vo2.getNum());
|
||||
vo.setNum2(vo2.getNum2());
|
||||
vo.setNum3(vo2.getNum3());
|
||||
vo.setNum4(vo2.getNum4());
|
||||
vo.setNum5(vo2.getNum5());
|
||||
vo.setNum6(vo2.getNum6());
|
||||
vo.setNum7(vo2.getNum7());
|
||||
return ServerResponse.createSuccess(vo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return ServerResponse.createErroe("查询失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerResponse getProProgress(QueryParamDto dto) {
|
||||
List<ProProgressVo.TowerDetailVo> list = null;
|
||||
try {
|
||||
list = Optional.ofNullable(dao.getProProgress(dto)).orElseGet(ArrayList::new);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
PageInfo<ProProgressVo.TowerDetailVo> pageInfo = new PageInfo<>(list);
|
||||
return ServerResponse.createSuccessPage(pageInfo, dto.getPageNum(), dto.getPageSize());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ServerResponse updateRecord(QueryParamDto dto) {
|
||||
List<ProProgressVo.UpdateRecordVo> list = null;
|
||||
try {
|
||||
list = Optional.ofNullable(dao.getUpdateRecord(dto)).orElseGet(ArrayList::new);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return ServerResponse.createSuccess(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerResponse getGxData(QueryParamDto dto) {
|
||||
List<ProProgressVo.TowerDetailVo> list = null;
|
||||
try {
|
||||
list = Optional.ofNullable(dao.getGxData(dto)).orElseGet(ArrayList::new);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return ServerResponse.createSuccess(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ServerResponse updateProgressData(ProProgressVo.UpdateRecordVo vo) {
|
||||
try {
|
||||
// 校验数据是否合法
|
||||
String validResult = validatorsUtils.valid(vo, ProProgressVo.UpdateRecordVo.Update.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return ServerResponse.createErroe(validResult);
|
||||
}
|
||||
// 查询杆塔进度是否被重复更新
|
||||
int result = dao.getIsRepeatUpdate(vo);
|
||||
if (result > 0) {
|
||||
return ServerResponse.createErroe("请勿重复更新杆塔数据");
|
||||
}
|
||||
// 查询当前工程进度和杆塔数量
|
||||
List<Long> progressAndTowers = Optional.ofNullable(dao.getNowProProgress(vo)).orElseGet(ArrayList::new);
|
||||
Long finishTowerNum = progressAndTowers.get(0);
|
||||
Long towerNum = progressAndTowers.get(1);
|
||||
// 计算更新后的进度
|
||||
double progress = handleProgress(finishTowerNum, towerNum, vo.getTowerIds().size());
|
||||
vo.setFinishProgress(progress);
|
||||
// 更新杆塔进度、杆塔进度关系表、更新工程整体进度
|
||||
dao.addProgress(vo);
|
||||
dao.addTowerProgress(vo);
|
||||
dao.updateProProgress(vo);
|
||||
return ServerResponse.createSuccess("操作成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算进度
|
||||
* @param nowProgress
|
||||
* @param towerNum
|
||||
* @param towerNum2
|
||||
* @return double
|
||||
* @author cwchen
|
||||
* @date 2025/4/22 14:57
|
||||
*/
|
||||
public static double handleProgress(Long nowProgress, Long towerNum, int towerNum2) {
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(nowProgress + (long) towerNum2).multiply(BigDecimal.valueOf(100));
|
||||
BigDecimal bigDecimal2 = BigDecimal.valueOf(towerNum * 7);
|
||||
BigDecimal result = bigDecimal.divide(bigDecimal2, 2, RoundingMode.HALF_UP);
|
||||
return result.doubleValue();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@ public class LoginPageConfig {
|
|||
|
||||
@RequestMapping("/")
|
||||
public RedirectView loginPage() {
|
||||
return new RedirectView("/digitalSignage/login.html");
|
||||
return new RedirectView("/gzDigitalSignage/login.html");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,15 +2,47 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.digitalSignage.backstage.dao.ProProgressDao">
|
||||
<insert id="addProgress" useGeneratedKeys="true" keyProperty="dataId">
|
||||
INSERT INTO tb_progress
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">pro_id,</if>
|
||||
<if test="progressType != null">progress_type,</if>
|
||||
<if test="updateDesc != null and updateDesc != ''">update_desc,</if>
|
||||
<if test="finishProgress != null and finishProgress != ''">finish_progress,</if>
|
||||
create_user_id,
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="progressType != null">#{progressType},</if>
|
||||
<if test="updateDesc != null and updateDesc != ''">#{updateDesc},</if>
|
||||
<if test="finishProgress != null and finishProgress != ''">#{finishProgress},</if>
|
||||
#{createUserId}
|
||||
</trim>
|
||||
</insert>
|
||||
<!--杆塔进度关系表-->
|
||||
<insert id="addTowerProgress">
|
||||
INSERT INTO tb_tower_progress(tower_id,progress_id,progress_type,pro_id) VALUES
|
||||
<foreach collection="towerIds" separator="," item="item">
|
||||
(
|
||||
#{item},#{dataId},#{progressType},#{id}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<!--更新工程整体进度-->
|
||||
<update id="updateProProgress">
|
||||
UPDATE tb_project SET pro_progress = #{finishProgress},update_user_id = #{updateUserId}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!--工程进度更新-查询列表-->
|
||||
<select id="getList" resultType="com.bonus.digitalSignage.backstage.entity.vo.ProProgressVo">
|
||||
SELECT tp.id,
|
||||
tp.pro_name AS proName,
|
||||
A.dict_name AS voltageLevel,
|
||||
tp.pro_progress,
|
||||
tp.pro_progress AS proProgress,
|
||||
tp.update_time AS updateTime,
|
||||
su.user_name AS updateUserName
|
||||
su.user_name AS updateUserName,
|
||||
tp.depart_id AS departId
|
||||
FROM tb_project tp
|
||||
LEFT JOIN sys_user su ON tp.update_user_id = su.id
|
||||
LEFT JOIN (
|
||||
|
|
@ -32,4 +64,108 @@
|
|||
AND tp.is_active = '1'
|
||||
</where>
|
||||
</select>
|
||||
<!--工程进度更新-更新进度-详情-->
|
||||
<select id="detailQuery"
|
||||
resultType="com.bonus.digitalSignage.backstage.entity.vo.ProProgressVo$ProDetailVo">
|
||||
SELECT tp.id,
|
||||
tp.pro_name AS proName,
|
||||
D.departName AS companyName,
|
||||
B.dict_name AS proStatus,
|
||||
A.dict_name AS voltageLevel,
|
||||
tp.line_length AS lineLength,
|
||||
IFNULL(C.num,0) AS towerNum,
|
||||
tp.plan_start_time AS planStartTime,
|
||||
tp.plan_end_time AS planEndTime,
|
||||
tp.update_time AS updateTime
|
||||
FROM tb_project tp
|
||||
LEFT JOIN (
|
||||
SELECT pro_id,COUNT(*) AS num
|
||||
FROM tb_tower
|
||||
WHERE pro_id = #{id}
|
||||
GROUP BY pro_id
|
||||
) C ON tp.id = C.pro_id
|
||||
LEFT JOIN (
|
||||
SELECT sd.dict_value,sd.dict_name
|
||||
FROM sys_distinct sd
|
||||
LEFT JOIN sys_distinct sd2 ON sd.p_id = sd2.id
|
||||
WHERE sd2.dict_code = 'voltage_level' AND sd.del_flag = 0
|
||||
) A ON A.dict_value = tp.voltage_level
|
||||
LEFT JOIN (
|
||||
SELECT sd.dict_value,sd.dict_name
|
||||
FROM sys_distinct sd
|
||||
LEFT JOIN sys_distinct sd2 ON sd.p_id = sd2.id
|
||||
WHERE sd2.dict_code = 'pro_status' AND sd.del_flag = 0
|
||||
) B ON B.dict_value = tp.pro_status
|
||||
LEFT JOIN (
|
||||
SELECT td.id,td2.depart_name AS departName
|
||||
FROM tb_depart td
|
||||
LEFT JOIN tb_depart td2 ON td.parent_id = td2.id
|
||||
WHERE td.id = #{departId}
|
||||
) D ON D.id = tp.depart_id
|
||||
WHERE tp.id = #{id}
|
||||
</select>
|
||||
<!--工程进度更新-更新进度-项目进度-->
|
||||
<select id="getProProgress"
|
||||
resultType="com.bonus.digitalSignage.backstage.entity.vo.ProProgressVo$TowerDetailVo">
|
||||
SELECT tower_name AS towerName,
|
||||
tower_progress AS towerProgress
|
||||
FROM tb_tower
|
||||
WHERE pro_id = #{id}
|
||||
</select>
|
||||
<!--查询工程杆塔进度-->
|
||||
<select id="getTowerProgress"
|
||||
resultType="com.bonus.digitalSignage.backstage.entity.vo.ProProgressVo$ProDetailVo">
|
||||
SELECT COUNT(IF(tower_progress >= 1, 1, NULL)) AS num,
|
||||
COUNT(IF(tower_progress >= 2, 1, NULL)) AS num2,
|
||||
COUNT(IF(tower_progress >= 3, 1, NULL)) AS num3,
|
||||
COUNT(IF(tower_progress >= 4, 1, NULL)) AS num4,
|
||||
COUNT(IF(tower_progress >= 5, 1, NULL)) AS num5,
|
||||
COUNT(IF(tower_progress >= 6, 1, NULL)) AS num6,
|
||||
COUNT(IF(tower_progress >= 7, 1, NULL)) AS num7
|
||||
FROM tb_tower WHERE pro_id = #{id}
|
||||
</select>
|
||||
<!--工程进度更新-更新进度-更新记录-->
|
||||
<select id="getUpdateRecord"
|
||||
resultType="com.bonus.digitalSignage.backstage.entity.vo.ProProgressVo$UpdateRecordVo">
|
||||
SELECT su.user_name AS userName,
|
||||
tp.create_time AS updateDate,
|
||||
tp.create_time AS updateTime,
|
||||
tp.update_desc AS updateContent,
|
||||
tp.finish_progress AS finishProgress
|
||||
FROM tb_progress tp
|
||||
LEFT JOIN sys_user su ON tp.create_user_id = su.id
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
<!--工程进度更新-更新进度-查询更新项目工序数据-->
|
||||
<select id="getGxData"
|
||||
resultType="com.bonus.digitalSignage.backstage.entity.vo.ProProgressVo$TowerDetailVo">
|
||||
SELECT id,
|
||||
tower_name AS towerName,
|
||||
1 AS chooseStatus
|
||||
FROM tb_tower WHERE pro_id = #{id} AND tower_progress = #{type} - 1
|
||||
UNION ALL
|
||||
SELECT id,
|
||||
tower_name AS towerName,
|
||||
0 AS chooseStatus
|
||||
FROM tb_tower WHERE pro_id = #{id} AND tower_progress >= #{type}
|
||||
</select>
|
||||
<!--查询杆塔进度是否被重复更新-->
|
||||
<select id="getIsRepeatUpdate" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*)
|
||||
FROM tb_tower_progress
|
||||
WHERE progress_type = #{progressType} AND tower_id IN
|
||||
<foreach collection="towerIds" item="towerId" open="(" separator="," close=")">
|
||||
#{towerId}
|
||||
</foreach>
|
||||
</select>
|
||||
<!--查询当前工程进度-->
|
||||
<select id="getNowProProgress" resultType="java.lang.Long">
|
||||
SELECT COUNT(*)
|
||||
FROM tb_tower_progress
|
||||
WHERE pro_id = #{id}
|
||||
UNION ALL
|
||||
SELECT COUNT(*)
|
||||
FROM tb_tower
|
||||
WHERE pro_id = #{id} AND is_actvice = '1'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue