Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -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> {
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
public interface ConsStockFlowMapper extends BaseMapper<ConsStockFlow> {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -21,5 +21,5 @@ public interface ShopVendorMapper extends BaseMapper<ShopVendor> {
|
||||
ShopVendorSummaryVO summary(@Param("shopId") Long shopId);
|
||||
|
||||
|
||||
List<ShopVendorBillVO> bill(@Param("shopId") Long shopId);
|
||||
List<ShopVendorBillVO> bill(@Param("shopId") Long shopId, @Param("key") String key);
|
||||
}
|
||||
|
||||
@@ -122,15 +122,15 @@ public class ShopVendorServiceImpl extends ServiceImpl<ShopVendorMapper, ShopVen
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ShopVendorBillVO> billList(Long shopId) {
|
||||
public Page<ShopVendorBillVO> billList(Long shopId, String key) {
|
||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||
return PageUtil.convert(new PageInfo<>(mapper.bill(shopId)));
|
||||
return PageUtil.convert(new PageInfo<>(mapper.bill(shopId, key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ShopVendorBillRecordVO> billRecord(Long shopId, Integer vendorId) {
|
||||
public Page<ShopVendorBillRecordVO> billRecord(Long shopId, Integer vendorId, String key) {
|
||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||
return PageUtil.convert(new PageInfo<>(consStockFlowMapper.selectByVendorId(shopId, vendorId)));
|
||||
return PageUtil.convert(new PageInfo<>(consStockFlowMapper.selectByVendorId(shopId, vendorId, key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,17 +37,20 @@
|
||||
</select>
|
||||
<select id="selectByVendorId" resultType="com.czg.product.vo.ShopVendorBillRecordVO">
|
||||
SELECT id,
|
||||
con_name,
|
||||
purchase_price,
|
||||
in_out_number,
|
||||
amount_payable,
|
||||
actual_payment_amount,
|
||||
remark,
|
||||
create_time,
|
||||
(amount_payable - actual_payment_amount) as unPaidAmount
|
||||
con_name,
|
||||
purchase_price,
|
||||
in_out_number,
|
||||
amount_payable,
|
||||
actual_payment_amount,
|
||||
remark,
|
||||
create_time,
|
||||
(amount_payable - actual_payment_amount) as unPaidAmount
|
||||
FROM tb_cons_stock_flow
|
||||
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 id="selectUnPaid" resultType="com.czg.product.entity.ConsStockFlow">
|
||||
|
||||
@@ -22,15 +22,18 @@
|
||||
WHERE shop_id = #{shopId}
|
||||
</select>
|
||||
<select id="bill" resultType="com.czg.product.vo.ShopVendorBillVO">
|
||||
select tb_cons_stock_flow.vendor_id as vendorId,
|
||||
tb_shop_vendor.`name`,
|
||||
sum(tb_cons_stock_flow.amount_payable) as amountPayable,
|
||||
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,
|
||||
tb_cons_stock_flow.remark
|
||||
select tb_cons_stock_flow.vendor_id as vendorId,
|
||||
tb_shop_vendor.`name`,
|
||||
sum(tb_cons_stock_flow.amount_payable) as amountPayable,
|
||||
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,
|
||||
tb_cons_stock_flow.remark
|
||||
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}
|
||||
<if test="key != null and key != ''">
|
||||
and tb_shop_vendor.`name` like concat('%', #{key}, '%')
|
||||
</if>
|
||||
GROUP BY tb_cons_stock_flow.vendor_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user