lyhzzz 9 месяцев назад
Родитель
Сommit
3b4a08a92a

+ 3 - 0
README.md

@@ -181,4 +181,7 @@
 1,添加接口,
     /service/manage/authorizeCamera/orderList      相机授权订单列表
     /service/manage/authorizeCamera/export         相机授权订单列表导出
+
+需求4:
+    列表旧接口service/manage/rtkDevice/list  多加参数,账号类型 accountType 0账号池,1专用账号,2账号池限期
 ~~~~

+ 6 - 1
src/main/java/com/fdkankan/manage/common/ResultCode.java

@@ -87,7 +87,7 @@ public enum ResultCode  {
     CAMERA_AUTHORIZE_TYPE_ERROR(50068, "请更换相同类型的相机"),
     FEEDBACK_OPTION_DELETE_ERROR(50069, "数据不存在或者预设数据不可删除"),
 
-    RTK_SN_CODE_NOT_EXIT(50070, "板卡SN码不存在,或未入库"),
+    RTK_SN_CODE_NOT_EXIT(50070, "板卡SN码不存在,或未入库,或禁用"),
     RTK_TOKEN_NOT_EXIT(50071, "缺少签名验证信息"),
     RTK_TOKEN_ERROR(50072, "签名校验失败"),
 
@@ -117,6 +117,11 @@ public enum ResultCode  {
     CAMERA_TYPE_ERROR3(50091, "当前账号未绑定此相机!"),
     RTK_UPDATE_ERROR(50092, "当前RTK设备不允许进行修改!"),
 
+    RTK_TIME_ERROR(50093, "当前授权期限内存在已授权的记录,请调整授权期限。"),
+
+    RTK_TIME_ERROR2(50094, "到期日期不能早于生效日期。"),
+
+
     ;
 
     private Integer code;

+ 43 - 0
src/main/java/com/fdkankan/manage/controller/AuthorizeRtkController.java

@@ -0,0 +1,43 @@
+package com.fdkankan.manage.controller;
+
+
+import com.fdkankan.manage.common.ResultData;
+import com.fdkankan.manage.entity.AuthorizeRtk;
+import com.fdkankan.manage.service.IAuthorizeRtkService;
+import com.fdkankan.manage.vo.request.AuthorizeParam;
+import com.fdkankan.manage.vo.request.AuthorizeRtkParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-24
+ */
+@RestController
+@RequestMapping("/service/manage/authorizeRtk")
+public class AuthorizeRtkController {
+
+    @Autowired
+    IAuthorizeRtkService authorizeRtkService;
+
+    @PostMapping("/addAuth")
+    public ResultData addAuth(@RequestBody AuthorizeRtk authorizeRtk){
+        authorizeRtkService.addAuth(authorizeRtk);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/authLog")
+    public ResultData authLog(@RequestBody AuthorizeRtkParam param){
+
+        return ResultData.ok(authorizeRtkService.pageList(param));
+    }
+}
+

+ 1 - 1
src/main/java/com/fdkankan/manage/entity/AuthorizeCamera.java

@@ -60,7 +60,7 @@ public class AuthorizeCamera implements Serializable {
     /**
      * 使用类型
      */
-    @ExcelProperty(value = "终端客户",index = 9,converter = CustomDateConverter.class)
+    @ExcelProperty(value = "使用类型",index = 9,converter = CustomDateConverter.class)
     @TableField("use_type")
     private Integer useType;
 

+ 138 - 0
src/main/java/com/fdkankan/manage/entity/AuthorizeRtk.java

@@ -0,0 +1,138 @@
+package com.fdkankan.manage.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-24
+ */
+@Getter
+@Setter
+@TableName("t_authorize_rtk")
+public class AuthorizeRtk implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 客户名称
+     */
+    @TableField("customer_name")
+    private String customerName;
+
+    /**
+     * 客户类别0直销,1经销
+     */
+    @TableField("customer_type")
+    private Integer customerType;
+
+    /**
+     * 终端客户
+     */
+    @TableField("end_customer")
+    private String endCustomer;
+
+    /**
+     * 使用类型
+     */
+    @TableField("use_type")
+    private Integer useType;
+
+    /**
+     * 项目号
+     */
+    @TableField("project_num")
+    private String projectNum;
+
+    /**
+     * 备注
+     */
+    @TableField("remark")
+    private String remark;
+
+    /**
+     * 合同所属公司
+     */
+    @TableField("company_name")
+    private String companyName;
+
+    /**
+     * 业务部门
+     */
+    @TableField("business_dept")
+    private String businessDept;
+
+    /**
+     * 业务员
+     */
+    @TableField("business_name")
+    private String businessName;
+
+    /**
+     * 客户付款时间
+     */
+    @TableField("customer_pay_time")
+    private String customerPayTime;
+
+    /**
+     * rtksn
+     */
+    @TableField("rtk_code")
+    private String rtkCode;
+
+    /**
+     * 创建人
+     */
+    @TableField("sys_user_id")
+    private Long sysUserId;
+
+    @TableField(exist = false)
+    private String sysUserName;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    @TableField("amount")
+    private BigDecimal amount;
+
+    @TableField("currency_symbol")
+    private String currencySymbol;
+
+    @TableField("order_sn")
+    private String orderSn;
+
+    @TableField("valid_day")
+    private String validDay;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @TableField("valid_start_time")
+    private Date validStartTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @TableField("valid_end_time")
+    private Date validEndTime;
+}

+ 13 - 0
src/main/java/com/fdkankan/manage/entity/RtkDevice.java

@@ -39,9 +39,15 @@ public class RtkDevice implements Serializable {
     @TableField("rtk_type")
     private Integer rtkType;
 
+    /**
+     * 0正常,1禁用
+     */
     @TableField("use_status")
     private Integer useStatus;
 
+    /**
+     * 0账号池,1专用账号,2账号池限期
+     */
     @TableField("account_type")
     private Integer accountType;
 
@@ -97,4 +103,11 @@ public class RtkDevice implements Serializable {
     @TableField(exist = false)
     private String createNickName;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @TableField("valid_start_time")
+    private Date validStartTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @TableField("valid_end_time")
+    private Date validEndTime;
 }

+ 1 - 1
src/main/java/com/fdkankan/manage/generate/AutoGenerate.java

@@ -18,7 +18,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir");
 
         generate(path,"manage", getTables(new String[]{
-                "t_rtk_update_log"
+                "t_authorize_rtk"
         }));
 
 //        generate(path,"goods", getTables(new String[]{

+ 18 - 0
src/main/java/com/fdkankan/manage/mapper/IAuthorizeRtkMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.manage.mapper;
+
+import com.fdkankan.manage.entity.AuthorizeRtk;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-24
+ */
+@Mapper
+public interface IAuthorizeRtkMapper extends BaseMapper<AuthorizeRtk> {
+
+}

+ 20 - 0
src/main/java/com/fdkankan/manage/service/IAuthorizeRtkService.java

@@ -0,0 +1,20 @@
+package com.fdkankan.manage.service;
+
+import com.fdkankan.manage.entity.AuthorizeRtk;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.manage.vo.request.AuthorizeRtkParam;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-24
+ */
+public interface IAuthorizeRtkService extends IService<AuthorizeRtk> {
+
+    void addAuth(AuthorizeRtk authorizeRtk);
+
+    Object pageList(AuthorizeRtkParam param);
+}

+ 2 - 0
src/main/java/com/fdkankan/manage/service/IRtkDeviceService.java

@@ -33,4 +33,6 @@ public interface IRtkDeviceService extends IService<RtkDevice> {
     Integer insExcelList(List<HashMap<Integer, String>> excelRowList);
 
     void updateTypeById(Integer id, Integer rtkType);
+
+    void updateValidTime(Integer id, String startTime, String endTime);
 }

+ 2 - 1
src/main/java/com/fdkankan/manage/service/impl/AuthorizeCameraServiceImpl.java

@@ -63,7 +63,7 @@ public class AuthorizeCameraServiceImpl extends ServiceImpl<IAuthorizeCameraMapp
     @Override
     public Object pageList(AuthorizeParam param) {
 
-        return this.pageListByParam(param);
+        return PageInfo.PageInfo(this.pageListByParam(param));
     }
     private  Page<AuthorizeCamera> pageListByParam(AuthorizeParam param){
         Page<AuthorizeCamera> page = getBaseMapper().pageList(new Page<>(param.getPageNum(), param.getPageSize()), param);
@@ -225,6 +225,7 @@ public class AuthorizeCameraServiceImpl extends ServiceImpl<IAuthorizeCameraMapp
         AuthorizeParam orderParam = CacheUtil.authorizeParam;
         orderParam.setPageNum(1);
         orderParam.setPageSize(5000);
+        orderParam.setListType("order");
         Page<AuthorizeCamera> page = this.pageListByParam(orderParam);
 
         ExcelWriter excelWriter = null;

+ 93 - 0
src/main/java/com/fdkankan/manage/service/impl/AuthorizeRtkServiceImpl.java

@@ -0,0 +1,93 @@
+package com.fdkankan.manage.service.impl;
+
+import cn.dev33.satoken.stp.StpUtil;
+import cn.hutool.core.date.DateUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.manage.common.PageInfo;
+import com.fdkankan.manage.common.ResultCode;
+import com.fdkankan.manage.entity.AuthorizeRtk;
+import com.fdkankan.manage.entity.RtkDevice;
+import com.fdkankan.manage.entity.SysUser;
+import com.fdkankan.manage.exception.BusinessException;
+import com.fdkankan.manage.mapper.IAuthorizeRtkMapper;
+import com.fdkankan.manage.service.IAuthorizeRtkService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.manage.service.IRtkDeviceService;
+import com.fdkankan.manage.service.ISysUserService;
+import com.fdkankan.manage.util.DateUtils;
+import com.fdkankan.manage.vo.request.AuthorizeRtkParam;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-24
+ */
+@Service
+public class AuthorizeRtkServiceImpl extends ServiceImpl<IAuthorizeRtkMapper, AuthorizeRtk> implements IAuthorizeRtkService {
+
+    @Autowired
+    IRtkDeviceService rtkDeviceService;
+    @Autowired
+    ISysUserService sysUserService;
+    @Override
+    public void addAuth(AuthorizeRtk authorizeRtk) {
+        if(StringUtils.isBlank(authorizeRtk.getRtkCode()) ||authorizeRtk.getValidStartTime() == null || authorizeRtk.getValidEndTime() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        RtkDevice rtkDevice = rtkDeviceService.getByRtkSnCode(authorizeRtk.getRtkCode());
+        if(rtkDevice == null || rtkDevice.getUseStatus() ==1){
+            throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_EXIT);
+        }
+        if(rtkDevice.getValidStartTime() != null || rtkDevice.getValidEndTime() != null){
+            throw new BusinessException(ResultCode.RTK_TIME_ERROR);
+        }
+        if(authorizeRtk.getValidEndTime().before(authorizeRtk.getValidStartTime())){
+            throw new BusinessException(ResultCode.RTK_TIME_ERROR2);
+        }
+
+        String startTime = DateUtils.getStartTime(authorizeRtk.getValidStartTime());
+        String endTime = DateUtils.getEndTime(authorizeRtk.getValidEndTime());
+        rtkDeviceService.updateValidTime(rtkDevice.getId(),startTime,endTime);
+
+        authorizeRtk.setValidStartTime(DateUtil.parse(startTime));
+        authorizeRtk.setValidEndTime(DateUtil.parse(endTime));
+        authorizeRtk.setSysUserId(Long.valueOf(StpUtil.getLoginId().toString()));
+        this.save(authorizeRtk);
+
+
+    }
+
+    @Override
+    public Object pageList(AuthorizeRtkParam param) {
+        if(StringUtils.isBlank(param.getRktCode())){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        LambdaQueryWrapper<AuthorizeRtk> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(AuthorizeRtk::getRtkCode,param.getRktCode());
+        wrapper.orderByDesc(AuthorizeRtk::getId);
+        Page<AuthorizeRtk> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
+        Set<Long> sysIds = page.getRecords().stream().map(AuthorizeRtk::getSysUserId).collect(Collectors.toSet());
+        HashMap<Long, SysUser> userMap = sysUserService.getByIds(sysIds);
+        for (AuthorizeRtk record : page.getRecords()) {
+            SysUser sysUser = userMap.get(record.getSysUserId());
+            if(sysUser != null){
+                record.setSysUserName(sysUser.getNickName());
+            }
+        }
+
+        return PageInfo.PageInfo(page);
+    }
+}

+ 13 - 0
src/main/java/com/fdkankan/manage/service/impl/RtkDeviceServiceImpl.java

@@ -78,6 +78,9 @@ public class RtkDeviceServiceImpl extends ServiceImpl<IRtkDeviceMapper, RtkDevic
         if(StringUtils.isNotBlank(param.getStartTime())&& StringUtils.isNotBlank(param.getEndTime()) ) {
             wrapper.between(RtkDevice::getCreateTime,param.getStartTime(),param.getEndTime());
         }
+        if(param.getAccountType() != null){
+            wrapper.eq(RtkDevice::getAccountType,param.getAccountType());
+        }
         wrapper.orderByDesc(RtkDevice::getCreateTime);
         wrapper.orderByDesc(RtkDevice::getId);
         Page<RtkDevice> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
@@ -286,4 +289,14 @@ public class RtkDeviceServiceImpl extends ServiceImpl<IRtkDeviceMapper, RtkDevic
         this.saveBatch(dbs);
         return dbs.size();
     }
+
+
+    @Override
+    public void updateValidTime(Integer id, String startTime, String endTime) {
+        LambdaUpdateWrapper<RtkDevice> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(RtkDevice::getId,id);
+        wrapper.set(RtkDevice::getValidStartTime,startTime);
+        wrapper.set(RtkDevice::getValidEndTime,endTime);
+        this.update(wrapper);
+    }
 }

+ 11 - 0
src/main/java/com/fdkankan/manage/util/DateUtils.java

@@ -1,5 +1,6 @@
 package com.fdkankan.manage.util;
 
+import cn.hutool.core.date.DateUtil;
 import com.fdkankan.manage.entity.IncrementType;
 import org.apache.commons.lang3.StringUtils;
 import org.joda.time.DateTime;
@@ -240,4 +241,14 @@ public class DateUtils {
             default: return dateTime;
         }
     }
+
+    public  static String getStartTime(Date date){
+        String format = DateUtil.format(date, "yyyy-MM-dd");
+        return format + " 00:00:00";
+    }
+
+    public  static String getEndTime(Date date){
+        String format = DateUtil.format(date, "yyyy-MM-dd");
+        return format + " 23:59:59";
+    }
 }

+ 2 - 0
src/main/java/com/fdkankan/manage/vo/request/AuthorizeParam.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.util.Date;
 
 @Data
@@ -37,4 +38,5 @@ public class AuthorizeParam extends RequestBase{
     private String orderSn;
 
     private String listType;
+    private BigDecimal amount;
 }

+ 8 - 0
src/main/java/com/fdkankan/manage/vo/request/AuthorizeRtkParam.java

@@ -0,0 +1,8 @@
+package com.fdkankan.manage.vo.request;
+
+import lombok.Data;
+
+@Data
+public class AuthorizeRtkParam extends RequestBase{
+    private String rktCode;
+}

+ 1 - 0
src/main/java/com/fdkankan/manage/vo/request/RtkInfoParam.java

@@ -13,6 +13,7 @@ public class RtkInfoParam extends RequestBase{
     private String cameraSn;
     private String sgRtkSn;
     private Integer useType;
+    private Integer accountType;
 
     private List<String> timeList;
 

+ 3 - 0
src/main/resources/mapper/manage/AuthorizeCameraMapper.xml

@@ -34,6 +34,9 @@
         <if test="param.snCode != null and param.snCode !=''">
             and d.sn_code like concat('%',#{param.snCode},'%')
         </if>
+        <if test="param.amount != null ">
+            and c.amount = #{amount}
+        </if>
         order by c.id desc
     </select>
 </mapper>

+ 5 - 0
src/main/resources/mapper/manage/AuthorizeRtkMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.manage.mapper.IAuthorizeRtkMapper">
+
+</mapper>