소스 검색

Merge remote-tracking branch 'origin/master'

wanglt 5 달 전
부모
커밋
c7bf58995f

+ 2 - 0
ygtx-common/src/main/java/com/ygtx/common/constant/UserConstants.java

@@ -89,4 +89,6 @@ public class UserConstants
     public static final String MESSAGE_STATUS_PROCEED = "PROCEED";//已处理
 
     public static final String NO = "N";
+
+    public static final String NOTIFY_KEY="NOTIFY:USER_TASK_";
 }

+ 10 - 0
ygtx-common/src/main/java/com/ygtx/common/core/redis/RedisCache.java

@@ -265,4 +265,14 @@ public class RedisCache
     {
         return redisTemplate.keys(pattern);
     }
+
+    public Object lPop(String key1, Long key2) {
+        // 底层调用 Redis LPOP 命令
+        return redisTemplate.opsForList().leftPop(key1+"_"+key2);
+    }
+
+    public Object lPush(String key1, Long key2, String value) {
+        // 底层调用 Redis LPOP 命令
+        return redisTemplate.opsForList().leftPush(key1+"_"+key2, value);
+    }
 }

+ 2 - 4
ygtx-framework/src/main/java/com/ygtx/framework/config/SecurityConfig.java

@@ -115,9 +115,7 @@ public class SecurityConfig
                                 , "/register"
                                 , "/captchaImage"
                                 , "/initPassword"
-                                , "/worklog/weekly/**"
-                                , "/demo/config/**"
-                                , "/demoT/config/**"
+                                , "/mobile/notify/**"
                         ).permitAll()
                     // 静态资源,可匿名访问
                     .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
@@ -143,4 +141,4 @@ public class SecurityConfig
     {
         return new BCryptPasswordEncoder();
     }
-}
+}

+ 57 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/controller/mobile/GxtMobileNotifyController.java

@@ -0,0 +1,57 @@
+package com.ygtx.gxt.controller.mobile;
+
+import cn.hutool.json.JSONUtil;
+import com.alibaba.druid.support.json.JSONUtils;
+import com.ygtx.common.annotation.Log;
+import com.ygtx.common.constant.UserConstants;
+import com.ygtx.common.core.controller.BaseController;
+import com.ygtx.common.core.domain.AjaxResult;
+import com.ygtx.common.core.page.TableDataInfo;
+import com.ygtx.common.core.redis.RedisCache;
+import com.ygtx.common.enums.BusinessType;
+import com.ygtx.common.utils.DateUtils;
+import com.ygtx.gxt.domain.GxtNotifyMessage;
+import com.ygtx.gxt.domain.GxtRepairOrder;
+import com.ygtx.gxt.domain.GxtWorkOrder;
+import com.ygtx.gxt.domain.OrderScoreInfo;
+import com.ygtx.gxt.service.IGxtOrderScoreService;
+import com.ygtx.gxt.service.IGxtRepairOrderService;
+import com.ygtx.gxt.service.IGxtWorkOrderService;
+import io.lettuce.core.dynamic.annotation.Param;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 工单Controller
+ *
+ * @date 2025-11-12
+ */
+@RestController
+@RequestMapping("/mobile/notify")
+public class GxtMobileNotifyController extends BaseController
+{
+    @Autowired
+    private RedisCache redisCache;
+    /**
+     * 获取通知信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getTask(@PathVariable("id") Long id)
+    {
+        try {
+            System.out.println("请求" + DateUtils.getTime());
+            if(id != null){
+                Object val = redisCache.lPop(UserConstants.NOTIFY_KEY,id);
+                if (val != null) {
+                    GxtNotifyMessage notifyMessage = JSONUtil.toBean(val.toString(), GxtNotifyMessage.class);
+                    return success(notifyMessage);
+                }
+            }
+        }catch (Exception ex){
+            ex.printStackTrace();
+        }
+        return AjaxResult.success();
+    }
+}

+ 22 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/domain/GxtNotifyMessage.java

@@ -0,0 +1,22 @@
+package com.ygtx.gxt.domain;
+
+public class GxtNotifyMessage {
+    private String title;
+    private String desc;
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+}

+ 12 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/domain/GxtRepairOrder.java

@@ -191,6 +191,9 @@ public class GxtRepairOrder extends BaseEntity
     /** 工单类型 */
     private Long orderType;
 
+    /** 维修方式 */
+    private String repairMethod;
+
     private List<GxtRepairOrderPerson> repairOrderPersonList;
 
     private List<GxtRepairOrderFlow> repairOrderFlowList;
@@ -684,6 +687,14 @@ public class GxtRepairOrder extends BaseEntity
         this.orderType = orderType;
     }
 
+    public String getRepairMethod() {
+        return repairMethod;
+    }
+
+    public void setRepairMethod(String repairMethod) {
+        this.repairMethod = repairMethod;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -728,6 +739,7 @@ public class GxtRepairOrder extends BaseEntity
             .append("rejectionReason", getRejectionReason())
             .append("finalizationRemark", getFinalizationRemark())
             .append("orderType", getOrderType())
+            .append("repairMethod", getRepairMethod())
             .toString();
     }
 }

+ 37 - 4
ygtx-gxt/src/main/java/com/ygtx/gxt/service/impl/GxtOrderScoreServiceImpl.java

@@ -1,13 +1,12 @@
 package com.ygtx.gxt.service.impl;
 
 import com.ygtx.common.constant.Constants;
+import com.ygtx.common.utils.DateUtils;
 import com.ygtx.common.utils.SecurityUtils;
 import com.ygtx.common.utils.StringUtils;
 import com.ygtx.gxt.domain.*;
 import com.ygtx.gxt.mapper.GxtOrderScoreMapper;
-import com.ygtx.gxt.service.IGxtOrderScoreService;
-import com.ygtx.gxt.service.IGxtRepairOrderService;
-import com.ygtx.gxt.service.IGxtWorkOrderService;
+import com.ygtx.gxt.service.*;
 import com.ygtx.system.service.ISysConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -48,6 +47,12 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
     @Autowired
     private ISysConfigService configService;
 
+    @Autowired
+    private IGxtRepairOrderFlowService repairOrderFlowService;
+
+    @Autowired
+    private IGxtWorkOrderFlowService gxtWorkOrderFlowService;
+
     /**
      * 查询合并的工单列表(维修工单和维保工单)
      *
@@ -646,6 +651,21 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
                 }
                 
                 gxtRepairOrderService.updateGxtRepairOrderForScore(order);
+
+                if("archived".equals(order.getWorkOrderStatus())){
+                    // 添加归档流程记录
+                    GxtRepairOrderFlow flow = new GxtRepairOrderFlow();
+                    flow.setOrderId(order.getId());
+                    flow.setOrderCode(order.getWorkOrderProjectNo());
+                    flow.setActionType("archive");
+                    flow.setFromStatus("to_archive");
+                    flow.setToStatus("archived");
+                    flow.setOperatorId(1L); // 系统自动操作,使用系统用户ID
+                    flow.setOperatorName("系统自动");
+                    flow.setActionTime(DateUtils.getNowDate());
+                    flow.setActionRemark("系统自动归档工单");
+                    repairOrderFlowService.insertGxtRepairOrderFlow(flow);
+                }
                 
                 return 1;
             } else if (orderScoreInfo.getOrderType() == 2) {
@@ -682,7 +702,20 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
                 }
                 
                 gxtWorkOrderService.updateGxtWorkOrderForScore(order);
-                
+                if("archived".equals(order.getWorkOrderStatus())){
+                    // 添加归档流程记录
+                    GxtWorkOrderFlow flow = new GxtWorkOrderFlow();
+                    flow.setOrderId(order.getId());
+                    flow.setOrderCode(order.getWorkOrderProjectNo());
+                    flow.setActionType("archive");
+                    flow.setFromStatus("to_archive");
+                    flow.setToStatus("archived");
+                    flow.setOperatorId(1L); // 系统自动操作,使用系统用户ID
+                    flow.setOperatorName("系统自动");
+                    flow.setActionTime(DateUtils.getNowDate());
+                    flow.setActionRemark("系统自动归档工单");
+                    gxtWorkOrderFlowService.insertGxtWorkOrderFlow(flow);
+                }
                 return 1;
             }
             return 0;

+ 7 - 1
ygtx-gxt/src/main/resources/mapper/gxt/GxtRepairOrderMapper.xml

@@ -59,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="reviewScoreNum"    column="review_score_num"    />
         <result property="finalCoefficient"    column="final_coefficient"    />
         <result property="orderType"    column="order_type"    />
+        <result property="repairMethod"    column="repair_method"    />
     </resultMap>
 
     <resultMap type="GxtRepairOrder" id="GxtRepairOrderWithPersonResult" extends="GxtRepairOrderResult">
@@ -94,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                accept_user_id, accept_user_name, real_start_time, real_end_time, team_leader_id, team_leader_name, work_group_member_id,
                work_group_member_name, t.create_by, t.create_time, t.update_by, t.update_time, t.remark, content, plan_hour, priority_type, score,
                review_content, maintenance_type, occur_time, fault_barcode, suspend_reason, suspend_description, approval_status,
-               rejection_reason, modify_reason, finalization_remark, related_order_code, related_order_content, mis_order_no, restart_time, scoring_status, pcs_station_pid, attachment_urls, review_score_num, final_coefficient, order_type
+               rejection_reason, modify_reason, finalization_remark, related_order_code, related_order_content, mis_order_no, restart_time, scoring_status, pcs_station_pid, attachment_urls, review_score_num, final_coefficient, order_type, repair_method
         from gxt_repair_order t
         left join sys_user u on u.user_name = t.create_by
         left join sys_dept d on u.dept_id = d.dept_id
@@ -151,6 +152,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="reviewScoreNum != null "> and review_score_num = #{reviewScoreNum}</if>
             <if test="finalCoefficient != null "> and final_coefficient = #{finalCoefficient}</if>
             <if test="orderType != null "> and order_type = #{orderType}</if>
+            <if test="repairMethod != null  and repairMethod != ''"> and repair_method = #{repairMethod}</if>
 
             <!-- 业务特定数据权限过滤条件 -->
             <if test="params.businessDataScope != null and params.businessDataScope != ''">
@@ -226,6 +228,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="reviewScoreNum != null">review_score_num,</if>
             <if test="finalCoefficient != null">final_coefficient,</if>
             <if test="orderType != null">order_type,</if>
+            <if test="repairMethod != null and repairMethod != ''">repair_method,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="workOrderProjectNo != null and workOrderProjectNo != ''">#{workOrderProjectNo},</if>
@@ -281,6 +284,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="reviewScoreNum != null">#{reviewScoreNum},</if>
             <if test="finalCoefficient != null">#{finalCoefficient},</if>
             <if test="orderType != null">#{orderType},</if>
+            <if test="repairMethod != null and repairMethod != ''">#{repairMethod},</if>
          </trim>
     </insert>
 
@@ -340,6 +344,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="reviewScoreNum != null">review_score_num = #{reviewScoreNum},</if>
             <if test="finalCoefficient != null">final_coefficient = #{finalCoefficient},</if>
             <if test="orderType != null">order_type = #{orderType},</if>
+            <if test="repairMethod != null and repairMethod != ''">repair_method = #{repairMethod},</if>
         </trim>
         where id = #{id}
     </update>
@@ -409,6 +414,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="pcsStationPid != null "> and pcs_station_pid = #{pcsStationPid}</if>
             <if test="attachmentUrls != null  and attachmentUrls != ''"> and attachment_urls = #{attachmentUrls}</if>
             <if test="reviewScoreNum != null "> and review_score_num = #{reviewScoreNum}</if>
+            <if test="repairMethod != null  and repairMethod != ''"> and repair_method = #{repairMethod}</if>
         </where>
         order by id desc
     </select>