Lius
2024-12-02 2dcd7f3634f2e636e10ea758441ded77e1d2c845
update
已添加1个文件
已修改19个文件
417 ■■■■ 文件已修改
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcPlanCloseController.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcPlanClose.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunMonitoringSpeedJob.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentShiftStatisticalProcessJob.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentStatisticalProcessJob.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentTraceProcessJob.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningEquipmentStatusJob.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningMonitoringSpeedJob.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningOverallEquipmentEfficiencyJob.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningOvertimeDurationJob.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningProcessCountJob.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/TransferTableDataJob.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcPlanCloseMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcPlanCloseMapper.xml 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcPlanCloseService.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPlanCloseServiceImpl.java 182 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcPlanCloseVo.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcPlanCloseController.java
@@ -5,18 +5,21 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.aspect.annotation.AutoLog;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.mdc.entity.MdcPlanClose;
import org.jeecg.modules.mdc.service.IMdcPlanCloseService;
import org.jeecg.modules.mdc.vo.MdcPlanCloseVo;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@@ -24,13 +27,13 @@
import io.swagger.annotations.ApiOperation;
/**
 * @Description: mdc计划停机维护表
 * @Description: mdc(计划/非计划)停机维护表
 * @Author: Lius
 * @Date: 2023-07-13
 * @Version: V1.0
 */
@Slf4j
@Api(tags = "mdc计划停机维护表")
@Api(tags = "mdc(计划/非计划)停机维护表")
@RestController
@RequestMapping("/mdc/mdcPlanClose")
public class MdcPlanCloseController extends JeecgController<MdcPlanClose, IMdcPlanCloseService> {
@@ -47,16 +50,17 @@
     * @param req
     * @return
     */
    @AutoLog(value = "mdc计划停机维护表-分页列表查询")
    @ApiOperation(value = "mdc计划停机维护表-分页列表查询", notes = "mdc计划停机维护表-分页列表查询")
    @AutoLog(value = "mdc(计划/非计划)停机维护表-分页列表查询")
    @ApiOperation(value = "mdc(计划/非计划)停机维护表-分页列表查询", notes = "mdc(计划/非计划)停机维护表-分页列表查询")
    @GetMapping(value = "/list")
    public Result<?> queryPageList(MdcPlanClose mdcPlanClose,
    public Result<?> queryPageList(MdcPlanCloseVo mdcPlanClose,
                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                   HttpServletRequest req) {
        QueryWrapper<MdcPlanClose> queryWrapper = QueryGenerator.initQueryWrapper(mdcPlanClose, req.getParameterMap());
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        Page<MdcPlanClose> page = new Page<MdcPlanClose>(pageNo, pageSize);
        IPage<MdcPlanClose> pageList = mdcPlanCloseService.page(page, queryWrapper);
        IPage<MdcPlanClose> pageList = mdcPlanCloseService.pageList(userId, page, mdcPlanClose, req);
        return Result.OK(pageList);
    }
@@ -66,11 +70,17 @@
     * @param mdcPlanClose
     * @return
     */
    @AutoLog(value = "mdc计划停机维护表-添加")
    @ApiOperation(value = "mdc计划停机维护表-添加", notes = "mdc计划停机维护表-添加")
    @AutoLog(value = "mdc(计划/非计划)停机维护表-添加")
    @ApiOperation(value = "mdc(计划/非计划)停机维护表-添加", notes = "mdc(计划/非计划)停机维护表-添加")
    @PostMapping(value = "/add")
    public Result<?> add(@RequestBody MdcPlanClose mdcPlanClose) {
        mdcPlanCloseService.save(mdcPlanClose);
    public Result<?> add(@RequestBody MdcPlanCloseVo mdcPlanClose) {
        if (StringUtils.isBlank(mdcPlanClose.getEquipmentIds())) {
            return Result.error("未选择设备,请排查!");
        }
        boolean result = mdcPlanCloseService.addPlanClose(mdcPlanClose);
        if (!result) {
            return Result.error("添加失败!");
        }
        return Result.OK("添加成功!");
    }
@@ -80,8 +90,8 @@
     * @param mdcPlanClose
     * @return
     */
    @AutoLog(value = "mdc计划停机维护表-编辑")
    @ApiOperation(value = "mdc计划停机维护表-编辑", notes = "mdc计划停机维护表-编辑")
    @AutoLog(value = "mdc(计划/非计划)停机维护表-编辑")
    @ApiOperation(value = "mdc(计划/非计划)停机维护表-编辑", notes = "mdc(计划/非计划)停机维护表-编辑")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<?> edit(@RequestBody MdcPlanClose mdcPlanClose) {
        mdcPlanCloseService.updateById(mdcPlanClose);
@@ -94,8 +104,8 @@
     * @param id
     * @return
     */
    @AutoLog(value = "mdc计划停机维护表-通过id删除")
    @ApiOperation(value = "mdc计划停机维护表-通过id删除", notes = "mdc计划停机维护表-通过id删除")
    @AutoLog(value = "mdc(计划/非计划)停机维护表-通过id删除")
    @ApiOperation(value = "mdc(计划/非计划)停机维护表-通过id删除", notes = "mdc(计划/非计划)停机维护表-通过id删除")
    @DeleteMapping(value = "/delete")
    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
        mdcPlanCloseService.removeById(id);
@@ -108,8 +118,8 @@
     * @param ids
     * @return
     */
    @AutoLog(value = "mdc计划停机维护表-批量删除")
    @ApiOperation(value = "mdc计划停机维护表-批量删除", notes = "mdc计划停机维护表-批量删除")
    @AutoLog(value = "mdc(计划/非计划)停机维护表-批量删除")
    @ApiOperation(value = "mdc(计划/非计划)停机维护表-批量删除", notes = "mdc(计划/非计划)停机维护表-批量删除")
    @DeleteMapping(value = "/deleteBatch")
    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
        this.mdcPlanCloseService.removeByIds(Arrays.asList(ids.split(",")));
@@ -122,8 +132,8 @@
     * @param id
     * @return
     */
    @AutoLog(value = "mdc计划停机维护表-通过id查询")
    @ApiOperation(value = "mdc计划停机维护表-通过id查询", notes = "mdc计划停机维护表-通过id查询")
    @AutoLog(value = "mdc(计划/非计划)停机维护表-通过id查询")
    @ApiOperation(value = "mdc(计划/非计划)停机维护表-通过id查询", notes = "mdc(计划/非计划)停机维护表-通过id查询")
    @GetMapping(value = "/queryById")
    public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
        MdcPlanClose mdcPlanClose = mdcPlanCloseService.getById(id);
@@ -134,11 +144,17 @@
     * å¯¼å‡ºexcel
     *
     * @param request
     * @param mdcPlanClose
     * @param mdcPlanCloseVo
     */
    @RequestMapping(value = "/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, MdcPlanClose mdcPlanClose) {
        return super.exportXls(request, mdcPlanClose, MdcPlanClose.class, "mdc计划停机维护表");
    public ModelAndView exportXls(HttpServletRequest request, MdcPlanCloseVo mdcPlanCloseVo) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        String title = "mdc非计划停机";
        if (mdcPlanCloseVo.getCloseType().equals(CommonConstant.STATUS_1)) {
            title = "mdc计划停机";
        }
        return mdcPlanCloseService.exportXls(userId, mdcPlanCloseVo, title);
    }
    /**
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcPlanClose.java
@@ -7,7 +7,6 @@
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.system.base.entity.JeecgEntity;
import org.jeecgframework.poi.excel.annotation.Excel;
@@ -28,25 +27,35 @@
    private static final long serialVersionUID = 3761395731884048515L;
    /**
     * æ—¥æœŸ
     */
    @Excel(name = "日期", width = 15)
    @ApiModelProperty(value = "日期")
    private String theDate;
    /**
     * è®¾å¤‡ç¼–号
     */
    @Excel(name = "设备编号", width = 15)
    @ApiModelProperty(value = "设备编号")
    private String equipmentId;
    /**
     * è®¡åˆ’停机类型
     */
    @Excel(name = "计划停机类型", width = 15)
    @ApiModelProperty(value = "计划停机类型")
    private String planCloseType;
    /**
     * è®¡åˆ’停机时间类型
     */
    @Excel(name = "计划停机时间类型", width = 15)
    @ApiModelProperty(value = "计划停机时间类型")
    @Dict(dicCode = "mdc_plan_type")
    private String planCloseTimeType;
    /**
     * æ—¶é•¿ï¼ˆåˆ†é’Ÿï¼‰
     */
    @Excel(name = "时长(分钟)", width = 15)
    @ApiModelProperty(value = "时长(分钟)")
    private Integer planCloseTimeLong;
    /**
     * åœæœºç±»åž‹(1:计划,2:非计划)
     */
    @ApiModelProperty(value = "停机类型(1:计划,2:非计划)")
    private String closeType;
    /**
     * å¤‡æ³¨
     */
    @Excel(name = "备注", width = 15)
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunMonitoringSpeedJob.java
@@ -20,8 +20,6 @@
 * @Description: ç›‘控设备运行参数任务
 * @date 2024/1/16 17:36
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class RunMonitoringSpeedJob implements Job {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentShiftStatisticalProcessJob.java
@@ -20,8 +20,6 @@
 * @author: LiuS
 * @create: 2023-07-24 10:26
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class RunningAllEquipmentShiftStatisticalProcessJob implements Job {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentStatisticalProcessJob.java
@@ -20,8 +20,6 @@
 * @author: LiuS
 * @create: 2023-04-14 13:53
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class RunningAllEquipmentStatisticalProcessJob implements Job {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentTraceProcessJob.java
@@ -20,8 +20,6 @@
 * @author: LiuS
 * @create: 2023-04-12 10:39
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class RunningAllEquipmentTraceProcessJob implements Job {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningEquipmentStatusJob.java
@@ -39,8 +39,6 @@
 * @Description: åˆ©ç”¨çŽ‡æ­£å¸¸å€¼ï¼Œè®¾å¤‡çŠ¶æ€é•¿æœŸæ— å˜åŒ–æŠ¥è­¦
 * @date 2024/1/17 14:10
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class RunningEquipmentStatusJob implements Job {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningMonitoringSpeedJob.java
@@ -33,8 +33,6 @@
 * @Description: ç›‘控设备运行转速与NC程序设定转速对比
 * @date 2024/3/4 16:14
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class RunningMonitoringSpeedJob implements Job {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningOverallEquipmentEfficiencyJob.java
@@ -20,8 +20,6 @@
 * @author: LiuS
 * @create: 2023-07-24 10:26
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class RunningOverallEquipmentEfficiencyJob implements Job {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningOvertimeDurationJob.java
@@ -30,8 +30,6 @@
 * @Description: è®¾å¤‡åŠ ç­æ—¶é•¿ç®—æ³•ç»Ÿè®¡
 * @date 2024/1/24 17:12
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class RunningOvertimeDurationJob implements Job {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningProcessCountJob.java
@@ -19,8 +19,6 @@
 * @author Lius
 * @date 2023/11/22 10:17
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class RunningProcessCountJob implements Job {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/TransferTableDataJob.java
@@ -24,8 +24,6 @@
 * @author Lius
 * @date 2024/4/3 10:39
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class TransferTableDataJob implements Job {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentMapper.java
@@ -16,7 +16,7 @@
public interface EquipmentMapper extends BaseMapper<Equipment> {
    @Select(" SELECT name FROM SysObjects Where XType='U' AND name = '${saveTableName}' ")
    @Select(" SELECT name FROM SysObjects WHERE name = '${saveTableName}' ")
    String checkTableExists(@Param("saveTableName") String saveTableName);
    @Select(" SELECT COUNT(CollectTime) num FROM ${saveTableName} WHERE CollectTime < '${day}' ")
@@ -28,6 +28,6 @@
    @Delete(" delete from ${tableName} where CollectTime < '${day}' ")
    void deleteTableData(@Param("tableName") String saveTableName, @Param("day") String day);
    @Insert(" SELECT * INTO ${tableName} FROM ${lastTableName} WHERE CollectTime < '${date}' ")
    @Insert(" CREATE TABLE ${tableName} AS SELECT * FROM ${lastTableName} WHERE CollectTime < '${date}' ")
    void insertNoTableData(@Param("tableName") String tableName, @Param("lastTableName") String lastTableName, @Param("date") String date);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcPlanCloseMapper.java
@@ -2,7 +2,11 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.mdc.entity.MdcPlanClose;
import org.jeecg.modules.mdc.vo.MdcPlanCloseVo;
/**
 * @Description: mdc计划停机维护表
@@ -12,4 +16,12 @@
 */
public interface MdcPlanCloseMapper extends BaseMapper<MdcPlanClose> {
    /**
     * åˆ†é¡µæŸ¥è¯¢
     *
     * @param page
     * @param mdcPlanClose
     * @return
     */
    IPage<MdcPlanClose> pageList(Page<MdcPlanClose> page, @Param("mdcPlanClose") MdcPlanCloseVo mdcPlanClose);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml
@@ -3,26 +3,26 @@
<mapper namespace="org.jeecg.modules.mdc.mapper.EquipmentWorklineMapper">
    <select id="getMacingDataList" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto">
        select top 1 [${tableName}].* from [${tableName}] order by CollectTime  desc
        select top 1 ${tableName}.* from ${tableName} order by CollectTime  desc
    </select>
    <select id="findRunningData" resultType="java.lang.String">
        SELECT ProductCount FROM [${tableName}] WHERE ProductCount &lt;&gt; '' AND CollectTime BETWEEN #{ startTime } AND #{ endTime } GROUP BY ProductCount ORDER BY ProductCount
        SELECT ProductCount FROM ${tableName} WHERE ProductCount &lt;&gt; '' AND CollectTime BETWEEN #{ startTime } AND #{ endTime } GROUP BY ProductCount ORDER BY ProductCount
    </select>
    <select id="getEquipProgramNum" resultType="org.jeecg.modules.mdc.dto.EquipmentMachingDto">
        select Programnumber,CollectTime from [${tableName}] where CollectTime &gt; #{startTime} and CollectTime &lt;= #{endTime} and Programnumber is not null
        select Programnumber,CollectTime from ${tableName} where CollectTime &gt; #{startTime} and CollectTime &lt;= #{endTime} and Programnumber is not null
    </select>
    <select id="findProductCountStartTime" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto">
        SELECT TOP 1 [${tableName}].* FROM [${tableName}] WHERE ProductCount = #{ productCount } AND CollectTime BETWEEN #{ startTime } AND #{ endTime } ORDER BY CollectTime ASC
        SELECT TOP 1 ${tableName}.* FROM [${tableName}] WHERE ProductCount = #{ productCount } AND CollectTime BETWEEN #{ startTime } AND #{ endTime } ORDER BY CollectTime ASC
    </select>
    <select id="findProductCountEndTime" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto">
        SELECT TOP 1 [${tableName}].* FROM [${tableName}] WHERE ProductCount = #{ productCount } AND CollectTime BETWEEN #{ startTime } AND #{ endTime } ORDER BY CollectTime DESC
        SELECT TOP 1 ${tableName}.* FROM ${tableName} WHERE ProductCount = #{ productCount } AND CollectTime BETWEEN #{ startTime } AND #{ endTime } ORDER BY CollectTime DESC
    </select>
    <select id="getDataList" resultType="java.util.Map">
        select top 1 [${tableName}].* from [${tableName}] order by CollectTime  desc
        select top 1 ${tableName}.* from ${tableName} order by CollectTime  desc
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcPlanCloseMapper.xml
@@ -2,4 +2,35 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mdc.mapper.MdcPlanCloseMapper">
    <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcPlanClose">
        SELECT
            *
        FROM
            mdc_plan_close
        <where>
            <if test="mdcPlanClose.equipmentId != null and mdcPlanClose.equipmentId != ''">
                AND equipment_id = #{ mdcPlanClose.equipmentId }
            </if>
            <if test="mdcPlanClose.planCloseType != null and mdcPlanClose.planCloseType != ''">
                AND plan_close_type = #{ mdcPlanClose.planCloseType }
            </if>
            <if test="mdcPlanClose.theDate != null and mdcPlanClose.theDate != ''">
                AND the_date LIKE CONCAT('%',#{ mdcPlanClose.theDate },'%')
            </if>
            <if test="mdcPlanClose.startTime != null and mdcPlanClose.startTime != ''">
                AND the_date &gt;= #{ mdcPlanClose.startTime }
            </if>
            <if test="mdcPlanClose.endTime != null and mdcPlanClose.endTime != ''">
                AND the_date &lt;= #{mdcPlanClose.endTime }
            </if>
            <if test="mdcPlanClose.equipmentIdList != null and mdcPlanClose.equipmentIdList.size() > 0 ">
                AND equipment_id IN
                <foreach collection="mdcPlanClose.equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
            AND close_type = #{ mdcPlanClose.closeType }
        </where>
        ORDER BY the_date DESC, equipment_id ASC
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcPlanCloseService.java
@@ -1,8 +1,13 @@
package org.jeecg.modules.mdc.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.mdc.entity.MdcPlanClose;
import org.jeecg.modules.mdc.vo.MdcPlanCloseVo;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
/**
@@ -14,4 +19,33 @@
public interface IMdcPlanCloseService extends IService<MdcPlanClose> {
    BigDecimal findPlanTimeDuration(BigDecimal actualWorkDayCount, String planCloseType);
    /**
     * åˆ†é¡µæŸ¥è¯¢
     *
     * @param userId
     * @param page
     * @param mdcPlanClose
     * @param req
     * @return
     */
    IPage<MdcPlanClose> pageList(String userId, Page<MdcPlanClose> page, MdcPlanCloseVo mdcPlanClose, HttpServletRequest req);
    /**
     * æ·»åŠ 
     *
     * @param mdcPlanClose
     * @return
     */
    boolean addPlanClose(MdcPlanCloseVo mdcPlanClose);
    /**
     * å¯¼å‡º
     *
     * @param userId
     * @param mdcPlanCloseVo
     * @param title
     * @return
     */
    ModelAndView exportXls(String userId, MdcPlanCloseVo mdcPlanCloseVo, String title);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPlanCloseServiceImpl.java
@@ -2,15 +2,29 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.mdc.constant.MdcConstant;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.mdc.entity.MdcPassRate;
import org.jeecg.modules.mdc.entity.MdcPlanClose;
import org.jeecg.modules.mdc.mapper.MdcPlanCloseMapper;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.service.IMdcPlanCloseService;
import org.jeecg.modules.mdc.vo.MdcPlanCloseVo;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -23,27 +37,155 @@
@Service
public class MdcPlanCloseServiceImpl extends ServiceImpl<MdcPlanCloseMapper, MdcPlanClose> implements IMdcPlanCloseService {
    @Resource
    private IMdcEquipmentService mdcEquipmentService;
    /**
     * åˆ†é¡µæŸ¥è¯¢
     *
     * @param userId
     * @param page
     * @param mdcPlanClose
     * @param req
     * @return
     */
    @Override
    public IPage<MdcPlanClose> pageList(String userId, Page<MdcPlanClose> page, MdcPlanCloseVo mdcPlanClose, HttpServletRequest req) {
        List<String> equipmentIds = new ArrayList<>();
        if (StringUtils.isNotEmpty(mdcPlanClose.getParentId()) && StringUtils.isEmpty(mdcPlanClose.getEquipmentId())) {
            if ("2".equals(mdcPlanClose.getTypeTree())) {
                //部门层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcPlanClose.getParentId());
            } else {
                //产线层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcPlanClose.getParentId());
            }
        } else if (StringUtils.isNotEmpty(mdcPlanClose.getEquipmentId())) {
            //单台设备信息
            mdcPlanClose.setEquipmentIdList(Collections.singletonList(mdcPlanClose.getEquipmentId()));
        } else {
            //查询用户拥有的所有设备信息
            if ("2".equals(mdcPlanClose.getTypeTree())) {
                //部门层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null);
            } else {
                //产线层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null);
            }
        }
        if (mdcPlanClose.getEquipmentIdList() == null || mdcPlanClose.getEquipmentIdList().isEmpty()) {
            mdcPlanClose.setEquipmentIdList(equipmentIds);
        }
        if (mdcPlanClose.getEquipmentIdList() == null || mdcPlanClose.getEquipmentIdList().isEmpty()) {
            return null;
        }
        return this.baseMapper.pageList(page, mdcPlanClose);
    }
    /**
     * æ·»åŠ 
     *
     * @param mdcPlanCloseVo
     * @return
     */
    @Override
    public boolean addPlanClose(MdcPlanCloseVo mdcPlanCloseVo) {
        String[] equipmentIdList = mdcPlanCloseVo.getEquipmentIds().split(",");
        List<MdcPlanClose> planCloseList = new ArrayList<>();
        for (String equipmentId : equipmentIdList) {
            MdcPlanClose mdcPlanClose = new MdcPlanClose();
            mdcPlanClose.setEquipmentId(equipmentId);
            mdcPlanClose.setPlanCloseType(mdcPlanCloseVo.getPlanCloseType());
            mdcPlanClose.setPlanCloseTimeLong(mdcPlanCloseVo.getPlanCloseTimeLong());
            mdcPlanClose.setTheDate(mdcPlanCloseVo.getTheDate());
            mdcPlanClose.setCloseType(mdcPlanCloseVo.getCloseType());
            mdcPlanClose.setRemark(mdcPlanClose.getRemark());
            planCloseList.add(mdcPlanClose);
        }
        this.saveBatch(planCloseList);
        return true;
    }
    @Override
    public ModelAndView exportXls(String userId, MdcPlanCloseVo mdcPlanClose, String title) {
        LambdaQueryWrapper<MdcPlanClose> queryWrapper = new LambdaQueryWrapper<>();
        List<String> equipmentIds = new ArrayList<>();
        if (StringUtils.isNotEmpty(mdcPlanClose.getParentId()) && StringUtils.isEmpty(mdcPlanClose.getEquipmentId())) {
            if ("2".equals(mdcPlanClose.getTypeTree())) {
                //部门层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcPlanClose.getParentId());
            } else {
                //产线层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcPlanClose.getParentId());
            }
        } else if (StringUtils.isNotEmpty(mdcPlanClose.getEquipmentId())) {
            //单台设备信息
            mdcPlanClose.setEquipmentIdList(Collections.singletonList(mdcPlanClose.getEquipmentId()));
        } else {
            //查询用户拥有的所有设备信息
            if ("2".equals(mdcPlanClose.getTypeTree())) {
                //部门层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null);
            } else {
                //产线层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null);
            }
        }
        if (mdcPlanClose.getEquipmentIdList() == null || mdcPlanClose.getEquipmentIdList().isEmpty()) {
            mdcPlanClose.setEquipmentIdList(equipmentIds);
        }
        if (mdcPlanClose.getEquipmentIdList() == null || mdcPlanClose.getEquipmentIdList().isEmpty()) {
            return null;
        } else {
            queryWrapper.in(MdcPlanClose::getEquipmentId, mdcPlanClose.getEquipmentIdList());
        }
        if (StringUtils.isNotEmpty(mdcPlanClose.getEquipmentId())) {
            queryWrapper.eq(MdcPlanClose::getEquipmentId, mdcPlanClose.getEquipmentId());
        }
        if (StringUtils.isNotEmpty(mdcPlanClose.getPlanCloseType())) {
            queryWrapper.eq(MdcPlanClose::getPlanCloseType, mdcPlanClose.getPlanCloseType());
        }
        if (StringUtils.isNotEmpty(mdcPlanClose.getStartTime()) && StringUtils.isNotEmpty(mdcPlanClose.getEndTime())) {
            queryWrapper.between(MdcPlanClose::getTheDate, mdcPlanClose.getStartTime(), mdcPlanClose.getEndTime());
        }
        queryWrapper.orderByDesc(MdcPlanClose::getTheDate).orderByDesc(MdcPlanClose::getEquipmentId);
        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
        List<MdcPlanClose> mdcPlanCloses = this.baseMapper.selectList(queryWrapper);
        // å¯¼å‡ºæ–‡ä»¶åç§°
        mv.addObject(NormalExcelConstants.FILE_NAME, title + "列表");
        mv.addObject(NormalExcelConstants.CLASS, MdcPlanClose.class);
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams(title + "列表数据", "导出人:" + user.getRealname(), title));
        //update-end---author:wangshuai ---date:20211227  for:[JTC-116]导出人写死了------------
        mv.addObject(NormalExcelConstants.DATA_LIST, mdcPlanCloses);
        return mv;
    }
    @Override
    public BigDecimal findPlanTimeDuration(BigDecimal actualWorkDayCount, String planCloseType) {
        BigDecimal result = new BigDecimal("0");
        List<MdcPlanClose> mdcPlanCloses = this.baseMapper.selectList(new LambdaQueryWrapper<MdcPlanClose>().in(MdcPlanClose::getPlanCloseType, Arrays.asList(planCloseType.split(","))));
        if (mdcPlanCloses != null && !mdcPlanCloses.isEmpty()) {
            for (MdcPlanClose mdcPlanClose : mdcPlanCloses) {
                switch (mdcPlanClose.getPlanCloseTimeType()) {
                    case MdcConstant.DAY:
                        result = result.add(actualWorkDayCount.multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong())));
                        break;
                    case MdcConstant.WEEK:
                        result = result.add(new BigDecimal("4").multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong())));
                        break;
                    case MdcConstant.MONTH:
                        result = result.add(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong()));
                        break;
                    default:
                        break;
                }
            }
        }
//        List<MdcPlanClose> mdcPlanCloses = this.baseMapper.selectList(new LambdaQueryWrapper<MdcPlanClose>().in(MdcPlanClose::getPlanCloseType, Arrays.asList(planCloseType.split(","))));
//        if (mdcPlanCloses != null && !mdcPlanCloses.isEmpty()) {
//            for (MdcPlanClose mdcPlanClose : mdcPlanCloses) {
//                switch (mdcPlanClose.getPlanCloseTimeType()) {
//                    case MdcConstant.DAY:
//                        result = result.add(actualWorkDayCount.multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong())));
//                        break;
//                    case MdcConstant.WEEK:
//                        result = result.add(new BigDecimal("4").multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong())));
//                        break;
//                    case MdcConstant.MONTH:
//                        result = result.add(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong()));
//                        break;
//                    default:
//                        break;
//                }
//            }
//        }
        return result;
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftServiceImpl.java
@@ -5,19 +5,16 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sun.xml.bind.v2.TODO;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.mdc.entity.MdcShift;
import org.jeecg.modules.mdc.mapper.MdcShiftMapper;
import org.jeecg.modules.mdc.service.IMdcShiftService;
import org.jeecg.modules.mdc.service.IMdcShiftSubService;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -114,8 +111,10 @@
    @Transactional(rollbackFor = Exception.class)
    public boolean changeDefaultShift(String id) {
        MdcShift mdcShift = this.baseMapper.selectOne(new LambdaQueryWrapper<MdcShift>().eq(MdcShift::getDefaultShift, "true"));
        mdcShift.setDefaultShift("false");
        this.baseMapper.updateById(mdcShift);
        if (mdcShift != null) {
            mdcShift.setDefaultShift("false");
            this.baseMapper.updateById(mdcShift);
        }
        MdcShift defaultShift = this.baseMapper.selectById(id);
        defaultShift.setDefaultShift("true");
        this.baseMapper.updateById(defaultShift);
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcPlanCloseVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
package org.jeecg.modules.mdc.vo;
import lombok.Data;
import java.util.List;
/**
 * @author Lius
 * @date 2024/12/2 15:25
 */
@Data
public class MdcPlanCloseVo {
    private String equipmentId;
    private String planCloseType;
    private Integer planCloseTimeLong;
    private String startTime;
    private String endTime;
    private String theDate;
    private String parentId;
    private String typeTree;
    private List<String> equipmentIdList;
    private String equipmentIds;
    private String closeType;
}