新火炬后端单体项目初始化代码
安灯处理 ,安灯已处理列表,安灯数据模型 增加字段,安灯发起:新增发起人
已修改11个文件
240 ■■■■ 文件已修改
src/main/java/org/jeecg/modules/andon/controller/AndonButtonConfigController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/andon/controller/AndonOrderController.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/andon/dto/AndonButtonDTO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/andon/entity/AndonOrder.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/andon/mapper/AndonButtonConfigMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/andon/mapper/xml/AndonButtonConfigMapper.xml 125 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/andon/service/IAndonButtonConfigService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/andon/service/IAndonOrderService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/andon/service/impl/AndonButtonConfigServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/andon/service/impl/AndonOrderServiceImpl.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/andon/service/impl/AndonResponseConfigServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/andon/controller/AndonButtonConfigController.java
@@ -102,7 +102,18 @@
        return Result.OK(list);
    }
    /**
     * APP安灯已处理列表查询
     *
     * @param factoryId
     * @return
     */
    @ApiOperation(value = "安灯响应-分页列表查询", notes = "安灯响应-分页列表查询")
    @GetMapping(value = "/queryUserAndonHandelList")
    public Result<List<AndonButtonDTO>> queryUserAndonHandelList(@RequestParam("factoryId") String factoryId) {
        List<AndonButtonDTO> list = andonButtonConfigService.queryUserAndonHandelList(factoryId);
        return Result.OK(list);
    }
    /**
     * 添加
     *
src/main/java/org/jeecg/modules/andon/controller/AndonOrderController.java
@@ -12,6 +12,8 @@
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.andon.entity.AndonOrder;
import org.jeecg.modules.andon.service.IAndonOrderService;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@@ -33,6 +35,8 @@
public class AndonOrderController extends JeecgController<AndonOrder, IAndonOrderService> {
    @Autowired
    private IAndonOrderService andonOrderService;
    /**
     * 分页列表查询
@@ -87,6 +91,20 @@
        return Result.OK("响应成功!");
    }
    /**
     * APP安灯处理操作
     *
     *
     * @return
     */
    @ApiOperation(value = "APP安灯处理操作", notes = "APP安灯处理操作")
    @PostMapping(value = "/AndonHandel")
    public Result<String> AndonHandel(@RequestBody AndonOrder andonOrder) {
        return andonOrderService.handleAndonOrder(andonOrder);
    }
    /**
     * 编辑
     *
src/main/java/org/jeecg/modules/andon/dto/AndonButtonDTO.java
@@ -77,4 +77,7 @@
    @ApiModelProperty(value = "工单状态")
    private String orderStatus;
    @ApiModelProperty(value = "安灯发起人")
    private String operator;
}
src/main/java/org/jeecg/modules/andon/entity/AndonOrder.java
@@ -68,6 +68,7 @@
    private String buttonId;
    /**安灯人*/
    @Excel(name = "安灯人", width = 15)
    @Dict(dictTable = "sys_user", dicCode = "id", dicText = "username")
    @ApiModelProperty(value = "安灯人")
    private String operator;
    /**安灯时间*/
@@ -82,6 +83,7 @@
    @ApiModelProperty(value = "安灯等级")
    private String andonLevel;
    /**响应人*/
    @Dict(dictTable = "sys_user", dicCode = "id", dicText = "username")
    @Excel(name = "响应人", width = 15)
    @ApiModelProperty(value = "响应人")
    private String responder;
@@ -92,6 +94,7 @@
    @ApiModelProperty(value = "响应时间")
    private Date responseTime;
    /**处理人*/
    @Dict(dictTable = "sys_user", dicCode = "id", dicText = "username")
    @Excel(name = "处理人", width = 15)
    @ApiModelProperty(value = "处理人")
    private String processor;
src/main/java/org/jeecg/modules/andon/mapper/AndonButtonConfigMapper.java
@@ -36,6 +36,14 @@
     */
    List<AndonButtonDTO> queryUserAndonRespondList(String factoryId);
    /**
     * 处理安灯列表
     * @param factoryId
     * @return
     */
    List<AndonButtonDTO> queryUserAndonHandelList(String factoryId);
}
src/main/java/org/jeecg/modules/andon/mapper/xml/AndonButtonConfigMapper.xml
@@ -27,6 +27,7 @@
        on arc.button_id = abc.id
        where arc.factory_id=#{factoryId};
    </select>
    <select id="queryUserAndonCallList" resultType="org.jeecg.modules.andon.dto.AndonButtonDTO">
        select arc.id,
               abc.id          as buttonId,
@@ -68,37 +69,6 @@
                 and ao.factory_id = arc.factory_id
                 and ao.order_status = '1') = 1
    </select>
<!--    <select id="queryUserAndonCallList" resultType="org.jeecg.modules.andon.dto.AndonButtonDTO">-->
<!--        select arc.id,-->
<!--               abc.id          as buttonId,-->
<!--               abc.button_name as buttonName,-->
<!--               abc.button_code as buttonCode,-->
<!--               (select count(1)-->
<!--                from andon_order ao-->
<!--                where ao.button_id = arc.button_id-->
<!--                  and ao.factory_id = arc.factory_id-->
<!--                  and ao.order_status != '3') as blinkingFlag, STUFF((SELECT ',' + CAST (ao.id AS VARCHAR)-->
<!--            FROM andon_order ao-->
<!--            WHERE ao.button_id = arc.button_id-->
<!--            and ao.factory_id = arc.factory_id-->
<!--            FOR XML PATH ('')), 1, 1, '') as orderIds, bf.factory_name as factoryName, parent_bf.factory_name as parentFactoryName, abc.upgrade_response_duration as upgradeResponseDuration, abc.second_upgrade_response_duration as secondUpgradeResponseDuration, arc.firster_responder as responder, arc.second_responder, arc.third_responder, STUFF((SELECT ',' + ao.order_status-->
<!--            FROM andon_order ao-->
<!--            WHERE ao.button_id = arc.button_id-->
<!--            and ao.factory_id = arc.factory_id-->
<!--            and ao.order_status != '3'-->
<!--            FOR XML PATH ('')), 1, 1, '') as orderStatus-->
<!--        from andon_response_config arc-->
<!--            left join andon_button_config abc-->
<!--        on arc.button_id = abc.id-->
<!--            left join base_factory bf on arc.factory_id = bf.id-->
<!--            left join base_factory parent_bf on bf.parent_id = parent_bf.id-->
<!--        where arc.factory_id=#{factoryId}-->
<!--          and (select count (1)-->
<!--            from andon_order ao-->
<!--            where ao.button_id = arc.button_id-->
<!--          and ao.factory_id = arc.factory_id-->
<!--          and ao.order_status != '3') = 1-->
<!--    </select>-->
    <select id="queryUserAndonRespondList" resultType="org.jeecg.modules.andon.dto.AndonButtonDTO">
        select arc.id,
@@ -128,7 +98,12 @@
                      WHERE ao.button_id = arc.button_id
                        and ao.factory_id = arc.factory_id
                        and ao.order_status = '2'
                   FOR XML PATH ('')), 1, 1, '')    as orderStatus
                   FOR XML PATH ('')), 1, 1, '')    as orderStatus,
               (SELECT TOP 1 ao.operator
                FROM andon_order ao
                WHERE ao.button_id = arc.button_id
                  and ao.factory_id = arc.factory_id
                  and ao.order_status = '2')         as operator
        from andon_response_config arc
                 left join andon_button_config abc
                           on arc.button_id = abc.id
@@ -141,4 +116,90 @@
                 and ao.factory_id = arc.factory_id
                 and ao.order_status = '2') = 1
    </select>
<!--    <select id="queryUserAndonRespondList" resultType="org.jeecg.modules.andon.dto.AndonButtonDTO">-->
<!--        select arc.id,-->
<!--               abc.id                               as buttonId,-->
<!--               abc.button_name                      as buttonName,-->
<!--               abc.button_code                      as buttonCode,-->
<!--               (select count(1)-->
<!--                from andon_order ao-->
<!--                where ao.button_id = arc.button_id-->
<!--                  and ao.factory_id = arc.factory_id-->
<!--                  and ao.order_status = '2')        as blinkingFlag,-->
<!--               STUFF((SELECT ',' + CAST(ao.id AS VARCHAR)-->
<!--                      FROM andon_order ao-->
<!--                      WHERE ao.button_id = arc.button_id-->
<!--                        and ao.factory_id = arc.factory_id-->
<!--                        and ao.order_status = '2'-->
<!--                   FOR XML PATH ('')), 1, 1, '')    as orderIds,-->
<!--               bf.factory_name                      as factoryName,-->
<!--               parent_bf.factory_name               as parentFactoryName,-->
<!--               abc.upgrade_response_duration        as upgradeResponseDuration,-->
<!--               abc.second_upgrade_response_duration as secondUpgradeResponseDuration,-->
<!--               arc.firster_responder                as responder,-->
<!--               arc.second_responder,-->
<!--               arc.third_responder,-->
<!--               STUFF((SELECT ',' + ao.order_status-->
<!--                      FROM andon_order ao-->
<!--                      WHERE ao.button_id = arc.button_id-->
<!--                        and ao.factory_id = arc.factory_id-->
<!--                        and ao.order_status = '2'-->
<!--                   FOR XML PATH ('')), 1, 1, '')    as orderStatus-->
<!--        from andon_response_config arc-->
<!--                 left join andon_button_config abc-->
<!--                           on arc.button_id = abc.id-->
<!--                 left join base_factory bf on arc.factory_id = bf.id-->
<!--                 left join base_factory parent_bf on bf.parent_id = parent_bf.id-->
<!--        where arc.factory_id = #{factoryId}-->
<!--          and (select count(1)-->
<!--               from andon_order ao-->
<!--               where ao.button_id = arc.button_id-->
<!--                 and ao.factory_id = arc.factory_id-->
<!--                 and ao.order_status = '2') = 1-->
<!--    </select>-->
    <select id="queryUserAndonHandelList" resultType="org.jeecg.modules.andon.dto.AndonButtonDTO">
        select arc.id,
               abc.id                               as buttonId,
               abc.button_name                      as buttonName,
               abc.button_code                      as buttonCode,
               (select count(1)
                from andon_order ao
                where ao.button_id = arc.button_id
                  and ao.factory_id = arc.factory_id
                  and ao.order_status = '3')        as blinkingFlag,
               STUFF((SELECT ',' + CAST(ao.id AS VARCHAR)
                      FROM andon_order ao
                      WHERE ao.button_id = arc.button_id
                        and ao.factory_id = arc.factory_id
                        and ao.order_status = '3'
                   FOR XML PATH ('')), 1, 1, '')    as orderIds,
               bf.factory_name                      as factoryName,
               parent_bf.factory_name               as parentFactoryName,
               abc.upgrade_response_duration        as upgradeResponseDuration,
               abc.second_upgrade_response_duration as secondUpgradeResponseDuration,
               arc.firster_responder                as responder,
               arc.second_responder,
               arc.third_responder,
               STUFF((SELECT ',' + ao.order_status
                      FROM andon_order ao
                      WHERE ao.button_id = arc.button_id
                        and ao.factory_id = arc.factory_id
                        and ao.order_status = '3'
                   FOR XML PATH ('')), 1, 1, '')    as orderStatus
        from andon_response_config arc
                 left join andon_button_config abc
                           on arc.button_id = abc.id
                 left join base_factory bf on arc.factory_id = bf.id
                 left join base_factory parent_bf on bf.parent_id = parent_bf.id
        where arc.factory_id = #{factoryId}
          and (select count(1)
               from andon_order ao
               where ao.button_id = arc.button_id
                 and ao.factory_id = arc.factory_id
                 and ao.order_status = '3') = 1
    </select>
</mapper>
src/main/java/org/jeecg/modules/andon/service/IAndonButtonConfigService.java
@@ -37,4 +37,12 @@
     */
    List<AndonButtonDTO> queryUserAndonRespondList(String factoryId);
    /**
     * 查询用户发起安灯处理列表
     * @param factoryId
     * @return
     */
    List<AndonButtonDTO> queryUserAndonHandelList(String factoryId);
}
src/main/java/org/jeecg/modules/andon/service/IAndonOrderService.java
@@ -1,6 +1,7 @@
package org.jeecg.modules.andon.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.andon.entity.AndonOrder;
import java.util.List;
@@ -22,4 +23,12 @@
     */
    String getPrimaryResponder(AndonOrder andonOrder);
    /**
     * 处理安灯工单
     * @param andonOrder
     * @return
     */
    Result<String> handleAndonOrder(AndonOrder andonOrder);
}
src/main/java/org/jeecg/modules/andon/service/impl/AndonButtonConfigServiceImpl.java
@@ -39,5 +39,10 @@
        return baseMapper.queryUserAndonRespondList(factoryId);
    }
    @Override
    public List<AndonButtonDTO> queryUserAndonHandelList(String factoryId) {
        return baseMapper.queryUserAndonHandelList(factoryId);
    }
}
src/main/java/org/jeecg/modules/andon/service/impl/AndonOrderServiceImpl.java
@@ -3,12 +3,14 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.andon.entity.AndonResponseConfig;
import org.jeecg.modules.andon.mapper.AndonResponseConfigMapper;
import org.jeecg.modules.andon.service.IAndonOrderService;
import org.jeecg.modules.andon.entity.AndonOrder;
import org.jeecg.modules.andon.mapper.AndonOrderMapper;
import org.jeecg.modules.feishu.service.FeishuUserService;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -60,4 +62,36 @@
        return config.getFirsterResponder();
    }
    @Override
    public Result<String> handleAndonOrder(AndonOrder andonOrder) {
        // 设置工单状态为处理中
        andonOrder.setOrderStatus("3");
        // 获取响应者用户名
        String responderUsername = andonOrder.getResponder();
        // 验证响应者用户名不为空
        if (StringUtils.isBlank(responderUsername)) {
            return Result.error("响应者信息不能为空");
        }
        // 根据用户名查询用户信息
        SysUser sysUser = sysUserService.getOne(
                new QueryWrapper<SysUser>().eq("username", responderUsername)
        );
        // 验证用户是否存在
        if (sysUser == null) {
            return Result.error("找不到用户名为 " + responderUsername + " 的用户");
        }
        // 设置响应者ID
        andonOrder.setResponder(sysUser.getId());
        andonOrder.setProcessor(sysUser.getId());
        // 更新工单信息
        this.updateById(andonOrder);
        return Result.OK("处理成功");
    }
}
src/main/java/org/jeecg/modules/andon/service/impl/AndonResponseConfigServiceImpl.java
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.andon.dto.AndonButtonDTO;
import org.jeecg.modules.andon.entity.AndonButtonConfig;
import org.jeecg.modules.andon.entity.AndonOrder;
@@ -61,6 +63,10 @@
            throw new IllegalArgumentException("请求参数不能为空");
        }
        /**
         * 设置安灯人
         */
        /**
         * 2. 获取响应配置
         */
        AndonResponseConfig andonResponseConfig = this.getById(andonButtonDTO.getId());
@@ -70,6 +76,14 @@
            log.warn("未找到ID为[{}]的安灯订单");
            throw new IllegalArgumentException("未找到对应的安灯订单");
        }
        // 获取当前登录用户
        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        if (loginUser != null) {
            log.warn("未找到当前用户");
        }
        assert loginUser != null;
        andonOrder.setResponder(loginUser.getId());
        String orderStatus = andonOrder.getOrderStatus();
        andonButtonDTO.setOrderStatus(orderStatus);
        if (andonResponseConfig == null) {