记得上下班打卡 | git大法好,push需谨慎

Commit 662ee554 authored by 张国柄's avatar 张国柄

~admin:分类重复校验逻辑调整;

~API:下架商品+更新上架处理方式为手动上架除阿里;
parent 86efde6d
...@@ -48,7 +48,7 @@ public class GoblinSelfCategoryAdminController extends BaseController { ...@@ -48,7 +48,7 @@ public class GoblinSelfCategoryAdminController extends BaseController {
@ResponseBody @ResponseBody
public TableDataInfo list() { public TableDataInfo list() {
PageHelper.startPage(0, 1000, "mid"); PageHelper.startPage(0, 1000, "mid");
return getDataTable(goblinSelfGoodsCategoryService.listForForMultiGrade()); return getDataTable(goblinSelfGoodsCategoryService.listForMultiGrade());
} }
@ApiOperation(value = "筛选") @ApiOperation(value = "筛选")
...@@ -115,6 +115,11 @@ public class GoblinSelfCategoryAdminController extends BaseController { ...@@ -115,6 +115,11 @@ public class GoblinSelfCategoryAdminController extends BaseController {
switch (grade) { switch (grade) {
case "1": case "1":
selfGoodsCategory.setCatePid(null); selfGoodsCategory.setCatePid(null);
queryWrapper.eq(GoblinSelfGoodsCategory::getGrade, "1");
queryWrapper.eq(GoblinSelfGoodsCategory::getName, name.trim());
if (goblinSelfGoodsCategoryService.count(queryWrapper) > 0) {
return AjaxResult.warn("分类名称重复,请核实");
}
break; break;
case "2": case "2":
queryWrapper.eq(GoblinSelfGoodsCategory::getCateId, catePid).eq(GoblinSelfGoodsCategory::getGrade, "1"); queryWrapper.eq(GoblinSelfGoodsCategory::getCateId, catePid).eq(GoblinSelfGoodsCategory::getGrade, "1");
...@@ -122,6 +127,12 @@ public class GoblinSelfCategoryAdminController extends BaseController { ...@@ -122,6 +127,12 @@ public class GoblinSelfCategoryAdminController extends BaseController {
if (null == catePidObj) { if (null == catePidObj) {
return AjaxResult.warn("父级分类无效"); return AjaxResult.warn("父级分类无效");
} }
if (catePidObj.getName().equals(name.trim())) {
return AjaxResult.warn("分类名称与父级分类重复,请核实");
}
if (goblinSelfGoodsCategoryService.countForMatchName(catePid, name.trim()) > 0) {
return AjaxResult.warn("分类名称重复,请核实");
}
break; break;
case "3": case "3":
queryWrapper.eq(GoblinSelfGoodsCategory::getCateId, catePid).eq(GoblinSelfGoodsCategory::getGrade, "2"); queryWrapper.eq(GoblinSelfGoodsCategory::getCateId, catePid).eq(GoblinSelfGoodsCategory::getGrade, "2");
...@@ -129,16 +140,16 @@ public class GoblinSelfCategoryAdminController extends BaseController { ...@@ -129,16 +140,16 @@ public class GoblinSelfCategoryAdminController extends BaseController {
if (null == catePidObj) { if (null == catePidObj) {
return AjaxResult.warn("父级分类无效"); return AjaxResult.warn("父级分类无效");
} }
if (catePidObj.getName().equals(name.trim())) {
return AjaxResult.warn("分类名称与父级分类重复,请核实");
}
if (goblinSelfGoodsCategoryService.countForMatchName(catePidObj.getCatePid(), name.trim()) > 0) {
return AjaxResult.warn("分类名称重复,请核实");
}
break; break;
default: default:
return AjaxResult.warn("分类层级无效"); return AjaxResult.warn("分类层级无效");
} }
queryWrapper.clear();
queryWrapper.eq(GoblinSelfGoodsCategory::getDelFlg, "0");
queryWrapper.eq(GoblinSelfGoodsCategory::getName, name.trim());
if (goblinSelfGoodsCategoryService.count(queryWrapper) > 0) {
return AjaxResult.warn("分类名称重复,请核实");
}
selfGoodsCategory.setCateId(IDGenerator.nextMilliId2()); selfGoodsCategory.setCateId(IDGenerator.nextMilliId2());
selfGoodsCategory.setDelFlg("0"); selfGoodsCategory.setDelFlg("0");
......
...@@ -16,7 +16,9 @@ import java.util.List; ...@@ -16,7 +16,9 @@ import java.util.List;
*/ */
public interface IGoblinSelfGoodsCategoryService extends IService<GoblinSelfGoodsCategory> { public interface IGoblinSelfGoodsCategoryService extends IService<GoblinSelfGoodsCategory> {
List<GoblinSelfGoodsCategoryDto> listForForMultiGrade(); int countForMatchName(String cateFid, String name);
List<GoblinSelfGoodsCategoryDto> listForMultiGrade();
boolean addSave(GoblinSelfGoodsCategory selfGoodsCategory); boolean addSave(GoblinSelfGoodsCategory selfGoodsCategory);
......
...@@ -46,9 +46,14 @@ public class GoblinSelfGoodsCategoryServiceImpl extends ServiceImpl<GoblinSelfGo ...@@ -46,9 +46,14 @@ public class GoblinSelfGoodsCategoryServiceImpl extends ServiceImpl<GoblinSelfGo
private RedisDataSourceUtil redisDataSourceUtil; private RedisDataSourceUtil redisDataSourceUtil;
@Override @Override
public List<GoblinSelfGoodsCategoryDto> listForForMultiGrade() { public int countForMatchName(String cateFid, String name) {
return goblinSelfGoodsCategoryMapper.countForMatchName(cateFid, name);
}
@Override
public List<GoblinSelfGoodsCategoryDto> listForMultiGrade() {
goblinSelfGoodsCategoryMapper.statsForForMultiGrade(); goblinSelfGoodsCategoryMapper.statsForForMultiGrade();
List<GoblinSelfGoodsCategoryDto> dtos = goblinSelfGoodsCategoryMapper.listForForMultiGrade(); List<GoblinSelfGoodsCategoryDto> dtos = goblinSelfGoodsCategoryMapper.listForMultiGrade();
if (!CollectionUtils.isEmpty(dtos)) { if (!CollectionUtils.isEmpty(dtos)) {
dtos.forEach(dto -> { dtos.forEach(dto -> {
if (StringUtils.isNotEmpty(dto.getTcateId())) { if (StringUtils.isNotEmpty(dto.getTcateId())) {
......
...@@ -28,43 +28,61 @@ public interface GoblinSelfGoodsCategoryMapper extends BaseMapper<GoblinSelfGood ...@@ -28,43 +28,61 @@ public interface GoblinSelfGoodsCategoryMapper extends BaseMapper<GoblinSelfGood
// ) t ON t.cate_id=gsgc.cate_id // ) t ON t.cate_id=gsgc.cate_id
//SET gsgc.counts=t.ct //SET gsgc.counts=t.ct
//WHERE gsgc.del_flg='0' //WHERE gsgc.del_flg='0'
@Update("UPDATE goblin_self_goods_category gsgc\n" + @Update("UPDATE goblin_self_goods_category gsgc " +
"INNER JOIN (\n" + "INNER JOIN (" +
" SELECT cate_fid cate_id,count(1) ct FROM goblin_goods WHERE cate_fid IS NOT NULL AND del_flg='0' group by cate_fid\n" + " SELECT cate_fid cate_id,count(1) ct FROM goblin_goods WHERE cate_fid IS NOT NULL AND del_flg='0' group by cate_fid " +
" UNION ALL\n" + " UNION ALL " +
" SELECT cate_sid cate_id,count(1) ct FROM goblin_goods WHERE cate_sid IS NOT NULL AND del_flg='0' group by cate_sid\n" + " SELECT cate_sid cate_id,count(1) ct FROM goblin_goods WHERE cate_sid IS NOT NULL AND del_flg='0' group by cate_sid " +
" UNION ALL\n" + " UNION ALL " +
" SELECT cate_tid cate_id,count(1) ct FROM goblin_goods WHERE cate_tid IS NOT NULL AND del_flg='0' group by cate_tid\n" + " SELECT cate_tid cate_id,count(1) ct FROM goblin_goods WHERE cate_tid IS NOT NULL AND del_flg='0' group by cate_tid " +
" ) t ON t.cate_id=gsgc.cate_id\n" + " ) t ON t.cate_id=gsgc.cate_id " +
"SET gsgc.counts=t.ct\n" + "SET gsgc.counts=t.ct " +
"WHERE gsgc.del_flg='0'") "WHERE gsgc.del_flg='0'")
int statsForForMultiGrade(); int statsForForMultiGrade();
// SELECT cf.cate_id AS fcateId, cf.name AS fname, cf.icon AS ficon, cf.ne_isbn AS fneIsbn, cf.counts AS fcounts , cs.cate_id AS scateId, cs.name AS sname, cs.icon AS sicon, cs.ne_isbn AS sneIsbn, cs.counts AS scounts , ct.cate_id AS tcateId, ct.name AS tname, ct.icon AS ticon, ct.ne_isbn AS tneIsbn, ct.counts AS tcounts FROM goblin_self_goods_category cf LEFT JOIN ( SELECT cate_id, name, icon, grade, ne_isbn , counts, cate_pid FROM goblin_self_goods_category WHERE grade = '2' AND del_flg = '0' ) cs ON cs.cate_pid = cf.cate_id LEFT JOIN ( SELECT cate_id, name, icon, grade, ne_isbn , counts, cate_pid FROM goblin_self_goods_category WHERE grade = '3' AND del_flg = '0' ) ct ON ct.cate_pid = cs.cate_id WHERE cf.grade = '1' AND del_flg = '0' // SELECT cf.cate_id AS fcateId, cf.name AS fname, cf.icon AS ficon, cf.ne_isbn AS fneIsbn, cf.counts AS fcounts , cs.cate_id AS scateId, cs.name AS sname, cs.icon AS sicon, cs.ne_isbn AS sneIsbn, cs.counts AS scounts , ct.cate_id AS tcateId, ct.name AS tname, ct.icon AS ticon, ct.ne_isbn AS tneIsbn, ct.counts AS tcounts FROM goblin_self_goods_category cf LEFT JOIN ( SELECT cate_id, name, icon, grade, ne_isbn , counts, cate_pid FROM goblin_self_goods_category WHERE grade = '2' AND del_flg = '0' ) cs ON cs.cate_pid = cf.cate_id LEFT JOIN ( SELECT cate_id, name, icon, grade, ne_isbn , counts, cate_pid FROM goblin_self_goods_category WHERE grade = '3' AND del_flg = '0' ) ct ON ct.cate_pid = cs.cate_id WHERE cf.grade = '1' AND del_flg = '0'
@Select({"select cf.cate_id fcateId,\n" + @Select({"select cf.cate_id fcateId," +
" cf.name fname,\n" + " cf.name fname," +
" cf.icon ficon,\n" + " cf.icon ficon," +
" cf.ne_isbn fneIsbn,\n" + " cf.ne_isbn fneIsbn," +
" cf.counts fcounts,\n" + " cf.counts fcounts," +
" cs.cate_id scateId,\n" + " cs.cate_id scateId," +
" cs.name sname,\n" + " cs.name sname," +
" cs.icon sicon,\n" + " cs.icon sicon," +
" cs.ne_isbn sneIsbn,\n" + " cs.ne_isbn sneIsbn," +
" cs.counts scounts,\n" + " cs.counts scounts," +
" ct.cate_id tcateId,\n" + " ct.cate_id tcateId," +
" ct.name tname,\n" + " ct.name tname," +
" ct.icon ticon,\n" + " ct.icon ticon," +
" ct.ne_isbn tneIsbn,\n" + " ct.ne_isbn tneIsbn," +
" ct.counts tcounts\n" + " ct.counts tcounts " +
"from goblin_self_goods_category cf\n" + "from goblin_self_goods_category cf " +
" left join (\n" + " left join (" +
" select cate_id, name, icon, grade, ne_isbn, counts, cate_pid from goblin_self_goods_category where grade = '2' and del_flg = '0'\n" + " select cate_id, name, icon, grade, ne_isbn, counts, cate_pid from goblin_self_goods_category where grade = '2' and del_flg = '0' " +
") cs on cs.cate_pid = cf.cate_id\n" + ") cs on cs.cate_pid = cf.cate_id " +
" left join (\n" + " left join (" +
" select cate_id, name, icon, grade, ne_isbn, counts, cate_pid from goblin_self_goods_category where grade = '3' and del_flg = '0'\n" + " select cate_id, name, icon, grade, ne_isbn, counts, cate_pid from goblin_self_goods_category where grade = '3' and del_flg = '0' " +
") ct on ct.cate_pid = cs.cate_id\n" + ") ct on ct.cate_pid = cs.cate_id " +
"where cf.grade = '1' and del_flg = '0'"}) "where cf.grade = '1' and del_flg = '0'"})
List<GoblinSelfGoodsCategoryDto> listForForMultiGrade(); List<GoblinSelfGoodsCategoryDto> listForMultiGrade();
List<String> listForMultiGradeCateId(@Param("cateIdArr") String[] cateIdArr); List<String> listForMultiGradeCateId(@Param("cateIdArr") String[] cateIdArr);
// SELECT count(1) AS ct FROM ( SELECT gsgc2.cate_id, gsgc2.name, gsgc2.grade, gsgc2.cate_pid FROM goblin_self_goods_category gsgc2 WHERE gsgc2.del_flg = '0' AND gsgc2.cate_pid = '2268131118729' AND gsgc2.name = 'CD' UNION SELECT gsgc3.cate_id, gsgc3.name, gsgc3.grade, gsgc3.cate_pid FROM goblin_self_goods_category gsgc2 LEFT JOIN goblin_self_goods_category gsgc3 ON gsgc2.cate_id = gsgc3.cate_pid AND gsgc3.grade = '3' WHERE gsgc2.del_flg = '0' AND gsgc2.cate_pid = '2268131118729' AND gsgc3.name = 'CD' ) t
@Select({"select count(1) ct " +
"from (" +
" SELECT gsgc2.cate_id, gsgc2.name, gsgc2.grade, gsgc2.cate_pid " +
" from goblin_self_goods_category gsgc2 " +
" where gsgc2.del_flg = '0' " +
" and gsgc2.cate_pid = #{cateFid} " +
" and gsgc2.name = #{name} " +
" union " +
" SELECT gsgc3.cate_id, gsgc3.name, gsgc3.grade, gsgc3.cate_pid " +
" from goblin_self_goods_category gsgc2 " +
" left join goblin_self_goods_category gsgc3 on gsgc2.cate_id = gsgc3.cate_pid and gsgc3.grade = '3' " +
" where gsgc2.del_flg = '0' " +
" and gsgc2.cate_pid = #{cateFid} " +
" and gsgc3.name = #{name} " +
" ) t"})
int countForMatchName(@Param("cateFid") String cateFid, @Param("name") String name);
} }
...@@ -895,10 +895,16 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -895,10 +895,16 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
}); });
LinkedList<String> toMqSqls = CollectionUtil.linkedListString(); LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_goods.update_by_shelves"));
LinkedList<Object[]> updateGoodsObjs = CollectionUtil.linkedListObjectArr();
String shelvesStatus = shelvesFlg ? "3" : "1"; String shelvesStatus = shelvesFlg ? "3" : "1";
spuIdList.forEach(spuId -> updateGoodsObjs.add(new Object[]{shelvesStatus, now, uid, now, spuId, storeId})); LinkedList<Object[]> updateGoodsObjs = CollectionUtil.linkedListObjectArr();
if (shelvesFlg) {
toMqSqls.add(SqlMapping.get("goblin_goods.update_by_shelves"));
spuIdList.forEach(spuId -> updateGoodsObjs.add(new Object[]{shelvesStatus, now, uid, now, spuId, storeId}));
} else {
toMqSqls.add(SqlMapping.get("goblin_goods.update_by_unshelves"));
spuIdList.forEach(spuId -> updateGoodsObjs.add(new Object[]{"1", shelvesStatus, now, uid, now, spuId, storeId}));
}
toMqSqls.add(SqlMapping.get("goblin_goods_sku.update_by_shelves")); toMqSqls.add(SqlMapping.get("goblin_goods_sku.update_by_shelves"));
LinkedList<Object[]> updateGoodsSkuObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> updateGoodsSkuObjs = CollectionUtil.linkedListObjectArr();
spuIdList.forEach(spuId -> updateGoodsSkuObjs.add(new Object[]{shelvesStatus, now, uid, now, spuId, storeId})); spuIdList.forEach(spuId -> updateGoodsSkuObjs.add(new Object[]{shelvesStatus, now, uid, now, spuId, storeId}));
......
...@@ -510,8 +510,12 @@ public class GoblinMongoUtils { ...@@ -510,8 +510,12 @@ public class GoblinMongoUtils {
} }
public boolean updateGoodsInfoVoByShelves(String storeId, List<String> spuIdList, boolean shelvesFlg, String uid, LocalDateTime time) { public boolean updateGoodsInfoVoByShelves(String storeId, List<String> spuIdList, boolean shelvesFlg, String uid, LocalDateTime time) {
Update update = Update.update("shelvesStatus", shelvesFlg ? "3" : "1").set("shelvesAt", time).set("updatedBy", uid).set("updatedAt", time);
if (!shelvesFlg) {
update.set("shelvesHandle", "1");
}
return mongoTemplate.updateMulti(Query.query(Criteria.where("storeId").is(storeId).and("spuId").in(spuIdList.toArray())), return mongoTemplate.updateMulti(Query.query(Criteria.where("storeId").is(storeId).and("spuId").in(spuIdList.toArray())),
Update.update("shelvesStatus", shelvesFlg ? "3" : "1").set("shelvesAt", time).set("updatedBy", uid).set("updatedAt", time), update,
GoblinGoodsInfoVo.class.getSimpleName()).getModifiedCount() > 0; GoblinGoodsInfoVo.class.getSimpleName()).getModifiedCount() > 0;
} }
......
...@@ -36,7 +36,8 @@ goblin_goods_sku_spec_value.update_by_del_sku=UPDATE goblin_goods_sku_spec_value ...@@ -36,7 +36,8 @@ goblin_goods_sku_spec_value.update_by_del_sku=UPDATE goblin_goods_sku_spec_value
#---- 商品信息 #---- 商品信息
goblin_goods.insert=INSERT INTO goblin_goods (spu_id,spu_no,name,subtitle,sell_price, price_ge,price_le,intro,details,cover_pic, video,spec_mode,store_id,cate_fid,cate_sid, cate_tid,store_cate_fid,store_cate_sid,store_cate_tid,brand_id, shelves_handle,shelves_time,spu_validity,virtual_flg,status, shelves_status,spu_appear,shelves_at,created_by,created_at, logistics_template)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) goblin_goods.insert=INSERT INTO goblin_goods (spu_id,spu_no,name,subtitle,sell_price, price_ge,price_le,intro,details,cover_pic, video,spec_mode,store_id,cate_fid,cate_sid, cate_tid,store_cate_fid,store_cate_sid,store_cate_tid,brand_id, shelves_handle,shelves_time,spu_validity,virtual_flg,status, shelves_status,spu_appear,shelves_at,created_by,created_at, logistics_template)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin_goods.update_by_edit=UPDATE goblin_goods SET spu_no=?,name=?,subtitle=?,sell_price=?,intro=?,details=?,cover_pic=?,video=?,spec_mode=?,cate_fid=?,cate_sid=?,cate_tid=?,shelves_handle=?,shelves_time=?,spu_validity=?,virtual_flg=?,logistics_template=?,updated_by=?,updated_at=? WHERE spu_id=? AND del_flg='0' goblin_goods.update_by_edit=UPDATE goblin_goods SET spu_no=?,name=?,subtitle=?,sell_price=?,intro=?,details=?,cover_pic=?,video=?,spec_mode=?,cate_fid=?,cate_sid=?,cate_tid=?,shelves_handle=?,shelves_time=?,spu_validity=?,virtual_flg=?,logistics_template=?,updated_by=?,updated_at=? WHERE spu_id=? AND del_flg='0'
goblin_goods.update_by_shelves=UPDATE goblin_goods SET shelves_status=?,shelves_at=?,updated_by=?,updated_at=? WHERE spu_id=? AND store_id=? AND spu_appear='0' goblin_goods.update_by_shelves=UPDATE goblin_goods SET shelves_status=?,shelves_at=?,updated_by=?,updated_at=? WHERE spu_id=? AND store_id=? AND spu_appear='0'
goblin_goods.update_by_unshelves=UPDATE goblin_goods SET shelves_handle=?,shelves_status=?,shelves_at=?,updated_by=?,updated_at=? WHERE spu_id=? AND store_id=? AND spu_appear='0'
goblin_goods.update_by_status=UPDATE goblin_goods SET spu_appear=?,updated_by=?,updated_at=? WHERE store_id=? AND del_flg='0' goblin_goods.update_by_status=UPDATE goblin_goods SET spu_appear=?,updated_by=?,updated_at=? WHERE store_id=? AND del_flg='0'
goblin_goods.update_by_edit_sku=UPDATE goblin_goods SET price_ge=?,price_le=?,updated_by=?,updated_at=? WHERE spu_id=? AND del_flg='0' goblin_goods.update_by_edit_sku=UPDATE goblin_goods SET price_ge=?,price_le=?,updated_by=?,updated_at=? WHERE spu_id=? AND del_flg='0'
goblin_goods.update_by_del_sku=UPDATE goblin_goods SET price_ge=?,price_le=?,updated_by=?,updated_at=? WHERE spu_id=? AND del_flg='0' goblin_goods.update_by_del_sku=UPDATE goblin_goods SET price_ge=?,price_le=?,updated_by=?,updated_at=? WHERE spu_id=? AND del_flg='0'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment