| | |
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AdminAcceptData;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel;
|
| | | import com.yeshi.fanli.exception.GoodsClassException;
|
| | | import com.yeshi.fanli.exception.goods.GoodsClassException;
|
| | | import com.yeshi.fanli.service.inter.clazz.GoodsSubClassLabelService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.common.entity.PageEntity;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | /**
|
| | | * 标签列表
|
| | | * |
| | | * @param callback
|
| | | * @param classId
|
| | | * @param pageIndex
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "labelList")
|
| | | public void labelList(String callback, Long classId, int pageIndex, int pageSize, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | | public void labelList(AdminAcceptData acceptData, String callback, Long classId, int pageIndex, int pageSize, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (classId != null && classId == 0)
|
| | | classId = null;
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveLabel")
|
| | | public void save(String callback, GoodsSubClassLabel label, HttpServletRequest request, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(label.getName()) || label.getGoodsClass() == null) {
|
| | | public void save(AdminAcceptData acceptData,String callback, GoodsSubClassLabel label, HttpServletRequest request, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(label.getName()) || label.getGoodsClass() == null || label.getOrderBy() == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("数据不完整"));
|
| | | return;
|
| | | }
|
| | |
| | |
|
| | | label.setCreateTime(new Date());
|
| | | try {
|
| | | goodsSubClassLabelService.addSubClassLabel(label);
|
| | | String[] names = label.getName().replace(",", ",").split(",");
|
| | | int orderBy = label.getOrderBy();
|
| | | for (String name : names) {
|
| | | label.setId(null);
|
| | | label.setOrderBy(orderBy++);
|
| | | label.setName(name);
|
| | | goodsSubClassLabelService.addSubClassLabel(label);
|
| | | }
|
| | | } catch (GoodsClassException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage()));
|
| | | }
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "deleteLabelBatch")
|
| | | public void deleteBatch(String callback, String ids, PrintWriter out) {
|
| | | public void deleteBatch(AdminAcceptData acceptData,String callback, String ids, PrintWriter out) {
|
| | | Gson gson = new Gson();
|
| | | try {
|
| | | List<String> recordIds = gson.fromJson(ids, new TypeToken<ArrayList<String>>() {
|