update 项目库代码
This commit is contained in:
+144
-212
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.aspect.annotation.DictPoint;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
@@ -24,6 +25,8 @@ import com.jero.modules.projectLibrary.vo.RiskOverviewVo;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import com.jero.modules.system.service.ISysUserService;
|
||||
import com.jero.modules.system.vo.IdMapBody;
|
||||
import com.jero.modules.system.vo.IdsMapBody;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -45,232 +48,161 @@ import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Description: 项目库
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-09-11
|
||||
* @Date: 2023-09-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="项目库")
|
||||
@Api(tags = "项目库")
|
||||
@RestController
|
||||
@RequestMapping("/projectLibrary/lawsProjectLibrary")
|
||||
@Slf4j
|
||||
public class LawsProjectLibraryController extends JeroController<LawsProjectLibrary, ILawsProjectLibraryService> {
|
||||
@Autowired
|
||||
private ILawsProjectLibraryService lawsProjectLibraryService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
@Autowired
|
||||
private ILawsAssessService lawsAssessService;
|
||||
@Autowired
|
||||
private ILawsAssessResultsService lawsAssessResultsService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*/
|
||||
@RequiresPermissions("vehicleItemLibrary:search")
|
||||
@AutoLog(value = "项目库-分页列表查询")
|
||||
@ApiOperation(value="项目库-分页列表查询", notes="项目库-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<LawsProjectLibrary>> queryPageList(LawsProjectLibrary lawsProjectLibrary,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
lawsProjectLibrary.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
IPage<LawsProjectLibrary> pageList = lawsProjectLibraryService.queryPage(lawsProjectLibrary, pageNo, pageSize, req);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "项目库-列表查询")
|
||||
@ApiOperation(value="项目库-列表查询", notes="项目库-列表查询")
|
||||
@GetMapping(value = "/queryList")
|
||||
public Result<List<LawsProjectLibrary>> queryList(LawsProjectLibrary lawsProjectLibrary, HttpServletRequest req) {
|
||||
lawsProjectLibrary.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
List<LawsProjectLibrary> queryList = lawsProjectLibraryService.queryList(lawsProjectLibrary, req);
|
||||
return Result.OK(queryList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@RequiresPermissions("vehicleItemLibrary:add")
|
||||
@AutoLog(value = "项目库-添加")
|
||||
@ApiOperation(value="项目库-添加", notes="项目库-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@Validated @RequestBody LawsProjectLibrary lawsProjectLibrary) {
|
||||
lawsProjectLibrary.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
lawsProjectLibraryService.add(lawsProjectLibrary);
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
@RequiresPermissions("vehicleItemLibrary:edit")
|
||||
@AutoLog(value = "项目库-编辑")
|
||||
@ApiOperation(value="项目库-编辑", notes="项目库-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@RequestBody LawsProjectLibrary lawsProjectLibrary) {
|
||||
lawsProjectLibraryService.editById(lawsProjectLibrary);
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*/
|
||||
@RequiresPermissions("vehicleItemLibrary:delete")
|
||||
@AutoLog(value = "项目库-通过id删除")
|
||||
@ApiOperation(value="项目库-通过id删除", notes="项目库-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
lawsProjectLibraryService.deleteById(map.get("id"));
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@RequiresPermissions("vehicleItemLibrary:batchDel")
|
||||
@AutoLog(value = "项目库-批量删除")
|
||||
@ApiOperation(value="项目库-批量删除", notes="项目库-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
this.lawsProjectLibraryService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.SUCCESSFULLY_DELETED_IN_BULK));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*/
|
||||
@AutoLog(value = "项目库-通过id查询")
|
||||
@ApiOperation(value="项目库-通过id查询", notes="项目库-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<LawsProjectLibrary> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
LawsProjectLibrary lawsProjectLibrary = lawsProjectLibraryService.queryById(id);
|
||||
if(lawsProjectLibrary==null) {
|
||||
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||
}
|
||||
return Result.OK(lawsProjectLibrary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目风险性总览
|
||||
*/
|
||||
@AutoLog(value = "项目库详情-项目风险性总览")
|
||||
@ApiOperation(value="项目库详情-项目风险性总览", notes="项目库详情-项目风险性总览")
|
||||
@GetMapping(value = "/riskOverview")
|
||||
public Result<RiskOverviewVo> riskOverview(@RequestParam(name="id",required=true) String id) {
|
||||
LawsProjectLibrary lawsProjectLibrary = lawsProjectLibraryService.queryById(id);
|
||||
if(lawsProjectLibrary==null) {
|
||||
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||
}
|
||||
LambdaQueryWrapper<LawsAssess> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(LawsAssess::getProjectId, id);
|
||||
wrapper.eq(LawsAssess::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
|
||||
List<LawsAssess> list = lawsAssessService.list(wrapper);
|
||||
List<String> collect = list.stream().map(LawsAssess::getId).collect(Collectors.toList());
|
||||
if (collect.isEmpty()){
|
||||
return Result.OK(new RiskOverviewVo(0,0,0,0));
|
||||
}
|
||||
LambdaQueryWrapper<LawsAssessResults> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(LawsAssessResults::getAssessId, collect);
|
||||
List<LawsAssessResults> assessResults = lawsAssessResultsService.list(queryWrapper);
|
||||
int a = Math.toIntExact(assessResults.stream().filter(LawsAssessResults -> "1".equals(LawsAssessResults.getAssessResults())).count());
|
||||
int b = Math.toIntExact(assessResults.stream().filter(LawsAssessResults -> "2".equals(LawsAssessResults.getAssessResults())).count());
|
||||
int c = Math.toIntExact(assessResults.stream().filter(LawsAssessResults -> "3".equals(LawsAssessResults.getAssessResults())).count());
|
||||
int d = Math.toIntExact(assessResults.stream().filter(LawsAssessResults -> "4".equals(LawsAssessResults.getAssessResults())).count());
|
||||
return Result.OK(new RiskOverviewVo(a,b,c,d));
|
||||
}
|
||||
@Autowired
|
||||
private ILawsProjectLibraryService lawsProjectLibraryService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
@Autowired
|
||||
private ILawsAssessService lawsAssessService;
|
||||
@Autowired
|
||||
private ILawsAssessResultsService lawsAssessResultsService;
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*/
|
||||
@RequiresPermissions("vehicleItemLibrary:export")
|
||||
@AutoLog(value = "项目库-导出excel")
|
||||
@ApiOperation(value="项目库-导出excel", notes="项目库-导出excel")
|
||||
@GetMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, LawsProjectLibrary lawsProjectLibrary, HttpServletResponse response) {
|
||||
String outFileName = "内部工作组人员表" + System.currentTimeMillis() + ".xlsx";
|
||||
String ENCODING = "UTF-8";
|
||||
ExcelWriter writer = ExcelUtil.getWriter(true);
|
||||
|
||||
// 通过工具类创建writer并且进行别名
|
||||
assembleWriter(writer);
|
||||
|
||||
//获取数据
|
||||
List<LawsProjectLibrary> dos = null;
|
||||
String selections = request.getParameter("selections");
|
||||
if (StringUtils.isNotBlank(selections)){
|
||||
dos = lawsProjectLibraryService.listByIds(Arrays.asList(selections.split(",")));
|
||||
}else {
|
||||
lawsProjectLibrary.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
QueryWrapper<LawsProjectLibrary> queryWrapper = QueryGenerator.initQueryWrapper(lawsProjectLibrary, request.getParameterMap());
|
||||
dos = lawsProjectLibraryService.list(queryWrapper);
|
||||
}
|
||||
if (dos.isEmpty()){
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
this.translate(dos);
|
||||
|
||||
//导出表头只保留别名中的字段
|
||||
writer.setOnlyAlias(true);
|
||||
//表格高度
|
||||
writer.setDefaultRowHeight(18);
|
||||
//表格宽度
|
||||
writer.setColumnWidth(-1, 20);
|
||||
//放入数据
|
||||
writer.write(dos, true);
|
||||
try {
|
||||
// 获取我们的输出流
|
||||
final OutputStream output = response.getOutputStream();
|
||||
response.setContentType("application/vnd.ms-excel;charset=utf-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + outFileName + ";filename*=utf-8"
|
||||
+ URLEncoder.encode(outFileName, ENCODING));
|
||||
writer.flush(output, true);
|
||||
writer.close();
|
||||
// 这里可以自行关闭资源或者写一个关闭资源的工具类
|
||||
IoUtil.close(output);
|
||||
} catch (Exception e) {
|
||||
log.error("导出失败:", e);
|
||||
}
|
||||
return null;
|
||||
* 分页列表查询
|
||||
*/
|
||||
@RequiresPermissions("vehicleItemLibrary:search")
|
||||
@AutoLog(value = "项目库-分页列表查询")
|
||||
@ApiOperation(value = "项目库-分页列表查询", notes = "项目库-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<LawsProjectLibrary>> queryPageList(LawsProjectLibrary lawsProjectLibrary,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
IPage<LawsProjectLibrary> pageList = lawsProjectLibraryService.queryPage(lawsProjectLibrary, pageNo, pageSize, req);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 翻译项目来源、项目负责人、项目健康状态
|
||||
*/
|
||||
private void translate(List<LawsProjectLibrary> dos){
|
||||
for (LawsProjectLibrary aDo : dos) {
|
||||
String projectSource = aDo.getProjectSource();
|
||||
String projectHealth = aDo.getProjectHealth();
|
||||
String projectLeader = aDo.getProjectLeader();
|
||||
@DictPoint
|
||||
@AutoLog(value = "项目库-列表查询")
|
||||
@ApiOperation(value = "项目库-列表查询", notes = "项目库-列表查询")
|
||||
@GetMapping(value = "/queryList")
|
||||
public Result<List<LawsProjectLibrary>> queryList(LawsProjectLibrary lawsProjectLibrary, HttpServletRequest req) {
|
||||
List<LawsProjectLibrary> queryList = lawsProjectLibraryService.queryList(lawsProjectLibrary, req);
|
||||
return Result.OK(queryList);
|
||||
}
|
||||
|
||||
String project_source = sysDictService.queryDictTextByKey("project_source", projectSource);
|
||||
aDo.setProjectSource(project_source);
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@RequiresPermissions("vehicleItemLibrary:add")
|
||||
@AutoLog(value = "项目库-添加")
|
||||
@ApiOperation(value = "项目库-添加", notes = "项目库-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@Validated @RequestBody LawsProjectLibrary lawsProjectLibrary) {
|
||||
lawsProjectLibrary.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
lawsProjectLibraryService.add(lawsProjectLibrary);
|
||||
return Result.OK(ResultCommon.OK);
|
||||
}
|
||||
|
||||
String project_health = sysDictService.queryDictTextByKey("project_health", projectHealth);
|
||||
aDo.setProjectHealth(project_health);
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
@RequiresPermissions("vehicleItemLibrary:edit")
|
||||
@AutoLog(value = "项目库-编辑")
|
||||
@ApiOperation(value = "项目库-编辑", notes = "项目库-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@RequestBody LawsProjectLibrary lawsProjectLibrary) {
|
||||
lawsProjectLibraryService.editById(lawsProjectLibrary);
|
||||
return Result.OK(ResultCommon.OK);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(projectLeader)) {
|
||||
SysUser sysUser = sysUserService.getById(projectLeader);
|
||||
aDo.setProjectLeader(sysUser.calcNameWorkNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 通过id删除
|
||||
*/
|
||||
@RequiresPermissions("vehicleItemLibrary:delete")
|
||||
@AutoLog(value = "项目库-通过id删除")
|
||||
@ApiOperation(value = "项目库-通过id删除", notes = "项目库-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody IdMapBody body) {
|
||||
String id = body.getId();
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
lawsProjectLibraryService.deleteById(id);
|
||||
return Result.OK(ResultCommon.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@RequiresPermissions("vehicleItemLibrary:batchDel")
|
||||
@AutoLog(value = "项目库-批量删除")
|
||||
@ApiOperation(value = "项目库-批量删除", notes = "项目库-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody IdsMapBody body) {
|
||||
String ids = body.getIds();
|
||||
if (StringUtils.isEmpty(ids)) {
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
this.lawsProjectLibraryService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK(ResultCommon.SUCCESSFULLY_DELETED_IN_BULK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*/
|
||||
@DictPoint
|
||||
@AutoLog(value = "项目库-通过id查询")
|
||||
@ApiOperation(value = "项目库-通过id查询", notes = "项目库-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<LawsProjectLibrary> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
LawsProjectLibrary lawsProjectLibrary = lawsProjectLibraryService.queryById(id);
|
||||
if (lawsProjectLibrary == null) {
|
||||
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||
}
|
||||
return Result.OK(lawsProjectLibrary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目风险性总览
|
||||
*/
|
||||
@AutoLog(value = "项目库详情-项目风险性总览")
|
||||
@ApiOperation(value = "项目库详情-项目风险性总览", notes = "项目库详情-项目风险性总览")
|
||||
@GetMapping(value = "/riskOverview")
|
||||
public Result<RiskOverviewVo> riskOverview(@RequestParam(name = "id", required = true) String id) {
|
||||
LawsProjectLibrary lawsProjectLibrary = lawsProjectLibraryService.queryById(id);
|
||||
if (lawsProjectLibrary == null) {
|
||||
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||
}
|
||||
LambdaQueryWrapper<LawsAssess> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(LawsAssess::getProjectId, id);
|
||||
List<LawsAssess> list = lawsAssessService.list(wrapper);
|
||||
List<String> collect = list.stream().map(LawsAssess::getId).collect(Collectors.toList());
|
||||
if (collect.isEmpty()) {
|
||||
return Result.OK(new RiskOverviewVo(0, 0, 0, 0));
|
||||
}
|
||||
LambdaQueryWrapper<LawsAssessResults> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(LawsAssessResults::getAssessId, collect);
|
||||
List<LawsAssessResults> assessResults = lawsAssessResultsService.list(queryWrapper);
|
||||
int a = Math.toIntExact(assessResults.stream().filter(LawsAssessResults -> "1".equals(LawsAssessResults.getAssessResults())).count());
|
||||
int b = Math.toIntExact(assessResults.stream().filter(LawsAssessResults -> "2".equals(LawsAssessResults.getAssessResults())).count());
|
||||
int c = Math.toIntExact(assessResults.stream().filter(LawsAssessResults -> "3".equals(LawsAssessResults.getAssessResults())).count());
|
||||
int d = Math.toIntExact(assessResults.stream().filter(LawsAssessResults -> "4".equals(LawsAssessResults.getAssessResults())).count());
|
||||
return Result.OK(new RiskOverviewVo(a, b, c, d));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*/
|
||||
@RequiresPermissions("vehicleItemLibrary:export")
|
||||
@AutoLog(value = "项目库-导出excel")
|
||||
@ApiOperation(value = "项目库-导出excel", notes = "项目库-导出excel")
|
||||
@GetMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, LawsProjectLibrary lawsProjectLibrary, HttpServletResponse response) {
|
||||
return super.exportXls(request,lawsProjectLibrary,LawsProjectLibrary.class,"内部工作组人员表");
|
||||
}
|
||||
|
||||
private void assembleWriter(ExcelWriter writer) {
|
||||
writer.addHeaderAlias("projectSource", "项目来源");
|
||||
writer.addHeaderAlias("projectName", "项目名称");
|
||||
writer.addHeaderAlias("projectLeader", "项目负责人");
|
||||
writer.addHeaderAlias("workNumber", "工作令编号");
|
||||
writer.addHeaderAlias("projectHealth", "项目健康状态");
|
||||
}
|
||||
}
|
||||
|
||||
+13
-12
@@ -3,13 +3,11 @@ package com.jero.modules.projectLibrary.entity;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -40,30 +38,32 @@ public class LawsProjectLibrary implements Serializable {
|
||||
|
||||
/**项目来源(1-本地新增、2-PMS)*/
|
||||
@Dict(dicCode = "project_source")
|
||||
@Excel(name = "项目来源", width = 15, dicCode = "project_source")
|
||||
@ApiModelProperty(value = "项目来源(1-本地新增、2-PMS)")
|
||||
private String projectSource;
|
||||
@TableField(exist = false)
|
||||
private String projectSource_dictText;
|
||||
|
||||
/**项目名称*/
|
||||
@NotBlank(message = "projectName not null")
|
||||
@Excel(name = "项目名称", width = 15)
|
||||
@ApiModelProperty(value = "项目名称")
|
||||
private String projectName;
|
||||
|
||||
/**工作令编号*/
|
||||
@ApiModelProperty(value = "工作令编号")
|
||||
private String workNumber;
|
||||
|
||||
/**项目负责人*/
|
||||
@ApiModelProperty(value = "项目负责人")
|
||||
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "id")
|
||||
@Excel(name = "项目负责人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "id")
|
||||
private String projectLeader;
|
||||
|
||||
/**工作令编号*/
|
||||
@ApiModelProperty(value = "工作令编号")
|
||||
@Excel(name = "工作令编号", width = 15)
|
||||
private String workNumber;
|
||||
|
||||
/**项目健康度(1-预警、2-风险、3-正常)*/
|
||||
@Dict(dicCode = "project_health")
|
||||
@Excel(name = "项目健康度", width = 15, dicCode = "project_health")
|
||||
@ApiModelProperty(value = "项目健康度(1-预警、2-风险、3-正常)")
|
||||
private String projectHealth;
|
||||
@TableField(exist = false)
|
||||
private String projectHealth_dictText;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
@@ -90,6 +90,7 @@ public class LawsProjectLibrary implements Serializable {
|
||||
private String orgCode;
|
||||
|
||||
/**删除状态(0-正常,1-删除)*/
|
||||
@TableLogic
|
||||
@ApiModelProperty(value = "删除状态(0-正常,1-删除)")
|
||||
private String delFlag;
|
||||
|
||||
|
||||
+1
-51
@@ -44,7 +44,6 @@ public class LawsProjectLibraryServiceImpl extends ServiceImpl<LawsProjectLibrar
|
||||
QueryWrapper<LawsProjectLibrary> queryWrapper = QueryGenerator.initQueryWrapper(lawsProjectLibrary, req.getParameterMap());
|
||||
Page<LawsProjectLibrary> page = new Page<>(pageNo, pageSize);
|
||||
Page<LawsProjectLibrary> libraryPage = page(page, queryWrapper);
|
||||
this.voluation(libraryPage.getRecords());
|
||||
return libraryPage;
|
||||
}
|
||||
|
||||
@@ -52,31 +51,14 @@ public class LawsProjectLibraryServiceImpl extends ServiceImpl<LawsProjectLibrar
|
||||
public List<LawsProjectLibrary> queryList(LawsProjectLibrary lawsProjectLibrary, HttpServletRequest req) {
|
||||
QueryWrapper<LawsProjectLibrary> queryWrapper = QueryGenerator.initQueryWrapper(lawsProjectLibrary, req.getParameterMap());
|
||||
List<LawsProjectLibrary> list = list(queryWrapper);
|
||||
this.voluation(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 赋值姓名+工号
|
||||
*/
|
||||
private void voluation(List<LawsProjectLibrary> pageRecords){
|
||||
for (LawsProjectLibrary pageRecord : pageRecords) {
|
||||
String projectLeader = pageRecord.getProjectLeader();
|
||||
if (StringUtils.isNotBlank(projectLeader)){
|
||||
SysUser user = sysUserService.getById(projectLeader);
|
||||
pageRecord.setNameWorkNo(user.calcNameWorkNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Override
|
||||
public void add(LawsProjectLibrary lawsProjectLibrary) {
|
||||
Date now = new Date();
|
||||
lawsProjectLibrary.setCreateTime(now);
|
||||
lawsProjectLibrary.setUpdateTime(now);
|
||||
save(lawsProjectLibrary);
|
||||
}
|
||||
|
||||
@@ -85,8 +67,6 @@ public class LawsProjectLibraryServiceImpl extends ServiceImpl<LawsProjectLibrar
|
||||
*/
|
||||
@Override
|
||||
public void editById(LawsProjectLibrary lawsProjectLibrary) {
|
||||
Date now = new Date();
|
||||
lawsProjectLibrary.setUpdateTime(now);
|
||||
saveOrUpdate(lawsProjectLibrary);
|
||||
}
|
||||
|
||||
@@ -96,8 +76,7 @@ public class LawsProjectLibraryServiceImpl extends ServiceImpl<LawsProjectLibrar
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
LawsProjectLibrary projectLibrary = getById(id);
|
||||
projectLibrary.setDelFlag(CommonConstant.DEL_FLAG_1.toString());
|
||||
updateById(projectLibrary);
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,39 +97,10 @@ public class LawsProjectLibraryServiceImpl extends ServiceImpl<LawsProjectLibrar
|
||||
public LawsProjectLibrary queryById(String id) {
|
||||
LawsProjectLibrary library = getById(id);
|
||||
String projectLeader = library.getProjectLeader();
|
||||
String projectSource = library.getProjectSource();
|
||||
String projectHealth = library.getProjectHealth();
|
||||
if (StringUtils.isNotBlank(projectLeader)){
|
||||
SysUser user = sysUserService.getById(projectLeader);
|
||||
library.setNameWorkNo(user.calcNameWorkNo());
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectSource)){
|
||||
switch (projectSource) {
|
||||
case "1":
|
||||
library.setProjectSource_dictText("本地新增");
|
||||
break;
|
||||
case "2":
|
||||
library.setProjectSource_dictText("PMS");
|
||||
break;
|
||||
default:
|
||||
library.setProjectSource_dictText("");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectHealth)){
|
||||
switch (projectHealth) {
|
||||
case "1":
|
||||
library.setProjectHealth_dictText("预警");
|
||||
break;
|
||||
case "2":
|
||||
library.setProjectHealth_dictText("风险");
|
||||
break;
|
||||
case "3":
|
||||
library.setProjectHealth_dictText("正常");
|
||||
break;
|
||||
default:
|
||||
library.setProjectHealth_dictText("");
|
||||
}
|
||||
}
|
||||
return library;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user