|  | @ -1,69 +1,73 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.base.endpoint.servicePackage;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.jw.base.service.servicePackage.ServicePackageNormcatService;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.servicePackage.ServicePackageNormcatDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.base.servicePackage.ServicePackageNormcatVO;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.yihu.jw.base.service.servicePackage.ServicePackageItemService;
 | 
	
		
			
				|  |  | import com.yihu.jw.base.util.ConstantUtils;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.Envelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.ListEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.ObjEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.PageEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.base.BaseRequestMapping;
 | 
	
		
			
				|  |  | import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiParam;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.http.MediaType;
 | 
	
		
			
				|  |  | import org.springframework.util.StringUtils;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * @author yeshijie on 2018/9/7.
 | 
	
		
			
				|  |  |  * @author yeshijie on 2021/2/23.
 | 
	
		
			
				|  |  |  */
 | 
	
		
			
				|  |  | @RestController
 | 
	
		
			
				|  |  | @RequestMapping(value = BaseRequestMapping.ServicePackageNormcat.PREFIX, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 | 
	
		
			
				|  |  | @Api(value = "服务包类目管理", description = "服务包类目管理服务接口", tags = {"wlyy基础服务 - 服务包类目管理服务接口"})
 | 
	
		
			
				|  |  | public class ServicePackageNormcatEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  | @RequestMapping(value = "servicePackageItem", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 | 
	
		
			
				|  |  | @Api(value = "服务项管理", description = "服务项管理服务接口", tags = {"wlyy基础服务 - 服务项管理服务接口"})
 | 
	
		
			
				|  |  | public class ServicePackageItemEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private ServicePackageNormcatService servicePackageNormcatService;
 | 
	
		
			
				|  |  |     private ServicePackageItemService servicePackageItemService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @PostMapping(value = BaseRequestMapping.ServicePackageNormcat.CREATE)
 | 
	
		
			
				|  |  |     @PostMapping(value = "create")
 | 
	
		
			
				|  |  |     @ApiOperation(value = "创建")
 | 
	
		
			
				|  |  |     public ObjEnvelop<ServicePackageNormcatVO> create (
 | 
	
		
			
				|  |  |             @ApiParam(name = "json_data", value = "Json数据", required = true)
 | 
	
		
			
				|  |  |             @RequestBody String jsonData) throws Exception {
 | 
	
		
			
				|  |  |         ServicePackageNormcatDO normcatDO = toEntity(jsonData, ServicePackageNormcatDO.class);
 | 
	
		
			
				|  |  |         normcatDO = servicePackageNormcatService.save(normcatDO);
 | 
	
		
			
				|  |  |         return success(convertToModel(normcatDO, ServicePackageNormcatVO.class));
 | 
	
		
			
				|  |  |     public Envelop create (
 | 
	
		
			
				|  |  |             @ApiParam(name = "jsonData", value = "Json数据", required = true)
 | 
	
		
			
				|  |  |             @RequestParam String jsonData) throws Exception {
 | 
	
		
			
				|  |  |         ServicePackageItemDO servicePackageItemDO = toEntity(jsonData, ServicePackageItemDO.class);
 | 
	
		
			
				|  |  |         JSONObject result = servicePackageItemService.create(servicePackageItemDO);
 | 
	
		
			
				|  |  |         if(StringUtils.endsWithIgnoreCase(ConstantUtils.FAIL,result.getString("response"))){
 | 
	
		
			
				|  |  |             return failed(result.getString("msg"));
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return success(result.get("msg"));
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @PostMapping(value = BaseRequestMapping.ServicePackageNormcat.DELETE)
 | 
	
		
			
				|  |  |     @PostMapping(value = "delete")
 | 
	
		
			
				|  |  |     @ApiOperation(value = "删除")
 | 
	
		
			
				|  |  |     public Envelop delete(
 | 
	
		
			
				|  |  |             @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
 | 
	
		
			
				|  |  |             @RequestParam(value = "ids") String ids) throws Exception{
 | 
	
		
			
				|  |  |         servicePackageNormcatService.delete(ids.split(","));
 | 
	
		
			
				|  |  |         servicePackageItemService.delete(ids.split(","));
 | 
	
		
			
				|  |  |         return success("删除成功");
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @PostMapping(value = BaseRequestMapping.ServicePackageNormcat.UPDATE)
 | 
	
		
			
				|  |  |     @PostMapping(value = "update")
 | 
	
		
			
				|  |  |     @ApiOperation(value = "更新")
 | 
	
		
			
				|  |  |     public ObjEnvelop<ServicePackageNormcatVO> update (
 | 
	
		
			
				|  |  |     public ObjEnvelop<ServicePackageItemDO> update (
 | 
	
		
			
				|  |  |             @ApiParam(name = "jsonData", value = "Json数据", required = true)
 | 
	
		
			
				|  |  |             @RequestBody String jsonData) throws Exception {
 | 
	
		
			
				|  |  |         ServicePackageNormcatDO normcatDO = toEntity(jsonData, ServicePackageNormcatDO.class);
 | 
	
		
			
				|  |  |         if (null == normcatDO.getId()) {
 | 
	
		
			
				|  |  |             @RequestParam String jsonData) throws Exception {
 | 
	
		
			
				|  |  |         ServicePackageItemDO servicePackageItemDO = toEntity(jsonData, ServicePackageItemDO.class);
 | 
	
		
			
				|  |  |         if (null == servicePackageItemDO.getId()) {
 | 
	
		
			
				|  |  |             return failed("ID不能为空", ObjEnvelop.class);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         normcatDO = servicePackageNormcatService.save(normcatDO);
 | 
	
		
			
				|  |  |         return success(normcatDO, ServicePackageNormcatVO.class);
 | 
	
		
			
				|  |  |         servicePackageItemDO = servicePackageItemService.save(servicePackageItemDO);
 | 
	
		
			
				|  |  |         return success(servicePackageItemDO);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @GetMapping(value = BaseRequestMapping.ServicePackageNormcat.PAGE)
 | 
	
		
			
				|  |  |     @GetMapping(value = "page")
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取分页")
 | 
	
		
			
				|  |  |     public PageEnvelop<ServicePackageNormcatVO> page (
 | 
	
		
			
				|  |  |     public PageEnvelop<ServicePackageItemDO> page (
 | 
	
		
			
				|  |  |             @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
 | 
	
		
			
				|  |  |             @RequestParam(value = "fields", required = false) String fields,
 | 
	
		
			
				|  |  |             @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
 | 
	
	
		
			
				|  | @ -74,21 +78,23 @@ public class ServicePackageNormcatEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |             @RequestParam(value = "page") int page,
 | 
	
		
			
				|  |  |             @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
 | 
	
		
			
				|  |  |             @RequestParam(value = "size") int size) throws Exception {
 | 
	
		
			
				|  |  |         List<ServicePackageNormcatDO> normcatDOS = servicePackageNormcatService.search(fields, filters, sorts, page, size);
 | 
	
		
			
				|  |  |         int count = (int)servicePackageNormcatService.getCount(filters);
 | 
	
		
			
				|  |  |         return success(normcatDOS, count, page, size, ServicePackageNormcatVO.class);
 | 
	
		
			
				|  |  |         List<ServicePackageItemDO> servicePackageItemDOS = servicePackageItemService.search(fields, filters, sorts, page, size);
 | 
	
		
			
				|  |  |         int count = (int)servicePackageItemService.getCount(filters);
 | 
	
		
			
				|  |  |         return success(servicePackageItemDOS, count, page, size);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @GetMapping(value = BaseRequestMapping.ServicePackageNormcat.LIST)
 | 
	
		
			
				|  |  |     @GetMapping(value = "list")
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取列表")
 | 
	
		
			
				|  |  |     public ListEnvelop<ServicePackageNormcatVO> list (
 | 
	
		
			
				|  |  |     public ListEnvelop<ServicePackageItemDO> list (
 | 
	
		
			
				|  |  |             @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
 | 
	
		
			
				|  |  |             @RequestParam(value = "fields", required = false) String fields,
 | 
	
		
			
				|  |  |             @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
 | 
	
		
			
				|  |  |             @RequestParam(value = "filters", required = false) String filters,
 | 
	
		
			
				|  |  |             @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
 | 
	
		
			
				|  |  |             @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
 | 
	
		
			
				|  |  |         List<ServicePackageNormcatDO> normcatDOS = servicePackageNormcatService.search(fields, filters, sorts);
 | 
	
		
			
				|  |  |         return success(normcatDOS, ServicePackageNormcatVO.class);
 | 
	
		
			
				|  |  |         List<ServicePackageItemDO> servicePackageItemDOS = servicePackageItemService.search(fields, filters, sorts);
 | 
	
		
			
				|  |  |         return success(servicePackageItemDOS);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |