|
|
@@ -24,10 +24,10 @@ import com.sapit.common.bean.mobile.GoodsTypeBean;
|
|
|
import com.sapit.common.bean.storemobile.GoodsInfoBean;
|
|
|
import com.sapit.common.constant.ReturnCode;
|
|
|
import com.sapit.common.constant.Status;
|
|
|
-import com.sapit.common.entity.goods.BuGoods;
|
|
|
-import com.sapit.common.entity.goods.BuGoodsModel;
|
|
|
-import com.sapit.common.entity.goods.BuGoodsProperty;
|
|
|
-import com.sapit.common.entity.goods.BuGoodsType;
|
|
|
+import com.sapit.common.entity.goods.BuGoods1;
|
|
|
+import com.sapit.common.entity.goods.BuGoodsModel1;
|
|
|
+import com.sapit.common.entity.goods.BuGoodsProperty1;
|
|
|
+import com.sapit.common.entity.goods.BuGoodsType1;
|
|
|
import com.sapit.common.framwork.BaseDao;
|
|
|
import com.sapit.common.framwork.ResultBean;
|
|
|
import com.sapit.common.search.goods.BuGoodsTypeSearchBean;
|
|
|
@@ -94,7 +94,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取店铺商品类型列表(含新品标记)
|
|
|
+ * Get store goods type list with new goods flag
|
|
|
* @param storeId
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -144,7 +144,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
public ResultBean updateGoodsPicForThird(Long goodsId, MultipartFile file) {
|
|
|
ResultBean result = newResult();
|
|
|
if (goodsId == null || file == null) {
|
|
|
- return fail(result, ReturnCode.PARAM_WRONG, "参数错误!");
|
|
|
+ return fail(result, ReturnCode.PARAM_WRONG, "Operation failed");
|
|
|
}
|
|
|
|
|
|
String imageUrl = tryUploadImage(file, result);
|
|
|
@@ -152,10 +152,10 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- BuGoods goods = getGoodsByIdForThird(goodsId);
|
|
|
+ BuGoods1 goods = getGoodsByIdForThird(goodsId);
|
|
|
goods.setPictureUrl(imageUrl);
|
|
|
|
|
|
- return updateEntityAndWrapResult(goods, result, "更新成功", "更新失败,请重新尝试!");
|
|
|
+ return updateEntityAndWrapResult(goods, result, "更新成功", "Operation failed");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -167,13 +167,13 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
public ResultBean updateGoodsNameForThird(Long goodsId, String goodsName) {
|
|
|
ResultBean result = newResult();
|
|
|
if (goodsId == null || goodsName == null) {
|
|
|
- return fail(result, ReturnCode.PARAM_WRONG, "参数错误!");
|
|
|
+ return fail(result, ReturnCode.PARAM_WRONG, "Operation failed");
|
|
|
}
|
|
|
|
|
|
- BuGoods goods = getGoodsByIdForThird(goodsId);
|
|
|
+ BuGoods1 goods = getGoodsByIdForThird(goodsId);
|
|
|
goods.setGoodsName(goodsName);
|
|
|
|
|
|
- return updateEntityAndWrapResult(goods, result, "更新成功", "更新失败,请重新尝试!");
|
|
|
+ return updateEntityAndWrapResult(goods, result, "更新成功", "Operation failed");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -185,10 +185,10 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
public ResultBean updateGoodsPriceForThird(Long goodsId, String modelBeanListJson) {
|
|
|
ResultBean result = newResult();
|
|
|
if (goodsId == null || modelBeanListJson == null) {
|
|
|
- return fail(result, ReturnCode.PARAM_WRONG, "参数错误!");
|
|
|
+ return fail(result, ReturnCode.PARAM_WRONG, "Operation failed");
|
|
|
}
|
|
|
|
|
|
- BuGoods goods = getGoodsByIdForThird(goodsId);
|
|
|
+ BuGoods1 goods = getGoodsByIdForThird(goodsId);
|
|
|
boolean isSpecial = checkGoodsInSpecialForStore(goodsId);
|
|
|
JSONArray modelArray = JSONArray.parseArray(modelBeanListJson);
|
|
|
|
|
|
@@ -208,7 +208,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- BuGoodsModel model = (BuGoodsModel) findById(BuGoodsModel.class, Long.valueOf(modelId));
|
|
|
+ BuGoodsModel1 model = (BuGoodsModel1) findById(BuGoodsModel1.class, Long.valueOf(modelId));
|
|
|
long costPrice = parsePriceInCents(modelArray, i);
|
|
|
model.setCostPrice(costPrice);
|
|
|
if (!isSpecial) {
|
|
|
@@ -217,12 +217,12 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
model.setPackingFee(parsePriceInCents(modelJson, "packingFee"));
|
|
|
|
|
|
if (!this.update(model)) {
|
|
|
- return fail(result, ReturnCode.FAILED, "编辑商品价格失败,请重新尝试!");
|
|
|
+ return fail(result, ReturnCode.FAILED, "Operation failed");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!this.update(goods)) {
|
|
|
- return fail(result, ReturnCode.FAILED, "更新失败,请重新尝试!");
|
|
|
+ return fail(result, ReturnCode.FAILED, "Operation failed");
|
|
|
}
|
|
|
result.getRtnBean().setRtnCode(ReturnCode.SUCCESS);
|
|
|
result.getRtnBean().setRtnMsg("更新成功");
|
|
|
@@ -237,7 +237,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
public ResultBean updateGoodsInventoryForThird(String modelBeanListJson) {
|
|
|
ResultBean result = newResult();
|
|
|
if (modelBeanListJson == null) {
|
|
|
- return fail(result, ReturnCode.PARAM_WRONG, "参数错误!");
|
|
|
+ return fail(result, ReturnCode.PARAM_WRONG, "Operation failed");
|
|
|
}
|
|
|
|
|
|
JSONArray modelArray = JSONArray.parseArray(modelBeanListJson);
|
|
|
@@ -264,7 +264,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
return fail(result, ReturnCode.PARAM_WRONG);
|
|
|
}
|
|
|
|
|
|
- BuGoods goods = getGoodsByIdForThird(goodsId);
|
|
|
+ BuGoods1 goods = getGoodsByIdForThird(goodsId);
|
|
|
if (dayCount == null) {
|
|
|
goods.setNewGoodsEnddate(null);
|
|
|
goods.setNewGoodsFlg(0L);
|
|
|
@@ -275,16 +275,16 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
|
|
|
if (this.update(goods)) {
|
|
|
result.getRtnBean().setRtnCode(ReturnCode.SUCCESS);
|
|
|
- result.getRtnBean().setRtnMsg("更新成功!");
|
|
|
+ result.getRtnBean().setRtnMsg("Operation failed");
|
|
|
} else {
|
|
|
result.getRtnBean().setRtnCode(ReturnCode.FAILED);
|
|
|
- result.getRtnBean().setRtnMsg("更新失败!");
|
|
|
+ result.getRtnBean().setRtnMsg("Operation failed");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 修改店铺商品状态
|
|
|
+ * Change store goods status
|
|
|
* @param storeId
|
|
|
* @param goodsId
|
|
|
* @param status
|
|
|
@@ -298,16 +298,16 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
|
|
|
if (changeStatusForStore(goodsId, status, storeId)) {
|
|
|
result.getRtnBean().setRtnCode(ReturnCode.SUCCESS);
|
|
|
- result.getRtnBean().setRtnMsg("更新成功!");
|
|
|
+ result.getRtnBean().setRtnMsg("Operation failed");
|
|
|
} else {
|
|
|
result.getRtnBean().setRtnCode(ReturnCode.FAILED);
|
|
|
- result.getRtnBean().setRtnMsg("更新失败!");
|
|
|
+ result.getRtnBean().setRtnMsg("Operation failed");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 新增或修改店铺商品
|
|
|
+ * Create or update store goods
|
|
|
* @param infoBean
|
|
|
* @param storeId
|
|
|
* @param file
|
|
|
@@ -316,7 +316,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
public ResultBean updateStoreGoodsForThird(GoodsInfoBean infoBean, Long storeId, MultipartFile file) {
|
|
|
ResultBean result = newResult();
|
|
|
if (infoBean == null || storeId == null) {
|
|
|
- return fail(result, ReturnCode.PARAM_WRONG, "参数错误!");
|
|
|
+ return fail(result, ReturnCode.PARAM_WRONG, "Operation failed");
|
|
|
}
|
|
|
|
|
|
if (file != null && file.getOriginalFilename() != null) {
|
|
|
@@ -343,7 +343,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
* @param goodsId
|
|
|
*/
|
|
|
public void deleteGoods(Long goodsId) {
|
|
|
- String sql = "UPDATE bu_goods SET DEL_FLAG = 1 WHERE GOODS_ID = " + goodsId + " AND STATUS = 0";
|
|
|
+ String sql = "UPDATE bu_goods1 SET DEL_FLAG = 1 WHERE GOODS_ID = " + goodsId + " AND STATUS = 0";
|
|
|
executeSql(sql);
|
|
|
log.info("逻辑删除商品, goodsId={}", goodsId);
|
|
|
}
|
|
|
@@ -361,7 +361,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < stepsIds.size(); i++) {
|
|
|
- BuGoods goods = getGoodsByIdForThird(stepsIds.get(i));
|
|
|
+ BuGoods1 goods = getGoodsByIdForThird(stepsIds.get(i));
|
|
|
goods.setOrderKey((long) (stepsIds.size() - i + 1));
|
|
|
this.update(goods);
|
|
|
}
|
|
|
@@ -371,36 +371,36 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 新增或修改店铺商品类型
|
|
|
+ * Create or update store goods type
|
|
|
* @param type
|
|
|
* @return
|
|
|
*/
|
|
|
- public ResultBean updateStoreGoodsTypeForThird(BuGoodsType type) {
|
|
|
+ public ResultBean updateStoreGoodsTypeForThird(BuGoodsType1 type) {
|
|
|
ResultBean result = newResult();
|
|
|
if (type == null || type.getStoreId() == null) {
|
|
|
- return fail(result, ReturnCode.PARAM_WRONG, "参数错误!");
|
|
|
+ return fail(result, ReturnCode.PARAM_WRONG, "Operation failed");
|
|
|
}
|
|
|
|
|
|
Long maxOrderKey = findMaxTypeOrderKey(type.getStoreId());
|
|
|
|
|
|
if (type.getGoodsTypeId() == null) {
|
|
|
if (type.getType() == 1 && !checkGoodsTypeByType(type.getStoreId(), null)) {
|
|
|
- return fail(result, ReturnCode.FAILED, "最多只能添加一个必选分类");
|
|
|
+ return fail(result, ReturnCode.FAILED, "Operation failed");
|
|
|
}
|
|
|
type.setCreateDate(DateUtil.getSqlToday());
|
|
|
type.setOrderKey(maxOrderKey + 1);
|
|
|
if (!this.save(type)) {
|
|
|
- return fail(result, ReturnCode.FAILED, "新增失败,请重新尝试!");
|
|
|
+ return fail(result, ReturnCode.FAILED, "Operation failed");
|
|
|
}
|
|
|
} else {
|
|
|
if (type.getType() == 1 && !checkGoodsTypeByType(type.getStoreId(), type.getGoodsTypeId())) {
|
|
|
- return fail(result, ReturnCode.FAILED, "最多只能添加一个必选分类");
|
|
|
+ return fail(result, ReturnCode.FAILED, "Operation failed");
|
|
|
}
|
|
|
- BuGoodsType existingType = (BuGoodsType) findById(BuGoodsType.class, type.getGoodsTypeId());
|
|
|
+ BuGoodsType1 existingType = (BuGoodsType1) findById(BuGoodsType1.class, type.getGoodsTypeId());
|
|
|
existingType.setGoodsTypeName(type.getGoodsTypeName());
|
|
|
existingType.setType(type.getType());
|
|
|
if (!this.update(existingType)) {
|
|
|
- return fail(result, ReturnCode.FAILED, "更新失败,请重新尝试!");
|
|
|
+ return fail(result, ReturnCode.FAILED, "Operation failed");
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
@@ -415,7 +415,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
public ResultBean deleteTypeByIdForThird(Long goodsTypeId, Long storeId) {
|
|
|
ResultBean result = newResult();
|
|
|
if (goodsTypeId == null || storeId == null) {
|
|
|
- return fail(result, ReturnCode.PARAM_WRONG, "参数错误!");
|
|
|
+ return fail(result, ReturnCode.PARAM_WRONG, "Operation failed");
|
|
|
}
|
|
|
|
|
|
if (checkTypeIsUsed(goodsTypeId, storeId)) {
|
|
|
@@ -424,10 +424,10 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
|
|
|
if (deleteTypeByIdForStore(goodsTypeId, storeId)) {
|
|
|
result.getRtnBean().setRtnCode(ReturnCode.SUCCESS);
|
|
|
- result.getRtnBean().setRtnMsg("删除成功!");
|
|
|
+ result.getRtnBean().setRtnMsg("Operation failed");
|
|
|
} else {
|
|
|
result.getRtnBean().setRtnCode(ReturnCode.FAILED);
|
|
|
- result.getRtnBean().setRtnMsg("删除失败!");
|
|
|
+ result.getRtnBean().setRtnMsg("Operation failed");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
@@ -442,7 +442,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
public ResultBean changeOrderKey(Long id, Long type, Long storeId) {
|
|
|
ResultBean result = newResult();
|
|
|
if (id == null || type == null || storeId == null) {
|
|
|
- return fail(result, ReturnCode.PARAM_WRONG, "参数错误!");
|
|
|
+ return fail(result, ReturnCode.PARAM_WRONG, "Operation failed");
|
|
|
}
|
|
|
|
|
|
if (type == 1) {
|
|
|
@@ -500,7 +500,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- private ResultBean updateEntityAndWrapResult(BuGoods entity, ResultBean result, String successMsg, String failMsg) {
|
|
|
+ private ResultBean updateEntityAndWrapResult(BuGoods1 entity, ResultBean result, String successMsg, String failMsg) {
|
|
|
if (this.update(entity)) {
|
|
|
result.getRtnBean().setRtnCode(ReturnCode.SUCCESS);
|
|
|
result.getRtnBean().setRtnMsg(successMsg);
|
|
|
@@ -523,13 +523,13 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
try {
|
|
|
if (!FileFtpUploadUtil.uploadFile(IMAGE_DIR, filename, file.getInputStream())) {
|
|
|
result.getRtnBean().setRtnCode(ReturnCode.SYSTEMERR);
|
|
|
- result.getRtnBean().setRtnMsg("文件上传失败,请重新尝试!");
|
|
|
+ result.getRtnBean().setRtnMsg("Operation failed");
|
|
|
return null;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("文件上传异常", e);
|
|
|
result.getRtnBean().setRtnCode(ReturnCode.SYSTEMERR);
|
|
|
- result.getRtnBean().setRtnMsg("文件上传失败,请重新尝试!");
|
|
|
+ result.getRtnBean().setRtnMsg("Operation failed");
|
|
|
return null;
|
|
|
}
|
|
|
return FileFtpUploadUtil.rootURL + IMAGE_DIR + "/" + filename;
|
|
|
@@ -605,7 +605,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
JSONArray modelArray, JSONArray propertyArray, Timestamp now) {
|
|
|
Long maxOrderKey = findMaxGoodsOrderKey(storeId);
|
|
|
|
|
|
- BuGoods goods = new BuGoods();
|
|
|
+ BuGoods1 goods = new BuGoods1();
|
|
|
goods.setGoodsName(infoBean.getGoodsName());
|
|
|
goods.setPictureUrl(infoBean.getPictureUrl());
|
|
|
goods.setMiniNum(infoBean.getMiniNum());
|
|
|
@@ -627,12 +627,12 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
goods.setCreateDate(now);
|
|
|
|
|
|
if (!this.save(goods)) {
|
|
|
- return fail(result, ReturnCode.FAILED, "新增商品失败,请重新尝试!");
|
|
|
+ return fail(result, ReturnCode.FAILED, "Operation failed");
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < modelArray.size(); i++) {
|
|
|
JSONObject modelJson = modelArray.getJSONObject(i);
|
|
|
- BuGoodsModel model = new BuGoodsModel();
|
|
|
+ BuGoodsModel1 model = new BuGoodsModel1();
|
|
|
model.setModelName(modelJson.getString("modelName"));
|
|
|
model.setCostPrice(parsePriceInCents(modelArray, i));
|
|
|
model.setSalePrice(parsePriceInCents(modelArray, i));
|
|
|
@@ -640,7 +640,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
model.setGoodsId(goods.getGoodsId());
|
|
|
model.setCreateDate(now);
|
|
|
if (!this.save(model)) {
|
|
|
- return fail(result, ReturnCode.FAILED, "新增商品规格失败,请重新尝试!");
|
|
|
+ return fail(result, ReturnCode.FAILED, "Operation failed");
|
|
|
}
|
|
|
adjustGoods(model.getModelId(), Long.parseLong(modelJson.getString("inventory")));
|
|
|
}
|
|
|
@@ -651,7 +651,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
private ResultBean updateExistingGoods(ResultBean result, GoodsInfoBean infoBean, Long storeId,
|
|
|
JSONArray modelArray, JSONArray propertyArray, Timestamp now) {
|
|
|
boolean isSpecial = checkGoodsInSpecialForStore(infoBean.getGoodsId());
|
|
|
- BuGoods goods = getGoodsByIdForThird(infoBean.getGoodsId());
|
|
|
+ BuGoods1 goods = getGoodsByIdForThird(infoBean.getGoodsId());
|
|
|
|
|
|
deleteOldImageIfChanged(goods, infoBean);
|
|
|
|
|
|
@@ -672,7 +672,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
goods.setSingleFlg(modelArray.size() > 1 ? 0L : 1L);
|
|
|
|
|
|
if (!this.update(goods)) {
|
|
|
- return fail(result, ReturnCode.FAILED, "编辑商品失败,请重新尝试!");
|
|
|
+ return fail(result, ReturnCode.FAILED, "Operation failed");
|
|
|
}
|
|
|
|
|
|
deleteGoodsPropertyByGoodsForStore(goods.getGoodsId());
|
|
|
@@ -681,7 +681,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
JSONObject modelJson = modelArray.getJSONObject(i);
|
|
|
String modelId = modelJson.getString("modelId");
|
|
|
if (modelId != null && !modelId.isEmpty()) {
|
|
|
- BuGoodsModel model = (BuGoodsModel) findById(BuGoodsModel.class, Long.valueOf(modelId));
|
|
|
+ BuGoodsModel1 model = (BuGoodsModel1) findById(BuGoodsModel1.class, Long.valueOf(modelId));
|
|
|
model.setModelName(modelJson.getString("modelName"));
|
|
|
model.setCostPrice(parsePriceInCents(modelArray, i));
|
|
|
if (!isSpecial) {
|
|
|
@@ -689,11 +689,11 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
}
|
|
|
model.setPackingFee(parsePriceInCents(modelJson, "packingFee"));
|
|
|
if (!this.update(model)) {
|
|
|
- return fail(result, ReturnCode.FAILED, "编辑商品规格失败,请重新尝试!");
|
|
|
+ return fail(result, ReturnCode.FAILED, "Operation failed");
|
|
|
}
|
|
|
adjustGoods(model.getModelId(), Long.parseLong(modelJson.getString("inventory")));
|
|
|
} else {
|
|
|
- BuGoodsModel newModel = new BuGoodsModel();
|
|
|
+ BuGoodsModel1 newModel = new BuGoodsModel1();
|
|
|
newModel.setGoodsId(goods.getGoodsId());
|
|
|
newModel.setModelName(modelJson.getString("modelName"));
|
|
|
newModel.setCostPrice(parsePriceInCents(modelArray, i));
|
|
|
@@ -701,7 +701,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
newModel.setPackingFee(parsePriceInCents(modelJson, "packingFee"));
|
|
|
newModel.setCreateDate(now);
|
|
|
if (!this.save(newModel)) {
|
|
|
- return fail(result, ReturnCode.FAILED, "新增商品规格失败,请重新尝试!");
|
|
|
+ return fail(result, ReturnCode.FAILED, "Operation failed");
|
|
|
}
|
|
|
adjustGoods(newModel.getModelId(), Long.parseLong(modelJson.getString("inventory")));
|
|
|
}
|
|
|
@@ -710,7 +710,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
return saveProperties(result, propertyArray, goods.getGoodsId(), now, "新增商品属性失败,请重新尝试!");
|
|
|
}
|
|
|
|
|
|
- private void deleteOldImageIfChanged(BuGoods goods, GoodsInfoBean infoBean) {
|
|
|
+ private void deleteOldImageIfChanged(BuGoods1 goods, GoodsInfoBean infoBean) {
|
|
|
if (!StringUtil.isBlank(goods.getPictureUrl()) && !infoBean.getPictureUrl().equals(goods.getPictureUrl())) {
|
|
|
String filename = goods.getPictureUrl().substring(goods.getPictureUrl().lastIndexOf("/") + 1);
|
|
|
FileFtpUploadUtil.deleteFile(IMAGE_DIR, filename);
|
|
|
@@ -735,7 +735,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
if (propertyName == null || propertyName.isEmpty() || propertyList == null || propertyList.isEmpty()) {
|
|
|
continue;
|
|
|
}
|
|
|
- BuGoodsProperty property = new BuGoodsProperty();
|
|
|
+ BuGoodsProperty1 property = new BuGoodsProperty1();
|
|
|
property.setPropertyName(propertyName);
|
|
|
property.setPropertyList(propertyList);
|
|
|
property.setGoodsId(goodsId);
|
|
|
@@ -750,7 +750,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
}
|
|
|
|
|
|
private ResultBean moveTypeUp(ResultBean result, Long typeId, Long storeId) {
|
|
|
- BuGoodsType currentType = (BuGoodsType) findById(BuGoodsType.class, typeId);
|
|
|
+ BuGoodsType1 currentType = (BuGoodsType1) findById(BuGoodsType1.class, typeId);
|
|
|
if (currentType == null) {
|
|
|
return fail(result, ReturnCode.SYSTEMERR, "商品分类未找到!");
|
|
|
}
|
|
|
@@ -759,7 +759,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
BuGoodsTypeSearchBean searchBean = new BuGoodsTypeSearchBean();
|
|
|
searchBean.setStoreId(storeId);
|
|
|
searchBean.setOrderKey(currentOrder + 1);
|
|
|
- BuGoodsType previousType = getGoodsTypeLastForStore(searchBean);
|
|
|
+ BuGoodsType1 previousType = getGoodsTypeLastForStore(searchBean);
|
|
|
if (previousType == null) {
|
|
|
return fail(result, ReturnCode.SYSTEMERR, "该分类已经置顶无法上移!");
|
|
|
}
|
|
|
@@ -771,12 +771,12 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
this.update(previousType);
|
|
|
|
|
|
result.getRtnBean().setRtnCode(ReturnCode.SUCCESS);
|
|
|
- result.getRtnBean().setRtnMsg("上移成功!");
|
|
|
+ result.getRtnBean().setRtnMsg("Operation failed");
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private ResultBean moveTypeToTop(ResultBean result, Long typeId, Long storeId) {
|
|
|
- BuGoodsType currentType = (BuGoodsType) findById(BuGoodsType.class, typeId);
|
|
|
+ BuGoodsType1 currentType = (BuGoodsType1) findById(BuGoodsType1.class, typeId);
|
|
|
if (currentType == null) {
|
|
|
return fail(result, ReturnCode.SYSTEMERR, "商品分类未找到!");
|
|
|
}
|
|
|
@@ -787,8 +787,8 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
BuGoodsTypeSearchBean searchBean = new BuGoodsTypeSearchBean();
|
|
|
searchBean.setStoreId(storeId);
|
|
|
searchBean.setLastOrderKey(currentOrder);
|
|
|
- List<BuGoodsType> lowerTypes = getGoodsTypeForStore(searchBean);
|
|
|
- for (BuGoodsType lowerType : lowerTypes) {
|
|
|
+ List<BuGoodsType1> lowerTypes = getGoodsTypeForStore(searchBean);
|
|
|
+ for (BuGoodsType1 lowerType : lowerTypes) {
|
|
|
lowerType.setOrderKey(lowerType.getOrderKey() - 1);
|
|
|
this.update(lowerType);
|
|
|
}
|
|
|
@@ -796,22 +796,22 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
this.update(currentType);
|
|
|
|
|
|
result.getRtnBean().setRtnCode(ReturnCode.SUCCESS);
|
|
|
- result.getRtnBean().setRtnMsg("置顶成功!");
|
|
|
+ result.getRtnBean().setRtnMsg("Operation failed");
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private Long findMaxTypeOrderKey(Long storeId) {
|
|
|
- List<BuGoodsType> typeList = getGoodsTypeMaxOrderKeyForStore(storeId);
|
|
|
+ List<BuGoodsType1> typeList = getGoodsTypeMaxOrderKeyForStore(storeId);
|
|
|
return typeList.isEmpty() ? 0L : typeList.get(0).getOrderKey();
|
|
|
}
|
|
|
|
|
|
private Long findMaxGoodsOrderKey(Long storeId) {
|
|
|
- List<BuGoods> goodsList = getGoodsMaxOrderKeyForStore(storeId);
|
|
|
+ List<BuGoods1> goodsList = getGoodsMaxOrderKeyForStore(storeId);
|
|
|
return goodsList.isEmpty() ? 0L : goodsList.get(0).getOrderKey();
|
|
|
}
|
|
|
|
|
|
- private BuGoods getGoodsByIdForThird(Long goodsId) {
|
|
|
- return (BuGoods) findById(BuGoods.class, goodsId);
|
|
|
+ private BuGoods1 getGoodsByIdForThird(Long goodsId) {
|
|
|
+ return (BuGoods1) findById(BuGoods1.class, goodsId);
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@@ -819,7 +819,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
sql.append("SELECT T.GOODS_ID, T.GOODS_NAME, T.GOODS_TYPE_ID, T.SALES_COUNT, T.SALE_PRICE, T.COST_PRICE, T.LIMITED_NUM, ");
|
|
|
sql.append("T.MINI_NUM, T.PICTURE_URL, T.NEW_GOODS_FLG, T.SINGLE_FLG, T.STORE_ID, T.STATUS, W.MODEL_ID, T.ORDER_KEY, T.RMK")
|
|
|
- .append(" FROM bu_goods T LEFT JOIN bu_goods_model W ON T.GOODS_ID = W.GOODS_ID WHERE 1 = 1 ");
|
|
|
+ .append(" FROM bu_goods1 T LEFT JOIN bu_goods_model1 W ON T.GOODS_ID = W.GOODS_ID WHERE 1 = 1 ");
|
|
|
if (storeId != null) {
|
|
|
sql.append("AND STORE_ID = ").append(storeId).append(" ");
|
|
|
}
|
|
|
@@ -857,7 +857,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
private List<GoodsModelBean> getModelByGoodsIdsForThird(List<Long> goodsIds) {
|
|
|
- StringBuilder sql = new StringBuilder("SELECT MODEL_ID, MODEL_CODE, MODEL_NAME, GOODS_ID, COST_PRICE, SALE_PRICE, PACKING_FEE FROM bu_goods_model WHERE 1 = 1 ");
|
|
|
+ StringBuilder sql = new StringBuilder("SELECT MODEL_ID, MODEL_CODE, MODEL_NAME, GOODS_ID, COST_PRICE, SALE_PRICE, PACKING_FEE FROM bu_goods_model1 WHERE 1 = 1 ");
|
|
|
if (CollectionUtils.isNotEmpty(goodsIds)) {
|
|
|
sql.append("AND GOODS_ID IN ( ");
|
|
|
for (int i = 0; i < goodsIds.size(); i++) {
|
|
|
@@ -888,7 +888,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
private List<GoodsPropertyBean> getPropertyByGoodsIdsForStore(List<Long> goodsIds) {
|
|
|
- StringBuilder sql = new StringBuilder("SELECT PROPERTY_ID, PROPERTY_NAME, PROPERTY_LIST, GOODS_ID FROM bu_goods_property WHERE 1 = 1 ");
|
|
|
+ StringBuilder sql = new StringBuilder("SELECT PROPERTY_ID, PROPERTY_NAME, PROPERTY_LIST, GOODS_ID FROM bu_goods_property1 WHERE 1 = 1 ");
|
|
|
if (CollectionUtils.isNotEmpty(goodsIds)) {
|
|
|
sql.append("AND GOODS_ID IN ( ");
|
|
|
for (int i = 0; i < goodsIds.size(); i++) {
|
|
|
@@ -915,7 +915,7 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
}
|
|
|
|
|
|
private boolean checkGoodsInSpecialForStore(Long goodsId) {
|
|
|
- String sql = "select count(*) from bu_store_special_goods t LEFT JOIN bu_store_special_activity g on t.STORE_SPECIAL_ACTIVITY_ID = g.STORE_SPECIAL_ACTIVITY_ID WHERE t.GOODS_ID = " + goodsId;
|
|
|
+ String sql = "select count(*) from bu_store_special_goods1 t LEFT JOIN bu_store_special_activity1 g on t.STORE_SPECIAL_ACTIVITY_ID = g.STORE_SPECIAL_ACTIVITY_ID WHERE t.GOODS_ID = " + goodsId;
|
|
|
List<?> list = searchBySql(sql);
|
|
|
boolean rtn = true;
|
|
|
if (list != null && !list.isEmpty() && Long.valueOf(list.get(0).toString()) < 1) {
|
|
|
@@ -925,26 +925,26 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
}
|
|
|
|
|
|
private boolean changeStatusForStore(Long goodsId, Long status, Long storeId) {
|
|
|
- String sql = "update bu_goods set STATUS = " + status + " where GOODS_ID = " + goodsId + " AND STORE_ID = " + storeId;
|
|
|
+ String sql = "update bu_goods1 set STATUS = " + status + " where GOODS_ID = " + goodsId + " AND STORE_ID = " + storeId;
|
|
|
return executeSql(sql) >= 1;
|
|
|
}
|
|
|
|
|
|
private boolean deleteGoodsPropertyByGoodsForStore(Long goodsId) {
|
|
|
- String sql = "delete from bu_goods_property where GOODS_ID = " + goodsId;
|
|
|
+ String sql = "delete from bu_goods_property1 where GOODS_ID = " + goodsId;
|
|
|
return executeSql(sql) == 1;
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
- private List<BuGoods> getGoodsMaxOrderKeyForStore(Long storeId) {
|
|
|
- String hql = "from BuGoods where 1=1 and STORE_ID = " + storeId + " ORDER BY ORDER_KEY DESC ";
|
|
|
+ private List<BuGoods1> getGoodsMaxOrderKeyForStore(Long storeId) {
|
|
|
+ String hql = "from BuGoods1 where 1=1 and STORE_ID = " + storeId + " ORDER BY ORDER_KEY DESC ";
|
|
|
return searchByHql(hql);
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
private List<GoodsTypeBean> getGoodsTypeListForThird(Long storeId) {
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
- sql.append("SELECT t.GOODS_TYPE_ID, t.GOODS_TYPE_NAME, count(w.GOODS_ID), t.TYPE FROM bu_goods_type t ")
|
|
|
- .append("LEFT JOIN bu_goods w on t.GOODS_TYPE_ID = w.GOODS_TYPE_ID ")
|
|
|
+ sql.append("SELECT t.GOODS_TYPE_ID, t.GOODS_TYPE_NAME, count(w.GOODS_ID), t.TYPE FROM bu_goods_type1 t ")
|
|
|
+ .append("LEFT JOIN bu_goods1 w on t.GOODS_TYPE_ID = w.GOODS_TYPE_ID ")
|
|
|
.append("WHERE t.STORE_ID = ").append(storeId)
|
|
|
.append(" AND (w.DEL_FLAG = 0 OR w.DEL_FLAG IS NULL) GROUP BY t.GOODS_TYPE_ID ORDER BY t.ORDER_KEY DESC");
|
|
|
List<Object> list = searchBySql(sql.toString());
|
|
|
@@ -967,8 +967,8 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
private List<GoodsBean> getBeanByStoreId(Long storeId, String searchValue) {
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
sql.append("SELECT T.GOODS_ID, T.GOODS_NAME, T.GOODS_TYPE_ID, T.SALES_COUNT, T.SALE_PRICE, T.COST_PRICE, T.LIMITED_NUM, ");
|
|
|
- sql.append("T.MINI_NUM, T.PICTURE_URL, T.NEW_GOODS_FLG, T.SINGLE_FLG, T.STORE_ID, G.MAX_NUM, T.RMK FROM bu_goods T ")
|
|
|
- .append("LEFT JOIN bu_store_special_goods G ON T.GOODS_ID = G.GOODS_ID WHERE T.STATUS = 1 ");
|
|
|
+ sql.append("T.MINI_NUM, T.PICTURE_URL, T.NEW_GOODS_FLG, T.SINGLE_FLG, T.STORE_ID, G.MAX_NUM, T.RMK FROM bu_goods1 T ")
|
|
|
+ .append("LEFT JOIN bu_store_special_goods1 G ON T.GOODS_ID = G.GOODS_ID WHERE T.STATUS = 1 ");
|
|
|
if (storeId != null) {
|
|
|
sql.append("AND T.STORE_ID = ").append(storeId).append(" ");
|
|
|
}
|
|
|
@@ -1002,19 +1002,19 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
- private List<BuGoodsType> getGoodsTypeForStore(BuGoodsTypeSearchBean searchBean) {
|
|
|
- String hql = "from BuGoodsType where 1=1" + searchBean.getSerchCondition() + " ORDER BY ORDER_KEY DESC";
|
|
|
+ private List<BuGoodsType1> getGoodsTypeForStore(BuGoodsTypeSearchBean searchBean) {
|
|
|
+ String hql = "from BuGoodsType1 where 1=1" + searchBean.getSerchCondition() + " ORDER BY ORDER_KEY DESC";
|
|
|
return searchByHql(hql);
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
- private List<BuGoodsType> getGoodsTypeMaxOrderKeyForStore(Long storeId) {
|
|
|
- String hql = "from BuGoodsType where 1=1 and STORE_ID = " + storeId + " ORDER BY ORDER_KEY DESC ";
|
|
|
+ private List<BuGoodsType1> getGoodsTypeMaxOrderKeyForStore(Long storeId) {
|
|
|
+ String hql = "from BuGoodsType1 where 1=1 and STORE_ID = " + storeId + " ORDER BY ORDER_KEY DESC ";
|
|
|
return searchByHql(hql);
|
|
|
}
|
|
|
|
|
|
private boolean checkGoodsTypeByType(Long storeId, Long goodsTypeId) {
|
|
|
- String sql = "select count(*) from bu_goods_type WHERE 1=1 AND TYPE = 1 AND STORE_ID = " + storeId;
|
|
|
+ String sql = "select count(*) from bu_goods_type1 WHERE 1=1 AND TYPE = 1 AND STORE_ID = " + storeId;
|
|
|
if (goodsTypeId != null) {
|
|
|
sql += " AND GOODS_TYPE_ID <> " + goodsTypeId;
|
|
|
}
|
|
|
@@ -1023,19 +1023,21 @@ public class ThirdStoreGoodsManageCtltestService extends BaseDao {
|
|
|
}
|
|
|
|
|
|
private boolean checkTypeIsUsed(Long goodsTypeId, Long storeId) {
|
|
|
- String sql = "select count(*) from bu_goods WHERE GOODS_TYPE_ID = " + goodsTypeId + " AND STORE_ID = " + storeId;
|
|
|
+ String sql = "select count(*) from bu_goods1 WHERE GOODS_TYPE_ID = " + goodsTypeId + " AND STORE_ID = " + storeId;
|
|
|
List<?> list = searchBySql(sql);
|
|
|
return list != null && !list.isEmpty() && Long.valueOf(list.get(0).toString()) > 0;
|
|
|
}
|
|
|
|
|
|
private boolean deleteTypeByIdForStore(Long goodsTypeId, Long storeId) {
|
|
|
- String sql = "delete from bu_goods_type where GOODS_TYPE_ID = " + goodsTypeId + " AND STORE_ID = " + storeId;
|
|
|
+ String sql = "delete from bu_goods_type1 where GOODS_TYPE_ID = " + goodsTypeId + " AND STORE_ID = " + storeId;
|
|
|
return executeSql(sql) == 1;
|
|
|
}
|
|
|
|
|
|
- private BuGoodsType getGoodsTypeLastForStore(BuGoodsTypeSearchBean searchBean) {
|
|
|
- String hql = "from BuGoodsType where 1=1 " + searchBean.getSerchCondition();
|
|
|
- List<BuGoodsType> list = searchByHql(hql);
|
|
|
+ private BuGoodsType1 getGoodsTypeLastForStore(BuGoodsTypeSearchBean searchBean) {
|
|
|
+ String hql = "from BuGoodsType1 where 1=1 " + searchBean.getSerchCondition();
|
|
|
+ List<BuGoodsType1> list = searchByHql(hql);
|
|
|
return (list != null && !list.isEmpty()) ? list.get(0) : null;
|
|
|
}
|
|
|
-}
|
|
|
+}
|
|
|
+
|
|
|
+
|