Browse Source

广电报备后台操作增加日志记录

mac 2 years ago
parent
commit
37128d7f78

+ 1 - 0
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/constant/enums/ErrorTypeEnum.java

@@ -39,6 +39,7 @@ public enum ErrorTypeEnum {
 	SYS_MORNING_IS_NULL(-1, "该晨会不存在"),
 	SYS_SCHOOL_IS_NULL(-1, "该学堂不存在"),
 	SYS_TYPE_ERROR(-1, "类型异常"),
+	PARAM_ERROR(0, "类型异常"),
 
 	;
 

+ 3 - 1
kxs-common/kxs-common-log/src/main/java/com/kxs/common/log/util/SysLogUtils.java

@@ -24,6 +24,7 @@ import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 
 import java.lang.reflect.Method;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
 
@@ -50,7 +51,8 @@ public class SysLogUtils {
 
 		// get 参数脱敏
 		SkyLogProperties logProperties = SpringContextHolder.getBean(SkyLogProperties.class);
-		Map<String, String[]> paramsMap = MapUtil.removeAny(request.getParameterMap(),
+		HashMap<String, String[]> requestMap = new HashMap<>(request.getParameterMap());
+		Map<String, String[]> paramsMap = MapUtil.removeAny(requestMap,
 				ArrayUtil.toArray(logProperties.getExcludeFields(), String.class));
 		sysLog.setParams(HttpUtil.toParams(paramsMap));
 		return sysLog;

+ 3 - 6
kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/controller/admin/SysGdController.java

@@ -6,8 +6,6 @@ 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;
@@ -17,7 +15,6 @@ 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.*;
 
 import java.util.List;
@@ -84,7 +81,7 @@ public class SysGdController {
      * @param param 实体对象
      * @return 广电报备-编辑
      */
-//    @SysLog("广电报备编辑")
+    @SysLog("广电报备编辑")
     @PutMapping("/update")
 //    @PreAuthorize("@pms.hasPermission('sys_gd_report_edit')")
     public R update(@RequestBody KxsGdReport param) {
@@ -98,12 +95,12 @@ public class SysGdController {
      * @param param 实体对象
      * @return 广电报备-作废
      */
-//    @SysLog("广电报备作废")
+    @SysLog("广电报备作废")
     @PutMapping("/cancel")
 //    @PreAuthorize("@pms.hasPermission('sys_gd_report_cancel')")
     public R cancel(@RequestBody KxsGdReport param) {
 
-        return R.ok(kxsGdReportService.cancelReport(param));
+        return R.ok(kxsGdReportService.cancelSysReport(param));
     }
 
     /**

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

@@ -106,7 +106,6 @@ public class GdController {
     @PutMapping("/cancel")
     public R cancel(@RequestBody KxsGdReport param) {
 
-        param.setUserId(SecurityUtils.getUser().getId().intValue());
         return R.ok(kxsGdReportService.cancelReport(param));
     }
 
@@ -123,44 +122,6 @@ public class GdController {
         return R.ok(kxsGdReportService.report(param));
     }
 
-    /**
-     * 广电报备-电渠列表
-     *
-     * @param page 分页对象
-     * @param status 状态
-     * @param keyword 关键字
-     * @return 广电报备-列表
-     */
-    @GetMapping("/dqPage")
-    public R dqPage(Page<GdReportListVO> page, @RequestParam("status") Integer status, @RequestParam(value = "keyword", required = false) String keyword) {
-
-        return R.ok(kxsGdReportService.getDqByPage(page, status, keyword));
-    }
-
-    /**
-     * 广电报备-电渠报备
-     *
-     * @param param 实体对象
-     * @return 广电报备-报备
-     */
-    @PostMapping("/dqReport")
-    public R dqReport(@RequestBody @Valid GdDqReportDTO param) {
-
-        return R.ok(kxsGdReportService.dqReport(param));
-    }
-
-
-    /**
-     * 广电报备-电渠数量接口
-     *
-     * @return 广电报备-数量接口
-     */
-    @GetMapping("/dqDot")
-    public R dqDot() {
-
-        return R.ok(kxsGdReportService.dqDotNum());
-    }
-
     @Inner(value = false)
     @PostMapping("/acceptActData")
     public Object acceptActData(@RequestBody Map<String, Object> param) {

+ 8 - 23
kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/service/KxsGdReportService.java

@@ -41,15 +41,6 @@ public interface KxsGdReportService extends IService<KxsGdReport> {
      */
     IPage<GdReportListVO> getByPage(Page<GdReportListVO> page, Integer status, Integer putType, String keyword);
 
-    /**
-     * 电渠分页
-     *
-     * @param page    页
-     * @param keyword 关键词
-     * @return {@link IPage}<{@link GdReportListVO}>
-     */
-    IPage<GdReportListVO> getDqByPage(Page<GdReportListVO> page, Integer status, String keyword);
-
 
     /**
      * 数量接口
@@ -66,6 +57,14 @@ public interface KxsGdReportService extends IService<KxsGdReport> {
      */
     Boolean cancelReport(KxsGdReport param);
 
+    /**
+     * 广电报备-后台作废
+     *
+     * @param param 参数
+     * @return {@link Boolean}
+     */
+    Boolean cancelSysReport(KxsGdReport param);
+
     /**
      * 报备
      *
@@ -100,20 +99,6 @@ public interface KxsGdReportService extends IService<KxsGdReport> {
      */
     IPage<MachineUnBindListVO> getByUnBindPage(Page<MachineUnBindListVO> page, String posSn);
 
-    /**
-     * 电渠报备
-     *
-     * @param param 参数
-     * @return {@link R}
-     */
-    Boolean dqReport(GdDqReportDTO param);
-
-    /**
-     * 电渠数量接口
-     *
-     * @return {@link GdDqDotNumVO}
-     */
-    GdDqDotNumVO dqDotNum();
 
 }
 

+ 26 - 60
kxs-product/kxs-product-biz/src/main/java/com/kxs/product/biz/service/impl/KxsGdReportServiceImpl.java

@@ -91,14 +91,6 @@ public class KxsGdReportServiceImpl extends ServiceImpl<KxsGdReportMapper, KxsGd
         return baseMapper.getByPage(page, userId, status, putType, keyword);
     }
 
-    @Override
-    public IPage<GdReportListVO> getDqByPage(Page<GdReportListVO> page, Integer status, String keyword) {
-
-        Long userId = SecurityUtils.getUser().getId();
-
-        return baseMapper.getDqByPage(page, userId, status, keyword);
-    }
-
     @Override
     public GdDotNumVO dotNum(Integer putType) {
 
@@ -123,14 +115,33 @@ public class KxsGdReportServiceImpl extends ServiceImpl<KxsGdReportMapper, KxsGd
     @Override
     public Boolean cancelReport(KxsGdReport param) {
 
-        Optional.ofNullable(param.getId()).orElseThrow(() -> new GlobalCustomerException("参数错误"));
+        Optional.ofNullable(param.getId()).orElseThrow(() -> new GlobalCustomerException(ErrorTypeEnum.PARAM_ERROR.getDescription()));
+
+        Long userId = SecurityUtils.getUser().getId();
         KxsGdReport kxsGdReport = this.getById(param.getId());
-        Optional.ofNullable(kxsGdReport).orElseThrow(() -> new GlobalCustomerException("参数错误"));
+        Optional.ofNullable(kxsGdReport).orElseThrow(() -> new GlobalCustomerException(ErrorTypeEnum.PARAM_ERROR.getDescription()));
         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());
+        if(Objects.equals(kxsGdReport.getUserId(), userId.intValue())){
+            throw new GlobalCustomerException(ErrorTypeEnum.PARAM_ERROR.getDescription());
+        }
+
+        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
+    public Boolean cancelSysReport(KxsGdReport param) {
+
+        Optional.ofNullable(param.getId()).orElseThrow(() -> new GlobalCustomerException(ErrorTypeEnum.PARAM_ERROR.getDescription()));
+
+        KxsGdReport kxsGdReport = this.getById(param.getId());
+        Optional.ofNullable(kxsGdReport).orElseThrow(() -> new GlobalCustomerException(ErrorTypeEnum.PARAM_ERROR.getDescription()));
+        if (Objects.equals(kxsGdReport.getIsCheck(), GdReportEnum.CHECK_SUC.getType())) {
+            throw new GlobalCustomerException("该工单已激活,无法作废");
         }
 
         return this.update(Wrappers.<KxsGdReport>lambdaUpdate().eq(KxsGdReport::getId, param.getId())
@@ -144,7 +155,7 @@ public class KxsGdReportServiceImpl extends ServiceImpl<KxsGdReportMapper, KxsGd
 
         KxsGdReport kxsGdReport = this.getById(param.getId());
 
-        Optional.ofNullable(kxsGdReport).orElseThrow(() -> new GlobalCustomerException("参数错误"));
+        Optional.ofNullable(kxsGdReport).orElseThrow(() -> new GlobalCustomerException(ErrorTypeEnum.PARAM_ERROR.getDescription()));
         if (!Objects.equals(kxsGdReport.getStatus(), GdReportEnum.PENDING.getType())) {
             throw new GlobalCustomerException("该工单状态错误");
         }
@@ -183,9 +194,9 @@ public class KxsGdReportServiceImpl extends ServiceImpl<KxsGdReportMapper, KxsGd
     @Override
     public Boolean updateData(KxsGdReport param) {
 
-        Optional.ofNullable(param.getId()).orElseThrow(() -> new GlobalCustomerException("参数错误"));
+        Optional.ofNullable(param.getId()).orElseThrow(() -> new GlobalCustomerException(ErrorTypeEnum.PARAM_ERROR.getDescription()));
         KxsGdReport kxsGdReport = this.getById(param.getId());
-        Optional.ofNullable(kxsGdReport).orElseThrow(() -> new GlobalCustomerException("参数错误"));
+        Optional.ofNullable(kxsGdReport).orElseThrow(() -> new GlobalCustomerException(ErrorTypeEnum.PARAM_ERROR.getDescription()));
 
         if (Objects.equals(kxsGdReport.getIsCheck(), GdReportEnum.CHECK_SUC.getType())) {
             throw new GlobalCustomerException("该工单已匹配,无法更新");
@@ -214,51 +225,6 @@ public class KxsGdReportServiceImpl extends ServiceImpl<KxsGdReportMapper, KxsGd
         return baseMapper.getByUnBindPage(page, userId, posSn);
     }
 
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public Boolean dqReport(GdDqReportDTO param) {
-
-        R<KxsUser> kxsUserR = remoteKxsUserService.loadUserById(SecurityUtils.getUser().getId(), SecurityConstants.FROM_IN);
-        KxsUser user = RetOps.of(kxsUserR)
-                .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());
-        kxsGdReport.setUsername(user.getUsername());
-        kxsGdReport.setUserCode(user.getUserCode());
-        kxsGdReport.setStatus(GdReportEnum.REPORT.getType());
-
-        return this.save(kxsGdReport);
-    }
-
-    @Override
-    public GdDqDotNumVO dqDotNum() {
-
-        Long userId = SecurityUtils.getUser().getId();
-        GdDqDotNumVO gdDotNumVO = new GdDqDotNumVO();
-        gdDotNumVO.setAllNum(Optional.of(this.count(Wrappers.<KxsGdReport>lambdaQuery().eq(KxsGdReport::getUserId, userId)
-                        .eq(KxsGdReport::getPutType, GdReportEnum.DQ.getType())))
-                .orElse(0L));
-        gdDotNumVO.setReportNum(Optional.of(this.count(Wrappers.<KxsGdReport>lambdaQuery()
-                        .eq(KxsGdReport::getUserId, userId)
-                        .eq(KxsGdReport::getStatus, GdReportEnum.REPORT.getType())
-                        .eq(KxsGdReport::getPutType, GdReportEnum.DQ.getType())))
-                .orElse(0L));
-        gdDotNumVO.setEndNum(Optional.of(this.count(Wrappers.<KxsGdReport>lambdaQuery()
-                        .eq(KxsGdReport::getUserId, userId)
-                        .eq(KxsGdReport::getPutType, GdReportEnum.DQ.getType())
-                        .eq(KxsGdReport::getIsCheck, GdReportEnum.CHECK_SUC)
-                        .eq(KxsGdReport::getStatus, GdReportEnum.CANCEL.getType())))
-                .orElse(0L));
-
-        return gdDotNumVO;
-    }
 
 
 }