dev^2
吱屋 1 year ago
commit f84d5ef57e
  1. 2
      ant-design-vue-jeecg/src/mixins/JeecgListMixin.js
  2. 2
      ant-design-vue-jeecg/src/views/functiontemple/FunctionTemplateList.vue
  3. 1
      ant-design-vue-jeecg/src/views/modulex/ModulexList.vue
  4. 36
      ant-design-vue-jeecg/src/views/task/TaskList.vue
  5. 7
      jeecg-boot/jeecg-boot-module-system/pom.xml
  6. 103
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/controller/BugxController.java
  7. 9
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/entity/Bugx.java
  8. 143
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/entity/BugxExportDto.java
  9. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/mapper/BugxMapper.java
  10. 1
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/IBugxService.java
  11. 1
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/impl/BugxServiceImpl.java
  12. 5
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/entity/FunctionxTest.java
  13. 29
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionXTestServiceImpl.java
  14. 4
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementtype/entity/RequirementType.java
  15. 43
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java
  16. 15
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/RuleVo.java
  17. 6
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/Rulex.java
  18. 168
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java
  19. 4
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/dto/ExcelInfo.java
  20. 13
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/ModulexTemplate.java
  21. 1
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java
  22. 81
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java
  23. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java
  24. 320
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java
  25. 1
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java
  26. 5
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/ITaskService.java
  27. 15
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/impl/TaskServiceImpl.java

@ -349,6 +349,8 @@ export const JeecgListMixin = {
this.$refs.modalForm.edit(record); this.$refs.modalForm.edit(record);
this.$refs.modalForm.title = "复制"; this.$refs.modalForm.title = "复制";
this.$refs.modalForm.disableSubmit = false; this.$refs.modalForm.disableSubmit = false;
// 重载列表
this.loadData();
}, },
// 任务管理-任务-分解 // 任务管理-任务-分解
fengjieRenwu: function (record) { fengjieRenwu: function (record) {

@ -40,7 +40,7 @@
<div class="table-operator"> <div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('功能模板管理')">导出</a-button> <a-button type="primary" icon="download" @click="handleExportXls('功能模板管理')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handle">
<a-button type="primary" icon="import">导入</a-button> <a-button type="primary" icon="import">导入</a-button>
</a-upload> </a-upload>
<!-- 高级查询区域 --> <!-- 高级查询区域 -->

@ -475,7 +475,6 @@ export default {
deleteBatch: "/modulex/modulex/deleteBatch", deleteBatch: "/modulex/modulex/deleteBatch",
exportXlsUrl: "/modulex/modulex/exportXls", exportXlsUrl: "/modulex/modulex/exportXls",
importExcelUrlf: "fieldx/fieldx/importExcel", importExcelUrlf: "fieldx/fieldx/importExcel",
importExcelUrl: "modulex/modulex/importExcel", importExcelUrl: "modulex/modulex/importExcel",
functionImportExcelUrl: "/functionx/functionx/importExcel", functionImportExcelUrl: "/functionx/functionx/importExcel",
tablexImportExcelUrl: "tablex/tablex/importExcel", tablexImportExcelUrl: "tablex/tablex/importExcel",

@ -5,7 +5,7 @@
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="6" :sm="12"> <a-col :md="4" :sm="12">
<a-form-item label="项目"> <a-form-item label="项目">
<!-- <j-input placeholder="" v-model="queryParam.projectId"></j-input>--> <!-- <j-input placeholder="" v-model="queryParam.projectId"></j-input>-->
<j-dict-select-tag v-model="queryParam.projectId" placeholder="请选择项目" <j-dict-select-tag v-model="queryParam.projectId" placeholder="请选择项目"
@ -13,7 +13,7 @@
style="width: 100%"></j-dict-select-tag> style="width: 100%"></j-dict-select-tag>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="6" :sm="12"> <a-col :md="4" :sm="12">
<a-form-item label="模块"> <a-form-item label="模块">
<!-- <j-input placeholder="" v-model="queryParam.moduleId"></j-input>--> <!-- <j-input placeholder="" v-model="queryParam.moduleId"></j-input>-->
<j-dict-select-tag v-model="queryParam.moduleId" placeholder="请选择模块" <j-dict-select-tag v-model="queryParam.moduleId" placeholder="请选择模块"
@ -22,11 +22,41 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="6" :sm="12"> <a-col :md="6" :sm="12">
<a-form-item label="任务等级">
<!-- <j-input placeholder="" v-model="queryParam.moduleId"></j-input>-->
<j-dict-select-tag v-model="queryParam.workStatus" placeholder="请选择等级"
dict-code="task_work_status"
style="width: 100%"></j-dict-select-tag>
</a-form-item>
</a-col>
<a-col :md="6" :sm="12">
<a-form-item label="任务类型">
<!-- <j-input placeholder="" v-model="queryParam.moduleId"></j-input>-->
<j-dict-select-tag v-model="queryParam.typeId" placeholder="请选择任务类型"
dict-code="task_type,type_name,id"
style="width: 100%"></j-dict-select-tag>
</a-form-item>
</a-col>
<a-col :md="4" :sm="12">
<a-form-item label="责任人">
<j-dict-select-tag v-model="queryParam.managerUsers" placeholder="请选责任人"
dict-code="sys_user,realname,id"
style="width: 100%"></j-dict-select-tag>
</a-form-item>
</a-col>
<a-col :md="4" :sm="12">
<a-form-item label="任务名称"> <a-form-item label="任务名称">
<j-input placeholder="" v-model="queryParam.taskName"></j-input> <j-input placeholder="" v-model="queryParam.taskName"></j-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="6" :sm="12">
<a-form-item label="日期">
<j-dict-select-tag v-model="queryParam.time" placeholder="请选择日期"
dict-code="task_time_status"
style="width: 100%"></j-dict-select-tag>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8"> <a-col :md="6" :sm="8">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button> <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>

@ -110,6 +110,13 @@
<version>3.17</version> <version>3.17</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.belerweb/pinyin4j -->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.1</version>
</dependency>
<dependency> <dependency>
<groupId>org.jeecgframework.boot</groupId> <groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-module-cms</artifactId> <artifactId>jeecg-boot-module-cms</artifactId>

@ -1,23 +1,19 @@
package org.jeecg.modules.demo.bugx.controller; package org.jeecg.modules.demo.bugx.controller;
import java.util.Arrays; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.demo.bugx.entity.Bugx; import org.jeecg.modules.demo.bugx.entity.Bugx;
import org.jeecg.modules.demo.bugx.entity.BugxExportDto;
import org.jeecg.modules.demo.bugx.service.IBugxService; import org.jeecg.modules.demo.bugx.service.IBugxService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -34,18 +30,14 @@ import org.jeecg.modules.modulex.entity.Modulex;
import org.jeecg.modules.modulex.mapper.ModulexMapper; import org.jeecg.modules.modulex.mapper.ModulexMapper;
import org.jeecg.modules.projectx.entity.Projectx; import org.jeecg.modules.projectx.entity.Projectx;
import org.jeecg.modules.projectx.mapper.ProjectxMapper; import org.jeecg.modules.projectx.mapper.ProjectxMapper;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
@ -279,7 +271,92 @@ public class BugxController extends JeecgController<Bugx, IBugxService> {
*/ */
@RequestMapping(value = "/exportXls") @RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, Bugx bugx) { public ModelAndView exportXls(HttpServletRequest request, Bugx bugx) {
return super.exportXls(request, bugx, Bugx.class, "BUG管理"); return this.exportXlss(request, bugx, BugxExportDto.class, "BUG管理");
}
protected ModelAndView exportXlss(HttpServletRequest request, Bugx bugx, Class<BugxExportDto> clazz, String title) {
// Step.1 组装查询条件
QueryWrapper<Bugx> queryWrapper = QueryGenerator.initQueryWrapper(bugx, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String getRealname = "佚名";
if (sysUser != null) {
getRealname = sysUser.getRealname();
}
// Step.2 获取导出数据
List<Bugx> pageList = bugxService.list(queryWrapper);
List<BugxExportDto> exportList = null;
List<BugxExportDto> BugxExportDtoList =new ArrayList<>();
for (Bugx bugx1 : pageList) {
BugxExportDto BugxExportDto = new BugxExportDto();
BeanUtils.copyProperties(bugx1,BugxExportDto);
String projectId = bugx1.getProjectId();
Projectx projectx = projectxMapper.selectById(projectId);
if (projectx!=null)
BugxExportDto.setProjectId(projectx.getProjectName());
//模块id
String moduleId = bugx1.getModuleId();
Modulex modulex = modulexMapper.selectById(moduleId);
if (modulex!=null)
BugxExportDto.setModuleId(modulex.getModuleName());
//功能id
String functionId = bugx1.getFunctionId();
Functionx functionx = functionxMapper.selectById(functionId);
if (functionx!=null)
BugxExportDto.setFunctionId(functionx.getFunctionName());
//规则id
String ruleId = bugx1.getRuleId();
Rulex rulex = rulexMapper.selectById(ruleId);
if (rulex!=null)
BugxExportDto.setRulePm_desc(rulex.getPmDescribe());
//bug状态
Integer bugStatus = bugx1.getBugStatus();
if (bugStatus.equals(1)){
BugxExportDto.setBugStatusName("已解决");
} else if (bugStatus.equals(3))
BugxExportDto.setBugStatusName("待修改");
else if (bugStatus.equals(0))
BugxExportDto.setBugStatusName("未解决");
//bug类型
Integer type = bugx1.getType();
if (type.equals(1)){
BugxExportDto.setTypeName("模块");
} else if (type.equals(3))
BugxExportDto.setTypeName("规则");
else if (type.equals(0))
BugxExportDto.setTypeName("项目");
else if (type.equals(2))
BugxExportDto.setTypeName("功能");
BugxExportDtoList.add(BugxExportDto);
}
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
exportList = BugxExportDtoList.stream().filter(item -> selectionList.contains(getId(item))).collect(Collectors.toList());
} else {
exportList = BugxExportDtoList;
}
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.CLASS, clazz);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
ExportParams exportParams = new ExportParams(title + "报表", "导出人:" + getRealname, title);
exportParams.setImageBasePath(upLoadPath);
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
protected String getId(BugxExportDto item) {
try {
return PropertyUtils.getProperty(item, "id").toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
} }
/** /**

@ -63,23 +63,24 @@ public class Bugx implements Serializable {
/**项目id*/ /**项目id*/
@Excel(name = "项目id", width = 15) @Excel(name = "项目id", width = 15)
@ApiModelProperty(value = "项目id") @ApiModelProperty(value = "项目id")
@Dict(dicText = "project_code",dicCode = "id",dictTable = "projectx") @Dict(dicCode = "id",dicText = "project_code",dictTable = "projectx")
private java.lang.String projectId; private java.lang.String projectId;
/**对应模块id*/ /**对应模块id*/
@Excel(name = "对应模块id", width = 15) @Excel(name = "对应模块id", width = 15)
@ApiModelProperty(value = "对应模块id") @ApiModelProperty(value = "对应模块id")
@Dict(dicText = "module_code",dicCode = "id",dictTable = "modulex") @Dict(dicCode = "id",dicText = "module_code",dictTable = "modulex")
private java.lang.String moduleId; private java.lang.String moduleId;
/**对应功能id*/ /**对应功能id*/
@Excel(name = "对应功能id", width = 15) @Excel(name = "对应功能id", width = 15)
@ApiModelProperty(value = "对应功能id") @ApiModelProperty(value = "对应功能id")
@Dict(dicText = "function_code",dicCode = "id",dictTable = "functionx") @Dict(dicCode = "id",dicText = "function_code",dictTable = "functionx")
private java.lang.String functionId; private java.lang.String functionId;
/**对应规则id*/ /**对应规则id*/
@Excel(name = "对应规则id", width = 15) @Excel(name = "对应规则id", width = 15)
@ApiModelProperty(value = "对应规则id") @ApiModelProperty(value = "对应规则id")
@Dict(dicText = "rule_code",dicCode = "id",dictTable = "rulex") @Dict(dicCode = "id",dicText = "rule_code",dictTable = "rulex")
private java.lang.String ruleId; private java.lang.String ruleId;
/**BUG等级*/ /**BUG等级*/
@Excel(name = "BUG等级", width = 15) @Excel(name = "BUG等级", width = 15)
@ApiModelProperty(value = "BUG等级") @ApiModelProperty(value = "BUG等级")

@ -0,0 +1,143 @@
package org.jeecg.modules.demo.bugx.entity;
import java.io.Serializable;
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 lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecgframework.poi.excel.annotation.ExcelIgnore;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: BUG管理
* @Author: jeecg-boot
* @Date: 2023-04-11
* @Version: V1.0
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="bugx对象", description="BUG管理")
public class BugxExportDto implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**BUG编码*/
@Excel(name = "BUG编码", width = 15)
@ApiModelProperty(value = "BUG编码")
private java.lang.String bugCode;
/**BUG类型*/
@ExcelIgnore()
@ApiModelProperty(value = "BUG类型")
@Dict(dicCode = "bug_type")
private java.lang.Integer type;
@TableField(exist = false)
@Excel(name = "BUG类型", width = 15)
private java.lang.String typeName;
/**项目id*/
@Excel(name = "项目", width = 15)
@ApiModelProperty(value = "项目id")
@Dict(dicCode = "id",dicText = "project_code",dictTable = "projectx")
private java.lang.String projectId;
/**对应模块id*/
@Excel(name = "对应模块", width = 15)
@ApiModelProperty(value = "对应模块id")
@Dict(dicCode = "id",dicText = "module_code",dictTable = "modulex")
private java.lang.String moduleId;
/**对应功能id*/
@Excel(name = "对应功能", width = 15)
@ApiModelProperty(value = "对应功能id")
@Dict(dicCode = "id",dicText = "function_code",dictTable = "functionx")
private java.lang.String functionId;
/**对应规则id*/
@ExcelIgnore
@ApiModelProperty(value = "对应规则id")
@Dict(dicCode = "id",dicText = "rule_code",dictTable = "rulex")
private java.lang.String ruleId;
@Excel(name = "对应规则", width = 15)
@TableField(exist = false)
private java.lang.String rulePm_desc;
/**BUG等级*/
@Excel(name = "BUG等级", width = 15)
@ApiModelProperty(value = "BUG等级")
@Dict(dicCode = "work_level")
private java.lang.Integer bugLevel;
/**BUG描述*/
@Excel(name = "BUG描述", width = 15)
@ApiModelProperty(value = "BUG描述")
private java.lang.String pmDesc;
/**BUG图片*/
@Excel(name = "BUG图片", width = 15)
@ApiModelProperty(value = "BUG图片")
private java.lang.String bugPic;
/**发布时间*/
@Excel(name = "发布时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "发布时间")
private java.util.Date publishTime;
/**提交内容*/
@Excel(name = "提交内容", width = 15)
@ApiModelProperty(value = "提交内容")
private java.lang.String submitContent;
/**提交图片*/
@Excel(name = "提交图片", width = 15)
@ApiModelProperty(value = "提交图片")
private java.lang.String submitPic;
/**责任人*/
@Excel(name = "责任人", width = 15)
@ApiModelProperty(value = "责任人")
private java.lang.String managerUsers;
/**BUG状态*/
@ExcelIgnore
@ApiModelProperty(value = "BUG状态")
@Dict(dicCode = "bug_status")
private java.lang.Integer bugStatus;
@TableField(exist = false)
@Excel(name = "BUG状态", width = 15)
private java.lang.String bugStatusName;
/**提交时间*/
@Excel(name = "提交时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "提交时间")
private java.util.Date submitTime;
/**审核时间*/
@Excel(name = "审核时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "审核时间")
private java.util.Date auditTime;
}

@ -1,12 +1,12 @@
package org.jeecg.modules.demo.bugx.mapper; package org.jeecg.modules.demo.bugx.mapper;
import java.util.Date; import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
import org.jeecg.modules.demo.bugx.entity.Bugx; import org.jeecg.modules.demo.bugx.entity.Bugx;
import org.jeecg.modules.demo.bugx.entity.BugxExportDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/** /**

@ -2,6 +2,7 @@ package org.jeecg.modules.demo.bugx.service;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.bugx.entity.Bugx; import org.jeecg.modules.demo.bugx.entity.Bugx;
import org.jeecg.modules.demo.bugx.entity.BugxExportDto;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
/** /**

@ -2,6 +2,7 @@ package org.jeecg.modules.demo.bugx.service.impl;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.bugx.entity.Bugx; import org.jeecg.modules.demo.bugx.entity.Bugx;
import org.jeecg.modules.demo.bugx.entity.BugxExportDto;
import org.jeecg.modules.demo.bugx.mapper.BugxMapper; import org.jeecg.modules.demo.bugx.mapper.BugxMapper;
import org.jeecg.modules.demo.bugx.service.IBugxService; import org.jeecg.modules.demo.bugx.service.IBugxService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

@ -52,11 +52,6 @@ public class FunctionxTest implements Serializable {
*/ */
private String pmDescribe; private String pmDescribe;
/**
* 分析图
*/
private String diagrams;
/** /**
* 用户角色 * 用户角色
*/ */

@ -101,19 +101,18 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F
fun.setFunctionCode(list.get(3)); // 功能编码 fun.setFunctionCode(list.get(3)); // 功能编码
fun.setFunctionType(list.get(4)); // 功能类型 fun.setFunctionType(list.get(4)); // 功能类型
fun.setPmDescribe(list.get(5)); // 功能描述 fun.setPmDescribe(list.get(5)); // 功能描述
fun.setDiagrams(list.get(6)); // 分析图 fun.setUserRole(list.get(6)); // 用户角色
fun.setUserRole(list.get(7)); // 用户角色 fun.setManagerUsers(list.get(7)); // 责任人
fun.setManagerUsers(list.get(8)); // 责任人 fun.setWorkLevel(list.get(8)); // 任务等级
fun.setWorkLevel(list.get(9)); // 任务等级 fun.setWorkStatus(list.get(9)); // 任务状态
fun.setWorkStatus(list.get(10)); // 任务状态 fun.setPublishTime(list.get(10)); // 发布时间
fun.setPublishTime(list.get(11)); // 发布时间 fun.setStartTime(list.get(11)); // 开始时间
fun.setStartTime(list.get(12)); // 开始时间 fun.setDuration(list.get(12)); // 任务时长
fun.setDuration(list.get(13)); // 任务时长 fun.setSubmitTime(list.get(13)); // 提交时间
fun.setSubmitTime(list.get(14)); // 提交时间 fun.setRealDuration(list.get(14)); // 实际时长
fun.setRealDuration(list.get(15)); // 实际时长 fun.setStatus(list.get(15)); // 功能状态
fun.setStatus(list.get(16)); // 功能状态 fun.setVerisonStatus(list.get(16)); // 版本状态
fun.setVerisonStatus(list.get(17)); // 版本状态 fun.setVerison(list.get(17)); // 版本号
fun.setVerison(list.get(18)); // 版本号
fun.setCreatName(username); fun.setCreatName(username);
listVo.add(fun); listVo.add(fun);
@ -150,7 +149,6 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F
String functionCode = function.getFunctionCode(); String functionCode = function.getFunctionCode();
String functionType = function.getFunctionType(); String functionType = function.getFunctionType();
String pmDescribe = function.getPmDescribe(); String pmDescribe = function.getPmDescribe();
String diagrams = function.getDiagrams();
String userRole = function.getUserRole(); String userRole = function.getUserRole();
String managerUsers = function.getManagerUsers(); String managerUsers = function.getManagerUsers();
String workLevel = function.getWorkLevel(); String workLevel = function.getWorkLevel();
@ -237,9 +235,6 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F
if(StringUtils.isNotBlank(pmDescribe)){ // 功能描述 if(StringUtils.isNotBlank(pmDescribe)){ // 功能描述
functionx.setPmDescribe(pmDescribe); functionx.setPmDescribe(pmDescribe);
} }
if(StringUtils.isNotBlank(diagrams)){ // 分析图
functionx.setDiagrams(diagrams);
}
if(StringUtils.isNotBlank(userRole)){ // 用户角色 if(StringUtils.isNotBlank(userRole)){ // 用户角色
LambdaQueryWrapper<ProjectUserRole> queryWrapperUser = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ProjectUserRole> queryWrapperUser = new LambdaQueryWrapper<>();
queryWrapperUser.eq(ProjectUserRole::getUserRole,userRole); // 是否匹配项目id? queryWrapperUser.eq(ProjectUserRole::getUserRole,userRole); // 是否匹配项目id?

@ -57,12 +57,12 @@ public class RequirementType implements Serializable {
@ApiModelProperty(value = "所属部门") @ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode; private java.lang.String sysOrgCode;
/**项目id*/ /**项目id*/
@Excel(name = "项目id", width = 15, dictTable = "projectx", dicText = "project_name", dicCode = "id") @Excel(name = "项目", width = 15, dictTable = "projectx", dicText = "project_name", dicCode = "id")
@Dict(dictTable = "projectx", dicText = "project_name", dicCode = "id") @Dict(dictTable = "projectx", dicText = "project_name", dicCode = "id")
@ApiModelProperty(value = "项目id") @ApiModelProperty(value = "项目id")
private java.lang.String projectId; private java.lang.String projectId;
/**上级类型id*/ /**上级类型id*/
@Excel(name = "上级类型id", width = 15, dictTable = "requirement_type", dicText = "type_name", dicCode = "id") @Excel(name = "上级类型", width = 15, dictTable = "requirement_type", dicText = "type_name", dicCode = "id")
@Dict(dictTable = "requirement_type", dicText = "type_name", dicCode = "id") @Dict(dictTable = "requirement_type", dicText = "type_name", dicCode = "id")
@ApiModelProperty(value = "上级类型id") @ApiModelProperty(value = "上级类型id")
private java.lang.String upperId; private java.lang.String upperId;

@ -329,7 +329,7 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
if (ruleVoList.size() <= 0 || ruleVoList == null) { if (ruleVoList.size() <= 0 || ruleVoList == null) {
message.put("isVisible", "false"); message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件导入失败,模板不匹配"); return Result.error("文件导入失败,模板不匹配有空值");
} }
// 将总的记录数传递给前端 // 将总的记录数传递给前端
message.put("records", String.valueOf(ruleVoList.size())); message.put("records", String.valueOf(ruleVoList.size()));
@ -421,31 +421,44 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
} }
rulex.setWorkLevel(integer); rulex.setWorkLevel(integer);
String workStatus = ruleVo.getWorkStatus(); String workStatus = ruleVo.getWorkStatus();
LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper = new LambdaQueryWrapper<>();
sysDictItemLambdaQueryWrapper.eq(SysDictItem::getItemText, workStatus).eq(SysDictItem::getDictId, "1645268542514421762"); // sysDictItemLambdaQueryWrapper.eq(SysDictItem::getItemText, workStatus).eq(SysDictItem::getDictId, "1645268542514421762");
SysDictItem sysDictItem = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper); // SysDictItem sysDictItem = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper);
if (sysDictItem == null) {
if (workStatus.equals("未发布"))
rulex.setWorkStatus(0);
else if (workStatus.equals("已发布"))
rulex.setWorkStatus(1);
else if (workStatus.equals("开发中"))
rulex.setWorkStatus(2);
else if(workStatus.equals("已完成"))
rulex.setWorkStatus(3);
else if(workStatus.equals("已撤回"))
rulex.setWorkStatus(4);
else if(workStatus.equals("DEBUG"))
rulex.setWorkStatus(9);
else {
iRuleVoService.remove(null); iRuleVoService.remove(null);
message.put("isVisible", "false"); message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("任务状态输入错误,请核对"); return Result.error("任务状态输入错误,请核对");
} }
rulex.setWorkStatus(Integer.valueOf(sysDictItem.getItemValue()));
String status = ruleVo.getStatus(); String status = ruleVo.getStatus();
LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper2 = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper2 = new LambdaQueryWrapper<>();
sysDictItemLambdaQueryWrapper2.eq(SysDictItem::getItemText, status).eq(SysDictItem::getDictId, "1645264493205491713"); // sysDictItemLambdaQueryWrapper2.eq(SysDictItem::getItemText, status).eq(SysDictItem::getDictId, "1645264493205491713");
SysDictItem sysDictItem2 = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper2); // SysDictItem sysDictItem2 = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper2);
if (sysDictItem2 == null) { if (status.equals("正常"))
rulex.setStatus(1);
else if (status.equals("停用"))
rulex.setStatus(0);
else if (status.equals("废弃"))
rulex.setStatus(9);
else {
iRuleVoService.remove(null); iRuleVoService.remove(null);
message.put("isVisible", "false"); message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("规则状态输入错误,请核对"); return Result.error("规则状态输入错误,请核对");
} }
rulex.setStatus(Integer.valueOf(sysDictItem2.getItemValue()));
String verisonStatus = ruleVo.getVerisonStatus(); String verisonStatus = ruleVo.getVerisonStatus();
LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper3 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper3 = new LambdaQueryWrapper<>();
sysDictItemLambdaQueryWrapper3.eq(SysDictItem::getItemText, verisonStatus); sysDictItemLambdaQueryWrapper3.eq(SysDictItem::getItemText, verisonStatus);

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecg.common.aspect.annotation.Dict;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecgframework.poi.excel.annotation.Excel;
//import org.jeecg.common.aspect.annotation.Dict; //import org.jeecg.common.aspect.annotation.Dict;
@ -61,15 +62,15 @@ public class RuleVo implements Serializable {
/** /**
* 对应模块id * 对应模块id
*/ */
@Excel(name = "对应模块id", width = 15) @Excel(name = "对应模块", width = 15)
@ApiModelProperty(value = "对应模块id") @ApiModelProperty(value = "对应模块")
// /*@Dict(dictTable = "modulex", dicCode = "id", dicText = "module_name")*/ @Dict(dictTable = "modulex", dicCode = "id", dicText = "module_name")
private java.lang.String moduleId; private java.lang.String moduleId;
/** /**
* 对应功能id * 对应功能id
*/ */
@Excel(name = "对应功能id", width = 15) @Excel(name = "对应功能", width = 15)
@ApiModelProperty(value = "对应功能id") @ApiModelProperty(value = "对应功能")
// /*@Dict(dictTable = "functionx", dicCode = "id", dicText = "function_name")*/ // /*@Dict(dictTable = "functionx", dicCode = "id", dicText = "function_name")*/
private java.lang.String functionId; private java.lang.String functionId;
/** /**
@ -99,8 +100,8 @@ public class RuleVo implements Serializable {
/** /**
* 对应实体id * 对应实体id
*/ */
@Excel(name = "对应实体id", width = 15) @Excel(name = "对应实体", width = 15)
@ApiModelProperty(value = "对应实体id") @ApiModelProperty(value = "对应实体")
// @Dict(dictTable = "tablex", dicText = "table_name", dicCode = "id") // @Dict(dictTable = "tablex", dicText = "table_name", dicCode = "id")
private java.lang.String tableId; private java.lang.String tableId;
/** /**

@ -66,14 +66,14 @@ public class Rulex implements Serializable {
* 对应模块id * 对应模块id
*/ */
@Excel(name = "对应模块id", width = 15) @Excel(name = "对应模块id", width = 15)
@ApiModelProperty(value = "对应模块id") @ApiModelProperty(value = "对应模块")
@Dict(dictTable = "modulex", dicCode = "id", dicText = "module_name") @Dict(dictTable = "modulex", dicCode = "id", dicText = "module_name")
private java.lang.String moduleId; private java.lang.String moduleId;
/** /**
* 对应功能id * 对应功能id
*/ */
@Excel(name = "对应功能id", width = 15) @Excel(name = "对应功能id", width = 15)
@ApiModelProperty(value = "对应功能id") @ApiModelProperty(value = "对应功能")
@Dict(dictTable = "functionx", dicCode = "id", dicText = "function_name") @Dict(dictTable = "functionx", dicCode = "id", dicText = "function_name")
private java.lang.String functionId; private java.lang.String functionId;
/** /**
@ -104,7 +104,7 @@ public class Rulex implements Serializable {
* 对应实体id * 对应实体id
*/ */
@Excel(name = "对应实体id", width = 15) @Excel(name = "对应实体id", width = 15)
@ApiModelProperty(value = "对应实体id") @ApiModelProperty(value = "对应实体")
@Dict(dictTable = "tablex", dicText = "table_name", dicCode = "id") @Dict(dictTable = "tablex", dicText = "table_name", dicCode = "id")
private java.lang.String tableId; private java.lang.String tableId;
/** /**

@ -11,7 +11,10 @@ import com.aliyuncs.utils.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -31,6 +34,7 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.tablex.entity.Tablex; import org.jeecg.modules.tablex.entity.Tablex;
import org.jeecg.modules.tablex.service.ITablexService; import org.jeecg.modules.tablex.service.ITablexService;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jsoup.helper.StringUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -301,15 +305,97 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
return Result.error("文件格式上传有误"); return Result.error("文件格式上传有误");
} }
//根据格式读取 //根据格式读取
InputStream inputStream=file.getInputStream();
Workbook workbook=null;
if (path.endsWith(".xls")) {
workbook=new HSSFWorkbook(inputStream);
}
else {
workbook = new XSSFWorkbook(inputStream);
}
//读取表
List<Fieldx222> list = new ArrayList<>(); List<Fieldx222> list = new ArrayList<>();
//获取excel的所有页
int numberofSheets= workbook.getNumberOfSheets();
for (int i=0;i< numberofSheets;i++)
{
Sheet Sheet=workbook.getSheetAt(i);
//判断表结构
Row row=Sheet.getRow(3);
if(row==null)
return Result.error("表结构不能为空");
if (path.endsWith(".xls")) { for(int r=3;r<=Sheet.getLastRowNum();r++) {
list = readXLS(file); Row cells = Sheet.getRow(r);
} else list = readXLSX(file); String cell = cells.getCell(0).getStringCellValue();
if (StringUtils.isEmpty(cell)) {
break;
}
ExcelInfo excelInfo = new ExcelInfo();
excelInfo.setcells(cells);
Fieldx222 fieldx222 = new Fieldx222();
if (StringUtil.isBlank(excelInfo.getTableId())) {
return Result.error("序号为" + (r - 2) + "的表名不能为空");
}
fieldx222.setTableId(excelInfo.getTableId());
if (StringUtil.isBlank(excelInfo.getFieldName())) {
return Result.error("序号为" + (r - 2) + "的中文名称不能为空");
}
fieldx222.setFieldName(excelInfo.getFieldName());
if (StringUtil.isBlank(excelInfo.getFieldEnName())) {
return Result.error("序号为" + (r - 2) + "的英文名称不能为空");
}
fieldx222.setFieldEnName(excelInfo.getFieldEnName());
if (StringUtil.isBlank(excelInfo.getType())) {
return Result.error("序号为" + (r - 2) + "的数据类型不能为空");
}
fieldx222.setType(excelInfo.getType());
if (StringUtil.isBlank(excelInfo.getLength())) {
return Result.error("序号为" + (r - 2) + "的数据长度不能为空");
}
fieldx222.setLength(excelInfo.getLength());
if (StringUtil.isBlank(excelInfo.getIsPk())) {
return Result.error("序号为" + (r - 2) + "的是否主键不能为空");
}
fieldx222.setIsPk(excelInfo.getIsPk());
if (StringUtil.isBlank(excelInfo.getIsFk())) {
return Result.error("序号为" + (r - 2) + "的是否外键不能为空");
}
fieldx222.setIsFk(excelInfo.getIsFk());
if (StringUtil.isBlank(excelInfo.getIsNull())) {
return Result.error("序号为" + (r - 2) + "的是否为空不能为空");
}
fieldx222.setIsNull(excelInfo.getIsNull());
if (StringUtil.isBlank(excelInfo.getIsUniqueness())) {
return Result.error("序号为" + (r - 2) + "的是否重复不能为空");
}
fieldx222.setIsUniqueness(excelInfo.getIsUniqueness());
if (StringUtil.isBlank(excelInfo.getVerisonStatus())) {
return Result.error("序号为" + (r - 2) + "的字段状态不能为空");
}
fieldx222.setVerisonStatus(excelInfo.getVerisonStatus());
if (StringUtil.isBlank(excelInfo.getVerison())) {
return Result.error("序号为" + (r - 2) + "的版本状态不能为空");
}
fieldx222.setVerison(excelInfo.getVerison());
if (!StringUtils.isEmpty(excelInfo.getAccuracy()))
fieldx222.setAccuracy(excelInfo.getAccuracy());
if (!StringUtils.isEmpty(excelInfo.getFormat()))
fieldx222.setFormat(excelInfo.getFormat());
if (!StringUtils.isEmpty(excelInfo.getAssociateTable()))
fieldx222.setAssociateTable(excelInfo.getAssociateTable());
if (!StringUtils.isEmpty(excelInfo.getAssociateField()))
fieldx222.setAssociateField(excelInfo.getAssociateField());
if (!StringUtils.isEmpty(excelInfo.getRule()))
fieldx222.setRull(excelInfo.getRule());
list.add(fieldx222);
}
}
fieldx222Service.saveBatch(list); fieldx222Service.saveBatch(list);
List<Fieldx222> list222 = fieldx222Service.list(); List<Fieldx222> list222 = fieldx222Service.list();
fieldx222Service.remove(null);
if(list222==null) if(list222==null)
return Result.error("文件上传失败"); return Result.error("文件上传失败");
List<Fieldx> list1= list222.stream().map((item)->{ List<Fieldx> list1= list222.stream().map((item)->{
@ -338,86 +424,10 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
fieldx.setRule(item.getRull()); fieldx.setRule(item.getRull());
return fieldx; return fieldx;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
fieldx222Service.remove(null);
fieldxService.saveBatch(list1); fieldxService.saveBatch(list1);
return Result.OK("文件上传成功"); return Result.OK("文件上传成功");
}
public List<Fieldx222> readXLS(MultipartFile file) throws IOException {
List<Fieldx222> list=new ArrayList<>();
InputStream inputStream=file.getInputStream();
HSSFWorkbook workbook=new HSSFWorkbook(inputStream);
//读取表
HSSFSheet hssfSheet=workbook.getSheetAt(0);
for(int r=3;r<=hssfSheet.getLastRowNum();r++){
HSSFRow cells =hssfSheet.getRow(r);
String cell=cells.getCell(0).getStringCellValue();
if(StringUtils.isEmpty(cell)){
break;
}
ExcelInfo excelInfo = new ExcelInfo();
excelInfo.setcells(cells);
Fieldx222 fieldx=copy(excelInfo);
list.add(fieldx);
}
return list;
}
public List<Fieldx222> readXLSX(MultipartFile file) throws IOException {
List<Fieldx222> list=new ArrayList<>();
InputStream inputStream=file.getInputStream();
XSSFWorkbook workbook=new XSSFWorkbook(inputStream);
//读取表
XSSFSheet hssfSheet=workbook.getSheetAt(0);
for(int r=3;r<=hssfSheet.getLastRowNum();r++){
XSSFRow cells =hssfSheet.getRow(r);
String cell=cells.getCell(0).getStringCellValue();
if(StringUtils.isEmpty(cell)){
break;
}
ExcelInfo excelInfo=new ExcelInfo();
excelInfo.setcells(cells);
Fieldx222 fieldx=copy(excelInfo);
list.add(fieldx);
}
return list;
}
private Fieldx222 copy(ExcelInfo excelInfo){
Fieldx222 fieldx222=new Fieldx222();
if(pdNull(excelInfo.getTableId())||pdNull((excelInfo.getFieldName()))||pdNull((excelInfo.getFieldEnName()))||
pdNull((excelInfo.getType()))||pdNull((excelInfo.getLength()))||pdNull((excelInfo.getIsPk()))||
pdNull((excelInfo.getIsFk()))||pdNull((excelInfo.getIsNull()))||pdNull((excelInfo.getIsUniqueness()))||
pdNull((excelInfo.getVerison()))||pdNull((excelInfo.getVerison())))
return null;
fieldx222.setTableId(excelInfo.getTableId());
fieldx222.setFieldName(excelInfo.getFieldName());
fieldx222.setFieldEnName(excelInfo.getFieldEnName());
fieldx222.setType(excelInfo.getType());
fieldx222.setLength(excelInfo.getLength());
fieldx222.setIsPk(excelInfo.getIsPk());
fieldx222.setIsFk(excelInfo.getIsFk());
fieldx222.setIsNull(excelInfo.getIsNull());
fieldx222.setIsUniqueness(excelInfo.getIsUniqueness());
fieldx222.setVerisonStatus(excelInfo.getVerisonStatus());
fieldx222.setVerison(excelInfo.getVerison());
if(!StringUtils.isEmpty(excelInfo.getAccuracy()))
fieldx222.setAccuracy(excelInfo.getAccuracy());
if(!StringUtils.isEmpty(excelInfo.getFormat()))
fieldx222.setFormat(excelInfo.getFormat());
if(!StringUtils.isEmpty(excelInfo.getAssociateTable()))
fieldx222.setAssociateTable(excelInfo.getAssociateTable());
if(!StringUtils.isEmpty(excelInfo.getAssociateField()))
fieldx222.setAssociateField(excelInfo.getAssociateField());
if(!StringUtils.isEmpty(excelInfo.getRule()))
fieldx222.setRull(excelInfo.getRule());
return fieldx222;
} }
public boolean pdNull(Object object){
if (object == null)
return true;
else
return false;
}
// 生成sql // 生成sql
public String createSql(String tableId){ public String createSql(String tableId){

@ -121,7 +121,7 @@ public class ExcelInfo {
return "1"; return "1";
if(value.equals("SMALLINT")) if(value.equals("SMALLINT"))
return "2"; return "2";
if(value.equals("MEDIUMINT")||value.equals("废弃")) if(value.equals("MEDIUMINT"))
return "3"; return "3";
if(value.equals("INT")) if(value.equals("INT"))
return "4"; return "4";
@ -133,7 +133,7 @@ public class ExcelInfo {
return "7"; return "7";
if(value.equals("DECIMAL")) if(value.equals("DECIMAL"))
return "8"; return "8";
if(value.equals("YEAR")) if(value.equals("YEAR")||value.equals("废弃"))
return "9"; return "9";
if(value.equals("TIME")) if(value.equals("TIME"))
return "10"; return "10";

@ -171,18 +171,7 @@ public class ModulexTemplate implements Serializable {
@ApiModelProperty(value = "关联实体") @ApiModelProperty(value = "关联实体")
@Dict(dictTable = "tablex", dicText = "table_name", dicCode = "id") @Dict(dictTable = "tablex", dicText = "table_name", dicCode = "id")
private String relatedBean; private String relatedBean;
/**
* 原型图
*/
@Excel(name = "原型图", width = 15)
@ApiModelProperty(value = "原型图")
private String prototypes;
/**
* 分析图
*/
@Excel(name = "分析图", width = 15)
@ApiModelProperty(value = "分析图")
private String diagrams;
/** /**
* 模块状态 * 模块状态
* 正常1停用0废弃9默认1 * 正常1停用0废弃9默认1

@ -42,4 +42,5 @@ public interface IModulexService extends IService<Modulex> {
List<ModuleFunctionRule> exportXlslist(HttpServletRequest request, String selections,Modulex modulex); List<ModuleFunctionRule> exportXlslist(HttpServletRequest request, String selections,Modulex modulex);
Result<?> importExcel(MultipartFile file) throws Exception; Result<?> importExcel(MultipartFile file) throws Exception;
} }

@ -4,6 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.api.R; import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
@ -479,12 +484,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
modulexVo.setRelatedBean(value); modulexVo.setRelatedBean(value);
break; break;
case 16: case 16:
modulexVo.setPrototypes(value);
break;
case 17:
modulexVo.setDiagrams(value);
break;
case 18:
if (value == null || value == "") { if (value == null || value == "") {
message.put("isVisible", "false"); message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
@ -492,7 +491,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
} }
modulexVo.setStatus(value); modulexVo.setStatus(value);
break; break;
case 19: case 17:
if (value == null || value == "") { if (value == null || value == "") {
message.put("isVisible", "false"); message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
@ -500,7 +499,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
} }
modulexVo.setVerisonStatus(value); modulexVo.setVerisonStatus(value);
break; break;
case 20: case 18:
if (value == null || value == "") { if (value == null || value == "") {
message.put("isVisible", "false"); message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
@ -621,6 +620,23 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,模块编码不能为空或者模块编码过长"); return Result.error("导入失败,模块编码不能为空或者模块编码过长");
} }
String modulecode = null;
LambdaQueryWrapper<Projectx> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Projectx::getProjectName,projectId);
Projectx projectx = projectxService.getOne(queryWrapper);
String firstChar = this.toFirstChar(moduleName);
String projectCode = projectx.getProjectCode();
if(projectCode==null){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("项目编码不存在,请重新填写");
}
modulecode = projectCode + firstChar;
if(!modulecode.equals(moduleCode)){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("模块编码不规范,导入失败");
}
modulex.setModuleCode(moduleCode); modulex.setModuleCode(moduleCode);
String pmDescribe = modulexTemplate.getPmDescribe(); String pmDescribe = modulexTemplate.getPmDescribe();
if(StringUtils.isBlank(pmDescribe)){ if(StringUtils.isBlank(pmDescribe)){
@ -631,20 +647,23 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
modulex.setManagerUsers(null); modulex.setManagerUsers(null);
}else { }else {
LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
sysUserLambdaQueryWrapper.eq(SysUser::getUsername,managerUsers); String[] split = managerUsers.split(",");
SysUser iSysUserServiceOne = iSysUserService.getOne(sysUserLambdaQueryWrapper); // sysUserLambdaQueryWrapper.eq(SysUser::getUsername,managerUsers);
sysUserLambdaQueryWrapper.in(SysUser::getUsername,split);
List<SysUser> iSysUserServiceOne = iSysUserService.list(sysUserLambdaQueryWrapper);
if(iSysUserServiceOne==null){ if(iSysUserServiceOne==null){
message.put("isVisible", "false"); message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,责任人信息查询不到"); return Result.error("导入失败,责任人信息查询不到");
}else { }else {
String id = iSysUserServiceOne.getId(); List<String> list = iSysUserServiceOne.stream().map(SysUser::getId).collect(Collectors.toList());
if (id == null) { // String id = iSysUserServiceOne.getId();
if (list == null) {
message.put("isVisible", "false"); message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,责任人信息查询不到"); return Result.error("导入失败,责任人信息查询不到");
} }
modulex.setManagerUsers(id); modulex.setManagerUsers(String.valueOf(list));
} }
} }
String workLevel = modulexTemplate.getWorkLevel(); String workLevel = modulexTemplate.getWorkLevel();
@ -784,14 +803,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
return Result.error("关联实体不存在"); return Result.error("关联实体不存在");
} }
} }
String prototypes = modulexTemplate.getPrototypes();
if(StringUtils.isBlank(prototypes)){
modulex.setPrototypes(null);
}modulex.setPrototypes(prototypes);
String diagrams = modulexTemplate.getDiagrams();
if(StringUtils.isBlank(diagrams)){
modulex.setDiagrams(null);
}modulex.setDiagrams(diagrams);
String status = modulexTemplate.getStatus(); String status = modulexTemplate.getStatus();
if(StringUtils.isBlank(status)){ if(StringUtils.isBlank(status)){
message.put("isVisible", "false"); message.put("isVisible", "false");
@ -1179,4 +1190,32 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
moduleFunctionRule.setVerison(x.getVerison()); moduleFunctionRule.setVerison(x.getVerison());
return moduleFunctionRule; return moduleFunctionRule;
} }
/**
* 获取字符串拼音的第一个字母
* @param chinese
* @return
*/
public static String toFirstChar(String chinese){
String pinyinStr = "";
char[] newChar = chinese.toCharArray(); //转为单个字符
HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
for (int i = 0; i < newChar.length; i++) {
if (newChar[i] > 128) {
try {
pinyinStr += PinyinHelper.toHanyuPinyinStringArray(newChar[i], defaultFormat)[0].charAt(0);
} catch (BadHanyuPinyinOutputFormatCombination e) {
e.printStackTrace();
}
}else{
pinyinStr += newChar[i];
}
}
return pinyinStr;
}
} }

@ -298,7 +298,7 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
//获取上传文件对象 //获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setTitleRows(2);//表格标题行数,默认0 params.setTitleRows(1);//表格标题行数,默认0
params.setHeadRows(1);//表头行数,默认1 params.setHeadRows(1);//表头行数,默认1
params.setNeedSave(true);//是否需要保存上传的Excel,默认为false params.setNeedSave(true);//是否需要保存上传的Excel,默认为false
List<TablexVo> list = null; List<TablexVo> list = null;

@ -39,11 +39,10 @@ import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Optional;
/** /**
* @Description: 任务管理 * @Description: 任务管理
@ -62,6 +61,14 @@ public class TaskController extends JeecgController<Task, ITaskService> {
private static final String ADMIN = "admin"; private static final String ADMIN = "admin";
private static final String FORMAT = "yyyy/MM/dd HH:mm:ss"; private static final String FORMAT = "yyyy/MM/dd HH:mm:ss";
private static final long DAYWORKTIME = 35*60*60*100*2;
private static final long DAYTIME = 24*60*60*1000;
private static final String MORINGSTART = " 08:30:00";
private static final String MORINGEND = " 12:00:00";
private static final String AFTERNOONSTART = " 14:30:00";
private static final String AFTERNOONEND= " 18:00:00";
@Resource @Resource
private IProjectxService iProjectxService; private IProjectxService iProjectxService;
@ -91,17 +98,114 @@ public class TaskController extends JeecgController<Task, ITaskService> {
@ApiOperation(value = "任务管理-分页列表查询", notes = "任务管理-分页列表查询") @ApiOperation(value = "任务管理-分页列表查询", notes = "任务管理-分页列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<?> queryPageList(Task task, public Result<?> queryPageList(Task task,
@RequestParam(name = "type", required = false) List<String> type,
@RequestParam(name = "userName", defaultValue = "") String userName,
@RequestParam(name = "time", required = false) Integer time,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) throws ParseException {
QueryWrapper<Task> queryWrapper = QueryGenerator.initQueryWrapper(task, req.getParameterMap()); QueryWrapper<Task> queryWrapper = new QueryWrapper<>();
Page<Task> page = new Page<Task>(pageNo, pageSize); Page<Task> page = new Page<Task>(pageNo, pageSize);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (!StringUtils.equals(ADMIN, user.getUsername())) { if (!StringUtils.equals(ADMIN, user.getUsername())) {
queryWrapper.like("manager_users", user.getId()); queryWrapper.like("manager_users", user.getId());
} }
queryWrapper.orderByDesc("create_time"); if (type != null && type.size() > 0)
queryWrapper.and(qw -> {
for (int i = 0; i < type.size(); i++) {
qw.eq("type_id", type.get(i));
if (i != type.size() - 1)
qw.or();
}
});
// projectId
Calendar now = Calendar.getInstance();
int year = now.get(Calendar.YEAR);
int month = now.get(Calendar.MONTH) + 1;
int day = now.get(Calendar.DAY_OF_MONTH);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (time != null) {
switch (time) {
case 1: {//当前天
Date startTime = sdf.parse(year + "-" + month + "-" + day + " 00:00:00");
Date endTime = sdf.parse(year + "-" + month + "-" + day + " 23:59:59");
queryWrapper.ge("start_time", startTime);
queryWrapper.le("start_time", endTime);
break;
}
case 2: {//当前周
Calendar now1 = Calendar.getInstance();
now1.set(Calendar.DAY_OF_WEEK, 2);
int year1 = now1.get(Calendar.YEAR);
int month1 = now1.get(Calendar.MONTH) + 1;
int day1 = now1.get(Calendar.DAY_OF_MONTH);
now1.set(Calendar.DATE, now1.get(Calendar.DATE) + 6);
int year2 = now1.get(Calendar.YEAR);
int month2 = now1.get(Calendar.MONTH) + 1;
int day2 = now1.get(Calendar.DAY_OF_MONTH);
Date startTime = sdf.parse(year1 + "-" + month1 + "-" + day1 + " 00:00:00");
Date endTime = sdf.parse(year2 + "-" + month2 + "-" + day2 + " 23:59:59");
queryWrapper.ge("start_time", startTime);
queryWrapper.le("start_time", endTime);
}
case 3: {//当前月
int minDay = now.getActualMinimum(Calendar.DAY_OF_MONTH);
int lastDay = now.getActualMaximum(Calendar.DAY_OF_MONTH);
Date startTime = sdf.parse(year + "-" + month + "-" + minDay + " 00:00:00");
Date endTime = sdf.parse(year + "-" + month + "-" + lastDay + " 23:59:59");
queryWrapper.ge("start_time", startTime);
queryWrapper.le("start_time", endTime);
break;
}
// case 4: {
// Date startTime = sdf.parse(year + "-" + month + "-" + day + " 00:00:00");
// Date endTime = sdf.parse(year + "-" + month + "-" + day + " 23:59:59");
// queryWrapper.ge("create_time", startTime);
// queryWrapper.le("create_time", endTime);
// break;
// }
}
}
if (task != null && StringUtils.isNotBlank(task.getModuleId())) {
String moduleId = task.getModuleId();
queryWrapper.like("module_id", moduleId);
}
if (task != null && StringUtils.isNotBlank(task.getProjectId())) {
String projectId = task.getProjectId();
queryWrapper.like("project_id", projectId);
}
if (task != null && StringUtils.isNotBlank(task.getTypeId())) {
String typeId = task.getTypeId();
queryWrapper.like("type_id", typeId);
}
if (task != null && StringUtils.isNotBlank(task.getManagerUsers())) {
String managerUsers = task.getManagerUsers();
queryWrapper.like("manager_users", managerUsers);
}
// List<SysUser> sysUsers = taskService.UserIdByUserName(userName);
// queryWrapper.and(qw -> {
// for (int i = 0; i < sysUsers.size(); i++) {
// qw.like("manager_users", sysUsers.get(i).getId());
// if (i != sysUsers.size() - 1)
// qw.or();
// }
// });
if (task != null && StringUtils.isNotBlank(task.getTaskName())) {
String tas = task.getTaskName();
if (tas.startsWith("*") && tas.endsWith("*"))
tas = tas.substring(1, tas.length() - 1);
queryWrapper.like("task_name", tas);
}
if (task != null && task.getWorkStatus() != null && (task.getWorkStatus() == 0 || task.getWorkStatus() == 1)) {
queryWrapper.in("work_status", 0, 1);
} else if (task != null && task.getWorkStatus() != null && (task.getWorkStatus() == 2 || task.getWorkStatus() == 9)) {
queryWrapper.in("work_status", 2, 9);
} else if (task != null && task.getWorkStatus() != null) {
queryWrapper.eq("work_status", task.getWorkStatus());
}
queryWrapper.orderByDesc("update_time");
IPage<Task> pageList = taskService.page(page, queryWrapper); IPage<Task> pageList = taskService.page(page, queryWrapper);
pageList.getRecords().stream().forEach(e -> { pageList.getRecords().stream().forEach(e -> {
String startDate = DateUtils.date2Str(e.getStartTime(), new SimpleDateFormat(FORMAT)); String startDate = DateUtils.date2Str(e.getStartTime(), new SimpleDateFormat(FORMAT));
@ -128,18 +232,89 @@ public class TaskController extends JeecgController<Task, ITaskService> {
e.setUpperTaskName(taskUpper.getTaskName()); e.setUpperTaskName(taskUpper.getTaskName());
} }
} }
if (e.getTaskFile()!=null&& !e.getTaskFile().equals("")){ if (e.getTaskFile() != null && !e.getTaskFile().equals("")) {
e.setContentType("file"); e.setContentType("file");
}else if(e.getTaskPic()!=null&& !e.getTaskPic().equals("")){ } else if (e.getTaskPic() != null && !e.getTaskPic().equals("")) {
e.setContentType("image"); e.setContentType("image");
}else{ } else {
e.setContentType("text"); e.setContentType("text");
} }
String managerUsers = e.getManagerUsers(); String managerUsers = e.getManagerUsers();
if (managerUsers!=null&&!managerUsers.equals("")) { if (managerUsers != null && !managerUsers.equals("")) {
SysUser byId = iSysUserService.getById(managerUsers); String[] managerUsers1 = managerUsers.split(",");
if (byId!=null) StringBuilder avatars = new StringBuilder();
e.setHeadpic(byId.getAvatar()); for (String managerUser : managerUsers1) {
SysUser byId = iSysUserService.getById(managerUser);
if (byId != null)
avatars.append(byId.getAvatar()).append(",");
}
avatars = new StringBuilder(avatars.substring(0, avatars.length() - 1));
e.setHeadpic(avatars.toString());
}
});
return Result.OK(pageList);
}
@AutoLog(value = "任务管理-分页列表查询")
@ApiOperation(value = "任务管理-分页列表查询", notes = "任务管理-分页列表查询")
@GetMapping(value = "/list1")
public Result<?> queryPageList1(Task task,
@RequestParam(name = "userId") String userId,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<Task> queryWrapper = QueryGenerator.initQueryWrapper(task, req.getParameterMap());
Page<Task> page = new Page<Task>(pageNo, pageSize);
queryWrapper.like("manager_users", userId);
queryWrapper.like("work_status", 3);
queryWrapper.orderByDesc("update_time");
IPage<Task> pageList = taskService.page(page, queryWrapper);
pageList.getRecords().stream().forEach(e -> {
String startDate = DateUtils.date2Str(e.getStartTime(), new SimpleDateFormat(FORMAT));
String endDate = DateUtils.date2Str(e.getExpectedEndTime(), new SimpleDateFormat(FORMAT));
String startEndTime = startDate + "-" + endDate;
e.setStartEndTime(startEndTime);
Projectx projectx = iProjectxService.getById(e.getProjectId());
e.setUnion(projectx.getProjectName());
if (StringUtils.isNotBlank(e.getModuleId())) {
Modulex modulex = iModulexService.getById(e.getModuleId());
e.setUnion(e.getUnion() + "-" + modulex.getModuleName());
}
if (StringUtils.isNotBlank(e.getFunctionId())) {
Functionx functionx = iFunctionxService.getById(e.getFunctionId());
e.setUnion(e.getUnion() + "-" + functionx.getFunctionName());
}
if (StringUtils.isNotBlank(e.getRuleId())) {
Rulex rulex = iRulexService.getById(e.getRuleId());
e.setUnion(e.getUnion() + "-" + rulex.getRuleCode());
}
if (StringUtils.isNotBlank(e.getUpperId())) {
Task taskUpper = taskService.getById(e.getUpperId());
if (ObjectUtils.isNotEmpty(taskUpper)) {
e.setUpperTaskName(taskUpper.getTaskName());
}
}
if (e.getTaskFile() != null && !e.getTaskFile().equals("")) {
e.setContentType("file");
} else if (e.getTaskPic() != null && !e.getTaskPic().equals("")) {
e.setContentType("image");
} else {
e.setContentType("text");
}
String managerUsers = e.getManagerUsers();
if (managerUsers != null && !managerUsers.equals("")) {
String[] managerUsers1 = managerUsers.split(",");
StringBuilder avatars = new StringBuilder();
for (String managerUser : managerUsers1) {
SysUser byId = iSysUserService.getById(managerUser);
if (byId != null)
avatars.append(byId.getAvatar()).append(",");
}
avatars = new StringBuilder(avatars.substring(0, avatars.length() - 1));
e.setHeadpic(avatars.toString());
} }
}); });
@ -174,31 +349,138 @@ public class TaskController extends JeecgController<Task, ITaskService> {
@ApiOperation(value = "任务管理-编辑", notes = "任务管理-编辑") @ApiOperation(value = "任务管理-编辑", notes = "任务管理-编辑")
@PutMapping(value = "/edit") @PutMapping(value = "/edit")
public Result<?> edit(@RequestBody Task task) { public Result<?> edit(@RequestBody Task task) {
String taskDescribe = task.getTaskDescribe();
boolean st = taskDescribe.contains("data:image/png;base64");
if (st)
return Result.error("不能直接将图片放入任务描述中,因为图片将会进行base64转码,数据库中text字段不一定存下");
taskService.updateById(task); taskService.updateById(task);
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");
} }
/** /**
* 提交任务更新状态同时计算实际任务时长 * 提交任务更新状态同时计算实际任务时长
* 计算一整天一上午一下午的工作时间计算有多个个这样的整段时间之后算头和尾时间 * 计算一整天之后算头和尾时间
* @param task * @param task
* @return * @return
*/ */
@ApiOperation(value = "任务管理-更新状态", notes = "任务管理-更新状态") @ApiOperation(value = "任务管理-更新状态", notes = "任务管理-更新状态")
@PutMapping(value = "/updateWorkStatus") @PutMapping(value = "/updateWorkStatus")
public Result<?> updateWorkStatus(@RequestBody Task task) { public Result<?> updateWorkStatus(@RequestBody Task task) {
Date time = new Date();
if (task.getWorkStatus() == 3){
//获取数据 //获取数据
Task oldTask = taskService.query().eq("id", task.getId()).one(); Task oldTask = taskService.query().eq("id", task.getId()).one();
Date startTime = oldTask.getStartTime(); Date startTime = oldTask.getStartTime();
Date endTime = new Date(); long realTime = 0;
try {
realTime = realDuration(startTime, time);
} catch (ParseException e) {
throw new RuntimeException(e);
}
//更新数据 //设置更新数据
task.setUpdateTime(endTime); double realTimeHour = (double)realTime/(60*60*1000);
task.setSubmitTime(endTime); realTimeHour = new BigDecimal(realTimeHour).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
task.setRealDuration(realTimeHour);
task.setSubmitTime(time);
}
task.setUpdateTime(time);
taskService.updateById(task); taskService.updateById(task);
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");
} }
//计算真实时间, 单位:小时
private long realDuration(Date startTime, Date endTime) throws ParseException {
long workTime = 0;
long millisecond = endTime.getTime() - startTime.getTime();
//统计整天时间
workTime += (millisecond / DAYTIME) * DAYWORKTIME;
millisecond = millisecond % DAYTIME;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
SimpleDateFormat sdf1 = new SimpleDateFormat("HH:mm:ss");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
String time = dateFormat.format(new Date());
String start = sdf1.format(startTime);
String time0 = time + " " + start;
startTime = sdf.parse(time0);
String time1 = time + MORINGSTART;
String time2 = time + MORINGEND;
String time3 = time + AFTERNOONSTART;
String time4 = time + AFTERNOONEND;
Date date3 = sdf.parse(time3);
Date date2 = sdf.parse(time2);
Date date1 = sdf.parse(time1);
Date date4 = sdf.parse(time4);
//从start往后推到end,要判断大量情况
if (startTime.compareTo(endTime) > 0){
//时间跨度两天,但总时间不超过24小时
if (startTime.compareTo(date1) <= 0)
startTime = date1; //任务发布在8点前,从8点开始算
if (startTime.compareTo(date2) <= 0){
//早上有工作时间
workTime += date2.getTime() - startTime.getTime();
//跨度两天,下午必有任务时间
workTime += DAYWORKTIME/2;
//第二天下午必没有工作时间,判断第二天早上是否有部分工作时间
if (endTime.compareTo(date1) > 0)
workTime += endTime.getTime() - date1.getTime(); //第二天早上有工作时间
return workTime; //计算完成,返回结果
}
//上午没有工作时间
if (startTime.compareTo(date3) <= 0)
startTime = date3; //任务发布时间在12点后,14点前
if (startTime.compareTo(date4) <= 0) //下午有工作时间
workTime += date4.getTime() - startTime.getTime();
if (endTime.compareTo(date1) <= 0)
return workTime; //第二天没有工作时间
if (endTime.compareTo(date2) <= 0){
workTime += endTime.getTime() - date1.getTime(); //第二天上午有部分工作时间
return workTime; //必然下午没有工作时间
}
workTime += DAYWORKTIME/2; //第二天上午工作时间占满
if (endTime.compareTo(date3) <= 0)
return workTime; //下午没有工作时间
if (endTime.compareTo(date4) >= 0)
endTime = date4; //下午干满了
workTime += endTime.getTime() - date3.getTime();
return workTime;
}else {
//时间跨度没有超过两天
if (startTime.compareTo(date1) <= 0)
startTime = date1; //发布任务在8点之前
if (startTime.compareTo(date2) <= 0){
//上午发布的任务
if (endTime.compareTo(date2) <= 0){
//上午提交的任务
workTime += endTime.getTime() - startTime.getTime();
return workTime;
}
workTime += date2.getTime() - startTime.getTime(); //上午没有提交任务
if (endTime.compareTo(date3) <= 0)
return workTime; //中午12点后14点前提交任务
if (endTime.compareTo(date4) >= 0)
endTime = date4; //时间偏移
workTime += endTime.getTime() - date3.getTime(); //下午工作时间
return workTime;
}else {
//下午发布的任务
if (startTime.compareTo(date3) <= 0)
startTime = date3; //12点之后,14点之前发布任务
if (endTime.compareTo(date4) >= 0)
endTime = date4; //时间偏移
workTime += endTime.getTime() - startTime.getTime();
return workTime;
}
}
}
/** /**
* 通过id删除 * 通过id删除
* *

@ -97,6 +97,7 @@ public class Task implements Serializable {
*/ */
@Excel(name = "模块id", width = 15) @Excel(name = "模块id", width = 15)
@ApiModelProperty(value = "模块id") @ApiModelProperty(value = "模块id")
@Dict(dictTable = "modulex", dicText = "module_name",dicCode = "id")
private java.lang.String moduleId; private java.lang.String moduleId;
/** /**
* 功能id * 功能id

@ -2,8 +2,11 @@ package org.jeecg.modules.task.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.task.entity.Task; import org.jeecg.modules.task.entity.Task;
import java.util.List;
/** /**
* @Description: 任务管理 * @Description: 任务管理
* @Author: jeecg-boot * @Author: jeecg-boot
@ -26,4 +29,6 @@ public interface ITaskService extends IService<Task> {
Result<?> fabu(String id); Result<?> fabu(String id);
String fillTaskName(String projectId, String typeId); String fillTaskName(String projectId, String typeId);
// List<SysUser> UserIdByUserName(String userName);
} }

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.projectx.entity.Projectx; import org.jeecg.modules.projectx.entity.Projectx;
import org.jeecg.modules.projectx.service.IProjectxService; import org.jeecg.modules.projectx.service.IProjectxService;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.modules.task.entity.Task; import org.jeecg.modules.task.entity.Task;
import org.jeecg.modules.task.mapper.TaskMapper; import org.jeecg.modules.task.mapper.TaskMapper;
import org.jeecg.modules.task.service.ITaskService; import org.jeecg.modules.task.service.ITaskService;
@ -35,7 +37,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
@Resource @Resource
private ITaskTypeService iTaskTypeService; private ITaskTypeService iTaskTypeService;
// @Resource
// private ISysUserService sysUserService;
/** /**
* 责任人回显
* 责任人回显 * 责任人回显
*/ */
@Override @Override
@ -145,4 +150,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
String fillName = taskType.getTypeName() + "-" + projectx.getProjectName(); String fillName = taskType.getTypeName() + "-" + projectx.getProjectName();
return fillName; return fillName;
} }
// @Override
// public List<SysUser> UserIdByUserName(String userName) {
// if (userName==null)
// return null;
// LambdaQueryWrapper<SysUser> wrapper=new LambdaQueryWrapper<>();
// if(userName.startsWith("*")&&userName.endsWith("*"))
// userName = userName.substring(1, userName.length() - 1);
// wrapper.eq(SysUser::getUsername,userName);
// return sysUserService.list(wrapper);
// }
} }

Loading…
Cancel
Save