|
@@ -1,28 +1,26 @@
|
|
package com.jjt.biz.controller;
|
|
package com.jjt.biz.controller;
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
-
|
|
|
|
-import io.swagger.annotations.Api;
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import com.jjt.biz.domain.BizObjData;
|
|
|
|
+import com.jjt.biz.domain.BizObjMetrics;
|
|
|
|
+import com.jjt.biz.service.IBizObjDataService;
|
|
|
|
+import com.jjt.biz.service.IBizObjMetricsService;
|
|
import com.jjt.common.annotation.Log;
|
|
import com.jjt.common.annotation.Log;
|
|
import com.jjt.common.core.controller.BaseController;
|
|
import com.jjt.common.core.controller.BaseController;
|
|
import com.jjt.common.core.domain.AjaxResult;
|
|
import com.jjt.common.core.domain.AjaxResult;
|
|
|
|
+import com.jjt.common.core.page.TableDataInfo;
|
|
import com.jjt.common.enums.BusinessType;
|
|
import com.jjt.common.enums.BusinessType;
|
|
-import com.jjt.biz.domain.BizObjData;
|
|
|
|
-import com.jjt.biz.service.IBizObjDataService;
|
|
|
|
import com.jjt.common.utils.poi.ExcelUtil;
|
|
import com.jjt.common.utils.poi.ExcelUtil;
|
|
-import com.jjt.common.core.page.TableDataInfo;
|
|
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 业务对象数据接口Controller
|
|
* 业务对象数据接口Controller
|
|
@@ -30,13 +28,14 @@ import com.jjt.common.core.page.TableDataInfo;
|
|
* @author jjt
|
|
* @author jjt
|
|
* @date 2024-08-09
|
|
* @date 2024-08-09
|
|
*/
|
|
*/
|
|
-@Api(tags="业务对象数据接口")
|
|
|
|
|
|
+@Api(tags = "业务对象数据接口")
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/obj/data")
|
|
@RequestMapping("/obj/data")
|
|
-public class BizObjDataController extends BaseController
|
|
|
|
-{
|
|
|
|
|
|
+public class BizObjDataController extends BaseController {
|
|
@Resource
|
|
@Resource
|
|
private IBizObjDataService bizObjDataService;
|
|
private IBizObjDataService bizObjDataService;
|
|
|
|
+ @Resource
|
|
|
|
+ private IBizObjMetricsService metricsService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询业务对象数据接口列表
|
|
* 查询业务对象数据接口列表
|
|
@@ -44,22 +43,49 @@ public class BizObjDataController extends BaseController
|
|
@ApiOperation("查询业务对象数据接口列表")
|
|
@ApiOperation("查询业务对象数据接口列表")
|
|
@PreAuthorize("@ss.hasPermi('obj:data:list')")
|
|
@PreAuthorize("@ss.hasPermi('obj:data:list')")
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- public TableDataInfo list(BizObjData bizObjData)
|
|
|
|
- {
|
|
|
|
|
|
+ public TableDataInfo list(BizObjData bizObjData) {
|
|
startPage();
|
|
startPage();
|
|
List<BizObjData> list = bizObjDataService.selectBizObjDataList(bizObjData);
|
|
List<BizObjData> list = bizObjDataService.selectBizObjDataList(bizObjData);
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 查询业务对象数据接口列表
|
|
|
|
+ */
|
|
|
|
+ @ApiOperation("根据对象查询列表")
|
|
|
|
+ @GetMapping("/list/{objId}")
|
|
|
|
+ public TableDataInfo list(@ApiParam(value = "对象ID", required = true) @PathVariable("objId") Long objId) {
|
|
|
|
+ BizObjData bizObjData = new BizObjData();
|
|
|
|
+ bizObjData.setObjId(objId);
|
|
|
|
+ List<BizObjData> list = bizObjDataService.selectBizObjDataList(bizObjData);
|
|
|
|
+ Map<String, List<BizObjData>> existsMap = list.stream().collect(Collectors.groupingBy(BizObjData::getMetricsType));
|
|
|
|
+ BizObjMetrics om = new BizObjMetrics();
|
|
|
|
+ om.setObjId(objId);
|
|
|
|
+ List<BizObjMetrics> metricsList = metricsService.selectBizObjMetricsList(om);
|
|
|
|
+ //根据部门对用户列表进行分组
|
|
|
|
+ Map<String, List<BizObjMetrics>> userMap = metricsList.stream().collect(Collectors.groupingBy(obj -> obj.getMetricsDef().getMetricsType()));
|
|
|
|
+ for (String s : userMap.keySet()) {
|
|
|
|
+ if (!existsMap.containsKey(s)) {
|
|
|
|
+ BizObjData temp = new BizObjData();
|
|
|
|
+ temp.setObjId(objId);
|
|
|
|
+ temp.setMetricsType(s);
|
|
|
|
+ bizObjDataService.insertBizObjData(temp);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ startPage();
|
|
|
|
+ list = bizObjDataService.selectBizObjDataList(bizObjData);
|
|
|
|
+ return getDataTable(list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 导出业务对象数据接口列表
|
|
* 导出业务对象数据接口列表
|
|
*/
|
|
*/
|
|
@ApiOperation("导出业务对象数据接口列表")
|
|
@ApiOperation("导出业务对象数据接口列表")
|
|
@PreAuthorize("@ss.hasPermi('obj:data:export')")
|
|
@PreAuthorize("@ss.hasPermi('obj:data:export')")
|
|
@Log(title = "业务对象数据接口", businessType = BusinessType.EXPORT)
|
|
@Log(title = "业务对象数据接口", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
@PostMapping("/export")
|
|
- public void export(HttpServletResponse response, BizObjData bizObjData)
|
|
|
|
- {
|
|
|
|
|
|
+ public void export(HttpServletResponse response, BizObjData bizObjData) {
|
|
List<BizObjData> list = bizObjDataService.selectBizObjDataList(bizObjData);
|
|
List<BizObjData> list = bizObjDataService.selectBizObjDataList(bizObjData);
|
|
ExcelUtil<BizObjData> util = new ExcelUtil<BizObjData>(BizObjData.class);
|
|
ExcelUtil<BizObjData> util = new ExcelUtil<BizObjData>(BizObjData.class);
|
|
util.exportExcel(response, list, "业务对象数据接口数据");
|
|
util.exportExcel(response, list, "业务对象数据接口数据");
|
|
@@ -71,8 +97,7 @@ public class BizObjDataController extends BaseController
|
|
@ApiOperation("获取业务对象数据接口详细信息")
|
|
@ApiOperation("获取业务对象数据接口详细信息")
|
|
@PreAuthorize("@ss.hasPermi('obj:data:query')")
|
|
@PreAuthorize("@ss.hasPermi('obj:data:query')")
|
|
@GetMapping(value = "/{dataId}")
|
|
@GetMapping(value = "/{dataId}")
|
|
- public AjaxResult getInfo(@PathVariable("dataId") Long dataId)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult getInfo(@PathVariable("dataId") Long dataId) {
|
|
return success(bizObjDataService.selectBizObjDataByDataId(dataId));
|
|
return success(bizObjDataService.selectBizObjDataByDataId(dataId));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -83,8 +108,7 @@ public class BizObjDataController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('obj:data:add')")
|
|
@PreAuthorize("@ss.hasPermi('obj:data:add')")
|
|
@Log(title = "业务对象数据接口", businessType = BusinessType.INSERT)
|
|
@Log(title = "业务对象数据接口", businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
@PostMapping
|
|
- public AjaxResult add(@RequestBody BizObjData bizObjData)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult add(@RequestBody BizObjData bizObjData) {
|
|
return toAjax(bizObjDataService.insertBizObjData(bizObjData));
|
|
return toAjax(bizObjDataService.insertBizObjData(bizObjData));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -95,8 +119,7 @@ public class BizObjDataController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('obj:data:edit')")
|
|
@PreAuthorize("@ss.hasPermi('obj:data:edit')")
|
|
@Log(title = "业务对象数据接口", businessType = BusinessType.UPDATE)
|
|
@Log(title = "业务对象数据接口", businessType = BusinessType.UPDATE)
|
|
@PutMapping
|
|
@PutMapping
|
|
- public AjaxResult edit(@RequestBody BizObjData bizObjData)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult edit(@RequestBody BizObjData bizObjData) {
|
|
return toAjax(bizObjDataService.updateBizObjData(bizObjData));
|
|
return toAjax(bizObjDataService.updateBizObjData(bizObjData));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -106,9 +129,8 @@ public class BizObjDataController extends BaseController
|
|
@ApiOperation("删除业务对象数据接口")
|
|
@ApiOperation("删除业务对象数据接口")
|
|
@PreAuthorize("@ss.hasPermi('obj:data:remove')")
|
|
@PreAuthorize("@ss.hasPermi('obj:data:remove')")
|
|
@Log(title = "业务对象数据接口", businessType = BusinessType.DELETE)
|
|
@Log(title = "业务对象数据接口", businessType = BusinessType.DELETE)
|
|
- @DeleteMapping("/{dataIds}")
|
|
|
|
- public AjaxResult remove(@PathVariable Long[] dataIds)
|
|
|
|
- {
|
|
|
|
|
|
+ @DeleteMapping("/{dataIds}")
|
|
|
|
+ public AjaxResult remove(@PathVariable Long[] dataIds) {
|
|
return toAjax(bizObjDataService.deleteBizObjDataByDataIds(dataIds));
|
|
return toAjax(bizObjDataService.deleteBizObjDataByDataIds(dataIds));
|
|
}
|
|
}
|
|
}
|
|
}
|