Merge remote-tracking branch 'origin/dev' into zs

# Conflicts:
#	eladmin-system/src/main/java/cn/ysk/cashier/repository/order/TbOrderDetailRepository.java
This commit is contained in:
2024-08-14 10:28:04 +08:00
7 changed files with 30 additions and 5 deletions

View File

@@ -22,4 +22,5 @@ public class Activate extends Model<Activate> {
private BigDecimal handselNum;
private String handselType;
private String isDel;
private String isUser;
}

View File

@@ -130,8 +130,12 @@ public class ShopServiceImpl implements ShopService {
@Override
public void modityActivate(Activate activate) {
if (Objects.nonNull(activate.getId()) && activate.getId() > 0){
activate.setHandselType("GD");
activate.setMaxNum(activate.getMinNum());
activateMapper.updateById(activate);
}else {
activate.setHandselType("GD");
activate.setMaxNum(activate.getMinNum());
activateMapper.insert(activate);
}
}

View File

@@ -115,7 +115,6 @@ public interface TbOrderDetailRepository extends JpaRepository<TbOrderDetail, In
"ORDER BY salesNum DESC")
List<TbOrderSalesCountByDayVo> queryTbOrderSalesCountByDay(@Param("shopId") Integer shopId,@Param("cateId")String cateId,@Param("proName")String proName, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
@Query("SELECT new cn.ysk.cashier.vo.TbOrderSalesCountByDayVo(" +
"COALESCE(CAST(SUM(CASE WHEN orders.orderType!='return' THEN info.num ELSE 0 END) as long),0), " +
"COALESCE(CAST(SUM(CASE WHEN orders.orderType='return' THEN info.num ELSE 0 END) as long),0))" +

View File

@@ -205,4 +205,9 @@ public interface TbOrderInfoRepository extends JpaRepository<TbOrderInfo, Intege
"GROUP BY info.tableId ")
List<ShopTableSaleInfoVo> queryShopTableSaleInfo(@Param("shopId") String shopId,
@Param("startTime") Long startTime, @Param("endTime") Long endTime);
@Query(value = "select count(*) from tb_order_info where user_id=:userId and shop_id=:shopId and `status` in ('closed','refund')",nativeQuery = true)
Integer countByUserIdAndStatusAndShopId(String userId,String shopId);
}

View File

@@ -22,6 +22,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import javax.persistence.Tuple;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@@ -44,4 +45,10 @@ public interface TbShopUserRepository extends JpaRepository<TbShopUser, Integer>
@Query("SELECT user.userId from TbShopUser user where user.shopId = :shopId")
List<Integer> getUserIdByShopId(String shopId);
@Query(value = "select IFNULL(sum(amount),0) from tb_shop_user_flow where shop_user_id=:userId and biz_code in ('cashMemberIn','scanMemberIn')",nativeQuery = true)
BigDecimal sumAmount(Integer userId);
}

View File

@@ -8,7 +8,9 @@ import cn.ysk.cashier.dto.shop.TbShopUserDto;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbShopUserMapper;
import cn.ysk.cashier.mybatis.mapper.ShopUserMapper;
import cn.ysk.cashier.mybatis.mapper.TbShopUserFlowMapper;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.repository.order.TbOrderInfoRepository;
import cn.ysk.cashier.repository.shop.TbShopUserRepository;
import cn.ysk.cashier.service.shop.TbShopUserService;
import cn.ysk.cashier.utils.FileUtil;
@@ -26,11 +28,9 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.Instant;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author lyf
@@ -45,6 +45,8 @@ public class TbShopUserServiceImpl implements TbShopUserService {
private final TbShopUserRepository tbShopUserRepository;
private final TbShopUserMapper tbShopUserMapper;
private final TbOrderInfoRepository tbOrderInfoRepository;
@Autowired
private ShopUserMapper shopUserMapper;
@@ -63,6 +65,10 @@ public class TbShopUserServiceImpl implements TbShopUserService {
shopUserInfoVo.setTotalScore(0);
});
}
Integer orderNumber=tbOrderInfoRepository.countByUserIdAndStatusAndShopId(shopUserInfoVo.getId().toString(),criteria.getShopId());
shopUserInfoVo.setOrderNumber(Objects.isNull(orderNumber)?0:orderNumber);
shopUserInfoVo.setInMoney(tbShopUserRepository.sumAmount(shopUserInfoVo.getId()));
}
return PageUtil.toPlusPage(iPage.getRecords(), Integer.valueOf(iPage.getTotal() + ""));

View File

@@ -35,6 +35,9 @@ public class ShopUserInfoVo implements Serializable {
private long createAt;
private long lastLoginAt;
private BigDecimal inMoney;
private Integer orderNumber;
public Object getSex() {
return sex;
}