hurixing 1 month ago
parent
commit
21a0435ccb

+ 5 - 0
hcp-core/src/main/java/com/yingyangfly/core/service/WxApplicationBlankService.java

@@ -24,4 +24,9 @@ public interface WxApplicationBlankService extends IService<WxApplicationBlank>
 
 
     void updatePayStatusFulfill(Long id);
+
+    /**
+     * 判断线上是否有支付成功患者
+     */
+    Boolean succeedMessage();
 }

+ 17 - 0
hcp-core/src/main/java/com/yingyangfly/core/service/impl/AppUserService.java

@@ -985,6 +985,22 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
         return ResultResponse.success();
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean updatePadNo(AppUser appUser){
+        AppUser upAppUser = new AppUser();
+        upAppUser.setPadNo(appUser.getPadNo());
+        upAppUser.setId(appUser.getId());
+
+        AppUser appUser1 = appUserMapper.selectById(appUser.getId());
+        // 添加新纪录 修改状态
+        doRentRecord(appUser1);
+        // 修改原设备为未租设备
+        Equipment equipmentCurrent = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getSn,appUser.getPadNo()));
+        equipmentCurrent.setStatus("A");
+        equipmentService.updateById(equipmentCurrent);
+        return appUserMapper.updateById(upAppUser) > 0;
+    }
+
     /**
      * 按钮开通  患者套餐
      */
@@ -1168,6 +1184,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
     }
 
 
+
     @Resource
     private WxApplicationBlankService wxApplicationBlankService;
 

+ 8 - 0
hcp-core/src/main/java/com/yingyangfly/core/service/impl/WxApplicationBlankServiceImpl.java

@@ -140,4 +140,12 @@ public class WxApplicationBlankServiceImpl extends ServiceImpl<WxApplicationBlan
         payOrderB.setMobile(appUser.getMobile());
         payOrderMapper.insert(payOrderB);
     }
+
+    @Override
+    public Boolean succeedMessage() {
+        LambdaQueryWrapper<WxApplicationBlank> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(WxApplicationBlank::getPayStatus, "2");
+        Long count = baseMapper.selectCount(lambdaQueryWrapper);
+        return count>0;
+    }
 }

+ 6 - 0
hcp-platform/pom.xml

@@ -17,6 +17,12 @@
 
 
     <dependencies>
+        <!-- websocket -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-websocket</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>

+ 30 - 0
hcp-platform/src/main/java/com/yingyangfly/platform/config/WebSocketConfig.java

@@ -0,0 +1,30 @@
+package com.yingyangfly.platform.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.messaging.simp.config.MessageBrokerRegistry;
+import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
+import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
+import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
+import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
+
+@Configuration
+@EnableWebSocketMessageBroker
+public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
+
+    @Override
+    public void registerStompEndpoints(StompEndpointRegistry registry) {
+        registry.addEndpoint("/ws-notification")
+                .setAllowedOriginPatterns("http://localhost:*", "http://192.168.0.*")
+                .setHandshakeHandler(new DefaultHandshakeHandler())
+                .withSockJS()
+                .setSupressCors(true);
+    }
+
+    @Override
+    public void configureMessageBroker(MessageBrokerRegistry registry) {
+        // 客户端订阅路径前缀
+        registry.enableSimpleBroker("/topic");
+        // 客户端发送消息的路径前缀
+        registry.setApplicationDestinationPrefixes("/app");
+    }
+}

+ 12 - 3
hcp-platform/src/main/java/com/yingyangfly/platform/controller/PatientController.java

@@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.text.ParseException;
 import java.util.Date;
 import java.util.List;
 
@@ -127,7 +128,7 @@ public class PatientController {
     /**
      * 关闭订单
      */
-   /* @PostMapping("/delPayOrder")
+    @PostMapping("/delPayOrder")
     @TraceLog
     public ResultResponse delPayOrder(String orderNo,Long userId,String orderType) {
 
@@ -154,7 +155,7 @@ public class PatientController {
         }
 
         return ResultResponse.success();
-    }*/
+    }
 
 
     /**
@@ -182,7 +183,7 @@ public class PatientController {
     @PreAuthorize("@SSPermissionChecker.hasPermission('deal_apckage')")
     @Log(title = "不付费开通理疗功能")
     @PostMapping("/deal/package")
-    public ResultResponse dealPackage(@RequestBody DealPackageDto dealPackageDto){
+    public ResultResponse dealPackage(@RequestBody DealPackageDto dealPackageDto) throws ParseException {
         CurrentLoginUser currentUser = tokenUtil.getCurrentUser();
         if (!currentUser.getOrgCode().equals("system")) {
             SysOrg oryCodeSysOrg = sysOrgService.getOryCodeSysOrg(currentUser.getOrgCode());
@@ -200,5 +201,13 @@ public class PatientController {
         return ResultResponse.success(appUserService.resetPassWordSys(appUser));
     }
 
+    /**
+     * 更换设备
+     */
+    @PostMapping("/updatePadNo")
+    @TraceLog
+    public ResultResponse updatePadNo(@RequestBody AppUser appUser) {
+        return ResultResponse.success(appUserService.updatePadNo(appUser));
+    }
 
 }

+ 9 - 0
hcp-platform/src/main/java/com/yingyangfly/platform/controller/WxApplicationBlankController.java

@@ -48,4 +48,13 @@ public class WxApplicationBlankController {
         wxApplicationBlankService.updatePayStatusFulfill(id);
         return ResultResponse.success();
     }
+
+    /**
+     * 判断线上是否有支付成功患者
+     * @return
+     */
+    @GetMapping("succeed/message")
+    public ResultResponse succeedMessage() {
+        return ResultResponse.success(wxApplicationBlankService.succeedMessage());
+    }
 }

+ 1 - 0
hcp-platform/src/main/resources/application-dev.yml

@@ -121,6 +121,7 @@ security:
       - /system/dict/data/selectByDictType
       - /learn/package/tencent/learnPackage
       - /wx/tencent/**
+      - /ws-notification/*
 
 query-daily-trai: http://60.205.122.15/h5-training-daily/index.html