|
|
@@ -497,10 +497,10 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public ResultMap confirmBom(Long bomId, User user, String url) {
|
|
|
+ public ResultMap confirmBom(Long bomId, String url, Long endTime, Integer count) {
|
|
|
SeekPurchaseBom seekPurchaseBom = seekPurchaseBomDao.findOne(bomId);
|
|
|
List<SeekPurchaseByBatch> seekPurchaseByBatchList = seekPurchaseByBatchDao.findByBomId(bomId);
|
|
|
- return publishBomInquiry(user, url, seekPurchaseByBatchList, seekPurchaseBom);
|
|
|
+ return publishBomInquiry(url, seekPurchaseByBatchList, seekPurchaseBom, endTime, count);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -733,12 +733,16 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
|
|
|
* 部分发布,bom明细非全选时
|
|
|
*
|
|
|
* @param detailIds detail id串 1,2,3,4...
|
|
|
- * @param user 用户信息
|
|
|
+ * @param endTime 截止时间 时间戳
|
|
|
+ * @param count 采购套数
|
|
|
* @param url 询价服务地址
|
|
|
* @return 处理结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public ResultMap confirmBomSelectedItems(String detailIds, User user, String url) {
|
|
|
+ public ResultMap confirmBomSelectedItems(String detailIds, String url, Long endTime, Integer count) {
|
|
|
+ if (null == endTime || null == count) {
|
|
|
+ return new ResultMap(CodeType.NO_INFO, "存在未传入必需参数");
|
|
|
+ }
|
|
|
List<Long> detailIdList = new ArrayList<>();
|
|
|
String[] detailIdsArray = detailIds.split(",");
|
|
|
for (String detailId : detailIdsArray) {
|
|
|
@@ -747,24 +751,37 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
|
|
|
List<SeekPurchaseByBatch> seekPurchaseByBatchList = seekPurchaseByBatchDao.findAll(detailIdList);
|
|
|
if (!CollectionUtils.isEmpty(seekPurchaseByBatchList)) {
|
|
|
SeekPurchaseBom seekPurchaseBom = seekPurchaseBomDao.findOne(seekPurchaseByBatchList.get(0).getBomId());
|
|
|
- return publishBomInquiry(user, url, seekPurchaseByBatchList, seekPurchaseBom);
|
|
|
+ return publishBomInquiry(url, seekPurchaseByBatchList, seekPurchaseBom, endTime, count);
|
|
|
}
|
|
|
return new ResultMap(CodeType.NOT_EXiST, "未找到对应bom明细记录");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询bom信息,(无明细)
|
|
|
+ *
|
|
|
+ * @param bomId bomId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public SeekPurchaseBom findOneWithoutDetail(Long bomId) {
|
|
|
+ return seekPurchaseBomDao.findOne(bomId);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 发布bom询价
|
|
|
- * @param user 用户信息
|
|
|
* @param url 询价服务url
|
|
|
* @param seekPurchaseByBatchList bom明细List
|
|
|
+ * @param endTime 截止时间 时间戳
|
|
|
+ * @param count 采购套数
|
|
|
* @return 处理结果
|
|
|
*/
|
|
|
- private ResultMap publishBomInquiry(User user, String url, List<SeekPurchaseByBatch> seekPurchaseByBatchList, SeekPurchaseBom seekPurchaseBom) {
|
|
|
+ private ResultMap publishBomInquiry(String url, List<SeekPurchaseByBatch> seekPurchaseByBatchList, SeekPurchaseBom seekPurchaseBom, Long endTime, Integer count) {
|
|
|
PurcInquiry inquiry = new PurcInquiry();
|
|
|
+ User user = SystemSession.getUser();
|
|
|
// 商城现货的数量
|
|
|
int haveGoodsCount = 0;
|
|
|
Set<PurcInquiryItem> inquiryItems = new HashSet<>();
|
|
|
- Date endDate = null;
|
|
|
+ Date endDate = new Date(endTime);
|
|
|
for (SeekPurchaseByBatch batch : seekPurchaseByBatchList) {
|
|
|
SeekPurchase seekPurchase = new SeekPurchase();
|
|
|
Calendar now = Calendar.getInstance();
|
|
|
@@ -776,26 +793,19 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
|
|
|
inquiryItem.setSource("MALL");
|
|
|
inquiryItem.setUserName(user.getUserName());
|
|
|
inquiryItem.setUserTel(user.getUserTel());
|
|
|
- inquiryItem.setNeedquantity(batch.getAmount());
|
|
|
+ inquiryItem.setNeedquantity(batch.getAmount() * count);
|
|
|
inquiryItem.setInbrand(batch.getBrand());
|
|
|
inquiryItem.setCurrency(batch.getCurrency());
|
|
|
inquiryItem.setCmpCode(batch.getCode().toUpperCase());
|
|
|
inquiryItem.setUnitPrice(batch.getUnitPrice());
|
|
|
inquiryItem.setProduceDate(batch.getProduceDate());
|
|
|
inquiryItem.setDate(new Date());
|
|
|
- inquiryItem.setEndDate(batch.getDeadline());
|
|
|
+ inquiryItem.setEndDate(endDate);
|
|
|
if (StringUtils.isEmpty(batch.getKind())) {
|
|
|
batch.setKind(matchKind(batch.getBrand(), batch.getCode()));
|
|
|
}
|
|
|
inquiryItem.setProdTitle(batch.getKind());
|
|
|
inquiryItem.setSpec(batch.getSpec());
|
|
|
- if (StringUtils.isEmpty(endDate)) {
|
|
|
- endDate = batch.getDeadline();
|
|
|
- } else {
|
|
|
- if (endDate.compareTo(batch.getDeadline()) != 1) {
|
|
|
- endDate = batch.getDeadline();
|
|
|
- }
|
|
|
- }
|
|
|
inquiryItem.setEncapsulation(batch.getEncapsulation());
|
|
|
// 商城现货搜索
|
|
|
List<Goods> goods = goodsDao.getGoodsByCodeAndName(seekPurchase.getCode(), seekPurchase.getBrand());
|
|
|
@@ -816,6 +826,7 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
|
|
|
}
|
|
|
inquiry.setDate(new Date(System.currentTimeMillis()));
|
|
|
inquiry.setEndDate(endDate);
|
|
|
+ inquiry.setCount(count);
|
|
|
inquiry.setInquiryItems(inquiryItems);
|
|
|
if (!StringUtils.isEmpty(user.getEnterprise())) {
|
|
|
inquiry.setEnUU(user.getEnterprise().getUu());
|