Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
780fce1416
|
|
@ -58,7 +58,7 @@ public interface LogService {
|
|||
* @param method 方法
|
||||
* @param param 入参
|
||||
*/
|
||||
void save(String description,String method,String param);
|
||||
void save(String description,String method,Integer shopId,String param);
|
||||
|
||||
/**
|
||||
* 查询异常详情
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public class LogServiceImpl implements LogService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(String description,String method,String param) {
|
||||
public void save(String description,String method,Integer shopId,String param) {
|
||||
Log log = new Log();
|
||||
HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||
log.setUsername(SecurityUtils.getCurrentUsername());
|
||||
|
|
@ -132,6 +132,7 @@ public class LogServiceImpl implements LogService {
|
|||
log.setBrowser(StringUtils.getBrowser(request));
|
||||
log.setRequestIp(StringUtils.getIp(request));
|
||||
log.setAddress(StringUtils.getCityInfo(log.getRequestIp()));
|
||||
log.setShopId(shopId);
|
||||
|
||||
log.setDescription(description);
|
||||
log.setMethod(method);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package cn.ysk.cashier.cons.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -31,7 +30,7 @@ public class SuppFlow implements Serializable {
|
|||
|
||||
@Data
|
||||
public static class ConInfos{
|
||||
private Integer conInfold;
|
||||
private Integer conInfoId;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package cn.ysk.cashier.cons.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.cons.domain.*;
|
||||
import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository;
|
||||
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
||||
|
|
@ -39,7 +38,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -235,7 +233,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||
for (SuppFlow.ConInfos conInfos : resources.getList()) {
|
||||
JSONObject object = new JSONObject();
|
||||
|
||||
TbConsInfo info = tbConsInfoRepository.getById(conInfos.getConInfold());
|
||||
TbConsInfo info = tbConsInfoRepository.getById(conInfos.getConInfoId());
|
||||
if (Objects.isNull(info)) {
|
||||
log.info("耗材信息不存在");
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -1,31 +1,21 @@
|
|||
package cn.ysk.cashier.controller.product;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||
import cn.ysk.cashier.dto.product.StockQueryDto;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.service.product.StockService;
|
||||
import cn.ysk.cashier.utils.BeanUtil;
|
||||
import cn.ysk.cashier.utils.JSONUtil;
|
||||
import cn.ysk.cashier.vo.StockUpdateValueVO;
|
||||
import cn.ysk.cashier.vo.StockUpdateWarnLineVO;
|
||||
import cn.ysk.cashier.vo.StockV2Vo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
|
|
@ -36,109 +26,7 @@ public class StockController {
|
|||
|
||||
private final StockService stockService;
|
||||
|
||||
// @ApiOperation("库存导出")
|
||||
// @PostMapping(value = "download")
|
||||
// public void exportTbOrderInfo(HttpServletResponse response, @RequestBody StockQueryDto criteria) throws IOException {
|
||||
// stockService.download(criteria,response);
|
||||
// }
|
||||
//
|
||||
// @ApiOperation("库存导出")
|
||||
// @PostMapping(value = "download/v2")
|
||||
// public void exportTbOrderInfoV2(HttpServletResponse response, @RequestBody StockQueryDto criteria) throws IOException {
|
||||
// stockService.downloadV2(criteria,response);
|
||||
// }
|
||||
//
|
||||
// @Log("库存导入")
|
||||
// @PostMapping("/doImport")
|
||||
// @ApiOperation("文件导入库存")
|
||||
// public ResponseEntity<Object> importExcel(@RequestParam String shopId,@RequestParam("file") MultipartFile file) {
|
||||
// String fileName = file.getOriginalFilename();
|
||||
// if (file.isEmpty()) {
|
||||
// throw new BadRequestException("文件不能为空");
|
||||
// }
|
||||
// if (!fileName.contains("xls") && !fileName.contains("xlsx")) {
|
||||
// throw new BadRequestException("文件格式不正确");
|
||||
// }
|
||||
// try {
|
||||
// stockService.importExcel(shopId,file);
|
||||
// } catch (Exception e) {
|
||||
// log.error("文件导入库存异常:",e);
|
||||
// }
|
||||
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
// @Log("库存导入")
|
||||
// @PostMapping("/doImport/v2")
|
||||
// @ApiOperation("文件导入库存")
|
||||
// public ResponseEntity<Object> importExcelV2(@RequestParam String shopId,@RequestParam("file") MultipartFile file) {
|
||||
// String fileName = file.getOriginalFilename();
|
||||
// if (file.isEmpty()) {
|
||||
// throw new BadRequestException("文件不能为空");
|
||||
// }
|
||||
// if (!fileName.contains("xls") && !fileName.contains("xlsx")) {
|
||||
// throw new BadRequestException("文件格式不正确");
|
||||
// }
|
||||
// try {
|
||||
// stockService.importExcelV2(shopId,file);
|
||||
// } catch (Exception e) {
|
||||
// log.error("文件导入库存异常:",e);
|
||||
// }
|
||||
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
// @GetMapping
|
||||
// @ApiOperation("查询库存")
|
||||
// public ResponseEntity<Object> queryTbProduct(StockQueryDto criteria,
|
||||
// @RequestParam(required = false, defaultValue = "0") Integer page,
|
||||
// @RequestParam(required = false, defaultValue = "10") Integer size){
|
||||
// return new ResponseEntity<>(stockService.queryAll(criteria,page,size), HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/v2")
|
||||
// @ApiOperation("查询库存")
|
||||
// public ResponseEntity<Object> queryTbProductV2(StockQueryDto criteria,
|
||||
// @RequestParam(required = false, defaultValue = "0") Integer page,
|
||||
// @RequestParam(required = false, defaultValue = "10") Integer size){
|
||||
// Page<StockV2Vo> stockV2Vos = stockService.queryAllV2(criteria, page, size);
|
||||
// Map<String, Object> dataMap = BeanUtil.transBean2Map(stockV2Vos);
|
||||
// if (stockV2Vos.getContent().isEmpty()) {
|
||||
// dataMap.put("warnLine", 0);
|
||||
// }else {
|
||||
// StockV2Vo stockV2Vo = stockV2Vos.getContent().stream().filter(item -> item.getWarnLine() != null).findFirst().orElse(null);
|
||||
// dataMap.put("warnLine", stockV2Vo != null ? stockV2Vo.getWarnLine() : 0);
|
||||
// }
|
||||
// return new ResponseEntity<>(dataMap, HttpStatus.OK);
|
||||
// }
|
||||
|
||||
|
||||
// @Log("商品库存 上下架商品")
|
||||
// @PutMapping("/grounding")
|
||||
// @ApiOperation("上下架商品")
|
||||
// public ResponseEntity<Object> grounding(
|
||||
// @RequestParam Integer shopId,
|
||||
// @RequestParam Integer skuId,
|
||||
// @RequestParam Boolean isGrounding
|
||||
// ){
|
||||
// stockService.grounding(shopId,skuId, isGrounding);
|
||||
// return ResponseEntity.ok("success");
|
||||
// }
|
||||
|
||||
@GetMapping("/sku")
|
||||
@ApiOperation("查询库存")
|
||||
public ResponseEntity<Object> queryProductSku(String productId){
|
||||
return new ResponseEntity<>(stockService.queryProductSku(productId), HttpStatus.OK);
|
||||
}
|
||||
|
||||
// @GetMapping("/isStock")
|
||||
// public ResponseEntity<Object> updateIsHot(
|
||||
// @RequestParam String shopId,
|
||||
// @RequestParam Integer proId,
|
||||
// @RequestParam Integer isStock){
|
||||
// stockService.updateIsStock(proId,shopId,isStock);
|
||||
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
// }
|
||||
|
||||
// @Log("商品库存 修改商品状态")
|
||||
@PostMapping("updateProductData")
|
||||
public ResponseEntity<Object> updateProductData(@Validated @RequestBody List<StockUpdateValueVO> updateValueVO) {
|
||||
log.info(JSONUtil.toJSONString(updateValueVO));
|
||||
|
|
|
|||
|
|
@ -62,12 +62,12 @@ public class TbProductController {
|
|||
|
||||
|
||||
|
||||
@GetMapping("/isHot")
|
||||
@ApiOperation("设为招牌菜")
|
||||
public ResponseEntity<Object> updateIsHot(@RequestParam Integer isHot, @RequestParam Integer id){
|
||||
tbProductService.updateIsHot(id,isHot);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
// @GetMapping("/isHot")
|
||||
// @ApiOperation("设为招牌菜")
|
||||
// public ResponseEntity<Object> updateIsHot(@RequestParam Integer isHot, @RequestParam Integer id){
|
||||
// tbProductService.updateIsHot(id,isHot);
|
||||
// return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
// }
|
||||
|
||||
|
||||
@PostMapping("/upProSort")
|
||||
|
|
|
|||
|
|
@ -43,13 +43,6 @@ public class TbProductSkuController {
|
|||
|
||||
private final TbProductSkuService tbProductSkuService;
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('tbProductSku:list')")
|
||||
public void exportTbProductSku(HttpServletResponse response, TbProductSkuQueryCriteria criteria) throws IOException {
|
||||
tbProductSkuService.download(tbProductSkuService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询/product/sku")
|
||||
@PreAuthorize("@el.check('tbProductSku:list')")
|
||||
|
|
|
|||
|
|
@ -4,10 +4,7 @@ import cn.ysk.cashier.annotation.Log;
|
|||
import cn.ysk.cashier.dto.product.TbProductFrmLossDto;
|
||||
import cn.ysk.cashier.dto.product.TbProductStockCountQueryCriteria;
|
||||
import cn.ysk.cashier.dto.product.TbProductStockDetailQueryCriteria;
|
||||
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
||||
import cn.ysk.cashier.service.product.TbProductStockDetailService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
|
|||
|
|
@ -68,9 +68,6 @@ public class TbProductSkuDto implements Serializable {
|
|||
|
||||
private String coverImg;
|
||||
|
||||
/** 库存警戒线 */
|
||||
private Integer warnLine;
|
||||
|
||||
private Double weight;
|
||||
|
||||
private Float volume;
|
||||
|
|
|
|||
|
|
@ -88,10 +88,6 @@ public class TbProductSku implements Serializable {
|
|||
@ApiModelProperty(value = "coverImg")
|
||||
private String coverImg;
|
||||
|
||||
@Column(name = "`warn_line`")
|
||||
@ApiModelProperty(value = "库存警戒线")
|
||||
private Integer warnLine;
|
||||
|
||||
@Column(name = "`weight`")
|
||||
@ApiModelProperty(value = "weight")
|
||||
private Double weight;
|
||||
|
|
|
|||
|
|
@ -83,15 +83,11 @@ public class TestTask {
|
|||
predicate = criteriaBuilder.and(predicate, criteriaBuilder.gt(root.get("updatedAt"), System.currentTimeMillis() - 60 * 1000L * 60 * 24 * 2));
|
||||
return predicate;
|
||||
});
|
||||
Set<String> keys = new HashSet<>();
|
||||
for (TbCashierCart cart : all) {
|
||||
tbCashierCartService.clearExpireOrder(cart);
|
||||
// tbCashierCartService.clearExpireOrder(cart);
|
||||
cart.setStatus("cancelled");
|
||||
cartService.save(cart);
|
||||
keys.add(CacheKey.PRODUCT_SKU + cart.getShopId() + ":" + cart.getSkuId());
|
||||
}
|
||||
String[] keysArray = keys.toArray(new String[keys.size()]);
|
||||
redisUtils.del(keysArray);
|
||||
log.info("购物车清楚记录开始结束");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ public interface TbOrderDetailRepository extends JpaRepository<TbOrderDetail, In
|
|||
" AND info.createTime < :endTime" +
|
||||
" AND ( info.status = 'closed' OR info.status = 'refund' ) " +
|
||||
"GROUP BY orders.tradeDay " +
|
||||
"ORDER BY orders.tradeDay DESC")
|
||||
"ORDER BY orders.tradeDay")
|
||||
List<CountStockByDayVo> countStockByDay(@Param("shopId") Integer shopId,@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.TbOrderSalesCountByDayVo(" +
|
||||
|
|
|
|||
|
|
@ -27,18 +27,6 @@ public interface TbProductRepository extends JpaRepository<TbProduct, Integer>,
|
|||
@Query(value = "update tb_product set status = -1 where id in :productIds",nativeQuery = true)
|
||||
@Modifying
|
||||
void updateByStatus(List<Integer> productIds);
|
||||
@Query(value = "update tb_product set is_hot=:isHot where id = :id",nativeQuery = true)
|
||||
@Modifying
|
||||
void updateIsHot(@Param("id") Integer id,@Param("isHot")Integer isHot);
|
||||
|
||||
@Query(value = "update tb_product set is_stock=:isStock where id = :proId and shop_id=:shopId",nativeQuery = true)
|
||||
@Modifying
|
||||
void updateIsStock(@Param("proId") Integer proId,@Param("shopId") String shopId,@Param("isStock")Integer isStock);
|
||||
|
||||
|
||||
@Query(value = "update tb_product set is_hot=0 where shop_id = :shopId and is_hot = 1",nativeQuery = true)
|
||||
@Modifying
|
||||
void updateNullHot(@Param("shopId")String shopId);
|
||||
|
||||
@Modifying
|
||||
@Query("update FROM TbProduct pro set pro.stockNumber=:stockNumber WHERE pro.id =:productId")
|
||||
|
|
@ -58,8 +46,6 @@ public interface TbProductRepository extends JpaRepository<TbProduct, Integer>,
|
|||
@Query("update TbProduct set stockNumber=stockNumber+:num where id=:id")
|
||||
void incrStock(@Param("id") Integer id, @Param("num") Integer num);
|
||||
|
||||
@Query("select product from TbProduct product where product.id=:id and product.shopId=:shopId and product.isDel=0")
|
||||
TbProduct selectByShopIdAndId(Integer id, String shopId);
|
||||
|
||||
@Query("select product from TbProduct product where product.shopId=:shopId")
|
||||
List<TbProduct> selectByShopId(String shopId);
|
||||
|
|
@ -67,11 +53,13 @@ public interface TbProductRepository extends JpaRepository<TbProduct, Integer>,
|
|||
@Query(value = "select b.* from tb_product_sku as a left join tb_product as b on a.product_id=b.id where a.id=:skuId", nativeQuery = true)
|
||||
TbProduct selectBySkuId(@Param("skuId") Integer skuId);
|
||||
|
||||
@Query(value = "select * from tb_product as a where a.id=:skuId", nativeQuery = true)
|
||||
TbProduct selectById(@Param("skuId") Integer skuId);
|
||||
|
||||
@Modifying
|
||||
@Query("update TbProduct set lowPrice=:lowPrice where id=:id")
|
||||
void upLowPrice(@Param("id") Integer id, @Param("lowPrice") BigDecimal lowPrice);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("UPDATE TbProduct p SET p.warnLine = :warnLine WHERE p.shopId = :shopId")
|
||||
Integer updateWarnLineByShopId(@Param("warnLine")Integer warnLine, @Param("shopId")String shopId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
package cn.ysk.cashier.repository.product;
|
||||
|
||||
import cn.ysk.cashier.pojo.product.TbProductSku;
|
||||
import cn.ysk.cashier.vo.StockV2Vo;
|
||||
import cn.ysk.cashier.vo.StockVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
|
|
@ -23,189 +18,32 @@ import java.util.List;
|
|||
**/
|
||||
public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Integer>, JpaSpecificationExecutor<TbProductSku> {
|
||||
|
||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.productId IN :productId and sku.isDel=0")
|
||||
List<TbProductSku> searchSku(@Param("productId")List<String> productId);
|
||||
|
||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.productId = :productId and sku.isDel=0")
|
||||
List<TbProductSku> searchSku(@Param("productId")String productId);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("DELETE FROM TbProductSku sku WHERE sku.productId = :productId")
|
||||
Integer deleteByProductId(@Param("productId") String productId);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("update FROM TbProductSku sku set sku.isDel=1 WHERE sku.id = :skuId")
|
||||
Integer deleteBySkuId(@Param("skuId") Integer skuId);
|
||||
|
||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.barCode = :barCode and sku.isDel=0")
|
||||
TbProductSku searchBarCode(@Param("barCode")String barCode);
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.StockVo(" +
|
||||
"sku.id,pro.id,pro.coverImg,pro.name,unit.name,pro.typeEnum,sku.specSnap,pro.isStock,sku.stockNumber" +
|
||||
") " +
|
||||
"from " +
|
||||
"TbProduct pro " +
|
||||
"LEFT JOIN TbProductSku sku on pro.id = sku.productId " +
|
||||
"LEFT JOIN TbShopUnit unit ON pro.unitId = unit.id " +
|
||||
"WHERE " +
|
||||
"pro.shopId = :shopId " +
|
||||
"AND pro.status = 1 " +
|
||||
"AND sku.isDel=0 " +
|
||||
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
||||
"AND (:num IS NULL OR sku.stockNumber < :num) " +
|
||||
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
||||
"ORDER BY " +
|
||||
"pro.name DESC,sku.stockNumber DESC")
|
||||
Page<StockVo> searchProStock(@Param("shopId") String shopId, @Param("proName") String proName, @Param("isStock")Integer isStock,@Param("num")Double num, Pageable pageable);
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.StockV2Vo(" +
|
||||
"sku.id,pro.id,pro.coverImg,pro.name,unit.name,pro.typeEnum,sku.specSnap,pro.isStock, " +
|
||||
"CASE WHEN pro.isDistribute = 1 THEN IFNULL(pro.stockNumber, 0) ELSE SUM(sku.stockNumber) END as number" +
|
||||
", pro.isDistribute, pro.isPauseSale, true, sku.warnLine, pro.lowPrice, CASE WHEN sum(sku.isGrounding) > 0 THEN true ELSE false END as isGrounding) " +
|
||||
"from " +
|
||||
"TbProduct pro " +
|
||||
"LEFT JOIN TbProductSku sku on pro.id = sku.productId " +
|
||||
"LEFT JOIN TbShopUnit unit ON pro.unitId = unit.id " +
|
||||
"WHERE " +
|
||||
"pro.shopId = :shopId " +
|
||||
"AND pro.status = 1 " +
|
||||
"AND sku.isDel = 0 " +
|
||||
"AND (:categoryId IS NULL OR pro.categoryId = :categoryId) " +
|
||||
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
||||
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
||||
"group by pro.id " +
|
||||
"order by number asc ")
|
||||
Page<StockV2Vo> searchProStockV2(@Param("shopId") String shopId, @Param("proName") String proName, @Param("isStock")Integer isStock,
|
||||
@Param("categoryId") String categoryId, Pageable pageable);
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.StockV2Vo(" +
|
||||
"sku.id,pro.id,pro.coverImg,pro.name,unit.name,pro.typeEnum,sku.specSnap,pro.isStock, " +
|
||||
"CASE WHEN pro.isDistribute = 1 THEN IFNULL(pro.stockNumber, 0) ELSE SUM(sku.stockNumber) END as number" +
|
||||
", pro.isDistribute, pro.isPauseSale, true, sku.warnLine, pro.lowPrice, CASE WHEN sum(sku.isGrounding) > 0 THEN true ELSE false END as isGrounding) " +
|
||||
"from " +
|
||||
"TbProduct pro " +
|
||||
"LEFT JOIN TbProductSku sku on pro.id = sku.productId " +
|
||||
"LEFT JOIN TbShopUnit unit ON pro.unitId = unit.id " +
|
||||
"WHERE " +
|
||||
"pro.shopId = :shopId " +
|
||||
"AND pro.status = 1 " +
|
||||
"AND sku.isDel = 0 " +
|
||||
"AND (:categoryId IS NULL OR pro.categoryId = :categoryId) " +
|
||||
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
||||
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
||||
"group by pro.id " +
|
||||
"order by number desc ")
|
||||
Page<StockV2Vo> searchProStockV2ByDesc(@Param("shopId") String shopId, @Param("proName") String proName, @Param("isStock")Integer isStock,
|
||||
@Param("categoryId") String categoryId, Pageable pageable);
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.StockV2Vo(" +
|
||||
"sku.id,pro.id,pro.coverImg,pro.name,unit.name,pro.typeEnum,sku.specSnap,pro.isStock, " +
|
||||
"CASE " +
|
||||
" WHEN pro.isDistribute = 1 THEN pro.stockNumber " +
|
||||
" ELSE SUM(sku.stockNumber) " +
|
||||
" END " +
|
||||
", pro.isDistribute, pro.isPauseSale, true ) " +
|
||||
"from " +
|
||||
"TbProduct pro " +
|
||||
"LEFT JOIN TbProductSku sku on pro.id = sku.productId " +
|
||||
"LEFT JOIN TbShopUnit unit ON pro.unitId = unit.id " +
|
||||
"WHERE " +
|
||||
"pro.shopId = :shopId " +
|
||||
"AND pro.status = 1 " +
|
||||
"AND sku.isDel=0 " +
|
||||
"AND (:categoryId IS NULL OR pro.categoryId = :categoryId) " +
|
||||
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
||||
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
||||
"group by pro.id " +
|
||||
"ORDER BY " +
|
||||
"pro.name DESC,sku.stockNumber DESC")
|
||||
List<StockV2Vo> searchProStockV2(@Param("shopId") String shopId, @Param("proName") String proName, @Param("isStock")Integer isStock,
|
||||
@Param("categoryId") String categoryId);
|
||||
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.StockV2Vo(" +
|
||||
"sku.id,pro.id,pro.coverImg,pro.name," +
|
||||
"unit.name,pro.typeEnum,sku.specSnap,pro.isStock,sku.stockNumber, 1, sku.isPauseSale, false, 0, sku.salePrice, CASE WHEN sku.isGrounding=1 THEN true ELSE false END" +
|
||||
") " +
|
||||
"from " +
|
||||
"TbProductSku sku " +
|
||||
"left join TbProduct pro on sku.productId = pro.id " +
|
||||
"left join TbShopUnit unit on pro.unitId = unit.id " +
|
||||
"where " +
|
||||
"sku.productId = :productId " +
|
||||
"AND sku.isDel=0 " +
|
||||
"order by " +
|
||||
"sku.stockNumber desc "
|
||||
)
|
||||
List<StockV2Vo> searchProductSkuByProductId(@Param("productId") String productId);
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.StockVo(" +
|
||||
"sku.id,pro.id,pro.coverImg,pro.name,unit.name,pro.typeEnum,sku.specSnap,pro.isStock,sku.stockNumber" +
|
||||
") " +
|
||||
"from " +
|
||||
"TbProduct pro " +
|
||||
"LEFT JOIN TbProductSku sku on pro.id = sku.productId " +
|
||||
"LEFT JOIN TbShopUnit unit ON pro.unitId = unit.id " +
|
||||
"WHERE " +
|
||||
"pro.shopId = :shopId " +
|
||||
"AND pro.status = 1 " +
|
||||
"AND sku.isDel=0 " +
|
||||
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
||||
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
||||
"AND (:num IS NULL OR sku.stockNumber < :num) " +
|
||||
"ORDER BY " +
|
||||
"pro.name DESC,sku.stockNumber DESC")
|
||||
List<StockVo> searchProStock(@Param("shopId") String shopId, @Param("proName") String proName, @Param("isStock")Integer isStock,@Param("num")Double num);
|
||||
|
||||
|
||||
@Query(value = "SELECT min(sale_price) from tb_product_sku where product_id = ?1 and id != ?2", nativeQuery = true)
|
||||
BigDecimal searchMinSalePrice(@Param("productId") Integer productId, @Param("skuId") Integer skuId);
|
||||
|
||||
|
||||
@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 " +
|
||||
"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("id") Integer id);
|
||||
|
||||
|
||||
@Modifying
|
||||
@Query("update FROM TbProductSku sku set sku.stockNumber=sku.stockNumber+:stockNumber WHERE sku.id =:id")
|
||||
Integer updateStockNumber(@Param("id") Integer id, @Param("stockNumber") Double stockNumber);
|
||||
|
||||
@Modifying
|
||||
@Query("update FROM TbProductSku sku set sku.stockNumber=:stockNumber WHERE sku.shopId=:shopId and sku.id =:id")
|
||||
Integer updateStockNumber2(@Param("id") Integer id,@Param("shopId")String shopId, @Param("stockNumber") Double stockNumber);
|
||||
|
||||
@Modifying
|
||||
@Query("update FROM TbProductSku sku set sku.costPrice=:cost WHERE sku.productId=:productId")
|
||||
Integer updateCostByProductId(String productId, BigDecimal cost);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("UPDATE TbProductSku p SET p.warnLine = :warnLine WHERE p.shopId = :shopId")
|
||||
Integer updateWarnLineByShopId(@Param("warnLine")Integer warnLine, @Param("shopId")String shopId);
|
||||
|
||||
@Modifying
|
||||
@Query("update TbProductSku set stockNumber=stockNumber+:num where id=:productId")
|
||||
void incrStock(@Param("productId") Integer productId, @Param("num") Double num);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("update TbProductSku set isGrounding=:isGrounding where productId=:productId")
|
||||
void updateGroundingByProId(@Param("productId") String productId, @Param("isGrounding") Integer isGrounding);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("update TbProductSku set isGrounding=:isGrounding where id=:skuId")
|
||||
void updateGrounding(Integer skuId,int isGrounding);
|
||||
|
||||
@Modifying
|
||||
@Query("update TbProductSku set salePrice = :salePrice where productId= :productId")
|
||||
void upSalePrice(@Param("productId") String productId, @Param("lowPrice") BigDecimal salePrice);
|
||||
|
|
|
|||
|
|
@ -143,22 +143,11 @@ public class TbCashierCartServiceImpl implements TbCashierCartService {
|
|||
|
||||
@Override
|
||||
public void clearExpireOrder(TbCashierCart cart) {
|
||||
String key = CacheKey.PRODUCT + cart.getShopId() + ":product" + cart.getProductId();
|
||||
TbProduct tbProduct = tbProductRepository.findById(Integer.valueOf(cart.getProductId())).orElse(null);
|
||||
if (tbProduct == null) {
|
||||
log.warn("清空购物车查询订单失败,product id: {}", cart.getProductId());
|
||||
return;
|
||||
}
|
||||
if (tbProduct.getIsDistribute() == 1) {
|
||||
tbproductService.incrStockNumber(cart.getProductId(), cart.getNumber());
|
||||
} else {
|
||||
key = CacheKey.PRODUCT + cart.getShopId() + ":" + cart.getId();
|
||||
skuRepository.updateStockNumber(Integer.valueOf(cart.getSkuId()),cart.getNumber().doubleValue());
|
||||
}
|
||||
|
||||
// 减去销量
|
||||
if (cart.getNumber() > 0) {
|
||||
redisUtils.decrBy(key, cart.getNumber());
|
||||
}
|
||||
tbproductService.incrStockNumber(cart.getProductId(), cart.getNumber());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,5 @@
|
|||
package cn.ysk.cashier.service.impl.productimpl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.dto.product.OutAndOnDto;
|
||||
import cn.ysk.cashier.dto.product.StockQueryDto;
|
||||
import cn.ysk.cashier.dto.product.TbProductDto;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.pojo.product.TbProduct;
|
||||
import cn.ysk.cashier.pojo.product.TbProductSku;
|
||||
|
|
@ -16,34 +12,24 @@ import cn.ysk.cashier.repository.product.TbProductStockDetailRepository;
|
|||
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbShopUnitRepository;
|
||||
import cn.ysk.cashier.service.LogService;
|
||||
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.*;
|
||||
import cn.ysk.cashier.utils.JSONUtil;
|
||||
import cn.ysk.cashier.utils.SecurityUtils;
|
||||
import cn.ysk.cashier.utils.StringUtils;
|
||||
import cn.ysk.cashier.utils.WxMsgUtils;
|
||||
import cn.ysk.cashier.vo.StockUpdateValueVO;
|
||||
import cn.ysk.cashier.vo.StockUpdateWarnLineVO;
|
||||
import cn.ysk.cashier.vo.StockV2Vo;
|
||||
import cn.ysk.cashier.vo.StockVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.transaction.Transactional;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
|
|
@ -51,12 +37,7 @@ import java.util.*;
|
|||
public class StockServiceImpl implements StockService {
|
||||
|
||||
private final TbProductSkuRepository tbProductSkuRepository;
|
||||
private final TbProductService productService;
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
|
||||
private final TbProductStockOperateService stockOperateService;
|
||||
private final TbProductSkuRepository skuRepository;
|
||||
private final TbShopInfoRepository tbShopInfoRepository;
|
||||
private final TbShopUnitRepository shopUnitRepository;
|
||||
private final TbProductStockDetailRepository tbProductStockDetailRepository;
|
||||
|
|
@ -67,288 +48,6 @@ public class StockServiceImpl implements StockService {
|
|||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
|
||||
@Override
|
||||
public Page queryAll(StockQueryDto criteria, Integer page, Integer size) {
|
||||
Pageable pageable = PageRequest.of(page, size);
|
||||
return tbProductSkuRepository.searchProStock(criteria.getShopId(), criteria.getName(), criteria.getIsStock(), criteria.getNum(), pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page queryAllV2(StockQueryDto criteria, Integer page, Integer size) {
|
||||
Pageable pageable = PageRequest.of(page, size);
|
||||
if (StrUtil.isNotBlank(criteria.getSort()) && Boolean.parseBoolean(criteria.getSort())) {
|
||||
return tbProductSkuRepository.searchProStockV2ByDesc(criteria.getShopId(), criteria.getName(), criteria.getIsStock(), criteria.getCategoryId(), pageable);
|
||||
}
|
||||
return tbProductSkuRepository.searchProStockV2(criteria.getShopId(), criteria.getName(), criteria.getIsStock(), criteria.getCategoryId(), pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StockV2Vo> queryProductSku(String productId) {
|
||||
return tbProductSkuRepository.searchProductSkuByProductId(productId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(StockQueryDto criteria, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
List<StockVo> stockVos = tbProductSkuRepository.searchProStock(criteria.getShopId(), criteria.getName(), criteria.getIsStock(), criteria.getNum());
|
||||
for (StockVo all : stockVos) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("id(如需导入,该值不可变)", all.getId());
|
||||
map.put("商品名称", all.getName());
|
||||
map.put("商品类型", all.getType());
|
||||
map.put("商品规格", all.getSpecSnap());
|
||||
map.put("商品单位", all.getUnitName());
|
||||
map.put("库存数量", all.getNumber());
|
||||
// map.put("库存开关", all.getIsStock().equals(0)?"否":"是");
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadV2(StockQueryDto summaryDto, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
List<StockV2Vo> stockVos = tbProductSkuRepository.searchProStockV2(summaryDto.getShopId(), summaryDto.getName(),
|
||||
summaryDto.getIsStock(), summaryDto.getCategoryId());
|
||||
for (StockV2Vo all : stockVos) {
|
||||
if (all.getIsDistribute().equals(1)) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("id(如需导入,该值不可变)", all.getProId());
|
||||
map.put("商品名称", all.getName());
|
||||
map.put("商品skuId(如需导入,该值不可变)", all.getSkuId());
|
||||
map.put("商品类型", all.getType());
|
||||
map.put("商品规格", all.getSpecSnap());
|
||||
map.put("商品单位", all.getUnitName());
|
||||
map.put("库存数量", all.getStockNumber());
|
||||
map.put("库存开关", all.getIsStock().equals(0) ? "否" : "是");
|
||||
map.put("是否共享库存", all.getIsDistribute().equals(0) ? "否" : "是");
|
||||
map.put("是否售罄", all.getIsPauseSale().equals(0) ? "否" : "是");
|
||||
list.add(map);
|
||||
} else {
|
||||
List<StockV2Vo> skuList = queryProductSku(all.getProId().toString());
|
||||
for (StockV2Vo sku : skuList) {
|
||||
Map<String, Object> skuMap = new LinkedHashMap<>();
|
||||
skuMap.put("id(如需导入,该值不可变)", "sku");
|
||||
skuMap.put("商品名称", all.getName());
|
||||
skuMap.put("商品skuId(如需导入,该值不可变)", sku.getSkuId());
|
||||
skuMap.put("商品类型", sku.getType());
|
||||
skuMap.put("商品规格", sku.getSpecSnap());
|
||||
skuMap.put("商品单位", sku.getUnitName());
|
||||
skuMap.put("库存数量", sku.getStockNumber());
|
||||
skuMap.put("库存开关", sku.getIsStock().equals(0) ? "否" : "是");
|
||||
skuMap.put("是否共享库存", sku.getIsDistribute().equals(0) ? "否" : "是");
|
||||
skuMap.put("是否售罄", sku.getIsPauseSale().equals(0) ? "否" : "是");
|
||||
list.add(skuMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importExcel(String shopId, MultipartFile file) throws IOException {
|
||||
//根据路径获取这个操作excel的实例
|
||||
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(file.getInputStream());
|
||||
//根据页面index 获取sheet页
|
||||
XSSFSheet sheet = xssfWorkbook.getSheetAt(0);
|
||||
XSSFRow row = null;
|
||||
List<StockVo> list = new ArrayList<>();
|
||||
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
|
||||
row = sheet.getRow(i);
|
||||
if (row != null) {
|
||||
if (row.getCell(0) != null) {
|
||||
Optional<TbProductSku> byId = skuRepository.findById(Integer.valueOf(row.getCell(0).toString()));
|
||||
if (byId.isPresent()) {
|
||||
TbProductSku sku = byId.get();
|
||||
list.add(new StockVo(
|
||||
sku.getId(),
|
||||
row.getCell(1).toString(),
|
||||
row.getCell(4).toString(),
|
||||
row.getCell(3).toString(),
|
||||
row.getCell(5).toString(),
|
||||
sku.getStockNumber()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("库存导入.importExcel.data:" + list);
|
||||
OutAndOnDto outAndOnDto = new OutAndOnDto();
|
||||
outAndOnDto.setShopId(shopId);
|
||||
outAndOnDto.setList(new ArrayList<>(list));
|
||||
outAndOnDto.setType("purchase");
|
||||
outAndOnDto.setRemark("一次性导入 库存数会覆盖");
|
||||
outAndOnDto.setIsImport("true");
|
||||
outAndOnDto.setTime(System.currentTimeMillis());
|
||||
outAndOnDto.setTotalAmount(BigDecimal.ZERO);
|
||||
outAndOnDto.setPaidAmount(BigDecimal.ZERO);
|
||||
stockOperateService.createOutAndONOperate(outAndOnDto);
|
||||
inHouse(shopId, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void importExcelV2(String shopId, MultipartFile file) throws IOException {
|
||||
//根据路径获取这个操作excel的实例
|
||||
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(file.getInputStream());
|
||||
//根据页面index 获取sheet页
|
||||
XSSFSheet sheet = xssfWorkbook.getSheetAt(0);
|
||||
XSSFRow row = null;
|
||||
List<StockV2Vo> list = new ArrayList<>();
|
||||
|
||||
List<TbProductStockDetail> stockDetails = new ArrayList<>();
|
||||
|
||||
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
|
||||
row = sheet.getRow(i);
|
||||
if (row != null) {
|
||||
XSSFCell cell0 = row.getCell(0);
|
||||
String productIdStr = cell0.toString();
|
||||
|
||||
TbProductStockDetail stockDetail = new TbProductStockDetail();
|
||||
stockDetail.setCreatedAt(System.currentTimeMillis());
|
||||
stockDetail.setUpdatedAt(System.currentTimeMillis());
|
||||
stockDetail.setSourcePath("SHOP");
|
||||
stockDetail.setRemark("一次性入库覆盖库存");
|
||||
stockDetail.setOperator(SecurityUtils.getCurrentUsername());
|
||||
if ("sku".equals(productIdStr)) {
|
||||
Optional<TbProductSku> byId = skuRepository.findById(Double.valueOf(row.getCell(2).toString()).intValue());
|
||||
if (byId.isPresent()) {
|
||||
TbProductSku sku = byId.get();
|
||||
|
||||
String numStr = row.getCell(6).toString();
|
||||
Double aDouble = Double.valueOf(numStr);
|
||||
if (aDouble.equals(sku.getStockNumber())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
TbProductDto product = productService.findById(Integer.valueOf(sku.getProductId()));
|
||||
TbShopUnit shopUnit = shopUnitRepository.searchUnit(product.getUnitId());
|
||||
|
||||
stockDetail.setShopId(sku.getShopId());
|
||||
stockDetail.setSkuId(sku.getId().toString());
|
||||
stockDetail.setProductId(product.getId().toString());
|
||||
stockDetail.setProductName(product.getName());
|
||||
stockDetail.setUnitName(shopUnit.getName());
|
||||
stockDetail.setLeftNumber(product.getStockNumber());//原库存
|
||||
BigDecimal subtract = new BigDecimal(aDouble).subtract(new BigDecimal(product.getStockNumber()));
|
||||
if (subtract.compareTo(BigDecimal.ZERO) > 0) {
|
||||
stockDetail.setSubType(1);
|
||||
stockDetail.setType("盘点入库");
|
||||
stockDetail.setStockNumber(subtract.doubleValue());
|
||||
}else {
|
||||
stockDetail.setSubType(-1);
|
||||
stockDetail.setType("盘点出库");
|
||||
stockDetail.setStockNumber(subtract.doubleValue());
|
||||
}
|
||||
stockDetails.add(stockDetail);
|
||||
|
||||
list.add(new StockV2Vo(
|
||||
0,
|
||||
sku.getId(),
|
||||
row.getCell(1).toString(),
|
||||
row.getCell(5).toString(),
|
||||
row.getCell(4).toString(),
|
||||
aDouble.intValue(),
|
||||
sku.getStockNumber().intValue(),
|
||||
0
|
||||
));
|
||||
}
|
||||
} else {
|
||||
TbProductDto product = productService.findById(Double.valueOf(productIdStr).intValue());
|
||||
if (product != null) {
|
||||
String numStr = row.getCell(6).toString();
|
||||
Double aDouble = Double.valueOf(numStr);
|
||||
Integer aIntValue = aDouble.intValue();
|
||||
if (aIntValue.equals(product.getStockNumber())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
TbShopUnit shopUnit = shopUnitRepository.searchUnit(product.getUnitId());
|
||||
|
||||
stockDetail.setShopId(product.getShopId());
|
||||
stockDetail.setProductId(product.getId().toString());
|
||||
stockDetail.setProductName(product.getName());
|
||||
stockDetail.setUnitName(shopUnit.getName());
|
||||
// stockDetail.setLeftNumber(0);
|
||||
// stockDetail.setStockNumber(aDouble);
|
||||
stockDetail.setLeftNumber(product.getStockNumber());//原库存
|
||||
BigDecimal subtract = new BigDecimal(aDouble).subtract(new BigDecimal(product.getStockNumber()));
|
||||
if (subtract.compareTo(BigDecimal.ZERO) > 0) {
|
||||
stockDetail.setSubType(1);
|
||||
stockDetail.setType("盘点入库");
|
||||
stockDetail.setStockNumber(subtract.doubleValue());
|
||||
}else {
|
||||
stockDetail.setSubType(-1);
|
||||
stockDetail.setType("盘点出库");
|
||||
stockDetail.setStockNumber(subtract.doubleValue());
|
||||
}
|
||||
stockDetails.add(stockDetail);
|
||||
|
||||
list.add(new StockV2Vo(
|
||||
product.getId(),
|
||||
0,
|
||||
product.getName(),
|
||||
row.getCell(5).toString(),
|
||||
row.getCell(4).toString(),
|
||||
aIntValue,
|
||||
product.getStockNumber(),
|
||||
product.getIsDistribute()
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!stockDetails.isEmpty()) {
|
||||
tbProductStockDetailRepository.saveAll(stockDetails);
|
||||
}
|
||||
|
||||
log.info("库存导入.importExcel.data:" + list);
|
||||
OutAndOnDto outAndOnDto = new OutAndOnDto();
|
||||
outAndOnDto.setShopId(shopId);
|
||||
outAndOnDto.setList(new ArrayList<>(list));
|
||||
outAndOnDto.setType("purchase");
|
||||
outAndOnDto.setRemark("一次性导入 库存数会覆盖");
|
||||
outAndOnDto.setIsImport("true");
|
||||
outAndOnDto.setTime(System.currentTimeMillis());
|
||||
outAndOnDto.setTotalAmount(BigDecimal.ZERO);
|
||||
outAndOnDto.setPaidAmount(BigDecimal.ZERO);
|
||||
stockOperateService.createOutAndONOperate(outAndOnDto);
|
||||
inHouseV2(shopId, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void inHouse(String shopId, List<StockVo> list) {
|
||||
Map<Integer, Double> idStockMap = new HashMap<>();
|
||||
for (StockVo stockVo : list) {
|
||||
tbProductSkuRepository.updateStockNumber2(stockVo.getId(), shopId, Double.parseDouble(stockVo.getNumber().toString()));
|
||||
idStockMap.put(stockVo.getId(), Double.parseDouble(stockVo.getNumber().toString()));
|
||||
}
|
||||
redisUtils.redisUp(2, shopId, idStockMap);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void inHouseV2(String shopId, List<StockV2Vo> list) {
|
||||
Set<Integer> proIds = new HashSet<>();
|
||||
Set<Integer> skuIds = new HashSet<>();
|
||||
for (StockV2Vo stockVo : list) {
|
||||
if (stockVo.getProId() == 0) {
|
||||
tbProductSkuRepository.updateStockNumber2(stockVo.getSkuId(), shopId, Double.parseDouble(stockVo.getNumber().toString()));
|
||||
skuIds.add(stockVo.getSkuId());
|
||||
} else {
|
||||
productService.updateStockNumber(stockVo.getProId(), Double.parseDouble(stockVo.getNumber().toString()));
|
||||
proIds.add(stockVo.getProId());
|
||||
}
|
||||
}
|
||||
redisUtils.delByIntKey(CacheKey.PRODUCT_SKU + shopId + ":product", proIds);
|
||||
redisUtils.delByIntKey(CacheKey.PRODUCT_SKU + shopId + ":", skuIds);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void updateIsStock(Integer proId, String shopId, Integer isStock) {
|
||||
productService.updateIsStock(proId, shopId, isStock);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
|
|
@ -390,6 +89,8 @@ public class StockServiceImpl implements StockService {
|
|||
tbProductSkuRepository.updateGroundingByProId(product.getId().toString(), Integer.valueOf(updateValueVO.getValue()));
|
||||
description.append("0".equals(updateValueVO.getValue()) ? "已下架" : "已上架");
|
||||
sqlQuery.append(" set is_grounding = ").append(updateValueVO.getValue());
|
||||
// 推送微信操作消息
|
||||
wxMsgUtils.aboardOperationMsg(("1".equals(updateValueVO.getValue()) ? "上架商品: " : "下架商品: ") + product.getName(), Integer.valueOf(product.getShopId()));
|
||||
break;
|
||||
case "stockNumber"://库存
|
||||
description.append(" 库存数量修改为:"+updateValueVO.getValue()+" 原库存:"+product.getStockNumber());
|
||||
|
|
@ -464,6 +165,7 @@ public class StockServiceImpl implements StockService {
|
|||
}
|
||||
logService.save(description.toString(),
|
||||
"cn.ysk.cashier.controller.product.StockController.updateProductStatus()",
|
||||
Integer.valueOf(product.getShopId()),
|
||||
JSONUtil.toJSONString(updateValueVO));
|
||||
}
|
||||
|
||||
|
|
@ -483,17 +185,18 @@ public class StockServiceImpl implements StockService {
|
|||
throw new BadRequestException("无效值");
|
||||
}
|
||||
sqlQuery.append(" set is_pause_sale = ").append(updateValueVO.getValue());
|
||||
description.append(" 修改为" + ("0".equals(updateValueVO.getValue()) ? "非售罄" : "已售罄"));
|
||||
description.append(" 修改为").append("0".equals(updateValueVO.getValue()) ? "非售罄" : "已售罄");
|
||||
break;
|
||||
case "grounding": //sku上下架
|
||||
if (!"0".equals(updateValueVO.getValue()) && !"1".equals(updateValueVO.getValue())) {
|
||||
throw new BadRequestException("无效值");
|
||||
}
|
||||
sqlQuery.append(" set is_grounding = ").append(updateValueVO.getValue());
|
||||
wxMsgUtils.aboardOperationMsg(("1".equals(updateValueVO.getValue()) ? "上架: " : "下架: ") + description, Integer.valueOf(product.getShopId()));
|
||||
description.append("0".equals(updateValueVO.getValue()) ? "已下架" : "已上架");
|
||||
break;
|
||||
case "salePrice"://价格
|
||||
description.append("修改价格为" + updateValueVO.getValue());
|
||||
description.append("修改价格为").append(updateValueVO.getValue());
|
||||
sqlQuery.append(" set sale_price = ").append(updateValueVO.getValue());
|
||||
if(("sku").equals(product.getTypeEnum())){
|
||||
BigDecimal bigDecimal = tbProductSkuRepository.searchMinSalePrice(Integer.valueOf(tbProductSku.getProductId()),tbProductSku.getId());
|
||||
|
|
@ -528,6 +231,7 @@ public class StockServiceImpl implements StockService {
|
|||
}
|
||||
logService.save(description.toString(),
|
||||
"cn.ysk.cashier.controller.product.StockController.updateProductStatus()",
|
||||
Integer.valueOf(product.getShopId()),
|
||||
JSONUtil.toJSONString(updateValueVO));
|
||||
}
|
||||
|
||||
|
|
@ -538,24 +242,6 @@ public class StockServiceImpl implements StockService {
|
|||
if (shopInfo == null) {
|
||||
throw new BadRequestException("店铺不存在");
|
||||
}
|
||||
tbProductSkuRepository.updateWarnLineByShopId(stockUpdateWarnLineVO.getWarnLine(), stockUpdateWarnLineVO.getShopId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void grounding(Integer shopId, Integer skuId, Boolean isGrounding) {
|
||||
TbProductSku tbProductSku = skuRepository.findById(skuId).orElse(null);
|
||||
if (tbProductSku == null) {
|
||||
throw new BadRequestException("商品不存在,skuId: " + skuId);
|
||||
}
|
||||
|
||||
TbProduct product = tbProductRepository.selectByShopIdAndId(Integer.parseInt(tbProductSku.getProductId()), String.valueOf(shopId));
|
||||
// 推送微信操作消息
|
||||
wxMsgUtils.aboardOperationMsg((isGrounding ? "上架商品: " : "下架商品: ") + product.getName(), shopId);
|
||||
// 共享库存下架所有sku
|
||||
if (product.getIsDistribute().equals(1)) {
|
||||
tbProductSkuRepository.updateGroundingByProId(product.getId().toString(), isGrounding ? 1 : 0);
|
||||
}else {
|
||||
tbProductSkuRepository.updateGrounding(skuId, isGrounding ? 1 : 0);
|
||||
}
|
||||
tbProductRepository.updateWarnLineByShopId(stockUpdateWarnLineVO.getWarnLine(), stockUpdateWarnLineVO.getShopId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import cn.ysk.cashier.repository.product.*;
|
|||
import cn.ysk.cashier.repository.shop.TbPurchaseNoticeRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbShopUnitRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbShopUserDutyDetailRepository;
|
||||
import cn.ysk.cashier.service.LogService;
|
||||
import cn.ysk.cashier.service.TbPlatformDictService;
|
||||
import cn.ysk.cashier.service.product.TbProductService;
|
||||
import cn.ysk.cashier.service.shop.TbCouponCategoryService;
|
||||
|
|
@ -79,6 +80,7 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
private final cn.ysk.cashier.mybatis.mapper.TbProductMapper productMapper;
|
||||
private final TbProductSkuResultRepository productSkuResultRepository;
|
||||
private final ViewConSkuRepository viewConSkuRepository;
|
||||
private final LogService logService;
|
||||
|
||||
|
||||
private final RedisUtils redisUtils;
|
||||
|
|
@ -413,13 +415,6 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
if (resources.getCategoryId() == null) {
|
||||
throw new BadRequestException("必填内容未填写");
|
||||
}
|
||||
// if (resources.getIsShowMall() == 1) {
|
||||
// for (TbProductSku sku : resources.getSkuList()) {
|
||||
// if (sku.getStockNumber() <= 0) {
|
||||
// throw new BadRequestException("上架区域包括小程序时,库存数量必须大于0。");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
product.setCategoryId(String.valueOf(resources.getCategoryId()));
|
||||
}
|
||||
if (product.getUnitId() == null) {
|
||||
|
|
@ -463,16 +458,6 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
tbProductRepository.save(save);
|
||||
//sku
|
||||
if (resources.getSkuList() != null) {
|
||||
Integer warnLine = 0;
|
||||
List<TbProduct> productList = tbProductRepository.selectByShopId(resources.getShopId());
|
||||
if (!productList.isEmpty()) {
|
||||
TbProduct p = productList.get(0);
|
||||
List<TbProductSku> productSkus = tbProductSkuRepository.searchSku(p.getId().toString());
|
||||
if (!productSkus.isEmpty()) {
|
||||
warnLine = productSkus.get(0).getWarnLine();
|
||||
}
|
||||
}
|
||||
|
||||
List<TbProductSku> skuList = new ArrayList<>();
|
||||
for (TbProductSku sku : resources.getSkuList()) {
|
||||
sku.setProductId(String.valueOf(save.getId()));
|
||||
|
|
@ -480,13 +465,8 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
sku.setCreatedAt(Instant.now().toEpochMilli());
|
||||
sku.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
sku.setIsGrounding(1);
|
||||
sku.setWarnLine(warnLine);
|
||||
skuList.add(sku);
|
||||
}
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuRepository.saveAll(skuList);
|
||||
Map<Integer, Double> idStockMap = tbProductSkus.stream()
|
||||
.collect(Collectors.toMap(TbProductSku::getId, TbProductSku::getStockNumber));
|
||||
redisUtils.redisUp(1, save.getShopId(), idStockMap);
|
||||
}
|
||||
//保存到sku_result
|
||||
if ("sku".equals(resources.getTypeEnum())) {
|
||||
|
|
@ -514,6 +494,21 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbProductVo resources) {
|
||||
TbProduct source = tbProductRepository.findById(resources.getId()).orElse(null);
|
||||
if (source == null) {
|
||||
throw new BadRequestException("商品不存在");
|
||||
}
|
||||
StringBuilder description = new StringBuilder("商品" + source.getName());
|
||||
//上架 库存开关 设为推荐
|
||||
if (resources.getIsHot().equals(source.getIsHot())) {
|
||||
description.append((resources.getIsHot() == 0 ? ",已取消" : ",已设为") + "推荐");
|
||||
}
|
||||
if (resources.getIsGrounding().equals(source.getIsGrounding())) {
|
||||
description.append((resources.getIsGrounding() == 0 ? ",已取消" : ",已设为") + "上架");
|
||||
}
|
||||
if (resources.getIsStock().equals(source.getIsStock())) {
|
||||
description.append((resources.getIsStock() == 0 ? ",已关闭" : ",已打开") + "库存开关");
|
||||
}
|
||||
TbProduct product = new TbProduct();
|
||||
//组装
|
||||
BeanUtils.copyProperties(resources, product);
|
||||
|
|
@ -569,7 +564,6 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
|
||||
//sku
|
||||
if (resources.getSkuList() != null) {
|
||||
// if ("sku".equals(save.getTypeEnum())) {
|
||||
List<Integer> collect = resources.getSkuList().stream().map(TbProductSku::getId).collect(Collectors.toList());
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuRepository.searchSku(resources.getId().toString());
|
||||
for (TbProductSku productSkus : tbProductSkus) {
|
||||
|
|
@ -577,7 +571,6 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
tbProductSkuRepository.deleteBySkuId(productSkus.getId());
|
||||
}
|
||||
}
|
||||
// }
|
||||
tbProductSkuRepository.saveAll(resources.getSkuList());
|
||||
}
|
||||
//保存到sku_result
|
||||
|
|
@ -602,19 +595,16 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
noticeRepository.save(resources.getNotices());
|
||||
}
|
||||
}
|
||||
String desc = description.toString();
|
||||
if (desc.contains("推荐") || desc.contains("上架") || desc.contains("库存开关")) {
|
||||
logService.save(description.toString(),
|
||||
"cn.ysk.cashier.controller.product.StockController.updateProductStatus()",
|
||||
Integer.valueOf(product.getShopId()),
|
||||
JSONUtil.toJSONString(resources));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateIsHot(Integer id, Integer isHot) {
|
||||
tbProductRepository.updateIsHot(id, isHot);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateIsStock(Integer proId, String shopId, Integer isStock) {
|
||||
tbProductRepository.updateIsStock(proId, shopId, isStock);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
|
|
@ -768,11 +758,7 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
log.info("返还库存失败,商品不存在: {}", productId);
|
||||
return;
|
||||
}
|
||||
if (product.getIsDistribute() == 1) {
|
||||
tbProductRepository.incrStock(productId, num);
|
||||
} else {
|
||||
tbProductSkuRepository.incrStock(productSkuId, Double.valueOf(num));
|
||||
}
|
||||
tbProductRepository.incrStock(productId, num);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,21 +53,21 @@ public class TbProductSkuServiceImpl implements TbProductSkuService {
|
|||
private final TbProductSkuMapper tbProductSkuMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbProductSkuQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbProductSku> page = tbProductSkuRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
public Map<String, Object> queryAll(TbProductSkuQueryCriteria criteria, Pageable pageable) {
|
||||
Page<TbProductSku> page = tbProductSkuRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
return PageUtil.toPage(page.map(tbProductSkuMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbProductSkuDto> queryAll(TbProductSkuQueryCriteria criteria){
|
||||
return tbProductSkuMapper.toDto(tbProductSkuRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
public List<TbProductSkuDto> queryAll(TbProductSkuQueryCriteria criteria) {
|
||||
return tbProductSkuMapper.toDto(tbProductSkuRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TbProductSkuDto findById(Integer id) {
|
||||
TbProductSku tbProductSku = tbProductSkuRepository.findById(id).orElseGet(TbProductSku::new);
|
||||
ValidationUtil.isNull(tbProductSku.getId(),"TbProductSku","id",id);
|
||||
ValidationUtil.isNull(tbProductSku.getId(), "TbProductSku", "id", id);
|
||||
return tbProductSkuMapper.toDto(tbProductSku);
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ public class TbProductSkuServiceImpl implements TbProductSkuService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbProductSku resources) {
|
||||
TbProductSku tbProductSku = tbProductSkuRepository.findById(resources.getId()).orElseGet(TbProductSku::new);
|
||||
ValidationUtil.isNull( tbProductSku.getId(),"TbProductSku","id",resources.getId());
|
||||
ValidationUtil.isNull(tbProductSku.getId(), "TbProductSku", "id", resources.getId());
|
||||
tbProductSku.copy(resources);
|
||||
tbProductSkuRepository.save(tbProductSku);
|
||||
}
|
||||
|
|
@ -92,35 +92,4 @@ public class TbProductSkuServiceImpl implements TbProductSkuService {
|
|||
tbProductSkuRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<TbProductSkuDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbProductSkuDto tbProductSku : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put(" shopId", tbProductSku.getShopId());
|
||||
map.put("条形码", tbProductSku.getBarCode());
|
||||
map.put("商品Id", tbProductSku.getProductId());
|
||||
map.put("原价", tbProductSku.getOriginPrice());
|
||||
map.put("成本价", tbProductSku.getCostPrice());
|
||||
map.put("会员价", tbProductSku.getMemberPrice());
|
||||
map.put(" mealPrice", tbProductSku.getMealPrice());
|
||||
map.put("售价", tbProductSku.getSalePrice());
|
||||
map.put("进货参考价", tbProductSku.getGuidePrice());
|
||||
map.put(" strategyPrice", tbProductSku.getStrategyPrice());
|
||||
map.put("库存数量", tbProductSku.getStockNumber());
|
||||
map.put("标签镜像", tbProductSku.getSpecSnap());
|
||||
map.put(" coverImg", tbProductSku.getCoverImg());
|
||||
map.put("库存警戒线", tbProductSku.getWarnLine());
|
||||
map.put(" weight", tbProductSku.getWeight());
|
||||
map.put(" volume", tbProductSku.getVolume());
|
||||
map.put("销量", tbProductSku.getRealSalesNumber());
|
||||
map.put("一级分销金额", tbProductSku.getFirstShared());
|
||||
map.put("二级分销金额", tbProductSku.getSecondShared());
|
||||
map.put(" createdAt", tbProductSku.getCreatedAt());
|
||||
map.put(" updatedAt", tbProductSku.getUpdatedAt());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
|
|
@ -922,7 +922,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
*/
|
||||
private void checkWarnLineAndSendMsg(TbProductSku productSku, TbProduct product, Integer shopId, Integer num) {
|
||||
TbShopInfo shopInfo = shopInfoRepository.getById(shopId);
|
||||
if (productSku.getWarnLine() == null) {
|
||||
if (product.getWarnLine() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -930,20 +930,12 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
return;
|
||||
}
|
||||
|
||||
if (productSku.getStockNumber() == null) {
|
||||
productSku.setStockNumber((double) 0);
|
||||
}
|
||||
|
||||
if (product.getStockNumber() == null) {
|
||||
product.setStockNumber(0);
|
||||
}
|
||||
if (
|
||||
(product.getIsDistribute() == 1 && product.getStockNumber() - num <= productSku.getWarnLine())
|
||||
|| (product.getIsDistribute() != 1) && productSku.getStockNumber() - num <= productSku.getWarnLine()
|
||||
) {
|
||||
|
||||
if (product.getStockNumber() - num <= product.getWarnLine()) {
|
||||
wxMsgUtils.aboardStockMsg(shopInfo.getShopName(), shopId, product.getName(),
|
||||
product.getIsDistribute() == 1 ? product.getStockNumber() - num : (int) (productSku.getStockNumber() - num));
|
||||
product.getStockNumber() - num);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,41 +1,12 @@
|
|||
package cn.ysk.cashier.service.product;
|
||||
|
||||
import cn.ysk.cashier.dto.product.StockQueryDto;
|
||||
import cn.ysk.cashier.vo.StockUpdateValueVO;
|
||||
import cn.ysk.cashier.vo.StockUpdateWarnLineVO;
|
||||
import cn.ysk.cashier.vo.StockV2Vo;
|
||||
import cn.ysk.cashier.vo.StockVo;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public interface StockService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Page queryAll(StockQueryDto criteria, Integer page, Integer size);
|
||||
|
||||
Page<StockV2Vo> queryAllV2(StockQueryDto criteria, Integer page, Integer size);
|
||||
|
||||
List<StockV2Vo> queryProductSku(String productId);
|
||||
|
||||
void download(StockQueryDto summaryDto, HttpServletResponse response) throws IOException;
|
||||
|
||||
void downloadV2(StockQueryDto summaryDto, HttpServletResponse response) throws IOException;
|
||||
|
||||
void importExcel(String shopId, MultipartFile file) throws IOException;
|
||||
|
||||
void importExcelV2(String shopId, MultipartFile file) throws IOException;
|
||||
|
||||
void inHouse(String shopId,List<StockVo> list);
|
||||
|
||||
void updateIsStock(Integer proId, String shopId,Integer isStock);
|
||||
|
||||
void updateProductStatus(List<StockUpdateValueVO> updateValueVO);
|
||||
|
||||
|
|
@ -45,12 +16,4 @@ public interface StockService {
|
|||
*/
|
||||
void updateProductWarnLine(StockUpdateWarnLineVO stockUpdateWarnLineVO);
|
||||
|
||||
/**
|
||||
* 上下架商品
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param skuId ski
|
||||
* @param isGrounding
|
||||
*/
|
||||
void grounding(Integer shopId, Integer skuId, Boolean isGrounding);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,10 +90,6 @@ public interface TbProductService {
|
|||
*/
|
||||
void download(List<TbProductDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
void updateIsHot(Integer id,Integer isStock);
|
||||
|
||||
void updateIsStock(Integer proId, String shopId, Integer isStock);
|
||||
|
||||
/**
|
||||
* 增加库存
|
||||
*
|
||||
|
|
|
|||
|
|
@ -73,11 +73,5 @@ public interface TbProductSkuService {
|
|||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TbProductSkuDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package cn.ysk.cashier.vo;
|
||||
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class StockPageImpl<T> extends PageImpl<T> {
|
||||
private Integer warnLine;
|
||||
|
||||
public StockPageImpl(List<T> content, Pageable pageable, long total) {
|
||||
super(content, pageable, total);
|
||||
}
|
||||
|
||||
public StockPageImpl(List<T> content) {
|
||||
super(content);
|
||||
}
|
||||
|
||||
public Integer getWarnLine() {
|
||||
return warnLine;
|
||||
}
|
||||
|
||||
public void setWarnLine(Integer warnLine) {
|
||||
this.warnLine = warnLine;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,10 +2,6 @@ package cn.ysk.cashier.vo;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class StockUpdateWarnLineVO {
|
||||
private String shopId;
|
||||
|
|
|
|||
|
|
@ -1,290 +0,0 @@
|
|||
package cn.ysk.cashier.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
public class StockV2Vo {
|
||||
private String id;
|
||||
private Integer skuId;
|
||||
private Integer proId;
|
||||
private String img;
|
||||
private String name;
|
||||
private String unitName;
|
||||
private String type;
|
||||
private String specSnap;
|
||||
private Object isStock;
|
||||
private Object stockNumber;
|
||||
private Integer isDistribute;
|
||||
private Integer isPauseSale;
|
||||
private Object number;
|
||||
private Integer warnLine;
|
||||
private BigDecimal salePrice;
|
||||
private boolean isGrounding;
|
||||
|
||||
public StockV2Vo(Integer proId, Integer skuId, String name, String unitName,String specSnap, Object number,Object stockNumber, Integer isDistribute) {
|
||||
this.proId = proId;
|
||||
this.skuId = skuId;
|
||||
this.name = name;
|
||||
this.unitName = unitName;
|
||||
this.specSnap = specSnap;
|
||||
this.number = number;
|
||||
this.stockNumber = stockNumber;
|
||||
this.isDistribute = isDistribute;
|
||||
}
|
||||
|
||||
public StockV2Vo(Integer id, Integer proId,String img,String name,String unitName, String type, String specSnap,
|
||||
Object isStock, Object number, Integer isDistribute, Integer isPauseSale, boolean isPro) {
|
||||
this.id = id.toString() + "-" + proId.toString();
|
||||
if (isPro) {
|
||||
this.id += proId;
|
||||
} else {
|
||||
this.id += id;
|
||||
}
|
||||
this.skuId = id;
|
||||
this.proId = proId;
|
||||
this.img = img;
|
||||
this.name = name;
|
||||
this.unitName = unitName;
|
||||
setType(type);
|
||||
this.specSnap = specSnap;
|
||||
this.isStock = isStock;
|
||||
this.stockNumber = number;
|
||||
this.isDistribute = isDistribute;
|
||||
this.isPauseSale = isPauseSale;
|
||||
}
|
||||
|
||||
public StockV2Vo(Integer id, Integer proId,String img,String name,String unitName, String type, String specSnap,
|
||||
Object isStock, Object number, Integer isDistribute, Integer isPauseSale, boolean isPro, Integer warnLine) {
|
||||
this.id = id.toString() + "-" + proId.toString();
|
||||
if (isPro) {
|
||||
this.id += proId;
|
||||
} else {
|
||||
this.id += id;
|
||||
}
|
||||
this.skuId = id;
|
||||
this.proId = proId;
|
||||
this.img = img;
|
||||
this.name = name;
|
||||
this.unitName = unitName;
|
||||
setType(type);
|
||||
this.specSnap = specSnap;
|
||||
this.isStock = isStock;
|
||||
this.stockNumber = number;
|
||||
this.isDistribute = isDistribute;
|
||||
this.isPauseSale = isPauseSale;
|
||||
this.warnLine = warnLine;
|
||||
}
|
||||
|
||||
|
||||
public StockV2Vo(Integer id, Integer proId,String img,String name,String unitName, String type, String specSnap,
|
||||
Object isStock, Object number, Integer isDistribute, Integer isPauseSale, boolean isPro, Integer warnLine, BigDecimal sellPrice) {
|
||||
this.id = id.toString() + "-" + proId.toString();
|
||||
if (isPro) {
|
||||
this.id += proId;
|
||||
} else {
|
||||
this.id += id;
|
||||
}
|
||||
this.skuId = id;
|
||||
this.proId = proId;
|
||||
this.img = img;
|
||||
this.name = name;
|
||||
this.unitName = unitName;
|
||||
setType(type);
|
||||
this.specSnap = specSnap;
|
||||
this.isStock = isStock;
|
||||
this.stockNumber = number;
|
||||
this.isDistribute = isDistribute;
|
||||
this.isPauseSale = isPauseSale;
|
||||
this.warnLine = warnLine;
|
||||
this.salePrice = sellPrice;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public StockV2Vo(Integer id, Integer proId,String img,String name,String unitName, String type, String specSnap,
|
||||
Object isStock, Object number, Integer isDistribute, Integer isPauseSale, boolean isPro, Integer warnLine, BigDecimal sellPrice, boolean isGrounding) {
|
||||
this.skuId = id;
|
||||
this.id = id.toString() + "-" + proId.toString();
|
||||
if (isPro) {
|
||||
this.id += proId;
|
||||
} else {
|
||||
this.id += id;
|
||||
}
|
||||
this.proId = proId;
|
||||
this.img = img;
|
||||
this.name = name;
|
||||
this.unitName = unitName;
|
||||
setType(type);
|
||||
this.specSnap = specSnap;
|
||||
this.isStock = isStock;
|
||||
this.stockNumber = number;
|
||||
this.isDistribute = isDistribute;
|
||||
this.isPauseSale = isPauseSale;
|
||||
this.warnLine = warnLine;
|
||||
this.salePrice = sellPrice;
|
||||
this.isGrounding = isGrounding;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getSkuId() {
|
||||
return skuId;
|
||||
}
|
||||
|
||||
public void setSkuId(Integer skuId) {
|
||||
this.skuId = skuId;
|
||||
}
|
||||
|
||||
public Integer getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(Integer proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUnitName() {
|
||||
return unitName;
|
||||
}
|
||||
|
||||
public void setUnitName(String unitName) {
|
||||
this.unitName = unitName;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getSpecSnap() {
|
||||
return specSnap;
|
||||
}
|
||||
|
||||
public void setSpecSnap(String specSnap) {
|
||||
this.specSnap = specSnap;
|
||||
}
|
||||
|
||||
public Object getIsStock() {
|
||||
return isStock;
|
||||
}
|
||||
|
||||
public void setIsStock(Object isStock) {
|
||||
this.isStock = isStock;
|
||||
}
|
||||
|
||||
public Object getStockNumber() {
|
||||
return stockNumber;
|
||||
}
|
||||
|
||||
public void setStockNumber(Object stockNumber) {
|
||||
this.stockNumber = stockNumber;
|
||||
}
|
||||
|
||||
public Integer getIsDistribute() {
|
||||
return isDistribute;
|
||||
}
|
||||
|
||||
public void setIsDistribute(Integer isDistribute) {
|
||||
this.isDistribute = isDistribute;
|
||||
}
|
||||
|
||||
public Integer getIsPauseSale() {
|
||||
return isPauseSale;
|
||||
}
|
||||
|
||||
public void setIsPauseSale(Integer isPauseSale) {
|
||||
this.isPauseSale = isPauseSale;
|
||||
}
|
||||
|
||||
public Object getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(Object number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public Integer getWarnLine() {
|
||||
return warnLine;
|
||||
}
|
||||
|
||||
public void setWarnLine(Integer warnLine) {
|
||||
this.warnLine = warnLine;
|
||||
}
|
||||
|
||||
public BigDecimal getSalePrice() {
|
||||
return salePrice;
|
||||
}
|
||||
|
||||
public void setSalePrice(BigDecimal salePrice) {
|
||||
this.salePrice = salePrice;
|
||||
}
|
||||
|
||||
public boolean getIsGrounding() {
|
||||
return isGrounding;
|
||||
}
|
||||
|
||||
public void setIsGrounding(boolean grounding) {
|
||||
isGrounding = grounding;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
switch (type) {
|
||||
case "normal":
|
||||
this.type = "单规格";
|
||||
break;
|
||||
case "sku":
|
||||
this.type = "多规格";
|
||||
break;
|
||||
case "weight":
|
||||
this.type = "称重商品";
|
||||
break;
|
||||
case "currentPrice":
|
||||
this.type = "时价商品";
|
||||
break;
|
||||
case "group":
|
||||
this.type = "套餐商品/团购卷";
|
||||
break;
|
||||
default:
|
||||
this.type = type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" +
|
||||
"\"name\":\"" + name + "\","+
|
||||
"\"unitName\":\"" + unitName +"\","+
|
||||
"\"specSnap\":\"" + specSnap + "\"," +
|
||||
"\"number\":\"" + number + "\"," +
|
||||
"\"stockNumber\":\"" + stockNumber + "\"" +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
package cn.ysk.cashier.vo;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class StockVo {
|
||||
private Integer id;
|
||||
private Integer proId;
|
||||
private String img;
|
||||
private String name;
|
||||
private String unitName;
|
||||
private String type;
|
||||
private String specSnap;
|
||||
private Object isStock;
|
||||
private Object number;
|
||||
private Object stockNumber;
|
||||
|
||||
public StockVo(Integer id,String name,String unitName,String specSnap, Object number,Object stockNumber) {
|
||||
this.id = id;
|
||||
this.unitName = unitName;
|
||||
this.specSnap = specSnap;
|
||||
this.name = name;
|
||||
this.number = number;
|
||||
this.stockNumber = stockNumber;
|
||||
}
|
||||
|
||||
public StockVo(Integer id, Integer proId,String img,String name,String unitName, String type, String specSnap, Object isStock, Object number) {
|
||||
this.id = id;
|
||||
this.proId = proId;
|
||||
this.img = img;
|
||||
this.name = name;
|
||||
this.unitName = unitName;
|
||||
setType(type);
|
||||
this.specSnap = specSnap;
|
||||
this.isStock = isStock;
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
switch (type) {
|
||||
case "normal":
|
||||
this.type = "单规格";
|
||||
break;
|
||||
case "sku":
|
||||
this.type = "多规格";
|
||||
break;
|
||||
case "weight":
|
||||
this.type = "称重商品";
|
||||
break;
|
||||
case "currentPrice":
|
||||
this.type = "时价商品";
|
||||
break;
|
||||
case "group":
|
||||
this.type = "套餐商品/团购卷";
|
||||
break;
|
||||
default:
|
||||
this.type = type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" +
|
||||
"\"name\":\"" + name + "\","+
|
||||
"\"unitName\":\"" + unitName +"\","+
|
||||
"\"specSnap\":\"" + specSnap + "\"," +
|
||||
"\"number\":\"" + number + "\"," +
|
||||
"\"stockNumber\":\"" + stockNumber + "\"" +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue