| package com.xzx.gc.system.controller;  | 
|   | 
| import com.xzx.gc.common.Result;  | 
| import com.xzx.gc.common.constant.CommonEnum;  | 
| import com.xzx.gc.common.constant.Constants;  | 
| import com.xzx.gc.common.constant.OrderEnum;  | 
| import com.xzx.gc.common.dto.log.OperationAppLog;  | 
| import com.xzx.gc.common.request.BaseController;  | 
| import com.xzx.gc.common.utils.BusinessUtil;  | 
| import com.xzx.gc.entity.CityPartner;  | 
| import com.xzx.gc.entity.PackageGoodsInfo;  | 
| import com.xzx.gc.model.JsonResult;  | 
| import com.xzx.gc.model.admin.ItemModel;  | 
| import com.xzx.gc.system.service.AddressLevelService;  | 
| import com.xzx.gc.system.service.CityPartnerService;  | 
| import com.xzx.gc.system.service.PackageGoodsInfoService;  | 
| import com.xzx.gc.util.PreventManyCommit;  | 
| import io.swagger.annotations.Api;  | 
| import io.swagger.annotations.ApiImplicitParam;  | 
| import io.swagger.annotations.ApiImplicitParams;  | 
| import io.swagger.annotations.ApiOperation;  | 
| import org.springframework.beans.factory.annotation.Autowired;  | 
| import org.springframework.web.bind.annotation.PostMapping;  | 
| import org.springframework.web.bind.annotation.RequestBody;  | 
| import org.springframework.web.bind.annotation.RestController;  | 
|   | 
| import javax.servlet.http.HttpServletRequest;  | 
| import java.util.HashMap;  | 
| import java.util.List;  | 
| import java.util.Map;  | 
|   | 
| /**  | 
|  * @author :zz  | 
|  */  | 
| @RestController  | 
| @Api(tags = {"打包站分类管理"})  | 
| public class PackageGoodsController extends BaseController {  | 
|   | 
|     @Autowired  | 
|     private PackageGoodsInfoService packageGoodsInfoService;  | 
|   | 
|     @Autowired  | 
|     private AddressLevelService addressLevelService;  | 
|   | 
|     @Autowired  | 
|     private CityPartnerService cityPartnerService;  | 
|   | 
|     @Autowired  | 
|     private BusinessUtil businessUtil;  | 
|   | 
|     @PostMapping("/packageGoods/list")  | 
|     @ApiOperation(value = "查询所有分类")  | 
|     public Result<List<PackageGoodsInfo>> list(HttpServletRequest request){  | 
|         String userId = getUserId(request);  | 
|         CityPartner byuserId = cityPartnerService.findByUserId(userId, OrderEnum.打包站.getValue());  | 
|         if(byuserId!=null){  | 
|             List<PackageGoodsInfo> byPackageId = packageGoodsInfoService.findByPackageId(byuserId.getId().toString());  | 
|             for (PackageGoodsInfo packageGoodsInfo : byPackageId) {  | 
|                     packageGoodsInfo.setPrice(businessUtil.changeMoney(packageGoodsInfo.getPrice()));  | 
|                     packageGoodsInfo.setSecondPrice(businessUtil.changeMoney(packageGoodsInfo.getSecondPrice()));  | 
|                     packageGoodsInfo.setPutStoragePrice(businessUtil.changeMul(packageGoodsInfo.getPutStoragePrice()));  | 
|             }  | 
|   | 
|             return Result.success(byPackageId);  | 
|         }  | 
|         return Result.success(null);  | 
|     }  | 
|   | 
|     /**  | 
|      * 查询  | 
|      * @param item  | 
|      * @return  | 
|      */  | 
|     @PostMapping( "/admin/front/packageGoods/queryPackageOperaIteml.do")  | 
|     @ApiOperation(value="运营管理-打包站分类管理", notes="test: 仅0有正确返回")  | 
|     @ApiImplicitParams({  | 
|             @ApiImplicitParam(paramType="query", name = "pageNum", value = "页码", required = true, dataType = "int"),  | 
|             @ApiImplicitParam(paramType="query", name = "limitNum", value = "每页条数", required = true, dataType = "int"),  | 
|             @ApiImplicitParam(paramType="query", name = "title", value = "大类名称", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "parentId", value = "大类类别Id", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "packageId", value = "打包站Id", required = true, dataType = "String")  | 
|     })  | 
|     public JsonResult<Map<String, Object>> queryPackageOperaIteml(@RequestBody ItemModel item){  | 
|         Map<String, Object> map = packageGoodsInfoService.queryPackageOperaIteml(item);  | 
|         return JsonResult.success(map);  | 
|     }  | 
|   | 
|     @PostMapping( "/admin/front/packageGoods/queryCityByPartnerId.do")  | 
|     @ApiOperation(value="运营管理-根据用户Id查询所有城市", notes="test: 仅0有正确返回")  | 
|     public JsonResult<Map<String, Object>> queryCityByPartnerId(){  | 
|         List<Map<String, Object>> list = addressLevelService.queryCityByPartnerId();  | 
|         Map<String, Object>  map = new HashMap<>();  | 
|         map.put("code",0);  | 
|         map.put("data",list);  | 
|         map.put("msg","成功");  | 
|         return JsonResult.success(map);  | 
|     }  | 
|   | 
|     /**  | 
|      * 查询  | 
|      * @param item  | 
|      * @return  | 
|      */  | 
|     @PostMapping( "/admin/front/packageGoods/addPackageOperateParent.json")  | 
|     @ApiOperation(value="运营管理-添加打包站物品(添加分类)", notes="test: 仅0有正确返回")  | 
|     @ApiImplicitParams({  | 
|             @ApiImplicitParam(paramType="query", name = "title", value = "类别名称", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "itemUnit", value = "单位", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "price", value = "回收价格", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "putStoragePrice", value = "入库价格", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "picture", value = "图片", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "secondPrice", value = "500公斤以上价格", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "parentId", value = "所属类别(如果是添加分类为空)", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "sort", value = "排序", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "packageId", value = "打包站Id", required = true, dataType = "String")  | 
|     })  | 
|     public JsonResult<Map<String, Object>> addPackageOperateParent(@RequestBody ItemModel item){  | 
|         Map<String, Object> map = packageGoodsInfoService.addOperateParent1(item);  | 
|         return JsonResult.success(map);  | 
|     }  | 
|   | 
|   | 
|     @PostMapping( "/admin/front/packageGoods/delPackageOperateItem.json")  | 
|     @PreventManyCommit(time = 10)  | 
|     @ApiOperation(value="运营管理-删除打包站物品(删除分类)", notes="test: 仅0有正确返回")  | 
|     @ApiImplicitParams({  | 
|             @ApiImplicitParam(paramType="query", name = "id", value = "物品(父类)Id", required = true, dataType = "String")  | 
|     })  | 
|     public JsonResult<Map<String, Object>> delPackageOperateItem(@RequestBody ItemModel item,HttpServletRequest request){  | 
|         Map<String, Object> map = packageGoodsInfoService.delPackageOperateItem(item);  | 
|         OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))  | 
|                 .methodName(Constants.ORDER_MODUL_NAME).operateAction("删除打包站物品-"+item.getId()).build();  | 
|         mqUtil.sendApp(build);  | 
|         return JsonResult.success(map);  | 
|     }  | 
|     @PostMapping( "/admin/front/packageGoods/updatePackageOperateItem.json")  | 
|     @PreventManyCommit(time = 10)  | 
|     @ApiOperation(value="运营管理-更新打包站物品(更新分类)", notes="test: 仅0有正确返回")  | 
|     @ApiImplicitParams({  | 
|             @ApiImplicitParam(paramType="query", name = "id", value = "物品(父类)Id", required = true, dataType = "String"),  | 
|             @ApiImplicitParam(paramType="query", name = "packageId", value = "城市ID", required = true, dataType = "String")  | 
|     })  | 
|     public JsonResult<Map<String, Object>> updatePackageOperateItem(@RequestBody ItemModel item, HttpServletRequest request){  | 
|         Map<String, Object> map = packageGoodsInfoService.updateOperateItem1(item);  | 
|         OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))  | 
|                 .methodName(Constants.ORDER_MODUL_NAME).operateAction("更新打包站物品-"+item.getId()).build();  | 
|         mqUtil.sendApp(build);  | 
|         return JsonResult.success(map);  | 
|     }  | 
|   | 
|   | 
|     @PostMapping( "/admin/front/packageGoods/queryPackageItemList.json")  | 
|     @PreventManyCommit(time = 10)  | 
|     @ApiOperation(value="运营管理-打包站类别列表(更新分类)", notes="test: 仅0有正确返回")  | 
|     @ApiImplicitParams({  | 
|             @ApiImplicitParam(paramType="query", name = "pageNum", value = "页码", required = true, dataType = "int"),  | 
|             @ApiImplicitParam(paramType="query", name = "limitNum", value = "每页条数", required = true, dataType = "int"),  | 
|             @ApiImplicitParam(paramType="query", name = "id", value = "父类Id", required = true, dataType = "String")  | 
|     })  | 
|     public JsonResult<Map<String, Object>> queryPackageItemList(@RequestBody ItemModel item){  | 
|         Map<String, Object> map = packageGoodsInfoService.queryOperateItemList1(item);  | 
|         return JsonResult.success(map);  | 
|     }  | 
| }  |