Compare commits

..

11 Commits

Author SHA1 Message Date
dzq 3ef4c71258 feat(用户标签): 新增用户标签管理功能
新增用户标签管理模块,包括用户标签的增删改查功能。涉及实体类、服务类、控制器及相关查询、命令类的实现。通过Ab98UserTagApplicationService提供业务逻辑处理,Ab98UserTagController提供RESTful接口,支持用户标签的列表查询、新增、修改和删除操作。
2025-05-22 09:45:10 +08:00
dzq 14e7a934de fix(缓存): 将登录令牌的缓存时间从30分钟改为600分钟
docs(数据库): 新增用户标签表的SQL脚本
2025-05-22 08:17:04 +08:00
dzq a26cd2e3c5 feat(qywx): 添加系统角色ID字段以支持用户角色管理
在`qy_user`表中新增`sys_role_id`字段,并在相关DTO、Entity、查询类及服务层中同步更新,以支持用户角色管理功能。同时修复了更新用户角色时未调用`updateById`方法的问题。
2025-05-21 10:34:12 +08:00
dzq ffc5befc81 feat(订单): 添加查询未归还订单商品功能
在ShopOrderGoodsService、OrderApplicationService、ShopOrderGoodsServiceImpl和ShopOrderGoodsMapper中添加了selectUnReturnOrderGoods方法,用于查询未归还的订单商品。同时,在StatsDTO中新增了未归还商品数量、未归还订单数量和未归还金额字段,并在ShopController的stats方法中实现了相关统计逻辑。
2025-05-21 09:22:55 +08:00
dzq 10329475f3 feat: 添加商品总金额统计和用户角色信息
- 在StatsDTO中添加goodsTotalAmount字段以统计商品总金额
- 在QyUserDTO中添加roleId和roleName字段以展示用户角色信息
- 在ShopGoodsService及相关实现中添加calculateTotalAmount方法
- 在QyUserApplicationService中处理用户角色信息的更新
2025-05-21 08:06:40 +08:00
dzq 32bf187134 feat(商品): 添加商品使用说明字段
在商品相关的DTO、Entity和查询类中添加`usageInstruction`字段,用于存储商品的使用说明信息。同时更新了Mapper中的SQL查询语句,确保该字段在查询结果中返回。
2025-05-20 16:12:33 +08:00
dzq 34f250b354 feat(订单): 添加总订单金额统计功能
在订单相关服务中新增了计算总订单金额的功能,并在统计数据DTO中添加了总订单金额字段,以便在前端展示。此功能用于统计通过微信支付且支付状态为已支付、已完成或已关闭的订单总金额。
2025-05-20 15:45:14 +08:00
dzq ca858ba62b feat(shop): 添加统计功能以获取商店、商品、订单等数据
新增统计功能,用于获取商店数量、商品数量、订单数量、柜子数量、格口数量、已关联格口数量、未管理格口数量、网关数量等数据,并支持获取热门商品和今日最新订单商品信息。
2025-05-20 11:00:08 +08:00
dzq 97bf45987f refactor(mqtt): 调整MQTT连接复用逻辑,先订阅主题再记录日志
refactor(qywx): 移除QyTemplateDTO中未使用的operator字段
2025-05-19 17:14:12 +08:00
dzq dc260dec0e refactor: 移除多个DTO中从缓存获取用户名的逻辑
为了提高代码的可维护性和减少对缓存的依赖,移除了多个DTO中从缓存获取用户名的逻辑。这些逻辑已被注释掉,未来可根据需求重新实现或优化。
2025-05-19 15:22:21 +08:00
dzq 003b5b972c refactor: 简化机柜模板枚举命名
删除冗余的机柜模板枚举项,统一命名规范,提高代码可维护性
2025-05-19 11:21:33 +08:00
62 changed files with 939 additions and 42 deletions

View File

@ -0,0 +1,68 @@
package com.agileboot.admin.controller.ab98.tag;
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.common.command.BulkOperationCommand;
import com.agileboot.domain.ab98.tag.Ab98UserTagApplicationService;
import com.agileboot.domain.ab98.tag.command.AddAb98UserTagCommand;
import com.agileboot.domain.ab98.tag.command.UpdateAb98UserTagCommand;
import com.agileboot.domain.ab98.tag.db.Ab98UserTagEntity;
import com.agileboot.domain.ab98.tag.dto.Ab98UserTagDTO;
import com.agileboot.domain.ab98.tag.query.SearchAb98UserTagQuery;
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/userTags")
@RequiredArgsConstructor
@Validated
public class Ab98UserTagController extends BaseController {
private final Ab98UserTagApplicationService ab98UserTagApplicationService;
@Operation(summary = "用户标签列表")
@GetMapping
public ResponseDTO<PageDTO<Ab98UserTagDTO>> list(SearchAb98UserTagQuery<Ab98UserTagEntity> query) {
PageDTO<Ab98UserTagDTO> page = ab98UserTagApplicationService.getAb98UserTagList(query);
return ResponseDTO.ok(page);
}
@Operation(summary = "新增用户标签")
@AccessLog(title = "用户标签管理", businessType = BusinessTypeEnum.ADD)
@PostMapping
public ResponseDTO<Void> add(@Validated @RequestBody AddAb98UserTagCommand command) {
ab98UserTagApplicationService.addAb98UserTag(command);
return ResponseDTO.ok();
}
@Operation(summary = "修改用户标签")
@AccessLog(title = "用户标签管理", businessType = BusinessTypeEnum.MODIFY)
@PutMapping("/{id}")
public ResponseDTO<Void> edit(@PathVariable Long id, @Validated @RequestBody UpdateAb98UserTagCommand command) {
command.setTagId(id);
ab98UserTagApplicationService.updateAb98UserTag(command);
return ResponseDTO.ok();
}
@Operation(summary = "删除用户标签")
@AccessLog(title = "用户标签管理", businessType = BusinessTypeEnum.DELETE)
@DeleteMapping("/{ids}")
public ResponseDTO<Void> remove(@PathVariable @NotNull List<Long> ids) {
ab98UserTagApplicationService.deleteAb98UserTag(new BulkOperationCommand<>(ids));
return ResponseDTO.ok();
}
}

View File

@ -5,14 +5,24 @@ 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.cabinet.cell.CabinetCellApplicationService;
import com.agileboot.domain.cabinet.smartCabinet.SmartCabinetApplicationService;
import com.agileboot.domain.common.command.BulkOperationCommand;
import com.agileboot.domain.mqtt.MqttService;
import com.agileboot.domain.shop.goods.GoodsApplicationService;
import com.agileboot.domain.shop.order.OrderApplicationService;
import com.agileboot.domain.shop.order.db.ShopOrderGoodsEntity;
import com.agileboot.domain.shop.order.db.TodayLatestOrderGoodsDTO;
import com.agileboot.domain.shop.shop.ShopApplicationService;
import com.agileboot.domain.shop.shop.command.AddShopCommand;
import com.agileboot.domain.shop.shop.command.UpdateShopCommand;
import com.agileboot.domain.shop.shop.db.ShopEntity;
import com.agileboot.domain.shop.shop.dto.ShopDTO;
import com.agileboot.domain.shop.shop.dto.StatsDTO;
import com.agileboot.domain.shop.shop.query.SearchShopQuery;
import io.swagger.v3.oas.annotations.Operation;
import java.math.BigDecimal;
import java.util.List;
import javax.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
@ -33,6 +43,60 @@ import org.springframework.web.bind.annotation.RestController;
public class ShopController extends BaseController {
private final ShopApplicationService shopApplicationService;
private final GoodsApplicationService goodsApplicationService;
private final OrderApplicationService orderApplicationService;
private final SmartCabinetApplicationService smartCabinetApplicationService;
private final CabinetCellApplicationService cabinetCellApplicationService;
private final MqttService mqttService;
@Operation(summary = "首页数据")
@GetMapping("/Stats")
public ResponseDTO<StatsDTO> stats() {
// 创建统计数据DTO对象
StatsDTO statsDTO = new StatsDTO();
// 设置商店总数调用商店服务统计
statsDTO.setShopCount(shopApplicationService.countAllRecord());
// 设置商品总数调用商品服务统计
statsDTO.setGoodsCount(goodsApplicationService.countAllRecord());
// 设置商品总金额调用商品服务计算
statsDTO.setGoodsTotalAmount(goodsApplicationService.calculateTotalAmount());
// 设置订单总数调用订单服务统计
statsDTO.setOrderCount(orderApplicationService.countAllRecord());
// 设置订单总金额调用订单服务计算
statsDTO.setOrderAmountSum(orderApplicationService.sumTotalAmount());
List<ShopOrderGoodsEntity> unReturnOrderGoods = orderApplicationService.selectUnReturnOrderGoods();
// 设置未还商品数量调用订单服务统计
statsDTO.setUnReturnedGoodsCount((long) unReturnOrderGoods.size());
// 设置未还订单数量调用订单服务统计
statsDTO.setUnReturnedOrderCount(unReturnOrderGoods.stream().map(ShopOrderGoodsEntity::getOrderId).distinct().count());
// 设置未还金额调用订单服务计算
statsDTO.setUnReturnedAmount(unReturnOrderGoods.stream().map(ShopOrderGoodsEntity::getTotalAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
// 设置智能柜总数调用智能柜服务统计
statsDTO.setCabinetCount(smartCabinetApplicationService.countAllRecord());
// 设置格口总数调用格口服务统计
statsDTO.setCellCount(cabinetCellApplicationService.countAllRecord());
// 设置已关联格口数调用格口服务统计
statsDTO.setLinkedCellCount(cabinetCellApplicationService.countLinkedRecord());
// 计算并设置未管理格口数总格口数-已关联格口数
statsDTO.setUnmanagedCellCount(statsDTO.getCellCount() - statsDTO.getLinkedCellCount());
// 设置网关数量从MQTT服务获取
statsDTO.setGatewayCount(mqttService.getGatewayCount());
// 设置热门商品列表调用订单服务获取
statsDTO.setTopGoods(orderApplicationService.selectTopGoodsByOccurrence());
// 获取今日最新订单商品列表
List<TodayLatestOrderGoodsDTO> todayLatestOrderGoodsDTOS = orderApplicationService.selectTodayLatestOrderGoods();
// 格式化每个订单商品的创建时间HH:mm:ss格式
todayLatestOrderGoodsDTOS.forEach(dto -> {
if (dto.getCreateTime() != null) {
dto.setCreateTimeStr(cn.hutool.core.date.DateUtil.format(dto.getCreateTime(), "HH:mm:ss"));
}
});
// 设置今日最新订单商品列表到统计DTO
statsDTO.setTodayLatestOrderGoods(todayLatestOrderGoodsDTOS);
return ResponseDTO.ok(statsDTO);
}
@Operation(summary = "商店列表")
@GetMapping

View File

@ -0,0 +1,61 @@
package com.agileboot.domain.ab98.tag;
import com.agileboot.common.core.page.PageDTO;
import com.agileboot.domain.common.command.BulkOperationCommand;
import com.agileboot.domain.ab98.tag.command.AddAb98UserTagCommand;
import com.agileboot.domain.ab98.tag.command.UpdateAb98UserTagCommand;
import com.agileboot.domain.ab98.tag.db.Ab98UserTagEntity;
import com.agileboot.domain.ab98.tag.db.Ab98UserTagService;
import com.agileboot.domain.ab98.tag.dto.Ab98UserTagDTO;
import com.agileboot.domain.ab98.tag.model.Ab98UserTagModel;
import com.agileboot.domain.ab98.tag.model.Ab98UserTagModelFactory;
import com.agileboot.domain.ab98.tag.query.SearchAb98UserTagQuery;
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.springframework.stereotype.Service;
@Service
@Slf4j
@RequiredArgsConstructor
public class Ab98UserTagApplicationService {
private final Ab98UserTagService ab98UserTagService;
private final Ab98UserTagModelFactory ab98UserTagModelFactory;
public PageDTO<Ab98UserTagDTO> getAb98UserTagList(SearchAb98UserTagQuery<Ab98UserTagEntity> query) {
Page<Ab98UserTagEntity> page = ab98UserTagService.getUserTagList(query);
List<Ab98UserTagDTO> dtoList = page.getRecords().stream()
.map(Ab98UserTagDTO::new)
.collect(Collectors.toList());
return new PageDTO<>(dtoList, page.getTotal());
}
public void addAb98UserTag(AddAb98UserTagCommand command) {
Ab98UserTagModel model = ab98UserTagModelFactory.create();
model.loadAddCommand(command);
model.insert();
}
public void updateAb98UserTag(UpdateAb98UserTagCommand command) {
Ab98UserTagModel model = ab98UserTagModelFactory.loadById(command.getTagId());
model.loadUpdateCommand(command);
model.updateById();
}
public void deleteAb98UserTag(BulkOperationCommand<Long> command) {
for (Long tagId : command.getIds()) {
Ab98UserTagModel model = ab98UserTagModelFactory.loadById(tagId);
model.deleteById();
}
}
public Ab98UserTagEntity getFirstEnabledTag() {
return ab98UserTagService.getFirstEnabledTag();
}
public Ab98UserTagEntity getByTagId(Long tagId) {
return ab98UserTagService.getByTagId(tagId);
}
}

View File

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

View File

@ -0,0 +1,16 @@
package com.agileboot.domain.ab98.tag.command;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.PositiveOrZero;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class UpdateAb98UserTagCommand extends AddAb98UserTagCommand {
@NotNull
@PositiveOrZero
private Long tagId;
}

View File

@ -0,0 +1,48 @@
package com.agileboot.domain.ab98.tag.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-22
*/
@Getter
@Setter
@TableName("ab98_user_tag")
@ApiModel(value = "Ab98UserTagEntity对象", description = "用户标签表")
public class Ab98UserTagEntity extends BaseEntity<Ab98UserTagEntity> {
private static final long serialVersionUID = 1L;
@ApiModelProperty("标签ID")
@TableId(value = "tag_id", type = IdType.AUTO)
private Long tagId;
@ApiModelProperty("关联用户ID")
@TableField("ab98_user_id")
private Long ab98UserId;
@ApiModelProperty("标签名称")
@TableField("tag_name")
private String tagName;
@Override
public Serializable pkVal() {
return this.tagId;
}
}

View File

@ -0,0 +1,38 @@
package com.agileboot.domain.ab98.tag.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-22
*/
public interface Ab98UserTagMapper extends BaseMapper<Ab98UserTagEntity> {
@Select("SELECT tag_id, ab98_user_id, tag_name " +
"FROM ab98_user_tag " +
"${ew.customSqlSegment}")
Page<Ab98UserTagEntity> getUserTagList(
Page<Ab98UserTagEntity> page,
@Param(Constants.WRAPPER) Wrapper<Ab98UserTagEntity> queryWrapper
);
@Select("SELECT * " +
"FROM ab98_user_tag " +
"ORDER BY create_time DESC")
List<Ab98UserTagEntity> selectAll();
@Select("SELECT * FROM ab98_user_tag WHERE ab98_user_id = #{userId}")
List<Ab98UserTagEntity> selectByUserId(@Param("userId") Long userId);
@Select("SELECT * FROM ab98_user_tag WHERE tag_id = #{tagId} LIMIT 1")
Ab98UserTagEntity selectByTagId(@Param("tagId") Long tagId);
}

View File

@ -0,0 +1,25 @@
package com.agileboot.domain.ab98.tag.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-22
*/
public interface Ab98UserTagService extends IService<Ab98UserTagEntity> {
Page<Ab98UserTagEntity> getUserTagList(AbstractPageQuery<Ab98UserTagEntity> query);
List<Ab98UserTagEntity> selectAll();
Ab98UserTagEntity getFirstEnabledTag();
Ab98UserTagEntity getByTagId(Long tagId);
}

View File

@ -0,0 +1,44 @@
package com.agileboot.domain.ab98.tag.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-22
*/
@Service
public class Ab98UserTagServiceImpl extends ServiceImpl<Ab98UserTagMapper, Ab98UserTagEntity> implements Ab98UserTagService {
@Override
public Page<Ab98UserTagEntity> getUserTagList(AbstractPageQuery<Ab98UserTagEntity> query) {
return this.page(query.toPage(), query.toQueryWrapper());
}
@Override
public List<Ab98UserTagEntity> selectAll() {
return baseMapper.selectAll();
}
@Override
public Ab98UserTagEntity getFirstEnabledTag() {
LambdaQueryWrapper<Ab98UserTagEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Ab98UserTagEntity::getDeleted, false)
.orderByDesc(Ab98UserTagEntity::getCreateTime);
return getOne(wrapper);
}
@Override
public Ab98UserTagEntity getByTagId(Long tagId) {
return baseMapper.selectByTagId(tagId);
}
}

View File

@ -0,0 +1,27 @@
package com.agileboot.domain.ab98.tag.dto;
import cn.hutool.core.bean.BeanUtil;
import com.agileboot.common.annotation.ExcelColumn;
import com.agileboot.common.annotation.ExcelSheet;
import com.agileboot.domain.ab98.tag.db.Ab98UserTagEntity;
import lombok.Data;
@ExcelSheet(name = "AB98用户标签列表")
@Data
public class Ab98UserTagDTO {
public Ab98UserTagDTO(Ab98UserTagEntity entity) {
if (entity != null) {
BeanUtil.copyProperties(entity, this);
}
}
@ExcelColumn(name = "标签ID")
private Long tagId;
@ExcelColumn(name = "关联用户ID")
private Long ab98UserId;
@ExcelColumn(name = "标签名称")
private String tagName;
}

View File

@ -0,0 +1,39 @@
package com.agileboot.domain.ab98.tag.model;
import cn.hutool.core.bean.BeanUtil;
import com.agileboot.domain.ab98.tag.command.AddAb98UserTagCommand;
import com.agileboot.domain.ab98.tag.command.UpdateAb98UserTagCommand;
import com.agileboot.domain.ab98.tag.db.Ab98UserTagEntity;
import com.agileboot.domain.ab98.tag.db.Ab98UserTagService;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class Ab98UserTagModel extends Ab98UserTagEntity {
private Ab98UserTagService ab98UserTagService;
public Ab98UserTagModel(Ab98UserTagEntity entity, Ab98UserTagService ab98UserTagService) {
this(ab98UserTagService);
if (entity != null) {
BeanUtil.copyProperties(entity, this);
}
}
public Ab98UserTagModel(Ab98UserTagService ab98UserTagService) {
this.ab98UserTagService = ab98UserTagService;
}
public void loadAddCommand(AddAb98UserTagCommand command) {
if (command != null) {
BeanUtil.copyProperties(command, this, "id");
}
}
public void loadUpdateCommand(UpdateAb98UserTagCommand command) {
if (command != null) {
loadAddCommand(command);
}
}
}

View File

@ -0,0 +1,27 @@
package com.agileboot.domain.ab98.tag.model;
import com.agileboot.common.exception.ApiException;
import com.agileboot.common.exception.error.ErrorCode;
import com.agileboot.domain.ab98.tag.db.Ab98UserTagEntity;
import com.agileboot.domain.ab98.tag.db.Ab98UserTagService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class Ab98UserTagModelFactory {
private final Ab98UserTagService ab98UserTagService;
public Ab98UserTagModel loadById(Long tagId) {
Ab98UserTagEntity entity = ab98UserTagService.getById(tagId);
if (entity == null) {
throw new ApiException(ErrorCode.Business.COMMON_OBJECT_NOT_FOUND, tagId, "用户标签");
}
return new Ab98UserTagModel(entity, ab98UserTagService);
}
public Ab98UserTagModel create() {
return new Ab98UserTagModel(ab98UserTagService);
}
}

View File

@ -0,0 +1,32 @@
package com.agileboot.domain.ab98.tag.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 SearchAb98UserTagQuery<T> extends AbstractPageQuery<T> {
private Long ab98UserId;
private String tagName;
private Date startTime;
private Date endTime;
@Override
public QueryWrapper<T> addQueryCondition() {
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
queryWrapper
.eq(ab98UserId != null, "ab98_user_id", ab98UserId)
.like(StrUtil.isNotEmpty(tagName), "tag_name", tagName)
.between(startTime != null && endTime != null, "create_time", startTime, endTime);
this.timeRangeColumn = "create_time";
return queryWrapper;
}
}

View File

@ -104,4 +104,12 @@ public class CabinetCellApplicationService {
public void clearGoodsCells(Long cellId) {
cabinetCellService.clearGoodsIdAndFreeCell(cellId);
}
public Long countAllRecord() {
return cabinetCellService.countAllRecord();
}
public Long countLinkedRecord() {
return cabinetCellService.countLinkedRecord();
}
}

View File

@ -61,4 +61,9 @@ public interface CabinetCellMapper extends BaseMapper<CabinetCellEntity> {
@Param(Constants.WRAPPER) Wrapper<CabinetCellEntity> queryWrapper
);
@Select("SELECT COUNT(1) FROM cabinet_cell WHERE deleted = 0")
Long countAllRecord();
@Select("SELECT COUNT(1) FROM cabinet_cell WHERE deleted = 0 AND goods_id IS NOT NULL")
Long countLinkedRecord();
}

View File

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@ -30,4 +31,8 @@ public interface CabinetCellService extends IService<CabinetCellEntity> {
void clearGoodsIdAndFreeCell(Long cellId);
Page<CabinetCellWithOrderCountDTO> getCellListWithOrders(AbstractPageQuery<CabinetCellEntity> query);
Long countAllRecord();
Long countLinkedRecord();
}

View File

@ -46,4 +46,14 @@ public class CabinetCellServiceImpl extends ServiceImpl<CabinetCellMapper, Cabin
public Page<CabinetCellWithOrderCountDTO> getCellListWithOrders(AbstractPageQuery<CabinetCellEntity> query) {
return baseMapper.getCellListWithOrders(query.toPage(), query.toQueryWrapper());
}
@Override
public Long countAllRecord() {
return baseMapper.countAllRecord();
}
@Override
public Long countLinkedRecord() {
return baseMapper.countLinkedRecord();
}
}

View File

@ -20,11 +20,9 @@ public enum CabinetTemplateEnum {
/** 60口机柜模板2块主板每块主板30个单元格 */
CABINET_60(7, "cabinet_60.jpg", "60口机柜", 2, 30),
/** 120口机柜模板(6X20)6块主板每块主板20个单元格 */
CABINET_6X20(8, "cabinet_120_6X20.jpg", "120口机柜6X20", 6, 20),
CABINET_120(8, "cabinet_120.jpg", "120口机柜", 6, 20),
/** 4口机柜模板1块主板每块主板4个单元格 */
CABINET_4(9, "cabinet_4.jpg","4口机柜", 1, 4),
/** 120口机柜模板(4X30)4块主板每块主板30个单元格 */
CABINET_4X30(10, "cabinet_120_4X30.jpg", "120口机柜4X30", 4, 30);
CABINET_4(9, "cabinet_4.jpg","4口机柜", 1, 4);
/** 模板代码 */
private final int code;

View File

@ -218,4 +218,8 @@ public class SmartCabinetApplicationService {
}
return result;
}
public Long countAllRecord() {
return smartCabinetService.countAllRecord();
}
}

View File

@ -48,4 +48,7 @@ public interface SmartCabinetMapper extends BaseMapper<SmartCabinetEntity> {
// 新增根据柜体ID查询的方法
@Select("SELECT * FROM smart_cabinet WHERE cabinet_id = #{cabinetId} LIMIT 1")
SmartCabinetEntity selectByCabinetId(Long cabinetId);
@Select("SELECT COUNT(1) FROM smart_cabinet WHERE deleted = 0")
Long countAllRecord();
}

View File

@ -23,4 +23,5 @@ public interface SmartCabinetService extends IService<SmartCabinetEntity> {
SmartCabinetEntity getByCabinetId(Long cabinetId);
Long countAllRecord();
}

View File

@ -40,4 +40,9 @@ public class SmartCabinetServiceImpl extends ServiceImpl<SmartCabinetMapper, Sma
return baseMapper.selectByCabinetId(cabinetId);
}
@Override
public Long countAllRecord() {
return baseMapper.countAllRecord();
}
}

View File

@ -64,8 +64,9 @@ public class MqttService implements MqttCallback {
.orElse(null);
if (existingConfig != null) {
log.info("复用已有MQTT连接{} 账号:{}", config.getServerUrl(), config.getUsername());
existingConfig.client.subscribe(config.getTopicFilter());
clientConfigs.add(new ClientConfig(existingConfig.client, config));
log.info("复用已有MQTT连接{} 账号:{}", config.getServerUrl(), config.getUsername());
continue;
}
@ -134,6 +135,10 @@ public class MqttService implements MqttCallback {
@Override
public void deliveryComplete(IMqttDeliveryToken token) {}
public Long getGatewayCount() {
return (long) clientConfigs.size();
}
/******************************************************
*函数名称: lockCmd
* : 指令地址码通道号指令参数

View File

@ -18,10 +18,10 @@ public class QyAccessTokenDTO {
if (entity != null) {
BeanUtil.copyProperties(entity, this);
SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
/*SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
if (creator != null) {
this.operator = creator.getUsername();
}
}*/
}
}

View File

@ -18,10 +18,10 @@ public class QyAuthDTO {
if (entity != null) {
BeanUtil.copyProperties(entity, this);
SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
/*SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
if (creator != null) {
this.operator = creator.getUsername();
}
}*/
this.timeStampStr = entity.getTimeStamp();
}

View File

@ -18,10 +18,10 @@ public class QyAuthCorpInfoDTO {
if (entity != null) {
BeanUtil.copyProperties(entity, this);
SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
/*SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
if (creator != null) {
this.operator = creator.getUsername();
}
}*/
}
}

View File

@ -16,10 +16,10 @@ public class QyDepartmentDTO {
if (entity != null) {
BeanUtil.copyProperties(entity, this);
SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
/*SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
if (creator != null) {
this.operator = creator.getUsername();
}
}*/
this.enableStatus = "1".equals(entity.getEnable()) ? "启用" : "停用";
}

View File

@ -18,10 +18,10 @@ public class QyMessageDTO {
if (entity != null) {
BeanUtil.copyProperties(entity, this);
SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
/*SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
if (creator != null) {
this.operator = creator.getUsername();
}
}*/
this.sendTimeStr = DateUtil.format(entity.getSendTime(), "yyyy-MM-dd HH:mm:ss");
this.recallStateStr = convertRecallState(entity.getRecallState());

View File

@ -18,11 +18,6 @@ public class QyTemplateDTO {
if (entity != null) {
BeanUtil.copyProperties(entity, this);
SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
if (creator != null) {
this.operator = creator.getUsername();
}
this.enableStatus = "1".equals(entity.getEnable()) ? "启用" : "停用";
this.gettokenTimeStr = DateUtil.format(entity.getGettokenTime(), "yyyy-MM-dd HH:mm:ss");
}
@ -55,9 +50,6 @@ public class QyTemplateDTO {
@ExcelColumn(name = "凭证有效期(秒)")
private Integer expiresIn;
@ExcelColumn(name = "操作人")
private String operator;
@ExcelColumn(name = "状态")
private String enableStatus;

View File

@ -15,6 +15,8 @@ import com.agileboot.domain.qywx.user.model.QyUserModelFactory;
import com.agileboot.domain.qywx.user.query.SearchQyUserQuery;
import com.agileboot.domain.qywx.userQySys.db.SysUserQyUserEntity;
import com.agileboot.domain.qywx.userQySys.db.SysUserQyUserService;
import com.agileboot.domain.system.role.db.SysRoleEntity;
import com.agileboot.domain.system.role.db.SysRoleService;
import com.agileboot.domain.system.user.db.SysUserEntity;
import com.agileboot.domain.system.user.db.SysUserService;
import com.agileboot.domain.system.user.dto.UserDTO;
@ -33,6 +35,7 @@ public class QyUserApplicationService {
private final QyUserModelFactory qyUserModelFactory;
private final SysUserQyUserService sysUserQyUserService;
private final SysUserService sysUserService;
private final SysRoleService sysRoleService;
public PageDTO<QyUserDTO> getUserList(SearchQyUserQuery<QyUserEntity> query) {
Page<QyUserEntity> page = userService.getUserList(query);
@ -48,7 +51,11 @@ public class QyUserApplicationService {
SysUserQyUserEntity sysUserQyUser = sysUserQyUserService.getByQyUserId(id.intValue());
if (sysUserQyUser != null) {
SysUserEntity sysUser = sysUserService.getById(sysUserQyUser.getSysUserId());
dto.setSysUser(new UserDTO(sysUser));
if (sysUser != null && sysUser.getRoleId()!= null) {
SysRoleEntity sysRole = sysRoleService.getById(sysUser.getRoleId());
dto.setRoleId(sysUser.getRoleId());
dto.setRoleName(sysRole.getRoleName());
}
}
return dto;
}
@ -67,6 +74,16 @@ public class QyUserApplicationService {
UserModel model = qyUserModelFactory.loadById(command.getId());
model.loadUpdateCommand(command);
model.updateById();
if (command.getRoleId() == null) {
return;
}
SysUserQyUserEntity sysUserQyUser = sysUserQyUserService.getByQyUserId(command.getId());
if (sysUserQyUser != null) {
SysUserEntity sysUser = sysUserService.getById(sysUserQyUser.getSysUserId());
sysUser.setRoleId(command.getRoleId() > 0 ? command.getRoleId() : null);
sysUserService.updateById(sysUser);
}
}
public void deleteUser(BulkOperationCommand<Integer> command) {

View File

@ -12,4 +12,7 @@ public class UpdateQyUserCommand extends AddQyUserCommand {
@NotNull
@PositiveOrZero
private Integer id;
private Long roleId;
}

View File

@ -148,6 +148,10 @@ public class QyUserEntity extends BaseEntity<QyUserEntity> {
@TableField("balance")
private BigDecimal balance;
@ApiModelProperty("系统角色id")
@TableField("sys_role_id")
private Long sysRoleId;
@Override
public Serializable pkVal() {
return this.id;

View File

@ -21,7 +21,7 @@ public class QyUserServiceImpl extends ServiceImpl<QyUserMapper, QyUserEntity> i
@Override
public Page<QyUserEntity> getUserList(AbstractPageQuery<QyUserEntity> query) {
return this.page(query.toPage(), query.toQueryWrapper());
return baseMapper.getUserList(query.toPage(), query.toQueryWrapper());
}
@Override

View File

@ -24,19 +24,16 @@ public class QyUserDTO {
if (entity != null) {
BeanUtil.copyProperties(entity, this);
SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
/*SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
if (creator != null) {
this.operator = creator.getUsername();
}
}*/
this.enableStatus = "1".equals(entity.getEnable()) ? "启用" : "停用";
this.createTimeStr = DateUtil.format(entity.getCreateTime(), "yyyy-MM-dd HH:mm:ss");
}
}
// 系统用户
private UserDTO sysUser;
@ExcelColumn(name = "用户ID")
private Integer id;
@ -108,4 +105,13 @@ public class QyUserDTO {
@ExcelColumn(name = "用户余额")
private BigDecimal balance;
@ExcelColumn(name = "系统角色ID")
private Long sysRoleId;
@ExcelColumn(name = "角色ID")
private Long roleId;
@ExcelColumn(name = "角色名称")
private String roleName;
}

View File

@ -20,6 +20,7 @@ public class SearchQyUserQuery<T> extends AbstractPageQuery<T> {
private String enable;
private Date startTime;
private Date endTime;
private Long sysRoleId;
@Override
public QueryWrapper<T> addQueryCondition() {
@ -28,12 +29,14 @@ public class SearchQyUserQuery<T> extends AbstractPageQuery<T> {
queryWrapper
.eq(StrUtil.isNotBlank(corpid), "corpid", corpid)
.eq(StrUtil.isNotBlank(userid), "userid", userid)
.eq(sysRoleId != null, "sys_role_id", sysRoleId)
.like(StrUtil.isNotBlank(name), "name", name)
.like(StrUtil.isNotBlank(mobile), "mobile", mobile)
.eq(StrUtil.isNotBlank(department), "department", department)
.eq(StrUtil.isNotBlank(mainDepartment), "main_department", mainDepartment)
.eq(StrUtil.isNotBlank(enable), "enable", enable)
.between(startTime != null && endTime != null, "create_time", startTime, endTime);
.between(startTime != null && endTime != null, "create_time", startTime, endTime)
.orderByDesc("id");
this.timeRangeColumn = "create_time";

View File

@ -13,6 +13,8 @@ import com.agileboot.domain.shop.goods.model.GoodsModel;
import com.agileboot.domain.shop.goods.model.GoodsModelFactory;
import com.agileboot.domain.shop.goods.query.SearchShopGoodsQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
@ -69,4 +71,12 @@ public class GoodsApplicationService {
public ShopGoodsDTO getGoodsInfo(Long goodsId) {
return new ShopGoodsDTO(shopGoodsService.getGoodsInfo(goodsId));
}
public Long countAllRecord() {
return shopGoodsService.countAllRecord();
}
public BigDecimal calculateTotalAmount() {
return shopGoodsService.calculateTotalAmount();
}
}

View File

@ -20,6 +20,7 @@ public class SearchGoodsWithCabinetDO extends BaseEntity<SearchGoodsWithCabinetD
private Integer status;
private String coverImg;
private String goodsDetail;
private String usageInstruction;
private String remark;
@TableField("sc.cabinet_id")

View File

@ -68,6 +68,9 @@ public class ShopGoodsEntity extends BaseEntity<ShopGoodsEntity> {
@TableField("remark")
private String remark;
@ApiModelProperty("商品使用说明")
@TableField("usage_instruction")
private String usageInstruction;
@Override
public Serializable pkVal() {

View File

@ -4,6 +4,8 @@ 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.math.BigDecimal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -36,7 +38,7 @@ public interface ShopGoodsMapper extends BaseMapper<ShopGoodsEntity> {
@Param(Constants.WRAPPER) Wrapper<SearchGoodsDO> queryWrapper
); */
@Select("SELECT g.goods_id, g.goods_name, g.category_id, g.price, " +
"g.stock, g.status, g.auto_approval, g.cover_img, SUM(cc.stock) AS total_stock, " +
"g.stock, g.status, g.auto_approval, g.cover_img, g.usage_instruction, SUM(cc.stock) AS total_stock, " +
"GROUP_CONCAT(DISTINCT cc.cell_no) AS cell_no_str, " +
"GROUP_CONCAT(DISTINCT sc.cabinet_name) AS cabinet_name " +
"FROM shop_goods g " +
@ -63,7 +65,7 @@ public interface ShopGoodsMapper extends BaseMapper<ShopGoodsEntity> {
* @return 商品列表
*/
@Select("SELECT g.goods_id, g.goods_name, g.category_id, g.price, " +
"g.status, g.cover_img, g.goods_detail, " +
"g.status, g.cover_img, g.goods_detail, g.usage_instruction, " +
"g.creator_id, g.create_time, g.updater_id, g.update_time, g.remark, g.deleted, " +
"sc.cabinet_id, sc.cabinet_name, cc.stock, cc.cell_id " +
"FROM shop_goods g " +
@ -73,7 +75,7 @@ public interface ShopGoodsMapper extends BaseMapper<ShopGoodsEntity> {
List<SearchGoodsWithCabinetDO> getGoodsWithCabinetList();
@Select("SELECT g.goods_id, g.goods_name, g.category_id, g.price, " +
"g.status, g.cover_img, g.goods_detail, " +
"g.status, g.cover_img, g.goods_detail, g.usage_instruction, " +
"g.creator_id, g.create_time, g.updater_id, g.update_time, g.remark, g.deleted, " +
"sc.cabinet_id, sc.cabinet_name, sc.shop_id, cc.stock, cc.cell_id " +
"FROM shop_goods g " +
@ -91,4 +93,14 @@ public interface ShopGoodsMapper extends BaseMapper<ShopGoodsEntity> {
"LEFT JOIN smart_cabinet sc ON cc.cabinet_id = sc.cabinet_id AND sc.deleted = 0 " +
"WHERE g.goods_id = #{goodsId} ")
SearchGoodsDO getGoodsInfo(@Param("goodsId") Long goodsId);
@Select("SELECT COUNT(1) FROM shop_goods WHERE deleted = 0")
Long countAllRecord();
/**
* 计算所有未删除商品的总金额price * stock
* @return 商品总金额
*/
@Select("SELECT SUM(price * stock) FROM shop_goods WHERE deleted = 0")
BigDecimal calculateTotalAmount();
}

View File

@ -4,6 +4,7 @@ import com.agileboot.common.core.page.AbstractPageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.math.BigDecimal;
import java.util.List;
/**
@ -22,4 +23,8 @@ public interface ShopGoodsService extends IService<ShopGoodsEntity> {
List<SearchGoodsWithCabinetDO> getGoodsWithCabinetList(Long shopId);
SearchGoodsDO getGoodsInfo(Long goodsId);
Long countAllRecord();
BigDecimal calculateTotalAmount();
}

View File

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
/**
@ -45,4 +47,14 @@ public class ShopGoodsServiceImpl extends ServiceImpl<ShopGoodsMapper, ShopGoods
public SearchGoodsDO getGoodsInfo(Long goodsId) {
return baseMapper.getGoodsInfo(goodsId);
}
@Override
public Long countAllRecord() {
return baseMapper.countAllRecord();
}
@Override
public BigDecimal calculateTotalAmount() {
return baseMapper.calculateTotalAmount();
}
}

View File

@ -86,4 +86,7 @@ public class ShopGoodsDTO {
private String cellNoStr;
@ExcelColumn(name = "已分配库存")
private Integer totalStock;
@ExcelColumn(name = "商品使用说明")
private String usageInstruction;
}

View File

@ -25,14 +25,12 @@ import com.agileboot.domain.qywx.user.model.QyUserModelFactory;
import com.agileboot.domain.shop.goods.db.ShopGoodsEntity;
import com.agileboot.domain.shop.goods.db.ShopGoodsService;
import com.agileboot.domain.shop.order.command.SubmitOrderCommand;
import com.agileboot.domain.shop.order.db.ShopOrderEntity;
import com.agileboot.domain.shop.order.db.ShopOrderService;
import com.agileboot.domain.shop.order.db.ShopOrderGoodsEntity;
import com.agileboot.domain.shop.order.db.ShopOrderGoodsService;
import com.agileboot.domain.shop.order.db.*;
import com.agileboot.domain.shop.order.db.dto.OrderWithGoodsDTO;
import com.agileboot.domain.shop.order.dto.CreateOrderResult;
import com.agileboot.domain.shop.order.dto.GetOrdersByOpenIdDTO;
import com.agileboot.domain.shop.order.dto.ShopOrderDTO;
import com.agileboot.domain.shop.order.dto.TopGoodsDTO;
import com.agileboot.domain.shop.order.model.OrderModel;
import com.agileboot.domain.shop.order.model.OrderModelFactory;
import com.agileboot.domain.shop.order.model.OrderGoodsModel;
@ -339,4 +337,24 @@ public class OrderApplicationService {
public OrderModel loadById(Long orderId) {
return orderModelFactory.loadById(orderId);
}
public Long countAllRecord() {
return orderService.countAllRecord();
}
public List<TopGoodsDTO> selectTopGoodsByOccurrence(){
return orderGoodsService.selectTopGoodsByOccurrence();
}
public List<TodayLatestOrderGoodsDTO> selectTodayLatestOrderGoods(){
return orderGoodsService.selectTodayLatestOrderGoods();
}
public BigDecimal sumTotalAmount() {
return orderService.sumTotalAmount();
}
public List<ShopOrderGoodsEntity> selectUnReturnOrderGoods() {
return orderGoodsService.selectUnReturnOrderGoods();
}
}

View File

@ -1,5 +1,6 @@
package com.agileboot.domain.shop.order.db;
import com.agileboot.domain.shop.order.dto.TopGoodsDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -22,4 +23,32 @@ public interface ShopOrderGoodsMapper extends BaseMapper<ShopOrderGoodsEntity> {
@Select("SELECT * FROM shop_order_goods WHERE order_id = #{orderId} AND deleted = 0")
List<ShopOrderGoodsEntity> selectByOrderId(@Param("orderId") Long orderId);
@Select("SELECT sog.goods_id, sg.goods_name, sg.cover_img, COUNT(*) AS occurrence_count " +
"FROM shop_order_goods sog " +
"JOIN shop_goods sg ON sog.goods_id = sg.goods_id " +
"WHERE sog.deleted = 0 AND sg.deleted = 0 AND sog.goods_id != 6 " +
"GROUP BY sog.goods_id, sg.goods_name, sg.cover_img " +
"ORDER BY occurrence_count DESC " +
"LIMIT 10")
List<TopGoodsDTO> selectTopGoodsByOccurrence();
@Select("SELECT sog.*, so.name AS buyer_name " +
"FROM shop_order_goods sog " +
"JOIN shop_order so ON sog.order_id = so.order_id " +
"WHERE sog.deleted = 0 AND so.deleted = 0 " +
"AND DATE(sog.create_time) = CURRENT_DATE " +
"ORDER BY sog.create_time DESC " +
"LIMIT 10")
List<TodayLatestOrderGoodsDTO> selectTodayLatestOrderGoods();
@Select("SELECT og.* " +
"FROM shop_order_goods og " +
"LEFT JOIN shop_goods g ON og.goods_id = g.goods_id " +
"LEFT JOIN cabinet_cell cc ON og.cell_id = cc.cell_id " +
"WHERE og.status = 1 " +
"AND og.deleted = 0 " +
"AND g.deleted = 0 " +
"AND cc.deleted = 0 AND cc.goods_id = og.goods_id")
List<ShopOrderGoodsEntity> selectUnReturnOrderGoods();
}

View File

@ -1,6 +1,8 @@
package com.agileboot.domain.shop.order.db;
import com.agileboot.domain.shop.order.dto.TopGoodsDTO;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@ -16,4 +18,10 @@ public interface ShopOrderGoodsService extends IService<ShopOrderGoodsEntity> {
ShopOrderGoodsEntity getByOrderIdAndGoodsId(Long orderId, Long goodsId);
List<ShopOrderGoodsEntity> selectByOrderId(Long orderId);
List<TopGoodsDTO> selectTopGoodsByOccurrence();
List<TodayLatestOrderGoodsDTO> selectTodayLatestOrderGoods();
List<ShopOrderGoodsEntity> selectUnReturnOrderGoods();
}

View File

@ -1,5 +1,6 @@
package com.agileboot.domain.shop.order.db;
import com.agileboot.domain.shop.order.dto.TopGoodsDTO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@ -26,4 +27,19 @@ public class ShopOrderGoodsServiceImpl extends ServiceImpl<ShopOrderGoodsMapper,
return baseMapper.selectByOrderId(orderId);
}
@Override
public List<TopGoodsDTO> selectTopGoodsByOccurrence() {
return baseMapper.selectTopGoodsByOccurrence();
}
@Override
public List<TodayLatestOrderGoodsDTO> selectTodayLatestOrderGoods() {
return baseMapper.selectTodayLatestOrderGoods();
}
@Override
public List<ShopOrderGoodsEntity> selectUnReturnOrderGoods() {
return baseMapper.selectUnReturnOrderGoods();
}
}

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal;
/**
* <p>
* 商品订单表 Mapper 接口
@ -29,4 +31,11 @@ public interface ShopOrderMapper extends BaseMapper<ShopOrderEntity> {
Page<OrderWithGoodsDTO> page,
@Param(Constants.WRAPPER) Wrapper<OrderWithGoodsDTO> queryWrapper
);
@Select("SELECT COUNT(1) FROM shop_order WHERE deleted = 0")
Long countAllRecord();
@Select("SELECT SUM(total_amount) FROM shop_order " +
"WHERE deleted = 0 and pay_status in (2,3,4) and payment_method = 'wechat'")
BigDecimal sumTotalAmount();
}

View File

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.math.BigDecimal;
/**
* <p>
* 商品订单表 服务类
@ -16,4 +18,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface ShopOrderService extends IService<ShopOrderEntity> {
Page<OrderWithGoodsDTO> getOrderList(SearchShopOrderQuery<OrderWithGoodsDTO> query);
Long countAllRecord();
BigDecimal sumTotalAmount();
}

View File

@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* <p>
* 商品订单表 服务实现类
@ -23,4 +25,14 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder
public Page<OrderWithGoodsDTO> getOrderList(SearchShopOrderQuery<OrderWithGoodsDTO> query) {
return baseMapper.getOrderList(query.toPage(), query.toQueryWrapper());
}
@Override
public Long countAllRecord() {
return baseMapper.countAllRecord();
}
@Override
public BigDecimal sumTotalAmount() {
return baseMapper.sumTotalAmount();
}
}

View File

@ -0,0 +1,63 @@
package com.agileboot.domain.shop.order.db;
import com.agileboot.common.core.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.util.Date;
/**
* <p>
* 今日最新订单商品DTO
* </p>
*
* @author valarchie
* @since 2025-03-10
*/
@Getter
@Setter
@ApiModel(value = "TodayLatestOrderGoodsDTO对象", description = "今日最新订单商品DTO")
public class TodayLatestOrderGoodsDTO extends BaseEntity<TodayLatestOrderGoodsDTO> {
@ApiModelProperty("订单商品唯一ID")
private Long orderGoodsId;
@ApiModelProperty("关联订单ID")
private Long orderId;
@ApiModelProperty("关联商品ID")
private Long goodsId;
@ApiModelProperty("关联格口ID")
private Long cellId;
@ApiModelProperty("购买数量")
private Integer quantity;
@ApiModelProperty("购买时单价")
private BigDecimal price;
@ApiModelProperty("商品总金额")
private BigDecimal totalAmount;
@ApiModelProperty("商品名称")
private String goodsName;
@ApiModelProperty("封面图URL")
private String coverImg;
@ApiModelProperty("商品状态1正常 2已退货 3已换货 4已完成 5审核中 6退货未通过")
private Integer status;
@ApiModelProperty("买家姓名")
private String buyerName;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("创建时间")
private String createTimeStr;
}

View File

@ -0,0 +1,22 @@
package com.agileboot.domain.shop.order.dto;
import com.agileboot.common.annotation.ExcelColumn;
import com.agileboot.common.annotation.ExcelSheet;
import lombok.Data;
@ExcelSheet(name = "热门商品统计")
@Data
public class TopGoodsDTO {
@ExcelColumn(name = "商品ID")
private Long goodsId;
@ExcelColumn(name = "商品名称")
private String goodsName;
@ExcelColumn(name = "封面图片")
private String coverImg;
@ExcelColumn(name = "出现次数")
private Integer occurrenceCount;
}

View File

@ -50,4 +50,8 @@ public class ShopApplicationService {
model.deleteById();
}
}
public Long countAllRecord() {
return shopService.countAllRecord();
}
}

View File

@ -40,4 +40,7 @@ public interface ShopMapper extends BaseMapper<ShopEntity> {
@Select("SELECT * FROM shop WHERE shop_name = #{shopName} LIMIT 1")
ShopEntity selectByShopName(String shopName);
@Select("SELECT COUNT(1) FROM shop WHERE deleted = 0")
Long countAllRecord();
}

View File

@ -25,4 +25,6 @@ public interface ShopService extends IService<ShopEntity> {
ShopEntity selectByShopId(Long shopId);
ShopEntity selectByShopName(String shopName);
Long countAllRecord();
}

View File

@ -42,4 +42,9 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopEntity> impleme
public ShopEntity selectByShopName(String shopName) {
return baseMapper.selectByShopName(shopName);
}
@Override
public Long countAllRecord() {
return baseMapper.countAllRecord();
}
}

View File

@ -0,0 +1,58 @@
package com.agileboot.domain.shop.shop.dto;
import com.agileboot.common.annotation.ExcelColumn;
import com.agileboot.common.annotation.ExcelSheet;
import com.agileboot.domain.shop.order.db.TodayLatestOrderGoodsDTO;
import com.agileboot.domain.shop.order.dto.TopGoodsDTO;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@ExcelSheet(name = "统计数据")
@Data
public class StatsDTO {
@ExcelColumn(name = "商店数量")
private Long shopCount;
@ExcelColumn(name = "商品数量")
private Long goodsCount;
@ExcelColumn(name = "商品总金额")
private BigDecimal goodsTotalAmount;
@ExcelColumn(name = "订单数量")
private Long orderCount;
@ExcelColumn(name = "总订单金额")
private BigDecimal orderAmountSum;
@ExcelColumn(name = "总柜子数量")
private Long cabinetCount;
@ExcelColumn(name = "未还商品数量")
private Long unReturnedGoodsCount;
@ExcelColumn(name = "未还订单数量")
private Long unReturnedOrderCount;
@ExcelColumn(name = "未还金额")
private BigDecimal unReturnedAmount;
@ExcelColumn(name = "总格口数量")
private Long cellCount;
@ExcelColumn(name = "已关联格口数量")
private Long linkedCellCount;
@ExcelColumn(name = "未管理格口数量")
private Long unmanagedCellCount;
@ExcelColumn(name = "网关数量")
private Long gatewayCount;
private List<TopGoodsDTO> topGoods;
private List<TodayLatestOrderGoodsDTO> todayLatestOrderGoods;
}

View File

@ -21,10 +21,10 @@ public class NoticeDTO {
this.status = entity.getStatus();
this.createTime = entity.getCreateTime();
SysUserEntity cacheUser = CacheCenter.userCache.getObjectById(entity.getCreatorId());
/*SysUserEntity cacheUser = CacheCenter.userCache.getObjectById(entity.getCreatorId());
if (cacheUser != null) {
this.creatorName = cacheUser.getUsername();
}
}*/
}
}

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.tag.db.Ab98UserTagMapper">
</mapper>

View File

@ -11,7 +11,7 @@ public enum CacheKeyEnum {
* Redis各类缓存集合
*/
CAPTCHAT("captcha_codes:", 2, TimeUnit.MINUTES),
LOGIN_USER_KEY("login_tokens:", 30, TimeUnit.MINUTES),
LOGIN_USER_KEY("login_tokens:", 10*60, TimeUnit.MINUTES),
RATE_LIMIT_KEY("rate_limit:", 60, TimeUnit.SECONDS),
USER_ENTITY_KEY("user_entity:", 60, TimeUnit.MINUTES),
ROLE_ENTITY_KEY("role_entity:", 60, TimeUnit.MINUTES),

View File

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

7
sql/20250520_goods.sql Normal file
View File

@ -0,0 +1,7 @@
ALTER TABLE `shop_goods`
ADD COLUMN `usage_instruction` VARCHAR(512) NULL COMMENT '商品使用说明'
AFTER `goods_detail`;
ALTER TABLE `qy_user`
ADD COLUMN `sys_role_id` BIGINT DEFAULT NULL COMMENT '系统角色id'
AFTER `balance`;

View File

@ -0,0 +1,15 @@
DROP TABLE IF EXISTS `ab98_user_tag`;
CREATE TABLE `ab98_user_tag` (
`tag_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '标签ID',
`ab98_user_id` BIGINT NOT NULL COMMENT '关联用户ID',
`tag_name` VARCHAR(50) NOT NULL COMMENT '标签名称',
`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 (`tag_id`),
KEY `idx_user` (`ab98_user_id`),
CONSTRAINT `fk_tag_user` FOREIGN KEY (`ab98_user_id`) REFERENCES `ab98_user` (`ab98_user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户标签表';