2024年6月13日 修复问题
This commit is contained in:
parent
1fb4bdeb4f
commit
fbaf417de9
|
@ -48,43 +48,10 @@ public class BlArtificerSelfGoodsEntryExitRecordsController {
|
|||
return Result.success().put("data",pageList);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/add")
|
||||
@ApiOperation("新增")
|
||||
public Result add(@RequestBody BlArtificerSelfGoodsEntryExitRecords entity){
|
||||
entity.setCreateTime(DateUtil.now());
|
||||
entity.setUpdateTime(DateUtil.now());
|
||||
return Result.success().put("data",service.save(entity));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/update")
|
||||
@ApiOperation("修改")
|
||||
public Result update(@RequestBody BlArtificerSelfGoodsEntryExitRecords entity){
|
||||
entity.setUpdateTime(DateUtil.now());
|
||||
return Result.success().put("data",service.updateById(entity));
|
||||
}
|
||||
|
||||
@RequestMapping("/info/{id}")
|
||||
public Result info(@PathVariable("id") Long id){
|
||||
BlArtificerSelfGoodsEntryExitRecords data = service.getById(id);
|
||||
return Result.success().put("data", data);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/deleteById")
|
||||
@ApiOperation("删除")
|
||||
public Result deleteById(Long id){
|
||||
service.removeById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/deleteByIds")
|
||||
@ApiOperation("批量删除")
|
||||
public Result deleteByIds(String id){
|
||||
if(StringUtils.isNotBlank(id)){
|
||||
String[] ids = StringUtils.split(id,",");
|
||||
service.removeByIds(Arrays.asList(ids));
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -61,17 +61,17 @@ public class BlArtificerSelfGoodsEntryExitRecords implements Serializable {
|
|||
/**
|
||||
* 变更后库存量
|
||||
*/
|
||||
private Integer num;
|
||||
private Integer afterTheChangeNum;
|
||||
|
||||
/**
|
||||
* 变更前库存量
|
||||
*/
|
||||
private Integer lastTimeNum;
|
||||
private Integer beforeTheChangeNum;
|
||||
|
||||
/**
|
||||
* 本次变更量
|
||||
*/
|
||||
private Integer lastTimeChangeNum;
|
||||
private Integer changeNum;
|
||||
|
||||
/**
|
||||
* 操作类型(1:入库,2:出库,3:修改库)
|
||||
|
|
|
@ -8,12 +8,12 @@ import java.math.BigDecimal;
|
|||
|
||||
public interface BlArtificerSelfGoodsEntryExitRecordsService extends IService<BlArtificerSelfGoodsEntryExitRecords> {
|
||||
|
||||
boolean addLog(BlArtificerSelfGoods e,Integer operationType, String createAt, Integer changeEndNum, Integer allNum, Integer num, BigDecimal purchasePrice, String userId, String remark);
|
||||
boolean addLog(BlArtificerSelfGoods e,Integer operationType, String createAt, Integer afterTheChangeNum, Integer beforeTheChangeNum, Integer changeNum, BigDecimal purchasePrice, String userId, String remark);
|
||||
|
||||
boolean addInLog(BlArtificerSelfGoods e, String createAt, Integer changeEndNum, Integer allNum, Integer num, BigDecimal purchasePrice);
|
||||
boolean addInLog(BlArtificerSelfGoods e, String createAt, Integer afterTheChangeNum, Integer beforeTheChangeNum, Integer changeNum, BigDecimal purchasePrice);
|
||||
|
||||
boolean addOutLog(BlArtificerSelfGoods e, String createAt, Integer changeEndNum, Integer allNum, Integer num, String userId);
|
||||
boolean addOutLog(BlArtificerSelfGoods e, String createAt, Integer afterTheChangeNum, Integer beforeTheChangeNum, Integer changeNum, String userId);
|
||||
|
||||
boolean editLog(BlArtificerSelfGoods e, String createAt, Integer changeEndNum, Integer allNum, Integer num, String remark);
|
||||
boolean editLog(BlArtificerSelfGoods e, String createAt, Integer afterTheChangeNum, Integer beforeTheChangeNum, Integer changeNum, String remark);
|
||||
|
||||
}
|
||||
|
|
|
@ -31,54 +31,78 @@ public interface BlArtificerSelfGoodsService extends IService<BlArtificerSelfGoo
|
|||
*/
|
||||
BlArtificerSelfGoods findArtificerSelfGoodsByArtificerIdAndGoodsId(String artificerId, String goodsId);
|
||||
|
||||
/**
|
||||
* 新增或入库
|
||||
* @param artificerSelfGoods
|
||||
* @return
|
||||
*/
|
||||
boolean addOrInWarehouse(BlArtificerSelfGoods artificerSelfGoods);
|
||||
|
||||
/**
|
||||
* 批量新增或入库
|
||||
* @param artificerSelfGoodsList
|
||||
* @return
|
||||
*/
|
||||
boolean addOrInWarehouse(List<BlArtificerSelfGoods> artificerSelfGoodsList);
|
||||
|
||||
/**
|
||||
* 新增库
|
||||
* @param artificerSelfGoods
|
||||
* @return
|
||||
*/
|
||||
boolean addWarehouse(BlArtificerSelfGoods artificerSelfGoods);
|
||||
|
||||
/**
|
||||
* 批量新增库
|
||||
* @param artificerSelfGoodsList
|
||||
* @return
|
||||
*/
|
||||
boolean addWarehouse(List<BlArtificerSelfGoods> artificerSelfGoodsList);
|
||||
|
||||
/**
|
||||
* 入库
|
||||
* @param artificerSelfGoodsId
|
||||
* @param num
|
||||
* @param changeNum
|
||||
* @return
|
||||
*/
|
||||
boolean inWarehouse(Long artificerSelfGoodsId, BigDecimal purchasePrice, int num);
|
||||
boolean inWarehouse(Long artificerSelfGoodsId, BigDecimal purchasePrice, int changeNum);
|
||||
|
||||
/**
|
||||
* 批量入库
|
||||
* @param artificerSelfGoods
|
||||
* @param artificerSelfGoodsList
|
||||
* @return
|
||||
*/
|
||||
boolean inWarehouse(List<BlArtificerSelfGoods> artificerSelfGoods);
|
||||
boolean inWarehouse(List<BlArtificerSelfGoods> artificerSelfGoodsList);
|
||||
|
||||
/**
|
||||
* 出库
|
||||
* @param artificerSelfGoodsId
|
||||
* @param num
|
||||
* @param changeNum
|
||||
* @return
|
||||
*/
|
||||
boolean outWarehouse(Long artificerSelfGoodsId, int num, String userId);
|
||||
boolean outWarehouse(Long artificerSelfGoodsId, int changeNum, String userId);
|
||||
|
||||
/**
|
||||
* 批量出库
|
||||
* @param artificerSelfGoods
|
||||
* @param artificerSelfGoodsList
|
||||
* @return
|
||||
*/
|
||||
boolean outWarehouse(List<BlArtificerSelfGoods> artificerSelfGoods);
|
||||
boolean outWarehouse(List<BlArtificerSelfGoods> artificerSelfGoodsList);
|
||||
|
||||
/**
|
||||
* 修改库
|
||||
* @param artificerSelfGoodsId
|
||||
* @param num
|
||||
* @param changeNum
|
||||
* @return
|
||||
*/
|
||||
boolean editWarehouse(Long artificerSelfGoodsId, int num, String remark);
|
||||
boolean editWarehouse(Long artificerSelfGoodsId, int changeNum, String remark);
|
||||
|
||||
/**
|
||||
* 批量修改库
|
||||
* @param artificerSelfGoods
|
||||
* @param artificerSelfGoodsList
|
||||
* @return
|
||||
*/
|
||||
boolean editWarehouse(List<BlArtificerSelfGoods> artificerSelfGoods);
|
||||
boolean editWarehouse(List<BlArtificerSelfGoods> artificerSelfGoodsList);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import java.math.BigDecimal;
|
|||
public class BlArtificerSelfGoodsEntryExitRecordsServiceImpl extends ServiceImpl<BlArtificerSelfGoodsEntryExitRecordsDao, BlArtificerSelfGoodsEntryExitRecords> implements BlArtificerSelfGoodsEntryExitRecordsService {
|
||||
|
||||
@Override
|
||||
public boolean addLog(BlArtificerSelfGoods e,Integer operationType, String createAt, Integer changeEndNum, Integer allNum, Integer num, BigDecimal purchasePrice, String userId, String remark) {
|
||||
public boolean addLog(BlArtificerSelfGoods e,Integer operationType, String createAt, Integer afterTheChangeNum, Integer beforeTheChangeNum, Integer changeNum, BigDecimal purchasePrice, String userId, String remark) {
|
||||
BlArtificerSelfGoodsEntryExitRecords log = new BlArtificerSelfGoodsEntryExitRecords();
|
||||
log.setCreateTime(DateUtil.now());
|
||||
log.setCreateAt(createAt);
|
||||
|
@ -27,9 +27,9 @@ public class BlArtificerSelfGoodsEntryExitRecordsServiceImpl extends ServiceImpl
|
|||
log.setSelfGoodsTypeId(e.getSelfGoodsTypeId());
|
||||
log.setSelfGoodsTypeParentId(e.getSelfGoodsTypeParentId());
|
||||
log.setArtificerId(e.getArtificerId());
|
||||
log.setNum(changeEndNum);
|
||||
log.setLastTimeNum(allNum);
|
||||
log.setLastTimeChangeNum(num);
|
||||
log.setAfterTheChangeNum(afterTheChangeNum);
|
||||
log.setBeforeTheChangeNum(beforeTheChangeNum);
|
||||
log.setChangeNum(changeNum);
|
||||
log.setOperationType(operationType);
|
||||
log.setPurchasePrice(purchasePrice);
|
||||
log.setUserId(userId);
|
||||
|
@ -40,20 +40,20 @@ public class BlArtificerSelfGoodsEntryExitRecordsServiceImpl extends ServiceImpl
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean addInLog(BlArtificerSelfGoods e, String createAt, Integer changeEndNum, Integer allNum, Integer num, BigDecimal purchasePrice) {
|
||||
addLog(e, ArtificerSelfGoodsEnum.OperationType.IN.getValue(), createAt, changeEndNum, allNum, num, purchasePrice, null, null);
|
||||
public boolean addInLog(BlArtificerSelfGoods e, String createAt, Integer afterTheChangeNum, Integer beforeTheChangeNum, Integer changeNum, BigDecimal purchasePrice) {
|
||||
addLog(e, ArtificerSelfGoodsEnum.OperationType.IN.getValue(), createAt, afterTheChangeNum, beforeTheChangeNum, changeNum, purchasePrice, null, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addOutLog(BlArtificerSelfGoods e, String createAt, Integer changeEndNum, Integer allNum, Integer num, String userId) {
|
||||
addLog(e, ArtificerSelfGoodsEnum.OperationType.OUT.getValue(), createAt, changeEndNum, allNum, num, null, userId, null);
|
||||
public boolean addOutLog(BlArtificerSelfGoods e, String createAt, Integer afterTheChangeNum, Integer beforeTheChangeNum, Integer changeNum, String userId) {
|
||||
addLog(e, ArtificerSelfGoodsEnum.OperationType.OUT.getValue(), createAt, afterTheChangeNum, beforeTheChangeNum, changeNum, null, userId, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean editLog(BlArtificerSelfGoods e, String createAt, Integer changeEndNum, Integer allNum, Integer num, String remark) {
|
||||
addLog(e, ArtificerSelfGoodsEnum.OperationType.EDIT.getValue(), createAt, changeEndNum, allNum, num, null, null, remark);
|
||||
public boolean editLog(BlArtificerSelfGoods e, String createAt, Integer afterTheChangeNum, Integer beforeTheChangeNum, Integer changeNum, String remark) {
|
||||
addLog(e, ArtificerSelfGoodsEnum.OperationType.EDIT.getValue(), createAt, afterTheChangeNum, beforeTheChangeNum, changeNum, null, null, remark);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package com.sqx.modules.artificerselfgoods.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.modules.artificerselfgoods.dao.BlArtificerSelfGoodsDao;
|
||||
import com.sqx.modules.artificerselfgoods.entity.BlArtificerSelfGoods;
|
||||
import com.sqx.modules.artificerselfgoods.entity.BlArtificerSelfGoodsEntryExitRecords;
|
||||
import com.sqx.modules.artificerselfgoods.enums.ArtificerSelfGoodsEnum;
|
||||
import com.sqx.modules.artificerselfgoods.service.BlArtificerSelfGoodsEntryExitRecordsService;
|
||||
import com.sqx.modules.artificerselfgoods.service.BlArtificerSelfGoodsService;
|
||||
import com.sqx.modules.sys.entity.SysUserEntity;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -21,9 +21,17 @@ import java.util.List;
|
|||
@Service
|
||||
public class BlArtificerSelfGoodsServiceImpl extends ServiceImpl<BlArtificerSelfGoodsDao, BlArtificerSelfGoods> implements BlArtificerSelfGoodsService {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private BlArtificerSelfGoodsService artificerSelfGoodsService;
|
||||
|
||||
@Autowired
|
||||
private BlArtificerSelfGoodsEntryExitRecordsService artificerSelfGoodsEntryExitRecordsService;
|
||||
|
||||
private SysUserEntity getUser() {
|
||||
return ((SysUserEntity) SecurityUtils.getSubject().getPrincipal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlArtificerSelfGoods> findArtificerSelfGoodsByArtificerId(String artificerId) {
|
||||
QueryWrapper<BlArtificerSelfGoods> qw = new QueryWrapper<>();
|
||||
|
@ -48,6 +56,23 @@ public class BlArtificerSelfGoodsServiceImpl extends ServiceImpl<BlArtificerSelf
|
|||
return getOne(qw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addOrInWarehouse(BlArtificerSelfGoods artificerSelfGoods) {
|
||||
if(artificerSelfGoods.getId() == null){
|
||||
addWarehouse(artificerSelfGoods);
|
||||
} else {
|
||||
inWarehouse(artificerSelfGoods.getId(),artificerSelfGoods.getPurchasePrice(), artificerSelfGoods.getChangeNum());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addOrInWarehouse(List<BlArtificerSelfGoods> artificerSelfGoodsList) {
|
||||
artificerSelfGoodsList.forEach(this::addOrInWarehouse);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean addWarehouse(BlArtificerSelfGoods artificerSelfGoods) {
|
||||
save(artificerSelfGoods);
|
||||
|
@ -56,70 +81,70 @@ public class BlArtificerSelfGoodsServiceImpl extends ServiceImpl<BlArtificerSelf
|
|||
|
||||
@Override
|
||||
public boolean addWarehouse(List<BlArtificerSelfGoods> artificerSelfGoodsList) {
|
||||
saveBatch(artificerSelfGoodsList);
|
||||
artificerSelfGoodsService.saveBatch(artificerSelfGoodsList);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inWarehouse(Long artificerSelfGoodsId, BigDecimal purchasePrice, int num) {
|
||||
public boolean inWarehouse(Long artificerSelfGoodsId, BigDecimal purchasePrice, int changeNum) {
|
||||
BlArtificerSelfGoods e = getById(artificerSelfGoodsId);
|
||||
if(e == null) return false;
|
||||
Integer allNum = e.getNum();
|
||||
e.setLastTimeChangeNum(num);
|
||||
Integer afterTheChangeNum = e.getNum();
|
||||
e.setLastTimeChangeNum(changeNum);
|
||||
e.setLastTimeNum(e.getNum());
|
||||
Integer changeEndNum = allNum - num;
|
||||
e.setNum(changeEndNum);
|
||||
Integer beforeTheChangeNum = afterTheChangeNum - changeNum;
|
||||
e.setNum(beforeTheChangeNum);
|
||||
updateById(e);
|
||||
//记录日志
|
||||
artificerSelfGoodsEntryExitRecordsService.addInLog(e, null, changeEndNum, allNum, num, purchasePrice);
|
||||
artificerSelfGoodsEntryExitRecordsService.addInLog(e, null, afterTheChangeNum, beforeTheChangeNum, changeNum, purchasePrice);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inWarehouse(List<BlArtificerSelfGoods> artificerSelfGoods) {
|
||||
artificerSelfGoods.forEach(x -> inWarehouse(x.getId(), x.getPurchasePrice(), x.getChangeNum()));
|
||||
public boolean inWarehouse(List<BlArtificerSelfGoods> artificerSelfGoodsList) {
|
||||
artificerSelfGoodsList.forEach(x -> inWarehouse(x.getId(), x.getPurchasePrice(), x.getChangeNum()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean outWarehouse(Long artificerSelfGoodsId, int num, String userId) {
|
||||
public boolean outWarehouse(Long artificerSelfGoodsId, int changeNum, String userId) {
|
||||
BlArtificerSelfGoods e = getById(artificerSelfGoodsId);
|
||||
if(e == null) return false;
|
||||
Integer allNum = e.getNum();
|
||||
e.setLastTimeChangeNum(num);
|
||||
Integer afterTheChangeNum = e.getNum();
|
||||
e.setLastTimeChangeNum(changeNum);
|
||||
e.setLastTimeNum(e.getNum());
|
||||
Integer changeEndNum = allNum - num;
|
||||
e.setNum(changeEndNum);
|
||||
Integer beforeTheChangeNum = afterTheChangeNum - changeNum;
|
||||
e.setNum(beforeTheChangeNum);
|
||||
updateById(e);
|
||||
//记录日志
|
||||
artificerSelfGoodsEntryExitRecordsService.addOutLog(e, null, changeEndNum, allNum, num, userId);
|
||||
artificerSelfGoodsEntryExitRecordsService.addOutLog(e, null, afterTheChangeNum, beforeTheChangeNum, changeNum, userId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean outWarehouse(List<BlArtificerSelfGoods> artificerSelfGoods) {
|
||||
artificerSelfGoods.forEach(x -> outWarehouse(x.getId(), x.getChangeNum(), x.getUserId()));
|
||||
public boolean outWarehouse(List<BlArtificerSelfGoods> artificerSelfGoodsList) {
|
||||
artificerSelfGoodsList.forEach(x -> outWarehouse(x.getId(), x.getChangeNum(), x.getUserId()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean editWarehouse(Long artificerSelfGoodsId, int num, String remark) {
|
||||
public boolean editWarehouse(Long artificerSelfGoodsId, int changeNum, String remark) {
|
||||
BlArtificerSelfGoods e = getById(artificerSelfGoodsId);
|
||||
if(e == null) return false;
|
||||
Integer allNum = e.getNum();
|
||||
e.setLastTimeChangeNum(num);
|
||||
Integer afterTheChangeNum = e.getNum();
|
||||
e.setLastTimeChangeNum(changeNum);
|
||||
e.setLastTimeNum(e.getNum());
|
||||
Integer changeEndNum = allNum - num;
|
||||
e.setNum(changeEndNum);
|
||||
Integer beforeTheChangeNum = afterTheChangeNum - changeNum;
|
||||
e.setNum(beforeTheChangeNum);
|
||||
updateById(e);
|
||||
//记录日志
|
||||
artificerSelfGoodsEntryExitRecordsService.editLog(e, null, changeEndNum, allNum, num, remark);
|
||||
artificerSelfGoodsEntryExitRecordsService.editLog(e, null, afterTheChangeNum, beforeTheChangeNum, changeNum, remark);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean editWarehouse(List<BlArtificerSelfGoods> artificerSelfGoods) {
|
||||
artificerSelfGoods.forEach(x -> editWarehouse(x.getId(), x.getChangeNum(), x.getRemark()));
|
||||
public boolean editWarehouse(List<BlArtificerSelfGoods> artificerSelfGoodsList) {
|
||||
artificerSelfGoodsList.forEach(x -> editWarehouse(x.getId(), x.getChangeNum(), x.getRemark()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue