|
@@ -4,18 +4,21 @@ package com.bootdo.datas.controller;
|
|
|
import com.bootdo.common.annotation.Log;
|
|
|
import com.bootdo.common.utils.PageUtils;
|
|
|
import com.bootdo.common.utils.Query;
|
|
|
+import com.bootdo.common.utils.R;
|
|
|
+import com.bootdo.datas.dto.ExamineLogDTO;
|
|
|
import com.bootdo.datas.dto.GyDataImportDTO;
|
|
|
+import com.bootdo.datas.service.ExamineLogService;
|
|
|
import com.bootdo.datas.service.GyDataService;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.ui.Model;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -28,6 +31,8 @@ public class DataEntryController {
|
|
|
|
|
|
@Autowired
|
|
|
private GyDataService gyDataService;
|
|
|
+ @Autowired
|
|
|
+ private ExamineLogService examineLogService;
|
|
|
|
|
|
@GetMapping()
|
|
|
@Log("访问数据条目")
|
|
@@ -48,4 +53,41 @@ public class DataEntryController {
|
|
|
int total = gyDataService.dataEntryCountTotal(query);
|
|
|
return new PageUtils(dataList, total);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除
|
|
|
+ */
|
|
|
+ @PostMapping("/remove")
|
|
|
+ @ResponseBody
|
|
|
+ @RequiresPermissions("datas:data:remove")
|
|
|
+ public R remove(Long id) {
|
|
|
+ //判断一下该条数据是否被风评系统使用
|
|
|
+ int cnt = gyDataService.countAaAssData(id);
|
|
|
+ if(cnt > 0){
|
|
|
+ return R.error("该条数据已经被风评系统使用,不能删除!");
|
|
|
+ }
|
|
|
+ Long[] longArray = new Long[]{id};
|
|
|
+ gyDataService.batchRemove(longArray);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/edit/{id}")
|
|
|
+ @RequiresPermissions("datas:data:edit")
|
|
|
+ String edit(@PathVariable("id") Long id, Model model) {
|
|
|
+ log.info("edit id:{}", id);
|
|
|
+ GyDataImportDTO data = gyDataService.get(id);
|
|
|
+ Map<String, Object> reqParamMap = Maps.newHashMap();
|
|
|
+ reqParamMap.put("dataType", "DI_OPER");
|
|
|
+ reqParamMap.put("uniqueKey", id);
|
|
|
+ log.info("日志查询开始");
|
|
|
+ List<ExamineLogDTO> examineLogList = examineLogService.list(reqParamMap);
|
|
|
+ log.info("日志查询结束"+examineLogList.size());
|
|
|
+ model.addAttribute("data", data);
|
|
|
+ if (!CollectionUtils.isEmpty(examineLogList)) {
|
|
|
+ log.info("examineLog-----"+examineLogList);
|
|
|
+ model.addAttribute("examineLog", examineLogList);
|
|
|
+ }
|
|
|
+ return "datas/data/edit";
|
|
|
+ }
|
|
|
}
|