Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
张松
2025-12-01 11:25:47 +08:00
20 changed files with 75 additions and 55 deletions

View File

@@ -18,5 +18,5 @@ public interface BkContactListMapper extends BaseMapper<BkContactList> {
* @param shopId 店铺ID
* @return 通讯录联系人列表
*/
List<BkContactList> getUserList(Long shopId);
List<BkContactList> getUserList(Long shopId, Long mainShopId);
}

View File

@@ -97,10 +97,10 @@ public class AShopUserServiceImpl implements AShopUserService {
Long mainIdByShopId = shopInfoService.getMainIdByShopId(StpKit.USER.getShopId());
PageHelper.startPage(PageUtil.buildPageHelp());
PageInfo<ShopUserDTO> shopUserDTOPageInfo = new PageInfo<>(shopUserMapper.selectPageByKeyAndIsVip(mainIdByShopId, isVip, key, amount));
shopUserDTOPageInfo.getList().forEach(item -> {
item.setNew(consumeDiscountService.isNewUser(item, StpKit.USER.getShopId()));
setUserDiscount(item);
});
// shopUserDTOPageInfo.getList().forEach(item -> {
// item.setNew(consumeDiscountService.isNewUser(item, StpKit.USER.getShopId()));
// setUserDiscount(item);
// });
return PageUtil.convert(shopUserDTOPageInfo);
}

View File

@@ -1,12 +1,13 @@
package com.czg.service.account.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.BkContactList;
import com.czg.account.service.BkContactListService;
import com.czg.account.service.ShopInfoService;
import com.czg.service.account.mapper.BkContactListMapper;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -20,12 +21,14 @@ import java.util.stream.Collectors;
* @since 2025-11-27
*/
@Service
public class BkContactListServiceImpl extends ServiceImpl<BkContactListMapper, BkContactList> implements BkContactListService{
public class BkContactListServiceImpl extends ServiceImpl<BkContactListMapper, BkContactList> implements BkContactListService {
@Resource
private ShopInfoService shopInfoService;
@Override
public List<BkContactList> getUserList(Long shopId, Set<String> phones) {
remove(QueryWrapper.create().eq(BkContactList::getShopId, shopId));
saveBatch(phones.stream()
List<BkContactList> collect = phones.stream()
.filter(StrUtil::isNotEmpty)
.map(phone -> {
BkContactList bkContact = new BkContactList();
@@ -33,7 +36,9 @@ public class BkContactListServiceImpl extends ServiceImpl<BkContactListMapper, B
bkContact.setPhone(phone.trim());
return bkContact;
})
.collect(Collectors.toList()));
return mapper.getUserList(shopId);
.collect(Collectors.toList());
mapper.insertBatch(collect, 50);
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
return mapper.getUserList(shopId, mainShopId);
}
}

View File

@@ -1,24 +1,19 @@
package com.czg.service.account.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.czg.account.dto.PageDTO;
import com.czg.account.dto.register.MerchantRegisterDTO;
import com.czg.account.entity.MerchantRegister;
import com.czg.account.service.MerchantRegisterService;
import com.czg.account.vo.MerchantRegisterVO;
import com.czg.service.account.mapper.MerchantRegisterMapper;
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;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* 激活码 服务层实现。
@@ -27,7 +22,7 @@ import java.util.List;
* @since 2025-02-11
*/
@Service
public class MerchantRegisterServiceImpl extends ServiceImpl<MerchantRegisterMapper, MerchantRegister> implements MerchantRegisterService {
public class MerchantRegisterServiceImpl extends ServiceImpl<MerchantRegisterMapper, MerchantRegister> implements MerchantRegisterService {
@Override
public Page<MerchantRegister> get(PageDTO pageDTO, Integer state, String startTime, String endTime) {
@@ -46,6 +41,7 @@ public class MerchantRegisterServiceImpl extends ServiceImpl<MerchantRegisterMap
tbMerchantRegister.setPeriodMonth(merchantRegisterDTO.periodMonth());
registers.add(tbMerchantRegister);
}
return saveBatch(registers);
int i = mapper.insertBatchSelective(registers, 50);
return i > 0;
}
}

View File

@@ -61,7 +61,7 @@ public class ShopExtendServiceImpl extends ServiceImpl<ShopExtendMapper, ShopExt
newRecord.initAutoKey(key, shopId);
newRecords.add(newRecord);
}
saveBatch(newRecords);
mapper.insertBatchSelective(newRecords,50);
return newRecords;
} else {
for (ShopExtend shopExtend : shopExtendList) {
@@ -97,7 +97,7 @@ public class ShopExtendServiceImpl extends ServiceImpl<ShopExtendMapper, ShopExt
newRecords.add(newRecord);
}
saveBatch(newRecords);
mapper.insertBatchSelective(newRecords,50);
shopExtendList.addAll(newRecords);
return shopExtendList;

View File

@@ -103,7 +103,7 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
tableArrayList.add(shopTable);
}
saveBatch(tableArrayList);
mapper.insertBatchSelective(tableArrayList, 50);
if (StrUtil.isNotBlank(msg.toString())) {
msg.append("台桌名已存在,未添加");
throw new CzgException(msg.toString());

View File

@@ -36,7 +36,7 @@ import static com.mybatisflex.core.query.QueryMethods.column;
* @since 2025-02-08
*/
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {
@Resource
private SysMenuService sysMenuService;
@Resource
@@ -87,7 +87,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
}
return apiInfoItemDTOS.stream()
.map(pattern -> StrUtil.format("({} LIKE '{}' ESCAPE '\\\\' and method = '{}')" , columnName, toSqlLikePattern(pattern.getUrl()), pattern.getMethod()))
.map(pattern -> StrUtil.format("({} LIKE '{}' ESCAPE '\\\\' and method = '{}')", columnName, toSqlLikePattern(pattern.getUrl()), pattern.getMethod()))
.collect(Collectors.joining(" OR "));
}
@@ -95,7 +95,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
public Page<SysRole> getList(Long shopId, PageDTO pageDTO, String key, String startTime, String endTime) {
QueryWrapper queryWrapper = new QueryWrapper();
// if (!StpKit.USER.isAdmin()) {
queryWrapper.eq(SysRole::getCreateUserId, StpKit.USER.getLoginIdAsLong());
queryWrapper.eq(SysRole::getCreateUserId, StpKit.USER.getLoginIdAsLong());
// }
if (StrUtil.isNotBlank(key)) {
@@ -180,11 +180,10 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
// Step 4: 批量保存(如有数据)
return rolesMenus.isEmpty() || sysRolesMenusService.saveBatch(rolesMenus);
return rolesMenus.isEmpty() || sysRolesMenusService.getMapper().insertBatchSelective(rolesMenus, 50) > 0;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean editPermission(long userId, RolePermissionDTO rolePermissionDTO) {

View File

@@ -5,16 +5,16 @@
<mapper namespace="com.czg.service.account.mapper.BkContactListMapper">
<select id="getUserList" resultType="com.czg.account.entity.BkContactList">
SELECT
`order`.call_phone AS phone,
count( 1 ) AS orderNum,
sum( CASE `order`.`status` WHEN '已取消' THEN 1 ELSE 0 END ) AS cannelNum,
MAX(`order`.create_time) AS lastBookingTime
FROM
`bk_order` `order`
INNER JOIN bk_contact_list contact ON `order`.call_phone = contact.phone AND contact.shop_id = #{shopId}
WHERE
`order`.shop_id = #{shopId}
SELECT user.nick_name AS nickName,
`order`.call_phone AS phone,
count(1) AS orderNum,
sum(CASE `order`.`status` WHEN '已取消' THEN 1 ELSE 0 END) AS cancelNum,
MAX(`order`.create_time) AS lastBookingTime
FROM `bk_order` `order`
INNER JOIN bk_contact_list contact
ON `order`.call_phone = contact.phone AND contact.shop_id = #{shopId}
LEFT JOIN tb_shop_user user ON `contact`.phone = user.phone and user.main_shop_id = #{mainShopId}
WHERE `order`.shop_id = #{shopId}
GROUP BY `order`.call_phone
</select>
</mapper>

View File

@@ -49,7 +49,7 @@ public class MkCouponGiftServiceImpl extends ServiceImpl<MkCouponGiftMapper, MkC
public void addCouponGift(Long sourceId, String sourceName, Integer type, List<MkCouponGiftDTO> couponGiftList) {
remove(new QueryWrapper().eq(MkCouponGift::getSourceId, sourceId).eq(MkCouponGift::getType, type));
if (CollUtil.isNotEmpty(couponGiftList)) {
List newCoupons = new ArrayList<>();
List<MkCouponGift> newCoupons = new ArrayList<>();
for (MkCouponGiftDTO giftDTO : couponGiftList) {
ShopCoupon coupon = couponMapper.selectOneByQuery(new QueryWrapper().eq(ShopCoupon::getId, giftDTO.getCouponId()));
if (coupon == null) {
@@ -64,7 +64,7 @@ public class MkCouponGiftServiceImpl extends ServiceImpl<MkCouponGiftMapper, MkC
couponGift.setNum(giftDTO.getNum());
newCoupons.add(couponGift);
}
saveBatch(newCoupons);
mapper.insertBatchSelective(newCoupons, 50);
}
}

View File

@@ -476,7 +476,7 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
recordList.add(record);
}
}
saveBatch(recordList);
mapper.insertBatchSelective(recordList, 50);
QueryWrapper queryWrapper = new QueryWrapper();
ShopCoupon newCoupon = new ShopCoupon();
newCoupon.setGiftNum(coupon.getGiftNum());

View File

@@ -112,7 +112,7 @@ public class ShopProdStatisticServiceImpl extends ServiceImpl<ShopProdStatisticM
if (exists) {
remove(QueryWrapper.create().eq(ShopProdStatistic::getShopId, shopId).eq(ShopProdStatistic::getCreateDay, day));
}
saveBatch(realTimeData);
mapper.insertBatchSelective(realTimeData, 50);
}
}

View File

@@ -57,7 +57,7 @@ public class ShopTableOrderStatisticServiceImpl extends ServiceImpl<ShopTableOrd
.toList();
if (CollUtil.isNotEmpty(realTimeData)) {
remove(QueryWrapper.create().eq(ShopTableOrderStatistic::getShopId, shopId).eq(ShopTableOrderStatistic::getCreateDay, day));
saveBatch(realTimeData);
mapper.insertBatchSelective(realTimeData, 50);
}
}
}

View File

@@ -108,6 +108,8 @@
<result property="productId" column="productId"/>
<result property="isTemporary" column="isTemporary"/>
<result property="productName" column="productName"/>
<result property="categoryId" column="categoryId"/>
<result property="categoryName" column="categoryName"/>
<collection property="foodItems" ofType="com.czg.order.vo.KitchenFoodVO$KitchenFoodItemVO">
<constructor>
<arg column="orderId" javaType="java.lang.Long"/>
@@ -115,8 +117,6 @@
<arg column="tableName" javaType="java.lang.String"/>
<arg column="areaName" javaType="java.lang.String"/>
<arg column="orderDetailId" javaType="java.lang.Long"/>
<arg column="categoryId" javaType="java.lang.Long"/>
<arg column="categoryName" javaType="java.lang.String"/>
<arg column="num" javaType="java.lang.Long"/>
<arg column="subStatus" javaType="java.lang.String"/>
<arg column="orderTime" javaType="java.lang.String"/>

View File

@@ -121,7 +121,7 @@
consInfo.setStockNumber(consStockFlow.getAfterNumber());
updateStockList.add(consInfo);
}
super.saveBatch(insertList);
mapper.insertBatchSelective(insertList, 50);
for (ConsInfo consInfo : updateStockList) {
consInfoMapper.update(consInfo);
}
@@ -158,7 +158,7 @@
consInfo.setStockNumber(entity.getAfterNumber());
updateStockList.add(consInfo);
}
super.saveBatch(insertList);
mapper.insertBatchSelective(insertList, 50);
for (ConsInfo consInfo : updateStockList) {
consInfoMapper.update(consInfo);
}

View File

@@ -36,7 +36,7 @@ public class ProdConsRelationServiceImpl extends ServiceImpl<ProdConsRelationMap
private QueryWrapper buildQueryWrapper(ProdConsRelationDTO param) {
QueryWrapper queryWrapper = PageUtil.buildSortQueryWrapper();
Long shopId = StpKit.USER.getShopId(0L);
Long shopId = StpKit.USER.getShopId();
queryWrapper.eq(ProdConsRelation::getShopId, shopId);
return queryWrapper;
}
@@ -50,7 +50,7 @@ public class ProdConsRelationServiceImpl extends ServiceImpl<ProdConsRelationMap
@Override
@Transactional(rollbackFor = Exception.class)
public void saveProdConsRelation(ProdConsBindDTO dto) {
Long shopId = StpKit.USER.getShopId(0L);
Long shopId = StpKit.USER.getShopId();
long count = productMapper.selectCountByQuery(query().eq(Product::getShopId, shopId).eq(Product::getId, dto.getId()));
if (count == 0) {
throw new CzgException("商品不存在");
@@ -72,7 +72,7 @@ public class ProdConsRelationServiceImpl extends ServiceImpl<ProdConsRelationMap
throw new CzgException("非法操作,绑定关系商品不一致");
}
List<ProdConsRelation> entityList = BeanUtil.copyToList(consList, ProdConsRelation.class);
super.saveBatch(entityList);
mapper.insertBatchSelective(entityList, 50);
}
}

View File

@@ -733,7 +733,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
}
}
if (CollUtil.isNotEmpty(addList)) {
prodGroupRelationService.saveBatch(addList, 100);
prodGroupRelationService.getMapper().insertBatchSelective(addList, 100);
}
if (CollUtil.isNotEmpty(upList)) {
prodGroupRelationService.updateBatch(addList, 100);

View File

@@ -157,7 +157,7 @@ public class ShopVendorServiceImpl extends ServiceImpl<ShopVendorMapper, ShopVen
throw new CzgException("批量付款应全部付款");
}
consPayRecordService.saveBatch(records);
consPayRecordService.getMapper().insertBatchSelective(records, 50);
return consStockFlowService.updateBatch(stockFlows);
}else {
ConsStockFlow stockFlow = consStockFlowMapper.selectOneByQuery(new QueryWrapper().eq(ConsStockFlow::getShopId, shopId).eq(ConsStockFlow::getId, payDTO.getFlowIdList().getFirst()));