|
@ -2,9 +2,11 @@ package com.yihu.jw.wlyy.controller.agreement;
|
|
|
|
|
|
import com.yihu.jw.exception.ApiException;
|
|
import com.yihu.jw.exception.ApiException;
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
import com.yihu.jw.restmodel.web.EnvelopRestController;
|
|
|
|
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
import com.yihu.jw.rm.wlyy.WlyyRequestMapping;
|
|
import com.yihu.jw.rm.wlyy.WlyyRequestMapping;
|
|
import com.yihu.jw.wlyy.agreement.WlyyAgreementDO;
|
|
|
|
|
|
import com.yihu.jw.entity.wlyy.agreement.WlyyAgreementDO;
|
|
import com.yihu.jw.wlyy.service.agreement.WlyyAgreementService;
|
|
import com.yihu.jw.wlyy.service.agreement.WlyyAgreementService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@ -15,13 +17,14 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.io.IOException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping(WlyyRequestMapping.api_wlyy_common)
|
|
@RequestMapping(WlyyRequestMapping.api_wlyy_common)
|
|
@Api(value = "协议相关操作", description = "协议相关操作")
|
|
@Api(value = "协议相关操作", description = "协议相关操作")
|
|
public class WlyyAgreementController extends EnvelopRestController {
|
|
|
|
|
|
public class WlyyAgreementController extends EnvelopRestEndpoint {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private WlyyAgreementService wlyyAgreementService;
|
|
private WlyyAgreementService wlyyAgreementService;
|
|
@ -30,10 +33,10 @@ public class WlyyAgreementController extends EnvelopRestController {
|
|
@ApiOperation(value = "创建协议", notes = "创建协议")
|
|
@ApiOperation(value = "创建协议", notes = "创建协议")
|
|
public Envelop create(
|
|
public Envelop create(
|
|
@ApiParam(name = "json_data", value = "", defaultValue = "")
|
|
@ApiParam(name = "json_data", value = "", defaultValue = "")
|
|
@RequestBody String jsonData) {
|
|
|
|
|
|
@RequestBody String jsonData) throws IOException {
|
|
try {
|
|
try {
|
|
WlyyAgreementDO wlyyAgreement = toEntity(jsonData, WlyyAgreementDO.class);
|
|
WlyyAgreementDO wlyyAgreement = toEntity(jsonData, WlyyAgreementDO.class);
|
|
return Envelop.getSuccess(WlyyRequestMapping.Agreement.message_success_create, wlyyAgreementService.create(wlyyAgreement));
|
|
|
|
|
|
return success(WlyyRequestMapping.Agreement.message_success_create, wlyyAgreementService.create(wlyyAgreement));
|
|
} catch (ApiException e) {
|
|
} catch (ApiException e) {
|
|
return Envelop.getError(e.getMessage(), e.getErrorCode());
|
|
return Envelop.getError(e.getMessage(), e.getErrorCode());
|
|
}
|
|
}
|
|
@ -43,12 +46,12 @@ public class WlyyAgreementController extends EnvelopRestController {
|
|
@ApiOperation(value = "修改协议", notes = "修改协议")
|
|
@ApiOperation(value = "修改协议", notes = "修改协议")
|
|
public Envelop update(
|
|
public Envelop update(
|
|
@ApiParam(name = "json_data", value = "", defaultValue = "")
|
|
@ApiParam(name = "json_data", value = "", defaultValue = "")
|
|
@RequestBody String jsonData) {
|
|
|
|
|
|
@RequestBody String jsonData) throws IOException {
|
|
try {
|
|
try {
|
|
WlyyAgreementDO wlyyAgreement = toEntity(jsonData, WlyyAgreementDO.class);
|
|
WlyyAgreementDO wlyyAgreement = toEntity(jsonData, WlyyAgreementDO.class);
|
|
return Envelop.getSuccess(WlyyRequestMapping.Agreement.message_success_update, wlyyAgreementService.update(wlyyAgreement));
|
|
|
|
|
|
return success(WlyyRequestMapping.Agreement.message_success_update, wlyyAgreementService.update(wlyyAgreement));
|
|
} catch (ApiException e) {
|
|
} catch (ApiException e) {
|
|
return Envelop.getError(e.getMessage(), e.getErrorCode());
|
|
|
|
|
|
return failed(e.getMessage(), e.getErrorCode());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@ -70,10 +73,9 @@ public class WlyyAgreementController extends EnvelopRestController {
|
|
@ApiOperation(value = "根据code查找协议", notes = "根据code查找协议")
|
|
@ApiOperation(value = "根据code查找协议", notes = "根据code查找协议")
|
|
public Envelop findByCode(
|
|
public Envelop findByCode(
|
|
@ApiParam(name = "id", value = "id")
|
|
@ApiParam(name = "id", value = "id")
|
|
@RequestParam(value = "id", required = true) String id
|
|
|
|
) {
|
|
|
|
|
|
@RequestParam(value = "id", required = true) String id) {
|
|
try {
|
|
try {
|
|
return Envelop.getSuccess(WlyyRequestMapping.Agreement.message_success_find, wlyyAgreementService.findById(id));
|
|
|
|
|
|
return success(WlyyRequestMapping.Agreement.message_success_find, wlyyAgreementService.findById(id));
|
|
} catch (ApiException e) {
|
|
} catch (ApiException e) {
|
|
return Envelop.getError(e.getMessage(), e.getErrorCode());
|
|
return Envelop.getError(e.getMessage(), e.getErrorCode());
|
|
}
|
|
}
|
|
@ -81,7 +83,7 @@ public class WlyyAgreementController extends EnvelopRestController {
|
|
|
|
|
|
@RequestMapping(value = WlyyRequestMapping.Agreement.api_queryPage, method = RequestMethod.GET)
|
|
@RequestMapping(value = WlyyRequestMapping.Agreement.api_queryPage, method = RequestMethod.GET)
|
|
@ApiOperation(value = "分页获取协议")
|
|
@ApiOperation(value = "分页获取协议")
|
|
public Envelop queryPage(
|
|
|
|
|
|
public PageEnvelop<WlyyAgreementDO> queryPage(
|
|
@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,parentCode,saasId,name,price,posterPic,remark,type,status")
|
|
@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,parentCode,saasId,name,price,posterPic,remark,type,status")
|
|
@RequestParam(value = "fields", required = false) String fields,
|
|
@RequestParam(value = "fields", required = false) String fields,
|
|
@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
|
|
@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
|
|
@ -103,13 +105,13 @@ public class WlyyAgreementController extends EnvelopRestController {
|
|
//封装返回格式
|
|
//封装返回格式
|
|
List<WlyyAgreementDO> wlyyAgreement = convertToModels(list, new ArrayList<>(list.size()), WlyyAgreementDO.class, fields);
|
|
List<WlyyAgreementDO> wlyyAgreement = convertToModels(list, new ArrayList<>(list.size()), WlyyAgreementDO.class, fields);
|
|
|
|
|
|
return Envelop.getSuccessListWithPage(WlyyRequestMapping.Agreement.message_success_find_functions,wlyyAgreement, page, size,count);
|
|
|
|
|
|
return success(WlyyRequestMapping.Agreement.message_success_find_functions, wlyyAgreement, page, size, (int)count);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = WlyyRequestMapping.Agreement.api_getList)
|
|
@GetMapping(value = WlyyRequestMapping.Agreement.api_getList)
|
|
@ApiOperation(value = "获取协议列表(不分页)")
|
|
@ApiOperation(value = "获取协议列表(不分页)")
|
|
public Envelop getList(
|
|
|
|
|
|
public ListEnvelop<WlyyAgreementDO> getList(
|
|
@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,parentCode,saasId,name,price,posterPic,remark,type,status")
|
|
@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,parentCode,saasId,name,price,posterPic,remark,type,status")
|
|
@RequestParam(value = "fields", required = false) String fields,
|
|
@RequestParam(value = "fields", required = false) String fields,
|
|
@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
|
|
@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
|
|
@ -120,7 +122,7 @@ public class WlyyAgreementController extends EnvelopRestController {
|
|
List<WlyyAgreementDO> list = wlyyAgreementService.search(fields,filters,sorts);
|
|
List<WlyyAgreementDO> list = wlyyAgreementService.search(fields,filters,sorts);
|
|
//封装返回格式
|
|
//封装返回格式
|
|
List<WlyyAgreementDO> wlyyAgreement = convertToModels(list, new ArrayList<>(list.size()), WlyyAgreementDO.class, fields);
|
|
List<WlyyAgreementDO> wlyyAgreement = convertToModels(list, new ArrayList<>(list.size()), WlyyAgreementDO.class, fields);
|
|
return Envelop.getSuccessList(WlyyRequestMapping.Agreement.message_success_find_functions,wlyyAgreement);
|
|
|
|
|
|
return success(WlyyRequestMapping.Agreement.message_success_find_functions,wlyyAgreement);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|