Prechádzať zdrojové kódy

广电报备后台新增作废接口,新增操作日志

mac 2 rokov pred
rodič
commit
8de87024b3

+ 1 - 1
install.txt

@@ -10,4 +10,4 @@ mvn clean package -Dmaven.test.skip=true -P dev
 1): spring.profiles.active=test  代表测试环境
 2): spring.profiles.active=prod  代表正式环境
 3): -Xms4g -Xmx4g 根据运行服务器的内存大小调整,一般不超过机器最大内存的80%
-4): -XX:HeapDumpPath=/opt/jdk17/errorDump.hprof 指定内存溢出oom错误日志存放路径,方便线上排查问题
+4): -XX:HeapDumpPath=/opt/jdk17/errorDump.hprof 指定内存溢出oom错误日志存放路径,方便线上排查问题

+ 32 - 11
kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/controller/admin/SysGdController.java

@@ -5,14 +5,18 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.kxs.common.core.util.R;
 import com.kxs.common.idempotent.annotation.Idempotent;
+import com.kxs.common.log.annotation.SysLog;
 import com.kxs.common.security.annotation.Inner;
+import com.kxs.common.security.util.SecurityUtils;
 import com.kxs.product.api.model.KxsGdOrder;
 import com.kxs.product.api.model.KxsGdReport;
 import com.kxs.product.biz.constant.enums.GdReportEnum;
 import com.kxs.product.biz.service.KxsGdOrderService;
 import com.kxs.product.biz.service.KxsGdReportService;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
 import lombok.RequiredArgsConstructor;
 import org.springdoc.core.annotations.ParameterObject;
+import org.springframework.http.HttpHeaders;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
@@ -26,7 +30,8 @@ import java.util.List;
  */
 @RestController
 @RequiredArgsConstructor
-@RequestMapping("sysGd")
+@RequestMapping("/sysGd")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
 public class SysGdController {
 
     /**
@@ -58,32 +63,47 @@ public class SysGdController {
     }
 
 
+    /**
+     * 广电报备-匹配数据
+     *
+     * @param startTime 开始时间
+     * @param endTime 结束时间
+     * @return 广电报备-编辑
+     */
+    @Idempotent(key = "#startTime", expireTime = 15, info = "请于15秒后重试")
+//    @PreAuthorize("@pms.hasPermission('sys_gd_report_check')")
+    @GetMapping("/check")
+    public R check(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
+
+        return kxsGdReportService.checkGdData(startTime, endTime);
+    }
+
     /**
      * 广电报备-编辑
      *
      * @param param 实体对象
      * @return 广电报备-编辑
      */
-//    @PreAuthorize("@pms.hasPermission('sys_gd_report_edit')")
+    @SysLog("广电报备编辑")
     @PutMapping("/update")
+//    @PreAuthorize("@pms.hasPermission('sys_gd_report_edit')")
     public R update(@RequestBody KxsGdReport param) {
 
         return R.ok(kxsGdReportService.updateData(param));
     }
 
     /**
-     * 广电报备-匹配数据
+     * 广电报备-作废
      *
-     * @param startTime 开始时间
-     * @param endTime 结束时间
-     * @return 广电报备-编辑
+     * @param param 实体对象
+     * @return 广电报备-作废
      */
-    @Idempotent(key = "#startTime", expireTime = 15, info = "请于15秒后重试")
-//    @PreAuthorize("@pms.hasPermission('sys_gd_report_check')")
-    @GetMapping("/check")
-    public R check(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
+    @SysLog("广电报备作废")
+    @PutMapping("/cancel")
+//    @PreAuthorize("@pms.hasPermission('sys_gd_report_cancel')")
+    public R cancel(@RequestBody KxsGdReport param) {
 
-        return kxsGdReportService.checkGdData(startTime, endTime);
+        return R.ok(kxsGdReportService.cancelReport(param));
     }
 
     /**
@@ -101,6 +121,7 @@ public class SysGdController {
      * 广电报备-人工推送激活
      *
      */
+    @SysLog("广电报备人工推送激活")
     @GetMapping("/toAct")
 //    @PreAuthorize("@pms.hasPermission('sys_gd_to_act')")
     public R toAct(@RequestParam("id") Integer id) {

+ 2 - 0
kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/controller/kxsapp/GdController.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.kxs.common.core.util.R;
 import com.kxs.common.security.annotation.Inner;
+import com.kxs.common.security.util.SecurityUtils;
 import com.kxs.product.api.dto.kxsapp.gd.GdDqActDataRes;
 import com.kxs.product.api.dto.kxsapp.gd.GdDqReportDTO;
 import com.kxs.product.api.dto.kxsapp.gd.GdReportDTO;
@@ -105,6 +106,7 @@ public class GdController {
     @PutMapping("/cancel")
     public R cancel(@RequestBody KxsGdReport param) {
 
+        param.setUserId(SecurityUtils.getUser().getId().intValue());
         return R.ok(kxsGdReportService.cancelReport(param));
     }
 

+ 35 - 7
kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/service/impl/KxsGdReportServiceImpl.java

@@ -21,13 +21,16 @@ import com.kxs.product.api.amqp.rabbit.RabbitGdActQueueMQ;
 import com.kxs.product.api.dto.kxsapp.gd.GdDqReportDTO;
 import com.kxs.product.api.dto.kxsapp.gd.GdReportDTO;
 import com.kxs.product.api.dto.kxsapp.gd.GdReportPutDTO;
+import com.kxs.product.api.model.KxsGdOrder;
 import com.kxs.product.api.model.KxsGdReport;
 import com.kxs.product.api.vo.kxsapp.gd.GdDotNumVO;
 import com.kxs.product.api.vo.kxsapp.gd.GdDqDotNumVO;
 import com.kxs.product.api.vo.kxsapp.gd.GdReportListVO;
 import com.kxs.product.api.vo.kxsapp.machine.MachineUnBindListVO;
 import com.kxs.product.biz.constant.enums.GdReportEnum;
+import com.kxs.product.biz.constant.enums.ProductErrorTypeEnum;
 import com.kxs.product.biz.mapper.KxsGdReportMapper;
+import com.kxs.product.biz.service.KxsGdOrderService;
 import com.kxs.product.biz.service.KxsGdReportService;
 import com.kxs.product.biz.service.KxsGdService;
 import com.kxs.product.biz.util.GdRsaUtils;
@@ -36,6 +39,7 @@ import com.kxs.user.api.model.KxsUser;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -58,6 +62,7 @@ public class KxsGdReportServiceImpl extends ServiceImpl<KxsGdReportMapper, KxsGd
     private final RemoteKxsUserService remoteKxsUserService;
 
     private final KxsGdService kxsGdService;
+    private final KxsGdOrderService kxsGdOrderService;
 
 
     @Override
@@ -124,10 +129,14 @@ public class KxsGdReportServiceImpl extends ServiceImpl<KxsGdReportMapper, KxsGd
         if (Objects.equals(kxsGdReport.getStatus(), GdReportEnum.REPORT.getType())) {
             throw new GlobalCustomerException("该工单已报备,无法作废");
         }
+        if(param.getUserId() != null && !Objects.equals(kxsGdReport.getUserId(), param.getUserId())){
+            throw new GlobalCustomerException(ProductErrorTypeEnum.DATA_EMPTY.getDescription());
+        }
 
-        kxsGdReport.setStatus(GdReportEnum.CANCEL.getType());
-
-        return this.updateById(kxsGdReport);
+        return this.update(Wrappers.<KxsGdReport>lambdaUpdate().eq(KxsGdReport::getId, param.getId())
+                .set(KxsGdReport::getStatus, GdReportEnum.CANCEL.getType())
+                .set(KxsGdReport::getGdMobile, null)
+                .set(KxsGdReport::getGdSn, null));
     }
 
     @Override
@@ -140,13 +149,16 @@ public class KxsGdReportServiceImpl extends ServiceImpl<KxsGdReportMapper, KxsGd
             throw new GlobalCustomerException("该工单状态错误");
         }
         //判断sn是否重复
-        KxsGdReport report = this.getOne(Wrappers.<KxsGdReport>lambdaQuery().eq(KxsGdReport::getGdSn, param.getGdSn()));
+        KxsGdReport report = this.getOne(Wrappers.<KxsGdReport>lambdaQuery()
+                .eq(KxsGdReport::getGdSn, param.getGdSn()));
         if (report != null) {
-            throw new GlobalCustomerException("该工单sn已报备");
+            throw new GlobalCustomerException("该sn已报备");
         }
-        KxsGdReport reportMobile = this.getOne(Wrappers.<KxsGdReport>lambdaQuery().eq(KxsGdReport::getGdMobile, param.getGdMobile()));
+        //判断手机号码是否重复
+        KxsGdReport reportMobile = this.getOne(Wrappers.<KxsGdReport>lambdaQuery()
+                .eq(KxsGdReport::getGdMobile, param.getGdMobile()));
         if (reportMobile != null) {
-            throw new GlobalCustomerException("该工单广电手机号码已报备");
+            throw new GlobalCustomerException("该手机号码已报备");
         }
 
 
@@ -154,6 +166,17 @@ public class KxsGdReportServiceImpl extends ServiceImpl<KxsGdReportMapper, KxsGd
         kxsGdReport.setGdMobile(param.getGdMobile());
         kxsGdReport.setGdSn(param.getGdSn());
 
+        //判断报备的手机号码是否已经激活
+        KxsGdOrder order = kxsGdOrderService.getOne(Wrappers.<KxsGdOrder>lambdaQuery()
+                .eq(KxsGdOrder::getGdMobile, kxsGdReport.getGdMobile())
+                .eq(KxsGdOrder::getReceiveMobile, kxsGdReport.getPutMobile()));
+        //激活成功
+        if (order != null && order.getStatus() == 6) {
+            kxsGdService.toSendMq(order, kxsGdReport.getGdSn());
+            //修改为已匹配
+            kxsGdReport.setIsCheck(GdReportEnum.CHECK_SUC.getType());
+        }
+
         return this.updateById(kxsGdReport);
     }
 
@@ -192,6 +215,7 @@ public class KxsGdReportServiceImpl extends ServiceImpl<KxsGdReportMapper, KxsGd
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean dqReport(GdDqReportDTO param) {
 
         R<KxsUser> kxsUserR = remoteKxsUserService.loadUserById(SecurityUtils.getUser().getId(), SecurityConstants.FROM_IN);
@@ -199,6 +223,10 @@ public class KxsGdReportServiceImpl extends ServiceImpl<KxsGdReportMapper, KxsGd
                 .getData()
                 .orElseThrow(() -> new GlobalCustomerException(ErrorTypeEnum.USER_NOT_FOUND.getDescription()));
 
+        KxsGdReport report = getOne(Wrappers.<KxsGdReport>lambdaQuery().eq(KxsGdReport::getGdMobile, param.getGdMobile()));
+        if(report != null){
+            throw new GlobalCustomerException("该广电号码已报备");
+        }
         KxsGdReport kxsGdReport = new KxsGdReport();
         BeanUtil.copyProperties(param, kxsGdReport);
         kxsGdReport.setUserId(user.getId());

+ 1 - 1
kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/service/impl/KxsMachineAdvanceServiceImpl.java

@@ -279,7 +279,7 @@ public class KxsMachineAdvanceServiceImpl extends ServiceImpl<KxsMachineAdvanceM
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
+    @GlobalTransactional(rollbackFor = Exception.class)
     public R confirmAdvanceMachine(ConfirmAdvanceMachineDTO param) {
 
         Long userId = SecurityUtils.getUser().getId();