|
|
@ -11,6 +11,7 @@ import cn.chjyj.szwh.service.GoodsService; |
|
|
import cn.chjyj.szwh.service.GoodsSourceService; |
|
|
import cn.chjyj.szwh.service.GoodsSourceService; |
|
|
import cn.chjyj.szwh.service.UserService; |
|
|
import cn.chjyj.szwh.service.UserService; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -178,10 +179,11 @@ public class AdminGoodsController extends BaseController { |
|
|
@PostMapping("/addRanking") |
|
|
@PostMapping("/addRanking") |
|
|
public JSONObject addRanking(@RequestBody String rejson){ |
|
|
public JSONObject addRanking(@RequestBody String rejson){ |
|
|
JSONObject json = JSON.parseObject(rejson); |
|
|
JSONObject json = JSON.parseObject(rejson); |
|
|
String goodsIsli= json.getString("goods_isli"); |
|
|
JSONArray array = json.getJSONArray("goods_isli"); |
|
|
String[] goodsarr = goodsIsli.split(","); |
|
|
// 转成list
|
|
|
|
|
|
List<String> goodsarr=array.toJavaList(String.class); |
|
|
|
|
|
log.info(goodsarr); |
|
|
Map mp = goodsService.addRank(goodsarr); |
|
|
Map mp = goodsService.addRank(goodsarr); |
|
|
log.info("add rank :"+goodsIsli); |
|
|
|
|
|
jsonObject.put("code",mp.get("code")); |
|
|
jsonObject.put("code",mp.get("code")); |
|
|
jsonObject.put("msg",mp.get("msg")); |
|
|
jsonObject.put("msg",mp.get("msg")); |
|
|
return jsonObject; |
|
|
return jsonObject; |
|
|
@ -190,8 +192,9 @@ public class AdminGoodsController extends BaseController { |
|
|
@PostMapping("/delRanking") |
|
|
@PostMapping("/delRanking") |
|
|
public JSONObject delRanking(@RequestBody String rejson){ |
|
|
public JSONObject delRanking(@RequestBody String rejson){ |
|
|
JSONObject request = JSON.parseObject(rejson); |
|
|
JSONObject request = JSON.parseObject(rejson); |
|
|
String goods_isli=request.getString("goods_isli"); |
|
|
JSONArray array =request.getJSONArray("goods_isli"); |
|
|
String[] gsarr = goods_isli.split(","); |
|
|
// 转成list
|
|
|
|
|
|
List<String> gsarr=array.toJavaList(String.class); |
|
|
Map mp =goodsService.delRank(gsarr); |
|
|
Map mp =goodsService.delRank(gsarr); |
|
|
jsonObject.put("code",mp.get("code")); |
|
|
jsonObject.put("code",mp.get("code")); |
|
|
jsonObject.put("msg",mp.get("msg")); |
|
|
jsonObject.put("msg",mp.get("msg")); |
|
|
|