From 3f261b8279ada1bfea1d452095d0a730aefed886 Mon Sep 17 00:00:00 2001 From: username <1532322479@qq.com> Date: Wed, 5 Mar 2025 08:51:25 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E4=BF=AE=E6=94=B9=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bs/cm/controller/CmAttachController.java | 219 ++++++++++++++++++ .../main/java/com/bs/cm/domain/CmAttach.java | 95 ++++++++ .../java/com/bs/cm/mapper/CmAttachMapper.java | 14 ++ .../com/bs/cm/service/ICmAttachService.java | 14 ++ .../cm/service/impl/CmAttachServiceImpl.java | 19 ++ .../ct/controller/CtTaskInfoController.java | 19 ++ .../java/com/bs/ct/domain/CtTaskInfo.java | 5 +- .../controller/common/CommonController.java | 43 +++- .../resources/mapper/cm/CmAttachMapper.xml | 7 + bs-ui/package.json | 2 + .../send/other-task/components/EditDialog.vue | 22 +- .../other-task/components/RemarkDialog.vue | 4 +- 12 files changed, 446 insertions(+), 17 deletions(-) create mode 100644 bs-admin/src/main/java/com/bs/cm/controller/CmAttachController.java create mode 100644 bs-admin/src/main/java/com/bs/cm/domain/CmAttach.java create mode 100644 bs-admin/src/main/java/com/bs/cm/mapper/CmAttachMapper.java create mode 100644 bs-admin/src/main/java/com/bs/cm/service/ICmAttachService.java create mode 100644 bs-admin/src/main/java/com/bs/cm/service/impl/CmAttachServiceImpl.java create mode 100644 bs-admin/src/main/resources/mapper/cm/CmAttachMapper.xml diff --git a/bs-admin/src/main/java/com/bs/cm/controller/CmAttachController.java b/bs-admin/src/main/java/com/bs/cm/controller/CmAttachController.java new file mode 100644 index 0000000..5261510 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/cm/controller/CmAttachController.java @@ -0,0 +1,219 @@ +package com.bs.cm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.bs.common.annotation.Log; +import com.bs.common.core.controller.BaseController; +import com.bs.common.core.domain.AjaxResult; +import com.bs.common.core.page.TableDataInfo; +import com.bs.common.enums.BusinessType; +import com.bs.common.utils.poi.ExcelUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.apache.commons.lang3.StringUtils; +import com.bs.cm.domain.CmAttach; +import com.bs.cm.service.ICmAttachService; +import javax.annotation.Resource; + +/** + * 附近信息Controller + * + * @author bs + * @date 2025-03-04 + */ +@Api(tags = "附近信息") +@RestController +@RequestMapping("/cm/attach") +public class CmAttachController extends BaseController { + @Resource + private ICmAttachService cmAttachService; + + /** + * 分页查询附近信息列表 + */ + @ApiOperation("分页查询附近信息列表") + @GetMapping("/pageList") + public TableDataInfo pageList(CmAttach cmAttach) { + startPage(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,cmAttach); + List list = cmAttachService.list(queryWrapper); + return getDataTable(list); + } + + /** + * 查询附近信息列表 + */ + @ApiOperation("查询附近信息列表") + @GetMapping("/list") + public AjaxResult list(CmAttach cmAttach) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,cmAttach); + List list = cmAttachService.list(queryWrapper); + return success(list); + } + + /** + * 导出附近信息列表 + */ + @ApiOperation("导出附近信息列表") + @Log(title = "附近信息导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CmAttach cmAttach) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + condition(queryWrapper,cmAttach); + List list = cmAttachService.list(queryWrapper); + ExcelUtil util = new ExcelUtil(CmAttach. class); + util.exportExcel(response, list, "附近信息数据"); + } + + /** + * 获取附近信息详细信息 + */ + @ApiOperation("获取附近信息详细信息") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return success(cmAttachService.getById(id)); + } + + /** + * 新增附近信息 + */ + @ApiOperation("新增附近信息") + @Log(title = "附近信息新增", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CmAttach cmAttach) { + return toAjax(cmAttachService.save(cmAttach)); + } + + /** + * 修改附近信息 + */ + @ApiOperation("修改附近信息") + @Log(title = "附近信息修改", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody CmAttach cmAttach) { + return toAjax(cmAttachService.updateById(cmAttach)); + } + + /** + * 删除附近信息 + */ + @ApiOperation("删除附近信息") + @Log(title = "附近信息删除", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable List ids) { + return toAjax(cmAttachService.removeBatchByIds(ids)); + } + + /** + * 条件设置 + */ + private void condition (LambdaQueryWrapper queryWrapper,CmAttach cmAttach){ + + + //用户id + if(null != cmAttach.getId()){ + queryWrapper.eq(CmAttach::getId,cmAttach.getId()); + } + + //文件组id + if(StringUtils.isNotEmpty(cmAttach.getFileId())){ + queryWrapper.eq(CmAttach::getFileId,cmAttach.getFileId()); + } + + //文件排序 + if(null != cmAttach.getFileSort()){ + queryWrapper.eq(CmAttach::getFileSort,cmAttach.getFileSort()); + } + + //文件名称(编译后) + if(StringUtils.isNotEmpty(cmAttach.getAttachName())){ + queryWrapper.eq(CmAttach::getAttachName,cmAttach.getAttachName()); + } + + //文件类型 + if(StringUtils.isNotEmpty(cmAttach.getAttachFileType())){ + queryWrapper.eq(CmAttach::getAttachFileType,cmAttach.getAttachFileType()); + } + + //文件编码类型 + if(StringUtils.isNotEmpty(cmAttach.getAttachContentType())){ + queryWrapper.eq(CmAttach::getAttachContentType,cmAttach.getAttachContentType()); + } + + //文件大小 + if(null != cmAttach.getAttachFileSize()){ + queryWrapper.eq(CmAttach::getAttachFileSize,cmAttach.getAttachFileSize()); + } + + //文件路径 + if(StringUtils.isNotEmpty(cmAttach.getAttachFileUrl())){ + queryWrapper.eq(CmAttach::getAttachFileUrl,cmAttach.getAttachFileUrl()); + } + + //文件名(原始) + if(StringUtils.isNotEmpty(cmAttach.getOldName())){ + queryWrapper.eq(CmAttach::getOldName,cmAttach.getOldName()); + } + + //文件版本号 + if(StringUtils.isNotEmpty(cmAttach.getVersionNo())){ + queryWrapper.eq(CmAttach::getVersionNo,cmAttach.getVersionNo()); + } + + //创建部门 + if(null != cmAttach.getCreateDept()){ + queryWrapper.eq(CmAttach::getCreateDept,cmAttach.getCreateDept()); + } + + //创建人 + if(null != cmAttach.getCreateBy()){ + queryWrapper.eq(CmAttach::getCreateBy,cmAttach.getCreateBy()); + } + + //创建时间 + if(null != cmAttach.getCreateTime()){ + queryWrapper.eq(CmAttach::getCreateTime,cmAttach.getCreateTime()); + } + + //修改人 + if(null != cmAttach.getUpdateBy()){ + queryWrapper.eq(CmAttach::getUpdateBy,cmAttach.getUpdateBy()); + } + + //修改时间 + if(null != cmAttach.getUpdateTime()){ + queryWrapper.eq(CmAttach::getUpdateTime,cmAttach.getUpdateTime()); + } + + //备注 + if(StringUtils.isNotEmpty(cmAttach.getRemark())){ + queryWrapper.eq(CmAttach::getRemark,cmAttach.getRemark()); + } + + //删除标志(0代表存在 2代表删除) + if(StringUtils.isNotEmpty(cmAttach.getDelFlag())){ + queryWrapper.eq(CmAttach::getDelFlag,cmAttach.getDelFlag()); + } + + //${column.columnComment} + if(StringUtils.isNotEmpty(cmAttach.getTenantId())){ + queryWrapper.eq(CmAttach::getTenantId,cmAttach.getTenantId()); + } + + } + +} diff --git a/bs-admin/src/main/java/com/bs/cm/domain/CmAttach.java b/bs-admin/src/main/java/com/bs/cm/domain/CmAttach.java new file mode 100644 index 0000000..41ac940 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/cm/domain/CmAttach.java @@ -0,0 +1,95 @@ +package com.bs.cm.domain; + +import com.bs.common.annotation.Excel; +import com.bs.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +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 io.swagger.annotations.ApiModelProperty; + +/** + * 附近信息对象 cm_attach + * + * @author bs + * @date 2025-03-04 + */ +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("cm_attach") +@Data +public class CmAttach extends BaseEntity{ + private static final long serialVersionUID = 1L; + + /** 用户id */ + @TableId(value = "id",type = IdType.AUTO) + @ApiModelProperty(value = "用户id") + private Long id; + + /** 文件组id */ + + @Excel(name = "文件组id") + @ApiModelProperty(value = "文件组id") + private String fileId; + + /** 文件排序 */ + + @Excel(name = "文件排序") + @ApiModelProperty(value = "文件排序") + private Long fileSort; + + /** 文件名称(编译后) */ + + @Excel(name = "文件名称", readConverterExp = "编=译后") + @ApiModelProperty(value = "文件名称(编译后)") + private String attachName; + + /** 文件类型 */ + + @Excel(name = "文件类型") + @ApiModelProperty(value = "文件类型") + private String attachFileType; + + /** 文件编码类型 */ + + @Excel(name = "文件编码类型") + @ApiModelProperty(value = "文件编码类型") + private String attachContentType; + + /** 文件大小 */ + + @Excel(name = "文件大小") + @ApiModelProperty(value = "文件大小") + private Long attachFileSize; + + /** 文件路径 */ + + @Excel(name = "文件路径") + @ApiModelProperty(value = "文件路径") + private String attachFileUrl; + + /** 文件名(原始) */ + + @Excel(name = "文件名", readConverterExp = "原=始") + @ApiModelProperty(value = "文件名(原始)") + private String oldName; + + /** 文件版本号 */ + + @Excel(name = "文件版本号") + @ApiModelProperty(value = "文件版本号") + private String versionNo; + + /** 备注 */ + + @Excel(name = "备注") + @ApiModelProperty(value = "备注") + private String remark; + + + + +} diff --git a/bs-admin/src/main/java/com/bs/cm/mapper/CmAttachMapper.java b/bs-admin/src/main/java/com/bs/cm/mapper/CmAttachMapper.java new file mode 100644 index 0000000..f409167 --- /dev/null +++ b/bs-admin/src/main/java/com/bs/cm/mapper/CmAttachMapper.java @@ -0,0 +1,14 @@ +package com.bs.cm.mapper; + +import com.bs.common.mybatis.mapper.BaseMapperX; +import com.bs.cm.domain.CmAttach; + +/** + * 附近信息Mapper接口 + * + * @author bs + * @date 2025-03-04 + */ +public interface CmAttachMapper extends BaseMapperX { + +} diff --git a/bs-admin/src/main/java/com/bs/cm/service/ICmAttachService.java b/bs-admin/src/main/java/com/bs/cm/service/ICmAttachService.java new file mode 100644 index 0000000..0ee47ca --- /dev/null +++ b/bs-admin/src/main/java/com/bs/cm/service/ICmAttachService.java @@ -0,0 +1,14 @@ +package com.bs.cm.service; + +import com.github.yulichang.base.MPJBaseService; +import com.bs.cm.domain.CmAttach; + +/** + * 附近信息Service接口 + * + * @author bs + * @date 2025-03-04 + */ +public interface ICmAttachService extends MPJBaseService{ + +} diff --git a/bs-admin/src/main/java/com/bs/cm/service/impl/CmAttachServiceImpl.java b/bs-admin/src/main/java/com/bs/cm/service/impl/CmAttachServiceImpl.java new file mode 100644 index 0000000..5e5caae --- /dev/null +++ b/bs-admin/src/main/java/com/bs/cm/service/impl/CmAttachServiceImpl.java @@ -0,0 +1,19 @@ +package com.bs.cm.service.impl; + +import com.bs.cm.mapper.CmAttachMapper; +import com.bs.cm.domain.CmAttach; +import com.bs.cm.service.ICmAttachService; +import com.github.yulichang.base.MPJBaseServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +/** + * 附近信息Service业务层处理 + * + * @author bs + * @date 2025-03-04 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class CmAttachServiceImpl extends MPJBaseServiceImpl implements ICmAttachService { + +} diff --git a/bs-admin/src/main/java/com/bs/ct/controller/CtTaskInfoController.java b/bs-admin/src/main/java/com/bs/ct/controller/CtTaskInfoController.java index ab50912..1467d61 100644 --- a/bs-admin/src/main/java/com/bs/ct/controller/CtTaskInfoController.java +++ b/bs-admin/src/main/java/com/bs/ct/controller/CtTaskInfoController.java @@ -4,6 +4,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.Random; import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; @@ -144,6 +145,13 @@ public class CtTaskInfoController extends BaseController { @Log(title = "任务信息新增", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody CtTaskInfo ctTaskInfo) { + Long newId = System.currentTimeMillis() + new Random().nextInt(1000); + ctTaskInfo.setId(newId); + List branchList = ctTaskInfo.getBranchList(); + for (CtTaskBranch sdTaskOtherBranch : branchList) { + sdTaskOtherBranch.setTaskId(ctTaskInfo.getId()); + ctTaskBranchService.saveOrUpdate(sdTaskOtherBranch); + } return toAjax(ctTaskInfoService.save(ctTaskInfo)); } @@ -154,6 +162,17 @@ public class CtTaskInfoController extends BaseController { @Log(title = "任务信息修改", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody CtTaskInfo ctTaskInfo) { + List branchList = ctTaskInfo.getBranchList(); + if (branchList != null && branchList.size() > 0) { + for (CtTaskBranch sdTaskOtherBranch : branchList) { + sdTaskOtherBranch.setTaskId(ctTaskInfo.getId()); + if (sdTaskOtherBranch.getId() == null) { + ctTaskBranchService.save(sdTaskOtherBranch); + } else { + ctTaskBranchService.updateById(sdTaskOtherBranch); + } + } + } return toAjax(ctTaskInfoService.updateById(ctTaskInfo)); } diff --git a/bs-admin/src/main/java/com/bs/ct/domain/CtTaskInfo.java b/bs-admin/src/main/java/com/bs/ct/domain/CtTaskInfo.java index 1d5fd7e..d9b613c 100644 --- a/bs-admin/src/main/java/com/bs/ct/domain/CtTaskInfo.java +++ b/bs-admin/src/main/java/com/bs/ct/domain/CtTaskInfo.java @@ -1,6 +1,8 @@ package com.bs.ct.domain; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import com.bs.common.annotation.Excel; import com.bs.common.core.domain.BaseEntity; @@ -146,6 +148,7 @@ public class CtTaskInfo extends BaseEntity{ private String remarks; - + @TableField(exist = false) + private List branchList; } diff --git a/bs-admin/src/main/java/com/bs/web/controller/common/CommonController.java b/bs-admin/src/main/java/com/bs/web/controller/common/CommonController.java index 2dfce22..32981ed 100644 --- a/bs-admin/src/main/java/com/bs/web/controller/common/CommonController.java +++ b/bs-admin/src/main/java/com/bs/web/controller/common/CommonController.java @@ -4,6 +4,10 @@ import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import com.bs.cm.domain.CmAttach; +import com.bs.cm.service.ICmAttachService; +import org.aspectj.util.FileUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -34,6 +38,9 @@ public class CommonController @Autowired private ServerConfig serverConfig; + @Autowired + private ICmAttachService cmAttachService; + private static final String FILE_DELIMETER = ","; @@ -73,7 +80,7 @@ public class CommonController * 通用上传请求(单个) */ @PostMapping("/upload") - public AjaxResult uploadFile(MultipartFile file) throws Exception + public AjaxResult uploadFile(MultipartFile file, String fileId) throws Exception { try { @@ -82,12 +89,34 @@ public class CommonController // 上传并返回新文件名称 String fileName = FileUploadUtils.upload(filePath, file); String url = serverConfig.getUrl() + fileName; - AjaxResult ajax = AjaxResult.success(); - ajax.put("url", url); - ajax.put("fileName", fileName); - ajax.put("newFileName", FileUtils.getName(fileName)); - ajax.put("originalFilename", file.getOriginalFilename()); - return ajax; + String newFileName = FileUtils.getName(fileName); + String originalFilename = file.getOriginalFilename(); + CmAttach cmAttach = new CmAttach(); + cmAttach.setFileId(fileId); + cmAttach.setFileSort(1L); + cmAttach.setAttachName(newFileName); + cmAttach.setAttachContentType(file.getContentType()); + cmAttach.setAttachFileSize(file.getSize()); +// String suffix = FileUtil.getExtensionName(originalFilename); +// String type = FileUtil.getFileType(suffix); +// cmAttach.setAttachFileType(type); + cmAttach.setAttachFileUrl(fileName); + cmAttach.setOldName(originalFilename); + cmAttach.setVersionNo("1"); + cmAttach.setRemark(""); + boolean save = cmAttachService.save(cmAttach); + if (save) { + Long id = cmAttach.getId(); + AjaxResult ajax = AjaxResult.success(); + ajax.put("url", url); + ajax.put("fileId", id); + ajax.put("fileName", fileName); + ajax.put("newFileName", newFileName); + ajax.put("cmAttach", cmAttach); + ajax.put("originalFilename", originalFilename); + return ajax; + } + return null; } catch (Exception e) { diff --git a/bs-admin/src/main/resources/mapper/cm/CmAttachMapper.xml b/bs-admin/src/main/resources/mapper/cm/CmAttachMapper.xml new file mode 100644 index 0000000..75deb16 --- /dev/null +++ b/bs-admin/src/main/resources/mapper/cm/CmAttachMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/bs-ui/package.json b/bs-ui/package.json index 46db073..1a24fea 100644 --- a/bs-ui/package.json +++ b/bs-ui/package.json @@ -66,6 +66,8 @@ "@vue/cli-service": "4.4.6", "babel-eslint": "10.1.0", "babel-plugin-dynamic-import-node": "2.3.3", + "browserslist": "^4.24.4", + "caniuse-lite": "^1.0.30001700", "chalk": "4.1.0", "compression-webpack-plugin": "5.0.2", "connect": "3.6.6", diff --git a/bs-ui/src/views/task-distribut/send/other-task/components/EditDialog.vue b/bs-ui/src/views/task-distribut/send/other-task/components/EditDialog.vue index 23a0b8c..71bbb4a 100644 --- a/bs-ui/src/views/task-distribut/send/other-task/components/EditDialog.vue +++ b/bs-ui/src/views/task-distribut/send/other-task/components/EditDialog.vue @@ -143,6 +143,8 @@ import { listBranch, } from "@/api/task/branch"; // import { getDateStr } from "@/utils/"; +import { getAllTree } from "@/api/system/dept"; + export default { components: { @@ -209,11 +211,18 @@ export default { } if (!this.dialogForm.branchCode) { let dept = null; - this.$store.getters.depts.forEach(v => { - if (!dept || dept.deptId > v.deptId) { - dept = v; - } - }); + // getAllTree().then((res) => { + // res.forEach(v => { + // if (!dept || dept.deptId > v.deptId) { + // dept = v; + // } + // }); + // }); + // this.$store.getters.forEach(v => { + // if (!dept || dept.deptId > v.deptId) { + // dept = v; + // } + // }); if (dept) { this.dialogForm.branchCode = dept.deptId; this.dialogForm.branchName = dept.deptName; @@ -264,7 +273,7 @@ export default { taskId: this.dialogForm.id, }) .then((res) => { - this.branchList = res || []; + this.branchList = res.data || []; this.branchLoading = false; }) .catch((e) => { @@ -272,7 +281,6 @@ export default { }); }, branchChange(val) { - console.log(this.branchList); val.forEach((item) => { if (this.branchList.some((v) => v.branchCode === item.deptId + "")) { return; diff --git a/bs-ui/src/views/task-distribut/send/other-task/components/RemarkDialog.vue b/bs-ui/src/views/task-distribut/send/other-task/components/RemarkDialog.vue index 2928c3a..60a0892 100644 --- a/bs-ui/src/views/task-distribut/send/other-task/components/RemarkDialog.vue +++ b/bs-ui/src/views/task-distribut/send/other-task/components/RemarkDialog.vue @@ -42,7 +42,7 @@