From 42981e0f60dd670985b1c3407e7c03b055e730a7 Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Wed, 15 May 2024 19:33:16 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E5=9F=BA=E7=A1=80=E8=B5=84=E6=96=99?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=EF=BC=9A=E8=AF=B7=E8=B4=AD=E5=8D=95=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E6=95=B0=E6=8D=AE=E4=BC=A0=E8=BE=93=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AD=90=E8=A1=A8=E6=95=B0=E6=8D=AE=E5=88=A4=E7=A9=BA?= =?UTF-8?q?=E5=A4=84=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseRequisitioningOrderController.java | 49 +++++++- .../BaseRequisitioningOrderServiceImpl.java | 7 +- .../templates/system/requisitioning/add.html | 113 ++++++++++++++---- 3 files changed, 144 insertions(+), 25 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseRequisitioningOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseRequisitioningOrderController.java index 7042cc77..045e0ba6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseRequisitioningOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseRequisitioningOrderController.java @@ -1,8 +1,22 @@ package com.ruoyi.system.controller; +import java.util.HashMap; import java.util.List; - +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import com.ruoyi.common.core.domain.entity.SysDept; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.exception.base.BaseException; +import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.system.domain.*; +import com.ruoyi.system.mapper.SysDeptMapper; +import com.ruoyi.system.mapper.SysPostMapper; +import com.ruoyi.system.mapper.SysUserPostMapper; import com.ruoyi.system.service.IBaseRequisitioningOrderChildService; +import com.ruoyi.system.service.ISysRoleService; +import com.ruoyi.system.service.ISysUserService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -14,13 +28,14 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.system.domain.BaseRequisitioningOrder; import com.ruoyi.system.service.IBaseRequisitioningOrderService; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; +import javax.management.relation.Role; + /** * 请购单Controller * @@ -39,6 +54,19 @@ public class BaseRequisitioningOrderController extends BaseController @Autowired private IBaseRequisitioningOrderChildService baseRequisitioningOrderChildService; + @Autowired + private ISysUserService sysUserService; + + @Autowired + private ISysRoleService sysRoleService; + + @Autowired + private SysPostMapper sysPostMapper; + + @Autowired + private SysDeptMapper sysDeptMapper; + + @RequiresPermissions("system:requisitioning:view") @GetMapping() public String requisitioning() @@ -156,5 +184,20 @@ public class BaseRequisitioningOrderController extends BaseController return toAjax(baseRequisitioningOrderService.restoreBaseRequisitioningOrderById(id)); } - + @GetMapping("/getEmpUserName") + @ResponseBody + public Map child(ModelMap mmap) throws Exception{ + Map result = new HashMap<>(); + SysUser curUser = ShiroUtils.getSysUser(); + String loginName = curUser.getLoginName(); + Long userId = curUser.getUserId(); + List sysPostList = sysPostMapper.selectPostsByUserId(userId); + SysDept dept = sysDeptMapper.selectDeptById(curUser.getDeptId()); + String postName = sysPostList.get(0).getPostName(); + String deptName = dept.getDeptName(); + result.put("userName",loginName); + result.put("deptName",deptName); + result.put("postName",postName); + return result; + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseRequisitioningOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseRequisitioningOrderServiceImpl.java index 22506a53..4e3c0637 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseRequisitioningOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseRequisitioningOrderServiceImpl.java @@ -94,10 +94,13 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr baseRequisitioningOrder.setUpdateTime(DateUtils.getNowDate()); String requisitioningCode = baseRequisitioningOrder.getRequisitioningCode(); baseRequisitioningOrderChildMapper.deleteBaseRequisitioningOrderChildByQuoteId(baseRequisitioningOrder.getRequisitioningCode()); - if (baseRequisitioningOrder.getBaseRequisitioningOrderChildList() != null) { - List childList = baseRequisitioningOrder.getBaseRequisitioningOrderChildList(); + List childList = baseRequisitioningOrder.getBaseRequisitioningOrderChildList(); + int childSize = childList.size(); + if (childSize > 0) { for (BaseRequisitioningOrderChild child: childList) { child.setQuoteId(requisitioningCode); + child.setCreateBy(loginName); + child.setCreateTime(DateUtils.getNowDate()); child.setUpdateBy(loginName); child.setUpdateTime(DateUtils.getNowDate()); baseRequisitioningOrderChildMapper.insertBaseRequisitioningOrderChild(child); diff --git a/ruoyi-admin/src/main/resources/templates/system/requisitioning/add.html b/ruoyi-admin/src/main/resources/templates/system/requisitioning/add.html index d7ef1ee2..fd260d8d 100644 --- a/ruoyi-admin/src/main/resources/templates/system/requisitioning/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/requisitioning/add.html @@ -2,30 +2,32 @@ + +
- +
- +
- +
- +
- +
- +
- +
@@ -48,11 +50,14 @@
+ + \ No newline at end of file