Browse Source

考核规则

dev
尹作梅 6 years ago
parent
commit
7f1c9f1a5f
  1. 97
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/KpiRuleDTO.java
  2. 87
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/KpiRuleParamDTO.java
  3. 82
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/form/KpiRuleSaveOrUpdateFormDTO.java
  4. 29
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/result/KpiFormulaDictResultDTO.java
  5. 87
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/result/KpiRuleQueryResultDTO.java
  6. 85
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiFormulaController.java
  7. 145
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiRuleController.java
  8. 94
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiRuleParamController.java
  9. 11
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiFormulaDao.java
  10. 64
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiRuleDao.java
  11. 41
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiRuleParamDao.java
  12. 66
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/KpiRuleEntity.java
  13. 56
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/KpiRuleParamEntity.java
  14. 71
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/KpiRuleExcel.java
  15. 65
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/KpiRuleParamExcel.java
  16. 47
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/KpiRuleParamRedis.java
  17. 47
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/KpiRuleRedis.java
  18. 134
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiFormulaService.java
  19. 95
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiRuleParamService.java
  20. 134
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiRuleService.java
  21. 37
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiFormulaServiceImpl.java
  22. 104
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiRuleParamServiceImpl.java
  23. 225
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiRuleServiceImpl.java
  24. 14
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiFormulaDao.xml
  25. 126
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiRuleDao.xml
  26. 22
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiRuleParamDao.xml

97
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/KpiRuleDTO.java

@ -0,0 +1,97 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 考核规则表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@Data
public class KpiRuleDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 考核规则名称
*/
private String ruleName;
/**
* 考核规则编码
*/
private String ruleCode;
/**
* 规则生成方式(0-元公式1-手工打分2-投票)
*/
private String ruleMode;
/**
* 引用ID(公式id投票等)
*/
private String referenceId;
/**
* 考核周期(字典值)
*/
private String kpiCycle;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 删除标记
*/
private String delFlag;
}

87
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/KpiRuleParamDTO.java

@ -0,0 +1,87 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 公式参数表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@Data
public class KpiRuleParamDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 规则ID
*/
private String ruleId;
/**
* 元数据编码(数据字典值)
*/
private String metaDataCode;
/**
* 参数顺序
*/
private Integer sort;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 删除标记
*/
private String delFlag;
}

82
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/form/KpiRuleSaveOrUpdateFormDTO.java

@ -0,0 +1,82 @@
package com.elink.esua.epdc.dto.form;
import com.elink.esua.epdc.dto.KpiRuleParamDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Description 新增修改考核规则入参DTO
* @Author yinzuomei
* @Date 2019/11/27 16:21
*/
@Data
public class KpiRuleSaveOrUpdateFormDTO implements Serializable {
private static final long serialVersionUID = 6944783947114092507L;
/**
* 主键
*/
private String id;
/**
* 考核规则名称
*/
private String ruleName;
/**
* 考核规则编码
*/
private String ruleCode;
/**
* 规则生成方式(0-元公式1-手工打分2-投票)
*/
private String ruleMode;
/**
* 引用ID(公式id投票等)
*/
private String referenceId;
/**
* 考核周期(字典值)
*/
private String kpiCycle;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 删除标记
*/
private String delFlag;
/**
* 公式参数表
*/
private List<KpiRuleParamDTO> ruleParamList;
}

29
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/result/KpiFormulaDictResultDTO.java

@ -0,0 +1,29 @@
package com.elink.esua.epdc.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 新增考核规则界面[引用]下拉框
* @Author yinzuomei
* @Date 2019/11/27 14:00
*/
@Data
public class KpiFormulaDictResultDTO implements Serializable {
private static final long serialVersionUID = -51706543080866619L;
/**
* 主键
*/
private String id;
/**
* 公式名称
*/
private String formulaName;
/**
* 公式参数数量
*/
private Integer paramAmount;
}

87
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/result/KpiRuleQueryResultDTO.java

@ -0,0 +1,87 @@
package com.elink.esua.epdc.dto.result;
import com.elink.esua.epdc.dto.KpiRuleParamDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Description 考核规则列表查询返参DTO
* @Author yinzuomei
* @Date 2019/11/27 13:23
*/
@Data
public class KpiRuleQueryResultDTO implements Serializable {
private static final long serialVersionUID = 8268124759182327315L;
/**
* 主键
*/
private String id;
/**
* 考核规则名称
*/
private String ruleName;
/**
* 考核规则编码
*/
private String ruleCode;
/**
* 规则生成方式(0-元公式1-手工打分2-投票)
*/
private String ruleMode;
/**
* 引用ID(公式id投票等)
*/
private String referenceId;
/**
* 考核周期(字典值)
*/
private String kpiCycle;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 删除标记
*/
private String delFlag;
/**
* 引用名称
*/
private String referenceName;
/**
* 参数集合
*/
private List<KpiRuleParamDTO> ruleParamList;
}

85
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiFormulaController.java

@ -18,6 +18,7 @@
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.dto.KpiFormulaDTO;
import com.elink.esua.epdc.dto.result.KpiFormulaDictResultDTO;
import com.elink.esua.epdc.excel.KpiFormulaExcel;
import com.elink.esua.epdc.service.KpiFormulaService;
import com.elink.esua.epdc.commons.tools.page.PageData;
@ -46,48 +47,58 @@ import java.util.Map;
@RequestMapping("kpiformula")
public class KpiFormulaController {
@Autowired
private KpiFormulaService kpiFormulaService;
@Autowired
private KpiFormulaService kpiFormulaService;
@GetMapping("page")
public Result<PageData<KpiFormulaDTO>> page(@RequestParam Map<String, Object> params){
PageData<KpiFormulaDTO> page = kpiFormulaService.page(params);
return new Result<PageData<KpiFormulaDTO>>().ok(page);
}
@GetMapping("page")
public Result<PageData<KpiFormulaDTO>> page(@RequestParam Map<String, Object> params) {
PageData<KpiFormulaDTO> page = kpiFormulaService.page(params);
return new Result<PageData<KpiFormulaDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<KpiFormulaDTO> get(@PathVariable("id") String id){
KpiFormulaDTO data = kpiFormulaService.get(id);
return new Result<KpiFormulaDTO>().ok(data);
}
@GetMapping("{id}")
public Result<KpiFormulaDTO> get(@PathVariable("id") String id) {
KpiFormulaDTO data = kpiFormulaService.get(id);
return new Result<KpiFormulaDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody KpiFormulaDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
//kpiFormulaService.save(dto);
return kpiFormulaService.saveKpiFormula(dto);
}
@PostMapping
public Result save(@RequestBody KpiFormulaDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
//kpiFormulaService.save(dto);
return kpiFormulaService.saveKpiFormula(dto);
}
@PutMapping
public Result update(@RequestBody KpiFormulaDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
return kpiFormulaService.update(dto);
}
@PutMapping
public Result update(@RequestBody KpiFormulaDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
return kpiFormulaService.update(dto);
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
kpiFormulaService.delete(ids);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
return kpiFormulaService.delete(ids);
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<KpiFormulaDTO> list = kpiFormulaService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, KpiFormulaExcel.class);
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<KpiFormulaDTO> list = kpiFormulaService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, KpiFormulaExcel.class);
}
/**
* @param
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.result.KpiFormulaDictResultDTO>
* @Author yinzuomei
* @Description 获取公式id公式名称供下拉框使用
* @Date 2019/11/27 14:02
**/
@GetMapping("getKpiFormulaList")
public Result<List<KpiFormulaDictResultDTO>> getKpiFormulaList() {
return kpiFormulaService.listKpiFormulaDictResultDTO();
}
}

145
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiRuleController.java

@ -0,0 +1,145 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.KpiRuleDTO;
import com.elink.esua.epdc.dto.form.KpiRuleSaveOrUpdateFormDTO;
import com.elink.esua.epdc.dto.result.KpiRuleQueryResultDTO;
import com.elink.esua.epdc.excel.KpiRuleExcel;
import com.elink.esua.epdc.service.KpiRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 考核规则表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@RestController
@RequestMapping("kpirule")
public class KpiRuleController {
@Autowired
private KpiRuleService kpiRuleService;
@GetMapping("page")
public Result<PageData<KpiRuleDTO>> page(@RequestParam Map<String, Object> params) {
PageData<KpiRuleDTO> page = kpiRuleService.page(params);
return new Result<PageData<KpiRuleDTO>>().ok(page);
}
/*@GetMapping("{id}")
public Result<KpiRuleDTO> get(@PathVariable("id") String id){
KpiRuleDTO data = kpiRuleService.get(id);
return new Result<KpiRuleDTO>().ok(data);
}*/
@PostMapping
public Result save(@RequestBody KpiRuleDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
kpiRuleService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody KpiRuleDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
kpiRuleService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
kpiRuleService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<KpiRuleDTO> list = kpiRuleService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, KpiRuleExcel.class);
}
/**
* @param params
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.commons.tools.page.PageData < com.elink.esua.epdc.dto.KpiRuleDTO>>
* @Author yinzuomei
* @Description 列表查询
* @Date 2019/11/27 13:22
**/
@GetMapping("query")
public Result<PageData<KpiRuleQueryResultDTO>> query(@RequestParam Map<String, Object> params) {
PageData<KpiRuleQueryResultDTO> page = kpiRuleService.query(params);
return new Result<PageData<KpiRuleQueryResultDTO>>().ok(page);
}
/**
* @param id
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.result.KpiRuleQueryResultDTO>
* @Author yinzuomei
* @Description 查询详情
* @Date 2019/11/27 15:17
**/
@GetMapping("{id}")
public Result<KpiRuleQueryResultDTO> queryDetailInfo(@PathVariable("id") String id) {
KpiRuleQueryResultDTO data = kpiRuleService.queryDetailInfo(id);
return new Result<KpiRuleQueryResultDTO>().ok(data);
}
/**
* @param dto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @Author yinzuomei
* @Description 新增
* @Date 2019/11/27 16:23
**/
@PostMapping("saveOrUpdate")
public Result add(@RequestBody KpiRuleSaveOrUpdateFormDTO dto) {
return kpiRuleService.add(dto);
}
/**
* @param dto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @Author yinzuomei
* @Description 修改
* @Date 2019/11/27 16:20
**/
@PutMapping("saveOrUpdate")
public Result edit(@RequestBody KpiRuleSaveOrUpdateFormDTO dto) {
return kpiRuleService.edit(dto);
}
}

94
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiRuleParamController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.KpiRuleParamDTO;
import com.elink.esua.epdc.excel.KpiRuleParamExcel;
import com.elink.esua.epdc.service.KpiRuleParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 公式参数表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@RestController
@RequestMapping("kpiruleparam")
public class KpiRuleParamController {
@Autowired
private KpiRuleParamService kpiRuleParamService;
@GetMapping("page")
public Result<PageData<KpiRuleParamDTO>> page(@RequestParam Map<String, Object> params) {
PageData<KpiRuleParamDTO> page = kpiRuleParamService.page(params);
return new Result<PageData<KpiRuleParamDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<KpiRuleParamDTO> get(@PathVariable("id") String id) {
KpiRuleParamDTO data = kpiRuleParamService.get(id);
return new Result<KpiRuleParamDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody KpiRuleParamDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
kpiRuleParamService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody KpiRuleParamDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
kpiRuleParamService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
kpiRuleParamService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<KpiRuleParamDTO> list = kpiRuleParamService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, KpiRuleParamExcel.class);
}
}

11
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiFormulaDao.java

@ -17,10 +17,13 @@
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.dto.result.KpiFormulaDictResultDTO;
import com.elink.esua.epdc.entity.KpiFormulaEntity;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 绩效考核公式
*
@ -30,4 +33,12 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface KpiFormulaDao extends BaseDao<KpiFormulaEntity> {
/**
* @param
* @return java.util.List<com.elink.esua.epdc.dto.result.KpiFormulaDictResultDTO>
* @Author yinzuomei
* @Description 获取公式id公式名称供下拉框使用
* @Date 2019/11/27 14:11
**/
List<KpiFormulaDictResultDTO> selectListKpiFormulaDictResultDTO();
}

64
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiRuleDao.java

@ -0,0 +1,64 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.KpiRuleParamDTO;
import com.elink.esua.epdc.dto.result.KpiRuleQueryResultDTO;
import com.elink.esua.epdc.entity.KpiRuleEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 考核规则表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@Mapper
public interface KpiRuleDao extends BaseDao<KpiRuleEntity> {
/**
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.result.KpiRuleQueryResultDTO>
* @Author yinzuomei
* @Description 列表查询
* @Date 2019/11/27 13:32
**/
List<KpiRuleQueryResultDTO> selectListKpiRuleQueryResultDTO(Map<String, Object> params);
/**
* @param ruleId
* @return java.util.List<com.elink.esua.epdc.dto.result.KpiRuleParamInfoDTO>
* @Author yinzuomei
* @Description 根据规则id查询公式参数表
* @Date 2019/11/27 15:32
**/
List<KpiRuleParamDTO> selectKpiRuleParamInfoDTO(String ruleId);
/**
* @param id 考核规则表主键
* @return com.elink.esua.epdc.dto.result.KpiRuleQueryResultDTO
* @Author yinzuomei
* @Description 查询详情
* @Date 2019/11/27 15:19
**/
KpiRuleQueryResultDTO queryDetailInfo(String id);
}

41
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiRuleParamDao.java

@ -0,0 +1,41 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.KpiRuleParamEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 公式参数表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@Mapper
public interface KpiRuleParamDao extends BaseDao<KpiRuleParamEntity> {
/**
* @param id 规则ID
* @return int
* @Author yinzuomei
* @Description 根据规则id删除公式参数表记录
* @Date 2019/11/27 16:36
**/
int deleteByRuleId(String id);
}

66
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/KpiRuleEntity.java

@ -0,0 +1,66 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 考核规则表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_kpi_rule")
public class KpiRuleEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 考核规则名称
*/
private String ruleName;
/**
* 考核规则编码
*/
private String ruleCode;
/**
* 规则生成方式(0-元公式1-手工打分2-投票)
*/
private String ruleMode;
/**
* 引用ID(公式id投票等)
*/
private String referenceId;
/**
* 考核周期(字典值)
*/
private String kpiCycle;
}

56
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/KpiRuleParamEntity.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 公式参数表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_kpi_rule_param")
public class KpiRuleParamEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 规则ID
*/
private String ruleId;
/**
* 元数据编码(数据字典值)
*/
private String metaDataCode;
/**
* 参数顺序
*/
private Integer sort;
}

71
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/KpiRuleExcel.java

@ -0,0 +1,71 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 考核规则表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@Data
public class KpiRuleExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "考核规则名称")
private String ruleName;
@Excel(name = "考核规则编码")
private String ruleCode;
@Excel(name = "规则生成方式(0-元公式,1-手工打分,2-投票)")
private String ruleMode;
@Excel(name = "引用ID(公式id、投票等)")
private String referenceId;
@Excel(name = "考核周期(字典值)")
private String kpiCycle;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
@Excel(name = "删除标记")
private String delFlag;
}

65
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/KpiRuleParamExcel.java

@ -0,0 +1,65 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 公式参数表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@Data
public class KpiRuleParamExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "规则ID")
private String ruleId;
@Excel(name = "元数据编码(数据字典值)")
private String metaDataCode;
@Excel(name = "参数顺序")
private Integer sort;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
@Excel(name = "删除标记")
private String delFlag;
}

47
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/KpiRuleParamRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.redis;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 公式参数表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@Component
public class KpiRuleParamRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/KpiRuleRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.redis;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 考核规则表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@Component
public class KpiRuleRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

134
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiFormulaService.java

@ -20,6 +20,7 @@ package com.elink.esua.epdc.service;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.KpiFormulaDTO;
import com.elink.esua.epdc.dto.result.KpiFormulaDictResultDTO;
import com.elink.esua.epdc.entity.KpiFormulaEntity;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
@ -35,72 +36,81 @@ import java.util.Map;
*/
public interface KpiFormulaService extends BaseService<KpiFormulaEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<KpiFormulaDTO>
* @author generator
* @date 2019-11-26
*/
PageData<KpiFormulaDTO> page(Map<String, Object> params);
/**
* 默认分页
*
* @param params
* @return PageData<KpiFormulaDTO>
* @author generator
* @date 2019-11-26
*/
PageData<KpiFormulaDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<KpiFormulaDTO>
* @author generator
* @date 2019-11-26
*/
List<KpiFormulaDTO> list(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<KpiFormulaDTO>
* @author generator
* @date 2019-11-26
*/
List<KpiFormulaDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return KpiFormulaDTO
* @author generator
* @date 2019-11-26
*/
KpiFormulaDTO get(String id);
/**
* 单条查询
*
* @param id
* @return KpiFormulaDTO
* @author generator
* @date 2019-11-26
*/
KpiFormulaDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2019-11-26
*/
void save(KpiFormulaDTO dto);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2019-11-26
*/
void save(KpiFormulaDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2019-11-26
*/
Result update(KpiFormulaDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2019-11-26
*/
Result update(KpiFormulaDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2019-11-26
*/
void delete(String[] ids);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2019-11-26
*/
Result delete(String[] ids);
/**
* @param dto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @Author yinzuomei
* @Description 新增
* @Date 2019/11/26 17:14
**/
Result saveKpiFormula(KpiFormulaDTO dto);
/**
* @param dto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @Author yinzuomei
* @Description 新增
* @Date 2019/11/26 17:14
**/
Result saveKpiFormula(KpiFormulaDTO dto);
/**
* @param
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.result.KpiFormulaDictResultDTO>
* @Author yinzuomei
* @Description 获取公式id公式名称供下拉框使用
* @Date 2019/11/27 14:02
**/
Result<List<KpiFormulaDictResultDTO>> listKpiFormulaDictResultDTO();
}

95
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiRuleParamService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.KpiRuleParamDTO;
import com.elink.esua.epdc.entity.KpiRuleParamEntity;
import java.util.List;
import java.util.Map;
/**
* 公式参数表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
public interface KpiRuleParamService extends BaseService<KpiRuleParamEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<KpiRuleParamDTO>
* @author generator
* @date 2019-11-27
*/
PageData<KpiRuleParamDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<KpiRuleParamDTO>
* @author generator
* @date 2019-11-27
*/
List<KpiRuleParamDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return KpiRuleParamDTO
* @author generator
* @date 2019-11-27
*/
KpiRuleParamDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2019-11-27
*/
void save(KpiRuleParamDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2019-11-27
*/
void update(KpiRuleParamDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2019-11-27
*/
void delete(String[] ids);
}

134
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiRuleService.java

@ -0,0 +1,134 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.KpiRuleDTO;
import com.elink.esua.epdc.dto.form.KpiRuleSaveOrUpdateFormDTO;
import com.elink.esua.epdc.dto.result.KpiRuleQueryResultDTO;
import com.elink.esua.epdc.entity.KpiRuleEntity;
import java.util.List;
import java.util.Map;
/**
* 考核规则表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
public interface KpiRuleService extends BaseService<KpiRuleEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<KpiRuleDTO>
* @author generator
* @date 2019-11-27
*/
PageData<KpiRuleDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<KpiRuleDTO>
* @author generator
* @date 2019-11-27
*/
List<KpiRuleDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return KpiRuleDTO
* @author generator
* @date 2019-11-27
*/
KpiRuleDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2019-11-27
*/
void save(KpiRuleDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2019-11-27
*/
void update(KpiRuleDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2019-11-27
*/
void delete(String[] ids);
/**
* @param params
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.result.KpiRuleQueryResultDTO>
* @Author yinzuomei
* @Description 列表查询
* @Date 2019/11/27 13:29
**/
PageData<KpiRuleQueryResultDTO> query(Map<String, Object> params);
/**
* @param id 考核规则表主键
* @return com.elink.esua.epdc.dto.result.KpiRuleQueryResultDTO
* @Author yinzuomei
* @Description 查询详情
* @Date 2019/11/27 15:17
**/
KpiRuleQueryResultDTO queryDetailInfo(String id);
/**
* @param dto
* @return void
* @Author yinzuomei
* @Description 新增
* @Date 2019/11/27 16:27
**/
Result add(KpiRuleSaveOrUpdateFormDTO dto);
/**
* @param dto
* @return void
* @Author yinzuomei
* @Description 修改
* @Date 2019/11/27 16:27
**/
Result edit(KpiRuleSaveOrUpdateFormDTO dto);
}

37
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiFormulaServiceImpl.java

@ -19,16 +19,19 @@ package com.elink.esua.epdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dao.KpiFormulaDao;
import com.elink.esua.epdc.dao.KpiRuleDao;
import com.elink.esua.epdc.dto.KpiFormulaDTO;
import com.elink.esua.epdc.dto.result.KpiFormulaDictResultDTO;
import com.elink.esua.epdc.entity.KpiFormulaEntity;
import com.elink.esua.epdc.entity.KpiRuleEntity;
import com.elink.esua.epdc.redis.KpiFormulaRedis;
import com.elink.esua.epdc.service.KpiFormulaService;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -37,7 +40,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -53,7 +55,8 @@ public class KpiFormulaServiceImpl extends BaseServiceImpl<KpiFormulaDao, KpiFor
@Autowired
private KpiFormulaRedis kpiFormulaRedis;
@Autowired
private KpiRuleDao kpiRuleDao;
@Override
public PageData<KpiFormulaDTO> page(Map<String, Object> params) {
QueryWrapper<KpiFormulaEntity> wrapper=new QueryWrapper<>();
@ -127,9 +130,17 @@ public class KpiFormulaServiceImpl extends BaseServiceImpl<KpiFormulaDao, KpiFor
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
public Result delete(String[] ids) {
//如果已经被考核规则使用则不能删除
QueryWrapper<KpiRuleEntity> kpiRuleEntityQueryWrapper = new QueryWrapper<>();
kpiRuleEntityQueryWrapper.in(ids.length>0,"reference_id",ids);
List<KpiRuleEntity> kpiRuleEntityList= kpiRuleDao.selectList(kpiRuleEntityQueryWrapper);
if(null!=kpiRuleEntityList&&kpiRuleEntityList.size()>0){
return new Result().error("存在公式被引用,不允许删除");
}
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
return new Result();
}
/**
@ -162,4 +173,16 @@ public class KpiFormulaServiceImpl extends BaseServiceImpl<KpiFormulaDao, KpiFor
return new Result();
}
/**
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.result.KpiFormulaDictResultDTO>
* @Author yinzuomei
* @Description 获取公式id公式名称供下拉框使用
* @Date 2019/11/27 14:02
**/
@Override
public Result<List<KpiFormulaDictResultDTO>> listKpiFormulaDictResultDTO() {
List<KpiFormulaDictResultDTO> list=baseDao.selectListKpiFormulaDictResultDTO();
return new Result<List<KpiFormulaDictResultDTO>>().ok(list);
}
}

104
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiRuleParamServiceImpl.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.dao.KpiRuleParamDao;
import com.elink.esua.epdc.dto.KpiRuleParamDTO;
import com.elink.esua.epdc.entity.KpiRuleParamEntity;
import com.elink.esua.epdc.redis.KpiRuleParamRedis;
import com.elink.esua.epdc.service.KpiRuleParamService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 公式参数表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@Service
public class KpiRuleParamServiceImpl extends BaseServiceImpl<KpiRuleParamDao, KpiRuleParamEntity> implements KpiRuleParamService {
@Autowired
private KpiRuleParamRedis kpiRuleParamRedis;
@Override
public PageData<KpiRuleParamDTO> page(Map<String, Object> params) {
IPage<KpiRuleParamEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, KpiRuleParamDTO.class);
}
@Override
public List<KpiRuleParamDTO> list(Map<String, Object> params) {
List<KpiRuleParamEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, KpiRuleParamDTO.class);
}
private QueryWrapper<KpiRuleParamEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<KpiRuleParamEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public KpiRuleParamDTO get(String id) {
KpiRuleParamEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, KpiRuleParamDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(KpiRuleParamDTO dto) {
KpiRuleParamEntity entity = ConvertUtils.sourceToTarget(dto, KpiRuleParamEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(KpiRuleParamDTO dto) {
KpiRuleParamEntity entity = ConvertUtils.sourceToTarget(dto, KpiRuleParamEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

225
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiRuleServiceImpl.java

@ -0,0 +1,225 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dao.KpiFormulaDao;
import com.elink.esua.epdc.dao.KpiRuleDao;
import com.elink.esua.epdc.dao.KpiRuleParamDao;
import com.elink.esua.epdc.dto.KpiRuleDTO;
import com.elink.esua.epdc.dto.KpiRuleParamDTO;
import com.elink.esua.epdc.dto.form.KpiRuleSaveOrUpdateFormDTO;
import com.elink.esua.epdc.dto.result.KpiRuleQueryResultDTO;
import com.elink.esua.epdc.entity.KpiFormulaEntity;
import com.elink.esua.epdc.entity.KpiRuleEntity;
import com.elink.esua.epdc.entity.KpiRuleParamEntity;
import com.elink.esua.epdc.redis.KpiRuleRedis;
import com.elink.esua.epdc.service.KpiRuleParamService;
import com.elink.esua.epdc.service.KpiRuleService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 考核规则表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-11-27
*/
@Service
public class KpiRuleServiceImpl extends BaseServiceImpl<KpiRuleDao, KpiRuleEntity> implements KpiRuleService {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private KpiRuleRedis kpiRuleRedis;
@Autowired
private KpiRuleParamService kpiRuleParamService;
@Autowired
private KpiRuleParamDao kpiRuleParamDao;
@Autowired
private KpiFormulaDao kpiFormulaDao;
@Override
public PageData<KpiRuleDTO> page(Map<String, Object> params) {
String ruleName = params.containsKey("ruleName") ? params.get("ruleName").toString() : null;
QueryWrapper<KpiRuleEntity> wrapper = new QueryWrapper<>();
wrapper.like(StringUtils.isNotBlank(ruleName), "rule_name", ruleName);
IPage<KpiRuleEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
wrapper
);
return getPageData(page, KpiRuleDTO.class);
}
@Override
public List<KpiRuleDTO> list(Map<String, Object> params) {
List<KpiRuleEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, KpiRuleDTO.class);
}
private QueryWrapper<KpiRuleEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<KpiRuleEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public KpiRuleDTO get(String id) {
KpiRuleEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, KpiRuleDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(KpiRuleDTO dto) {
KpiRuleEntity entity = ConvertUtils.sourceToTarget(dto, KpiRuleEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(KpiRuleDTO dto) {
KpiRuleEntity entity = ConvertUtils.sourceToTarget(dto, KpiRuleEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
QueryWrapper<KpiRuleParamEntity> kpiRuleParamEntityQueryWrapper = new QueryWrapper<>();
kpiRuleParamEntityQueryWrapper.in(ids.length>0,"RULE_ID",ids);
kpiRuleParamDao.delete(kpiRuleParamEntityQueryWrapper);
}
/**
* @param params
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.result.KpiRuleQueryResultDTO>
* @Author yinzuomei
* @Description 列表查询
* @Date 2019/11/27 13:29
**/
@Override
public PageData<KpiRuleQueryResultDTO> query(Map<String, Object> params) {
IPage<KpiRuleQueryResultDTO> page = getPage(params);
List<KpiRuleQueryResultDTO> list = baseDao.selectListKpiRuleQueryResultDTO(params);
return new PageData<>(list, page.getTotal());
}
/**
* @param id 考核规则表主键
* @return com.elink.esua.epdc.dto.result.KpiRuleQueryResultDTO
* @Author yinzuomei
* @Description 查询详情
* @Date 2019/11/27 15:17
**/
@Override
public KpiRuleQueryResultDTO queryDetailInfo(String id) {
return baseDao.queryDetailInfo(id);
}
/**
* @param dto
* @return void
* @Author yinzuomei
* @Description 新增
* @Date 2019/11/27 16:27
**/
@Override
@Transactional(rollbackFor = Exception.class)
public Result add(KpiRuleSaveOrUpdateFormDTO dto) {
Result checkResult = this.checkKpiRuleSaveOrUpdateFormDTO(dto);
if (checkResult.getCode() != 0) {
return checkResult;
}
KpiRuleEntity entity = ConvertUtils.sourceToTarget(dto, KpiRuleEntity.class);
logger.info("考核规则表id=" + entity.getId());
insert(entity);
List<KpiRuleParamDTO> ruleParamList = dto.getRuleParamList();
for (KpiRuleParamDTO kpiRuleParamDTO : ruleParamList) {
kpiRuleParamDTO.setRuleId(entity.getId());
kpiRuleParamService.save(kpiRuleParamDTO);
}
return new Result();
}
/**
* @param dto
* @return void
* @Author yinzuomei
* @Description 修改
* @Date 2019/11/27 16:27
**/
@Override
@Transactional(rollbackFor = Exception.class)
public Result edit(KpiRuleSaveOrUpdateFormDTO dto) {
Result checkResult = this.checkKpiRuleSaveOrUpdateFormDTO(dto);
if (checkResult.getCode() != 0) {
return checkResult;
}
KpiRuleEntity entity = ConvertUtils.sourceToTarget(dto, KpiRuleEntity.class);
updateById(entity);
//全部删除参数记录表
int deleteResultNum = kpiRuleParamDao.deleteByRuleId(entity.getId());
logger.info("删除了" + deleteResultNum + "条记录");
List<KpiRuleParamDTO> ruleParamList = dto.getRuleParamList();
for (KpiRuleParamDTO kpiRuleParamDTO : ruleParamList) {
kpiRuleParamDTO.setId(null);
kpiRuleParamDTO.setRuleId(entity.getId());
kpiRuleParamService.save(kpiRuleParamDTO);
}
return new Result();
}
public Result checkKpiRuleSaveOrUpdateFormDTO(KpiRuleSaveOrUpdateFormDTO dto) {
if (("0").equals(dto.getRuleMode())) {
KpiFormulaEntity kpiFormulaEntity = kpiFormulaDao.selectById(dto.getReferenceId());
if (kpiFormulaEntity.getParamAmount() != dto.getRuleParamList().size()) {
return new Result().error("公式缺少入参");
}
//校验sort唯一性
int sort = 0;
for (KpiRuleParamDTO kpiRuleParamDTO : dto.getRuleParamList()) {
if (kpiRuleParamDTO.getSort() == sort) {
return new Result().error("参数排序不唯一,请重新编辑");
}
sort = kpiRuleParamDTO.getSort();
}
}
return new Result();
}
}

14
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiFormulaDao.xml

@ -20,5 +20,17 @@
<result property="delFlag" column="DEL_FLAG"/>
</resultMap>
<!-- 获取公式id、公式名称供下拉框使用 -->
<select id="selectListKpiFormulaDictResultDTO" resultType="com.elink.esua.epdc.dto.result.KpiFormulaDictResultDTO">
SELECT
ekf.id,
ekf.`NAME` as formulaName,
ekf.PARAM_AMOUNT as paramAmount
FROM
epdc_kpi_formula ekf
WHERE
ekf.DEL_FLAG = '0'
ORDER BY
ekf.CREATED_TIME DESC
</select>
</mapper>

126
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiRuleDao.xml

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.KpiRuleDao">
<resultMap type="com.elink.esua.epdc.entity.KpiRuleEntity" id="kpiRuleMap">
<result property="id" column="id"/>
<result property="ruleName" column="rule_name"/>
<result property="ruleCode" column="rule_code"/>
<result property="ruleMode" column="rule_mode"/>
<result property="referenceId" column="reference_id"/>
<result property="kpiCycle" column="kpi_cycle"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="delFlag" column="DEL_FLAG"/>
</resultMap>
<!-- 列表查询 -->
<select id="selectListKpiRuleQueryResultDTO" parameterType="map" resultType="com.elink.esua.epdc.dto.result.KpiRuleQueryResultDTO">
SELECT
ekr.ID as id,
ekr.rule_name as ruleName,
ekr.rule_code as ruleCode,
ekr.rule_mode as ruleMode,
ekr.reference_id as referenceId,
ekr.kpi_cycle as kpiCycle,
ekr.revision as revision,
ekr.CREATED_BY as createdBy,
ekr.CREATED_TIME as createdTime,
ekr.UPDATED_BY as updatedBy,
ekr.UPDATED_TIME as updatedTime,
ekr.DEL_FLAG as delFlag,
(case rule_mode
when '0' then (select ekf.name from epdc_kpi_formula ekf where ekf.ID=ekr.reference_id)
else null
end)as referenceName
FROM
epdc_kpi_rule ekr
WHERE
ekr.DEL_FLAG = '0'
<if test="ruleName != null and ruleName.trim() != ''">
and ekr.rule_name like concat('%', #{ruleName}, '%')
</if>
ORDER BY
ekr.CREATED_TIME DESC
</select>
<resultMap type="com.elink.esua.epdc.dto.result.KpiRuleQueryResultDTO" id="KpiRuleQueryResultDTOMap">
<result property="id" column="id"/>
<result property="ruleName" column="rule_name"/>
<result property="ruleCode" column="rule_code"/>
<result property="ruleMode" column="rule_mode"/>
<result property="referenceId" column="reference_id"/>
<result property="kpiCycle" column="kpi_cycle"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="referenceName" column="reference_name"/>
<collection property="ruleParamList" select="com.elink.esua.epdc.dao.KpiRuleDao.selectKpiRuleParamInfoDTO" column="id"></collection>
</resultMap>
<resultMap id="KpiRuleParamDTOMap" type="com.elink.esua.epdc.dto.KpiRuleParamDTO">
<result property="id" column="ID"/>
<result property="ruleId" column="RULE_ID"/>
<result property="metaDataCode" column="META_DATA_CODE"/>
<result property="sort" column="SORT"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="delFlag" column="DEL_FLAG"/>
</resultMap>
<select id="selectKpiRuleParamInfoDTO" resultMap="KpiRuleParamDTOMap">
SELECT
id,
rule_id,
META_DATA_CODE,
sort,
revision,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME,
DEL_FLAG
FROM
epdc_kpi_rule_param
WHERE
DEL_FLAG = '0'
AND rule_id =#{ruleId}
ORDER BY
sort ASC
</select>
<!-- -->
<select id="queryDetailInfo" parameterType="java.lang.String" resultMap="KpiRuleQueryResultDTOMap">
SELECT
ekr.ID,
ekr.rule_name,
ekr.rule_code,
ekr.rule_mode,
ekr.reference_id,
ekr.kpi_cycle,
ekr.revision,
ekr.CREATED_BY,
ekr.CREATED_TIME,
ekr.UPDATED_BY,
ekr.UPDATED_TIME,
ekr.DEL_FLAG,
(case rule_mode
when '0' then (select ekf.name from epdc_kpi_formula ekf where ekf.ID=ekr.reference_id)
else null
end)as reference_name
FROM
epdc_kpi_rule ekr
WHERE
ekr.DEL_FLAG = '0'
and ekr.id=#{id}
</select>
</mapper>

22
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiRuleParamDao.xml

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.KpiRuleParamDao">
<resultMap type="com.elink.esua.epdc.entity.KpiRuleParamEntity" id="kpiRuleParamMap">
<result property="id" column="ID"/>
<result property="ruleId" column="RULE_ID"/>
<result property="metaDataCode" column="META_DATA_CODE"/>
<result property="sort" column="SORT"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="delFlag" column="DEL_FLAG"/>
</resultMap>
<update id="deleteByRuleId">
delete from epdc_kpi_rule_param where rule_id=#{id}
</update>
</mapper>
Loading…
Cancel
Save