Merge remote-tracking branch 'origin/dev'
This commit is contained in:
@@ -33,10 +33,12 @@ import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -404,9 +406,12 @@ public class SummaryServiceImpl implements SummaryService {
|
||||
@Override
|
||||
public void download(ShopSummaryDto summaryDto, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
// ConcurrentLinkedQueue<Map<String, Object>> list = new ConcurrentLinkedQueue();
|
||||
if(StringUtils.isBlank(summaryDto.getCateId())){
|
||||
summaryDto.setCateId(null);
|
||||
}
|
||||
|
||||
ArrayList<Integer> mergeRowIndex = new ArrayList<>();
|
||||
if (summaryDto.getType() != null && summaryDto.getType() == 1) {//金额
|
||||
Long start = 1704038400000L;
|
||||
Long end = Instant.now().toEpochMilli();
|
||||
@@ -430,23 +435,39 @@ public class SummaryServiceImpl implements SummaryService {
|
||||
summaryDto.setStartTime(DateUtil.toDate(DateUtil.fromTimeStamp(1704038400L)));
|
||||
summaryDto.setEndTime(new Date());
|
||||
}
|
||||
List<TbOrderSalesCountByDayVo> tbOrderSalesCountByDayVos = detailRepository.queryTbOrderSalesCountByDay(Integer.valueOf(summaryDto.getShopId()),summaryDto.getCateId(),summaryDto.getProName(), summaryDto.getStartTime(), summaryDto.getEndTime());
|
||||
for (TbOrderSalesCountByDayVo all : tbOrderSalesCountByDayVos) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("商品分类", all.getCateName());
|
||||
map.put("商品名称", all.getProductName());
|
||||
map.put("单 位", all.getUnitName());
|
||||
map.put("商品规格", StringUtils.isBlank(all.getProductSkuName()) ? "" : all.getProductSkuName());
|
||||
map.put("销 售 额", all.getSalesAmount());
|
||||
map.put("销 量", all.getSalesNum());
|
||||
map.put("单 价", all.getPrice());
|
||||
map.put("退 单 量", all.getRefNum());
|
||||
map.put("退 单 额", all.getRefAmount().compareTo(BigDecimal.ZERO)==0?all.getRefAmount():"-"+all.getRefAmount());
|
||||
map.put("总 量", all.getNum()-all.getRefNum());
|
||||
list.add(map);
|
||||
}
|
||||
List<TbOrderSalesCountByDayVo> tbOrderSalesCountByDayVos = detailRepository
|
||||
.queryTbOrderSalesCountByDay(Integer.valueOf(summaryDto.getShopId()),summaryDto.getCateId(),summaryDto.getProName(), summaryDto.getStartTime(), summaryDto.getEndTime());
|
||||
tbOrderSalesCountByDayVos.forEach(all -> {
|
||||
List<TbOrderSaleVO> tbOrderSaleVOS = detailRepository.querySaleOrderInfo(new Timestamp(summaryDto.getStartTime().getTime()),
|
||||
new Timestamp(summaryDto.getEndTime().getTime()), all.getProductId(), all.getProductSkuId(), Integer.valueOf(summaryDto.getShopId()));
|
||||
for (TbOrderSaleVO tbOrderSaleVO : tbOrderSaleVOS) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("商品分类", all.getCateName());
|
||||
map.put("商品名称", all.getProductName());
|
||||
map.put("单 位", all.getUnitName());
|
||||
map.put("商品规格", StringUtils.isBlank(all.getProductSkuName()) ? "" : all.getProductSkuName());
|
||||
map.put("销 售 额", all.getSalesAmount());
|
||||
map.put("销 量", all.getSalesNum());
|
||||
map.put("单 价", all.getPrice());
|
||||
map.put("退 单 量", all.getRefNum());
|
||||
map.put("退 单 额", all.getRefAmount().compareTo(BigDecimal.ZERO)==0?all.getRefAmount():"-"+all.getRefAmount());
|
||||
map.put("总 量", all.getNum()-all.getRefNum());
|
||||
map.put("订单编号", tbOrderSaleVO.getOrderNo());
|
||||
map.put("售出数量", tbOrderSaleVO.getNum());
|
||||
list.add(map);
|
||||
}
|
||||
if (!tbOrderSaleVOS.isEmpty()) {
|
||||
if (mergeRowIndex.isEmpty()) {
|
||||
mergeRowIndex.add(tbOrderSaleVOS.size());
|
||||
}else {
|
||||
mergeRowIndex.add(mergeRowIndex.get(mergeRowIndex.size() - 1) + tbOrderSaleVOS.size());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
FileUtil.downloadExcelAndMerge(list, 10, response, mergeRowIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,10 +17,7 @@ import cn.ysk.cashier.repository.shop.TbShopUnitRepository;
|
||||
import cn.ysk.cashier.service.TbProductStockOperateService;
|
||||
import cn.ysk.cashier.service.product.StockService;
|
||||
import cn.ysk.cashier.service.product.TbProductService;
|
||||
import cn.ysk.cashier.utils.CacheKey;
|
||||
import cn.ysk.cashier.utils.FileUtil;
|
||||
import cn.ysk.cashier.utils.RedisUtils;
|
||||
import cn.ysk.cashier.utils.StringUtils;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import cn.ysk.cashier.vo.StockUpdateValueVO;
|
||||
import cn.ysk.cashier.vo.StockUpdateWarnLineVO;
|
||||
import cn.ysk.cashier.vo.StockV2Vo;
|
||||
@@ -62,6 +59,7 @@ public class StockServiceImpl implements StockService {
|
||||
private final TbShopUnitRepository shopUnitRepository;
|
||||
private final TbProductStockDetailRepository tbProductStockDetailRepository;
|
||||
private final TbProductRepository tbProductRepository;
|
||||
private final WxMsgUtils wxMsgUtils;
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
@@ -349,6 +347,15 @@ public class StockServiceImpl implements StockService {
|
||||
|
||||
Query nativeQuery = em.createNativeQuery(String.valueOf(sqlQuery));
|
||||
nativeQuery.executeUpdate();
|
||||
|
||||
TbProduct product = tbProductRepository.selectBySkuId(Integer.valueOf(updateValueVO.getTargetId()));
|
||||
TbProductSku tbProductSku = tbProductSkuRepository.findById(Integer.valueOf(updateValueVO.getTargetId())).orElse(null);
|
||||
// 推送微信操作消息
|
||||
if (product != null && tbProductSku != null) {
|
||||
wxMsgUtils.aboardOperationMsg(("0".equals(updateValueVO.getUpdateValue()) ? "关闭sku售罄: " : "开启sku售罄: ") + product.getName() + "/"+ tbProductSku.getSpecSnap());
|
||||
}else {
|
||||
log.warn("推送微信操作消息失败,未查询到商品信息,skuId: {}", updateValueVO.getTargetId());
|
||||
}
|
||||
return;
|
||||
case "stock":
|
||||
sqlQuery.append(" set is_stock = ").append(updateValueVO.getUpdateValue());
|
||||
@@ -358,6 +365,13 @@ public class StockServiceImpl implements StockService {
|
||||
break;
|
||||
case "pauseSale":
|
||||
sqlQuery.append(" set is_pause_sale = ").append(updateValueVO.getUpdateValue());
|
||||
TbProduct product1 = tbProductRepository.selectBySkuId(Integer.valueOf(updateValueVO.getTargetId()));
|
||||
// 推送微信操作消息
|
||||
if (product1 != null) {
|
||||
wxMsgUtils.aboardOperationMsg(("0".equals(updateValueVO.getUpdateValue()) ? "关闭售罄: " : "开启售罄: ") + product1.getName());
|
||||
}else {
|
||||
log.warn("推送微信操作消息失败,未查询到商品信息,skuId: {}", updateValueVO.getTargetId());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("无效更新类型");
|
||||
@@ -393,7 +407,10 @@ public class StockServiceImpl implements StockService {
|
||||
if (tbProductSku == null) {
|
||||
throw new BadRequestException("商品不存在,skuId: " + skuId);
|
||||
}
|
||||
|
||||
TbProduct product = tbProductRepository.selectByShopIdAndId(Integer.parseInt(tbProductSku.getProductId()), String.valueOf(shopId));
|
||||
// 推送微信操作消息
|
||||
wxMsgUtils.aboardOperationMsg((isGrounding ? "上架商品: " : "下架商品: ") + product.getName());
|
||||
// 共享库存下架所有sku
|
||||
if (product.getIsDistribute().equals(1)) {
|
||||
tbProductSkuRepository.updateGroundingByProId(product.getId().toString(), isGrounding ? 1 : 0);
|
||||
|
||||
@@ -46,6 +46,7 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
||||
private final TbProductGroupRepository tbProductGroupRepository;
|
||||
private final TbProductGroupMapper tbProductGroupMapper;
|
||||
private final TbProductRepository tbProductRepository;
|
||||
private final WxMsgUtils wxMsgUtils;
|
||||
|
||||
@Resource
|
||||
private OnlineUserService onlineUserService;
|
||||
@@ -104,6 +105,9 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
||||
ValidationUtil.isNull( tbProductGroup.getId(),"TbProductGroup","id",resources.getId());
|
||||
tbProductGroup.copy(resources);
|
||||
tbProductGroupRepository.save(tbProductGroup);
|
||||
|
||||
// 推送微信操作消息
|
||||
wxMsgUtils.aboardOperationMsg((resources.getIsShow() == 0 ? "关闭分组: " : "开启分组: ") + tbProductGroup.getName());
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -224,4 +228,4 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,9 +521,8 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateIsHot(Integer id, String shopId) {
|
||||
tbProductRepository.updateNullHot(shopId);
|
||||
tbProductRepository.updateIsHot(id);
|
||||
public void updateIsHot(Integer id,Integer isHot) {
|
||||
tbProductRepository.updateIsHot(id,isHot);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
@@ -160,6 +160,7 @@ public class TbProductStocktakinServiceImpl implements TbProductStocktakinServic
|
||||
|
||||
|
||||
round = (int) Math.floor( productSku.getStockNumber());
|
||||
productStockDetail.setSpecSnap(productSku.getSpecSnap());
|
||||
|
||||
productStockDetail.setSubType(productStocktakinDTO.getStocktakinNum() > productSku.getStockNumber() ? 1 : -1);
|
||||
stockOperate.setType(productStocktakinDTO.getStocktakinNum() > productSku.getStockNumber() ? "盘点入库" : "盘点出库");
|
||||
|
||||
@@ -203,7 +203,7 @@ public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
|
||||
Set<Long> sysUserIds=new HashSet<>();
|
||||
for (Integer id : ids) {
|
||||
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(id).get();
|
||||
User sysUser = userRepository.findByUsername(tbPlussShopStaff.getAccount());
|
||||
User sysUser = userRepository.findByUsername(tbPlussShopStaff.getShopId()+"@"+tbPlussShopStaff.getAccount());
|
||||
tbPlussShopStaffRepository.deleteById(id);
|
||||
sysUserIds.add(sysUser.getId());
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public interface TbProductService {
|
||||
*/
|
||||
void download(List<TbProductDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
void updateIsHot(Integer id, String shopId);
|
||||
void updateIsHot(Integer id,Integer isStock);
|
||||
|
||||
void updateIsStock(Integer proId, String shopId, Integer isStock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user