Commit 6934f120 authored by hubaoshan's avatar hubaoshan

1.4

parent 32dab0d1
...@@ -51,6 +51,7 @@ public class WmsGoodsController extends CyPaginationController<WmsGoods> { ...@@ -51,6 +51,7 @@ public class WmsGoodsController extends CyPaginationController<WmsGoods> {
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoods); wmsGoods);
} }
//@PreAuthorize("@cyPerm.hasPerm('sys:goods:delete')") //@PreAuthorize("@cyPerm.hasPerm('sys:goods:delete')")
@CyOpeLogAnno(title = "system-商品信息表管理-删除商品信息表", businessType = CyLogTypeEnum.DELETE) @CyOpeLogAnno(title = "system-商品信息表管理-删除商品信息表", businessType = CyLogTypeEnum.DELETE)
@ApiOperation(value="逻辑删除商品信息表", notes="逻辑删除商品信息表") @ApiOperation(value="逻辑删除商品信息表", notes="逻辑删除商品信息表")
...@@ -103,7 +104,16 @@ public class WmsGoodsController extends CyPaginationController<WmsGoods> { ...@@ -103,7 +104,16 @@ public class WmsGoodsController extends CyPaginationController<WmsGoods> {
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsServiceImpl.findById(businessId)); wmsGoodsServiceImpl.findById(businessId));
} }
@CyOpeLogAnno(title = "system-商品信息表管理-查询商品信息表", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="查询单一商品信息表", notes="查询单一商品信息表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@GetMapping("/detailGoods/{businessId:\\w+}")
public CyResult detailGoods(@PathVariable int businessId) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsServiceImpl.findByOss(businessId));
}
//@PreAuthorize("@cyPerm.hasPerm('sys:goods:list')") //@PreAuthorize("@cyPerm.hasPerm('sys:goods:list')")
@CyOpeLogAnno(title = "system-商品信息表管理-查询商品信息表", businessType = CyLogTypeEnum.QUERY) @CyOpeLogAnno(title = "system-商品信息表管理-查询商品信息表", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="查询商品信息表集合", notes="查询商品信息表集合") @ApiOperation(value="查询商品信息表集合", notes="查询商品信息表集合")
......
...@@ -6,12 +6,14 @@ import org.rcisoft.core.mapper.CyBaseMapper; ...@@ -6,12 +6,14 @@ import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods; import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.apache.ibatis.annotations.ResultMap; import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.rcisoft.sys.ossInfo.entity.OssInfo;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.rcisoft.core.model.CyPageInfo; import org.rcisoft.core.model.CyPageInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created with cy on 2024年5月29日 下午1:21:49. * Created with cy on 2024年5月29日 下午1:21:49.
...@@ -23,11 +25,19 @@ public interface WmsGoodsRepository extends CyBaseMapper<WmsGoods> { ...@@ -23,11 +25,19 @@ public interface WmsGoodsRepository extends CyBaseMapper<WmsGoods> {
List<WmsGoods> queryWmsGoods(@Param("entity") WmsGoods wmsGoods); List<WmsGoods> queryWmsGoods(@Param("entity") WmsGoods wmsGoods);
/** /**
* 分页查询 wmsGoods * 分页查询 wmsGoods
* */
*/ IPage<WmsGoods> queryWmsGoodssPaged(CyPageInfo cyPageInfo, @Param("entity") WmsGoods wmsGoods);
IPage<WmsGoods> queryWmsGoodssPaged(CyPageInfo cyPageInfo,@Param("entity") WmsGoods wmsGoods);
List<WmsGoods> queryWmsGoodsByAppId(@Param("entity") WmsGoodsApply wmsGoodsLog); List<WmsGoods> queryWmsGoodsByAppId(@Param("entity") WmsGoodsApply wmsGoodsLog);
List<WmsGoods> queryWmsGoodsByAppIdOut(@Param("entity") WmsGoodsApply wmsGoodsLog);
List<WmsGoods> findByIdGoods(@Param("entity") WmsGoods wmsGoods);
int insertOss(@Param("entity") List<Map<String, String>> wmsGoods);
List<OssInfo> findOss(@Param("entity") WmsGoods wmsGoods);
} }
...@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName; ...@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*; import lombok.*;
import org.rcisoft.core.entity.CyIdIncreEntity; import org.rcisoft.core.entity.CyIdIncreEntity;
import org.rcisoft.sys.ossInfo.entity.OssInfo;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.io.Serializable; import java.io.Serializable;
...@@ -103,5 +105,19 @@ public class WmsGoods extends CyIdIncreEntity<WmsGoods> { ...@@ -103,5 +105,19 @@ public class WmsGoods extends CyIdIncreEntity<WmsGoods> {
*/ */
@TableField(exist = false) @TableField(exist = false)
private Integer goodsCounts; private Integer goodsCounts;
@TableField(exist = false)
private List<OssInfo> ossInfoList;
@TableField(exist = false)
private Integer goodsId;
@TableField(exist = false)
private Integer ossId;
/**
* 新增,修改 图片 ids , 分割
*/
@TableField(exist = false)
private String urlIdList;
} }
...@@ -2,12 +2,14 @@ package org.rcisoft.bus.wmsgoods.service; ...@@ -2,12 +2,14 @@ package org.rcisoft.bus.wmsgoods.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods; import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply; import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog; import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog;
import org.rcisoft.core.model.CyPersistModel; import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtilAsp; import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPageInfo; import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.sys.ossInfo.entity.OssInfo;
import java.util.List; import java.util.List;
...@@ -57,7 +59,7 @@ public interface WmsGoodsService { ...@@ -57,7 +59,7 @@ public interface WmsGoodsService {
* @return * @return
*/ */
IPage<WmsGoods> findAllByPagination(CyPageInfo<WmsGoods> paginationUtility, IPage<WmsGoods> findAllByPagination(CyPageInfo<WmsGoods> paginationUtility,
WmsGoods wmsGoods); WmsGoods wmsGoods);
/** /**
...@@ -80,5 +82,10 @@ public interface WmsGoodsService { ...@@ -80,5 +82,10 @@ public interface WmsGoodsService {
* @return * @return
*/ */
List<WmsGoods> findByApplyId(WmsGoodsApply wmsGoodsLog); List<WmsGoods> findByApplyId(WmsGoodsApply wmsGoodsLog);
List<WmsGoods> findByApplyIdOut(WmsGoodsApply wmsGoodsLog);
List<WmsGoods> findByIdGoods(int id);
WmsGoods findByOss (int id);
List<OssInfo> findOss(WmsGoods wmsGoods);
} }
package org.rcisoft.bus.wmsgoods.service.impl; package org.rcisoft.bus.wmsgoods.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply; import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.util.CyUserUtil; import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyPersistModel; import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.bus.wmsgoods.dao.WmsGoodsRepository; import org.rcisoft.bus.wmsgoods.dao.WmsGoodsRepository;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods; import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.bus.wmsgoods.service.WmsGoodsService; import org.rcisoft.bus.wmsgoods.service.WmsGoodsService;
import org.rcisoft.sys.ossInfo.dao.OssInfoMapper;
import org.rcisoft.sys.ossInfo.entity.OssInfo;
import org.rcisoft.sys.ossInfo.service.OssInfoService;
import org.rcisoft.sys.ossInfo.service.impl.OssInfoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo; import org.rcisoft.core.model.CyPageInfo;
import java.util.List; import java.util.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
* Created by cy on 2024年5月29日 下午1:21:49. * Created by cy on 2024年5月29日 下午1:21:49.
*/ */
@Service @Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED) @Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
@Slf4j @Slf4j
public class WmsGoodsServiceImpl extends ServiceImpl<WmsGoodsRepository,WmsGoods> implements WmsGoodsService { public class WmsGoodsServiceImpl extends ServiceImpl<WmsGoodsRepository, WmsGoods> implements WmsGoodsService {
/** /**
* 保存 商品信息表 * 保存 商品信息表
* @param wmsGoods *
* @return * @param wmsGoods
*/ * @return
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT) */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override @Override
public CyPersistModel persist(WmsGoods wmsGoods){ public CyPersistModel persist(WmsGoods wmsGoods) {
WmsGoods existingGoods = baseMapper.selectOne(new QueryWrapper<WmsGoods>().eq("goods_code", wmsGoods.getGoodsCode()));
if (existingGoods != null) {
throw new CyServiceException(1001, "商品已存在");
}
//增加操作 //增加操作
int line = baseMapper.insert(wmsGoods); int line = baseMapper.insert(wmsGoods);
log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+ //插入图片
wmsGoods.getBusinessId()+"的商品信息表信息"); if(StringUtils.isNotBlank(wmsGoods.getUrlIdList())){
List<Map<String, String>> params = new ArrayList<>();
String[] oss_ids = wmsGoods.getUrlIdList().split(",");
Map<String, String> param = null;
for (String id : oss_ids) {
param = new HashMap<>();
param.put("gid", wmsGoods.getBusinessId() + "");
param.put("oid" , id);
params.add(param);
}
baseMapper.insertOss(params);
}
log.debug(CyUserUtil.getAuthenUsername() + "新增了ID为" +
wmsGoods.getBusinessId() + "的商品信息表信息");
return new CyPersistModel(line); return new CyPersistModel(line);
} }
/** /**
* 删除 商品信息表 * 删除 商品信息表
* @param wmsGoods *
* @return * @param wmsGoods
*/ * @return
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT) */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override @Override
public CyPersistModel remove(WmsGoods wmsGoods){ public CyPersistModel remove(WmsGoods wmsGoods) {
int line = baseMapper.realDelete(wmsGoods); int line = baseMapper.realDelete(wmsGoods);
log.debug(CyUserUtil.getAuthenUsername()+"删除了ID为"+ log.debug(CyUserUtil.getAuthenUsername() + "删除了ID为" +
wmsGoods.getBusinessId()+"的商品信息表信息"); wmsGoods.getBusinessId() + "的商品信息表信息");
return new CyPersistModel(line); return new CyPersistModel(line);
} }
/** /**
* 逻辑删除 商品信息表 * 逻辑删除 商品信息表
* @param wmsGoods *
* @return * @param wmsGoods
*/ * @return
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT) */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override @Override
public CyPersistModel removeLogical(WmsGoods wmsGoods){ public CyPersistModel removeLogical(WmsGoods wmsGoods) {
wmsGoods.setDeleted(); wmsGoods.setDeleted();
int line = baseMapper.deleteById(wmsGoods); int line = baseMapper.deleteById(wmsGoods);
log.debug(CyUserUtil.getAuthenUsername()+"逻辑删除了ID为"+ log.debug(CyUserUtil.getAuthenUsername() + "逻辑删除了ID为" +
wmsGoods.getBusinessId()+"的商品信息表信息"); wmsGoods.getBusinessId() + "的商品信息表信息");
return new CyPersistModel(line); return new CyPersistModel(line);
} }
/** /**
* 修改 商品信息表 * 修改 商品信息表
* @param wmsGoods *
* @return * @param wmsGoods
*/ * @return
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT) */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override @Override
public CyPersistModel merge(WmsGoods wmsGoods){ public CyPersistModel merge(WmsGoods wmsGoods) {
int line = baseMapper.updateById(wmsGoods); int line = baseMapper.updateById(wmsGoods);
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ wmsGoods.getBusinessId()+"的商品信息表信息");
// 删除一下 goods_oss by goods
//插入图片
if(StringUtils.isNotBlank(wmsGoods.getUrlIdList())){
List<Map<String, String>> params = new ArrayList<>();
String[] oss_ids = wmsGoods.getUrlIdList().split(",");
Map<String, String> param = null;
for (String id : oss_ids) {
param = new HashMap<>();
param.put("gid", wmsGoods.getBusinessId() + "");
param.put("oid" , id);
params.add(param);
}
baseMapper.insertOss(params);
}
log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + wmsGoods.getBusinessId() + "的商品信息表信息");
return new CyPersistModel(line); return new CyPersistModel(line);
} }
/** /**
* 根据id查询 商品信息表 * 根据id查询 商品信息表
* @param id *
* @return * @param id
*/ * @return
*/
// @Override
// public WmsGoods findById(int id) {
// WmsGoods wmsGoods = baseMapper.selectById(id);
// ossInfoMapper.selectBatchIds()
// return wmsGoods;
// }
@Override @Override
public WmsGoods findById(int id){ public WmsGoods findById(int id) {
return baseMapper.selectById(id); return baseMapper.selectById(id);
} }
/** /**
* 分页查询 商品信息表 * 分页查询 商品信息表
* @param wmsGoods *
* @return * @param wmsGoods
*/ * @return
*/
@Override @Override
public IPage<WmsGoods> findAllByPagination(CyPageInfo<WmsGoods> paginationUtility, public IPage<WmsGoods> findAllByPagination(CyPageInfo<WmsGoods> paginationUtility,
WmsGoods wmsGoods){ WmsGoods wmsGoods) {
return baseMapper.queryWmsGoodssPaged(paginationUtility,wmsGoods); IPage<WmsGoods> wmsGoodsIPage = baseMapper.queryWmsGoodssPaged(paginationUtility, wmsGoods);
wmsGoodsIPage.getRecords().forEach(record->{
record.setOssInfoList(baseMapper.findOss(record));
});
return wmsGoodsIPage;
} }
/** /**
* 查询list 商品信息表 * 查询list 商品信息表
* @param wmsGoods *
* @return * @param wmsGoods
*/ * @return
*/
@Override @Override
public List<WmsGoods> findAll(WmsGoods wmsGoods){ public List<WmsGoods> findAll(WmsGoods wmsGoods) {
return baseMapper.queryWmsGoods(wmsGoods); return baseMapper.queryWmsGoods(wmsGoods);
} }
/** /**
* 导出商品信息表 * 导出商品信息表
* @return *
*/ * @return
*/
@Override @Override
public List<WmsGoods> export(WmsGoods wmsGoods) { public List<WmsGoods> export(WmsGoods wmsGoods) {
List<WmsGoods> wmsGoodsList = baseMapper.queryWmsGoods(wmsGoods); List<WmsGoods> wmsGoodsList = baseMapper.queryWmsGoods(wmsGoods);
...@@ -133,4 +191,28 @@ public class WmsGoodsServiceImpl extends ServiceImpl<WmsGoodsRepository,WmsGoods ...@@ -133,4 +191,28 @@ public class WmsGoodsServiceImpl extends ServiceImpl<WmsGoodsRepository,WmsGoods
return baseMapper.queryWmsGoodsByAppId(wmsGoodsLog); return baseMapper.queryWmsGoodsByAppId(wmsGoodsLog);
} }
@Override
public List<WmsGoods> findByApplyIdOut(WmsGoodsApply wmsGoodsLog) {
return baseMapper.queryWmsGoodsByAppIdOut(wmsGoodsLog);
}
@Override
public List<WmsGoods> findByIdGoods(int id) {
WmsGoods wmsGoods = new WmsGoods();
wmsGoods.setGoodsId(id);
return baseMapper.findByIdGoods(wmsGoods);
}
@Override
public WmsGoods findByOss(int id) {
WmsGoods goods = baseMapper.selectById(id);
goods.setOssInfoList(baseMapper.findOss(goods));
return goods;
}
@Override
public List<OssInfo> findOss(WmsGoods wmsGoods) {
return baseMapper.findOss(wmsGoods);
}
} }
...@@ -97,7 +97,7 @@ public class WmsGoodsApplyController extends CyPaginationController<WmsGoodsAppl ...@@ -97,7 +97,7 @@ public class WmsGoodsApplyController extends CyPaginationController<WmsGoodsAppl
return CyResultGenUtil.builder(new CyPersistModel(1), return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsApplyServiceImpl.AppCode()); wmsGoodsApplyServiceImpl.appCode());
} }
//@PreAuthorize("@cyPerm.hasPerm('sys:goodsApply:delete')") //@PreAuthorize("@cyPerm.hasPerm('sys:goodsApply:delete')")
@CyOpeLogAnno(title = "system-商品申请表管理-删除商品申请表", businessType = CyLogTypeEnum.DELETE) @CyOpeLogAnno(title = "system-商品申请表管理-删除商品申请表", businessType = CyLogTypeEnum.DELETE)
...@@ -151,7 +151,16 @@ public class WmsGoodsApplyController extends CyPaginationController<WmsGoodsAppl ...@@ -151,7 +151,16 @@ public class WmsGoodsApplyController extends CyPaginationController<WmsGoodsAppl
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsApplyServiceImpl.findById(businessId)); wmsGoodsApplyServiceImpl.findById(businessId));
} }
@CyOpeLogAnno(title = "system-商品申请表管理-查询商品申请表", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="查询单一商品申请表", notes="查询单一商品申请表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@GetMapping("/detailOut/{businessId:\\w+}")
public CyResult detailOut(@PathVariable int businessId) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsApplyServiceImpl.findByIdOut(businessId));
}
//@PreAuthorize("@cyPerm.hasPerm('sys:goodsApply:list')") //@PreAuthorize("@cyPerm.hasPerm('sys:goodsApply:list')")
@CyOpeLogAnno(title = "system-商品申请表管理-查询商品申请表", businessType = CyLogTypeEnum.QUERY) @CyOpeLogAnno(title = "system-商品申请表管理-查询商品申请表", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="查询商品申请表集合", notes="查询商品申请表集合") @ApiOperation(value="查询商品申请表集合", notes="查询商品申请表集合")
......
...@@ -20,7 +20,7 @@ public interface WmsGoodsApplyService { ...@@ -20,7 +20,7 @@ public interface WmsGoodsApplyService {
*/ */
CyPersistModel persist(WmsGoodsApply wmsGoodsApply); CyPersistModel persist(WmsGoodsApply wmsGoodsApply);
String AppCode(); String appCode();
/** /**
* 删除 商品申请表 * 删除 商品申请表
...@@ -77,4 +77,6 @@ public interface WmsGoodsApplyService { ...@@ -77,4 +77,6 @@ public interface WmsGoodsApplyService {
CyPersistModel batchPersist(AddWmsGoodsApplyDTO wmsGoodsApply); CyPersistModel batchPersist(AddWmsGoodsApplyDTO wmsGoodsApply);
CyPersistModel batchOutPersist(AddWmsGoodsApplyDTO wmsGoodsApply); CyPersistModel batchOutPersist(AddWmsGoodsApplyDTO wmsGoodsApply);
WmsGoodsApply findByIdOut(int id);
} }
package org.rcisoft.bus.wmsgoodsapply.service.impl; package org.rcisoft.bus.wmsgoodsapply.service.impl;
import cn.afterturn.easypoi.exception.excel.ExcelImportException; import cn.afterturn.easypoi.exception.excel.ExcelImportException;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods; import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
...@@ -34,6 +35,7 @@ import java.util.Date; ...@@ -34,6 +35,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
/** /**
* Created by cy on 2024年5月29日 下午1:21:49. * Created by cy on 2024年5月29日 下午1:21:49.
...@@ -53,6 +55,7 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor ...@@ -53,6 +55,7 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
/** /**
* 保存 商品申请表 * 保存 商品申请表
*
* @param wmsGoodsApply * @param wmsGoodsApply
* @return * @return
*/ */
...@@ -78,6 +81,9 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor ...@@ -78,6 +81,9 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
wmsGoodsApply.setDealStatus("0"); wmsGoodsApply.setDealStatus("0");
baseMapper.insert(wmsGoodsApply); baseMapper.insert(wmsGoodsApply);
//空 //空
if (CollectionUtil.isEmpty(addwmsGoodsApply.getBoxList())) {
throw new CyServiceException(1001, "出库单为空");
}
List<WmsGoodsLog> logList = new ArrayList<>(); List<WmsGoodsLog> logList = new ArrayList<>();
WmsGoodsLog log = null; WmsGoodsLog log = null;
for (WmsGoods box : addwmsGoodsApply.getBoxList()) { for (WmsGoods box : addwmsGoodsApply.getBoxList()) {
...@@ -88,7 +94,7 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor ...@@ -88,7 +94,7 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
WmsGoodsStock goodsStock = wmsGoodsStockRepositoryImpl.findById(box.getBusinessId()); WmsGoodsStock goodsStock = wmsGoodsStockRepositoryImpl.findById(box.getBusinessId());
if (goodsStock == null) { if (goodsStock == null) {
WmsGoodsStock newGoodsStock = new WmsGoodsStock(); WmsGoodsStock newGoodsStock = new WmsGoodsStock();
newGoodsStock.setGoodsId(addwmsGoodsApply.getBoxList().get(0).getBusinessId()); newGoodsStock.setGoodsId(box.getBusinessId());
newGoodsStock.setGoodsCounts(box.getInCounts()); newGoodsStock.setGoodsCounts(box.getInCounts());
wmsGoodsStockRepositoryImpl.persist(newGoodsStock); wmsGoodsStockRepositoryImpl.persist(newGoodsStock);
} else { } else {
...@@ -96,14 +102,14 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor ...@@ -96,14 +102,14 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
wmsGoodsStockRepositoryImpl.updateCounts(goodsStock); wmsGoodsStockRepositoryImpl.updateCounts(goodsStock);
} }
//日志 //日志
WmsGoodsStock wmsgoodsStock = wmsGoodsStockRepositoryImpl.findById(box.getBusinessId());
log.setApplyId(wmsGoodsApply.getBusinessId()); log.setApplyId(wmsGoodsApply.getBusinessId());
log.setGoodsId(box.getBusinessId()); log.setGoodsId(box.getBusinessId());
log.setGoodsCounts(box.getInCounts()); log.setGoodsCounts(box.getInCounts());
log.setIoType("0"); log.setIoType("0");
log.setUpdateCounts(wmsgoodsStock.getGoodsCounts()); log.setUpdateCounts(goodsStock != null ? goodsStock.getGoodsCounts() : box.getInCounts());
logList.add(log); logList.add(log);
} }
wmsGoodsLogServiceImpl.batchPersist(logList); wmsGoodsLogServiceImpl.batchPersist(logList);
return new CyPersistModel(1); return new CyPersistModel(1);
} }
...@@ -120,6 +126,8 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor ...@@ -120,6 +126,8 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
// 1. 集合空 判断 // 1. 集合空 判断
if (CollectionUtil.isEmpty(addwmsGoodsApply.getBoxList()))
throw new CyServiceException(1001, "入库商品为空!");
// 出库 // 出库
WmsGoodsApply wmsGoodsApplyOut = new WmsGoodsApply(); WmsGoodsApply wmsGoodsApplyOut = new WmsGoodsApply();
BeanUtils.copyProperties(addwmsGoodsApply, wmsGoodsApplyOut); BeanUtils.copyProperties(addwmsGoodsApply, wmsGoodsApplyOut);
...@@ -160,9 +168,18 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor ...@@ -160,9 +168,18 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
return new CyPersistModel(1); return new CyPersistModel(1);
} }
@Override
public WmsGoodsApply findByIdOut(int id) {
WmsGoodsApply apply = baseMapper.selectById(id);
if (apply == null) {
throw new CyServiceException(1001, "入库申请不存在");
}
apply.setWmsGoods(wmsGoodsServiceImpl.findByApplyIdOut(apply));
return apply;
}
@Override @Override
public String AppCode() { public String appCode() {
// 获取当前时间 // 获取当前时间
Date date = new Date(); Date date = new Date();
// 设置日期格式 // 设置日期格式
...@@ -175,8 +192,8 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor ...@@ -175,8 +192,8 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
// 获取当前日期 // 获取当前日期
LocalDate currentDate = LocalDate.now(); LocalDate currentDate = LocalDate.now();
// 编号前缀 // 编号前缀
String AppCode = codePrefix + formattedDate + formattedCount; String appCode = codePrefix + formattedDate + formattedCount;
return AppCode; return appCode;
} }
/** /**
......
package org.rcisoft.bus.wmsgoodsstock.entity; package org.rcisoft.bus.wmsgoodsstock.entity;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*; import lombok.*;
import org.rcisoft.core.entity.CyIdIncreEntity; import org.rcisoft.core.entity.CyIdIncreEntity;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.io.Serializable; import java.io.Serializable;
...@@ -11,29 +14,29 @@ import java.util.Date; ...@@ -11,29 +14,29 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* Created with cy on 2024年5月29日 下午1:21:49. * Created with cy on 2024年5月29日 下午1:21:49.
*/ */
@Data @Data
@TableName("wms_goods_stock") @TableName("wms_goods_stock")
public class WmsGoodsStock extends CyIdIncreEntity<WmsGoodsStock> { public class WmsGoodsStock extends CyIdIncreEntity<WmsGoodsStock> {
/** /**
* @desc 商品id * @desc 商品id
* @column goods_id * @column goods_id
* @default * @default
*/ */
@Excel(name = "商品id", orderNum = "0", width = 20) @Excel(name = "商品id", orderNum = "0", width = 20)
private Integer goodsId; private Integer goodsId;
/** /**
* @desc 商品数量 * @desc 商品数量
* @column goods_counts * @column goods_counts
* @default * @default
*/ */
@Excel(name = "商品数量", orderNum = "1", width = 20) @Excel(name = "商品数量", orderNum = "1", width = 20)
private Integer goodsCounts; private Integer goodsCounts;
@TableField(exist = false)
private Integer inventoryValue;
} }
...@@ -109,8 +109,8 @@ cy: ...@@ -109,8 +109,8 @@ cy:
stringOutputType: base64 stringOutputType: base64
global: global:
path: path:
base_upload_location: D:\14406\Pictures base_upload_location: D:\soft\nginx-1.24.0\html\upload
base_discovery: 'http://192.168.1.12:8888/eduServer/' base_discovery: 'http://192.168.10.185/upload/'
code_generate_location: /code code_generate_location: /code
video_location: /video video_location: /video
temp_location: /temp temp_location: /temp
......
...@@ -24,6 +24,14 @@ ...@@ -24,6 +24,14 @@
<!--回显 入库/出库 列表--> <!--回显 入库/出库 列表-->
<result column="goods_counts" jdbcType="VARCHAR" property="goodsCounts"/> <result column="goods_counts" jdbcType="VARCHAR" property="goodsCounts"/>
</resultMap> </resultMap>
<insert id="insertOss">
insert into
wms_goods_oss(goods_id,oss_id)
values
<foreach collection="entity" item="item" separator=",">
(#{item.gid},#{item.oid})
</foreach>
</insert>
<!--<cache type="${corePackag!}.util.RedisCache"/>--> <!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="queryWmsGoods" resultMap="BaseResultMap"> <select id="queryWmsGoods" resultMap="BaseResultMap">
...@@ -67,42 +75,46 @@ ...@@ -67,42 +75,46 @@
</select> </select>
<select id="queryWmsGoodssPaged" resultMap="BaseResultMap"> <select id="queryWmsGoodssPaged" resultMap="BaseResultMap">
select * from wms_goods SELECT
where 1=1 wg.*
and del_flag = '0' FROM
wms_goods wg
WHERE
wg.del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' "> <if test="entity.flag !=null and entity.flag != '' ">
and flag = #{entity.flag} and wg.flag = #{entity.flag}
</if> </if>
<if test="entity.goodsName !=null and entity.goodsName != '' "> <if test="entity.goodsName !=null and entity.goodsName != '' ">
and goods_name like concat('%',#{entity.goodsName},'%') and wg.goods_name like concat('%',#{entity.goodsName},'%')
</if> </if>
<if test="entity.goodsDictName !=null and entity.goodsDictName != '' "> <if test="entity.goodsDictName !=null and entity.goodsDictName != '' ">
and goods_dict_name like concat('%',#{entity.goodsDictName},'%') and wg.goods_dict_name like concat('%',#{entity.goodsDictName},'%')
</if> </if>
<if test="entity.goodsCode !=null and entity.goodsCode != '' "> <if test="entity.goodsCode !=null and entity.goodsCode != '' ">
and goods_code like concat('%',#{entity.goodsCode},'%') and wg.goods_code = #{entity.goodsCode}
</if> </if>
<if test="entity.goodsStyle !=null and entity.goodsStyle != '' "> <if test="entity.goodsStyle !=null and entity.goodsStyle != '' ">
and goods_style like concat('%',#{entity.goodsStyle},'%') and wg.goods_style like concat('%',#{entity.goodsStyle},'%')
</if> </if>
<if test="entity.goodsArtNumber !=null and entity.goodsArtNumber != '' "> <if test="entity.goodsArtNumber !=null and entity.goodsArtNumber != '' ">
and goods_art_number like concat('%',#{entity.goodsArtNumber},'%') and wg.goods_art_number like concat('%',#{entity.goodsArtNumber},'%')
</if> </if>
<if test="entity.goodsSeason !=null and entity.goodsSeason != '' "> <if test="entity.goodsSeason !=null and entity.goodsSeason != '' ">
and goods_season like concat('%',#{entity.goodsSeason},'%') and wg.goods_season like concat('%',#{entity.goodsSeason},'%')
</if> </if>
<if test="entity.goodsColour !=null and entity.goodsColour != '' "> <if test="entity.goodsColour !=null and entity.goodsColour != '' ">
and goods_colour like concat('%',#{entity.goodsColour},'%') and wg.goods_colour like concat('%',#{entity.goodsColour},'%')
</if> </if>
<if test="entity.goodsNorms !=null and entity.goodsNorms != '' "> <if test="entity.goodsNorms !=null and entity.goodsNorms != '' ">
and goods_norms like concat('%',#{entity.goodsNorms},'%') and wg.goods_norms like concat('%',#{entity.goodsNorms},'%')
</if> </if>
<if test="entity.goodsSize !=null and entity.goodsSize != '' "> <if test="entity.goodsSize !=null and entity.goodsSize != '' ">
and goods_size like concat('%',#{entity.goodsSize},'%') and wg.goods_size like concat('%',#{entity.goodsSize},'%')
</if> </if>
<if test="entity.goodsBrand !=null and entity.goodsBrand != '' "> <if test="entity.goodsBrand !=null and entity.goodsBrand != '' ">
and goods_brand like concat('%',#{entity.goodsBrand},'%') and wg.goods_brand like concat('%',#{entity.goodsBrand},'%')
</if> </if>
ORDER BY business_id DESC ORDER BY business_id DESC
</select> </select>
...@@ -118,4 +130,65 @@ ...@@ -118,4 +130,65 @@
where log.apply_id = #{entity.businessId} where log.apply_id = #{entity.businessId}
</select> </select>
<select id="queryWmsGoodsByAppIdOut" resultMap="BaseResultMap">
SELECT
log.goods_counts as outCounts,
goods.*
FROM
wms_goods_log log
LEFT JOIN wms_goods goods ON log.goods_id = goods.business_id
where log.apply_id = #{entity.businessId}
</select>
<select id="findByIdGoods" resultMap="BaseResultMap">
select wg.*,oi.url from wms_goods_oss wgo join wms_goods wg on wg.business_id = wgo.goods_id
join oss_info oi on wgo.oss_id = oi.business_id
where 1=1
and wg.del_flag = '0' and oi.del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
and wg.flag = #{entity.flag}
</if>
<if test="entity.goodsName !=null and entity.goodsName != '' ">
and wg.goods_name like concat('%',#{entity.goodsName},'%')
</if>
<if test="entity.goodsDictName !=null and entity.goodsDictName != '' ">
and wg.goods_dict_name like concat('%',#{entity.goodsDictName},'%')
</if>
<if test="entity.goodsCode !=null and entity.goodsCode != '' ">
and wg.goods_code = #{entity.goodsCode}
</if>
<if test="entity.goodsStyle !=null and entity.goodsStyle != '' ">
and wg.goods_style like concat('%',#{entity.goodsStyle},'%')
</if>
<if test="entity.goodsArtNumber !=null and entity.goodsArtNumber != '' ">
and wg.goods_art_number like concat('%',#{entity.goodsArtNumber},'%')
</if>
<if test="entity.goodsSeason !=null and entity.goodsSeason != '' ">
and wg.goods_season like concat('%',#{entity.goodsSeason},'%')
</if>
<if test="entity.goodsColour !=null and entity.goodsColour != '' ">
and wg.goods_colour like concat('%',#{entity.goodsColour},'%')
</if>
<if test="entity.goodsNorms !=null and entity.goodsNorms != '' ">
and wg.goods_norms like concat('%',#{entity.goodsNorms},'%')
</if>
<if test="entity.goodsSize !=null and entity.goodsSize != '' ">
and wg.goods_size like concat('%',#{entity.goodsSize},'%')
</if>
<if test="entity.goodsBrand !=null and entity.goodsBrand != '' ">
and wg.goods_brand like concat('%',#{entity.goodsBrand},'%')
</if>
ORDER BY business_id DESC
</select>
<select id="findOss" resultType="org.rcisoft.sys.ossInfo.entity.OssInfo">
select oi.* from wms_goods_oss wgo
join wms_goods wg on wg.business_id = wgo.goods_id
join oss_info oi on wgo.oss_id = oi.business_id
where 1=1
and wg.del_flag='0' and oi.del_flag='0'
and wgo.goods_id = #{entity.businessId}
</select>
</mapper> </mapper>
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<result column="goods_norms" jdbcType="VARCHAR" property="goodsNorms"/> <result column="goods_norms" jdbcType="VARCHAR" property="goodsNorms"/>
<result column="goods_size" jdbcType="VARCHAR" property="goodsSize"/> <result column="goods_size" jdbcType="VARCHAR" property="goodsSize"/>
<result column="goods_brand" jdbcType="VARCHAR" property="goodsBrand"/> <result column="goods_brand" jdbcType="VARCHAR" property="goodsBrand"/>
<result column="inventoryValue" jdbcType="INTEGER" property="inventoryValue"/>
</resultMap> </resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>--> <!--<cache type="${corePackag!}.util.RedisCache"/>-->
...@@ -123,6 +124,9 @@ ...@@ -123,6 +124,9 @@
<if test="entity.goodsBrand !=null and entity.goodsBrand != '' "> <if test="entity.goodsBrand !=null and entity.goodsBrand != '' ">
and wg.goods_brand = #{entity.goodsBrand} and wg.goods_brand = #{entity.goodsBrand}
</if> </if>
<if test="entity.inventoryValue != null and entity.inventoryValue != ''">
and wgs.goods_counts &lt; #{entity.inventoryValue}
</if>
ORDER BY wgs.business_id ASC ORDER BY wgs.business_id ASC
</select> </select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment