完善首页数据
This commit is contained in:
parent
268d211f5b
commit
f783116bc8
|
|
@ -10,7 +10,7 @@ import lombok.Getter;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum PayTypeEnum {
|
public enum PayTypeEnum {
|
||||||
CASH("cash","现金"),BANK("bank","银行卡"),SCANCODE("scanCode","扫码支付"),
|
CASH("cash","现金"),BANK("bank","银行卡"),SCANCODE("scanCode","扫码支付"),
|
||||||
DEPOSIT("deposit","储值"),ARREARS("arrears","挂单");
|
DEPOSIT("deposit","储值"),ARREARS("arrears","挂单"),WXLIST("wx_lite","微信小程序支付");
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
package cn.ysk.cashier.pojo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访问量相关
|
||||||
|
* @author 12847
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
@Table(name = "tb_token")
|
||||||
|
public class TbToken implements Serializable {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "`id`")
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* shopId
|
||||||
|
*/
|
||||||
|
@Column(name = "account_id")
|
||||||
|
private Integer accountId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成员Id
|
||||||
|
*/
|
||||||
|
@Column(name = "staff_id")
|
||||||
|
private Integer staffId;
|
||||||
|
/**
|
||||||
|
* 渠道
|
||||||
|
*/
|
||||||
|
@Column(name = "client_type")
|
||||||
|
private String clientType;
|
||||||
|
/**
|
||||||
|
* token
|
||||||
|
*/
|
||||||
|
@Column(name = "token")
|
||||||
|
private String token;
|
||||||
|
/**
|
||||||
|
* ip
|
||||||
|
*/
|
||||||
|
@Column(name = "ip")
|
||||||
|
private String ip;
|
||||||
|
/**
|
||||||
|
* 状态 1 登录 2 结束运营 3 关班
|
||||||
|
*/
|
||||||
|
@Column(name = "status")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Column(name = "create_time")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@Column(name = "update_time")
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
||||||
|
|
@ -28,15 +28,42 @@ public interface ShopUserDutyDetailRepository extends JpaRepository<TbShopUserDu
|
||||||
,@Param("currentPage") Integer currentPage);
|
,@Param("currentPage") Integer currentPage);
|
||||||
|
|
||||||
|
|
||||||
@Query(value = "SELECT" +
|
@Query(value = "SELECT\n" +
|
||||||
" SUM(product.num),SUM(user.amount)" +
|
"\tcount( 0 ) \n" +
|
||||||
" FROM" +
|
"FROM\n" +
|
||||||
" tb_shop_user_duty_detail AS product" +
|
"\t(\n" +
|
||||||
" LEFT JOIN tb_shop_user_duty AS user ON product.duty_id = USER.id " +
|
"\tSELECT\n" +
|
||||||
"WHERE user.shop_id = :shopId" +
|
"\t\tproduct.product_name \n" +
|
||||||
" AND user.login_time BETWEEN :startTime AND :endTime", nativeQuery = true)
|
"\tFROM\n" +
|
||||||
|
"\t\ttb_shop_user_duty_detail AS product\n" +
|
||||||
|
"\t\tLEFT JOIN tb_shop_user_duty AS USER ON product.duty_id = USER.id \n" +
|
||||||
|
"\tWHERE\n" +
|
||||||
|
"\t\tUSER.shop_id = :shopId \n" +
|
||||||
|
"\t\tAND USER.login_time BETWEEN :startTime \n" +
|
||||||
|
"\t\tAND :endTime \n" +
|
||||||
|
"\tGROUP BY\n" +
|
||||||
|
"\tproduct.product_id \n" +
|
||||||
|
"\t) AS total", nativeQuery = true)
|
||||||
|
Tuple searchCount(@Param("shopId") Integer shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(value = "SELECT\n" +
|
||||||
|
"\tsum( sudd.num ),\n" +
|
||||||
|
"\tb.amount \n" +
|
||||||
|
"FROM\n" +
|
||||||
|
"\ttb_shop_user_duty_detail sudd\n" +
|
||||||
|
"\tINNER JOIN tb_shop_user_duty sud ON sudd.duty_id = sud.id\n" +
|
||||||
|
"\tLEFT JOIN ( SELECT shop_id, sum( amount ) AS amount FROM tb_shop_user_duty WHERE shop_id = :shopId AND login_time BETWEEN :startTime AND :endTime ) b ON sud.shop_id = b.shop_id \n" +
|
||||||
|
"WHERE\n" +
|
||||||
|
"\tsud.shop_id = :shopId \n" +
|
||||||
|
"\tAND sud.login_time BETWEEN :startTime \n" +
|
||||||
|
"\tAND :endTime \n" +
|
||||||
|
"GROUP BY\n" +
|
||||||
|
"\tb.shop_id", nativeQuery = true)
|
||||||
Tuple searchByDutyIdSum(@Param("shopId") Integer shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
Tuple searchByDutyIdSum(@Param("shopId") Integer shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Query(value = "SELECT" +
|
@Query(value = "SELECT" +
|
||||||
" SUM(product.num),SUM(product.amount)" +
|
" SUM(product.num),SUM(product.amount)" +
|
||||||
" FROM" +
|
" FROM" +
|
||||||
|
|
@ -46,4 +73,24 @@ public interface ShopUserDutyDetailRepository extends JpaRepository<TbShopUserDu
|
||||||
" AND user.login_time BETWEEN :startTime AND :endTime" +
|
" AND user.login_time BETWEEN :startTime AND :endTime" +
|
||||||
" group by user.trade_day", nativeQuery = true)
|
" group by user.trade_day", nativeQuery = true)
|
||||||
List<Object[]> searchByDayToAmount(@Param("shopId") Integer shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
List<Object[]> searchByDayToAmount(@Param("shopId") Integer shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(value = "SELECT" +
|
||||||
|
" SUM(product.num),user.trade_day" +
|
||||||
|
" FROM" +
|
||||||
|
" tb_shop_user_duty_detail AS product" +
|
||||||
|
" LEFT JOIN tb_shop_user_duty AS user ON product.duty_id = USER.id " +
|
||||||
|
"WHERE user.shop_id = :shopId" +
|
||||||
|
" AND user.login_time BETWEEN :startTime AND :endTime" +
|
||||||
|
" group by user.trade_day", nativeQuery = true)
|
||||||
|
List<Object[]> searchByDutyGroup(@Param("shopId") Integer shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
|
|
||||||
|
@Query(value = "SELECT" +
|
||||||
|
" SUM(user.amount),user.trade_day" +
|
||||||
|
" FROM" +
|
||||||
|
" tb_shop_user_duty AS user " +
|
||||||
|
" WHERE user.shop_id = :shopId" +
|
||||||
|
" AND user.login_time BETWEEN :startTime AND :endTime" +
|
||||||
|
" group by user.trade_day", nativeQuery = true)
|
||||||
|
List<Object[]> searchByGroup(@Param("shopId") Integer shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ public interface ShopUserDutyRepository extends JpaRepository<TbShopUserDuty, In
|
||||||
"\t`tb_shop_user_duty` \n" +
|
"\t`tb_shop_user_duty` \n" +
|
||||||
"WHERE\n" +
|
"WHERE\n" +
|
||||||
"\tshop_id = :shopId \n" +
|
"\tshop_id = :shopId \n" +
|
||||||
"\tAND return_amount < 0 \n" +
|
|
||||||
"\tAND login_time BETWEEN :startTime AND :endTime \n" +
|
"\tAND login_time BETWEEN :startTime AND :endTime \n" +
|
||||||
"GROUP BY\n" +
|
"GROUP BY\n" +
|
||||||
"\tshop_id,\n" +
|
"\tshop_id,\n" +
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package cn.ysk.cashier.repository;
|
||||||
|
|
||||||
|
import javax.persistence.Tuple;
|
||||||
|
import cn.ysk.cashier.pojo.TbShopPayType;
|
||||||
|
import cn.ysk.cashier.pojo.TbToken;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lyf
|
||||||
|
*/
|
||||||
|
public interface TbTokenRepository extends JpaRepository<TbToken, Integer>, JpaSpecificationExecutor<TbToken> {
|
||||||
|
@Query("select count(0) from TbToken token where token.accountId=:shopId")
|
||||||
|
Tuple countByAccountId(@Param("shopId") Integer shopId);
|
||||||
|
|
||||||
|
@Query("select count(0) from TbToken token where token.accountId=:shopId " +
|
||||||
|
"and token.createTime BETWEEN :startTime and :endTime")
|
||||||
|
Tuple countByAccountId(@Param("shopId") Integer shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
|
|
||||||
|
@Query(value = "select count(0),DATE_FORMAT(create_time,'%Y-%m-%d')from tb_token where account_id=:shopId " +
|
||||||
|
"and create_time BETWEEN :startTime and :endTime group by DATE_FORMAT( create_time, '%Y-%m-%d') ",nativeQuery = true)
|
||||||
|
List<Object[]> countByMonth(@Param("shopId") Integer shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -23,6 +23,7 @@ import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -43,10 +44,17 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||||
@Query("DELETE FROM TbProductSku sku WHERE sku.productId = :productId")
|
@Query("DELETE FROM TbProductSku sku WHERE sku.productId = :productId")
|
||||||
Integer deleteByProductId(@Param("productId") String productId);
|
Integer deleteByProductId(@Param("productId") String productId);
|
||||||
|
|
||||||
// @Insert("INSERT INTO TbProductSku sku(sku.shopId,sku.barCode,sku.productId,sku.originPrice,sku.costPrice,sku.memberPrice,sku.salePrice,sku.stockNumber,sku.firstShared) " +
|
@Query("SELECT sku FROM TbProductSku sku WHERE sku.barCode = :barCode")
|
||||||
// "VALUES (#{item.shopId},#{item.barCode},#{item.productId},#{item.originPrice},#{item.costPrice},#{item.memberPrice},#{item.salePrice},#{item.stockNumber},#{sku.firstShared}) ")
|
TbProductSku searchBarCode(@Param("barCode")String barCode);
|
||||||
// void findById(@Param("item") List<TbProductSku> skuList);
|
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Modifying
|
||||||
|
@Query("update FROM TbProductSku sku set sku.costPrice=:costPrice,sku.coverImg =:coverImg, " +
|
||||||
|
"sku.firstShared=:firstShared,sku.memberPrice = :memberPrice,sku.originPrice = :originPrice, " +
|
||||||
|
"sku.salePrice=:salePrice,sku.specSnap =:specSnap,sku.stockNumber = :stockNumber " +
|
||||||
|
"WHERE sku.barCode = :barCode and sku.id =:id")
|
||||||
|
Integer updateByBarCode(@Param("barCode") String barCode, @Param("costPrice")BigDecimal costPrice, @Param("coverImg")String coverImg,
|
||||||
|
@Param("firstShared")BigDecimal firstShared,@Param("memberPrice")BigDecimal memberPrice,@Param("originPrice") BigDecimal originPrice,
|
||||||
|
@Param("salePrice")BigDecimal salePrice,@Param("specSnap") String specSnap,@Param("stockNumber") Double stockNumber,@Param("id") Integer id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -4,6 +4,7 @@ import cn.ysk.cashier.enums.PayTypeEnum;
|
||||||
import cn.ysk.cashier.exception.BadRequestException;
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
import cn.ysk.cashier.repository.ShopUserDutyDetailRepository;
|
import cn.ysk.cashier.repository.ShopUserDutyDetailRepository;
|
||||||
import cn.ysk.cashier.repository.ShopUserDutyRepository;
|
import cn.ysk.cashier.repository.ShopUserDutyRepository;
|
||||||
|
import cn.ysk.cashier.repository.TbTokenRepository;
|
||||||
import cn.ysk.cashier.repository.mapping.CountPayTypeMapping;
|
import cn.ysk.cashier.repository.mapping.CountPayTypeMapping;
|
||||||
import cn.ysk.cashier.repository.mapping.SumDateMapping;
|
import cn.ysk.cashier.repository.mapping.SumDateMapping;
|
||||||
import cn.ysk.cashier.repository.order.TbOrderInfoRepository;
|
import cn.ysk.cashier.repository.order.TbOrderInfoRepository;
|
||||||
|
|
@ -36,6 +37,8 @@ public class SummaryServiceImpl implements SummaryService {
|
||||||
private TbShopUserRepository tbShopUserRepository;
|
private TbShopUserRepository tbShopUserRepository;
|
||||||
@Resource
|
@Resource
|
||||||
private TbOrderInfoRepository tbOrderInfoRepository;
|
private TbOrderInfoRepository tbOrderInfoRepository;
|
||||||
|
@Resource
|
||||||
|
private TbTokenRepository tbTokenRepository;
|
||||||
@Override
|
@Override
|
||||||
public SummaryVO selectSummary(Integer shopId) {
|
public SummaryVO selectSummary(Integer shopId) {
|
||||||
SummaryVO summaryVO = new SummaryVO();
|
SummaryVO summaryVO = new SummaryVO();
|
||||||
|
|
@ -88,53 +91,81 @@ public class SummaryServiceImpl implements SummaryService {
|
||||||
countDateLists.add(countDateVO);
|
countDateLists.add(countDateVO);
|
||||||
}
|
}
|
||||||
summaryVO.setCountDateList(countDateLists);
|
summaryVO.setCountDateList(countDateLists);
|
||||||
//用户数折线图
|
//访问量
|
||||||
|
Tuple tuple = tbTokenRepository.countByAccountId(shopId);
|
||||||
|
summaryVO.setTotalVisits(tuple.get(0, Long.class));
|
||||||
|
//访问量柱状图
|
||||||
|
List<Object[]> objectsVisits = tbTokenRepository.countByMonth(shopId, DateUtil.getDate30DaysAgo(), DateUtil.getDayEnd());
|
||||||
|
List<CountVisitsVO> visitsList = new ArrayList<>();
|
||||||
|
for (Object[] o :objectsVisits){
|
||||||
|
CountVisitsVO countDateVO = new CountVisitsVO();
|
||||||
|
countDateVO.setCount((BigInteger) o[0]);
|
||||||
|
countDateVO.setTradeDay((String) o[1]);
|
||||||
|
visitsList.add(countDateVO);
|
||||||
|
}
|
||||||
|
//填充日期
|
||||||
|
Map<String, CountVisitsVO> dataVisitsMap = new HashMap<>();
|
||||||
|
for (CountVisitsVO entry : visitsList) {
|
||||||
|
String tradeDay = entry.getTradeDay();
|
||||||
|
BigInteger countOrder = entry.getCount();
|
||||||
|
dataVisitsMap.put(tradeDay, new CountVisitsVO(tradeDay, countOrder));
|
||||||
|
}
|
||||||
|
// 转换为字符串
|
||||||
|
List<CountVisitsVO> countVisitsLists = new ArrayList<>();
|
||||||
|
for (int i = 0; i < 30; i++) {
|
||||||
|
LocalDate tradeDayLocalDate = today.minusDays(i);
|
||||||
|
String tradeDayString = tradeDayLocalDate.format(formatter);
|
||||||
|
CountVisitsVO countDateVO;
|
||||||
|
// 检查数据Map中是否存在该日期的数据
|
||||||
|
if (dataVisitsMap.containsKey(tradeDayString)) {
|
||||||
|
countDateVO = dataVisitsMap.get(tradeDayString);
|
||||||
|
} else {
|
||||||
|
// 如果不存在,则创建新的SumDateVO对象,amount设为0
|
||||||
|
countDateVO = new CountVisitsVO(tradeDayString, BigInteger.ZERO);
|
||||||
|
}
|
||||||
|
// 将SumDateVO对象添加到列表中
|
||||||
|
countVisitsLists.add(countDateVO);
|
||||||
|
}
|
||||||
|
summaryVO.setVisitsCountList(countVisitsLists);
|
||||||
return summaryVO;
|
return summaryVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> selectSummaryDate(Integer shopId, Integer day) {
|
public Map<String,Object> selectSummaryDate(Integer shopId, Integer day) {
|
||||||
Date startTime = new Date();
|
Date startTime = new Date();
|
||||||
Date endTime = new Date();
|
Date endTime = new Date();
|
||||||
List<Object[]> sumDateMappings = new ArrayList<>();
|
|
||||||
if (day == 7){
|
if (day == 7){
|
||||||
startTime = DateUtil.getDate7DaysAgo();
|
startTime = DateUtil.getDate7DaysAgo();
|
||||||
endTime = DateUtil.getDayEnd();
|
endTime = DateUtil.getDayEnd();
|
||||||
sumDateMappings=shopUserDutyRepository.sumByDate(shopId,startTime,endTime);
|
|
||||||
}else if (day == 30){
|
}else if (day == 30){
|
||||||
startTime = DateUtil.getDate30DaysAgo();
|
startTime = DateUtil.getDate30DaysAgo();
|
||||||
endTime = DateUtil.getDayEnd();
|
endTime = DateUtil.getDayEnd();
|
||||||
sumDateMappings=shopUserDutyRepository.sumByDate(shopId,startTime,endTime);
|
|
||||||
}else if (day == 360){
|
}else if (day == 360){
|
||||||
startTime = DateUtil.getBeginDayOfYear();
|
startTime = DateUtil.getBeginDayOfYear();
|
||||||
endTime = DateUtil.getDateOneYearAgo();
|
endTime = DateUtil.getDateOneYearAgo();
|
||||||
sumDateMappings=shopUserDutyRepository.sumByDate(shopId,DateUtil.getDate30DaysAgo(),DateUtil.getDayEnd());
|
|
||||||
}
|
}
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
// //根据时间商品排行
|
|
||||||
// List<Object[]> objects = shopUserDutyDetailRepository.searchByDutyId(shopId,startTime,endTime);
|
|
||||||
Tuple tuple = shopUserDutyDetailRepository.searchByDutyIdSum(shopId, startTime, endTime);
|
Tuple tuple = shopUserDutyDetailRepository.searchByDutyIdSum(shopId, startTime, endTime);
|
||||||
|
List<Object[]> objects = shopUserDutyDetailRepository.searchByDutyGroup(shopId, DateUtil.getDate30DaysAgo(), DateUtil.getDayEnd());
|
||||||
|
List<CountDateVO> numList = new ArrayList<>();
|
||||||
|
for (Object[] o :objects) {
|
||||||
|
CountDateVO countDateVO = new CountDateVO();
|
||||||
|
countDateVO.setCount((BigDecimal) o[0]);
|
||||||
|
countDateVO.setTradeDay((String) o[1]);
|
||||||
|
numList.add(countDateVO);
|
||||||
|
}
|
||||||
|
List<Object[]> objects1 = shopUserDutyDetailRepository.searchByGroup(shopId, DateUtil.getDate30DaysAgo(), DateUtil.getDayEnd());
|
||||||
|
List<CountDateVO> amountList = new ArrayList<>();
|
||||||
|
for (Object[] o :objects1) {
|
||||||
|
CountDateVO countDateVO = new CountDateVO();
|
||||||
|
countDateVO.setCount((BigDecimal) o[0]);
|
||||||
|
countDateVO.setTradeDay((String) o[1]);
|
||||||
|
amountList.add(countDateVO);
|
||||||
|
}
|
||||||
map.put("productCount",tuple.get(0, BigDecimal.class));
|
map.put("productCount",tuple.get(0, BigDecimal.class));
|
||||||
map.put("productSum",tuple.get(1, BigDecimal.class));
|
map.put("productSum",tuple.get(1, BigDecimal.class));
|
||||||
//商品销量排行前五
|
map.put("numList",numList);
|
||||||
List<ProductVO> list = new ArrayList<>();
|
map.put("amountList",amountList);
|
||||||
// for (Object[] o :objects) {
|
|
||||||
// ProductVO productVO = new ProductVO();
|
|
||||||
// productVO.setProductId((Integer) o[0]);
|
|
||||||
// productVO.setProductName((String) o[1]);
|
|
||||||
// productVO.setProductNum((BigDecimal)o[2]);
|
|
||||||
// list.add(productVO);
|
|
||||||
// }
|
|
||||||
// list = list.stream()
|
|
||||||
// .sorted(Comparator.comparing(ProductVO::getProductNum).reversed()) // 降序排序
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// map.put("totalProduct",list);
|
|
||||||
//支付类型占比
|
|
||||||
// List<CountPayTypeMapping> countPayTypeMappings = tbOrderInfoRepository.countByShopId(shopId.toString());
|
|
||||||
// map.put("countPayType",countPayTypeMappings);
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -169,10 +200,12 @@ public class SummaryServiceImpl implements SummaryService {
|
||||||
}
|
}
|
||||||
//汇总数据
|
//汇总数据
|
||||||
Tuple tuple = shopUserDutyDetailRepository.searchByDutyIdSum(shopId, startTime, endTime);
|
Tuple tuple = shopUserDutyDetailRepository.searchByDutyIdSum(shopId, startTime, endTime);
|
||||||
|
//分页数据
|
||||||
|
Tuple tuple1 = shopUserDutyDetailRepository.searchCount(shopId, startTime, endTime);
|
||||||
map.put("productCount",tuple.get(0, BigDecimal.class));
|
map.put("productCount",tuple.get(0, BigDecimal.class));
|
||||||
map.put("productSum",tuple.get(1, BigDecimal.class));
|
map.put("productSum",tuple.get(1, BigDecimal.class));
|
||||||
// List<Object[]> objects1 = shopUserDutyDetailRepository.searchByDayToAmount(shopId, startTime, endTime);
|
|
||||||
map.put("totalProduct",list);
|
map.put("totalProduct",list);
|
||||||
|
map.put("total",tuple1.get(0, BigInteger.class));
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -226,6 +259,9 @@ public class SummaryServiceImpl implements SummaryService {
|
||||||
// 将SumDateVO对象添加到列表中
|
// 将SumDateVO对象添加到列表中
|
||||||
sumDateList.add(sumDateVO);
|
sumDateList.add(sumDateVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sumDateList.sort((a,b)->a.getTradeDay().compareTo(b.getTradeDay()));
|
||||||
map.put("total",sumDateList);
|
map.put("total",sumDateList);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
@ -238,6 +274,8 @@ public class SummaryServiceImpl implements SummaryService {
|
||||||
map.put("totalSalesToday", tuple.get(1, BigDecimal.class) == null? new BigDecimal("0") : tuple.get(1, BigDecimal.class));
|
map.put("totalSalesToday", tuple.get(1, BigDecimal.class) == null? new BigDecimal("0") : tuple.get(1, BigDecimal.class));
|
||||||
Tuple tuple1 = tbShopUserRepository.searchByCountToday(shopId.toString(), DateUtil.getTodayStartTimestamp(), DateUtil.getTodayEndTimestamp());
|
Tuple tuple1 = tbShopUserRepository.searchByCountToday(shopId.toString(), DateUtil.getTodayStartTimestamp(), DateUtil.getTodayEndTimestamp());
|
||||||
map.put("userToday", tuple1.get(0, Long.class));
|
map.put("userToday", tuple1.get(0, Long.class));
|
||||||
|
Tuple tupleToday = tbTokenRepository.countByAccountId(shopId, DateUtil.getDayBegin(), DateUtil.getDayEnd());
|
||||||
|
map.put("totalVisitsToday",tupleToday);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -319,16 +319,22 @@ public class TbProductServiceImpl implements TbProductService {
|
||||||
|
|
||||||
//sku
|
//sku
|
||||||
if (resources.getSkuList() != null) {
|
if (resources.getSkuList() != null) {
|
||||||
if ("sku".equals(save.getTypeEnum())) {
|
|
||||||
tbProductSkuRepository.deleteByProductId(String.valueOf(save.getId()));
|
|
||||||
}
|
|
||||||
List<TbProductSku> skuList = new ArrayList<>();
|
List<TbProductSku> skuList = new ArrayList<>();
|
||||||
for (TbProductSku sku : resources.getSkuList()) {
|
for (TbProductSku sku : resources.getSkuList()) {
|
||||||
sku.setProductId(String.valueOf(save.getId()));
|
TbProductSku tbProductSku = tbProductSkuRepository.searchBarCode(sku.getBarCode());
|
||||||
sku.setShopId(save.getShopId());
|
if (tbProductSku != null){
|
||||||
sku.setCreatedAt(Instant.now().toEpochMilli());
|
tbProductSkuRepository.updateByBarCode(sku.getBarCode(),sku.getCostPrice(),sku.getCoverImg(),sku.getFirstShared(),sku.getMemberPrice(),
|
||||||
sku.setUpdatedAt(Instant.now().toEpochMilli());
|
sku.getOriginPrice(),sku.getSalePrice(),sku.getSpecSnap(),sku.getStockNumber(),tbProductSku.getId());
|
||||||
skuList.add(sku);
|
}else {
|
||||||
|
if ("sku".equals(save.getTypeEnum())) {
|
||||||
|
tbProductSkuRepository.deleteByProductId(String.valueOf(save.getId()));
|
||||||
|
}
|
||||||
|
sku.setProductId(String.valueOf(save.getId()));
|
||||||
|
sku.setShopId(save.getShopId());
|
||||||
|
sku.setCreatedAt(Instant.now().toEpochMilli());
|
||||||
|
sku.setUpdatedAt(Instant.now().toEpochMilli());
|
||||||
|
skuList.add(sku);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tbProductSkuRepository.saveAll(skuList);
|
tbProductSkuRepository.saveAll(skuList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cn.ysk.cashier.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 访问量vo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CountVisitsVO {
|
||||||
|
|
||||||
|
private String tradeDay;
|
||||||
|
private BigInteger count;
|
||||||
|
public CountVisitsVO(String tradeDay, BigInteger count) {
|
||||||
|
this.tradeDay = tradeDay;
|
||||||
|
this.count = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CountVisitsVO() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -31,7 +31,17 @@ public class SummaryVO {
|
||||||
*/
|
*/
|
||||||
private Long totalUser =0L;
|
private Long totalUser =0L;
|
||||||
/**
|
/**
|
||||||
* 支付笔数柱形图
|
* 销售额柱形图
|
||||||
*/
|
*/
|
||||||
private List<CountDateVO> countDateList;
|
private List<CountDateVO> countDateList;
|
||||||
|
/**
|
||||||
|
* 访问量
|
||||||
|
*/
|
||||||
|
private Long totalVisits;
|
||||||
|
/**
|
||||||
|
* 访问量柱状图
|
||||||
|
*/
|
||||||
|
public List<CountVisitsVO> visitsCountList;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue