PerryHsu
2022-12-18 0d0ab69d42bcfcd3a980405a0d06bbe51a3564eb
告警派工单更新
4个文件已添加
2个文件已修改
119 ■■■■■ 已修改文件
src/main/java/com/whyc/mapper/WorksheetAlarmMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/WorksheetLinkMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/WorksheetAlarm.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/WorksheetAlarmService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/WorksheetLinkService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/WorksheetMainService.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/WorksheetAlarmMapper.java
New file
@@ -0,0 +1,12 @@
package com.whyc.mapper;
import com.whyc.pojo.WorksheetAlarm;
/**
 * @author perryhsu
 * @date 2022/12/18 15:51
 */
public interface WorksheetAlarmMapper extends CustomMapper<WorksheetAlarm> {
}
src/main/java/com/whyc/mapper/WorksheetLinkMapper.java
New file
@@ -0,0 +1,12 @@
package com.whyc.mapper;
import com.whyc.pojo.WorksheetLink;
/**
 * @author perryhsu
 * @date 2022/12/18 15:49
 */
public interface WorksheetLinkMapper extends CustomMapper<WorksheetLink> {
}
src/main/java/com/whyc/pojo/WorksheetAlarm.java
@@ -14,6 +14,7 @@
@Alias("WorksheetAlarm")
public class WorksheetAlarm {
    private Integer id;
    private Integer mainId;
    private Integer alarmNum;
    private Integer stationId;
    private Integer battGroupId;
@@ -32,6 +33,14 @@
        this.id = id;
    }
    public Integer getMainId() {
        return mainId;
    }
    public void setMainId(Integer mainId) {
        this.mainId = mainId;
    }
    public Integer getAlarmNum() {
        return alarmNum;
    }
src/main/java/com/whyc/service/WorksheetAlarmService.java
New file
@@ -0,0 +1,22 @@
package com.whyc.service;
import com.whyc.mapper.WorksheetAlarmMapper;
import com.whyc.pojo.WorksheetAlarm;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
 * @author perryhsu
 * @date 2022/12/18 15:24
 */
@Service
public class WorksheetAlarmService {
    @Resource
    private WorksheetAlarmMapper mapper;
    public void insert(WorksheetAlarm worksheetAlarm) {
        mapper.insert(worksheetAlarm);
    }
}
src/main/java/com/whyc/service/WorksheetLinkService.java
New file
@@ -0,0 +1,22 @@
package com.whyc.service;
import com.whyc.mapper.WorksheetLinkMapper;
import com.whyc.pojo.WorksheetLink;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
 * @author perryhsu
 * @date 2022/12/18 15:24
 */
@Service
public class WorksheetLinkService {
    @Resource
    private WorksheetLinkMapper mapper;
    public void add(WorksheetLink link) {
        mapper.insert(link);
    }
}
src/main/java/com/whyc/service/WorksheetMainService.java
@@ -1,12 +1,19 @@
package com.whyc.service;
import com.whyc.constant.EnumWorksheetType;
import com.whyc.dto.Response;
import com.whyc.mapper.WorksheetMainMapper;
import com.whyc.pojo.UserInf;
import com.whyc.pojo.WorksheetAlarm;
import com.whyc.pojo.WorksheetLink;
import com.whyc.pojo.WorksheetMain;
import com.whyc.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
/**
 * @author perryhsu
@@ -18,8 +25,39 @@
    @Resource
    private WorksheetMainMapper mapper;
    @Autowired
    private WorksheetLinkService linkService;
    @Autowired
    private WorksheetAlarmService alarmService;
    @Transactional
    public Response alarmFlowSubmit(WorksheetMain main, UserInf user) {
        //TODO 待处理
        return null;
        WorksheetAlarm worksheetAlarm = main.getWorksheetAlarm();
        //存入主表信息,子表信息,附表告警信息
        Date date = new Date();
        String formatDate = DateUtil.YYYY_MM_DD_HH_MM_SS_UNION.format(date);
        main.setTitle("告警派工单-"+user.getUName()+"-"+formatDate);
        main.setCreateUserId(user.getUId());
        main.setBeginTime(date);
        main.setStatus(1);
        main.setType(EnumWorksheetType.ProductBom.getType());
        mapper.insert(main);
        //子表
        Long nextUser = main.getNextUser();
        WorksheetLink link = new WorksheetLink();
        link.setMainId(main.getId());
        link.setParentId(0);
        link.setDealUserId(nextUser);
        link.setDealDesc(main.getDescription());
        link.setLinkStatus(0);
        link.setCreateTime(date);
        linkService.add(link);
        //附表告警表
        worksheetAlarm.setMainId(main.getId());
        worksheetAlarm.setCreateTime(date);
        alarmService.insert(worksheetAlarm);
        return new Response().setII(1,"提交完成");
    }
}