|
|
@@ -11,18 +11,19 @@ import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.page.PageRes;
|
|
|
import com.sckw.core.utils.BeanUtils;
|
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
|
-import com.sckw.core.utils.IdWorker;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.order.dao.KwpWantBuyAddressMapper;
|
|
|
import com.sckw.order.dao.KwpWantBuyMapper;
|
|
|
import com.sckw.order.dao.KwpWantBuyTradingMapper;
|
|
|
-import com.sckw.order.model.*;
|
|
|
-import com.sckw.order.model.vo.req.AddWantBuyParam;
|
|
|
-import com.sckw.order.model.vo.req.UpdateWantBuyParam;
|
|
|
-import com.sckw.order.model.vo.req.WantBuyDels;
|
|
|
-import com.sckw.order.model.vo.req.WantBuySelectParam;
|
|
|
-import com.sckw.order.model.vo.res.*;
|
|
|
+import com.sckw.order.model.KwoWantBuy;
|
|
|
+import com.sckw.order.model.KwoWantBuyAddress;
|
|
|
+import com.sckw.order.model.KwoWantBuyTrading;
|
|
|
+import com.sckw.order.model.vo.req.*;
|
|
|
+import com.sckw.order.model.vo.res.TableTopRes;
|
|
|
+import com.sckw.order.model.vo.res.WantBuyAddressDetailRes;
|
|
|
+import com.sckw.order.model.vo.res.WantBuyDetailRes;
|
|
|
+import com.sckw.order.model.vo.res.WantBuySelectRes;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
@@ -148,21 +149,21 @@ public class KwpWantBuyService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @Desc 求购列表查询
|
|
|
* @param wantBuySelectParam
|
|
|
* @return
|
|
|
+ * @Desc 求购列表查询
|
|
|
*/
|
|
|
private List<String> goodsTypeHandle(WantBuySelectParam wantBuySelectParam) {
|
|
|
List<SysDictResDto> goodsTypeList = remoteSystemService.queryDictBottom(wantBuySelectParam.getGoodsType(), wantBuySelectParam.getGoodsTypeValue());
|
|
|
if (CollectionUtils.isNotEmpty(goodsTypeList)) {
|
|
|
- return goodsTypeList.stream().map(SysDictResDto::getValue).toList();
|
|
|
+ return goodsTypeList.stream().map(SysDictResDto::getValue).toList();
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @Desc 字符串转数组
|
|
|
* @return
|
|
|
+ * @Desc 字符串转数组
|
|
|
*/
|
|
|
private List<String> stringToLongList(String str) {
|
|
|
if (StringUtils.isBlank(str)) {
|
|
|
@@ -180,11 +181,10 @@ public class KwpWantBuyService {
|
|
|
* @Return
|
|
|
* @Date 11:56 2023/7/25 0025
|
|
|
**/
|
|
|
- public void addDraft(AddWantBuyParam param) {
|
|
|
- Integer status = Integer.valueOf(DictEnum.GOODS_STATUS_0.getValue()); //保存草稿
|
|
|
- String message = "求购草稿";
|
|
|
- addWantBuy(param, message, status);
|
|
|
-
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void addDraft(AddDraftWantBuyParam param) {
|
|
|
+ Integer status = Integer.valueOf(DictEnum.WANT_BUY_STATUS_0.getValue());
|
|
|
+ addWantBuy(BeanUtils.copyProperties(param, AddWantBuyParam.class), status);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -194,80 +194,41 @@ public class KwpWantBuyService {
|
|
|
* @Return
|
|
|
* @Date 11:57 2023/7/25 0025
|
|
|
**/
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void addShelves(AddWantBuyParam param) {
|
|
|
- Integer status = Integer.valueOf(DictEnum.GOODS_STATUS_1.getValue()); //上架
|
|
|
- String message = "求购上架";
|
|
|
- addWantBuy(param, message, status);
|
|
|
+ Integer status = Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue());
|
|
|
+ addWantBuy(param, status);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @desc 新增求购统一方法
|
|
|
* @author lt
|
|
|
* @Date 11:52 2023/8/1 0001
|
|
|
- **/
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public void addWantBuy(AddWantBuyParam param, String message, Integer status) {
|
|
|
- Date currentDate = new Date();
|
|
|
- Long entId = LoginUserHolder.getEntId();
|
|
|
- if (Objects.isNull(entId)) {
|
|
|
- throw new BusinessException("企业ID不存在,请重新登录");
|
|
|
- }
|
|
|
-// KwoWantBuy kwoWantBuy = BeanUtils.copyProperties(param, KwoWantBuy.class);
|
|
|
- KwoWantBuy kwoWantBuy = new KwoWantBuy();
|
|
|
- Long userId = LoginUserHolder.getUserId();
|
|
|
- kwoWantBuy.setEntId(LoginUserHolder.getEntId())
|
|
|
- .setName(param.getName()).setGoodsType(param.getGoodsType())
|
|
|
- .setSpec(param.getSpec()).setPrice(param.getPrice())
|
|
|
- .setAmount(param.getAmount()).setContacts(param.getContacts())
|
|
|
- .setPhone(param.getPhone()).setId(new IdWorker(1L).nextId())
|
|
|
- .setRemark(param.getRemark()).setStatus(status).setCreateBy(userId)
|
|
|
- .setCreateTime(currentDate).setUpdateBy(userId)
|
|
|
- .setUpdateTime(currentDate).setDelFlag(Global.NO);
|
|
|
+ **/
|
|
|
+ public void addWantBuy(AddWantBuyParam param, Integer status) {
|
|
|
+ //添加求购
|
|
|
+ KwoWantBuy kwoWantBuy = BeanUtils.copyProperties(param, KwoWantBuy.class);
|
|
|
+ kwoWantBuy.setEntId(LoginUserHolder.getEntId()).setStatus(status);
|
|
|
kwpWantBuyMapper.insert(kwoWantBuy);
|
|
|
- if (Objects.isNull(kwoWantBuy.getId())) {
|
|
|
- throw new BusinessException(message + "失败");
|
|
|
- }
|
|
|
- /*
|
|
|
- 支付方式添加
|
|
|
- */
|
|
|
+ //添加支付方式
|
|
|
List<String> list = param.getTradings();
|
|
|
- if (list != null && !list.isEmpty()) {
|
|
|
- Date currentDateTime = new Date();
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ Long wantBuyId = kwoWantBuy.getId();
|
|
|
List<KwoWantBuyTrading> tradingList = list.stream()
|
|
|
.map(item -> {
|
|
|
KwoWantBuyTrading kwoWantBuyTrading = new KwoWantBuyTrading();
|
|
|
- kwoWantBuyTrading.setWantBuyId(kwoWantBuy.getId());
|
|
|
+ kwoWantBuyTrading.setWantBuyId(wantBuyId);
|
|
|
kwoWantBuyTrading.setTrading(item);
|
|
|
- kwoWantBuyTrading.setCreateBy(userId);
|
|
|
- kwoWantBuyTrading.setCreateTime(currentDateTime);
|
|
|
- kwoWantBuyTrading.setUpdateTime(currentDateTime);
|
|
|
- kwoWantBuyTrading.setStatus(status);
|
|
|
return kwoWantBuyTrading;
|
|
|
})
|
|
|
.collect(Collectors.toList());
|
|
|
kwoWantBuyTradingService.insertBatch(tradingList);
|
|
|
}
|
|
|
- /*
|
|
|
- 地址信息添加,如果存在地址信息-新增入库
|
|
|
- */
|
|
|
- if (Objects.nonNull(param.getAddressInfo())) {
|
|
|
- KwoWantBuyAddress address = new KwoWantBuyAddress();
|
|
|
- Long idWorker = new IdWorker(1L).nextId();
|
|
|
+ //地址信息添加,如果存在地址信息-新增入库
|
|
|
+ WantBuyAddressParam addressInfo = param.getAddressInfo();
|
|
|
+ if (Objects.nonNull(addressInfo)) {
|
|
|
+ KwoWantBuyAddress address = BeanUtils.copyProperties(addressInfo, KwoWantBuyAddress.class);
|
|
|
address.setWantBuyId(kwoWantBuy.getId());
|
|
|
- address.setName(param.getAddressInfo().getName());
|
|
|
- address.setType(param.getAddressInfo().getType());
|
|
|
- address.setContacts(param.getAddressInfo().getContacts());
|
|
|
- address.setPhone(param.getAddressInfo().getPhone());
|
|
|
- address.setCityCode(param.getAddressInfo().getCityCode());
|
|
|
- address.setCityName(param.getAddressInfo().getCityName());
|
|
|
- address.setDetailAddress(param.getAddressInfo().getDetailAddress());
|
|
|
- address.setLat(param.getAddressInfo().getLat());
|
|
|
- address.setLng(param.getAddressInfo().getLng());
|
|
|
- address.setFence(param.getAddressInfo().getFence());
|
|
|
- address.setId(idWorker);
|
|
|
- address.setCreateBy(LoginUserHolder.getUserId());
|
|
|
- address.setCreateTime(new Date());
|
|
|
- address.setUpdateTime(new Date());
|
|
|
kwpWantBuyAddressMapper.insert(address);
|
|
|
}
|
|
|
}
|
|
|
@@ -278,14 +239,20 @@ public class KwpWantBuyService {
|
|
|
* @Date: 13:38 2023/7/25 0025
|
|
|
**/
|
|
|
public void putOnShelves(Long id) {
|
|
|
- KwoWantBuy kwoWantBuy = kwpWantBuyMapper.selectById(id);
|
|
|
+ LambdaQueryWrapper<KwoWantBuy> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(KwoWantBuy::getId, id).eq(KwoWantBuy::getEntId, LoginUserHolder.getEntId())
|
|
|
+ .eq(KwoWantBuy::getDelFlag, Global.NO).last("LIMIT 1");
|
|
|
+ KwoWantBuy kwoWantBuy = kwpWantBuyMapper.selectOne(wrapper);
|
|
|
if (Objects.isNull(kwoWantBuy)) {
|
|
|
throw new BusinessException("求购信息不存在");
|
|
|
}
|
|
|
- if (kwoWantBuy.getStatus().equals(Integer.valueOf(DictEnum.GOODS_STATUS_1.getValue()))) {
|
|
|
+ if (Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue()).equals(kwoWantBuy.getStatus())) {
|
|
|
throw new BusinessException("求购信息已上架");
|
|
|
}
|
|
|
- kwoWantBuy.setStatus(Integer.valueOf(DictEnum.GOODS_STATUS_1.getValue()));
|
|
|
+ if (Integer.valueOf(DictEnum.WANT_BUY_STATUS_0.getValue()).equals(kwoWantBuy.getStatus())) {
|
|
|
+ checkParams(BeanUtils.copyProperties(kwoWantBuy, UpdateWantBuyParam.class));
|
|
|
+ }
|
|
|
+ kwoWantBuy.setStatus(Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue()));
|
|
|
kwpWantBuyMapper.updateById(kwoWantBuy);
|
|
|
}
|
|
|
|
|
|
@@ -295,16 +262,16 @@ public class KwpWantBuyService {
|
|
|
* @Date 14:56 2023/7/25 0025
|
|
|
**/
|
|
|
public void batchTakeOffShelves(WantBuyDels param) {
|
|
|
- if (BeanUtils.isEmpty(param)) {
|
|
|
- throw new BusinessException("请提供需要下架的产品");
|
|
|
+ List<Long> ids = StringUtils.splitStrToList(param.getIds(), Long.class);
|
|
|
+ LambdaQueryWrapper<KwoWantBuy> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.in(KwoWantBuy::getId, ids).eq(KwoWantBuy::getStatus, Integer.valueOf(DictEnum.WANT_BUY_STATUS_1.getValue()))
|
|
|
+ .eq(KwoWantBuy::getEntId, LoginUserHolder.getEntId()).eq(KwoWantBuy::getDelFlag, Global.NO);
|
|
|
+ List<KwoWantBuy> list = kwpWantBuyMapper.selectList(wrapper);
|
|
|
+ if (!Objects.equals(ids.size(), list.size())) {
|
|
|
+ throw new BusinessException("下架操作仅针对“已上架”状态的单据");
|
|
|
}
|
|
|
- List<String> ids = List.of(param.getIds().split(Global.COMMA));
|
|
|
- //1.查询ids所属产品只有status=1的才能下架,如果存在其它状态的则不能下架
|
|
|
LambdaUpdateWrapper<KwoWantBuy> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.eq(KwoWantBuy::getDelFlag, Global.NO).in(KwoWantBuy::getId, ids);
|
|
|
- updateWrapper.set(KwoWantBuy::getStatus, DictEnum.GOODS_STATUS_2.getValue())
|
|
|
- .set(KwoWantBuy::getUpdateBy, LoginUserHolder.getUserId())
|
|
|
- .set(KwoWantBuy::getUpdateTime, new Date());
|
|
|
+ updateWrapper.set(KwoWantBuy::getStatus, Integer.valueOf(DictEnum.WANT_BUY_STATUS_2.getValue())).in(KwoWantBuy::getId, ids);
|
|
|
kwpWantBuyMapper.update(null, updateWrapper);
|
|
|
}
|
|
|
|
|
|
@@ -312,15 +279,19 @@ public class KwpWantBuyService {
|
|
|
* @desc 求购删除
|
|
|
* @author lt
|
|
|
* @Date 10:15 2023/8/1 0001
|
|
|
- **/
|
|
|
+ **/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void dels(WantBuyDels param) {
|
|
|
- List<String> ids = List.of(param.getIds().split(Global.COMMA));
|
|
|
+ List<Long> ids = StringUtils.splitStrToList(param.getIds(), Long.class);
|
|
|
+ LambdaQueryWrapper<KwoWantBuy> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.in(KwoWantBuy::getId, ids).eq(KwoWantBuy::getStatus, 0)
|
|
|
+ .eq(KwoWantBuy::getEntId, LoginUserHolder.getEntId()).eq(KwoWantBuy::getDelFlag, Global.NO);
|
|
|
+ List<KwoWantBuy> list = kwpWantBuyMapper.selectList(wrapper);
|
|
|
+ if (!Objects.equals(ids.size(), list.size())) {
|
|
|
+ throw new BusinessException("删除操作仅针对“草稿”状态的单据");
|
|
|
+ }
|
|
|
LambdaUpdateWrapper<KwoWantBuy> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.in(KwoWantBuy::getId, ids).eq(KwoWantBuy::getDelFlag, Global.NO)
|
|
|
- .set(KwoWantBuy::getDelFlag, Global.YES)
|
|
|
- .set(KwoWantBuy::getUpdateBy, LoginUserHolder.getUserId())
|
|
|
- .set(KwoWantBuy::getUpdateTime, new Date());
|
|
|
+ updateWrapper.set(KwoWantBuy::getDelFlag, Global.YES).in(KwoWantBuy::getId, ids);
|
|
|
kwpWantBuyMapper.update(null, updateWrapper);
|
|
|
//删除地址信息
|
|
|
kwoWantBuyAddressService.delAddressByWantBuyIds(ids);
|
|
|
@@ -333,7 +304,7 @@ public class KwpWantBuyService {
|
|
|
* @desc 求购详情查询
|
|
|
* @author lt
|
|
|
* @Date 10:15 2023/8/1 0001
|
|
|
- **/
|
|
|
+ **/
|
|
|
public WantBuyDetailRes detail(Long id) {
|
|
|
//先判断求购订单是否存在
|
|
|
KwoWantBuy kwoWantBuy = kwpWantBuyMapper.selectById(id);
|
|
|
@@ -341,15 +312,14 @@ public class KwpWantBuyService {
|
|
|
throw new BusinessException("求购信息不存在");
|
|
|
}
|
|
|
WantBuyDetailRes responseData = BeanUtils.copyProperties(kwoWantBuy, WantBuyDetailRes.class);
|
|
|
- //TODO 还未定义好求购状态(从表里面拿还是enum)
|
|
|
- responseData.setStatusLabel(DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(responseData.getStatus())));
|
|
|
+ responseData.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), responseData.getGoodsType()))
|
|
|
+ .setStatusLabel(DictEnum.getLabel(DictTypeEnum.WANT_BUY_STATUS.getType(), String.valueOf(responseData.getStatus())));
|
|
|
//求购地址信息
|
|
|
KwoWantBuyAddress address = kwpWantBuyAddressMapper.selectOne(new LambdaQueryWrapper<KwoWantBuyAddress>()
|
|
|
- .eq(KwoWantBuyAddress::getWantBuyId, id).eq(KwoWantBuyAddress::getDelFlag, Global.NO));
|
|
|
+ .eq(KwoWantBuyAddress::getWantBuyId, id).eq(KwoWantBuyAddress::getDelFlag, Global.NO).last("LIMIT 1"));
|
|
|
if (Objects.nonNull(address)) {
|
|
|
WantBuyAddressDetailRes wantBuyAddressInfo = BeanUtils.copyProperties(address, WantBuyAddressDetailRes.class);
|
|
|
- wantBuyAddressInfo.setTypeLabel(DictEnum.getLabel(DictTypeEnum.TORDER_ADDRESS_TYPE.getType(), String.valueOf(wantBuyAddressInfo.getType())));
|
|
|
- System.out.println(wantBuyAddressInfo);
|
|
|
+ wantBuyAddressInfo.setTypeLabel(DictEnum.getLabel(DictTypeEnum.TORDER_ADDRESS_TYPE.getType(), wantBuyAddressInfo.getType()));
|
|
|
responseData.setAddressInfo(wantBuyAddressInfo);
|
|
|
}
|
|
|
//获取求购企业信息
|
|
|
@@ -359,7 +329,7 @@ public class KwpWantBuyService {
|
|
|
}
|
|
|
//求购支付方式集合
|
|
|
List<KwoWantBuyTrading> tradingList = kwoWantBuyTradingService.getByWantBuyId(id);
|
|
|
- if (Objects.nonNull(tradingList) && !tradingList.isEmpty()) {
|
|
|
+ if (CollectionUtils.isNotEmpty(tradingList)) {
|
|
|
List<String> tradings = tradingList.stream().map(KwoWantBuyTrading::getTrading).collect(Collectors.toList());
|
|
|
responseData.setTradings(tradings);
|
|
|
//改成stream流的方式
|
|
|
@@ -381,74 +351,71 @@ public class KwpWantBuyService {
|
|
|
public void update(UpdateWantBuyParam param) {
|
|
|
Long id = param.getId();
|
|
|
KwoWantBuy kwoWantBuy = selectOneById(id);
|
|
|
- if (Objects.isNull(kwoWantBuy)) throw new BusinessException("求购信息不存在");
|
|
|
+ if (Objects.isNull(kwoWantBuy)) {
|
|
|
+ throw new BusinessException("求购信息不存在");
|
|
|
+ }
|
|
|
+ if (!Objects.equals(String.valueOf(kwoWantBuy.getStatus()), DictEnum.WANT_BUY_STATUS_0.getValue())) {
|
|
|
+ checkParams(param);
|
|
|
+ }
|
|
|
//1.更新求购信息
|
|
|
- Date currentDate = new Date();
|
|
|
- Long userId = LoginUserHolder.getUserId();
|
|
|
- KwoWantBuy wantBuy = BeanUtils.copyProperties(param, KwoWantBuy.class);
|
|
|
- wantBuy.setUpdateBy(userId);
|
|
|
- wantBuy.setUpdateTime(currentDate);
|
|
|
- kwpWantBuyMapper.updateById(wantBuy);
|
|
|
- //int i = kwpWantBuyMapper.updateById(wantBuy);
|
|
|
- //2.更新求购地址信息,判断是否存在地址信息
|
|
|
-
|
|
|
+ BeanUtils.copyProperties(param, kwoWantBuy);
|
|
|
+ kwpWantBuyMapper.updateById(kwoWantBuy);
|
|
|
+ //2.更新求购地址信息
|
|
|
+ kwoWantBuyAddressService.delAddressByWantBuyIds(List.of(id));
|
|
|
if (Objects.nonNull(param.getAddressInfo())) {
|
|
|
- //判断是否存在地址信息
|
|
|
- LambdaQueryWrapper<KwoWantBuyAddress> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(KwoWantBuyAddress::getWantBuyId, id).eq(KwoWantBuyAddress::getDelFlag, Global.NO);
|
|
|
- KwoWantBuyAddress kwoWantBuyAddress = kwpWantBuyAddressMapper.selectOne(queryWrapper);
|
|
|
- //存在地址信息则更新,不存在则新增
|
|
|
+ KwoWantBuyAddress kwoWantBuyAddress = BeanUtils.copyProperties(param.getAddressInfo(), KwoWantBuyAddress.class);
|
|
|
+ kwoWantBuyAddress.setWantBuyId(id);
|
|
|
+ kwpWantBuyAddressMapper.insert(kwoWantBuyAddress);
|
|
|
|
|
|
- KwoWantBuyAddress kwoWantBuyAddress1 = BeanUtils.copyProperties(param.getAddressInfo(), KwoWantBuyAddress.class);
|
|
|
- kwoWantBuyAddress1.setUpdateTime(currentDate);
|
|
|
- kwoWantBuyAddress1.setUpdateBy(userId);
|
|
|
- if (Objects.nonNull(kwoWantBuyAddress)) {
|
|
|
- kwoWantBuyAddress1.setId(kwoWantBuyAddress.getId());
|
|
|
- kwpWantBuyAddressMapper.updateById(kwoWantBuyAddress1);
|
|
|
- } else {
|
|
|
- //不存在则新增地址信息
|
|
|
- kwoWantBuyAddress1.setWantBuyId(id);
|
|
|
- kwoWantBuyAddress1.setCreateTime(currentDate);
|
|
|
- kwoWantBuyAddress1.setCreateBy(userId);
|
|
|
- kwpWantBuyAddressMapper.insert(kwoWantBuyAddress1);
|
|
|
- }
|
|
|
}
|
|
|
//3.更新求购支付方式
|
|
|
+ kwoWantBuyTradingService.deleteByWantBuyid(id);
|
|
|
List<String> tradings = param.getTradings();
|
|
|
if (CollectionUtils.isNotEmpty(tradings)) {
|
|
|
- kwoWantBuyTradingService.deleteByWantBuyid(id);
|
|
|
- ArrayList<KwoWantBuyTrading> list = new ArrayList<>(param.getTradings().size());
|
|
|
+ List<KwoWantBuyTrading> list = new ArrayList<>(param.getTradings().size());
|
|
|
for (String trading : tradings) {
|
|
|
KwoWantBuyTrading kwoWantBuyTrading = new KwoWantBuyTrading();
|
|
|
kwoWantBuyTrading.setWantBuyId(id);
|
|
|
kwoWantBuyTrading.setTrading(trading);
|
|
|
- kwoWantBuyTrading.setCreateTime(currentDate);
|
|
|
- kwoWantBuyTrading.setUpdateTime(currentDate);
|
|
|
- kwoWantBuyTrading.setCreateBy(userId);
|
|
|
list.add(kwoWantBuyTrading);
|
|
|
}
|
|
|
kwpWantBuyTradingMapper.insertBatch(list);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
+ private void checkParams(UpdateWantBuyParam param) {
|
|
|
+ if (StringUtils.isBlank(param.getName())) {
|
|
|
+ throw new BusinessException("商品名称不能为空!");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(param.getPrice())) {
|
|
|
+ throw new BusinessException("求购单价不能为空!");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(param.getAmount())) {
|
|
|
+ throw new BusinessException("求购总量不能为空!");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(param.getContacts())) {
|
|
|
+ throw new BusinessException("联系人不能为空!");
|
|
|
+ }
|
|
|
+ if (Objects.isNull(param.getPhone())) {
|
|
|
+ throw new BusinessException("联系电话不能为空!");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @Desc: 根据id查询求购信息
|
|
|
* @param id
|
|
|
* @return
|
|
|
+ * @Desc: 根据id查询求购信息
|
|
|
*/
|
|
|
public KwoWantBuy selectOneById(Long id) {
|
|
|
LambdaQueryWrapper<KwoWantBuy> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(KwoWantBuy::getId, id)
|
|
|
- .eq(KwoWantBuy::getDelFlag, Global.NO);
|
|
|
+ queryWrapper.eq(KwoWantBuy::getId, id).eq(KwoWantBuy::getDelFlag, Global.NO).last("LIMIT 1");
|
|
|
return kwpWantBuyMapper.selectOne(queryWrapper);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @Desc: 查询求购角标统计数量
|
|
|
* @param
|
|
|
* @return
|
|
|
+ * @Desc: 查询求购角标统计数量
|
|
|
*/
|
|
|
public Map statistic(WantBuySelectParam params) {
|
|
|
if (StringUtils.isNotBlank(params.getTrading())) {
|