|
@@ -30,8 +30,7 @@ import cn.ezhizao.framework.web.page.TableDataInfo;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/business/oncePrice")
|
|
|
-public class BizEntrustOncePriceController extends BaseController
|
|
|
-{
|
|
|
+public class BizEntrustOncePriceController extends BaseController {
|
|
|
@Resource
|
|
|
private IBizEntrustPriceService bizEntrustPriceService;
|
|
|
|
|
@@ -40,8 +39,7 @@ public class BizEntrustOncePriceController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('oncePrice:oncePrice:list')")
|
|
|
@GetMapping("/list")
|
|
|
- public TableDataInfo list(BizEntrustPrice bizEntrustPrice) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
+ public TableDataInfo list(BizEntrustPrice bizEntrustPrice) throws NoSuchFieldException, IllegalAccessException {
|
|
|
startPage();
|
|
|
List<BizEntrustPrice> list = bizEntrustPriceService.getOnceList(bizEntrustPrice);
|
|
|
return getDataTable(list);
|
|
@@ -53,9 +51,7 @@ public class BizEntrustOncePriceController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('oncePrice:oncePrice:export')")
|
|
|
@Log(title = "单次价目表", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
- public void export(HttpServletResponse response, BizEntrustPrice bizEntrustPrice) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
- setTenantId(bizEntrustPrice);
|
|
|
+ public void export(HttpServletResponse response, BizEntrustPrice bizEntrustPrice) throws NoSuchFieldException, IllegalAccessException {
|
|
|
List<BizEntrustPrice> list = bizEntrustPriceService.getList(bizEntrustPrice);
|
|
|
ExcelUtil<BizEntrustPrice> util = new ExcelUtil<BizEntrustPrice>(BizEntrustPrice.class);
|
|
|
util.exportExcel(response, list, "单次价目表数据");
|
|
@@ -66,8 +62,7 @@ public class BizEntrustOncePriceController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('priceList:oncePrice:list')")
|
|
|
@GetMapping("/taskTypeOnceList")
|
|
|
- public AjaxResult getTaskTypeList()
|
|
|
- {
|
|
|
+ public AjaxResult getTaskTypeList() {
|
|
|
return success(bizEntrustPriceService.getTaskType(2));
|
|
|
}
|
|
|
|
|
@@ -76,8 +71,7 @@ public class BizEntrustOncePriceController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('priceList:oncePrice:list')")
|
|
|
@GetMapping(value = "/typeDetail/{id}")
|
|
|
- public AjaxResult getTaskTypeDetailList(@PathVariable("id") Long id)
|
|
|
- {
|
|
|
+ public AjaxResult getTaskTypeDetailList(@PathVariable("id") Long id) {
|
|
|
return success(bizEntrustPriceService.getTaskTypeDetailList(id));
|
|
|
}
|
|
|
|
|
@@ -86,8 +80,7 @@ public class BizEntrustOncePriceController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('oncePrice:oncePrice:query')")
|
|
|
@GetMapping(value = "/{id}")
|
|
|
- public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
- {
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
return success(bizEntrustPriceService.getById(id));
|
|
|
}
|
|
|
|
|
@@ -97,11 +90,12 @@ public class BizEntrustOncePriceController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('oncePrice:oncePrice:save')")
|
|
|
@Log(title = "单次价目表", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
- public AjaxResult add(@RequestBody BizEntrustPrice bizEntrustPrice) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
+ public AjaxResult add(@RequestBody BizEntrustPrice bizEntrustPrice) throws NoSuchFieldException, IllegalAccessException {
|
|
|
//判读是否存在该价目
|
|
|
+ setTenantId(bizEntrustPrice);
|
|
|
+ bizEntrustPrice.setToTenantId(bizEntrustPrice.getFromTenantId());
|
|
|
List<BizEntrustPrice> list = bizEntrustPriceService.getOnceList(bizEntrustPrice);
|
|
|
- if(list.size() > 0){
|
|
|
+ if (list.size() > 0) {
|
|
|
return AjaxResult.error("该价目已存在");
|
|
|
}
|
|
|
return toAjax(bizEntrustPriceService.save(bizEntrustPrice));
|
|
@@ -113,16 +107,19 @@ public class BizEntrustOncePriceController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('oncePrice:oncePrice:save')")
|
|
|
@Log(title = "单次价目表", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
- public AjaxResult edit(@RequestBody BizEntrustPrice bizEntrustPrice) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
+ public AjaxResult edit(@RequestBody BizEntrustPrice bizEntrustPrice) throws NoSuchFieldException, IllegalAccessException {
|
|
|
//判读是否存在该价目
|
|
|
List<BizEntrustPrice> list = bizEntrustPriceService.getOnceList(bizEntrustPrice);
|
|
|
- if(list.size() > 0){
|
|
|
- //如果存在,则判断是否是同一个价目
|
|
|
- if(list.size() == 1&&list.get(0).getId().equals(bizEntrustPrice.getId())){
|
|
|
+ //如果存在多条数据
|
|
|
+ if (list.size() > 1) {
|
|
|
+ return AjaxResult.error("该价目已存在");
|
|
|
+ } else if (list.size() == 1) {
|
|
|
+ //如果存在一条数据且id一致
|
|
|
+ if (list.get(0).getId().equals(bizEntrustPrice.getId())) {
|
|
|
return toAjax(bizEntrustPriceService.updateById(bizEntrustPrice));
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error("该价目已存在");
|
|
|
}
|
|
|
- return AjaxResult.error("该价目已存在");
|
|
|
}
|
|
|
return toAjax(bizEntrustPriceService.updateById(bizEntrustPrice));
|
|
|
}
|
|
@@ -132,9 +129,8 @@ public class BizEntrustOncePriceController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('oncePrice:oncePrice:remove')")
|
|
|
@Log(title = "单次价目表", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{ids}")
|
|
|
- public AjaxResult remove(@PathVariable List<Long> ids)
|
|
|
- {
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult remove(@PathVariable List<Long> ids) {
|
|
|
return toAjax(bizEntrustPriceService.removeBatchByIds(ids));
|
|
|
}
|
|
|
}
|