guoshuai hace 2 días
padre
commit
f7f18d1838

+ 29 - 2
src/main/java/com/qmrb/system/controller/CaSignController.java

@@ -2468,8 +2468,9 @@ public class CaSignController {
             // map.put("data",base64);
             //
             // return Result.success(map);
-
-            byte[] imageBytes = iUserService.getCouponQRCodePng(toolWxConfigService.findConf(),key,redisKey);
+            //小程序跳转页面
+            String page = "pages/index/index";
+            byte[] imageBytes = iUserService.getCouponQRCodePng(toolWxConfigService.findConf(),key,redisKey,page);
             //保存当前时间戳
             redisTemplate.opsForValue().set(redisKey,System.currentTimeMillis(),fetchVehicleTime,TimeUnit.SECONDS);
             HttpHeaders headers = new HttpHeaders();
@@ -2481,6 +2482,32 @@ public class CaSignController {
         }
         return null;
     }
+    
+    
+    
+    /**
+     * 获取登记月租信息的二维码
+     * @return
+     */
+    @GetMapping("registerQrcode")
+    public ResponseEntity<?> registerQrcode(){
+        try {
+            String key = "registerey";
+            String redisKey = "";
+            //小程序跳转页面
+            String page = "pages/index/index2";
+
+            byte[] imageBytes = iUserService.getCouponQRCodePng(toolWxConfigService.findConf(),key,redisKey,page);
+
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.IMAGE_JPEG);
+            headers.setContentLength(imageBytes.length);
+            return new ResponseEntity<>(imageBytes, headers, HttpStatus.OK);
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+        }
+        return null;
+    }
 
 
     /**

+ 111 - 0
src/main/java/com/qmrb/system/controller/MonthlyParkingRegistrationController.java

@@ -0,0 +1,111 @@
+package com.qmrb.system.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.springdoc.core.annotations.ParameterObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmrb.system.common.result.PageResult;
+import com.qmrb.system.common.result.Result;
+import com.qmrb.system.common.result.ResultCode;
+import com.qmrb.system.framework.resubmit.Resubmit;
+import com.qmrb.system.service.IMonthlyParkingRegistrationService;
+import com.qmrb.system.pojo.form.MonthlyParkingRegistrationForm;
+import com.qmrb.system.pojo.vo.MonthlyParkingRegistrationVO;
+import com.qmrb.system.pojo.query.MonthlyParkingRegistrationQuery;
+import com.qmrb.system.pojo.vo.Option;
+
+import cn.hutool.core.util.StrUtil;
+import org.springframework.web.bind.annotation.RestController;
+import jakarta.validation.Valid;
+
+/**
+ * <p>
+ * 月租车登记信息表 前端控制器
+ * </p>
+ *
+ * @author gs
+ * @since 2025-04-03
+ */
+@Tag(name = "月租车登记信息表接口")
+@RestController
+@RequestMapping("/api/v1/parking_registration")
+@CrossOrigin
+public class MonthlyParkingRegistrationController{
+
+    @Autowired
+    private IMonthlyParkingRegistrationService monthlyParkingRegistrationService;
+
+	@Operation(summary = "月租车登记信息表分页列表", security = {@SecurityRequirement(name = "Authorization")})
+    @GetMapping("/page")
+    public PageResult<MonthlyParkingRegistrationVO> getPage(
+            @ParameterObject MonthlyParkingRegistrationQuery queryParams
+    ) {
+        Page<MonthlyParkingRegistrationVO> result = monthlyParkingRegistrationService.getPage(queryParams);
+        return PageResult.success(result);
+    }
+    
+    @Operation(summary = "新增月租车登记信息表", security = {@SecurityRequirement(name = "Authorization")})
+    @PostMapping
+    @Resubmit
+    public Result<MonthlyParkingRegistrationForm> saveForm(
+            @RequestBody @Valid MonthlyParkingRegistrationForm form
+    ) {
+        MonthlyParkingRegistrationForm result = monthlyParkingRegistrationService.saveForm(form);
+        return Result.success(result);
+    }
+
+    @Operation(summary = "月租车登记信息表表单数据", security = {@SecurityRequirement(name = "Authorization")})
+    @GetMapping("/{id}/form")
+    public Result<MonthlyParkingRegistrationForm> getForm(
+            @Parameter(description = "月租车登记信息表ID") @PathVariable Long id
+    ) {
+    	MonthlyParkingRegistrationForm formData = monthlyParkingRegistrationService.getFormData(id);
+        return Result.success(formData);
+    }
+
+    @Operation(summary = "修改月租车登记信息表", security = {@SecurityRequirement(name = "Authorization")})
+    @PutMapping(value = "/{id}")
+    public Result<?> updateForm(
+            @Parameter(description = "月租车登记信息表ID") @PathVariable Long id,
+            @RequestBody @Validated MonthlyParkingRegistrationForm form) {
+    	
+        boolean result = monthlyParkingRegistrationService.updateForm(id,form);
+        return Result.judge(result);
+    }
+
+    @Operation(summary = "删除月租车登记信息表", security = {@SecurityRequirement(name = "Authorization")})
+    @DeleteMapping("/{ids}")
+    public Result<?> deleteUsers(
+            @Parameter(description = "月租车登记信息表ID,多个以英文逗号(,)分割") @PathVariable String ids
+    ) {
+    	if(StrUtil.isBlank(ids)) {
+    		 return Result.failed(ResultCode.PARAM_ERROR, "删除的月租车登记信息表数据为空");
+    	}
+        // 逻辑删除
+        List<Long> idList = Arrays.asList(ids.split(",")).stream()
+                .map(idStr -> Long.parseLong(idStr)).collect(Collectors.toList());
+        boolean result = monthlyParkingRegistrationService.removeByIds(idList);
+        return Result.judge(result);
+    }
+    
+    
+
+
+}

+ 29 - 0
src/main/java/com/qmrb/system/converter/MonthlyParkingRegistrationConverter.java

@@ -0,0 +1,29 @@
+package com.qmrb.system.converter;
+
+import org.mapstruct.InheritInverseConfiguration;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmrb.system.pojo.entity.MonthlyParkingRegistration;
+import com.qmrb.system.pojo.form.MonthlyParkingRegistrationForm;
+import com.qmrb.system.pojo.vo.MonthlyParkingRegistrationVO;
+
+/**
+ * 月租车登记信息表数据项对象转换器
+ *
+ * @author gs
+ * @since 2025-04-03
+ */
+@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface MonthlyParkingRegistrationConverter {
+
+    Page<MonthlyParkingRegistrationVO> entity2Page(Page<MonthlyParkingRegistration> page);
+
+    MonthlyParkingRegistrationForm entity2Form(MonthlyParkingRegistration entity);
+
+    @InheritInverseConfiguration(name="entity2Form")
+    MonthlyParkingRegistration form2Entity(MonthlyParkingRegistrationForm form);
+    
+    MonthlyParkingRegistrationVO entity2Vo(MonthlyParkingRegistration entity);
+}

+ 1 - 0
src/main/java/com/qmrb/system/framework/security/config/SecurityConfig.java

@@ -103,6 +103,7 @@ public class SecurityConfig {
                         "/api/ucenter/**",
                         "/api/v1/auth/loginByMerchants",
                         "/api/v1/patientSign/fetchVehicleQrcode",
+                        "/api/v1/patientSign/registerQrcode",
                         "/api/order/wechatPayCallback"
 
                 );

+ 18 - 0
src/main/java/com/qmrb/system/mapper/MonthlyParkingRegistrationMapper.java

@@ -0,0 +1,18 @@
+package com.qmrb.system.mapper;
+
+import com.qmrb.system.pojo.entity.MonthlyParkingRegistration;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 月租车登记信息表 Mapper 接口
+ * </p>
+ *
+ * @author gs
+ * @since 2025-04-03
+ */
+@Mapper
+public interface MonthlyParkingRegistrationMapper extends BaseMapper<MonthlyParkingRegistration> {
+
+}

+ 69 - 0
src/main/java/com/qmrb/system/pojo/entity/MonthlyParkingRegistration.java

@@ -0,0 +1,69 @@
+package com.qmrb.system.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.qmrb.system.common.base.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 月租车登记信息表
+ * </p>
+ *
+ * @author gs
+ * @since 2025-04-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("monthly_parking_registration")
+public class MonthlyParkingRegistration extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 登记ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 用户微信openid
+     */
+    @TableField("openid")
+    private String openid;
+
+    /**
+     * 用户姓名
+     */
+    @TableField("name")
+    private String name;
+
+    /**
+     * 联系电话
+     */
+    @TableField("phone")
+    private String phone;
+
+    /**
+     * 需要车位数
+     */
+    @TableField("required_spots")
+    private Integer requiredSpots;
+
+    /**
+     * 居住地址
+     */
+    @TableField("address")
+    private String address;
+
+    /**
+     * 备注信息
+     */
+    @TableField("remark")
+    private String remark;
+
+
+}

+ 54 - 0
src/main/java/com/qmrb/system/pojo/form/MonthlyParkingRegistrationForm.java

@@ -0,0 +1,54 @@
+package com.qmrb.system.pojo.form;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * <p>
+ * 月租车登记信息表表单
+ * </p>
+ *
+ * @author gs
+ * @since 2025-04-03
+ */
+@Data
+public class MonthlyParkingRegistrationForm {
+
+    /**
+     * 登记ID
+     */
+	@Schema(description = "登记ID",type="Long")
+    private Long id;
+    /**
+     * 用户微信openid
+     */
+	@Schema(description = "用户微信openid",type="String")
+    private String openid;
+    /**
+     * 用户姓名
+     */
+	@Schema(description = "用户姓名",type="String")
+    private String name;
+    /**
+     * 联系电话
+     */
+	@Schema(description = "联系电话",type="String")
+    private String phone;
+    /**
+     * 需要车位数
+     */
+	@Schema(description = "需要车位数",type="Integer")
+    private Integer requiredSpots;
+    /**
+     * 居住地址
+     */
+	@Schema(description = "居住地址",type="String")
+    private String address;
+    /**
+     * 备注信息
+     */
+	@Schema(description = "备注信息",type="String")
+    private String remark;
+
+
+}

+ 60 - 0
src/main/java/com/qmrb/system/pojo/query/MonthlyParkingRegistrationQuery.java

@@ -0,0 +1,60 @@
+package com.qmrb.system.pojo.query;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import com.qmrb.system.common.base.BasePageQuery;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 月租车登记信息表查询对象
+ * </p>
+ *
+ * @author gs
+ * @since 2025-04-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class MonthlyParkingRegistrationQuery extends BasePageQuery{
+
+ 	@Schema(description="关键字")
+    private String keywords;
+
+    /**
+     * 登记ID
+     */
+	@Schema(description = "登记ID",type="Long")
+    private Long id;
+    /**
+     * 用户微信openid
+     */
+	@Schema(description = "用户微信openid",type="String")
+    private String openid;
+    /**
+     * 用户姓名
+     */
+	@Schema(description = "用户姓名",type="String")
+    private String name;
+    /**
+     * 联系电话
+     */
+	@Schema(description = "联系电话",type="String")
+    private String phone;
+    /**
+     * 需要车位数
+     */
+	@Schema(description = "需要车位数",type="Integer")
+    private Integer requiredSpots;
+    /**
+     * 居住地址
+     */
+	@Schema(description = "居住地址",type="String")
+    private String address;
+    /**
+     * 备注信息
+     */
+	@Schema(description = "备注信息",type="String")
+    private String remark;
+
+
+}

+ 58 - 0
src/main/java/com/qmrb/system/pojo/vo/MonthlyParkingRegistrationVO.java

@@ -0,0 +1,58 @@
+package com.qmrb.system.pojo.vo;
+
+import java.util.List;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * <p>
+ * 月租车登记信息表视图对象
+ * </p>
+ *
+ * @author gs
+ * @since 2025-04-03
+ */
+@Data
+public class MonthlyParkingRegistrationVO {
+
+    /**
+     * 登记ID
+     */
+	@Schema(description = "登记ID",type="Long")
+    private Long id;
+    /**
+     * 用户微信openid
+     */
+	@Schema(description = "用户微信openid",type="String")
+    private String openid;
+    /**
+     * 用户姓名
+     */
+	@Schema(description = "用户姓名",type="String")
+    private String name;
+    /**
+     * 联系电话
+     */
+	@Schema(description = "联系电话",type="String")
+    private String phone;
+    /**
+     * 需要车位数
+     */
+	@Schema(description = "需要车位数",type="Integer")
+    private Integer requiredSpots;
+    /**
+     * 居住地址
+     */
+	@Schema(description = "居住地址",type="String")
+    private String address;
+    /**
+     * 备注信息
+     */
+	@Schema(description = "备注信息",type="String")
+    private String remark;
+
+	@Schema(description = "子分类")
+    private List<MonthlyParkingRegistrationVO> children;
+
+
+}

+ 42 - 0
src/main/java/com/qmrb/system/service/IMonthlyParkingRegistrationService.java

@@ -0,0 +1,42 @@
+package com.qmrb.system.service;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmrb.system.pojo.entity.MonthlyParkingRegistration;
+import com.qmrb.system.pojo.form.MonthlyParkingRegistrationForm;
+import com.qmrb.system.pojo.vo.MonthlyParkingRegistrationVO;
+import com.qmrb.system.pojo.query.MonthlyParkingRegistrationQuery;
+import com.qmrb.system.pojo.vo.Option;
+import com.baomidou.mybatisplus.extension.service.IService;
+import jakarta.validation.Valid;
+
+/**
+ * <p>
+ * 月租车登记信息表 服务类
+ * </p>
+ *
+ * @author gs
+ * @since 2025-04-03
+ */
+public interface IMonthlyParkingRegistrationService extends IService<MonthlyParkingRegistration> {
+	
+	/**分页查询
+	 * */
+	public Page<MonthlyParkingRegistrationVO> getPage(MonthlyParkingRegistrationQuery queryParams);
+
+	/**
+	 * 保存表单
+	 * */
+	public MonthlyParkingRegistrationForm saveForm(@Valid MonthlyParkingRegistrationForm form);
+	
+	/**更新
+	 * */
+	public boolean updateForm(Long id, MonthlyParkingRegistrationForm form);
+	
+	/**获取表单数据
+	 * */
+	public MonthlyParkingRegistrationForm getFormData(Long id);
+	
+	
+}

+ 1 - 1
src/main/java/com/qmrb/system/service/UserService.java

@@ -36,5 +36,5 @@ public interface UserService extends IService<Order> {
 
     String getCouponQRCode(ToolWxConfig conf, String key, String redisKey);
 
-    byte[] getCouponQRCodePng(ToolWxConfig conf, String key, String redisKey);
+    byte[] getCouponQRCodePng(ToolWxConfig conf, String key, String redisKey, String page);
 }

+ 102 - 0
src/main/java/com/qmrb/system/service/impl/MonthlyParkingRegistrationServiceImpl.java

@@ -0,0 +1,102 @@
+package com.qmrb.system.service.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.qmrb.system.common.enums.StatusEnum;
+import com.qmrb.system.pojo.vo.Option;
+import com.qmrb.system.converter.MonthlyParkingRegistrationConverter;
+import com.qmrb.system.pojo.entity.MonthlyParkingRegistration;
+import com.qmrb.system.pojo.form.MonthlyParkingRegistrationForm;
+import com.qmrb.system.pojo.vo.MonthlyParkingRegistrationVO;
+import com.qmrb.system.pojo.query.MonthlyParkingRegistrationQuery;
+import com.qmrb.system.mapper.MonthlyParkingRegistrationMapper;
+import com.qmrb.system.service.IMonthlyParkingRegistrationService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.lang.Assert;
+import jakarta.validation.Valid;
+
+/**
+ * <p>
+ * 月租车登记信息表 服务实现类
+ * </p>
+ *
+ * @author gs
+ * @since 2025-04-03
+ */
+@Service
+public class MonthlyParkingRegistrationServiceImpl extends ServiceImpl<MonthlyParkingRegistrationMapper, MonthlyParkingRegistration> implements IMonthlyParkingRegistrationService {
+
+	@Autowired
+	private MonthlyParkingRegistrationConverter converter;
+
+	/**分页查询
+	 * */
+	@Override
+	public Page<MonthlyParkingRegistrationVO> getPage(MonthlyParkingRegistrationQuery queryParams) {
+		// 查询参数
+        int pageNum = queryParams.getPageNum();
+        int pageSize = queryParams.getPageSize();
+
+        //String keywords = queryParams.getKeywords();
+
+        // 查询数据
+        Page<MonthlyParkingRegistration> dictItemPage = this.page(
+                new Page<>(pageNum, pageSize),
+                new LambdaQueryWrapper<MonthlyParkingRegistration>()
+                	//.like(StrUtil.isNotBlank(keywords), MonthlyParkingRegistration::getCategoryName, keywords)
+        );
+
+        // 实体转换
+        Page<MonthlyParkingRegistrationVO> pageResult = converter.entity2Page(dictItemPage);
+        return pageResult;
+	}
+
+	/**
+	 * 保存表单
+	 * */
+	@Override
+	public MonthlyParkingRegistrationForm saveForm(@Valid MonthlyParkingRegistrationForm form) {
+		// 实体对象转换 form->entity
+		MonthlyParkingRegistration entity = converter.form2Entity(form);
+        // 持久化
+        this.save(entity);
+        MonthlyParkingRegistrationForm result = converter.entity2Form(entity);
+        return result;
+	}
+
+	/**更新
+	 * */
+	@Override
+	public boolean updateForm(Long id, MonthlyParkingRegistrationForm form) {
+		MonthlyParkingRegistration entity = converter.form2Entity(form);
+		entity.setId(id);
+        boolean result = this.updateById(entity);
+        return result;
+	}
+
+	/**获取表单数据
+	 * */
+	@Override
+	public MonthlyParkingRegistrationForm getFormData(Long id) {
+		// 获取entity
+		MonthlyParkingRegistration entity = this.getById(id);
+        Assert.isTrue(entity != null, "月租车登记信息表不存在");
+
+        // 实体转换
+        MonthlyParkingRegistrationForm form = converter.entity2Form(entity);
+        return form;
+	}
+	
+	
+}

+ 2 - 2
src/main/java/com/qmrb/system/service/impl/UserServiceImpl.java

@@ -210,7 +210,7 @@ public class UserServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     }
 
     @Override
-    public byte[] getCouponQRCodePng(ToolWxConfig conf, String key, String redisKey) {
+    public byte[] getCouponQRCodePng(ToolWxConfig conf, String key, String redisKey, String page) {
         String token =  getWxAccessToken(conf);
         
         Map<String, Object> resultObj = new HashMap();
@@ -234,7 +234,7 @@ public class UserServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             // 发送请求参数
             JSONObject jsonObject = new JSONObject();
             jsonObject.put("scene", key + "=" + redisKey); //参数自定义
-            jsonObject.put("page","pages/index/index");//要生成小程序码的链接
+            jsonObject.put("page",page);//要生成小程序码的链接
             jsonObject.put("width",500);
             jsonObject.put("env_version", conf.getEnvVersion());
             out.print(jsonObject);

+ 5 - 0
src/main/resources/mapper/MonthlyParkingRegistrationMapper.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.qmrb.system.mapper.MonthlyParkingRegistrationMapper">
+
+</mapper>