Merge remote-tracking branch 'origin/master'

This commit is contained in:
2025-03-20 11:17:22 +08:00
11 changed files with 62 additions and 36 deletions

View File

@@ -100,9 +100,6 @@ public class HandoverRecordController {
//@SaAdminCheckPermission("handoverRecord:handover")
public CzgResult<Long> handover(@RequestParam Integer isPrint) {
Long id = handoverRecordService.handover();
if (isPrint == 1){
rabbitPublisher.sendHandoverPrintMsg(id.toString());
}
return CzgResult.success(id);
}

View File

@@ -3,14 +3,10 @@ package com.czg.controller.admin;
import com.czg.account.dto.user.SysUserAddDTO;
import com.czg.account.dto.user.SysUserEditDTO;
import com.czg.account.dto.user.SysUserEditPwdDTO;
import com.czg.account.entity.SysUser;
import com.czg.account.entity.SysUsersRoles;
import com.czg.account.service.SysUserService;
import com.czg.account.vo.SysUserDetailVO;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.annotation.SaAdminCheckRole;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
@@ -40,7 +36,7 @@ public class SysController {
// @SaAdminCheckPermission("sysUser:list")
@SaAdminCheckRole("admin")
@GetMapping
public CzgResult<Page<SysUser>> list(String key, String startTime, String endTime, Integer status) {
public CzgResult<Page<SysUserDetailVO>> list(String key, String startTime, String endTime, Integer status) {
return CzgResult.success(sysUserService.getPage(key, startTime, endTime, status));
}

View File

@@ -4,11 +4,24 @@ import com.czg.account.entity.ShopUser;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* @author Administrator
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ShopUserDTO extends ShopUser {
/**
* 优惠券数量
*/
private Long couponNum;
/**
* 订单数量
*/
private Long orderNumber;
/**
* 充值金额
*/
private BigDecimal rechargeAmount;
}

View File

@@ -30,9 +30,6 @@ public class FreeDineConfig implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 是否启用
*/
@@ -71,6 +68,7 @@ public class FreeDineConfig implements Serializable {
/**
* 门店id
*/
@Id
private Long shopId;
/**

View File

@@ -25,7 +25,7 @@ public interface SysUserService extends IService<SysUser> {
Boolean removeUserAndRole(Long id);
Page<SysUser> getPage(String key, String startTime, String endTime, Integer status);
Page<SysUserDetailVO> getPage(String key, String startTime, String endTime, Integer status);
Boolean edit(SysUserEditDTO sysUserEditDTO);

View File

@@ -1,7 +1,11 @@
package com.czg.service.account.mapper;
import com.czg.account.entity.SysUser;
import com.czg.account.vo.SysUserDetailVO;
import com.mybatisflex.core.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 系统用户 映射层。
@@ -11,4 +15,5 @@ import com.mybatisflex.core.BaseMapper;
*/
public interface SysUserMapper extends BaseMapper<SysUser> {
List<SysUserDetailVO> page(@Param("key") String key, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("status") Integer status);
}

View File

@@ -31,6 +31,7 @@ import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -98,7 +99,13 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
if (merchantRegister.getStatus() == 1) {
throw new CzgException("激活码已使用");
}
// 续期
if (shopInfo.getExpireTime() != null && shopInfo.getExpireTime().isAfter(LocalDateTime.now())) {
shopInfo.setExpireTime(DateUtil.offsetMonth(DateUtil.date(shopInfo.getExpireTime()), merchantRegister.getPeriodMonth()).toLocalDateTime());
}else {
shopInfo.setExpireTime(DateUtil.offsetMonth(DateUtil.date(), merchantRegister.getPeriodMonth()).toLocalDateTime());
}
merchantRegister.setStatus(1);
merchantRegister.setShopId(shopInfo.getId());
merchantRegisterService.updateById(merchantRegister);

View File

@@ -22,6 +22,8 @@ import com.czg.service.account.mapper.SysRoleMapper;
import com.czg.service.account.mapper.SysUserMapper;
import com.czg.service.account.mapper.SysUsersRolesMapper;
import com.czg.utils.PageUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
@@ -99,24 +101,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
}
@Override
public Page<SysUser> getPage(String key, String startTime, String endTime, Integer status) {
QueryWrapper queryWrapper = new QueryWrapper();
if (StrUtil.isNotBlank(key)) {
queryWrapper.and(column(SysUser::getAccount).like(key).or(column(SysUser::getNickName).like(key)));
}
if (StrUtil.isNotBlank(startTime)) {
queryWrapper.ge(SysUser::getCreateTime, DateUtil.parse(startTime));
}
if (StrUtil.isNotBlank(endTime)) {
queryWrapper.le(SysUser::getCreateTime, DateUtil.parse(endTime));
}
if (status != null) {
queryWrapper.eq(SysUser::getStatus, status);
}
return page(PageUtil.buildPage(), queryWrapper);
public Page<SysUserDetailVO> getPage(String key, String startTime, String endTime, Integer status) {
PageHelper.startPage(PageUtil.buildPageHelp());
return PageUtil.convert(new PageInfo<>(mapper.page(key, startTime, endTime, status)));
}
@Override
@@ -180,8 +167,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override
public void download(String key, String startTime, String endTime, Integer status, HttpServletResponse response) throws IOException {
Page<SysUser> sysUserPage = getPage(key, startTime, endTime, status);
List<SysUser> records = sysUserPage.getRecords();
Page<SysUserDetailVO> sysUserPage = getPage(key, startTime, endTime, status);
List<SysUserDetailVO> records = sysUserPage.getRecords();
// 1. 创建 ExcelWriter
// true 表示使用 XLSX 格式

View File

@@ -41,7 +41,7 @@
<select id="selectAssetsSummary" resultType="com.czg.account.dto.user.userinfo.UserInfoAssetsSummaryDTO">
select sum(IFNULL(b.amount, 0)) as amount,
sum(IFNULL(b.account_points, 0)) as points,
sum(IFNULL(c.id, 0)) as couponNum
count(c.id) as couponNum
from tb_user_info as a
left join tb_shop_user as b on a.id = b.user_id
left join tb_shop_activate_coupon_record as c
@@ -50,11 +50,13 @@
</select>
<select id="selectPageByKeyAndIsVip" resultType="com.czg.account.dto.shopuser.ShopUserDTO">
SELECT
a.*, count(c.id) couponNum
a.*, count(c.id) couponNum, count(d.id) orderNumber, IFNULL(sum(f.amount), 0) rechargeAmount
FROM
tb_shop_user a
LEFT JOIN tb_user_info b ON b.id = a.user_id
left join tb_shop_activate_coupon_record c on c.shop_user_id=a.id and c.`status`=0
left join tb_order_info as d on d.user_id=a.user_id and d.shop_id=a.shop_id
left join tb_shop_user_flow as f on f.user_id=a.user_id and f.shop_id=a.shop_id and f.biz_code in ('cashIn', 'wechatIn', 'alipayIn')
where a.shop_id=#{shopId}
<if test="isVip != null">

View File

@@ -4,4 +4,25 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.account.mapper.SysUserMapper">
<select id="page" resultType="com.czg.account.vo.SysUserDetailVO">
select a.*, b.role_id from sys_user as a
left join sys_users_roles as b on a.id=b.user_id
<where>
<if test="key != null and key != ''">
and (a.nick_name like concat('%', #{key}, '%') or a.account like concat('%', #{key}, '%'))
</if>
<if test="startTime != null and startTime != ''">
and a.create_time >= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and a.create_time &lt;= #{endTime}
</if>
<if test="status != null">
and a.status=#{status}
</if>
</where>
order by a.create_time desc
</select>
</mapper>

View File

@@ -162,7 +162,7 @@ public interface PrinterImpl {
StringBuilder builder = new StringBuilder()
.append(getFormatLabel(handoverRecord.getShopName(), signLabelInfo.center, signLabelInfo.f)).append(signLabelInfo.br)
.append(getFormatLabel("交班小票", signLabelInfo.l,signLabelInfo.center)).append(signLabelInfo.br)
.append("交班时间: ").append(handoverRecord.getHandoverTime()).append(signLabelInfo.br)
.append("交班时间: ").append(DateUtil.format(handoverRecord.getHandoverTime(), "yyyy-MM-dd HH:mm:ss")).append(signLabelInfo.br)
.append("收银员: ").append(handoverRecord.getStaffName()).append(signLabelInfo.br)
.append("当班总收入: ").append(handoverRecord.getHandAmount()).append(signLabelInfo.br)
.append("现金收入: ").append(handoverRecord.getCashAmount()).append(signLabelInfo.br)