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