|
|
@@ -160,6 +160,9 @@ public class ProductServiceImpl implements ProductService {
|
|
|
@Autowired
|
|
|
private CreateNumberServiceImpl createNumberService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private MatchModelDao matchModelDao;
|
|
|
+
|
|
|
private ConcurrentHashMap<String, Field> sortFields = new ConcurrentHashMap<String, Field>();
|
|
|
|
|
|
@Override
|
|
|
@@ -675,33 +678,12 @@ public class ProductServiceImpl implements ProductService {
|
|
|
return ResultMap.success(map);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 根据标准上架信息 保存对产品包装,包装数量,生产日期的修改
|
|
|
- *
|
|
|
- * @param putOnInfo the Goods
|
|
|
- * @return the string
|
|
|
- */
|
|
|
- @Override
|
|
|
- public Product updateProduct(ProductStandardPutOnInfo putOnInfo) {
|
|
|
- if(putOnInfo == null) {
|
|
|
- throw new IllegalOperatorException("传入的信息信息为空");
|
|
|
- }
|
|
|
- if(StringUtils.isEmpty(putOnInfo.getProductid())) {
|
|
|
- throw new IllegalOperatorException("标准上架信息关联的标准产品信息为空");
|
|
|
- }
|
|
|
- Product product = productDao.findOne(putOnInfo.getProductid());
|
|
|
- if(product == null) {
|
|
|
- throw new IllegalOperatorException("标准上架信息关联的标准产品信息为空");
|
|
|
- }
|
|
|
- product.setAvailableOnSale(putOnInfo.getAvailableOnSale());
|
|
|
- product.setOnSaleQty(putOnInfo.getOnSaleQty());
|
|
|
- return product;
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public ResultMap matchSelected(List<Long> idList) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
Enterprise enterprise = SystemSession.getUser().getEnterprise();
|
|
|
Long enUU = enterprise != null ? enterprise.getUu() : null;
|
|
|
+ Long uu = SystemSession.getUser().getUserUU();
|
|
|
if (enUU == null) {
|
|
|
return new ResultMap(CodeType.NO_INFO, "企业或EnUU信息丢失");
|
|
|
}
|
|
|
@@ -712,11 +694,40 @@ public class ProductServiceImpl implements ProductService {
|
|
|
ProductStoreStatus status = (ProductStoreStatus) statusResult.getData();
|
|
|
String batch = createNumberService.getTimeNumber("product$match", 8);
|
|
|
// 保存要匹配的id数据
|
|
|
+ createMatchModel(idList, batch);
|
|
|
+ int success = 0;
|
|
|
+ int fail = 0;
|
|
|
|
|
|
- return null;
|
|
|
- }
|
|
|
+ String sql = "/*#mycat:db_type=master*/ call PRODUCT_MATCHES_SELECT_V1(%s, %s, @out); select @out";
|
|
|
+ final String formatSql = String.format(sql, batch, uu);
|
|
|
+ success = jdbcTemplate.execute(new StatementCallback<Integer>() {
|
|
|
+ @Override
|
|
|
+ public Integer doInStatement(Statement statement) throws SQLException, DataAccessException {
|
|
|
+ statement.execute(formatSql);
|
|
|
+ ResultSet rs = statement.getResultSet();
|
|
|
+ if (null != rs) {
|
|
|
+ rs.next();
|
|
|
+ return rs.getInt(1);
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ fail = idList.size() - success;
|
|
|
|
|
|
+ status.setStatus(Status.FINISH.value());
|
|
|
+ productStoreStatusDao.save(status);
|
|
|
+ map.put("total", idList.size());
|
|
|
+ map.put("fail", fail);
|
|
|
+ map.put("success", success);
|
|
|
|
|
|
+ return ResultMap.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id列表生成匹配信息
|
|
|
+ * @param idList 产品id列表
|
|
|
+ * @param batch 批次号标识
|
|
|
+ */
|
|
|
private void createMatchModel(List<Long> idList, String batch) {
|
|
|
Long uu = SystemSession.getUser().getUserUU();
|
|
|
Long enUU = SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null;
|
|
|
@@ -727,8 +738,33 @@ public class ProductServiceImpl implements ProductService {
|
|
|
matchModel.setProductId(id);
|
|
|
matchModel.setUseruu(uu);
|
|
|
matchModel.setEnuu(enUU);
|
|
|
+ matchModel.setStandard(ShortConstant.NO_SHORT);
|
|
|
resultList.add(matchModel);
|
|
|
}
|
|
|
+ matchModelDao.save(resultList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据标准上架信息 保存对产品包装,包装数量,生产日期的修改
|
|
|
+ *
|
|
|
+ * @param putOnInfo the Goods
|
|
|
+ * @return the string
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Product updateProduct(ProductStandardPutOnInfo putOnInfo) {
|
|
|
+ if(putOnInfo == null) {
|
|
|
+ throw new IllegalOperatorException("传入的信息信息为空");
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(putOnInfo.getProductid())) {
|
|
|
+ throw new IllegalOperatorException("标准上架信息关联的标准产品信息为空");
|
|
|
+ }
|
|
|
+ Product product = productDao.findOne(putOnInfo.getProductid());
|
|
|
+ if(product == null) {
|
|
|
+ throw new IllegalOperatorException("标准上架信息关联的标准产品信息为空");
|
|
|
+ }
|
|
|
+ product.setAvailableOnSale(putOnInfo.getAvailableOnSale());
|
|
|
+ product.setOnSaleQty(putOnInfo.getOnSaleQty());
|
|
|
+ return product;
|
|
|
}
|
|
|
|
|
|
/**
|