|
@@ -1,24 +1,17 @@
|
|
|
package com.yijia.label.controller;
|
|
|
-
|
|
|
import java.util.List;
|
|
|
-
|
|
|
import com.yijia.common.core.domain.entity.SysDept;
|
|
|
import com.yijia.common.core.domain.model.LoginUser;
|
|
|
import com.yijia.common.utils.DateUtils;
|
|
|
import com.yijia.common.utils.SecurityUtils;
|
|
|
-import com.yijia.common.utils.bean.BeanUtils;
|
|
|
-import com.yijia.station.domain.SysDeptDemo;
|
|
|
+import com.yijia.label.domain.LabelRuleDetail;
|
|
|
+import com.yijia.label.domain.RequsetSysDept;
|
|
|
+import com.yijia.label.service.ILabelRuleDetailService;
|
|
|
import com.yijia.system.service.ISysDeptService;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-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 org.springframework.web.bind.annotation.*;
|
|
|
import com.yijia.common.annotation.Log;
|
|
|
import com.yijia.common.core.controller.BaseController;
|
|
|
import com.yijia.common.core.domain.AjaxResult;
|
|
@@ -44,12 +37,18 @@ public class LabelRuleController extends BaseController
|
|
|
|
|
|
@Autowired
|
|
|
private ISysDeptService deptService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ILabelRuleDetailService labelRuleDetailService;
|
|
|
/**
|
|
|
* 查询标签规则列表
|
|
|
*/
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(LabelRule labelRule)
|
|
|
{
|
|
|
+ LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
+ labelRule.setStationId(currentUser.getUser().getDeptId());
|
|
|
+ labelRule.setDelFlag("0");
|
|
|
startPage();
|
|
|
List<LabelRule> list = labelRuleService.selectLabelRuleList(labelRule);
|
|
|
return getDataTable(list);
|
|
@@ -76,51 +75,89 @@ public class LabelRuleController extends BaseController
|
|
|
return AjaxResult.success(labelRuleService.selectLabelRuleById(id));
|
|
|
}
|
|
|
|
|
|
-// @GetMapping("/sysDeptDemoList")
|
|
|
-// public AjaxResult sysDeptDemoList()
|
|
|
-// {
|
|
|
-// LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
-// SysDeptDemo sysDeptDemo = new SysDeptDemo();
|
|
|
-// SysDept dept = deptService.selectDeptById(currentUser.getUser().getDeptId());
|
|
|
-// BeanUtils.copyProperties(sysDeptDemo, dept);
|
|
|
-// LabelRule labelRule =new LabelRule();
|
|
|
-// labelRule.setStationId(currentUser.getUser().getDeptId());
|
|
|
-// List<LabelRule> list = labelRuleService.selectLabelRuleList(labelRule);
|
|
|
-// sysDeptDemo.setLabelArr(list);
|
|
|
-// return AjaxResult.success(sysDeptDemo);
|
|
|
-// }
|
|
|
/**
|
|
|
- * 新增标签规则
|
|
|
+ *标签功能是否开启,标签名
|
|
|
*/
|
|
|
-// @Log(title = "标签规则", businessType = BusinessType.INSERT)
|
|
|
-// @PostMapping
|
|
|
-// @Transactional
|
|
|
-// public AjaxResult add(@RequestBody SysDeptDemo sysDeptDemo)
|
|
|
-// {
|
|
|
-// int i =0;
|
|
|
-// LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
-// //根据demo获取添加数据
|
|
|
-// if(sysDeptDemo!=null){
|
|
|
-// SysDept dept =new SysDept();
|
|
|
-// dept.setDeptId(sysDeptDemo.getDeptId());
|
|
|
-// dept.setLabelFlag(sysDeptDemo.getLabelFlag());
|
|
|
-// dept.setUpdateBy(currentUser.getUser().getUserId()+"");
|
|
|
-// dept.setUpdateTime(DateUtils.getNowDate());
|
|
|
-// i = deptService.updateDeptInfo(dept);
|
|
|
-// if(sysDeptDemo.getLabelArr()!=null && sysDeptDemo.getLabelArr().size()>0){
|
|
|
-// for(LabelRule labelRule : sysDeptDemo.getLabelArr()) {
|
|
|
-// if(labelRule.getId()!=null){
|
|
|
-// labelRule.setUpdateBy(currentUser.getUser().getUserId()+"");
|
|
|
-// i=labelRuleService.updateLabelRule(labelRule);
|
|
|
-// }else{
|
|
|
-// labelRule.setCreateBy(currentUser.getUser().getUserId()+"");
|
|
|
-// i=labelRuleService.insertLabelRule(labelRule);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return toAjax(i);
|
|
|
-// }
|
|
|
+
|
|
|
+ @GetMapping("/sysDeptDemoList")
|
|
|
+ public AjaxResult sysDeptDemoList()
|
|
|
+ {
|
|
|
+ LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
+ SysDept dept = deptService.selectDeptById(currentUser.getUser().getDeptId());
|
|
|
+ RequsetSysDept requsetSysDept = new RequsetSysDept();
|
|
|
+ BeanUtils.copyProperties(dept,requsetSysDept);
|
|
|
+ LabelRule labelRule =new LabelRule();
|
|
|
+ labelRule.setStationId(currentUser.getUser().getDeptId());
|
|
|
+ labelRule.setDelFlag("0");
|
|
|
+ List<LabelRule> list = labelRuleService.selectLabelRuleList(labelRule);
|
|
|
+ requsetSysDept.setLabelArr(list);
|
|
|
+ return AjaxResult.success(requsetSysDept);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/selectLabelList")
|
|
|
+ public AjaxResult selectLabelList()
|
|
|
+ {
|
|
|
+ LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
+ SysDept dept = deptService.selectDeptById(currentUser.getUser().getDeptId());
|
|
|
+ RequsetSysDept requsetSysDept = new RequsetSysDept();
|
|
|
+ BeanUtils.copyProperties(dept,requsetSysDept);
|
|
|
+ if(requsetSysDept!=null && requsetSysDept.getLabelFlag()!=null && requsetSysDept.getLabelFlag().equals("1")){
|
|
|
+ LabelRule labelRule =new LabelRule();
|
|
|
+ labelRule.setStationId(currentUser.getUser().getDeptId());
|
|
|
+ labelRule.setDelFlag("0");
|
|
|
+ startPage();
|
|
|
+ List<LabelRule> list = labelRuleService.selectLabelRuleList(labelRule);
|
|
|
+ if(list!=null && list.size()>0){
|
|
|
+ for(LabelRule rule:list){
|
|
|
+ LabelRuleDetail detail =new LabelRuleDetail();
|
|
|
+ detail.setParentId(rule.getId());
|
|
|
+ detail.setDelFlag("0");
|
|
|
+ List<LabelRuleDetail> labelRuleDetailList = labelRuleDetailService.selectLabelRuleDetailList(detail);
|
|
|
+ if(labelRuleDetailList!=null && labelRuleDetailList.size()>0){
|
|
|
+ rule.setLabelRuleDetailList(labelRuleDetailList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ requsetSysDept.setLabelArr(list);
|
|
|
+ }
|
|
|
+ return AjaxResult.success(requsetSysDept);
|
|
|
+ }
|
|
|
+ @Log(title = "标签规则", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/addlabel")
|
|
|
+ @Transactional
|
|
|
+ public AjaxResult addlabel(@RequestBody RequsetSysDept requsetSysDept)
|
|
|
+ {
|
|
|
+ int i =0;
|
|
|
+ LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
+ //根据demo获取添加数据
|
|
|
+ if(requsetSysDept!=null){
|
|
|
+ SysDept dept =new SysDept();
|
|
|
+ dept.setDeptId(currentUser.getUser().getDeptId());
|
|
|
+ dept.setLabelFlag(requsetSysDept.getLabelFlag());
|
|
|
+ dept.setUpdateBy(currentUser.getUser().getUserId()+"");
|
|
|
+ dept.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ i = deptService.updateDeptInfo(dept);
|
|
|
+ if(requsetSysDept.getLabelArr()!=null && requsetSysDept.getLabelArr().size()>0){
|
|
|
+ for(LabelRule labelRule : requsetSysDept.getLabelArr()) {
|
|
|
+ if(labelRule.getId()!=null){
|
|
|
+ labelRule.setUpdateBy(currentUser.getUser().getUserId()+"");
|
|
|
+ i=labelRuleService.updateLabelRule(labelRule);
|
|
|
+ }else{
|
|
|
+ labelRule.setStationId(currentUser.getUser().getDeptId());
|
|
|
+ labelRule.setCreateBy(currentUser.getUser().getUserId()+"");
|
|
|
+ labelRule.setDelFlag("0");
|
|
|
+ i=labelRuleService.insertLabelRule(labelRule);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(requsetSysDept.getDelArr()!=null &&requsetSysDept.getDelArr().size()>0){
|
|
|
+ List<Integer> idlist =requsetSysDept.getDelArr();
|
|
|
+ Integer[] ints = idlist.toArray(new Integer[0]);
|
|
|
+ labelRuleService.deleteLabelRuleByIds(ints);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return toAjax(i);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 修改标签规则
|