|
|
@ -1,7 +1,18 @@ |
|
|
|
package com.lzbi.targetFolder.controller; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
import com.alibaba.fastjson2.JSONArray; |
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
import com.lzbi.common.utils.DateUtils; |
|
|
|
import com.lzbi.targetFolder.domain.DcBaseTargetModel; |
|
|
|
import com.lzbi.targetFolder.service.DcBaseTargetModelService; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
@ -16,16 +27,15 @@ import com.lzbi.common.annotation.Log; |
|
|
|
import com.lzbi.common.core.controller.BaseController; |
|
|
|
import com.lzbi.common.core.domain.AjaxResult; |
|
|
|
import com.lzbi.common.enums.BusinessType; |
|
|
|
import com.lzbi.targetFolder.domain.DcBaseTargetModelDao; |
|
|
|
import com.lzbi.targetFolder.service.DcBaseTargetModelService; |
|
|
|
import com.lzbi.common.utils.poi.ExcelUtil; |
|
|
|
import com.lzbi.common.core.page.TableDataInfo; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 指标模版配置Controller |
|
|
|
* |
|
|
|
* @author Lu.JL |
|
|
|
* @date 2023-11-29 |
|
|
|
* @date 2023-12-07 |
|
|
|
*/ |
|
|
|
@RestController |
|
|
|
@RequestMapping("/target/targetModel") |
|
|
@ -37,81 +47,156 @@ public class DcBaseTargetModelController extends BaseController |
|
|
|
/** |
|
|
|
* 查询指标模版配置列表 |
|
|
|
*/ |
|
|
|
@ApiOperation("查询指标模版配置列表") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "DcBaseTargetModel", value = "", dataType = "DcBaseTargetModel", dataTypeClass = DcBaseTargetModel.class), |
|
|
|
}) |
|
|
|
@PreAuthorize("@ss.hasPermi('target:targetModel:list')") |
|
|
|
@GetMapping("/list") |
|
|
|
public TableDataInfo list(DcBaseTargetModelDao dcBaseTargetModelDao) |
|
|
|
public TableDataInfo list(DcBaseTargetModel DcBaseTargetModel) |
|
|
|
{ |
|
|
|
startPage(); |
|
|
|
List<DcBaseTargetModelDao> list = dcBaseTargetModelService.selectDcBaseTargetModelDaoList(dcBaseTargetModelDao); |
|
|
|
List< DcBaseTargetModel> list = dcBaseTargetModelService.selectDcBaseTargetModelList(DcBaseTargetModel); |
|
|
|
return getDataTable(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 导出指标模版配置列表 |
|
|
|
*/ |
|
|
|
@ApiOperation("导出指标模版配置列表") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "DcBaseTargetModel", value = "", dataType = "DcBaseTargetModel", dataTypeClass = DcBaseTargetModel.class), |
|
|
|
}) |
|
|
|
@PreAuthorize("@ss.hasPermi('target:targetModel:export')") |
|
|
|
@Log(title = "指标模版配置", businessType = BusinessType.EXPORT) |
|
|
|
@PostMapping("/export") |
|
|
|
public void export(HttpServletResponse response, DcBaseTargetModelDao dcBaseTargetModelDao) |
|
|
|
public void export(HttpServletResponse response,DcBaseTargetModel DcBaseTargetModel) |
|
|
|
{ |
|
|
|
List<DcBaseTargetModelDao> list = dcBaseTargetModelService.selectDcBaseTargetModelDaoList(dcBaseTargetModelDao); |
|
|
|
ExcelUtil<DcBaseTargetModelDao> util = new ExcelUtil<DcBaseTargetModelDao>(DcBaseTargetModelDao.class); |
|
|
|
List<DcBaseTargetModel> list = dcBaseTargetModelService.selectDcBaseTargetModelList(DcBaseTargetModel); |
|
|
|
ExcelUtil<DcBaseTargetModel> util = new ExcelUtil<DcBaseTargetModel>(DcBaseTargetModel.class); |
|
|
|
util.exportExcel(response, list, "指标模版配置数据"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取指标模版配置详细信息 |
|
|
|
*/ |
|
|
|
@ApiOperation("获取指标模版配置详细信息") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "id", value = "", dataType = "Long", dataTypeClass = Long.class), |
|
|
|
}) |
|
|
|
@PreAuthorize("@ss.hasPermi('target:targetModel:query')") |
|
|
|
@GetMapping(value = "/{id}") |
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) |
|
|
|
{ |
|
|
|
return success(dcBaseTargetModelService.selectDcBaseTargetModelDaoById(id)); |
|
|
|
return success(dcBaseTargetModelService.selectDcBaseTargetModelById(id)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 新增指标模版配置 |
|
|
|
*/ |
|
|
|
@ApiOperation("新增指标模版配置") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "DcBaseTargetModel", value = "", dataType = "DcBaseTargetModel", dataTypeClass = DcBaseTargetModel.class), |
|
|
|
}) |
|
|
|
@PreAuthorize("@ss.hasPermi('target:targetModel:add')") |
|
|
|
@Log(title = "指标模版配置", businessType = BusinessType.INSERT) |
|
|
|
@PostMapping |
|
|
|
public AjaxResult add(@RequestBody DcBaseTargetModelDao dcBaseTargetModelDao) |
|
|
|
public AjaxResult add(@RequestBody DcBaseTargetModel DcBaseTargetModel) |
|
|
|
{ |
|
|
|
return toAjax(dcBaseTargetModelService.insertDcBaseTargetModelDao(dcBaseTargetModelDao)); |
|
|
|
return toAjax(dcBaseTargetModelService.insertDcBaseTargetModel(DcBaseTargetModel)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 修改指标模版配置 |
|
|
|
*/ |
|
|
|
|
|
|
|
@ApiOperation("修改指标模版配置") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "DcBaseTargetModel", value = "", dataType = "DcBaseTargetModel", dataTypeClass = DcBaseTargetModel.class), |
|
|
|
}) |
|
|
|
@PreAuthorize("@ss.hasPermi('target:targetModel:edit')") |
|
|
|
@Log(title = "指标模版配置", businessType = BusinessType.UPDATE) |
|
|
|
@PutMapping |
|
|
|
public AjaxResult edit(@RequestBody DcBaseTargetModelDao dcBaseTargetModelDao) |
|
|
|
public AjaxResult edit(@RequestBody DcBaseTargetModel DcBaseTargetModel) |
|
|
|
{ |
|
|
|
return toAjax(dcBaseTargetModelService.updateDcBaseTargetModelDao(dcBaseTargetModelDao)); |
|
|
|
return toAjax(dcBaseTargetModelService.updateDcBaseTargetModel(DcBaseTargetModel)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 删除指标模版配置 |
|
|
|
*/ |
|
|
|
@ApiOperation("删除指标模版配置") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "ids", value = "", dataType = "Long", dataTypeClass =Long.class), |
|
|
|
}) |
|
|
|
@PreAuthorize("@ss.hasPermi('target:targetModel:remove')") |
|
|
|
@Log(title = "指标模版配置", businessType = BusinessType.DELETE) |
|
|
|
@DeleteMapping("/{ids}") |
|
|
|
public AjaxResult remove(@PathVariable Long[] ids) |
|
|
|
{ |
|
|
|
return toAjax(dcBaseTargetModelService.deleteDcBaseTargetModelDaoByIds(ids)); |
|
|
|
return toAjax(dcBaseTargetModelService.deleteDcBaseTargetModelByIds(ids)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 查询指标模版配置列表 |
|
|
|
* 新增指标模版配置 |
|
|
|
*/ |
|
|
|
@PreAuthorize("@ss.hasPermi('target:targetModel:list')") |
|
|
|
@GetMapping("/listNoPage") |
|
|
|
public AjaxResult listNoPage(DcBaseTargetModelDao dcBaseTargetModelDao) |
|
|
|
@PreAuthorize("@ss.hasPermi('target:targetModel:add')") |
|
|
|
@Log(title = "指标模版配置", businessType = BusinessType.INSERT) |
|
|
|
@PostMapping("/addBatch") |
|
|
|
public AjaxResult addBatch(@RequestBody JSONArray jsonArray) |
|
|
|
{ |
|
|
|
if (jsonArray == null) { |
|
|
|
throw new IllegalArgumentException("未能接收任何参数!"); |
|
|
|
} |
|
|
|
List<DcBaseTargetModel> beanList = new ArrayList<>(); |
|
|
|
try { |
|
|
|
for (int i = 0; i < jsonArray.size(); i++) { |
|
|
|
JSONObject beanObject = jsonArray.getJSONObject(i); |
|
|
|
// 移除ID属性
|
|
|
|
beanObject.remove("id"); |
|
|
|
DcBaseTargetModel dcBaseTargetModel = JSON.toJavaObject(beanObject, DcBaseTargetModel.class); |
|
|
|
dcBaseTargetModel.setCreatedTime(DateUtils.getNowDate()); |
|
|
|
dcBaseTargetModel.setDeptId(getDeptId()); |
|
|
|
dcBaseTargetModel.setUserId(getUserId()); |
|
|
|
dcBaseTargetModel.setCreatedBy(String.valueOf(getUserId())); |
|
|
|
dcBaseTargetModel.setCreatedTime(DateUtils.getNowDate()); |
|
|
|
beanList.add(dcBaseTargetModel); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
throw new IllegalArgumentException("解析list对象异常!"); |
|
|
|
} |
|
|
|
return toAjax(dcBaseTargetModelService.saveBatch(beanList)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 修改指标模版配置 |
|
|
|
*/ |
|
|
|
@PreAuthorize("@ss.hasPermi('target:targetModel:edit')") |
|
|
|
@Log(title = "指标模版配置", businessType = BusinessType.UPDATE) |
|
|
|
@PutMapping("editBatch") |
|
|
|
public AjaxResult editBatch(@RequestBody JSONArray jsonArray) |
|
|
|
{ |
|
|
|
List<DcBaseTargetModelDao> list = dcBaseTargetModelService.selectDcBaseTargetModelDaoList(dcBaseTargetModelDao); |
|
|
|
return AjaxResult.success(list); |
|
|
|
if (jsonArray == null) { |
|
|
|
throw new IllegalArgumentException("未能接收任何参数!"); |
|
|
|
} |
|
|
|
List<DcBaseTargetModel> dcBaseWorkSpecialList = new ArrayList<>(); |
|
|
|
try { |
|
|
|
for (int i = 0; i < jsonArray.size(); i++) { |
|
|
|
JSONObject beanObject = jsonArray.getJSONObject(i); |
|
|
|
DcBaseTargetModel dcBaseTargetModel = JSON.toJavaObject(beanObject, DcBaseTargetModel.class); |
|
|
|
dcBaseTargetModel.setUpdatedBy(String.valueOf(getUserId())); |
|
|
|
dcBaseTargetModel.setUpdatedTime(DateUtils.getNowDate()); |
|
|
|
dcBaseWorkSpecialList.add(dcBaseTargetModel); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
throw new IllegalArgumentException("解析list对象异常!"); |
|
|
|
} |
|
|
|
return toAjax(dcBaseTargetModelService.updateBatchById(dcBaseWorkSpecialList)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|