Forráskód Böngészése

'修改综合智慧云登录页和首页路径'

james 1 éve
szülő
commit
43e1a3571b

+ 32 - 6
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/WeChatController.java

@@ -6,11 +6,14 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.usky.common.core.bean.ApiResult;
 import com.usky.common.core.exception.BusinessException;
+import com.usky.common.core.util.HttpUtils;
 import com.usky.common.redis.core.RedisHelper;
 import com.usky.iot.constant.constant;
 import com.usky.iot.domain.SysWxOpuser;
 import com.usky.iot.service.SysWxOpuserService;
+import com.usky.iot.service.vo.SendWeChatMessageRequestVO;
 import com.usky.iot.service.vo.SignUpRequestVO;
+import lombok.extern.slf4j.Slf4j;
 import ma.glasnost.orika.impl.util.StringUtil;
 import me.chanjar.weixin.common.api.WxConsts;
 import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
@@ -35,6 +38,7 @@ import java.util.Objects;
 
 @RestController
 @RequestMapping("/weChat")
+@Slf4j
 public class WeChatController {
     @Autowired
     private WxMpService wxMpService;
@@ -118,7 +122,7 @@ public class WeChatController {
                     .eq(SysWxOpuser::getType,"app");
             SysWxOpuser one = sysWxOpuserService.getOne(queryWrapper);
             if(one != null){
-                String sendUrl = "https://aiot.usky.cn/work/#/pages/index?op="+one.getOpenid();
+                String sendUrl = "https://manager.usky.cn/mobile/#/pages/index?op="+one.getOpenid();
                 try{
                     System.out.println("sendUrl: "+sendUrl);
                     response.sendRedirect(sendUrl);
@@ -130,7 +134,7 @@ public class WeChatController {
         }else{
             if(!userAgent.contains("MicroMessenger")){
                 try{
-                    response.sendRedirect("https://aiot.usky.cn/work/#/pages/login");
+                    response.sendRedirect("https://manager.usky.cn/mobile/#/pages/login");
                 }catch (IOException e){
                     throw new BusinessException(e.getMessage());
                 }
@@ -163,13 +167,13 @@ public class WeChatController {
                             if(one != null){
                                 request.getSession().setAttribute("phone",one.getPhone());
 
-                                String sendUrl = "https://aiot.usky.cn/work/#/pages/index?op="+one.getOpenid();
+                                String sendUrl = "https://manager.usky.cn/mobile/#/pages/index?op="+one.getOpenid();
                                 response.sendRedirect(sendUrl);
                             }else{
                                 request.getSession().removeAttribute("openid");
                                 request.getSession().removeAttribute("phone");
 
-                                response.sendRedirect("https://aiot.usky.cn/work/#/pages/login");
+                                response.sendRedirect("https://manager.usky.cn/mobile/#/pages/login");
                             }
 
 
@@ -186,13 +190,13 @@ public class WeChatController {
                         SysWxOpuser one = sysWxOpuserService.getOne(queryWrapper);
                         if(one != null){
                             request.getSession().setAttribute("phone",one.getPhone());
-                            String sendUrl = "https://aiot.usky.cn/work/#/pages/index?op="+one.getOpenid();
+                            String sendUrl = "https://manager.usky.cn/mobile/#/pages/index?op="+one.getOpenid();
                             response.sendRedirect(sendUrl);
                         }else{
                             request.getSession().removeAttribute("openid");
                             request.getSession().removeAttribute("phone");
 
-                            response.sendRedirect("https://aiot.usky.cn/work/#/pages/login");
+                            response.sendRedirect("https://manager.usky.cn/mobile/#/pages/login");
                         }
                     }catch (IOException e){
                         throw new BusinessException(e.getMessage());
@@ -281,6 +285,28 @@ public class WeChatController {
         return null;
     }
 
+
+//    /**
+//     * 微信消息提醒
+//     * @return
+//     */
+//    @PostMapping("sendWeChatMessage")
+//    public Map<String,Object> sendWeChatMessage(@RequestBody SendWeChatMessageRequestVO requestVO){
+//        String infoType = requestVO.getInfoType();
+//        String infoTitle = requestVO.getInfoTitle();
+//        String infoContent = requestVO.getInfoContent();
+//        Map<String,Object> map = new HashMap<>();
+//
+//        String s = null;
+//        try {
+//            s = HttpUtils.postForm(URL, body, null);
+//        }catch (Exception e){
+//            log.info("发送微信推送报警出错"+e);
+//        }
+//        return map;
+//
+//    }
+
 }
 
 

+ 3 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpDeviceTypeServiceImpl.java

@@ -51,6 +51,9 @@ public class DmpDeviceTypeServiceImpl extends AbstractCrudService<DmpDeviceTypeM
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void edit(DmpDeviceType dmpDeviceType) {
+        if (checkNameUnique(dmpDeviceType)) {
+            throw new BusinessException("修改设备类型'" + dmpDeviceType.getTypeName() + "'失败,该设备类型已经存在");
+        }
         dmpDeviceType.setUpdatedBy(SecurityUtils.getUsername());
         dmpDeviceType.setUpdatedTime(LocalDateTime.now());
         this.updateById(dmpDeviceType);

+ 21 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/SendWeChatMessageRequestVO.java

@@ -0,0 +1,21 @@
+package com.usky.iot.service.vo;
+
+import lombok.Data;
+
+@Data
+public class SendWeChatMessageRequestVO {
+    /**
+     * 消息类型
+     */
+    String infoType;
+
+    /**
+     * 消息标题
+     */
+    String infoTitle;
+
+    /**
+     * 消息内容
+     */
+    String infoContent;
+}