|
|
@@ -7,6 +7,7 @@ import com.uas.platform.b2c.common.account.service.EnterpriseService;
|
|
|
import com.uas.platform.b2c.core.config.SysConf;
|
|
|
import com.uas.platform.b2c.core.constant.IntegerConstant;
|
|
|
import com.uas.platform.b2c.core.constant.ShortConstant;
|
|
|
+import com.uas.platform.b2c.core.constant.SplitChar;
|
|
|
import com.uas.platform.b2c.core.support.SystemSession;
|
|
|
import com.uas.platform.b2c.core.utils.FastjsonUtils;
|
|
|
import com.uas.platform.b2c.core.utils.NumberUtil;
|
|
|
@@ -52,6 +53,7 @@ import com.uas.platform.core.model.Type;
|
|
|
import com.uas.platform.core.persistence.criteria.LogicalExpression;
|
|
|
import com.uas.platform.core.persistence.criteria.PredicateUtils;
|
|
|
import com.uas.platform.core.persistence.criteria.SimpleExpression;
|
|
|
+import org.apache.commons.beanutils.ConvertUtils;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.log4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -1332,7 +1334,16 @@ public class ProductServiceImpl implements ProductService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public ResultMap batchPutOn() {
|
|
|
+ public ResultMap batchPutOn(Integer standard, String ids) {
|
|
|
+ List<Long> prIdLong = null;
|
|
|
+ if (StringUtils.isEmpty(ids) && StringUtils.isEmpty(standard)) {
|
|
|
+ return new ResultMap(CodeType.PARAMETER_ERROR.code(), "没有选择需要操作的信息", null);
|
|
|
+ } else {
|
|
|
+ if (!StringUtils.isEmpty(ids)) {
|
|
|
+ Long[] idArray = (Long[]) ConvertUtils.convert(ids.split(SplitChar.COMMA), Long.class);
|
|
|
+ prIdLong = Arrays.asList(idArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
Long uu = SystemSession.getUser().getEnterprise().getUu();
|
|
|
ResultMap registerAddress = enterpriseService.getCurrencyByRegisterAddress();
|
|
|
String currency = null;
|
|
|
@@ -1356,9 +1367,18 @@ public class ProductServiceImpl implements ProductService {
|
|
|
if (property == null) {
|
|
|
return new ResultMap(CodeType.NOT_COMPLETE_INFO.code(), "请先设置上架参数", null);
|
|
|
}
|
|
|
- String sql = "select p.pr_id from products p left join product$private pp on pp.pr_id = p.pr_id where pp.pr_batchcount = 0 and p.pr_sourceapp = 'ERP' and p.pr_reserve <> 0 and p.pr_reserve is not null and pp.pr_b2cenabled = 1 and p.pr_enuu = (:enuu) and p.pr_id not in (select DISTINCT go_productid from trade$goods where go_productid is not null);";
|
|
|
- Map<String, Long> map = new HashMap<>();
|
|
|
- map.put("enuu", uu);
|
|
|
+ String sql = null;
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ if ((prIdLong != null) && (prIdLong.size() != 0)) {
|
|
|
+ sql = "select p.pr_id from products p left join product$private pp on pp.pr_id = p.pr_id where ifnull(pp.pr_batchcount, 0) = 0 and p.pr_sourceapp = 'ERP' and p.pr_reserve <> 0 and ifnull(pp.pr_b2cenabled, 0) = 1 and p.pr_id in (:ids) and p.pr_id not in (select DISTINCT go_productid from trade$goods where go_productid is not null);";
|
|
|
+ map.put("ids", prIdLong);
|
|
|
+ } else {
|
|
|
+ // 暂时不会进入当前循环,速度比较低
|
|
|
+ sql = "select p.pr_id from products p left join product$private pp on pp.pr_id = p.pr_id where ifnull(pp.pr_batchcount, 0) = 0 and p.pr_sourceapp = 'ERP' and p.pr_reserve <> 0 and ifnull(pp.pr_b2cenabled,0) = 1 and if(p.pr_standard, 0) = (:standard) and p.pr_enuu = (:enuu) and p.pr_id not in (select DISTINCT go_productid from trade$goods where go_productid is not null);";
|
|
|
+ map.put("enuu", uu);
|
|
|
+ map.put("standard", standard);
|
|
|
+ }
|
|
|
+
|
|
|
List<Long> longList = namedParameterJdbcTemplate.queryForList(sql, map, Long.class);
|
|
|
if (longList.size() == 0) {
|
|
|
return new ResultMap(CodeType.OK.code(), "没有可上架的信息", null);
|