Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
6f50e1e134
|
|
@ -4,7 +4,6 @@ import cn.ysk.cashier.annotation.Log;
|
|||
import cn.ysk.cashier.cons.domain.ViewConInfoFlow;
|
||||
import cn.ysk.cashier.cons.service.ViewConInfoFlowService;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
|
@ -35,8 +34,8 @@ public class ViewConInfoFlowController {
|
|||
|
||||
@PostMapping("get")
|
||||
@ApiOperation("查询获取耗材流水信息")
|
||||
public ResponseEntity<Object> queryViewConInfoFlow(@RequestBody ViewConInfoFlowQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(viewConInfoFlowService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
public ResponseEntity<Object> queryViewConInfoFlow(@RequestBody ViewConInfoFlowQueryCriteria criteria){
|
||||
return new ResponseEntity<>(viewConInfoFlowService.queryAllPage(criteria),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package cn.ysk.cashier.cons.service;
|
|||
import cn.ysk.cashier.cons.domain.ViewConInfoFlow;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowDto;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
|
|
@ -18,10 +17,9 @@ public interface ViewConInfoFlowService {
|
|||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(ViewConInfoFlowQueryCriteria criteria, Pageable pageable);
|
||||
Map<String,Object> queryAllPage(ViewConInfoFlowQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
|
|
|
|||
|
|
@ -32,4 +32,8 @@ public class ViewConInfoFlowQueryCriteria {
|
|||
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Date> createTime;
|
||||
|
||||
private Integer page;
|
||||
private Integer size;
|
||||
private String sort;
|
||||
}
|
||||
|
|
@ -1,48 +1,36 @@
|
|||
package cn.ysk.cashier.cons.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.ysk.cashier.cons.domain.TbConsInfo;
|
||||
import cn.ysk.cashier.cons.domain.TbConsInfoFlow;
|
||||
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
||||
import cn.ysk.cashier.dto.product.TbProductStockCountQueryCriteria;
|
||||
import cn.ysk.cashier.dto.product.TbProductStockDetailQueryCriteria;
|
||||
import cn.ysk.cashier.dto.product.TbProductStockListDto;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.pojo.product.TbProduct;
|
||||
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopUnit;
|
||||
import cn.ysk.cashier.repository.product.ProductStockCountRepository;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import cn.ysk.cashier.vo.TbProductStockCountVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository;
|
||||
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
||||
import cn.ysk.cashier.cons.service.TbConsInfoFlowService;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConsInfoFlowDto;
|
||||
import cn.ysk.cashier.cons.service.dto.TbConsInfoFlowQueryCriteria;
|
||||
import cn.ysk.cashier.cons.service.mapstruct.TbConsInfoFlowMapper;
|
||||
import cn.ysk.cashier.dto.product.TbProductStockCountQueryCriteria;
|
||||
import cn.ysk.cashier.dto.product.TbProductStockListDto;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.repository.product.ProductStockCountRepository;
|
||||
import cn.ysk.cashier.utils.*;
|
||||
import cn.ysk.cashier.vo.TbProductStockCountVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author admin
|
||||
* @date 2024-06-22
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService {
|
||||
|
|
@ -85,6 +73,7 @@ public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService {
|
|||
//报损lossNumber; frmLoss
|
||||
//入库stockInNumber; stockIn
|
||||
//出库stockOutNumber; stockout
|
||||
@Override
|
||||
public Map<String,Object> queryPage(TbConsInfoFlowQueryCriteria criteria){
|
||||
if(StringUtils.isNotBlank(criteria.getColumn())){
|
||||
switch (criteria.getColumn()){
|
||||
|
|
@ -95,25 +84,25 @@ public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService {
|
|||
criteria.setBizCode(Arrays.asList("checkStockIn", "stockOtherIn"));
|
||||
break;
|
||||
case "refundNumber":
|
||||
criteria.setBizCode(Arrays.asList("cancelCart"));
|
||||
criteria.setBizCode(Collections.singletonList("cancelCart"));
|
||||
break;
|
||||
case "subCountNumber":
|
||||
criteria.setBizCode(Arrays.asList("createCart","stockout","checkStockOut"));
|
||||
break;
|
||||
case "subNumber":
|
||||
criteria.setBizCode(Arrays.asList("checkStockOut"));
|
||||
criteria.setBizCode(Collections.singletonList("checkStockOut"));
|
||||
break;
|
||||
case "saleNumber":
|
||||
criteria.setBizCode(Arrays.asList("createCart"));
|
||||
criteria.setBizCode(Collections.singletonList("createCart"));
|
||||
break;
|
||||
case "lossNumber":
|
||||
criteria.setBizCode(Arrays.asList("frmLoss"));
|
||||
criteria.setBizCode(Collections.singletonList("frmLoss"));
|
||||
break;
|
||||
case "stockInNumber":
|
||||
criteria.setBizCode(Arrays.asList("stockIn"));
|
||||
criteria.setBizCode(Collections.singletonList("stockIn"));
|
||||
break;
|
||||
case "stockOutNumber":
|
||||
criteria.setBizCode(Arrays.asList("stockout"));
|
||||
criteria.setBizCode(Collections.singletonList("stockout"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -151,9 +140,7 @@ public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService {
|
|||
criteria.getCategoryId(),
|
||||
DateUtil.getStrTime(criteria.getStartTime()), DateUtil.getStrTime(criteria.getEndTime()), pageable);
|
||||
if (!stockCountDtos.isEmpty()) {
|
||||
stockCountDtos.getContent().parallelStream().forEach(s->{
|
||||
s.setCountNumber(s.getStockNumber().add(s.getSubCountNumber()));
|
||||
});
|
||||
stockCountDtos.getContent().parallelStream().forEach(s-> s.setCountNumber(s.getStockNumber().add(s.getSubCountNumber())));
|
||||
}
|
||||
return PageUtil.toPage(stockCountDtos);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,12 +34,6 @@ import java.io.IOException;
|
|||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author admin
|
||||
* @date 2024-06-22
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
|
|
@ -75,7 +69,7 @@ public class TbProskuConServiceImpl implements TbProskuConService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbProskuConDto create(List<ProskuInfo> resources) throws BadRequestException,Exception {
|
||||
public TbProskuConDto create(List<ProskuInfo> resources) throws Exception {
|
||||
|
||||
log.info("List<ProskuInfo> resources:{}",JSONUtil.toJSONString(resources));
|
||||
for (ProskuInfo resource : resources) {
|
||||
|
|
@ -211,18 +205,18 @@ public class TbProskuConServiceImpl implements TbProskuConService {
|
|||
}
|
||||
TbProskuCon tbConsInfo1 = new TbProskuCon();
|
||||
|
||||
int count = tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resource.getConInfoId(), resource.getProductSkuId(), resource.getShopId(), resource.getProductId());
|
||||
if (count <= 0) {
|
||||
BeanUtil.copyProperties(resource, tbConsInfo1, CopyOptions.create().setIgnoreNullValue(true));
|
||||
newCons.add(tbConsInfo1);
|
||||
} else {
|
||||
StringBuilder strResult = new StringBuilder(product.getName());
|
||||
if (sku != null) {
|
||||
strResult.append(" 规格" + sku.getSpecSnap());
|
||||
}
|
||||
strResult.append("与耗材 " + tbConsInfo.getConName() + " 的对应关系已存在");
|
||||
throw new BadRequestException(strResult.toString());
|
||||
}
|
||||
// int count = tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resource.getConInfoId(), resource.getProductSkuId(), resource.getShopId(), resource.getProductId());
|
||||
// if (count <= 0) {
|
||||
// BeanUtil.copyProperties(resource, tbConsInfo1, CopyOptions.create().setIgnoreNullValue(true));
|
||||
// newCons.add(tbConsInfo1);
|
||||
// } else {
|
||||
// StringBuilder strResult = new StringBuilder(product.getName());
|
||||
// if (sku != null) {
|
||||
// strResult.append(" 规格" + sku.getSpecSnap());
|
||||
// }
|
||||
// strResult.append("与耗材 " + tbConsInfo.getConName() + " 的对应关系已存在");
|
||||
// throw new BadRequestException(strResult.toString());
|
||||
// }
|
||||
BeanUtil.copyProperties(resource, tbConsInfo1, CopyOptions.create().setIgnoreNullValue(true));
|
||||
newCons.add(tbConsInfo1);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ import cn.ysk.cashier.cons.service.ViewConInfoFlowService;
|
|||
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowDto;
|
||||
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowQueryCriteria;
|
||||
import cn.ysk.cashier.cons.service.mapstruct.ViewConInfoFlowMapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
|
@ -22,12 +25,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author admin
|
||||
* @date 2024-07-17
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ViewConInfoFlowServiceImpl implements ViewConInfoFlowService {
|
||||
|
|
@ -36,7 +33,15 @@ public class ViewConInfoFlowServiceImpl implements ViewConInfoFlowService {
|
|||
private final ViewConInfoFlowMapper viewConInfoFlowMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(ViewConInfoFlowQueryCriteria criteria, Pageable pageable){
|
||||
public Map<String,Object> queryAllPage(ViewConInfoFlowQueryCriteria criteria){
|
||||
Sort sort = Sort.by(Sort.Direction.DESC, "consId");
|
||||
if(StringUtils.isNotBlank(criteria.getSort())){
|
||||
String[] sortParams = criteria.getSort().split(",");
|
||||
String sortField = sortParams[0];
|
||||
Sort.Direction sortDirection = Sort.Direction.fromString(sortParams[1]);
|
||||
sort = Sort.by(sortDirection, sortField);
|
||||
}
|
||||
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort);
|
||||
Page<ViewConInfoFlow> page = viewConInfoFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(viewConInfoFlowMapper::toDto));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ public class TbProductController {
|
|||
|
||||
@PostMapping("/list/v2")
|
||||
@ApiOperation("查询商品列表 新")
|
||||
public ResponseEntity<Object> queryTbProductV2(@RequestBody TbProductQueryV2Criteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbProductService.queryAllV2(criteria,pageable),HttpStatus.OK);
|
||||
public ResponseEntity<Object> queryTbProductV2(@RequestBody TbProductQueryV2Criteria criteria){
|
||||
return new ResponseEntity<>(tbProductService.queryAllV2(criteria),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
|
|
|
|||
|
|
@ -67,9 +67,9 @@ public class TbProductQueryV2Criteria {
|
|||
@Query(type = BETWEEN)
|
||||
private List<Long> createdAt;
|
||||
|
||||
// private Integer page;
|
||||
//
|
||||
// private Integer size;
|
||||
private Integer page;
|
||||
private Integer size;
|
||||
private String sort;
|
||||
|
||||
public void setType(String type) {
|
||||
if(StringUtils.isNotBlank(type)){
|
||||
|
|
|
|||
|
|
@ -241,7 +241,12 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAllV2(TbProductQueryV2Criteria criteria,Pageable pageable) {
|
||||
public Map<String, Object> queryAllV2(TbProductQueryV2Criteria criteria) {
|
||||
String[] sortParams = criteria.getSort().split(",");
|
||||
String sortField = sortParams[0];
|
||||
Sort.Direction sortDirection = Sort.Direction.fromString(sortParams[1]);
|
||||
Sort sort = Sort.by(sortDirection, sortField);
|
||||
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort);
|
||||
//查询商品数据
|
||||
Page<TbProduct> page = tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
Integer warnLine = 0;
|
||||
|
|
|
|||
|
|
@ -176,6 +176,7 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
|||
stockDetail.setUnitName(tbShopUnit==null?"":tbShopUnit.getName());
|
||||
stockDetail.setCreatedAt(System.currentTimeMillis());
|
||||
stockDetail.setUpdatedAt(System.currentTimeMillis());
|
||||
stockDetail.setOperator(SecurityUtils.getCurrentUsername());
|
||||
tbProductStockDetailRepository.save(stockDetail);
|
||||
product.setStockNumber(product.getStockNumber()-stockDetail.getStockNumber().intValue());
|
||||
tbProductRepository.save(product);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public interface TbProductService {
|
|||
Map<String, Object> queryAll(TbProductQueryCriteria criteria, boolean isAdmin);
|
||||
|
||||
|
||||
Map<String, Object> queryAllV2(TbProductQueryV2Criteria criteria, Pageable pageable);
|
||||
Map<String, Object> queryAllV2(TbProductQueryV2Criteria criteria);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue