Bladeren bron

极光推送
盲板驳回

jiangbiao 11 maanden geleden
bovenliggende
commit
bb1136edb9

+ 32 - 32
master/src/main/java/com/ruoyi/common/jpush/JiGuangConfig.java

@@ -1,32 +1,32 @@
-//package com.ruoyi.common.jpush;
-//
-//import cn.jiguang.sdk.api.PushApi;
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//
-///**极光推送配置
-// */
-//@Configuration
-//public class JiGuangConfig {
-//    /**
-//     * 极光官网-个人管理中心-appkey
-//     * https://www.jiguang.cn/
-//     */
-//    @Value("${jpush.appKey}")
-//    private String appKey;
-//
-//    /**
-//     * 极光官网-个人管理中心-点击查看-secret
-//     */
-//    @Value("${jpush.masterSecret}")
-//    private String masterSecret;
-//
-//    @Bean
-//    public PushApi pushApi() {
-//        return new PushApi.Builder()
-//                .setAppKey(appKey)
-//                .setMasterSecret(masterSecret)
-//                .build();
-//    }
-//}
+package com.ruoyi.common.jpush;
+
+import cn.jiguang.sdk.api.PushApi;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**极光推送配置
+ */
+@Configuration
+public class JiGuangConfig {
+    /**
+     * 极光官网-个人管理中心-appkey
+     * https://www.jiguang.cn/
+     */
+    @Value("${jpush.appKey}")
+    private String appKey;
+
+    /**
+     * 极光官网-个人管理中心-点击查看-secret
+     */
+    @Value("${jpush.masterSecret}")
+    private String masterSecret;
+
+    @Bean
+    public PushApi pushApi() {
+        return new PushApi.Builder()
+                .setAppKey(appKey)
+                .setMasterSecret(masterSecret)
+                .build();
+    }
+}

+ 73 - 73
master/src/main/java/com/ruoyi/common/jpush/JiGuangPushService.java

@@ -1,73 +1,73 @@
-//package com.ruoyi.common.jpush;
-//
-//import cn.jiguang.sdk.api.PushApi;
-//import cn.jiguang.sdk.bean.push.PushSendParam;
-//import cn.jiguang.sdk.bean.push.PushSendResult;
-//import cn.jiguang.sdk.bean.push.audience.Audience;
-//import cn.jiguang.sdk.bean.push.message.notification.NotificationMessage;
-//import cn.jiguang.sdk.bean.push.other.CidGetResult;
-//import cn.jiguang.sdk.constants.ApiConstants;
-//import com.alibaba.fastjson.JSON;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.stereotype.Service;
-//
-//import java.util.Arrays;
-//
-//@Service
-//public class JiGuangPushService {
-//    Logger log = LoggerFactory.getLogger(this.getClass());
-//
-//
-//    @Autowired
-//    private PushApi pushApi;
-//
-//    public void getCidForPush() {
-//        CidGetResult result = pushApi.getCidForPush(10);
-//        log.info("result:{}", result);
-//    }
-//
-//
-//    public void send(String title, String alert, String alias) {
-//        PushSendParam param = new PushSendParam();
-//        // 通知内容
-//        NotificationMessage.Android android = new NotificationMessage.Android();
-//        android.setAlert(alert);
-//        android.setTitle(title);
-//        NotificationMessage.Android.Intent intent = new NotificationMessage.Android.Intent();
-//        intent.setUrl("intent:#Intent;action=android.intent.action.MAIN;end");
-//
-//        android.setIntent(intent);
-//
-//        NotificationMessage notificationMessage = new NotificationMessage();
-//        notificationMessage.setAlert(alert);
-//        notificationMessage.setAndroid(android);
-//        param.setNotification(notificationMessage);
-//
-//        // 目标人群
-//        Audience audience = new Audience();
-//        audience.setAliasList(Arrays.asList(alias));
-////        audience.setRegistrationIdList(Arrays.asList("1104a89793af2cfc030", "1104a89793af2cfc030"));
-//        // 指定目标
-//        param.setAudience(audience);
-//        // 或者发送所有人
-////        param.setAudience(ApiConstants.Audience.ALL);
-//
-//        // 指定平台
-////        param.setPlatform(Arrays.asList(Platform.android, Platform.ios));
-//        // 或者发送所有平台
-//        param.setPlatform(ApiConstants.Platform.ANDROID);
-//
-//        log.info("param:{}", JSON.toJSONString(param));
-//        // 发送
-//        try {
-//            PushSendResult result = pushApi.send(param);
-//            System.out.println("Push result: " + result);
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//
-//    }
-//
-//}
+package com.ruoyi.common.jpush;
+
+import cn.jiguang.sdk.api.PushApi;
+import cn.jiguang.sdk.bean.push.PushSendParam;
+import cn.jiguang.sdk.bean.push.PushSendResult;
+import cn.jiguang.sdk.bean.push.audience.Audience;
+import cn.jiguang.sdk.bean.push.message.notification.NotificationMessage;
+import cn.jiguang.sdk.bean.push.other.CidGetResult;
+import cn.jiguang.sdk.constants.ApiConstants;
+import com.alibaba.fastjson.JSON;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+
+@Service
+public class JiGuangPushService {
+    Logger log = LoggerFactory.getLogger(this.getClass());
+
+
+    @Autowired
+    private PushApi pushApi;
+
+    public void getCidForPush() {
+        CidGetResult result = pushApi.getCidForPush(10);
+        log.info("result:{}", result);
+    }
+
+
+    public void send(String title, String alert, String... alias) {
+        PushSendParam param = new PushSendParam();
+        // 通知内容
+        NotificationMessage.Android android = new NotificationMessage.Android();
+        android.setAlert(alert);
+        android.setTitle(title);
+        NotificationMessage.Android.Intent intent = new NotificationMessage.Android.Intent();
+        intent.setUrl("intent:#Intent;action=android.intent.action.MAIN;end");
+
+        android.setIntent(intent);
+
+        NotificationMessage notificationMessage = new NotificationMessage();
+        notificationMessage.setAlert(alert);
+        notificationMessage.setAndroid(android);
+        param.setNotification(notificationMessage);
+
+        // 目标人群
+        Audience audience = new Audience();
+        audience.setAliasList(Arrays.asList(alias));
+//        audience.setRegistrationIdList(Arrays.asList("1104a89793af2cfc030", "1104a89793af2cfc030"));
+        // 指定目标
+        param.setAudience(audience);
+        // 或者发送所有人
+//        param.setAudience(ApiConstants.Audience.ALL);
+
+        // 指定平台
+//        param.setPlatform(Arrays.asList(Platform.android, Platform.ios));
+        // 或者发送所有平台
+        param.setPlatform(ApiConstants.Platform.ANDROID);
+
+        log.info("param:{}", JSON.toJSONString(param));
+        // 发送
+        try {
+            PushSendResult result = pushApi.send(param);
+            System.out.println("Push result: " + result);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+}

+ 5 - 1
master/src/main/java/com/ruoyi/project/common/CommonController.java

@@ -431,7 +431,11 @@ public class CommonController extends BaseController
             for (MultipartFile file : files) {
                 // 上传并返回新文件名称
                 String fileName = FileUploadUtils.upload(filePath, file);
-                String url = serverConfig.getUrl() + fileName;
+                String url = serverConfig.getUrl();
+                if (url.contains("81")){
+                    url += "/cpms";
+                }
+                url = url + fileName;
                 urls.add(url);
                 fileNames.add(fileName);
                 newFileNames.add(FileUtils.getName(fileName));

+ 2 - 2
master/src/main/java/com/ruoyi/project/patrol/emergency/controller/TEmergencyEyewashController.java

@@ -186,7 +186,7 @@ public class TEmergencyEyewashController extends BaseController {
         TPatrolPlan tPatrolPlan = tPatrolPlanService.selectTPatrolPlanById(planId);
         if (Objects.nonNull(tPatrolPlan) && Objects.nonNull(tPatrolPlan.getConfirmed())) {
             SysUser sysUser = sysUserService.selectUserById(Long.valueOf(tPatrolPlan.getConfirmed()));
-            if (sysUser!=null) {
+            if (sysUser != null) {
                 confirmed = sysUser.getSignUrl();
                 confirmedDate = tPatrolPlan.getConfirmDate();
             }
@@ -363,7 +363,7 @@ public class TEmergencyEyewashController extends BaseController {
         tEmergencyEyewash.setCheckDate(new Date());
         TEmergencyEyewash eyewash = tEmergencyEyewashService.selectTEmergencyEyewashById(tEmergencyEyewash.getId());
         TPatrolPlan tPatrolPlan = tPatrolPlanService.selectTPatrolPlanById(tEmergencyEyewash.getPlanId());
-        if (tPatrolPlan.getStatus()==1){
+        if (tPatrolPlan.getStatus() == 1) {
             return AjaxResult.error("当前选择的计划已确认!");
         }
         if (!"1".equals(eyewash.getCheckStatus())) {

+ 9 - 4
master/src/main/java/com/ruoyi/project/patrol/patrol/controller/TIndexController.java

@@ -1,5 +1,6 @@
 package com.ruoyi.project.patrol.patrol.controller;
 
+import com.ruoyi.common.jpush.JiGuangPushService;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.project.patrol.patrol.domain.TIndex;
@@ -10,16 +11,15 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
 
 @RestController
 @RequestMapping("/patrol/index")
 public class TIndexController extends BaseController {
     @Autowired
     private ITIndexService tIndexService;
+    @Autowired
+    private JiGuangPushService jiGuangPushService;
     @GetMapping("/countNums")
     public AjaxResult getCountNums() {
         TIndex tIndex = new TIndex();
@@ -35,4 +35,9 @@ public class TIndexController extends BaseController {
         resultMap.put("issueNum", tIndexService.getIssueNumber(tIndex));
         return AjaxResult.success(resultMap);
     }
+
+    @PostMapping
+    public void sentTest() {
+        jiGuangPushService.send("欢迎使用EHS管理助手", "欢迎使用EHS管理助手!","20219","100","10020","1");
+    }
 }

+ 0 - 84
master/src/main/java/com/ruoyi/project/pssr/controller/TPssrApproveController.java

@@ -250,16 +250,6 @@ public class TPssrApproveController extends BaseController {
                 }
                 allDone = true;
             }
-        } else {
-            // 驳回操作,修改子表状态
-            handleTurnDown(tPssrSubcontent, condition);
-            if ("1".equals(condition)) {
-                remark="驳回至确认人1";
-            } else if ("2".equals(condition)) {
-                remark="驳回至确认人2";
-            } else if ("3".equals(condition)) {
-                remark="驳回至确认人3";
-            }
         }
         //处理流程节点
         Map<String, Object> param = new HashMap<>();
@@ -277,80 +267,6 @@ public class TPssrApproveController extends BaseController {
         return AjaxResult.success();
     }
 
-    public void handleTurnDown(TPssrSubcontent subcontent, String condition) {
-        switch (subcontent.getSerialNumber()) {
-            case "01":
-                break;
-            case "02":
-                break;
-            case "03":
-                break;
-            case "04":
-                break;
-            case "05":
-                break;
-            case "06":
-                break;
-            case "07":
-                break;
-            case "08":
-                break;
-            case "09":
-                break;
-            case "10":
-                break;
-            case "11":
-                break;
-            case "12":
-                break;
-            case "13":
-                break;
-            case "14":
-                break;
-            case "15":
-                break;
-            case "16":
-                break;
-            case "17":
-                TPssrLock lock = new TPssrLock();
-                lock.setApproveStatus(2L);
-                lock.setSubId(subcontent.getId());
-                for (TPssrLock tPssrLock : tPssrLockService.selectTPssrLockList(lock)) {
-                    if ("1".equals(condition)) {
-                        tPssrLock.setApproveStatus(1L);
-                    } else if ("2".equals(condition)) {
-                        tPssrLock.setApproveStatus(3L);
-                    } else if ("3".equals(condition)) {
-                        tPssrLock.setApproveStatus(4L);
-                    }
-                    tPssrLockService.updateTPssrLock(tPssrLock);
-                }
-                break;
-            case "18":
-                break;
-            case "19":
-                break;
-            case "20":
-                break;
-            case "21":
-                break;
-            case "22":
-                break;
-            case "23":
-                break;
-            case "24":
-                break;
-            case "25":
-                break;
-            case "26":
-                break;
-            case "27":
-                break;
-            case "28":
-                break;
-        }
-    }
-
     /**
      * 子项内容确认
      */

+ 53 - 1
master/src/main/java/com/ruoyi/project/pssr/controller/TPssrBlindController.java

@@ -12,12 +12,18 @@ import com.ruoyi.project.pssr.domain.TPssrSubcontent;
 import com.ruoyi.project.pssr.service.ITPssrApproveService;
 import com.ruoyi.project.pssr.service.ITPssrBlindService;
 import com.ruoyi.project.pssr.service.ITPssrSubcontentService;
+import org.activiti.engine.ProcessEngine;
+import org.activiti.engine.ProcessEngines;
+import org.activiti.engine.TaskService;
+import org.activiti.engine.task.Task;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 盲板Controller
@@ -151,7 +157,7 @@ public class TPssrBlindController extends BaseController {
                     if (item.getInstallStatus().split(",")[current].equals("0")) {
                         return AjaxResult.success();
                     }
-                } else if (tPssrBlind.getTaskType()==1) {
+                } else if (tPssrBlind.getTaskType() == 1) {
                     if (item.getRemoveStatus().split(",")[current].equals("0")) {
                         return AjaxResult.success();
                     }
@@ -250,4 +256,50 @@ public class TPssrBlindController extends BaseController {
         return currents;
     }
 
+    @PutMapping("/turnDownBlind")
+    public AjaxResult turnDownBlind(TPssrBlind tPssrBlind) {
+        if (tPssrBlind.getIds() != null) {
+            String userId = getUserId().toString();
+            // 修改已选择数据的状态
+            for (Long id : tPssrBlind.getIds()) {
+                TPssrBlind blind = new TPssrBlind();
+                blind.setId(id);
+                blind.setApproveStatus(tPssrBlind.getApproveStatus());
+                blind.setUpdatedate(new Date());
+                blind.setUpdaterCode(getUserId().toString());
+                tPssrBlindService.updateTPssrBlind(blind);
+            }
+            // 查询当前流程
+            TPssrApprove approve = tPssrApproveService.selectTPssrApproveBySubId(tPssrBlind.getSubId());
+
+            ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
+            TaskService taskService = processEngine.getTaskService();
+            Task task = processEngine.getTaskService()//获取任务service
+                    .createTaskQuery()//创建查询对象
+                    .taskAssignee(userId)
+                    .processInstanceId(approve.getProcessId()).singleResult();
+            String taskId = task.getId();
+
+            // 根据审批状态判断应驳回至哪一步
+            String condition = "0";
+            if (tPssrBlind.getApproveStatus() == 1) {
+                condition = "1";//确认人1
+            } else if (tPssrBlind.getApproveStatus() == 2) {
+                condition = "2";//确认人2
+            } else if (tPssrBlind.getApproveStatus() == 3) {
+                condition = "3";//确认人3
+            }
+
+            //处理流程节点
+            Map<String, Object> param = new HashMap<>();
+            param.put("condition", condition);
+            //认领任务
+            processEngine.getTaskService().claim(taskId, userId);
+            taskService.addComment(taskId, approve.getProcessId(), "驳回至确认人" + condition);
+            taskService.complete(taskId, param);
+            return AjaxResult.success();
+        }
+        return AjaxResult.error();
+    }
+
 }

+ 1 - 0
master/src/main/java/com/ruoyi/project/pssr/mapper/TPssrApproveMapper.java

@@ -19,6 +19,7 @@ public interface TPssrApproveMapper
      * @return pssr审批管理
      */
     public TPssrApprove selectTPssrApproveById(Long approveId);
+    public TPssrApprove selectTPssrApproveBySubId(Long subId);
 
     /**
      * 查询pssr审批管理列表

+ 1 - 0
master/src/main/java/com/ruoyi/project/pssr/service/ITPssrApproveService.java

@@ -18,6 +18,7 @@ public interface ITPssrApproveService
      * @return pssr审批管理
      */
     public TPssrApprove selectTPssrApproveById(Long approveId);
+    public TPssrApprove selectTPssrApproveBySubId(Long subId);
 
     /**
      * 查询pssr审批管理列表

+ 5 - 0
master/src/main/java/com/ruoyi/project/pssr/service/impl/TPssrApproveServiceImpl.java

@@ -30,6 +30,11 @@ public class TPssrApproveServiceImpl implements ITPssrApproveService
     {
         return tPssrApproveMapper.selectTPssrApproveById(approveId);
     }
+    @Override
+    public TPssrApprove selectTPssrApproveBySubId(Long subId)
+    {
+        return tPssrApproveMapper.selectTPssrApproveBySubId(subId);
+    }
 
     /**
      * 查询pssr审批管理列表

+ 5 - 0
master/src/main/resources/mybatis/pssr/TPssrApproveMapper.xml

@@ -54,6 +54,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectTPssrApproveVo"/>
         where approve_id = #{approveId}
     </select>
+
+    <select id="selectTPssrApproveById" parameterType="Long" resultMap="TPssrApproveResult">
+        <include refid="selectTPssrApproveVo"/>
+        where sub_id = #{subId}
+    </select>
         
     <insert id="insertTPssrApprove" parameterType="TPssrApprove">
         <selectKey keyProperty="approveId" resultType="long" order="BEFORE">

+ 8 - 0
ui/src/api/pssr/blind.js

@@ -43,6 +43,14 @@ export function handleConfirmApprove(data) {
     data: data
   })
 }
+// 确认盲板
+export function handleTurnDownBlind(data) {
+  return request({
+    url: '/pssr/blind/turnDownBlind',
+    method: 'put',
+    data: data
+  })
+}
 
 // 删除盲板
 export function delBlind(id) {

+ 0 - 6
ui/src/views/approve/approveDetail/pssrApprove-detail.vue

@@ -8,12 +8,6 @@
     <span slot="footer" class="dialog-footer">
       <el-button v-if="!this.taskForm.taskId == ''&&isApprove==2" type="primary"
                  @click="dataFormSubmit(0)" >通过</el-button>
-      <el-button v-if="!this.taskForm.taskId == ''&&isApprove==2" type="danger"
-                 @click="dataFormSubmit(1)" >驳回至确认人1</el-button>
-      <el-button v-if="!this.taskForm.taskId == ''&&isApprove==2" type="danger"
-                 @click="dataFormSubmit(2)" >驳回至确认人2</el-button>
-      <el-button v-if="!this.taskForm.taskId == ''&&isApprove==2" type="danger"
-                 @click="dataFormSubmit(3)" >驳回至确认人3</el-button>
       <el-button @click="visible = false">{{ $t('返回') }}</el-button>
     </span>
     <div>

+ 32 - 2
ui/src/views/pssr/blind/index.vue

@@ -94,7 +94,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
-          type="danger"
+          type="success"
           icon="el-icon-s-promotion"
           size="mini"
           @click="handleApprove"
@@ -105,7 +105,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
-          type="danger"
+          type="primary"
           icon="el-icon-check"
           size="mini"
           v-if="isApprove==4||isApprove==5"
@@ -114,6 +114,28 @@
         >确认
         </el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          icon="el-icon-refresh-left"
+          size="mini"
+          v-if="isApprove==2"
+          @click="handleTurnDown(1)"
+          v-hasPermi="['pssr:blind:edit']"
+        >驳回至拆除
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          icon="el-icon-refresh-left"
+          size="mini"
+          v-if="isApprove==2"
+          @click="handleTurnDown(2)"
+          v-hasPermi="['pssr:blind:edit']"
+        >驳回至安装
+        </el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -651,6 +673,14 @@ export default {
     });
   },
   methods: {
+    handleTurnDown(val) {
+      let data = {
+        ids: this.ids,
+        subId: this.subId,
+        approveStatus: val,
+      }
+
+    },
     userFormat(userId) {
       for (let item of this.userOptions) {
         if (item.userId == userId) {