【需求】完成延期预警功能

pull/4/head
zengchenxi 8 months ago
parent 0330250028
commit 34999265e3

@ -28,6 +28,12 @@
<artifactId>spring-boot-starter-validation</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

@ -0,0 +1,20 @@
package com.chanko.yunxi.mes.module.heli.enums;
import lombok.Getter;
/**
*
* @author chenxi
* @date 2024-02-23 10:15
*/
@Getter
public enum WarningEnum {
PROCESS_DESIGN_DEFERRED_WARNING("工艺设计延期预警");
private String description;
WarningEnum(String description) {
this.description = description;
}
}

@ -0,0 +1,56 @@
package com.chanko.yunxi.mes.module.heli.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
*
*
* @author chenxi
* @date 2024-02-23 09:54
*/
@Data
@Accessors(chain = true)
public class WarningMessageVO {
@Schema(description = "是否包含预警信息")
private boolean hasWarning = false;
@Schema(description = "预警信息")
private List<WarningVO> warnings;
public static abstract class WarningVO {}
@Data
@Accessors(chain = true)
public static class ProcessDesignDeferredWarningVO extends WarningVO {
/**
* {@link com.chanko.yunxi.mes.module.heli.enums.WarningEnum}
*/
@Schema(description = "预警类型")
private String warningType;
/**
* {@link com.chanko.yunxi.mes.module.heli.enums.ProcessDesignTypeEnum}
*/
@Schema(description = "工艺设计类型")
private String processDesignType;
@Schema(description = "预警接收人")
private String ownerName;
@Schema(description = "项目编号")
private String projectCode;
@Schema(description = "子项目编号")
private String projectSubCode;
@Schema(description = "剩余时间")
private long remainingTime;
}
}

@ -1,5 +1,6 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.processdesign;
import com.chanko.yunxi.mes.module.heli.vo.WarningMessageVO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -102,4 +103,11 @@ public class ProcessDesignController {
return success(processDesignService.getProcessDesignProgressListByProcessDesignId(processDesignId));
}
@GetMapping("/warnings")
@Operation(summary = "获得工艺设计预警信息")
@PreAuthorize("@ss.hasPermission('heli:process-design:query')")
public CommonResult<WarningMessageVO> getWarnings() {
return success(processDesignService.getWarnings());
}
}

@ -82,4 +82,10 @@ public class ProcessDesignPageReqVO extends PageParam {
@Schema(description = "子项目id列表")
private List<Long> projectSubIdList;
@Schema(description = "责任人")
private Long owner;
@Schema(description = "未完成设计")
private Boolean uncompletedDesign;
}

@ -2,7 +2,6 @@ package com.chanko.yunxi.mes.module.heli.dal.mysql.processdesign;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.chanko.yunxi.mes.module.heli.controller.admin.processdesign.vo.ProcessDesignPageReqVO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO;
@ -61,7 +60,11 @@ public interface ProcessDesignMapper extends BaseMapperX<ProcessDesignDO> {
.eq(reqVO.getProjectId() != null, ProcessDesignDO::getProjectId, reqVO.getProjectId())
.eq(reqVO.getProjectSubId() != null, ProcessDesignDO::getProjectSubId, reqVO.getProjectSubId())
.in(reqVO.getProjectSubIdList() != null && !reqVO.getProjectSubIdList().isEmpty(), ProcessDesignDO::getProjectSubId, reqVO.getProjectSubIdList())
.lt(reqVO.getUncompletedDesign() != null && reqVO.getUncompletedDesign(), "z.progress", "100")
;
if(!StringUtils.isEmpty(reqVO.getOwner())){
query.eq("u2.id", reqVO.getOwner()).or().eq("u3.id", reqVO.getOwner()).or().eq("u4.id", reqVO.getOwner()).or().eq("u5.id", reqVO.getOwner());
}
return selectPage(reqVO, query);
}
@ -112,4 +115,5 @@ public interface ProcessDesignMapper extends BaseMapperX<ProcessDesignDO> {
;
return selectPage(reqVO, query);
}
}

@ -7,6 +7,7 @@ import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesign.ProcessDesi
import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesignprogress.ProcessDesignProgressDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.module.heli.vo.WarningMessageVO;
/**
* Service
@ -63,4 +64,9 @@ public interface ProcessDesignService {
*/
List<ProcessDesignProgressDO> getProcessDesignProgressListByProcessDesignId(Long processDesignId);
/**
*
* @return
*/
WarningMessageVO getWarnings();
}

@ -1,20 +1,33 @@
package com.chanko.yunxi.mes.module.heli.service.processdesign;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import com.chanko.yunxi.mes.framework.security.core.util.SecurityFrameworkUtils;
import com.chanko.yunxi.mes.module.heli.controller.admin.processdesign.vo.ProcessDesignPageReqVO;
import com.chanko.yunxi.mes.module.heli.controller.admin.processdesign.vo.ProcessDesignSaveReqVO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesign.ProcessDesignDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesignprogress.ProcessDesignProgressDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderSubDO;
import com.chanko.yunxi.mes.module.heli.dal.mysql.processdesign.ProcessDesignMapper;
import com.chanko.yunxi.mes.module.heli.dal.mysql.processdesign.ProcessDesignProgressMapper;
import com.chanko.yunxi.mes.module.heli.enums.ProcessDesignTypeEnum;
import com.chanko.yunxi.mes.module.heli.enums.WarningEnum;
import com.chanko.yunxi.mes.module.heli.vo.WarningMessageVO;
import com.github.yulichang.query.MPJLambdaQueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -127,6 +140,52 @@ public class ProcessDesignServiceImpl implements ProcessDesignService {
return processDesignProgressMapper.selectListByProcessDesignId(processDesignId);
}
@Override
public WarningMessageVO getWarnings() {
WarningMessageVO warningMessageVO = new WarningMessageVO();
warningMessageVO.setWarnings(new ArrayList<>(16));
Long userId = SecurityFrameworkUtils.getLoginUser().getId();
ProcessDesignPageReqVO reqVO = new ProcessDesignPageReqVO();
reqVO.setUncompletedDesign(true).setOwner(userId).setPageSize(99);
PageResult<ProcessDesignDO> result = processDesignMapper.selectPage(reqVO);
if(result.getTotal() > 0){
LocalDateTime now = LocalDateTime.now();
result.getList().forEach(processDesign -> {
WarningMessageVO.ProcessDesignDeferredWarningVO warningVO = new WarningMessageVO.ProcessDesignDeferredWarningVO();
warningVO.setWarningType(WarningEnum.PROCESS_DESIGN_DEFERRED_WARNING.name())
.setProcessDesignType(processDesign.getProcessDesignType())
.setProjectCode(processDesign.getProjectCode())
.setProjectSubCode(processDesign.getProjectSubCode());
long betweenMills = 0;
String ownerName = "";
if(ProcessDesignTypeEnum.BLUEPRINT_WORKBLANK.name().equals(processDesign.getProcessDesignType())){
betweenMills = Duration.between(now, processDesign.getBlankDate()).toMillis();
ownerName = processDesign.getBlankOwnerName();
}else if(ProcessDesignTypeEnum.BLUEPRINT_3D.name().equals(processDesign.getProcessDesignType())){
betweenMills = Duration.between(now, processDesign.getThreeDimDate()).toMillis();
ownerName = processDesign.getThreeDimOwnerName();
}else if(ProcessDesignTypeEnum.BLUEPRINT_2D.name().equals(processDesign.getProcessDesignType())){
betweenMills = Duration.between(now, processDesign.getTwoDimDate()).toMillis();
ownerName = processDesign.getTwoDimOwnerName();
}else if (ProcessDesignTypeEnum.BLUEPRINT_FOUNDRY_TECHNOLOGY.name().equals(processDesign.getProcessDesignType())){
betweenMills = Duration.between(now, processDesign.getCraftEndDate()).toMillis();
ownerName = processDesign.getCraftOwnerName();
}
// 时差判断 48小时
if(betweenMills <= 172800000){
warningVO.setRemainingTime(betweenMills).setOwnerName(ownerName);
warningMessageVO.getWarnings().add(warningVO);
}
});
}
warningMessageVO.setHasWarning(!warningMessageVO.getWarnings().isEmpty());
return warningMessageVO;
}
private void createProcessDesignProgressList(Long processDesignId, List<ProcessDesignProgressDO> list) {
list.forEach(o -> o.setProcessDesignId(processDesignId));
// 按创建时间排序

@ -47,3 +47,8 @@ export const exportProcessDesign = async (params) => {
export const getProcessDesignProgressListByProcessDesignId = async (processDesignId) => {
return await request.get({ url: `/heli/process-design/process-design-progress/list-by-process-design-id?processDesignId=` + processDesignId })
}
// 查询工艺设计延期预警信息
export const getProcessDesignDeferredWarning = async () => {
return await request.get({ url: `/heli/process-design/warnings`})
}

@ -15,11 +15,15 @@
<!-- 折叠 -->
<div class="warncenter">
<div class="warntext" v-for="item in 5" :key="item">
<div class="warntext" v-for="item in warnings" :key="item">
<span style="margin-top:5px"><img :src="warnimg" alt="" /></span>
<div class="warnnr">
<span>铸造工艺设计负责人: <span class="warnname">{{`薛小宝`}}</span> 请注意!</span>
<span class="warnbh">项目编号{{ item}}的图纸设计即将超时请及时完成</span>
<div class="warnnr" v-if="item.processDesignType != 'BLUEPRINT_FOUNDRY_TECHNOLOGY'">
<span>{{processDesignTypeDict[item.processDesignType]}}设计负责人: <span class="warnname">{{item.ownerName}}</span> 请注意!</span>
<span class="warnbh">项目编号{{ item.projectCode}}, 子项目编号{{ item.projectSubCode }}的图纸设计{{item.remainingTime < 0 ? '已超时' : '即将超时'}}请及时完成</span>
</div>
<div class="warnnr" v-else>
<span>{{processDesignTypeDict[item.processDesignType]}}设计负责人: <span class="warnname">{{item.ownerName}}</span> 请注意!</span>
<span class="warnbh">项目编号{{ item.projectCode}}的图纸设计{{item.remainingTime < 0 ? '已超时' : '即将超时'}}请及时完成</span>
</div>
</div>
</div>
@ -38,9 +42,17 @@
import { useCommonStore } from '@/store/modules/common'
import { CloseBold, Expand, WarningFilled } from '@element-plus/icons-vue'
import warnimg from '/src/assets/imgs/warnicon.png'
import {getProcessDesignDeferredWarning} from "@/api/heli/processdesign";
const commonStore = useCommonStore()
const showWarning = computed(() => commonStore.showWarning)
const showFilled = ref(false)
const warnings = ref([])
const processDesignTypeDict = {
"BLUEPRINT_FOUNDRY_TECHNOLOGY": "铸造工艺",
"BLUEPRINT_3D": "3D",
"BLUEPRINT_2D": "2D",
"BLUEPRINT_WORKBLANK": "毛坯"
}
const FoldWran = () => {
showFilled.value = false
@ -83,8 +95,19 @@ const onMouseMove = (event: MouseEvent) => {
// const onDragEnd = () => {
// //
// };
onMounted(() => {
const queryData = async () => {
const data = await getProcessDesignDeferredWarning();
if (data.hasWarning){
warnings.value = data.warnings;
commonStore.setStore('showWarning', true)
}else{
commonStore.setStore('showWarning', false)
}
}
onMounted(() => {
queryData();
})
</script>
<style scoped lang="scss">

Loading…
Cancel
Save