From be89c3458c56d6a4de0a00611b2547fbda495e81 Mon Sep 17 00:00:00 2001 From: zhc077 <565291854@qq.com> Date: Thu, 24 Oct 2024 10:27:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=B9=A6-=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=E5=8A=9F=E8=83=BD=E6=B7=BB=E5=8A=A0=2010.?= =?UTF-8?q?24?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/controller/ProjectController.java | 8 +++++ .../demo/project/dto/ProjectShenBaoDto.java | 4 +-- .../demo/project/service/IProjectService.java | 2 ++ .../service/impl/ProjectServiceImpl.java | 34 +++++++++++++++++++ .../kejigongguan/xiangmushu/JiBenXinXi.api.ts | 16 +++++++-- .../xiangmushu/JiBenXinXiDemo.vue | 8 ++--- 6 files changed, 63 insertions(+), 9 deletions(-) diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/controller/ProjectController.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/controller/ProjectController.java index 7df8593..6db773c 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/controller/ProjectController.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/controller/ProjectController.java @@ -141,6 +141,14 @@ public class ProjectController extends JeecgController return Result.OK("添加成功!"); } + @AutoLog(value = "新增项目审报") + @ApiOperation(value = "新增项目审报", notes = "新增项目审报") + @PostMapping(value = "/update4shenbao") + public Result update4shenbao(@RequestBody ProjectShenBaoDto dto) { + projectService.update4shenbao(dto); + return Result.OK("添加成功!"); + } + /** * 编辑 * diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/dto/ProjectShenBaoDto.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/dto/ProjectShenBaoDto.java index bd82e9b..8a583b0 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/dto/ProjectShenBaoDto.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/dto/ProjectShenBaoDto.java @@ -31,8 +31,8 @@ public class ProjectShenBaoDto implements Serializable { * 主键 */ // @TableId(type = IdType.ASSIGN_ID) -// @ApiModelProperty(value = "主键") -// private String id; + @ApiModelProperty(value = "主键") + private String id; /** * 创建人 */ diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/IProjectService.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/IProjectService.java index 6ed80e6..38b0837 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/IProjectService.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/IProjectService.java @@ -13,4 +13,6 @@ import com.baomidou.mybatisplus.extension.service.IService; public interface IProjectService extends IService { void save4shenbao(ProjectShenBaoDto dto); + + void update4shenbao(ProjectShenBaoDto dto); } diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/impl/ProjectServiceImpl.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/impl/ProjectServiceImpl.java index 0f208d3..55a4662 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/impl/ProjectServiceImpl.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/impl/ProjectServiceImpl.java @@ -1,6 +1,7 @@ package org.jeecg.modules.demo.project.service.impl; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.SecurityUtils; @@ -80,4 +81,37 @@ public class ProjectServiceImpl extends ServiceImpl impl departExt.setProjectId(project.getId()); this.iDepartExtService.save(departExt); } + + @Override + public void update4shenbao(ProjectShenBaoDto dto) { + log.info(">>> the 修改项目书-文 reqParams:{}", JSON.toJSONString(dto)); + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + iUserExtService.remove(new LambdaQueryWrapper().eq(UserExt::getProjectId,dto.getId())); + iDepartExtService.remove(new LambdaQueryWrapper().eq(DepartExt::getProjectId,dto.getId())); + +// SysDepart sysDepart = new SysDepart(); + DepartExt departExt = new DepartExt(); +// SysUser sysUser = new SysUser(); + UserExt userExt = new UserExt(); + Project project = new Project(); + + BeanUtils.copyProperties(dto, departExt); +// BeanUtils.copyProperties(dto, sysDepart); +// BeanUtils.copyProperties(dto, sysUser); + BeanUtils.copyProperties(dto, userExt); + BeanUtils.copyProperties(dto, project); + project.setSysOrgCode(loginUser.getOrgId()); + //负责人 +// project.setProjectCharger(loginUser.getId()); + this.updateById(project); + + userExt.setUserId(loginUser.getId()); + userExt.setProjectId(project.getId()); + this.iUserExtService.save(userExt); + + departExt.setDepartId(loginUser.getOrgId()); + departExt.setProjectId(project.getId()); + this.iDepartExtService.save(departExt); + } } diff --git a/jeecgboot-vue3/src/views/projectApplication/kejigongguan/xiangmushu/JiBenXinXi.api.ts b/jeecgboot-vue3/src/views/projectApplication/kejigongguan/xiangmushu/JiBenXinXi.api.ts index 824208f..20d7c2d 100644 --- a/jeecgboot-vue3/src/views/projectApplication/kejigongguan/xiangmushu/JiBenXinXi.api.ts +++ b/jeecgboot-vue3/src/views/projectApplication/kejigongguan/xiangmushu/JiBenXinXi.api.ts @@ -9,7 +9,8 @@ enum Api { userInfo = '/project/project/getUserInfo', departInfo = '/project/project/getDepartInfo', save = '/project/project/add', - shenbao = '/project/project/save4shenbao', + saveshenbao = '/project/project/save4shenbao', + updateshenbao = '/project/project/update4shenbao', edit = '/project/project/edit', deleteOne = '/project/project/delete', deleteBatch = '/project/project/deleteBatch', @@ -82,9 +83,18 @@ export const saveOrUpdate = (params, isUpdate) => { } /** - * 保存或者更新 + * 保存 * @param params */ export const save4shenbao = (params) => { - return defHttp.post({url: Api.shenbao, params}); + return defHttp.post({url: Api.saveshenbao, params}); +}; + + +/** + * 更新 + * @param params + */ +export const update4shenbao = (params) => { + return defHttp.post({url: Api.updateshenbao, params}); }; diff --git a/jeecgboot-vue3/src/views/projectApplication/kejigongguan/xiangmushu/JiBenXinXiDemo.vue b/jeecgboot-vue3/src/views/projectApplication/kejigongguan/xiangmushu/JiBenXinXiDemo.vue index 9472115..994a56d 100644 --- a/jeecgboot-vue3/src/views/projectApplication/kejigongguan/xiangmushu/JiBenXinXiDemo.vue +++ b/jeecgboot-vue3/src/views/projectApplication/kejigongguan/xiangmushu/JiBenXinXiDemo.vue @@ -23,7 +23,7 @@ import { PageWrapper } from '@/components/Page'; import { projectBaseInfoSchemas, userSchemas, departSchemas } from './JiBenXinXi'; import { Card } from 'ant-design-vue'; import {defHttp} from "@/utils/http/axios"; -import {save4shenbao,getProjectById,getUserByProjectId,getDepartByProjectId} from './JiBenXinXi.api'; +import {save4shenbao,update4shenbao,getProjectById,getUserByProjectId,getDepartByProjectId} from './JiBenXinXi.api'; import {useRoute, useRouter} from 'vue-router'; export default defineComponent({ name: 'FormHightPage', @@ -97,10 +97,10 @@ export default defineComponent({ try { Promise.all([validateProjectInfoForm(), formMethods.validate(), formMethods2.validate()]).then(function (results) { const params = {...results[0], ...results[1], ...results[2]} - console.log('results', JSON.stringify(params)); - save4shenbao(params); + params.id = route.query.id; + console.log('the update4shenbao req params:', JSON.stringify(params)); + update4shenbao(params); back(); - // go_projectList; }); } catch (error) {} };