Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai 2025-04-07 10:13:57 +08:00
commit 75df0b07c3
16 changed files with 449 additions and 70 deletions

View File

@ -0,0 +1,73 @@
package com.czg.controller.admin;
import com.czg.account.entity.SyncNotice;
import com.czg.account.service.SyncNoticeService;
import com.czg.product.dto.SyncNoticeReadDTO;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 通知中心-同步消息
* @author Administrator
*/
@RestController
@RequestMapping("/admin/syncNotice")
public class SyncNoticeController {
@Resource
private SyncNoticeService syncNoticeService;
/**
* 通知消息列表
* @param name 名称
* @param startTime 起始时间
* @param endTime 结束时间
* @param type 0-商品 1-耗材
* @param isRead 0-未读 1-已读
* @return 分页数据
*/
@GetMapping
public CzgResult<Page<SyncNotice>> page(@RequestParam(required = false) String name, @RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime, @RequestParam(required = false) Integer type,
@RequestParam(required = false) Integer isRead) {
return CzgResult.success(syncNoticeService.pageInfo(StpKit.USER.getShopId(), name, startTime, endTime, type, isRead));
}
/**
* 详情
* @param id id
* @return 详细信息
*/
@GetMapping("/detail")
public CzgResult<SyncNotice> detail(@RequestParam Long id) {
return CzgResult.success(syncNoticeService.getOne(new QueryWrapper().eq(SyncNotice::getShopId, StpKit.USER.getShopId()).eq(SyncNotice::getId, id)));
}
/**
* 已读消息
* @return 是否成功
*/
@PutMapping("/read")
public CzgResult<Boolean> read(@RequestBody @Validated SyncNoticeReadDTO syncNoticeReadDTO) {
return CzgResult.success(syncNoticeService.read(StpKit.USER.getShopId(), syncNoticeReadDTO));
}
/**
* 消息统计
* @return 消息记录数
*/
@PutMapping("/count")
public CzgResult<Long> count(@RequestParam Integer isRead) {
QueryWrapper queryWrapper = new QueryWrapper().eq(SyncNotice::getShopId, StpKit.USER.getShopId());
queryWrapper.eq(SyncNotice::getIsRead, isRead);
return CzgResult.success(syncNoticeService.count(queryWrapper));
}
}

View File

@ -110,7 +110,7 @@ public class ShopVendorController {
* @return 统计信息 * @return 统计信息
*/ */
@GetMapping("summary") @GetMapping("summary")
@OperationLog("供应商账单-统计") // @OperationLog("供应商账单-统计")
public CzgResult<ShopVendorSummaryVO> summary() { public CzgResult<ShopVendorSummaryVO> summary() {
return CzgResult.success(shopVendorService.summary(StpKit.USER.getShopId())); return CzgResult.success(shopVendorService.summary(StpKit.USER.getShopId()));
} }
@ -120,9 +120,9 @@ public class ShopVendorController {
* @return 账单列表 * @return 账单列表
*/ */
@GetMapping("/bill") @GetMapping("/bill")
@OperationLog("供应商账单-列表") // @OperationLog("供应商账单-列表")
public CzgResult<Page<ShopVendorBillVO>> bill() { public CzgResult<Page<ShopVendorBillVO>> bill(@RequestParam(required = false) String key) {
return CzgResult.success(shopVendorService.billList(StpKit.USER.getShopId())); return CzgResult.success(shopVendorService.billList(StpKit.USER.getShopId(), key));
} }
/** /**
@ -130,9 +130,9 @@ public class ShopVendorController {
* @return 记录list * @return 记录list
*/ */
@GetMapping("/bill/record") @GetMapping("/bill/record")
@OperationLog("供应商账单-列表") // @OperationLog("供应商账单-列表")
public CzgResult<Page<ShopVendorBillRecordVO>> bill(@RequestParam Integer vendorId) { public CzgResult<Page<ShopVendorBillRecordVO>> bill(@RequestParam Integer vendorId, @RequestParam(required = false) String key) {
return CzgResult.success(shopVendorService.billRecord(StpKit.USER.getShopId(), vendorId)); return CzgResult.success(shopVendorService.billRecord(StpKit.USER.getShopId(), vendorId, key));
} }
@ -141,7 +141,7 @@ public class ShopVendorController {
* @return 记录list * @return 记录list
*/ */
@PostMapping("/bill/pay") @PostMapping("/bill/pay")
@OperationLog("供应商账单-付款") // @OperationLog("供应商账单-付款")
public CzgResult<Boolean> pay(@RequestBody @Validated ShopVendorBillPayDTO payDTO) { public CzgResult<Boolean> pay(@RequestBody @Validated ShopVendorBillPayDTO payDTO) {
return CzgResult.success(shopVendorService.pay(StpKit.USER.getShopId(), payDTO)); return CzgResult.success(shopVendorService.pay(StpKit.USER.getShopId(), payDTO));
} }
@ -152,7 +152,7 @@ public class ShopVendorController {
* @return 记录list * @return 记录list
*/ */
@GetMapping("/bill/pay/record") @GetMapping("/bill/pay/record")
@OperationLog("供应商账单-付款记录") // @OperationLog("供应商账单-付款记录")
public CzgResult<Page<ShopVendorBillPayRecordVO>> payRecord(@RequestParam Long flowId) { public CzgResult<Page<ShopVendorBillPayRecordVO>> payRecord(@RequestParam Long flowId) {
return CzgResult.success(shopVendorService.payRecord(StpKit.USER.getShopId(), flowId)); return CzgResult.success(shopVendorService.payRecord(StpKit.USER.getShopId(), flowId));
} }

View File

@ -0,0 +1,64 @@
package com.czg.account.dto;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.alibaba.fastjson2.annotation.JSONField;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 实体类
*
* @author zs
* @since 2025-04-07
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SyncNoticeDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long id;
/**
* 商品名称或耗材名称
*/
private String name;
/**
* 来源id
*/
private Long sourceId;
/**
* 操作用户id
*/
private Long sysUserId;
/**
* 通知类型 0 商品变动 1 耗材变动
*/
private Integer type;
/**
* 是否已读1已读
*/
private Integer isRead;
/**
* 店铺id
*/
private Long shopId;
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
}

View File

@ -38,7 +38,7 @@ public class ShopInfo implements Serializable {
/** /**
* 主店id * 主店id
*/ */
private Integer mainId; private Long mainId;
/** /**
* 店铺口号 * 店铺口号
@ -90,7 +90,7 @@ public class ShopInfo implements Serializable {
*/ */
private String detail; private String detail;
/** /**
* 注册类型 * 注册类型经营模式
* 快餐版 先付 munchies * 快餐版 先付 munchies
* 餐饮版 先付/后付 restaurant * 餐饮版 先付/后付 restaurant
*/ */
@ -187,46 +187,11 @@ public class ShopInfo implements Serializable {
*/ */
private String address; private String address;
/**
* 是否允许会员自定义金额 1 允许 0 不允许
*/
private Integer isCustomAmount;
/**
* 是否开启退款密码 1 启用 0 禁用
*/
private Integer isReturnPwd;
/**
* 是否开启会员充值密码 1 启用 0 禁用
*/
private Integer isMemberInPwd;
/**
* 是否开启会员退款密码 1 启用 0 禁用
*/
private Integer isMemberReturnPwd;
/**
* 是否免除桌位费 0否1是
*/
private Integer isTableFee;
/**
* 是否开启会员余额支付
*/
private Integer isAccountPay;
/** /**
* 桌位费 * 桌位费
*/ */
private BigDecimal tableFee; private BigDecimal tableFee;
/**
* 是否启用会员价 0否1是
*/
private Integer isMemberPrice;
/** /**
* 就餐模式 堂食 dine-in 外带 take-out * 就餐模式 堂食 dine-in 外带 take-out
*/ */
@ -272,4 +237,64 @@ public class ShopInfo implements Serializable {
*/ */
private String taxAmount; private String taxAmount;
/**
* 是否启用商品同步 1- 0-
*/
@Column(ignore = true)
private Integer isEnableProdSync;
/**
* 是否启用会员同步 1- 0-
*/
@Column(ignore = true)
private Integer isEnableVipSync;
/**
* 是否启用耗材同步 1- 0-
*/
@Column(ignore = true)
private Integer isEnableConsSync;
/**
* 是否允许账号登录 1- 0-
*/
@Column(ignore = true)
private Integer isAllowAccountLogin;
/**
* 是否允许会员自定义金额 1-允许 0-不允许
*/
@Column(ignore = true)
private Integer isCustomAmount;
/**
* 是否开启退款密码 1-启用 0-禁用
*/
@Column(ignore = true)
private Integer isReturnPwd;
/**
* 是否开启会员充值密码 1-启用 0-禁用
*/
@Column(ignore = true)
private Integer isMemberInPwd;
/**
* 是否开启会员退款密码 1-启用 0-禁用
*/
@Column(ignore = true)
private Integer isMemberReturnPwd;
/**
* 是否免除桌位费 1- 0-
*/
@Column(ignore = true)
private Integer isTableFee;
/**
* 是否启用会员价 1- 0-
*/
@Column(ignore = true)
private Integer isMemberPrice;
/**
* 是否允许会员余额支付 1- 0-
*/
@Column(ignore = true)
private Integer isAccountPay;
/**
* 是否主店 1- 0-
*/
@Column(ignore = true)
private Integer isHeadShop;
} }

View File

@ -0,0 +1,73 @@
package com.czg.account.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 实体类
*
* @author zs
* @since 2025-04-07
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_sync_notice")
public class SyncNotice implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 商品名称或耗材名称
*/
private String name;
/**
* 来源id
*/
private Long sourceId;
/**
* 操作用户id
*/
private Long sysUserId;
/**
* 通知类型 0 商品变动 1 耗材变动
*/
private Integer type;
/**
* 是否已读1已读
*/
private Integer isRead;
/**
* 店铺id
*/
private Long shopId;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
private LocalDateTime readTime;
}

View File

@ -0,0 +1,31 @@
package com.czg.account.service;
import com.czg.product.dto.SyncNoticeReadDTO;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.czg.account.entity.SyncNotice;
import java.util.List;
/**
* 服务层
*
* @author zs
* @since 2025-04-07
*/
public interface SyncNoticeService extends IService<SyncNotice> {
/**
* 添加消息
* @param shopId 店铺id
* @param sysUserId 操作用户id
* @param name 商品/耗材名称
* @param id 商品/耗材id
* @param type 0-商品 1-耗材
*/
void addNotice(Long shopId, Long sysUserId, String name, Long id, Integer type);
Page<SyncNotice> pageInfo(Long shopId, String name, String startTime, String endTime, Integer type, Integer isRead);
Boolean read(Long shopId, SyncNoticeReadDTO syncNoticeReadDTO);
}

View File

@ -0,0 +1,18 @@
package com.czg.product.dto;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import java.util.List;
/**
* @author Administrator
*/
@Data
public class SyncNoticeReadDTO {
/**
* 消息id
*/
@NotEmpty
private List<Long> noticeIdList;
}

View File

@ -70,7 +70,7 @@ public interface ShopVendorService extends IService<ShopVendor> {
* @param shopId 店铺id * @param shopId 店铺id
* @return 账单 * @return 账单
*/ */
Page<ShopVendorBillVO> billList(Long shopId); Page<ShopVendorBillVO> billList(Long shopId, String key);
/** /**
* 账单记录明细 * 账单记录明细
@ -79,7 +79,7 @@ public interface ShopVendorService extends IService<ShopVendor> {
* @param vendorId 供应商id * @param vendorId 供应商id
* @return 分页 * @return 分页
*/ */
Page<ShopVendorBillRecordVO> billRecord(Long shopId, Integer vendorId); Page<ShopVendorBillRecordVO> billRecord(Long shopId, Integer vendorId, String key);
/** /**
* 账单付款 * 账单付款

View File

@ -0,0 +1,14 @@
package com.czg.service.account.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.SyncNotice;
/**
* 映射层
*
* @author zs
* @since 2025-04-07
*/
public interface SyncNoticeMapper extends BaseMapper<SyncNotice> {
}

View File

@ -0,0 +1,68 @@
package com.czg.service.account.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.czg.product.dto.SyncNoticeReadDTO;
import com.czg.utils.PageUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.SyncNotice;
import com.czg.account.service.SyncNoticeService;
import com.czg.service.account.mapper.SyncNoticeMapper;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 服务层实现
*
* @author zs
* @since 2025-04-07
*/
@Service
public class SyncNoticeServiceImpl extends ServiceImpl<SyncNoticeMapper, SyncNotice> implements SyncNoticeService {
@Override
public void addNotice(Long shopId, Long sysUserId, String name, Long id, Integer type) {
SyncNotice syncNotice = new SyncNotice();
syncNotice.setShopId(shopId);
syncNotice.setSysUserId(sysUserId);
syncNotice.setName(name);
syncNotice.setSourceId(id);
syncNotice.setType(type);
save(syncNotice);
}
@Override
public Page<SyncNotice> pageInfo(Long shopId, String name, String startTime, String endTime, Integer type, Integer isRead) {
QueryWrapper queryWrapper = new QueryWrapper().eq(SyncNotice::getShopId, shopId);
if (StrUtil.isNotBlank(name)) {
queryWrapper.like(SyncNotice::getName, name);
}
if (StrUtil.isNotBlank(startTime)) {
queryWrapper.ge(SyncNotice::getCreateTime, startTime);
}
if (StrUtil.isNotBlank(endTime)) {
queryWrapper.le(SyncNotice::getCreateTime, endTime);
}
queryWrapper.eq(SyncNotice::getType, type);
queryWrapper.eq(SyncNotice::getIsRead, isRead);
queryWrapper.orderBy(SyncNotice::getCreateTime, false);
return page(PageUtil.buildPage(), queryWrapper);
}
@Override
public Boolean read(Long shopId, SyncNoticeReadDTO syncNoticeReadDTO) {
List<SyncNotice> listed = list(new QueryWrapper().eq(SyncNotice::getShopId, shopId).in(SyncNotice::getId, syncNoticeReadDTO.getNoticeIdList()));
listed.forEach(item -> {
if (item.getIsRead() == 0) {
item.setIsRead(1);
item.setReadTime(DateUtil.date().toLocalDateTime());
}
});
return updateBatch(listed);
}
}

View File

@ -0,0 +1,7 @@
<?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.czg.service.account.mapper.SyncNoticeMapper">
</mapper>

View File

@ -21,7 +21,7 @@ import java.util.List;
public interface ConsStockFlowMapper extends BaseMapper<ConsStockFlow> { public interface ConsStockFlowMapper extends BaseMapper<ConsStockFlow> {
ConsStatisticsVo getConsStatistics(ConsInfoParam param); ConsStatisticsVo getConsStatistics(ConsInfoParam param);
List<ShopVendorBillRecordVO> selectByVendorId(@Param("shopId") Long shopId, @Param("vendorId") Integer vendorId); List<ShopVendorBillRecordVO> selectByVendorId(@Param("shopId") Long shopId, @Param("vendorId") Integer vendorId, @Param("key") String key);
List<ConsStockFlow> selectUnPaid(@Param("shopId") Long shopId, @Param("vendorIds") @NotEmpty List<Long> vendorIds); List<ConsStockFlow> selectUnPaid(@Param("shopId") Long shopId, @Param("vendorIds") @NotEmpty List<Long> vendorIds);
} }

View File

@ -21,5 +21,5 @@ public interface ShopVendorMapper extends BaseMapper<ShopVendor> {
ShopVendorSummaryVO summary(@Param("shopId") Long shopId); ShopVendorSummaryVO summary(@Param("shopId") Long shopId);
List<ShopVendorBillVO> bill(@Param("shopId") Long shopId); List<ShopVendorBillVO> bill(@Param("shopId") Long shopId, @Param("key") String key);
} }

View File

@ -122,15 +122,15 @@ public class ShopVendorServiceImpl extends ServiceImpl<ShopVendorMapper, ShopVen
} }
@Override @Override
public Page<ShopVendorBillVO> billList(Long shopId) { public Page<ShopVendorBillVO> billList(Long shopId, String key) {
PageHelper.startPage(PageUtil.buildPageHelp()); PageHelper.startPage(PageUtil.buildPageHelp());
return PageUtil.convert(new PageInfo<>(mapper.bill(shopId))); return PageUtil.convert(new PageInfo<>(mapper.bill(shopId, key)));
} }
@Override @Override
public Page<ShopVendorBillRecordVO> billRecord(Long shopId, Integer vendorId) { public Page<ShopVendorBillRecordVO> billRecord(Long shopId, Integer vendorId, String key) {
PageHelper.startPage(PageUtil.buildPageHelp()); PageHelper.startPage(PageUtil.buildPageHelp());
return PageUtil.convert(new PageInfo<>(consStockFlowMapper.selectByVendorId(shopId, vendorId))); return PageUtil.convert(new PageInfo<>(consStockFlowMapper.selectByVendorId(shopId, vendorId, key)));
} }
@Override @Override

View File

@ -37,17 +37,20 @@
</select> </select>
<select id="selectByVendorId" resultType="com.czg.product.vo.ShopVendorBillRecordVO"> <select id="selectByVendorId" resultType="com.czg.product.vo.ShopVendorBillRecordVO">
SELECT id, SELECT id,
con_name, con_name,
purchase_price, purchase_price,
in_out_number, in_out_number,
amount_payable, amount_payable,
actual_payment_amount, actual_payment_amount,
remark, remark,
create_time, create_time,
(amount_payable - actual_payment_amount) as unPaidAmount (amount_payable - actual_payment_amount) as unPaidAmount
FROM tb_cons_stock_flow FROM tb_cons_stock_flow
WHERE shop_id = #{shopId} WHERE shop_id = #{shopId}
and vendor_id = #{vendorId} and vendor_id = #{vendorId}
<if test="key != null and key != ''">
and `name` like concat('%', #{key}, '%')
</if>
</select> </select>
<select id="selectUnPaid" resultType="com.czg.product.entity.ConsStockFlow"> <select id="selectUnPaid" resultType="com.czg.product.entity.ConsStockFlow">

View File

@ -22,15 +22,18 @@
WHERE shop_id = #{shopId} WHERE shop_id = #{shopId}
</select> </select>
<select id="bill" resultType="com.czg.product.vo.ShopVendorBillVO"> <select id="bill" resultType="com.czg.product.vo.ShopVendorBillVO">
select tb_cons_stock_flow.vendor_id as vendorId, select tb_cons_stock_flow.vendor_id as vendorId,
tb_shop_vendor.`name`, tb_shop_vendor.`name`,
sum(tb_cons_stock_flow.amount_payable) as amountPayable, sum(tb_cons_stock_flow.amount_payable) as amountPayable,
sum(tb_cons_stock_flow.actual_payment_amount) as actualPaymentAmount, sum(tb_cons_stock_flow.actual_payment_amount) as actualPaymentAmount,
sum(tb_cons_stock_flow.amount_payable) - sum(tb_cons_stock_flow.actual_payment_amount) as unPaidAmount, sum(tb_cons_stock_flow.amount_payable) - sum(tb_cons_stock_flow.actual_payment_amount) as unPaidAmount,
tb_cons_stock_flow.remark tb_cons_stock_flow.remark
from tb_cons_stock_flow from tb_cons_stock_flow
left join tb_shop_vendor on tb_cons_stock_flow.vendor_id = tb_shop_vendor.id left join tb_shop_vendor on tb_cons_stock_flow.vendor_id = tb_shop_vendor.id
where tb_cons_stock_flow.shop_id = #{shopId} where tb_cons_stock_flow.shop_id = #{shopId}
<if test="key != null and key != ''">
and tb_shop_vendor.`name` like concat('%', #{key}, '%')
</if>
GROUP BY tb_cons_stock_flow.vendor_id GROUP BY tb_cons_stock_flow.vendor_id
</select> </select>
</mapper> </mapper>