From 05673192c8ceaee603c80348ecb058ca63b33ce0 Mon Sep 17 00:00:00 2001 From: itcast Date: Tue, 18 Jul 2023 16:59:40 +0800 Subject: [PATCH 01/17] Changes --- .../functiontemple/FunctionTemplateList.vue | 2 +- .../src/views/modulex/ModulexList.vue | 1 - .../fieldx/controller/FieldxController.java | 168 ++++++++++-------- 3 files changed, 90 insertions(+), 81 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/functiontemple/FunctionTemplateList.vue b/ant-design-vue-jeecg/src/views/functiontemple/FunctionTemplateList.vue index c81cb85..0e1cc36 100644 --- a/ant-design-vue-jeecg/src/views/functiontemple/FunctionTemplateList.vue +++ b/ant-design-vue-jeecg/src/views/functiontemple/FunctionTemplateList.vue @@ -40,7 +40,7 @@
新增 导出 - + 导入 diff --git a/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue b/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue index f3a8a1b..e361df6 100644 --- a/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue +++ b/ant-design-vue-jeecg/src/views/modulex/ModulexList.vue @@ -469,7 +469,6 @@ export default { deleteBatch: "/modulex/modulex/deleteBatch", exportXlsUrl: "/modulex/modulex/exportXls", importExcelUrlf: "fieldx/fieldx/importExcel", - importExcelUrl: "modulex/modulex/importExcel", functionImportExcelUrl: "/functionx/functionx/importExcel", tablexImportExcelUrl: "tablex/tablex/importExcel", diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java index ef5344e..b290aba 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java @@ -11,7 +11,10 @@ import com.aliyuncs.utils.StringUtils; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; 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.Sheet; +import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; 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.service.ITablexService; import org.jeecg.common.system.base.controller.JeecgController; +import org.jsoup.helper.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -301,15 +305,97 @@ public class FieldxController extends JeecgController { return Result.error("文件格式上传有误"); } //根据格式读取 + InputStream inputStream=file.getInputStream(); + Workbook workbook=null; + if (path.endsWith(".xls")) { + workbook=new HSSFWorkbook(inputStream); + } + else { + workbook = new XSSFWorkbook(inputStream); + } + //读取表 List 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")) { - list = readXLS(file); - } else list = readXLSX(file); + for(int r=3;r<=Sheet.getLastRowNum();r++) { + Row cells = Sheet.getRow(r); + 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); List list222 = fieldx222Service.list(); + fieldx222Service.remove(null); if(list222==null) return Result.error("文件上传失败"); List list1= list222.stream().map((item)->{ @@ -338,86 +424,10 @@ public class FieldxController extends JeecgController { fieldx.setRule(item.getRull()); return fieldx; }).collect(Collectors.toList()); - fieldx222Service.remove(null); fieldxService.saveBatch(list1); return Result.OK("文件上传成功"); - } - public List readXLS(MultipartFile file) throws IOException { - List 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 readXLSX(MultipartFile file) throws IOException { - List 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 public String createSql(String tableId){ From c00113c0c67c822d136579c938dcb0d825794e1e Mon Sep 17 00:00:00 2001 From: chengyufei <1932574737@qq.com> Date: Tue, 18 Jul 2023 17:06:51 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=97=B6=E9=95=BF=E8=87=AA=E5=8A=A8=E8=AE=A1?= =?UTF-8?q?=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/controller/TaskController.java | 130 ++++++++++++++++-- 1 file changed, 121 insertions(+), 9 deletions(-) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java index b405c25..e81391d 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java @@ -39,6 +39,8 @@ import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.math.BigDecimal; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; @@ -62,6 +64,14 @@ public class TaskController extends JeecgController { private static final String ADMIN = "admin"; 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 private IProjectxService iProjectxService; @@ -180,25 +190,127 @@ public class TaskController extends JeecgController { /** * 提交任务,更新状态,同时计算实际任务时长 - * 计算一整天、一上午、一下午的工作时间;计算有多个个这样的整段时间,之后算头和尾时间 + * 计算一整天,之后算头和尾时间 * @param task * @return */ @ApiOperation(value = "任务管理-更新状态", notes = "任务管理-更新状态") @PutMapping(value = "/updateWorkStatus") public Result updateWorkStatus(@RequestBody Task task) { - //获取数据 - Task oldTask = taskService.query().eq("id", task.getId()).one(); - Date startTime = oldTask.getStartTime(); - Date endTime = new Date(); - - //更新数据 - task.setUpdateTime(endTime); - task.setSubmitTime(endTime); + Date time = new Date(); + + if (task.getWorkStatus() == 3){ + //获取数据 + Task oldTask = taskService.query().eq("id", task.getId()).one(); + Date startTime = oldTask.getStartTime(); + long realTime = 0; + try { + realTime = realDuration(startTime, time); + } catch (ParseException e) { + throw new RuntimeException(e); + } + + //设置更新数据 + double realTimeHour = (double)realTime/(60*60*1000); + realTimeHour = new BigDecimal(realTimeHour).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); + task.setRealDuration(realTimeHour); + task.setSubmitTime(time); + } + + task.setUpdateTime(time); taskService.updateById(task); 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删除 * From 6314dce865d081d14b458cb10ce2dfc6619292ef Mon Sep 17 00:00:00 2001 From: itcast Date: Tue, 18 Jul 2023 17:21:15 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/functiontemple/FunctionTemplateList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ant-design-vue-jeecg/src/views/functiontemple/FunctionTemplateList.vue b/ant-design-vue-jeecg/src/views/functiontemple/FunctionTemplateList.vue index 0e1cc36..02a0acf 100644 --- a/ant-design-vue-jeecg/src/views/functiontemple/FunctionTemplateList.vue +++ b/ant-design-vue-jeecg/src/views/functiontemple/FunctionTemplateList.vue @@ -40,7 +40,7 @@
新增 导出 - + 导入 From a15703d92038dcc1f441abeaae9aa7337bdc640c Mon Sep 17 00:00:00 2001 From: zjh <10930829+zheng-jinhao1209@user.noreply.gitee.com> Date: Wed, 19 Jul 2023 08:59:51 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=A7=84=E5=88=99?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jeecg/modules/demo/rulex/entity/RuleVo.java | 6 +++--- .../java/org/jeecg/modules/demo/rulex/entity/Rulex.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/RuleVo.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/RuleVo.java index 7645c11..cb3672f 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/RuleVo.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/RuleVo.java @@ -62,14 +62,14 @@ public class RuleVo implements Serializable { * 对应模块id */ @Excel(name = "对应模块id", width = 15) - @ApiModelProperty(value = "对应模块id") + @ApiModelProperty(value = "对应模块") // /*@Dict(dictTable = "modulex", dicCode = "id", dicText = "module_name")*/ private java.lang.String moduleId; /** * 对应功能id */ @Excel(name = "对应功能id", width = 15) - @ApiModelProperty(value = "对应功能id") + @ApiModelProperty(value = "对应功能") // /*@Dict(dictTable = "functionx", dicCode = "id", dicText = "function_name")*/ private java.lang.String functionId; /** @@ -100,7 +100,7 @@ public class RuleVo implements Serializable { * 对应实体id */ @Excel(name = "对应实体id", width = 15) - @ApiModelProperty(value = "对应实体id") + @ApiModelProperty(value = "对应实体") // @Dict(dictTable = "tablex", dicText = "table_name", dicCode = "id") private java.lang.String tableId; /** diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/Rulex.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/Rulex.java index 9fb343e..e340ffb 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/Rulex.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/Rulex.java @@ -66,14 +66,14 @@ public class Rulex implements Serializable { * 对应模块id */ @Excel(name = "对应模块id", width = 15) - @ApiModelProperty(value = "对应模块id") + @ApiModelProperty(value = "对应模块") @Dict(dictTable = "modulex", dicCode = "id", dicText = "module_name") private java.lang.String moduleId; /** * 对应功能id */ @Excel(name = "对应功能id", width = 15) - @ApiModelProperty(value = "对应功能id") + @ApiModelProperty(value = "对应功能") @Dict(dictTable = "functionx", dicCode = "id", dicText = "function_name") private java.lang.String functionId; /** @@ -104,7 +104,7 @@ public class Rulex implements Serializable { * 对应实体id */ @Excel(name = "对应实体id", width = 15) - @ApiModelProperty(value = "对应实体id") + @ApiModelProperty(value = "对应实体") @Dict(dictTable = "tablex", dicText = "table_name", dicCode = "id") private java.lang.String tableId; /** From 710245f40354ee9b18ffecb2065766a0df913770 Mon Sep 17 00:00:00 2001 From: zjh <10930829+zheng-jinhao1209@user.noreply.gitee.com> Date: Wed, 19 Jul 2023 10:09:32 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=A7=84=E5=88=99?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rulex/controller/RulexController.java | 43 ++++++++++++------- .../modules/demo/rulex/entity/RuleVo.java | 9 ++-- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java index 26646d4..a1ab599 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java @@ -329,7 +329,7 @@ public class RulexController extends JeecgController { if (ruleVoList.size() <= 0 || ruleVoList == null) { message.put("isVisible", "false"); webSocketUtils.sendMessage(loginUser.getId(), message); - return Result.error("文件导入失败,模板不匹配"); + return Result.error("文件导入失败,模板不匹配有空值"); } // 将总的记录数传递给前端 message.put("records", String.valueOf(ruleVoList.size())); @@ -421,31 +421,44 @@ public class RulexController extends JeecgController { } rulex.setWorkLevel(integer); String workStatus = ruleVo.getWorkStatus(); - LambdaQueryWrapper sysDictItemLambdaQueryWrapper = new LambdaQueryWrapper<>(); - sysDictItemLambdaQueryWrapper.eq(SysDictItem::getItemText, workStatus).eq(SysDictItem::getDictId, "1645268542514421762"); - SysDictItem sysDictItem = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper); - if (sysDictItem == null) { +// LambdaQueryWrapper sysDictItemLambdaQueryWrapper = new LambdaQueryWrapper<>(); +// sysDictItemLambdaQueryWrapper.eq(SysDictItem::getItemText, workStatus).eq(SysDictItem::getDictId, "1645268542514421762"); +// SysDictItem sysDictItem = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper); + + 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); message.put("isVisible", "false"); webSocketUtils.sendMessage(loginUser.getId(), message); return Result.error("任务状态输入错误,请核对"); } - - rulex.setWorkStatus(Integer.valueOf(sysDictItem.getItemValue())); - String status = ruleVo.getStatus(); - LambdaQueryWrapper sysDictItemLambdaQueryWrapper2 = new LambdaQueryWrapper<>(); - sysDictItemLambdaQueryWrapper2.eq(SysDictItem::getItemText, status).eq(SysDictItem::getDictId, "1645264493205491713"); - SysDictItem sysDictItem2 = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper2); - if (sysDictItem2 == null) { +// LambdaQueryWrapper sysDictItemLambdaQueryWrapper2 = new LambdaQueryWrapper<>(); +// sysDictItemLambdaQueryWrapper2.eq(SysDictItem::getItemText, status).eq(SysDictItem::getDictId, "1645264493205491713"); +// SysDictItem sysDictItem2 = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper2); + if (status.equals("正常")) + rulex.setStatus(1); + else if (status.equals("停用")) + rulex.setStatus(0); + else if (status.equals("废弃")) + rulex.setStatus(9); + else { iRuleVoService.remove(null); message.put("isVisible", "false"); webSocketUtils.sendMessage(loginUser.getId(), message); return Result.error("规则状态输入错误,请核对"); } - - - rulex.setStatus(Integer.valueOf(sysDictItem2.getItemValue())); String verisonStatus = ruleVo.getVerisonStatus(); LambdaQueryWrapper sysDictItemLambdaQueryWrapper3 = new LambdaQueryWrapper<>(); sysDictItemLambdaQueryWrapper3.eq(SysDictItem::getItemText, verisonStatus); diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/RuleVo.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/RuleVo.java index cb3672f..a72aed4 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/RuleVo.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/entity/RuleVo.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import com.fasterxml.jackson.annotation.JsonFormat; +import org.jeecg.common.aspect.annotation.Dict; import org.springframework.format.annotation.DateTimeFormat; import org.jeecgframework.poi.excel.annotation.Excel; //import org.jeecg.common.aspect.annotation.Dict; @@ -61,14 +62,14 @@ public class RuleVo implements Serializable { /** * 对应模块id */ - @Excel(name = "对应模块id", width = 15) + @Excel(name = "对应模块", width = 15) @ApiModelProperty(value = "对应模块") -// /*@Dict(dictTable = "modulex", dicCode = "id", dicText = "module_name")*/ + @Dict(dictTable = "modulex", dicCode = "id", dicText = "module_name") private java.lang.String moduleId; /** * 对应功能id */ - @Excel(name = "对应功能id", width = 15) + @Excel(name = "对应功能", width = 15) @ApiModelProperty(value = "对应功能") // /*@Dict(dictTable = "functionx", dicCode = "id", dicText = "function_name")*/ private java.lang.String functionId; @@ -99,7 +100,7 @@ public class RuleVo implements Serializable { /** * 对应实体id */ - @Excel(name = "对应实体id", width = 15) + @Excel(name = "对应实体", width = 15) @ApiModelProperty(value = "对应实体") // @Dict(dictTable = "tablex", dicText = "table_name", dicCode = "id") private java.lang.String tableId; From 1bedd0cc0e027aa27e5e0eba9dff3ccd78c2245c Mon Sep 17 00:00:00 2001 From: itcast Date: Wed, 19 Jul 2023 10:26:14 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E4=B8=AA=E9=87=8D=E8=BD=BD=E8=A1=A8=E5=8D=95=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ant-design-vue-jeecg/src/mixins/JeecgListMixin.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js b/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js index a20a414..4d360d3 100644 --- a/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js +++ b/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js @@ -349,6 +349,8 @@ export const JeecgListMixin = { this.$refs.modalForm.edit(record); this.$refs.modalForm.title = "复制"; this.$refs.modalForm.disableSubmit = false; + // 新增/修改 成功时,重载列表 + this.loadData(); }, // 任务管理-任务-分解 fengjieRenwu: function (record) { From 8470843edca6630bfd46ec09d21ca07412772bc0 Mon Sep 17 00:00:00 2001 From: mqh <1571896045@qq.com> Date: Wed, 19 Jul 2023 10:47:28 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/modules/tablex/controller/TablexController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java index 7b0296c..50d0f3a 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java @@ -298,7 +298,7 @@ public class TablexController extends JeecgController { //获取上传文件对象 ImportParams params = new ImportParams(); - params.setTitleRows(2);//表格标题行数,默认0 + params.setTitleRows(1);//表格标题行数,默认0 params.setHeadRows(1);//表头行数,默认1 params.setNeedSave(true);//是否需要保存上传的Excel,默认为false List list = null; From 3579a1aa63352a5336a688383358ca9d938d296c Mon Sep 17 00:00:00 2001 From: chengyufei <1932574737@qq.com> Date: Wed, 19 Jul 2023 15:23:19 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B4=A3=E4=BB=BB?= =?UTF-8?q?=E4=BA=BA=E7=B4=A2=E5=BC=95=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ant-design-vue-jeecg/src/views/task/TaskList.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/task/TaskList.vue b/ant-design-vue-jeecg/src/views/task/TaskList.vue index c23913d..48aed84 100644 --- a/ant-design-vue-jeecg/src/views/task/TaskList.vue +++ b/ant-design-vue-jeecg/src/views/task/TaskList.vue @@ -5,7 +5,7 @@ - + - + - + + + + + + + + From b210222210aecd131d54f9e4fc1dc90b629903e9 Mon Sep 17 00:00:00 2001 From: chengyufei <1932574737@qq.com> Date: Wed, 19 Jul 2023 15:46:29 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B4=A3=E4=BB=BB?= =?UTF-8?q?=E4=BA=BA=E7=B4=A2=E5=BC=95=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/modules/task/controller/TaskController.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java index e81391d..23569cd 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java @@ -184,6 +184,10 @@ public class TaskController extends JeecgController { @ApiOperation(value = "任务管理-编辑", notes = "任务管理-编辑") @PutMapping(value = "/edit") 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); return Result.OK("编辑成功!"); } From 0958c3ea37ec75c0c2e13f671d21435a172bf894 Mon Sep 17 00:00:00 2001 From: chengyufei <1932574737@qq.com> Date: Wed, 19 Jul 2023 15:47:49 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jeecg/modules/task/controller/TaskController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java index 23569cd..0af3095 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java @@ -189,6 +189,7 @@ public class TaskController extends JeecgController { if (st) return Result.error("不能直接将图片放入任务描述中,因为图片将会进行base64转码,数据库中text字段不一定存下"); taskService.updateById(task); + return Result.OK("编辑成功!"); } From 60863b0d75409da6ba7f187fb42319e8a052fbfc Mon Sep 17 00:00:00 2001 From: itcast Date: Wed, 19 Jul 2023 16:01:17 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E5=8E=BB=E6=8E=89excel=E8=A1=A8=E9=87=8C?= =?UTF-8?q?id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ant-design-vue-jeecg/src/mixins/JeecgListMixin.js | 2 +- .../modules/demo/requirementtype/entity/RequirementType.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js b/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js index 4d360d3..c4362d2 100644 --- a/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js +++ b/ant-design-vue-jeecg/src/mixins/JeecgListMixin.js @@ -349,7 +349,7 @@ export const JeecgListMixin = { this.$refs.modalForm.edit(record); this.$refs.modalForm.title = "复制"; this.$refs.modalForm.disableSubmit = false; - // 新增/修改 成功时,重载列表 + // 重载列表 this.loadData(); }, // 任务管理-任务-分解 diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementtype/entity/RequirementType.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementtype/entity/RequirementType.java index 3a76744..65e445f 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementtype/entity/RequirementType.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementtype/entity/RequirementType.java @@ -57,12 +57,12 @@ public class RequirementType implements Serializable { @ApiModelProperty(value = "所属部门") private java.lang.String sysOrgCode; /**项目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") @ApiModelProperty(value = "项目id") private java.lang.String projectId; /**上级类型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") @ApiModelProperty(value = "上级类型id") private java.lang.String upperId; From 5778035c74d54e84defd69f2eda17c11cf73becf Mon Sep 17 00:00:00 2001 From: itcast Date: Wed, 19 Jul 2023 16:51:52 +0800 Subject: [PATCH 12/17] Changes --- .../src/main/java/org/jeecg/modules/fieldx/dto/ExcelInfo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/dto/ExcelInfo.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/dto/ExcelInfo.java index 9b98666..163cef2 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/dto/ExcelInfo.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/dto/ExcelInfo.java @@ -121,7 +121,7 @@ public class ExcelInfo { return "1"; if(value.equals("SMALLINT")) return "2"; - if(value.equals("MEDIUMINT")||value.equals("废弃")) + if(value.equals("MEDIUMINT")) return "3"; if(value.equals("INT")) return "4"; @@ -133,7 +133,7 @@ public class ExcelInfo { return "7"; if(value.equals("DECIMAL")) return "8"; - if(value.equals("YEAR")) + if(value.equals("YEAR")||value.equals("废弃")) return "9"; if(value.equals("TIME")) return "10"; From 03659ed5495f398786ff5f8f426d53f7d434d17a Mon Sep 17 00:00:00 2001 From: shiji <1913712590@qq.com> Date: Wed, 19 Jul 2023 16:52:03 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/task/TaskList.vue | 25 ++- .../task/controller/TaskController.java | 193 ++++++++++++++++-- .../org/jeecg/modules/task/entity/Task.java | 1 + .../modules/task/service/ITaskService.java | 5 + .../task/service/impl/TaskServiceImpl.java | 15 ++ 5 files changed, 223 insertions(+), 16 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/task/TaskList.vue b/ant-design-vue-jeecg/src/views/task/TaskList.vue index 48aed84..b5762f5 100644 --- a/ant-design-vue-jeecg/src/views/task/TaskList.vue +++ b/ant-design-vue-jeecg/src/views/task/TaskList.vue @@ -21,7 +21,22 @@ style="width: 100%"> - + + + + + + + + + + + + - + + + + + 查询 diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java index 0af3095..f378790 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java @@ -42,10 +42,7 @@ import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Optional; +import java.util.*; /** * @Description: 任务管理 @@ -101,17 +98,114 @@ public class TaskController extends JeecgController { @ApiOperation(value = "任务管理-分页列表查询", notes = "任务管理-分页列表查询") @GetMapping(value = "/list") public Result queryPageList(Task task, + @RequestParam(name = "type", required = false) List type, + @RequestParam(name = "userName", defaultValue = "") String userName, + @RequestParam(name = "time", required = false) Integer time, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(task, req.getParameterMap()); + HttpServletRequest req) throws ParseException { + QueryWrapper queryWrapper = new QueryWrapper<>(); Page page = new Page(pageNo, pageSize); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); if (!StringUtils.equals(ADMIN, user.getUsername())) { 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 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 pageList = taskService.page(page, queryWrapper); pageList.getRecords().stream().forEach(e -> { String startDate = DateUtils.date2Str(e.getStartTime(), new SimpleDateFormat(FORMAT)); @@ -138,18 +232,89 @@ public class TaskController extends JeecgController { e.setUpperTaskName(taskUpper.getTaskName()); } } - if (e.getTaskFile()!=null&& !e.getTaskFile().equals("")){ + if (e.getTaskFile() != null && !e.getTaskFile().equals("")) { e.setContentType("file"); - }else if(e.getTaskPic()!=null&& !e.getTaskPic().equals("")){ + } else if (e.getTaskPic() != null && !e.getTaskPic().equals("")) { e.setContentType("image"); - }else{ + } else { e.setContentType("text"); } String managerUsers = e.getManagerUsers(); - if (managerUsers!=null&&!managerUsers.equals("")) { - SysUser byId = iSysUserService.getById(managerUsers); - if (byId!=null) - e.setHeadpic(byId.getAvatar()); + 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()); + } + + }); + 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 queryWrapper = QueryGenerator.initQueryWrapper(task, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + queryWrapper.like("manager_users", userId); + queryWrapper.like("work_status", 3); + queryWrapper.orderByDesc("update_time"); + IPage 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()); } }); diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java index c7f4af9..e75d257 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java @@ -97,6 +97,7 @@ public class Task implements Serializable { */ @Excel(name = "模块id", width = 15) @ApiModelProperty(value = "模块id") + @Dict(dictTable = "modulex", dicText = "module_name",dicCode = "id") private java.lang.String moduleId; /** * 功能id diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/ITaskService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/ITaskService.java index 52aae34..1cc1fb4 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/ITaskService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/ITaskService.java @@ -2,8 +2,11 @@ package org.jeecg.modules.task.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.task.entity.Task; +import java.util.List; + /** * @Description: 任务管理 * @Author: jeecg-boot @@ -26,4 +29,6 @@ public interface ITaskService extends IService { Result fabu(String id); String fillTaskName(String projectId, String typeId); + +// List UserIdByUserName(String userName); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/impl/TaskServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/impl/TaskServiceImpl.java index 2a63008..ec6f254 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/impl/TaskServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/impl/TaskServiceImpl.java @@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.projectx.entity.Projectx; 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.mapper.TaskMapper; import org.jeecg.modules.task.service.ITaskService; @@ -35,7 +37,10 @@ public class TaskServiceImpl extends ServiceImpl implements IT @Resource private ITaskTypeService iTaskTypeService; +// @Resource +// private ISysUserService sysUserService; /** + * 责任人回显 * 责任人回显 */ @Override @@ -145,4 +150,14 @@ public class TaskServiceImpl extends ServiceImpl implements IT String fillName = taskType.getTypeName() + "-" + projectx.getProjectName(); return fillName; } +// @Override +// public List UserIdByUserName(String userName) { +// if (userName==null) +// return null; +// LambdaQueryWrapper wrapper=new LambdaQueryWrapper<>(); +// if(userName.startsWith("*")&&userName.endsWith("*")) +// userName = userName.substring(1, userName.length() - 1); +// wrapper.eq(SysUser::getUsername,userName); +// return sysUserService.list(wrapper); +// } } From 04107fa6592a165e02fa2e9714d3738a96effc20 Mon Sep 17 00:00:00 2001 From: lijinyu <3023846734@qq.com> Date: Wed, 19 Jul 2023 17:02:14 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jeecg-boot/jeecg-boot-module-system/pom.xml | 7 ++ .../demo/functionx/entity/FunctionxTest.java | 5 -- .../impl/FunctionXTestServiceImpl.java | 29 +++---- .../modulex/entity/ModulexTemplate.java | 13 +-- .../modulex/service/IModulexService.java | 1 + .../service/impl/ModulexServiceImpl.java | 81 ++++++++++++++----- 6 files changed, 81 insertions(+), 55 deletions(-) diff --git a/jeecg-boot/jeecg-boot-module-system/pom.xml b/jeecg-boot/jeecg-boot-module-system/pom.xml index 47eb4bf..157365a 100644 --- a/jeecg-boot/jeecg-boot-module-system/pom.xml +++ b/jeecg-boot/jeecg-boot-module-system/pom.xml @@ -110,6 +110,13 @@ 3.17 + + + com.belerweb + pinyin4j + 2.5.1 + + org.jeecgframework.boot jeecg-boot-module-cms diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/entity/FunctionxTest.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/entity/FunctionxTest.java index 7ac0734..daa02f1 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/entity/FunctionxTest.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/entity/FunctionxTest.java @@ -52,11 +52,6 @@ public class FunctionxTest implements Serializable { */ private String pmDescribe; - /** - * 分析图 - */ - private String diagrams; - /** * 用户角色 */ diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionXTestServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionXTestServiceImpl.java index 3d0031b..b11e5fb 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionXTestServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionXTestServiceImpl.java @@ -101,19 +101,18 @@ public class FunctionXTestServiceImpl extends ServiceImpl queryWrapperUser = new LambdaQueryWrapper<>(); queryWrapperUser.eq(ProjectUserRole::getUserRole,userRole); // 是否匹配项目id? diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/ModulexTemplate.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/ModulexTemplate.java index 328efab..9cfca17 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/ModulexTemplate.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/ModulexTemplate.java @@ -171,18 +171,7 @@ public class ModulexTemplate implements Serializable { @ApiModelProperty(value = "关联实体") @Dict(dictTable = "tablex", dicText = "table_name", dicCode = "id") 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 diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java index 485d49d..ab443a0 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java @@ -42,4 +42,5 @@ public interface IModulexService extends IService { List exportXlslist(HttpServletRequest request, String selections,Modulex modulex); Result importExcel(MultipartFile file) throws Exception; + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java index 5f596a7..d941267 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java @@ -4,6 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.api.R; 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.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; @@ -479,12 +484,6 @@ public class ModulexServiceImpl extends ServiceImpl impl modulexVo.setRelatedBean(value); break; case 16: - modulexVo.setPrototypes(value); - break; - case 17: - modulexVo.setDiagrams(value); - break; - case 18: if (value == null || value == "") { message.put("isVisible", "false"); webSocketUtils.sendMessage(loginUser.getId(), message); @@ -492,7 +491,7 @@ public class ModulexServiceImpl extends ServiceImpl impl } modulexVo.setStatus(value); break; - case 19: + case 17: if (value == null || value == "") { message.put("isVisible", "false"); webSocketUtils.sendMessage(loginUser.getId(), message); @@ -500,7 +499,7 @@ public class ModulexServiceImpl extends ServiceImpl impl } modulexVo.setVerisonStatus(value); break; - case 20: + case 18: if (value == null || value == "") { message.put("isVisible", "false"); webSocketUtils.sendMessage(loginUser.getId(), message); @@ -621,6 +620,23 @@ public class ModulexServiceImpl extends ServiceImpl impl webSocketUtils.sendMessage(loginUser.getId(), message); return Result.error("导入失败,模块编码不能为空或者模块编码过长"); } + String modulecode = null; + LambdaQueryWrapper 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); String pmDescribe = modulexTemplate.getPmDescribe(); if(StringUtils.isBlank(pmDescribe)){ @@ -631,20 +647,23 @@ public class ModulexServiceImpl extends ServiceImpl impl modulex.setManagerUsers(null); }else { LambdaQueryWrapper sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); - sysUserLambdaQueryWrapper.eq(SysUser::getUsername,managerUsers); - SysUser iSysUserServiceOne = iSysUserService.getOne(sysUserLambdaQueryWrapper); + String[] split = managerUsers.split(","); +// sysUserLambdaQueryWrapper.eq(SysUser::getUsername,managerUsers); + sysUserLambdaQueryWrapper.in(SysUser::getUsername,split); + List iSysUserServiceOne = iSysUserService.list(sysUserLambdaQueryWrapper); if(iSysUserServiceOne==null){ message.put("isVisible", "false"); webSocketUtils.sendMessage(loginUser.getId(), message); return Result.error("导入失败,责任人信息查询不到"); }else { - String id = iSysUserServiceOne.getId(); - if (id == null) { + List list = iSysUserServiceOne.stream().map(SysUser::getId).collect(Collectors.toList()); +// String id = iSysUserServiceOne.getId(); + if (list == null) { message.put("isVisible", "false"); webSocketUtils.sendMessage(loginUser.getId(), message); return Result.error("导入失败,责任人信息查询不到"); } - modulex.setManagerUsers(id); + modulex.setManagerUsers(String.valueOf(list)); } } String workLevel = modulexTemplate.getWorkLevel(); @@ -784,14 +803,6 @@ public class ModulexServiceImpl extends ServiceImpl impl 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(); if(StringUtils.isBlank(status)){ message.put("isVisible", "false"); @@ -1179,4 +1190,32 @@ public class ModulexServiceImpl extends ServiceImpl impl moduleFunctionRule.setVerison(x.getVerison()); 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; + } + + + } From 200949e02474208c6744107485e5e8ed68c32016 Mon Sep 17 00:00:00 2001 From: shiji <1913712590@qq.com> Date: Wed, 19 Jul 2023 17:11:04 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A8=A1=E5=9D=97=20?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=95=B0=E6=8D=AE=E5=AD=97=E5=85=B8=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ant-design-vue-jeecg/src/views/task/TaskList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ant-design-vue-jeecg/src/views/task/TaskList.vue b/ant-design-vue-jeecg/src/views/task/TaskList.vue index b5762f5..1e4b209 100644 --- a/ant-design-vue-jeecg/src/views/task/TaskList.vue +++ b/ant-design-vue-jeecg/src/views/task/TaskList.vue @@ -53,7 +53,7 @@ From fd7039315ed7899d2b2be7cc28c98caa467ad1ff Mon Sep 17 00:00:00 2001 From: shiji <1913712590@qq.com> Date: Wed, 19 Jul 2023 17:11:53 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A8=A1=E5=9D=97=20?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=95=B0=E6=8D=AE=E5=AD=97=E5=85=B8=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ant-design-vue-jeecg/src/views/task/TaskList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ant-design-vue-jeecg/src/views/task/TaskList.vue b/ant-design-vue-jeecg/src/views/task/TaskList.vue index 1e4b209..ed99163 100644 --- a/ant-design-vue-jeecg/src/views/task/TaskList.vue +++ b/ant-design-vue-jeecg/src/views/task/TaskList.vue @@ -53,7 +53,7 @@ From 0258076ffb6bb8d5f07111d06bf4870d2f663c1c Mon Sep 17 00:00:00 2001 From: zjh <10930829+zheng-jinhao1209@user.noreply.gitee.com> Date: Wed, 19 Jul 2023 17:48:11 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E5=AF=BC=E5=87=BAbug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/bugx/controller/BugxController.java | 103 +++++++++++-- .../jeecg/modules/demo/bugx/entity/Bugx.java | 9 +- .../demo/bugx/entity/BugxExportDto.java | 143 ++++++++++++++++++ .../modules/demo/bugx/mapper/BugxMapper.java | 2 +- .../demo/bugx/service/IBugxService.java | 1 + .../bugx/service/impl/BugxServiceImpl.java | 1 + 6 files changed, 241 insertions(+), 18 deletions(-) create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/entity/BugxExportDto.java diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/controller/BugxController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/controller/BugxController.java index 5145640..fb57e9c 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/controller/BugxController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/controller/BugxController.java @@ -1,23 +1,19 @@ package org.jeecg.modules.demo.bugx.controller; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.beanutils.PropertyUtils; import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; 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 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.projectx.entity.Projectx; 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.entity.ExportParams; -import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; 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 com.alibaba.fastjson.JSON; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.jeecg.common.aspect.annotation.AutoLog; @@ -279,7 +271,92 @@ public class BugxController extends JeecgController { */ @RequestMapping(value = "/exportXls") 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 clazz, String title) { + // Step.1 组装查询条件 + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(bugx, request.getParameterMap()); + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + + String getRealname = "佚名"; + if (sysUser != null) { + getRealname = sysUser.getRealname(); + } + + // Step.2 获取导出数据 + List pageList = bugxService.list(queryWrapper); + List exportList = null; + List 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 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; + } } /** diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/entity/Bugx.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/entity/Bugx.java index abdc0dc..3f77da5 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/entity/Bugx.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/entity/Bugx.java @@ -63,23 +63,24 @@ public class Bugx implements Serializable { /**项目id*/ @Excel(name = "项目id", width = 15) @ApiModelProperty(value = "项目id") - @Dict(dicText = "project_code",dicCode = "id",dictTable = "projectx") + @Dict(dicCode = "id",dicText = "project_code",dictTable = "projectx") private java.lang.String projectId; /**对应模块id*/ @Excel(name = "对应模块id", width = 15) @ApiModelProperty(value = "对应模块id") - @Dict(dicText = "module_code",dicCode = "id",dictTable = "modulex") + @Dict(dicCode = "id",dicText = "module_code",dictTable = "modulex") private java.lang.String moduleId; /**对应功能id*/ @Excel(name = "对应功能id", width = 15) @ApiModelProperty(value = "对应功能id") - @Dict(dicText = "function_code",dicCode = "id",dictTable = "functionx") + @Dict(dicCode = "id",dicText = "function_code",dictTable = "functionx") private java.lang.String functionId; /**对应规则id*/ @Excel(name = "对应规则id", width = 15) @ApiModelProperty(value = "对应规则id") - @Dict(dicText = "rule_code",dicCode = "id",dictTable = "rulex") + @Dict(dicCode = "id",dicText = "rule_code",dictTable = "rulex") private java.lang.String ruleId; + /**BUG等级*/ @Excel(name = "BUG等级", width = 15) @ApiModelProperty(value = "BUG等级") diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/entity/BugxExportDto.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/entity/BugxExportDto.java new file mode 100644 index 0000000..ec953d5 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/entity/BugxExportDto.java @@ -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; +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/mapper/BugxMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/mapper/BugxMapper.java index 49d9b7a..dff4f73 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/mapper/BugxMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/mapper/BugxMapper.java @@ -1,12 +1,12 @@ package org.jeecg.modules.demo.bugx.mapper; import java.util.Date; -import java.util.List; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; import org.jeecg.modules.demo.bugx.entity.Bugx; +import org.jeecg.modules.demo.bugx.entity.BugxExportDto; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/IBugxService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/IBugxService.java index 2a173c9..2571cfe 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/IBugxService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/IBugxService.java @@ -2,6 +2,7 @@ package org.jeecg.modules.demo.bugx.service; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.demo.bugx.entity.Bugx; +import org.jeecg.modules.demo.bugx.entity.BugxExportDto; import com.baomidou.mybatisplus.extension.service.IService; /** diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/impl/BugxServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/impl/BugxServiceImpl.java index 52c2106..fa90f99 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/impl/BugxServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/bugx/service/impl/BugxServiceImpl.java @@ -2,6 +2,7 @@ package org.jeecg.modules.demo.bugx.service.impl; import org.jeecg.common.api.vo.Result; 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.service.IBugxService; import org.springframework.beans.factory.annotation.Autowired;