Compare commits

..

5 Commits

Author SHA1 Message Date
dzq f499939b14 feat: 在CabinetDetailDTO和SearchShopOrderQuery中添加新字段
- 在CabinetDetailDTO.CellInfoDTO中添加stock字段,用于存储单元格库存信息
- 在SmartCabinetApplicationService中设置cellInfo的stock字段
- 在SearchShopOrderQuery中添加openid字段,用于按用户openid查询订单
2025-05-13 10:42:42 +08:00
dzq 30dbf9d2f9 feat(用户管理): 新增用户详情功能并隐藏身份证号码中间8位
新增用户详情接口,用于获取用户详细信息。同时,在用户DTO中处理身份证号码,隐藏中间8位以保护用户隐私。
2025-05-13 08:03:14 +08:00
dzq 4b2eaf7532 feat(登录): 添加Ab98用户信息保存功能
在WxLoginController中新增Ab98UserApplicationService依赖,并在登录和token登录接口中添加对Ab98用户信息的保存逻辑。同时,在Ab98UserApplicationService中实现saveAb98User和saveAb98UserByToken方法,用于根据登录数据或用户信息保存或更新Ab98用户信息。
2025-05-10 17:16:04 +08:00
dzq a53ed61457 feat(用户管理): 新增汇邦云用户信息管理功能
新增汇邦云用户信息管理模块,包括用户实体、Mapper、Service、DTO、查询条件、命令对象、模型工厂、应用服务及控制器。支持用户列表查询、新增、修改、删除等操作,并提供了相应的数据校验和异常处理。
2025-05-10 16:13:52 +08:00
dzq 4655eb4df0 refactor(shop): 移除冗余日志并优化订单查询
- 移除 `ShopController` 和 `ShopGoodsServiceImpl` 中的冗余日志记录
- 在 `ShopOrderMapper` 中添加 `cabinet_cell` 表的连接以优化订单查询
- 在 `SearchShopOrderQuery` 中添加 `cabinetId` 查询条件以支持按柜子ID筛选订单
2025-05-09 16:05:52 +08:00
24 changed files with 739 additions and 7 deletions

View File

@ -0,0 +1,76 @@
package com.agileboot.admin.controller.ab98;
import com.agileboot.admin.customize.aop.accessLog.AccessLog;
import com.agileboot.common.core.base.BaseController;
import com.agileboot.common.core.dto.ResponseDTO;
import com.agileboot.common.core.page.PageDTO;
import com.agileboot.common.enums.common.BusinessTypeEnum;
import com.agileboot.domain.ab98.user.dto.Ab98UserDetailDTO;
import com.agileboot.domain.common.command.BulkOperationCommand;
import com.agileboot.domain.ab98.user.Ab98UserApplicationService;
import com.agileboot.domain.ab98.user.command.AddAb98UserCommand;
import com.agileboot.domain.ab98.user.command.UpdateAb98UserCommand;
import com.agileboot.domain.ab98.user.db.Ab98UserEntity;
import com.agileboot.domain.ab98.user.dto.Ab98UserDTO;
import com.agileboot.domain.ab98.user.query.SearchAb98UserQuery;
import io.swagger.v3.oas.annotations.Operation;
import java.util.List;
import javax.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
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 org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/ab98/users")
@RequiredArgsConstructor
@Validated
public class Ab98UserController extends BaseController {
private final Ab98UserApplicationService userApplicationService;
@Operation(summary = "用户列表")
@GetMapping
public ResponseDTO<PageDTO<Ab98UserDTO>> list(SearchAb98UserQuery<Ab98UserEntity> query) {
PageDTO<Ab98UserDTO> page = userApplicationService.getUserList(query);
return ResponseDTO.ok(page);
}
@Operation(summary = "用户详情")
@GetMapping("/detail/{id}")
public ResponseDTO<Ab98UserDetailDTO> detail(@PathVariable Long id) {
Ab98UserDetailDTO ab98UserDetail = userApplicationService.getAb98UserDetail(id);
return ResponseDTO.ok(ab98UserDetail);
}
@Operation(summary = "新增用户")
@AccessLog(title = "用户管理", businessType = BusinessTypeEnum.ADD)
@PostMapping
public ResponseDTO<Void> add(@Validated @RequestBody AddAb98UserCommand command) {
userApplicationService.addUser(command);
return ResponseDTO.ok();
}
@Operation(summary = "修改用户")
@AccessLog(title = "用户管理", businessType = BusinessTypeEnum.MODIFY)
@PutMapping("/{id}")
public ResponseDTO<Void> edit(@PathVariable Long id, @Validated @RequestBody UpdateAb98UserCommand command) {
command.setAb98UserId(id);
userApplicationService.updateUser(command);
return ResponseDTO.ok();
}
@Operation(summary = "删除用户")
@AccessLog(title = "用户管理", businessType = BusinessTypeEnum.DELETE)
@DeleteMapping("/{ids}")
public ResponseDTO<Void> remove(@PathVariable @NotNull List<Long> ids) {
userApplicationService.deleteUser(new BulkOperationCommand<>(ids));
return ResponseDTO.ok();
}
}

View File

@ -20,9 +20,9 @@ public class MqttController {
@GetMapping("/opencell")
public String opencell(@RequestParam String data, @RequestParam Long cabinetId) {
public String opencell(@RequestParam String data, @RequestParam Long mqttServerId) {
try {
mqttService.publish(data, cabinetId);
mqttService.publish(data, mqttServerId);
return "success";
} catch (Exception e) {
log.error("getPermanentCode error", e);

View File

@ -40,7 +40,6 @@ public class ShopController {
@GetMapping("/goods")
public ResponseDTO<ShopGoodsResponse> getShopGoodsInfo(@RequestParam(required = false) Long shopId) {
log.info("getShopGoodsInfo shopId: {}", shopId);
/*// 获取商品列表
List<ShopGoodsEntity> goodsList = goodsApplicationService.getGoodsAll();
goodsList.forEach(goods -> {

View File

@ -4,6 +4,7 @@ import com.agileboot.common.core.dto.ResponseDTO;
import com.agileboot.common.exception.ApiException;
import com.agileboot.common.exception.error.ErrorCode;
import com.agileboot.domain.ab98.api.SsoLoginUserinfo;
import com.agileboot.domain.ab98.user.Ab98UserApplicationService;
import com.agileboot.domain.qywx.user.QyUserApplicationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -23,6 +24,7 @@ import java.util.Map;
@Api(tags = "微信登录接口")
public class WxLoginController {
private final QyUserApplicationService qyUserApplicationService;
private final Ab98UserApplicationService ab98UserApplicationService;
@PostMapping("/logout")
@ApiOperation(value = "用户退出登录")
@ -83,7 +85,8 @@ public class WxLoginController {
@RequestParam String token,
@RequestParam String tel,
@RequestParam String vcode,
@RequestParam(required = false) String userid) {
@RequestParam(required = false) String userid,
@RequestParam(required = false) String openid) {
try {
Ab98ApiUtil.LoginResponse loginResponse = Ab98ApiUtil.verifySmsCode(token, tel, vcode);
Ab98ApiUtil.LoginData data = new Ab98ApiUtil.LoginData();
@ -97,6 +100,12 @@ public class WxLoginController {
try {
qyUserApplicationService.saveQyUserInfoByAb98(userid, loginResponse.getOutputData(), null);
} catch (Exception e) {
log.error("保存汇邦云用户信息到企业用户失败: ", e);
}
try {
ab98UserApplicationService.saveAb98User(openid, loginResponse.getOutputData());
} catch (Exception e) {
log.error("保存汇邦云用户信息失败: ", e);
}
@ -111,7 +120,8 @@ public class WxLoginController {
@GetMapping("/tokenLogin")
@ApiOperation(value = "通过token登录", notes = "用于快速登录,无需验证码")
public ResponseDTO<Ab98ApiUtil.LoginData> tokenLogin(@RequestParam String token,
@RequestParam(required = false) String userid) {
@RequestParam(required = false) String userid,
@RequestParam(required = false) String openid) {
SsoLoginUserinfo loginUserinfo = Ab98ApiUtil.getLoginUserInfoRemote("wxshop", "34164e41f0c6694be6bbbba0dc50c14a", token, "");
Ab98ApiUtil.LoginData data = new Ab98ApiUtil.LoginData();
@ -128,9 +138,16 @@ public class WxLoginController {
try {
qyUserApplicationService.saveQyUserInfoByAb98(userid, null, loginUserinfo);
} catch (Exception e) {
log.error("保存汇邦云用户信息到企业用户失败: ", e);
}
try {
ab98UserApplicationService.saveAb98UserByToken(openid, loginUserinfo);
} catch (Exception e) {
log.error("保存汇邦云用户信息失败: ", e);
}
return ResponseDTO.ok(data);
}
}

View File

@ -0,0 +1,145 @@
package com.agileboot.domain.ab98.user;
import com.agileboot.common.core.page.PageDTO;
import com.agileboot.domain.ab98.api.Ab98ApiUtil;
import com.agileboot.domain.ab98.api.SsoLoginUserinfo;
import com.agileboot.domain.ab98.user.dto.Ab98UserDetailDTO;
import com.agileboot.domain.common.command.BulkOperationCommand;
import com.agileboot.domain.ab98.user.command.AddAb98UserCommand;
import com.agileboot.domain.ab98.user.command.UpdateAb98UserCommand;
import com.agileboot.domain.ab98.user.db.Ab98UserEntity;
import com.agileboot.domain.ab98.user.db.Ab98UserService;
import com.agileboot.domain.ab98.user.dto.Ab98UserDTO;
import com.agileboot.domain.ab98.user.model.Ab98UserModel;
import com.agileboot.domain.ab98.user.model.Ab98UserModelFactory;
import com.agileboot.domain.ab98.user.query.SearchAb98UserQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@Service
@Slf4j
@RequiredArgsConstructor
public class Ab98UserApplicationService {
private final Ab98UserService userService;
private final Ab98UserModelFactory userModelFactory;
public PageDTO<Ab98UserDTO> getUserList(SearchAb98UserQuery<Ab98UserEntity> query) {
Page<Ab98UserEntity> page = userService.getUserList(query);
List<Ab98UserDTO> dtoList = page.getRecords().stream()
.map(Ab98UserDTO::new)
.collect(Collectors.toList());
return new PageDTO<>(dtoList, page.getTotal());
}
public void addUser(AddAb98UserCommand command) {
Ab98UserModel model = userModelFactory.create();
model.loadAddCommand(command);
model.insert();
}
public void updateUser(UpdateAb98UserCommand command) {
Ab98UserModel model = userModelFactory.loadById(command.getAb98UserId());
model.loadUpdateCommand(command);
model.updateById();
}
public void deleteUser(BulkOperationCommand<Long> command) {
for (Long id : command.getIds()) {
Ab98UserModel model = userModelFactory.loadById(id);
model.deleteById();
}
}
public Ab98UserEntity getByAb98UserId(Long ab98UserId) {
return userService.getById(ab98UserId);
}
public Ab98UserEntity getByUserId(String userId) {
return userService.getByUserid(userId);
}
public Ab98UserEntity getByOpenid(String openid) {
return userService.getByOpenid(openid);
}
public Ab98UserDetailDTO getAb98UserDetail(Long ab98UserId) {
Ab98UserEntity ab98UserEntity = userService.getById(ab98UserId);
return new Ab98UserDetailDTO(ab98UserEntity);
}
public void saveAb98User(String openid, Ab98ApiUtil.LoginData loginData) {
Ab98UserEntity ab98UserEntity = getByUserId(loginData.getUserid());
if (ab98UserEntity != null &&
StringUtils.equals(openid, ab98UserEntity.getOpenid()) &&
StringUtils.equals(loginData.getName(), ab98UserEntity.getName())
) {
UpdateAb98UserCommand command = new UpdateAb98UserCommand();
command.setAb98UserId(ab98UserEntity.getAb98UserId());
command.setTel(loginData.getTel());
command.setSex(loginData.getSex());
command.setIdnum(loginData.getIdnum());
command.setIdcardFront(loginData.getIdcard_front());
command.setIdcardBack(loginData.getIdcard_back());
command.setFaceImg(loginData.getFace_img());
command.setAddress(loginData.getAddress());
command.setRegistered(loginData.isRegistered());
updateUser(command);
} else {
AddAb98UserCommand command = new AddAb98UserCommand();
command.setOpenid(openid);
command.setUserid(loginData.getUserid());
command.setName(loginData.getName());
command.setTel(loginData.getTel());
command.setSex(loginData.getSex());
command.setIdnum(loginData.getIdnum());
command.setIdcardFront(loginData.getIdcard_front());
command.setIdcardBack(loginData.getIdcard_back());
command.setFaceImg(loginData.getFace_img());
command.setAddress(loginData.getAddress());
command.setRegistered(loginData.isRegistered());
addUser(command);
}
}
public void saveAb98UserByToken(String openid, SsoLoginUserinfo loginUserinfo) {
Ab98UserEntity ab98UserEntity = getByUserId(String.valueOf(loginUserinfo.getId()));
if (ab98UserEntity != null &&
StringUtils.equals(openid, ab98UserEntity.getOpenid()) &&
StringUtils.equals(loginUserinfo.getName(), ab98UserEntity.getName())
) {
UpdateAb98UserCommand command = new UpdateAb98UserCommand();
command.setAb98UserId(ab98UserEntity.getAb98UserId());
command.setTel(loginUserinfo.getPhone());
command.setSex(loginUserinfo.getSex());
command.setIdnum(loginUserinfo.getIdCardNo());
command.setIdcardFront(loginUserinfo.getIdCardFront());
command.setIdcardBack(loginUserinfo.getIdCardBack());
command.setFaceImg(loginUserinfo.getFace());
command.setAddress(loginUserinfo.getAddress());
command.setRegistered(true);
updateUser(command);
} else {
AddAb98UserCommand command = new AddAb98UserCommand();
command.setOpenid(openid);
command.setUserid(String.valueOf(loginUserinfo.getId()));
command.setName(loginUserinfo.getName());
command.setTel(loginUserinfo.getPhone());
command.setSex(loginUserinfo.getSex());
command.setIdnum(loginUserinfo.getIdCardNo());
command.setIdcardFront(loginUserinfo.getIdCardFront());
command.setIdcardBack(loginUserinfo.getIdCardBack());
command.setFaceImg(loginUserinfo.getFace());
command.setAddress(loginUserinfo.getAddress());
command.setRegistered(true);
addUser(command);
}
}
}

View File

@ -0,0 +1,11 @@
package com.agileboot.domain.ab98.user.command;
import com.agileboot.domain.ab98.user.db.Ab98UserEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class AddAb98UserCommand extends Ab98UserEntity {
}

View File

@ -0,0 +1,15 @@
package com.agileboot.domain.ab98.user.command;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.PositiveOrZero;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class UpdateAb98UserCommand extends AddAb98UserCommand {
@NotNull
@PositiveOrZero
private Long ab98UserId;
}

View File

@ -0,0 +1,84 @@
package com.agileboot.domain.ab98.user.db;
import com.agileboot.common.core.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
* 汇邦云用户信息表
* </p>
*
* @author valarchie
* @since 2025-05-10
*/
@Getter
@Setter
@TableName("ab98_user")
@ApiModel(value = "Ab98UserEntity对象", description = "汇邦云用户信息表")
public class Ab98UserEntity extends BaseEntity<Ab98UserEntity> {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键ID")
@TableId(value = "ab98_user_id", type = IdType.AUTO)
private Long ab98UserId;
@ApiModelProperty("openid")
@TableField("openid")
private String openid;
@ApiModelProperty("汇邦云用户唯一ID")
@TableField("userid")
private String userid;
@ApiModelProperty("真实姓名")
@TableField("`name`")
private String name;
@ApiModelProperty("手机号码")
@TableField("tel")
private String tel;
@ApiModelProperty("身份证号码")
@TableField("idnum")
private String idnum;
@ApiModelProperty("性别(男 女)")
@TableField("sex")
private String sex;
@ApiModelProperty("人脸照片地址")
@TableField("face_img")
private String faceImg;
@ApiModelProperty("身份证正面地址")
@TableField("idcard_front")
private String idcardFront;
@ApiModelProperty("身份证背面地址")
@TableField("idcard_back")
private String idcardBack;
@ApiModelProperty("身份证登记地址")
@TableField("address")
private String address;
@ApiModelProperty("是否已注册0未注册 1已注册")
@TableField("registered")
private Boolean registered;
@Override
public Serializable pkVal() {
return this.ab98UserId;
}
}

View File

@ -0,0 +1,46 @@
package com.agileboot.domain.ab98.user.db;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* <p>
* 汇邦云用户信息表 Mapper 接口
* </p>
*
* @author valarchie
* @since 2025-05-10
*/
public interface Ab98UserMapper extends BaseMapper<Ab98UserEntity> {
@Select("SELECT ab98_user_id, openid, userid, name, tel, idnum, sex, face_img, idcard_front, idcard_back, address, registered " +
"FROM ab98_user " +
"${ew.customSqlSegment}")
Page<Ab98UserEntity> getUserList(
Page<Ab98UserEntity> page,
@Param(Constants.WRAPPER) Wrapper<Ab98UserEntity> queryWrapper
);
@Select("SELECT * " +
"FROM ab98_user " +
"WHERE registered = '1' " +
"ORDER BY create_time DESC " +
"LIMIT 1")
Ab98UserEntity selectFirstRegisteredUser();
@Select("SELECT * " +
"FROM ab98_user " +
"WHERE registered = '1' " +
"ORDER BY create_time DESC")
List<Ab98UserEntity> selectAllRegistered();
@Select("SELECT * FROM ab98_user WHERE userid = #{userid} LIMIT 1")
Ab98UserEntity selectByUserid(String userid);
@Select("SELECT * FROM ab98_user WHERE openid = #{openid} LIMIT 1")
Ab98UserEntity selectByOpenid(String openid);
}

View File

@ -0,0 +1,25 @@
package com.agileboot.domain.ab98.user.db;
import com.agileboot.common.core.page.AbstractPageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 汇邦云用户信息表 服务类
* </p>
*
* @author valarchie
* @since 2025-05-10
*/
public interface Ab98UserService extends IService<Ab98UserEntity> {
Page<Ab98UserEntity> getUserList(AbstractPageQuery<Ab98UserEntity> query);
List<Ab98UserEntity> selectAll();
Ab98UserEntity getByOpenid(String openid);
Ab98UserEntity getByUserid(String userid);
}

View File

@ -0,0 +1,42 @@
package com.agileboot.domain.ab98.user.db;
import com.agileboot.common.core.page.AbstractPageQuery;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 汇邦云用户信息表 服务实现类
* </p>
*
* @author valarchie
* @since 2025-05-10
*/
@Service
public class Ab98UserServiceImpl extends ServiceImpl<Ab98UserMapper, Ab98UserEntity> implements Ab98UserService {
@Override
public Page<Ab98UserEntity> getUserList(AbstractPageQuery<Ab98UserEntity> query) {
return this.page(query.toPage(), query.toQueryWrapper());
}
@Override
public List<Ab98UserEntity> selectAll() {
LambdaQueryWrapper<Ab98UserEntity> wrapper = new LambdaQueryWrapper<>();
return this.list(wrapper);
}
@Override
public Ab98UserEntity getByOpenid(String openid) {
return baseMapper.selectByOpenid(openid);
}
@Override
public Ab98UserEntity getByUserid(String userid) {
return baseMapper.selectByUserid(userid);
}
}

View File

@ -0,0 +1,64 @@
package com.agileboot.domain.ab98.user.dto;
import cn.hutool.core.bean.BeanUtil;
import com.agileboot.common.annotation.ExcelColumn;
import com.agileboot.common.annotation.ExcelSheet;
import com.agileboot.domain.common.cache.CacheCenter;
import com.agileboot.domain.ab98.user.db.Ab98UserEntity;
import com.agileboot.domain.system.user.db.SysUserEntity;
import lombok.Data;
@ExcelSheet(name = "汇邦云用户列表")
@Data
public class Ab98UserDTO {
public Ab98UserDTO(Ab98UserEntity entity) {
if (entity != null) {
BeanUtil.copyProperties(entity, this);
this.registeredStatus = entity.getRegistered() ? "已注册" : "未注册";
// 处理身份证号码隐藏中间8位
if (this.idnum != null && this.idnum.length() >= 10) {
this.idnum = this.idnum.substring(0, 6) + "********" + this.idnum.substring(this.idnum.length() - 4);
}
}
}
@ExcelColumn(name = "主键ID")
private Long ab98UserId;
@ExcelColumn(name = "openid")
private String openid;
@ExcelColumn(name = "用户唯一ID")
private String userid;
@ExcelColumn(name = "真实姓名")
private String name;
@ExcelColumn(name = "手机号码")
private String tel;
@ExcelColumn(name = "身份证号码")
private String idnum;
@ExcelColumn(name = "性别")
private String sex;
@ExcelColumn(name = "人脸照片地址")
private String faceImg;
@ExcelColumn(name = "身份证正面地址")
private String idcardFront;
@ExcelColumn(name = "身份证背面地址")
private String idcardBack;
@ExcelColumn(name = "身份证登记地址")
private String address;
@ExcelColumn(name = "注册状态")
private String registeredStatus;
}

View File

@ -0,0 +1,64 @@
package com.agileboot.domain.ab98.user.dto;
import cn.hutool.core.bean.BeanUtil;
import com.agileboot.common.annotation.ExcelColumn;
import com.agileboot.common.annotation.ExcelSheet;
import com.agileboot.common.core.base.BaseEntity;
import com.agileboot.domain.ab98.user.db.Ab98UserEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@ExcelSheet(name = "汇邦云用户详情")
@Data
public class Ab98UserDetailDTO extends BaseEntity<Ab98UserDetailDTO> {
public Ab98UserDetailDTO(Ab98UserEntity entity) {
if (entity != null) {
BeanUtil.copyProperties(entity, this);
this.registeredStatus = entity.getRegistered() ? "已注册" : "未注册";
// 处理身份证号码隐藏中间8位
if (this.idnum != null && this.idnum.length() >= 10) {
this.idnum = this.idnum.substring(0, 6) + "********" + this.idnum.substring(this.idnum.length() - 4);
}
}
}
@ExcelColumn(name = "主键ID")
private Long ab98UserId;
@ExcelColumn(name = "openid")
private String openid;
@ExcelColumn(name = "用户唯一ID")
private String userid;
@ExcelColumn(name = "真实姓名")
private String name;
@ExcelColumn(name = "手机号码")
private String tel;
@ExcelColumn(name = "身份证号码")
private String idnum;
@ExcelColumn(name = "性别")
private String sex;
@ExcelColumn(name = "人脸照片地址")
private String faceImg;
@ExcelColumn(name = "身份证正面地址")
private String idcardFront;
@ExcelColumn(name = "身份证背面地址")
private String idcardBack;
@ExcelColumn(name = "身份证登记地址")
private String address;
@ExcelColumn(name = "注册状态")
private String registeredStatus;
}

View File

@ -0,0 +1,37 @@
package com.agileboot.domain.ab98.user.model;
import cn.hutool.core.bean.BeanUtil;
import com.agileboot.domain.ab98.user.db.Ab98UserEntity;
import com.agileboot.domain.ab98.user.db.Ab98UserService;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class Ab98UserModel extends Ab98UserEntity {
private Ab98UserService userService;
public Ab98UserModel(Ab98UserEntity entity, Ab98UserService userService) {
this(userService);
if (entity != null) {
BeanUtil.copyProperties(entity, this);
}
}
public Ab98UserModel(Ab98UserService userService) {
this.userService = userService;
}
public void loadAddCommand(Object command) {
if (command != null) {
BeanUtil.copyProperties(command, this, "id");
}
}
public void loadUpdateCommand(Object command) {
if (command != null) {
loadAddCommand(command);
}
}
}

View File

@ -0,0 +1,27 @@
package com.agileboot.domain.ab98.user.model;
import com.agileboot.common.exception.ApiException;
import com.agileboot.common.exception.error.ErrorCode;
import com.agileboot.domain.ab98.user.db.Ab98UserEntity;
import com.agileboot.domain.ab98.user.db.Ab98UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class Ab98UserModelFactory {
private final Ab98UserService userService;
public Ab98UserModel loadById(Long userId) {
Ab98UserEntity entity = userService.getById(userId);
if (entity == null) {
throw new ApiException(ErrorCode.Business.COMMON_OBJECT_NOT_FOUND, userId, "用户");
}
return new Ab98UserModel(entity, userService);
}
public Ab98UserModel create() {
return new Ab98UserModel(userService);
}
}

View File

@ -0,0 +1,44 @@
package com.agileboot.domain.ab98.user.query;
import cn.hutool.core.util.StrUtil;
import com.agileboot.common.core.page.AbstractPageQuery;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class SearchAb98UserQuery<T> extends AbstractPageQuery<T> {
private Long ab98UserId;
private String openid;
private String userid;
private String name;
private String tel;
private String idnum;
private String sex;
private Boolean registered;
private Date startTime;
private Date endTime;
@Override
public QueryWrapper<T> addQueryCondition() {
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
queryWrapper
.eq(ab98UserId != null, "ab98_user_id", ab98UserId)
.eq(StrUtil.isNotEmpty(openid), "openid", openid)
.eq(StrUtil.isNotEmpty(userid), "userid", userid)
.like(StrUtil.isNotEmpty(name), "name", name)
.like(StrUtil.isNotEmpty(tel), "tel", tel)
.like(StrUtil.isNotEmpty(idnum), "idnum", idnum)
.eq(StrUtil.isNotEmpty(sex), "sex", sex)
.eq(registered != null, "registered", registered)
.between(startTime != null && endTime != null, "create_time", startTime, endTime);
this.timeRangeColumn = "create_time";
return queryWrapper;
}
}

View File

@ -89,6 +89,7 @@ public class SmartCabinetApplicationService {
// 设置单元格基础信息
cellInfo.setCellId(cell.getCellId());
cellInfo.setPinNo(cell.getPinNo());
cellInfo.setStock(cell.getStock());
// 处理单元格关联的商品信息
if (cell.getGoodsId() != null) {

View File

@ -16,6 +16,7 @@ public class CabinetDetailDTO {
public static class CellInfoDTO {
private Long cellId;
private Integer pinNo;
private Integer stock;
private ProductInfoDTO product;
}

View File

@ -37,7 +37,6 @@ public class ShopGoodsServiceImpl extends ServiceImpl<ShopGoodsMapper, ShopGoods
if (shopId == null) {
return baseMapper.getGoodsWithCabinetList();
} else {
log.info("getGoodsWithCabinetList shopId: {}", shopId);
return baseMapper.getGoodsWithCabinetListByShopId(shopId);
}
}

View File

@ -23,6 +23,7 @@ public interface ShopOrderMapper extends BaseMapper<ShopOrderEntity> {
"GROUP_CONCAT(DISTINCT og.cover_img) AS coverImgs " +
"FROM shop_order o " +
"LEFT JOIN shop_order_goods og ON o.order_id = og.order_id AND og.deleted = 0 " +
"LEFT JOIN cabinet_cell cc ON cc.cell_id = og.cell_id " +
"${ew.customSqlSegment}")
Page<OrderWithGoodsDTO> getOrderList(
Page<OrderWithGoodsDTO> page,

View File

@ -13,7 +13,9 @@ import lombok.EqualsAndHashCode;
public class SearchShopOrderQuery<T> extends AbstractPageQuery<T> {
private Long orderId;
private String openid;
private Long cellId;
private Long cabinetId;
private Integer status;
private Integer payStatus;
private Date startTime;
@ -28,6 +30,8 @@ public class SearchShopOrderQuery<T> extends AbstractPageQuery<T> {
queryWrapper
.eq(orderId != null, "o.order_id", orderId)
.eq(cellId != null, "og.cell_id", cellId)
.eq(StrUtil.isNotBlank(openid), "o.openid", openid.trim())
.eq(cabinetId != null, "cc.cabinet_id", cabinetId)
.eq(status != null, "o.status", status)
.eq(payStatus != null, "o.pay_status", payStatus)
.eq(StrUtil.isNotEmpty(paymentMethod), "o.payment_method", paymentMethod)

View File

@ -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.agileboot.domain.ab98.user.db.Ab98UserMapper">
</mapper>

View File

@ -61,7 +61,7 @@ public class CodeGenerator {
//生成的类 放在orm子模块下的/target/generated-code目录底下
.module("/agileboot-orm/target/generated-code")
.parentPackage("com.agileboot")
.tableName("shop")
.tableName("ab98_user")
// 决定是否继承基类
.isExtendsFromBaseEntity(true)
.build();

View File

@ -0,0 +1,25 @@
DROP TABLE IF EXISTS `ab98_user`;
CREATE TABLE `ab98_user` (
`ab98_user_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`openid` VARCHAR(32) NOT NULL COMMENT 'openid',
`userid` VARCHAR(100) NOT NULL COMMENT '汇邦云用户唯一ID',
`name` VARCHAR(50) NOT NULL COMMENT '真实姓名',
`tel` VARCHAR(20) NOT NULL COMMENT '手机号码',
`idnum` VARCHAR(20) NOT NULL COMMENT '身份证号码',
`sex` CHAR(8) NOT NULL COMMENT '性别(男 女)',
`face_img` VARCHAR(500) NOT NULL COMMENT '人脸照片地址',
`idcard_front` VARCHAR(500) COMMENT '身份证正面地址',
`idcard_back` VARCHAR(500) COMMENT '身份证背面地址',
`address` VARCHAR(200) COMMENT '身份证登记地址',
`registered` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已注册0未注册 1已注册',
`creator_id` BIGINT DEFAULT 0 COMMENT '创建者ID',
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater_id` BIGINT DEFAULT 0 COMMENT '更新者ID',
`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '删除标志0存在 1删除',
PRIMARY KEY (`ab98_user_id`),
KEY `idx_openid` (`openid`),
KEY `idx_tel` (`tel`),
KEY `idx_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='汇邦云用户信息表';