商品审核BUG修改

This commit is contained in:
1215525055@qq.com 2025-06-04 16:05:14 +08:00
parent cba0fe09f3
commit 15bd0c2292
6 changed files with 84 additions and 15 deletions

View File

@ -40,6 +40,13 @@ public class GoodsController extends DefaultBaseController {
@Autowired @Autowired
private IGoodsService goodsService; private IGoodsService goodsService;
@ApiOperation(value = "置顶", notes = "置顶接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update-top/{goodsIds}")
public SuccessResult updateTop(@PathVariable("goodsIds") String goodsIds) {
return goodsService.updateFlag(Arrays.asList(goodsIds.split("\\_")), "置顶");
}
@ApiOperation(value = "今日特价", notes = "今日特价接口") @ApiOperation(value = "今日特价", notes = "今日特价接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update-flag/{goodsIds}") @PutMapping("update-flag/{goodsIds}")

View File

@ -57,8 +57,19 @@ public class GoodsonlineServiceImpl extends DefaultBaseService implements IGoods
params.put("goodsTypes", Arrays.asList(params.get("goodsType").toString().split(","))); params.put("goodsTypes", Arrays.asList(params.get("goodsType").toString().split(",")));
params.put("goodsType", ""); params.put("goodsType", "");
} }
List<GoodsSimpleDTO> goodsDTOs = new ArrayList<>();
if (params.get("goodsFlag") != null && params.get("goodsFlag").toString().equals("置顶")) {
PageHelper.startPage(1, 1);
goodsDTOs = goodsonlineDao.listPageAll(page.getParams());
if(goodsDTOs.size() < 1) {
params.put("goodsFlag", "特价");
goodsDTOs = goodsonlineDao.listPageAll(page.getParams());
}
}else{
PageHelper.startPage(page.getPage(), page.getRows()); PageHelper.startPage(page.getPage(), page.getRows());
List<GoodsSimpleDTO> goodsDTOs = goodsonlineDao.listPageAll(page.getParams()); goodsDTOs = goodsonlineDao.listPageAll(page.getParams());
}
for(GoodsSimpleDTO dto : goodsDTOs) { for(GoodsSimpleDTO dto : goodsDTOs) {
if(!StringUtils.isEmpty(dto.getGoodsDevelop())) { if(!StringUtils.isEmpty(dto.getGoodsDevelop())) {
DataDTO dataDTO1 = iDataService.get(dto.getGoodsDevelop()); DataDTO dataDTO1 = iDataService.get(dto.getGoodsDevelop());
@ -66,7 +77,20 @@ public class GoodsonlineServiceImpl extends DefaultBaseService implements IGoods
dto.setGoodsDevelop(dataDTO1.getDataName()); dto.setGoodsDevelop(dataDTO1.getDataName());
} }
} }
if ("1".equals(dto.getGoodsGetType())) { if(!StringUtils.isEmpty(dto.getGoodsType())) {
String[] arr = dto.getGoodsType().split(",");
String[] arr1 = new String[arr.length];
int index = 0;
for(String a : arr) {
DataDTO dataDTO1 = iDataService.get(a);
if (dataDTO1 != null) {
arr1[index] = dataDTO1.getDataName();
index++;
}
}
dto.setGoodsTypeName(StringUtils.join(arr1, ""));
}
/* if ("1".equals(dto.getGoodsGetType())) {
dto.setGoodsGetType("原始取得"); dto.setGoodsGetType("原始取得");
}else if ("2".equals(dto.getGoodsGetType())) { }else if ("2".equals(dto.getGoodsGetType())) {
dto.setGoodsGetType("继受取得(受让)"); dto.setGoodsGetType("继受取得(受让)");
@ -74,7 +98,7 @@ public class GoodsonlineServiceImpl extends DefaultBaseService implements IGoods
dto.setGoodsGetType("继受取得(继承)"); dto.setGoodsGetType("继受取得(继承)");
}else if ("4".equals(dto.getGoodsGetType())) { }else if ("4".equals(dto.getGoodsGetType())) {
dto.setGoodsGetType("继受取得(承受)"); dto.setGoodsGetType("继受取得(承受)");
} }*/
} }
PageInfo<GoodsSimpleDTO> pageInfo = new PageInfo<>(goodsDTOs); PageInfo<GoodsSimpleDTO> pageInfo = new PageInfo<>(goodsDTOs);
return new SuccessResultList<>(goodsDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); return new SuccessResultList<>(goodsDTOs, pageInfo.getPageNum(), pageInfo.getTotal());

View File

@ -487,6 +487,9 @@
<if test="goodsFlag != null and goodsFlag != ''"> <if test="goodsFlag != null and goodsFlag != ''">
AND t1.goods_flag LIKE CONCAT('%', #{goodsFlag}, '%') AND t1.goods_flag LIKE CONCAT('%', #{goodsFlag}, '%')
</if> </if>
<if test="goodsFlagIsNull != null and goodsFlagIsNull != '' ">
AND t1.goods_flag = ''
</if>
<if test="goodsType != null and goodsType != ''"> <if test="goodsType != null and goodsType != ''">
AND t1.goods_type LIKE CONCAT('%', #{goodsType}, '%') AND t1.goods_type LIKE CONCAT('%', #{goodsType}, '%')
</if> </if>
@ -496,9 +499,6 @@
t1.goods_type LIKE CONCAT('%', #{goodsTypes[${index}]}, '%') t1.goods_type LIKE CONCAT('%', #{goodsTypes[${index}]}, '%')
</foreach> </foreach>
</if> </if>
<if test="goodsFlag != null and goodsFlag != ''">
AND t1.goods_flag = #{goodsFlag}
</if>
<if test="keywords != null and keywords != ''"> <if test="keywords != null and keywords != ''">
AND ( AND (
t2.user_username LIKE CONCAT('%', #{keywords}, '%') t2.user_username LIKE CONCAT('%', #{keywords}, '%')

View File

@ -206,14 +206,9 @@
t1.goods_status_time, t1.goods_status_time,
t1.goods_vnumber, t1.goods_vnumber,
t1.goodsonline_id, t1.goodsonline_id,
t3.goods_flag, t3.goods_flag
t2.data_name AS goods_type_name
FROM FROM
shop_goodsonline t1 shop_goodsonline t1
LEFT JOIN
data_data t2
ON
t1.goods_type = t2.data_id
INNER JOIN INNER JOIN
( (
SELECT t2.goods_id, MAX(t2.goods_vnumber) AS v FROM shop_goodsonline t2 WHERE t2.is_delete = 0 AND t2.goods_status = 1 AND t2.goods_check_status = 2 GROUP BY t2.goods_id SELECT t2.goods_id, MAX(t2.goods_vnumber) AS v FROM shop_goodsonline t2 WHERE t2.is_delete = 0 AND t2.goods_status = 1 AND t2.goods_check_status = 2 GROUP BY t2.goods_id
@ -232,6 +227,9 @@
<if test="goodsFlag != null and goodsFlag != ''"> <if test="goodsFlag != null and goodsFlag != ''">
AND t3.goods_flag LIKE CONCAT('%', #{goodsFlag}, '%') AND t3.goods_flag LIKE CONCAT('%', #{goodsFlag}, '%')
</if> </if>
<if test="goodsFlagIsNull != null and goodsFlagIsNull != '' ">
AND t3.goods_flag = ''
</if>
<if test="notUserId != null and notUserId != ''"> <if test="notUserId != null and notUserId != ''">
AND t1.creator != #{notUserId} AND t1.creator != #{notUserId}
</if> </if>
@ -270,6 +268,11 @@
</if> </if>
ORDER BY ORDER BY
t1.goods_vnumber DESC , t1.goods_vnumber DESC ,
CASE
WHEN FIND_IN_SET('置顶', t3.goods_flag) > 0 THEN 0
WHEN FIND_IN_SET('特价', t3.goods_flag) > 0 THEN 1
ELSE 2
END ,
<if test="priceOrder != null and priceOrder != '' and priceOrder == 'DESC'"> <if test="priceOrder != null and priceOrder != '' and priceOrder == 'DESC'">
t1.goods_open_price DESC , t1.goods_open_price DESC ,
</if> </if>

View File

@ -180,10 +180,10 @@
</div> </div>
<div class="layui-col-lg6"> <div class="layui-col-lg6">
<div class="layui-form-item" pane=""> <div class="layui-form-item" pane="">
<label class="layui-form-label">是否特价</label> <label class="layui-form-label">商品标签</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="checkbox" name="goodsFlag[特价]" title="今日特价"> <input type="checkbox" name="goodsFlag[特价]" title="今日特价">
<input type="checkbox" name="goodsFlag[]" title="非特价"> <input type="checkbox" name="goodsFlag[置顶]" title="置顶">
</div> </div>
</div> </div>
</div> </div>

View File

@ -40,6 +40,7 @@
<select id="goodsFlag" name="goodsFlag"> <select id="goodsFlag" name="goodsFlag">
<option value="">请选择</option> <option value="">请选择</option>
<option value="特价">今日特价</option> <option value="特价">今日特价</option>
<option value="置顶">置顶</option>
</select> </select>
</div> </div>
<div class="layui-inline layui-form search-item" > <div class="layui-inline layui-form search-item" >
@ -89,6 +90,9 @@
<button type="button" class="layui-btn layui-btn-sm" lay-event="teJiaEvent"> <button type="button" class="layui-btn layui-btn-sm" lay-event="teJiaEvent">
<i class="fa fa-lg fa-star"></i> 设置今日特价 <i class="fa fa-lg fa-star"></i> 设置今日特价
</button> </button>
<button type="button" class="layui-btn layui-btn-sm" lay-event="zhiDingEvent">
<i class="fa fa-lg fa-star"></i> 设置置顶
</button>
</div> </div>
</script> </script>
</div> </div>
@ -524,6 +528,37 @@
} }
}); });
} }
} else if(layEvent === 'zhiDingEvent') {
if(checkDatas.length === 0) {
top.dialog.msg("至少选择一个软著商品");
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['goodsId'];
}
top.dialog.msg("确定改变这些商品的置顶状态?", {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
var layIndex;
top.restAjax.put(top.restAjax.path('api/goods/update-top/{goodsIds}', [ids]), {}, null, function (code, data) {
top.dialog.msg("修改完成", {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg("上架中...", {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
} else if(layEvent === 'downEvent') { } else if(layEvent === 'downEvent') {
if(checkDatas.length === 0) { if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit); top.dialog.msg(top.dataMessage.table.selectEdit);