Explorar o código

feat:“添加diy使用密码“

soobin hai 1 ano
pai
achega
e182e537fa

+ 12 - 0
src/main/java/com/szwl/controller/IndexController.java

@@ -2338,5 +2338,17 @@ public class IndexController {
         return "fail";
     }
 
+    /**
+     * 获取DIY使用密码
+     * @return
+     */
+    @RequestMapping(value = "/getDIYPassword", method = RequestMethod.GET, produces = "text/html;charset=utf-8")
+    @ResponseBody
+    public String getDIYPassword() {
+        TAdmin admin = adminService.getById(1L);
+        String diyPassword = admin.getDiyPassword();
+        return diyPassword;
+    }
+
 }
 

+ 40 - 1
src/main/java/com/szwl/controller/TEquipmentController.java

@@ -1791,33 +1791,72 @@ public class TEquipmentController {
         return R.ok();
     }
 
+    /**
+     * 查询指定设备在指定日期的日志是否已上传至七牛云。
+     *
+     * @param equipmentId 设备ID,用于查询日志所属设备。
+     * @param day 日期,格式为"yyyy-MM-dd",用于指定要查询的日志日期。
+     * @return 返回一个响应模型对象,如果日志已上传则返回成功信息和日志文件名,否则返回失败信息。
+     */
     @ApiOperation(value = "查询日志是否上传成功")
     @GetMapping("/queryLog")
     public ResponseModel<?> queryLog(String equipmentId, String day) {
+        // 检查设备ID是否为空
         if (StringUtils.isEmpty(equipmentId)) {
             return R.fail(A0001);
         }
+        // 根据设备ID查询设备信息
         TEquipment tEquipment = tEquipmentService.getById(equipmentId);
         if (tEquipment == null) {
             return R.fail(A0001, "该设备不存在");
         }
+        // 根据设备ID和日期构造日志文件名
         String clientId = tEquipment.getClientId();
         String key = "log/" + day + "-" + clientId + ".txt";
-        //构造一个带指定 Region 对象的配置类
+
+        // 配置七牛云连接
         Configuration cfg = new Configuration(Region.region2());
         Auth auth = Auth.create(ConfigConsts.QINIU_CLOUD_ACCESS_KEY, ConfigConsts.QINIU_CLOUD_SECRET_KEY);
         BucketManager bucketManager = new BucketManager(auth, cfg);
+
         boolean flag = true;
         try {
+            // 尝试获取指定文件信息,判断文件是否存在
             FileInfo fileInfo = bucketManager.stat(ConfigConsts.QINIU_CLOUD_BUCKET, key);
         } catch (QiniuException ex) {
             System.err.println(ex.response.error);
             flag = false;
         }
+
+        // 根据文件是否存在返回相应结果
         if (flag) {
             return R.ok(key);
         }
         return R.fail(F0002);
     }
+
+    /**
+     * 修改DIY功能使用的密码
+     *
+     * @param diyPassword 新的DIY功能密码
+     * @return 返回操作结果,成功返回成功标志,失败返回错误代码
+     */
+    @ApiOperation(value = "修改diy功能使用密码")
+    @GetMapping("/updateDIYPassword")
+    public ResponseModel<?> updateDIYPassword(String diyPassword) {
+        // 检查传入的DIY密码是否为空
+        if (StringUtils.isEmpty(diyPassword)) {
+            return R.fail(A0001);
+        }
+        // 获取管理员对象
+        TAdmin admin = tAdminService.getById(1L);
+        // 设置新的DIY密码
+        admin.setDiyPassword(diyPassword);
+        // 更新管理员信息
+        tAdminService.updateById(admin);
+        // 返回操作成功标志
+        return R.ok();
+    }
+
 }
 

+ 2 - 1
src/main/java/com/szwl/mapper/xml/TAdminMapper.xml

@@ -42,11 +42,12 @@
         <result column="manager_id" property="managerId" />
         <result column="company_type" property="companyType" />
         <result column="currency_symbol" property="currencySymbol" />
+        <result column="diy_password" property="diyPassword" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, create_date, modify_date, agency_id, area_id, qr_code_img_url, department, email, is_admined, is_enabled, is_locked, locked_date, login_date, login_failure_count, login_ip, merchant_id, trade_merchant_no, name, parent_id, password, personage_id, notice_id, type, username, phone, is_refund, if_foreign, open, promo_code_open, apply_start_time, apply_end_time, code, pay_platform, logo_rule, relation_admin_id, manager_id, company_type, currency_symbol
+        id, create_date, modify_date, agency_id, area_id, qr_code_img_url, department, email, is_admined, is_enabled, is_locked, locked_date, login_date, login_failure_count, login_ip, merchant_id, trade_merchant_no, name, parent_id, password, personage_id, notice_id, type, username, phone, is_refund, if_foreign, open, promo_code_open, apply_start_time, apply_end_time, code, pay_platform, logo_rule, relation_admin_id, manager_id, company_type, currency_symbol, diy_password
     </sql>
     <select id="queryByXml" resultType="com.szwl.model.entity.TAdmin">
         select * from t_admin a

+ 3 - 0
src/main/java/com/szwl/model/entity/TAdmin.java

@@ -148,5 +148,8 @@ public class TAdmin implements Serializable {
     @ApiModelProperty(value = "自定义货币符号")
     private String currencySymbol;
 
+    @ApiModelProperty(value = "DIY功能使用密码")
+    private String diyPassword;
+
 
 }