From b9036b872506fa88d1e82dbb7fc36ee5b3808926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com> Date: Mon, 23 Sep 2024 13:43:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B09.23?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fuint/business/userManager/entity/LJUser.java | 6 ++++++ .../src/main/java/com/fuint/repository/model/MtUser.java | 3 +++ 2 files changed, 9 insertions(+) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/entity/LJUser.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/entity/LJUser.java index 96229d9ce..66913f7d6 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/entity/LJUser.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/entity/LJUser.java @@ -13,6 +13,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; +import javax.validation.constraints.Pattern; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; @@ -88,6 +89,11 @@ public class LJUser extends BaseEntity implements Serializable { @ApiModelProperty("公众号") private String official; + //长度只能是六位,并且未数字 + @ApiModelProperty("支付密码") + @Pattern(regexp = "\\d{6}", message = "支付密码必须是6位数字") + private String payPassword; + // @ApiModelProperty("加油次数") // private BigDecimal consumeNum; // diff --git a/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/MtUser.java b/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/MtUser.java index ba934b195..1bf0a4ee9 100644 --- a/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/MtUser.java +++ b/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/MtUser.java @@ -117,4 +117,7 @@ public class MtUser implements Serializable { @TableField(exist = false) @ApiModelProperty("最后操作人") private String operator; + + @ApiModelProperty("支付密码") + private String payPassword; } From 3cd4b240c7304b6f8ff914fb7cf491f22a8c92d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com> Date: Mon, 23 Sep 2024 16:05:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B09.23?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MtUserCarNoController.java | 68 +++++++++++++ .../userManager/entity/MtUserCarNo.java | 57 +++++++++++ .../userManager/mapper/MtUserCarNoMapper.java | 16 ++++ .../service/IMtUserCarNoService.java | 45 +++++++++ .../service/impl/MtUserCarNoServiceImpl.java | 96 +++++++++++++++++++ .../business/userManager/vo/LJUserVo.java | 2 + 6 files changed, 284 insertions(+) create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/MtUserCarNoController.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/entity/MtUserCarNo.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/MtUserCarNoMapper.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/IMtUserCarNoService.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/MtUserCarNoServiceImpl.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/MtUserCarNoController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/MtUserCarNoController.java new file mode 100644 index 000000000..a31993ef9 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/MtUserCarNoController.java @@ -0,0 +1,68 @@ +package com.fuint.business.userManager.controller; + + +import com.fuint.business.userManager.entity.MtUserCarNo; +import com.fuint.business.userManager.service.IMtUserCarNoService; +import com.fuint.framework.web.BaseController; +import com.fuint.framework.web.ResponseObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import org.springframework.stereotype.Controller; + + +/** + *

+ * 用户车牌号 前端控制器 + *

+ * + * @author dianliang + * @since 2024-09-23 + */ +@RestController +@RequestMapping("/business/userManager/userCarNo") +public class MtUserCarNoController extends BaseController { + + @Autowired + private IMtUserCarNoService mtUserCarNoService; + + /** + * 获取用户车牌号列表 + * + * @return + */ + @GetMapping + public ResponseObject list(){ + return getSuccessResult(mtUserCarNoService.getCarNoList()); + } + + /** + * 新增用户车牌号 + * @param mtUserCarNo + * @return + */ + @PostMapping + public ResponseObject add(@RequestBody MtUserCarNo mtUserCarNo) { + return getSuccessResult(mtUserCarNoService.add(mtUserCarNo)); + } + + /** + * 编辑用户车牌号 + * @param mtUserCarNo + * @return + */ + @PutMapping + public ResponseObject edit(@RequestBody MtUserCarNo mtUserCarNo) { + return getSuccessResult(mtUserCarNoService.edit(mtUserCarNo)); + } + + /** + * 删除用户车牌号 + * @param id + * @return + */ + @DeleteMapping("/{id}") + public ResponseObject delete(@PathVariable Integer id) { + return getSuccessResult(mtUserCarNoService.delete(id)); + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/entity/MtUserCarNo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/entity/MtUserCarNo.java new file mode 100644 index 000000000..6d7948f05 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/entity/MtUserCarNo.java @@ -0,0 +1,57 @@ +package com.fuint.business.userManager.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 用户车牌号 + *

+ * + * @author dianliang + * @since 2024-09-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("mt_user_car_no") +@ApiModel(value="MtUserCarNo对象", description="用户车牌号") +public class MtUserCarNo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "用户id") + private Integer userId; + + @ApiModelProperty(value = "车牌号") + private String carNo; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间") + private LocalDateTime updateTime; + + @ApiModelProperty(value = "创建人") + private String createBy; + + @ApiModelProperty(value = "更新人") + private String updateBy; + + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/MtUserCarNoMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/MtUserCarNoMapper.java new file mode 100644 index 000000000..610a59a0e --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/MtUserCarNoMapper.java @@ -0,0 +1,16 @@ +package com.fuint.business.userManager.mapper; + +import com.fuint.business.userManager.entity.MtUserCarNo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 用户车牌号 Mapper 接口 + *

+ * + * @author dianliang + * @since 2024-09-23 + */ +public interface MtUserCarNoMapper extends BaseMapper { + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/IMtUserCarNoService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/IMtUserCarNoService.java new file mode 100644 index 000000000..aaa6863c4 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/IMtUserCarNoService.java @@ -0,0 +1,45 @@ +package com.fuint.business.userManager.service; + +import com.fuint.business.userManager.entity.MtUserCarNo; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 用户车牌号 服务类 + *

+ * + * @author dianliang + * @since 2024-09-23 + */ +public interface IMtUserCarNoService extends IService { + + /** + * 获取用户车牌号列表 + * + * @return + */ + List getCarNoList(); + + /** + * 新增用户车牌号 + * @param mtUserCarNo + * @return + */ + int add(MtUserCarNo mtUserCarNo); + + /** + * 编辑用户车牌号 + * @param mtUserCarNo + * @return + */ + int edit(MtUserCarNo mtUserCarNo); + + /** + * 删除用户车牌号 + * @param id + * @return + */ + int delete(Integer id); +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/MtUserCarNoServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/MtUserCarNoServiceImpl.java new file mode 100644 index 000000000..489bdc0d9 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/MtUserCarNoServiceImpl.java @@ -0,0 +1,96 @@ +package com.fuint.business.userManager.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.fuint.business.userManager.entity.MtUserCarNo; +import com.fuint.business.userManager.mapper.MtUserCarNoMapper; +import com.fuint.business.userManager.service.IMtUserCarNoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 用户车牌号 服务实现类 + *

+ * + * @author dianliang + * @since 2024-09-23 + */ +@Service +public class MtUserCarNoServiceImpl extends ServiceImpl implements IMtUserCarNoService { + + /** + * 获取用户车牌号列表 + * + * @return + */ + @Override + public List getCarNoList() { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + return baseMapper.selectList(new LambdaQueryWrapper() + .eq(MtUserCarNo::getUserId, nowAccountInfo.getId())); + } + + /** + * 新增用户车牌号 + * + * @param mtUserCarNo + * @return + */ + @Override + public int add(MtUserCarNo mtUserCarNo) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + mtUserCarNo.setUserId(nowAccountInfo.getId()); + //查询当前用户当前车牌号是否已经存在 + MtUserCarNo existCarNo = baseMapper.selectOne(new LambdaQueryWrapper() + .eq(MtUserCarNo::getUserId, nowAccountInfo.getId()) + .eq(MtUserCarNo::getCarNo, mtUserCarNo.getCarNo())); + if (ObjectUtil.isNotEmpty(existCarNo)) { + throw new RuntimeException("当前车牌号已存在"); + } + mtUserCarNo.setCreateTime(LocalDateTime.now()); + mtUserCarNo.setCreateBy(nowAccountInfo.getId().toString()); + return baseMapper.insert(mtUserCarNo); + } + + /** + * 编辑用户车牌号 + * + * @param mtUserCarNo + * @return + */ + @Override + public int edit(MtUserCarNo mtUserCarNo) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + mtUserCarNo.setUpdateTime(LocalDateTime.now()); + mtUserCarNo.setUpdateBy(nowAccountInfo.getId().toString()); + return baseMapper.updateById(mtUserCarNo); + } + + /** + * 删除用户车牌号 + * + * @param id + * @return + */ + @Override + public int delete(Integer id) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + MtUserCarNo mtUserCarNo = baseMapper.selectOne(new LambdaQueryWrapper() + .eq(MtUserCarNo::getId, id)); + if (ObjectUtil.isNotEmpty(mtUserCarNo)) { + if (mtUserCarNo.getUserId().equals(nowAccountInfo.getId())) { + return baseMapper.deleteById(id); + }else { + throw new RuntimeException("不能删除他人车牌号信息"); + } + } + return 0; + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/vo/LJUserVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/vo/LJUserVo.java index a5dba7930..289238336 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/vo/LJUserVo.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/vo/LJUserVo.java @@ -103,6 +103,8 @@ public class LJUserVo extends BaseEntity { // 固定等级 private String fixingLevel; + private String payPassword; + /** * 店铺Id */