Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -4,4 +4,5 @@
|
|||||||
*/target/*
|
*/target/*
|
||||||
*/*.iml
|
*/*.iml
|
||||||
/.gradle/
|
/.gradle/
|
||||||
/application.pid
|
/application.pid
|
||||||
|
*.log
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package cn.ysk.cashier.cons.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.security.core.parameters.P;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SuppFlow implements Serializable {
|
||||||
|
|
||||||
|
private BigDecimal accountsPayable;
|
||||||
|
|
||||||
|
private BigDecimal actualPayment;
|
||||||
|
|
||||||
|
private Date paymentTime;
|
||||||
|
|
||||||
|
private Integer supplierId;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private Integer shopId;
|
||||||
|
|
||||||
|
private List<ConInfos> list;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class ConInfos{
|
||||||
|
private Integer conInfold;
|
||||||
|
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
private BigDecimal stockNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package cn.ysk.cashier.cons.rest;
|
package cn.ysk.cashier.cons.rest;
|
||||||
|
|
||||||
import cn.ysk.cashier.annotation.Log;
|
import cn.ysk.cashier.annotation.Log;
|
||||||
|
import cn.ysk.cashier.cons.domain.SuppFlow;
|
||||||
import cn.ysk.cashier.cons.domain.TbConsInfo;
|
import cn.ysk.cashier.cons.domain.TbConsInfo;
|
||||||
import cn.ysk.cashier.cons.domain.TbConsSuppFlow;
|
import cn.ysk.cashier.cons.domain.TbConsSuppFlow;
|
||||||
import cn.ysk.cashier.cons.service.TbConsInfoService;
|
import cn.ysk.cashier.cons.service.TbConsInfoService;
|
||||||
@@ -68,7 +69,7 @@ public class TbConsInfoController {
|
|||||||
@PostMapping(value = "stockInOut")
|
@PostMapping(value = "stockInOut")
|
||||||
@Log("耗材出入库")
|
@Log("耗材出入库")
|
||||||
@ApiOperation("耗材出入库")
|
@ApiOperation("耗材出入库")
|
||||||
public ResponseEntity<Object> stockInOut(@Validated @RequestBody List<TbConsSuppFlow> resources) throws Exception {
|
public ResponseEntity<Object> stockInOut(@Validated @RequestBody SuppFlow resources) throws Exception {
|
||||||
tbConsInfoService.stockInOut(resources);
|
tbConsInfoService.stockInOut(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.ysk.cashier.cons.service;
|
package cn.ysk.cashier.cons.service;
|
||||||
|
|
||||||
|
import cn.ysk.cashier.cons.domain.SuppFlow;
|
||||||
import cn.ysk.cashier.cons.domain.TbConsInfo;
|
import cn.ysk.cashier.cons.domain.TbConsInfo;
|
||||||
import cn.ysk.cashier.cons.domain.TbConsSuppFlow;
|
import cn.ysk.cashier.cons.domain.TbConsSuppFlow;
|
||||||
import cn.ysk.cashier.cons.service.dto.TbConsInfoDto;
|
import cn.ysk.cashier.cons.service.dto.TbConsInfoDto;
|
||||||
@@ -66,5 +67,5 @@ public interface TbConsInfoService {
|
|||||||
void download(List<TbConsInfoDto> all, HttpServletResponse response) throws IOException;
|
void download(List<TbConsInfoDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
|
||||||
void stockInOut(List<TbConsSuppFlow> resources) throws Exception;
|
void stockInOut(SuppFlow resources) throws Exception;
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
package cn.ysk.cashier.cons.service.impl;
|
package cn.ysk.cashier.cons.service.impl;
|
||||||
|
|
||||||
import cn.ysk.cashier.cons.domain.TbConsInfo;
|
import cn.ysk.cashier.cons.domain.*;
|
||||||
import cn.ysk.cashier.cons.domain.TbConsInfoFlow;
|
|
||||||
import cn.ysk.cashier.cons.domain.TbConsSuppFlow;
|
|
||||||
import cn.ysk.cashier.cons.domain.TbConsType;
|
|
||||||
import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository;
|
import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository;
|
||||||
|
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
||||||
import cn.ysk.cashier.cons.repository.TbConsSuppFlowRepository;
|
import cn.ysk.cashier.cons.repository.TbConsSuppFlowRepository;
|
||||||
import cn.ysk.cashier.cons.repository.TbConsTypeRepository;
|
import cn.ysk.cashier.cons.repository.TbConsTypeRepository;
|
||||||
import cn.ysk.cashier.cons.service.mapstruct.TbConsSuppFlowMapper;
|
import cn.ysk.cashier.cons.service.TbConsInfoService;
|
||||||
|
import cn.ysk.cashier.cons.service.dto.TbConsInfoDto;
|
||||||
|
import cn.ysk.cashier.cons.service.dto.TbConsInfoQueryCriteria;
|
||||||
|
import cn.ysk.cashier.cons.service.mapstruct.TbConsInfoMapper;
|
||||||
import cn.ysk.cashier.pojo.product.TbProductStockOperate;
|
import cn.ysk.cashier.pojo.product.TbProductStockOperate;
|
||||||
import cn.ysk.cashier.pojo.shop.TbShopInfo;
|
import cn.ysk.cashier.pojo.shop.TbShopInfo;
|
||||||
import cn.ysk.cashier.pojo.shop.TbShopPurveyor;
|
import cn.ysk.cashier.pojo.shop.TbShopPurveyor;
|
||||||
@@ -22,43 +23,34 @@ import cn.ysk.cashier.utils.QueryHelp;
|
|||||||
import cn.ysk.cashier.utils.ValidationUtil;
|
import cn.ysk.cashier.utils.ValidationUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
|
||||||
import cn.ysk.cashier.cons.service.TbConsInfoService;
|
|
||||||
import cn.ysk.cashier.cons.service.dto.TbConsInfoDto;
|
|
||||||
import cn.ysk.cashier.cons.service.dto.TbConsInfoQueryCriteria;
|
|
||||||
import cn.ysk.cashier.cons.service.mapstruct.TbConsInfoMapper;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.IOException;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @author admin
|
||||||
* @description 服务实现
|
* @website https://eladmin.vip
|
||||||
* @author admin
|
* @description 服务实现
|
||||||
* @date 2024-06-22
|
* @date 2024-06-22
|
||||||
**/
|
**/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class TbConsInfoServiceImpl implements TbConsInfoService {
|
public class TbConsInfoServiceImpl implements TbConsInfoService {
|
||||||
|
|
||||||
|
public final TbConsTypeRepository tbConsTypeRepository;
|
||||||
|
public final TbConsInfoFlowRepository tbConsInfoFlowRepository;
|
||||||
|
public final TbConsSuppFlowRepository tbConsSuppFlowRepository;
|
||||||
private final TbConsInfoRepository tbConsInfoRepository;
|
private final TbConsInfoRepository tbConsInfoRepository;
|
||||||
private final TbConsInfoMapper tbConsInfoMapper;
|
private final TbConsInfoMapper tbConsInfoMapper;
|
||||||
|
|
||||||
public final TbConsTypeRepository tbConsTypeRepository;
|
|
||||||
|
|
||||||
public final TbConsInfoFlowRepository tbConsInfoFlowRepository;
|
|
||||||
|
|
||||||
public final TbConsSuppFlowRepository tbConsSuppFlowRepository;
|
|
||||||
|
|
||||||
private final TbShopPurveyorRepository tbShopPurveyorRepository;
|
private final TbShopPurveyorRepository tbShopPurveyorRepository;
|
||||||
|
|
||||||
private final TbShopInfoRepository tbShopInfoRepository;
|
private final TbShopInfoRepository tbShopInfoRepository;
|
||||||
@@ -71,21 +63,21 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> queryAll(TbConsInfoQueryCriteria criteria, Pageable pageable){
|
public Map<String, Object> queryAll(TbConsInfoQueryCriteria criteria, Pageable pageable) {
|
||||||
Page<TbConsInfo> page = tbConsInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
Page<TbConsInfo> page = tbConsInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||||
return PageUtil.toPage(page.map(tbConsInfoMapper::toDto));
|
return PageUtil.toPage(page.map(tbConsInfoMapper::toDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TbConsInfoDto> queryAll(TbConsInfoQueryCriteria criteria){
|
public List<TbConsInfoDto> queryAll(TbConsInfoQueryCriteria criteria) {
|
||||||
return tbConsInfoMapper.toDto(tbConsInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
return tbConsInfoMapper.toDto(tbConsInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public TbConsInfoDto findById(Integer id) {
|
public TbConsInfoDto findById(Integer id) {
|
||||||
TbConsInfo tbConsInfo = tbConsInfoRepository.findById(id).orElseGet(TbConsInfo::new);
|
TbConsInfo tbConsInfo = tbConsInfoRepository.findById(id).orElseGet(TbConsInfo::new);
|
||||||
ValidationUtil.isNull(tbConsInfo.getId(),"TbConsInfo","id",id);
|
ValidationUtil.isNull(tbConsInfo.getId(), "TbConsInfo", "id", id);
|
||||||
return tbConsInfoMapper.toDto(tbConsInfo);
|
return tbConsInfoMapper.toDto(tbConsInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,15 +86,14 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||||||
public TbConsInfoDto create(TbConsInfo resources) throws Exception {
|
public TbConsInfoDto create(TbConsInfo resources) throws Exception {
|
||||||
|
|
||||||
|
|
||||||
TbConsType tbConsType= tbConsTypeRepository.getById(resources.getConTypeId());
|
TbConsType tbConsType = tbConsTypeRepository.getById(resources.getConTypeId());
|
||||||
if(Objects.isNull(tbConsType)){
|
if (Objects.isNull(tbConsType)) {
|
||||||
throw new Exception("不存在的耗材类型");
|
throw new Exception("不存在的耗材类型");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int count = tbConsInfoRepository.countByConCode(resources.getConCode());
|
||||||
int count= tbConsInfoRepository.countByConCode(resources.getConCode());
|
if (count > 0) {
|
||||||
if(count>0){
|
|
||||||
throw new Exception("耗材代码不允许重复");
|
throw new Exception("耗材代码不允许重复");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +111,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||||||
public void update(TbConsInfo resources) throws Exception {
|
public void update(TbConsInfo resources) throws Exception {
|
||||||
TbConsInfo tbConsInfo = tbConsInfoRepository.findById(resources.getId()).orElseGet(TbConsInfo::new);
|
TbConsInfo tbConsInfo = tbConsInfoRepository.findById(resources.getId()).orElseGet(TbConsInfo::new);
|
||||||
|
|
||||||
if(Objects.isNull(tbConsInfo)){
|
if (Objects.isNull(tbConsInfo)) {
|
||||||
throw new Exception("耗材信息不存在");
|
throw new Exception("耗材信息不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +137,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||||||
public void download(List<TbConsInfoDto> all, HttpServletResponse response) throws IOException {
|
public void download(List<TbConsInfoDto> all, HttpServletResponse response) throws IOException {
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
for (TbConsInfoDto tbConsInfo : all) {
|
for (TbConsInfoDto tbConsInfo : all) {
|
||||||
Map<String,Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("耗材类型id", tbConsInfo.getConTypeId());
|
map.put("耗材类型id", tbConsInfo.getConTypeId());
|
||||||
map.put("耗材类型名称", tbConsInfo.getConTypeName());
|
map.put("耗材类型名称", tbConsInfo.getConTypeName());
|
||||||
map.put("耗材代码", tbConsInfo.getConCode());
|
map.put("耗材代码", tbConsInfo.getConCode());
|
||||||
@@ -155,7 +146,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||||||
map.put("单位值", tbConsInfo.getConUnit());
|
map.put("单位值", tbConsInfo.getConUnit());
|
||||||
map.put("最近一次入库量", tbConsInfo.getLasterInStock());
|
map.put("最近一次入库量", tbConsInfo.getLasterInStock());
|
||||||
map.put("创建时间", tbConsInfo.getCreateTime());
|
map.put("创建时间", tbConsInfo.getCreateTime());
|
||||||
map.put("耗材预警值",tbConsInfo.getConWarning());
|
map.put("耗材预警值", tbConsInfo.getConWarning());
|
||||||
map.put("更新时间", tbConsInfo.getUpdateTime());
|
map.put("更新时间", tbConsInfo.getUpdateTime());
|
||||||
map.put("店铺id", tbConsInfo.getShopId());
|
map.put("店铺id", tbConsInfo.getShopId());
|
||||||
list.add(map);
|
list.add(map);
|
||||||
@@ -165,30 +156,54 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void stockInOut(List<TbConsSuppFlow> resources) throws Exception {
|
public void stockInOut(SuppFlow resources) throws Exception {
|
||||||
if(Objects.isNull(resources)&&resources.size()<=0){
|
if (Objects.isNull(resources)) {
|
||||||
throw new Exception("参数错误");
|
throw new Exception("参数错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TbConsSuppFlow resource : resources) {
|
TbShopInfo tbShopInfo = tbShopInfoRepository.getById(resources.getShopId());
|
||||||
TbConsInfo info= tbConsInfoRepository.getById(resource.getConInfoId());
|
if (Objects.isNull(tbShopInfo)) {
|
||||||
if(Objects.isNull(info)){
|
throw new Exception("店铺信息不存在");
|
||||||
|
}
|
||||||
|
TbShopPurveyor purveyor = tbShopPurveyorRepository.getById(resources.getSupplierId());
|
||||||
|
if (Objects.isNull(purveyor)) {
|
||||||
|
throw new Exception("不存在的供应商");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TbProductStockOperate stockOperate = new TbProductStockOperate();
|
||||||
|
stockOperate.setShopId(tbShopInfo.getId().toString());
|
||||||
|
stockOperate.setStockSnap("");
|
||||||
|
stockOperate.setType(resources.getType());
|
||||||
|
stockOperate.setSubType(-1);
|
||||||
|
Map<String, String> operatorSnapMap = new HashMap<>();
|
||||||
|
operatorSnapMap.put("name", tbShopInfo.getShopName());
|
||||||
|
operatorSnapMap.put("account", tbShopInfo.getAccount());
|
||||||
|
|
||||||
|
stockOperate.setOperatorSnap(JSON.toJSONString(operatorSnapMap));
|
||||||
|
stockOperate.setBatchNumber("");
|
||||||
|
stockOperate.setRemark("");
|
||||||
|
stockOperate.setStockTime(System.currentTimeMillis());
|
||||||
|
stockOperate.setCreatedAt(System.currentTimeMillis());
|
||||||
|
stockOperate.setUpdatedAt(System.currentTimeMillis());
|
||||||
|
stockOperate.setStatus("normal");
|
||||||
|
stockOperate.setPurveyorId(resources.getSupplierId().toString());
|
||||||
|
stockOperate.setPurveyorName(purveyor.getPurveyorName());
|
||||||
|
|
||||||
|
tbProductStockOperateRepository.save(stockOperate);
|
||||||
|
|
||||||
|
|
||||||
|
for (SuppFlow.ConInfos conInfos : resources.getList()) {
|
||||||
|
|
||||||
|
TbConsInfo info = tbConsInfoRepository.getById(conInfos.getConInfold());
|
||||||
|
if (Objects.isNull(info)) {
|
||||||
log.info("耗材信息不存在");
|
log.info("耗材信息不存在");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
TbShopInfo tbShopInfo= tbShopInfoRepository.getById(resource.getShopId());
|
|
||||||
if(Objects.isNull(tbShopInfo)){
|
|
||||||
log.info("店铺信息不存在");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
TbShopPurveyor purveyor= tbShopPurveyorRepository.getById(resource.getSupplierId());
|
|
||||||
if(Objects.isNull(purveyor)){
|
|
||||||
log.info("不存在的供应商");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TbConsInfoFlow flow=new TbConsInfoFlow();
|
TbConsSuppFlow suppFlow = new TbConsSuppFlow();
|
||||||
|
|
||||||
|
TbConsInfoFlow flow = new TbConsInfoFlow();
|
||||||
|
|
||||||
TbShopPurveyorTransact purveyorTransact = new TbShopPurveyorTransact();
|
TbShopPurveyorTransact purveyorTransact = new TbShopPurveyorTransact();
|
||||||
purveyorTransact.setShopId(tbShopInfo.getId().toString());
|
purveyorTransact.setShopId(tbShopInfo.getId().toString());
|
||||||
@@ -198,96 +213,80 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||||||
purveyorTransact.setCreatedAt(System.currentTimeMillis());
|
purveyorTransact.setCreatedAt(System.currentTimeMillis());
|
||||||
purveyorTransact.setUpdatedAt(System.currentTimeMillis());
|
purveyorTransact.setUpdatedAt(System.currentTimeMillis());
|
||||||
|
|
||||||
|
suppFlow.setConInfoId(info.getConTypeId());
|
||||||
|
suppFlow.setShopId(resources.getShopId());
|
||||||
|
suppFlow.setSupplierId(resources.getSupplierId());
|
||||||
|
suppFlow.setType(resources.getType());
|
||||||
|
suppFlow.setStockNumber(conInfos.getStockNumber());
|
||||||
|
|
||||||
|
|
||||||
|
if ("in".equals(resources.getType())) {
|
||||||
|
info.setStockNumber(info.getStockNumber().add(conInfos.getStockNumber()));
|
||||||
|
info.setLasterInStock(conInfos.getStockNumber());
|
||||||
|
|
||||||
|
suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).add(conInfos.getStockNumber()));
|
||||||
|
|
||||||
|
|
||||||
TbProductStockOperate stockOperate = new TbProductStockOperate();
|
|
||||||
stockOperate.setShopId(tbShopInfo.getId().toString());
|
|
||||||
stockOperate.setStockSnap("");
|
|
||||||
stockOperate.setType(resource.getType());
|
|
||||||
stockOperate.setSubType(-1);
|
|
||||||
Map<String, String> operatorSnapMap = new HashMap<>();
|
|
||||||
operatorSnapMap.put("name", tbShopInfo.getShopName());
|
|
||||||
operatorSnapMap.put("account", tbShopInfo.getAccount());
|
|
||||||
|
|
||||||
stockOperate.setOperatorSnap(JSON.toJSONString(operatorSnapMap));
|
|
||||||
stockOperate.setBatchNumber("");
|
|
||||||
stockOperate.setRemark("");
|
|
||||||
stockOperate.setStockTime(System.currentTimeMillis());
|
|
||||||
stockOperate.setCreatedAt(System.currentTimeMillis());
|
|
||||||
stockOperate.setUpdatedAt(System.currentTimeMillis());
|
|
||||||
stockOperate.setStatus("normal");
|
|
||||||
stockOperate.setPurveyorId(resource.getSupplierId().toString());
|
|
||||||
stockOperate.setPurveyorName(purveyor.getPurveyorName());
|
|
||||||
|
|
||||||
tbProductStockOperateRepository.save(stockOperate);
|
|
||||||
|
|
||||||
if("in".equals(resource.getType())){
|
|
||||||
info.setStockNumber(info.getStockNumber().add(resource.getStockNumber()));
|
|
||||||
info.setLasterInStock(resource.getStockNumber());
|
|
||||||
resource.setType("in");
|
|
||||||
|
|
||||||
flow.setBizCode("stockIn");
|
flow.setBizCode("stockIn");
|
||||||
flow.setBizName("耗材入库");
|
flow.setBizName("耗材入库");
|
||||||
flow.setBizType("+");
|
flow.setBizType("+");
|
||||||
|
|
||||||
purveyorTransact.setTotalAmount(resource.getAccountsPayable());
|
purveyorTransact.setTotalAmount(resources.getAccountsPayable());
|
||||||
purveyorTransact.setPaidAmount(resource.getActualPayment());
|
purveyorTransact.setPaidAmount(resources.getActualPayment());
|
||||||
purveyorTransact.setWaitAmount((resource.getAccountsPayable().subtract(resource.getActualPayment())));
|
purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment())));
|
||||||
purveyorTransact.setType("cons_in");
|
purveyorTransact.setType("cons_in");
|
||||||
}else {
|
} else {
|
||||||
|
|
||||||
|
info.setStockNumber(info.getStockNumber().subtract(conInfos.getStockNumber()));
|
||||||
|
suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).subtract(conInfos.getStockNumber()));
|
||||||
|
|
||||||
info.setStockNumber(info.getStockNumber().subtract(resource.getStockNumber()));
|
|
||||||
resource.setType("out");
|
|
||||||
|
|
||||||
flow.setBizCode("stockout");
|
flow.setBizCode("stockout");
|
||||||
flow.setBizName("耗材出库");
|
flow.setBizName("耗材出库");
|
||||||
flow.setBizType("-");
|
flow.setBizType("-");
|
||||||
|
|
||||||
|
|
||||||
purveyorTransact.setTotalAmount(resource.getAccountsPayable().negate());
|
purveyorTransact.setTotalAmount(resources.getAccountsPayable().negate());
|
||||||
purveyorTransact.setPaidAmount(resource.getActualPayment());
|
purveyorTransact.setPaidAmount(resources.getActualPayment());
|
||||||
purveyorTransact.setWaitAmount((resource.getAccountsPayable().subtract(resource.getActualPayment())).negate());
|
purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment())).negate());
|
||||||
purveyorTransact.setType("cons_out");
|
purveyorTransact.setType("cons_out");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suppFlow.setPrice(conInfos.getPrice());
|
||||||
|
suppFlow.setAmount(conInfos.getStockNumber());
|
||||||
|
suppFlow.setAccountsPayable(resources.getAccountsPayable());
|
||||||
|
suppFlow.setActualPayment(resources.getActualPayment());
|
||||||
|
suppFlow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||||
|
|
||||||
if (resource.getAccountsPayable().compareTo(resource.getActualPayment()) <= 0) {
|
|
||||||
|
if (resources.getAccountsPayable().compareTo(resources.getActualPayment()) <= 0) {
|
||||||
purveyorTransact.setStatus(1);
|
purveyorTransact.setStatus(1);
|
||||||
} else {
|
} else {
|
||||||
purveyorTransact.setStatus(0);
|
purveyorTransact.setStatus(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
purveyorTransact.setPaidAt(System.currentTimeMillis());
|
purveyorTransact.setPaidAt(System.currentTimeMillis());
|
||||||
|
|
||||||
purveyorTransactRepository.save(purveyorTransact);
|
purveyorTransactRepository.save(purveyorTransact);
|
||||||
if (resource.getSupplierId() != null) {
|
if (resources.getSupplierId() != null) {
|
||||||
tbShopPurveyorRepository.upLastTransactAt(resource.getSupplierId().toString());
|
tbShopPurveyorRepository.upLastTransactAt(resources.getSupplierId().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tbConsInfoRepository.save(info);
|
tbConsInfoRepository.save(info);
|
||||||
|
tbConsSuppFlowRepository.save(suppFlow);
|
||||||
|
|
||||||
resource.setAmount(resource.getStockNumber());
|
|
||||||
resource.setBalance(info.getStockNumber());
|
|
||||||
resource.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
|
||||||
tbConsSuppFlowRepository.save(resource);
|
|
||||||
|
|
||||||
|
|
||||||
flow.setConsId(info.getId());
|
flow.setConsId(info.getId());
|
||||||
flow.setShopId(info.getShopId());
|
flow.setShopId(info.getShopId());
|
||||||
flow.setConName(info.getConName());
|
flow.setConName(info.getConName());
|
||||||
flow.setAmount(resource.getStockNumber());
|
flow.setAmount(conInfos.getStockNumber());
|
||||||
flow.setBalance(info.getStockNumber());
|
flow.setBalance(info.getStockNumber());
|
||||||
|
|
||||||
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||||
tbConsInfoFlowRepository.save(flow);
|
tbConsInfoFlowRepository.save(flow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -332,13 +332,13 @@ public class TbProductServiceImpl implements TbProductService {
|
|||||||
if (resources.getCategoryId() == null) {
|
if (resources.getCategoryId() == null) {
|
||||||
throw new BadRequestException("必填内容未填写");
|
throw new BadRequestException("必填内容未填写");
|
||||||
}
|
}
|
||||||
if (resources.getIsShowMall() == 1) {
|
// if (resources.getIsShowMall() == 1) {
|
||||||
for (TbProductSku sku : resources.getSkuList()) {
|
// for (TbProductSku sku : resources.getSkuList()) {
|
||||||
if (sku.getStockNumber() <= 0) {
|
// if (sku.getStockNumber() <= 0) {
|
||||||
throw new BadRequestException("上架区域包括小程序时,库存数量必须大于0。");
|
// throw new BadRequestException("上架区域包括小程序时,库存数量必须大于0。");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
product.setCategoryId(String.valueOf(resources.getCategoryId()));
|
product.setCategoryId(String.valueOf(resources.getCategoryId()));
|
||||||
}
|
}
|
||||||
if (!CollectionUtils.isEmpty(resources.getImages())) {
|
if (!CollectionUtils.isEmpty(resources.getImages())) {
|
||||||
|
|||||||
@@ -112,19 +112,8 @@ public class TbShopPurveyorTransactServiceImpl implements TbShopPurveyorTransact
|
|||||||
ValidationUtil.isNull(tbShopPurveyorTransact.getId(), "TbShopPurveyorTransact", "id", resources.getId());
|
ValidationUtil.isNull(tbShopPurveyorTransact.getId(), "TbShopPurveyorTransact", "id", resources.getId());
|
||||||
tbShopPurveyorTransact.setPaidAmount(tbShopPurveyorTransact.getPaidAmount().add(resources.getPaidAmount()));
|
tbShopPurveyorTransact.setPaidAmount(tbShopPurveyorTransact.getPaidAmount().add(resources.getPaidAmount()));
|
||||||
tbShopPurveyorTransact.setWaitAmount(tbShopPurveyorTransact.getTotalAmount().subtract(tbShopPurveyorTransact.getPaidAmount()));
|
tbShopPurveyorTransact.setWaitAmount(tbShopPurveyorTransact.getTotalAmount().subtract(tbShopPurveyorTransact.getPaidAmount()));
|
||||||
// if (resources.getPaidAmount().compareTo(BigDecimal.ZERO) == 0) {
|
|
||||||
// throw new BadRequestException("付款金额不能为 0");
|
|
||||||
// } else {
|
|
||||||
// if (tbShopPurveyorTransact.getWaitAmount().compareTo(BigDecimal.ZERO) > 0 && resources.getPaidAmount().compareTo(BigDecimal.ZERO) > 0) {//待付款金额大于0
|
|
||||||
// tbShopPurveyorTransact.setWaitAmount(tbShopPurveyorTransact.getWaitAmount().subtract(resources.getPaidAmount()));
|
|
||||||
// } else if (tbShopPurveyorTransact.getWaitAmount().compareTo(BigDecimal.ZERO) < 0 && resources.getPaidAmount().compareTo(BigDecimal.ZERO) < 0) {
|
|
||||||
// tbShopPurveyorTransact.setWaitAmount(tbShopPurveyorTransact.getWaitAmount().subtract(resources.getPaidAmount()));
|
|
||||||
// } else {
|
|
||||||
// tbShopPurveyorTransact.setWaitAmount(tbShopPurveyorTransact.getWaitAmount().add(resources.getPaidAmount()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
tbShopPurveyorTransact.setPaidAt(System.currentTimeMillis());
|
tbShopPurveyorTransact.setPaidAt(System.currentTimeMillis());
|
||||||
if (tbShopPurveyorTransact.getWaitAmount().compareTo(tbShopPurveyorTransact.getPaidAmount()) <= 0) {
|
if (tbShopPurveyorTransact.getPaidAmount().compareTo(tbShopPurveyorTransact.getTotalAmount()) >= 0) {
|
||||||
tbShopPurveyorTransact.setStatus(1);
|
tbShopPurveyorTransact.setStatus(1);
|
||||||
}else {
|
}else {
|
||||||
tbShopPurveyorTransact.setStatus(0);
|
tbShopPurveyorTransact.setStatus(0);
|
||||||
|
|||||||
@@ -38,8 +38,8 @@
|
|||||||
<logger name="jdbc.sqlonly" level="ERROR" additivity="false">
|
<logger name="jdbc.sqlonly" level="ERROR" additivity="false">
|
||||||
<appender-ref ref="console" />
|
<appender-ref ref="console" />
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="org.hibernate.SQL" level="DEBUG" >
|
<logger name="org.hibernate.SQL" level="debug">
|
||||||
<!-- <appender-ref ref="console" />-->
|
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<logger name="jdbc.resultset" level="ERROR" additivity="false">
|
<logger name="jdbc.resultset" level="ERROR" additivity="false">
|
||||||
|
|||||||
Reference in New Issue
Block a user