From cbed4629ca5d20b0b08eff0728a5da61ed008086 Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Wed, 22 May 2024 19:35:15 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF:=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8A=A5=E9=94=80=E5=8D=95=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=8A=A5=E9=94=80=E7=B1=BB=E5=88=AB=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=88=97=E5=AD=97=E6=AE=B5=E7=9A=84=E6=88=90=E6=9C=AC?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5=E7=9A=84=E5=80=BC=EF=BC=8C?= =?UTF-8?q?=E6=9D=A5=E5=86=B3=E5=AE=9A=E6=9C=AC=E5=88=97=E7=9A=84=E6=88=90?= =?UTF-8?q?=E6=9C=AC=E5=B0=8F=E7=B1=BB=E7=9A=84=E5=AD=97=E6=AE=B5=E7=9A=84?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E5=88=97=E8=A1=A8=E7=9A=84=E9=80=89=E9=A1=B9?= =?UTF-8?q?=EF=BC=8C=E6=9B=B4=E6=8D=A2=E6=9F=A5=E8=AF=A2=E8=AF=AD=E5=8F=A5?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E3=80=82=20=E6=96=B0=E5=A2=9E=E4=B8=80=E4=B8=AA=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=B8=BA=E6=88=90=E6=9C=AC=E7=B1=BB=E5=9E=8B=E5=AD=97?= =?UTF-8?q?=E6=AE=B5code=E5=80=BC=E4=B8=BA'costType',=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=A0=B9=E6=8D=AE=E6=AD=A4code=E5=9C=A8sys?= =?UTF-8?q?=5Factegory=E8=A1=A8=E4=B8=AD=E7=9A=84=E5=AD=90=E9=A1=B9?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E7=9A=84=E6=8E=A5=E5=8F=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/system/CategoryController.java | 25 +++ .../BaseExpenseAccountController.java | 10 +- .../SysCustomerQuoteController.java | 38 +++- .../controller/SysSalesOrderController.java | 20 ++- .../system/domain/BaseExpenseAccount.java | 12 ++ .../system/BaseExpenseAccountMapper.xml | 12 +- .../templates/system/baseExpense/add.html | 118 ++++++++++--- .../system/baseExpense/baseExpense.html | 8 +- .../templates/system/baseExpense/edit.html | 162 +++++++++++++----- .../baseExpenseChild/baseExpenseChild.html | 89 +++------- 10 files changed, 337 insertions(+), 157 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/system/CategoryController.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/CategoryController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/CategoryController.java new file mode 100644 index 00000000..948207e5 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/CategoryController.java @@ -0,0 +1,25 @@ +package com.ruoyi.system; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.framework.web.service.CategoryService; +import com.ruoyi.system.domain.SysCategory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; +import java.util.Map; + + +@Controller +@RequestMapping("/system/category") +public class CategoryController extends BaseController { + @Autowired + private CategoryService categoryService; + @RequestMapping("getChildCode") + @ResponseBody + public List getChildCode(String code) { + return categoryService.getChildByCode(code); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseExpenseAccountController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseExpenseAccountController.java index 2c0fae8e..5473c0d6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseExpenseAccountController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseExpenseAccountController.java @@ -5,11 +5,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.domain.BaseExpenseAccount; @@ -84,7 +80,7 @@ public class BaseExpenseAccountController extends BaseController @Log(title = "报销单", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody - public AjaxResult addSave(BaseExpenseAccount baseExpenseAccount) + public AjaxResult addSave(@RequestBody BaseExpenseAccount baseExpenseAccount) { return toAjax(baseExpenseAccountService.insertBaseExpenseAccount(baseExpenseAccount)); } @@ -107,7 +103,7 @@ public class BaseExpenseAccountController extends BaseController @Log(title = "报销单", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody - public AjaxResult editSave(BaseExpenseAccount baseExpenseAccount) + public AjaxResult editSave(@RequestBody BaseExpenseAccount baseExpenseAccount) { return toAjax(baseExpenseAccountService.updateBaseExpenseAccount(baseExpenseAccount)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java index 55169ac4..4a5154bb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java @@ -38,6 +38,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Set; +import java.util.stream.Collectors; /** * 客户报价信息Controller @@ -68,6 +69,8 @@ public class SysCustomerQuoteController extends BaseController @Autowired private RuntimeService runtimeService; + @Autowired + private ISysUserService sysUserService; @Autowired private IProcessService processService; @@ -90,16 +93,33 @@ public class SysCustomerQuoteController extends BaseController @ResponseBody public TableDataInfo list(SysCustomerQuoteVo sysCustomerQuoteVo) { - SysUser curUser = ShiroUtils.getSysUser(); - Long userId = curUser.getUserId(); - Set roleKeys = roleService.selectRoleKeys(userId); - // 业务员角色只能看到自己创建的数据 - if(roleKeys.contains("ywyRole")){ - sysCustomerQuoteVo.setCreateBy(curUser.getLoginName()); + try { + SysUser curUser = ShiroUtils.getSysUser(); + Long userId = curUser.getUserId(); + Set roleKeys = roleService.selectRoleKeys(userId); + startPage(); + List list = sysCustomerQuoteService.selectSysCustomerQuoteList(sysCustomerQuoteVo); + String loginName = ShiroUtils.getLoginName(); + List sysUserlist = sysUserService.selectRoleToUserList("ywyRole"); + sysUserlist.add(curUser); + if (roleKeys.contains("ywjlRole")) { + List findUser = sysUserlist.stream().filter(item -> (item.getDeptId().equals(curUser.getDeptId()))).collect(Collectors.toList()); + Set user = findUser.stream().map(SysUser::getLoginName).collect(Collectors.toSet()); + startPage(); + List list2 = list.stream().filter(item -> user.contains(item.getApplyUser())).collect(Collectors.toList()); + return getDataTable(list2); + } + // 业务员角色只能看到自己创建的数据 + if (roleKeys.contains("ywyRole")) { + sysCustomerQuoteVo.setApplyUser(curUser.getLoginName()); + startPage(); + List list2 = sysCustomerQuoteService.selectSysCustomerQuoteList(sysCustomerQuoteVo); + return getDataTable(list2); + } + return getDataTable(list); + }catch(NullPointerException e){ + throw new NullPointerException("当前用户没有申请客户报价信息"); } - startPage(); - List list = sysCustomerQuoteService.selectSysCustomerQuoteList(sysCustomerQuoteVo); - return getDataTable(list); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java index 0effb596..3b512cf2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java @@ -25,6 +25,7 @@ import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.exportDto.SysSalesFinishDto; import com.ruoyi.system.domain.exportDto.SysSalesOrderDto; +import com.ruoyi.system.mapper.SysSalesOrderMapper; import com.ruoyi.system.service.*; import org.activiti.engine.RuntimeService; import org.activiti.engine.TaskService; @@ -85,6 +86,9 @@ public class SysSalesOrderController extends BaseController @Autowired private ISysMakeOrderService sysMakeOrderService; + @Autowired + private SysSalesOrderMapper sysSalesOrderMapper; + @RequiresPermissions("system:salesOrder:view") @GetMapping() public String salesOrder(ModelMap mmap) @@ -110,6 +114,14 @@ public class SysSalesOrderController extends BaseController Set roleKeys = roleService.selectRoleKeys(userId); List sysUserlist = sysUserService.selectRoleToUserList("ywyRole"); sysUserlist.add(curUser); + if (curUser.getUserName().contains("admin")) { + SysSalesOrderVo sysSalesOrderVo2 = new SysSalesOrderVo(); + startPage(); + List list2 = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo2); + return getDataTable(list2); + } + //如果主管审批,查看当前自己部门的审核 + //如果经理审计需要查询自己部门下所有业务员的提交的订单,以及自身的提交的订单 if (roleKeys.contains("ywjlRole")) { List findUser = sysUserlist.stream().filter(item -> (item.getDeptId().equals(curUser.getDeptId()))).collect(Collectors.toList()); Set user = findUser.stream().map(SysUser::getLoginName).collect(Collectors.toSet()); @@ -117,12 +129,12 @@ public class SysSalesOrderController extends BaseController List list2 = list.stream().filter(item -> user.contains(item.getApplyUser())).collect(Collectors.toList()); return getDataTable(list2); } - // 业务员角色只能看到自己创建的数据 + // 业务员角色只能看到自己创建的数据 if (roleKeys.contains("ywyRole")) { - sysSalesOrderVo.setApplyUser(curUser.getUserName()); + sysSalesOrderVo.setApplyUser(curUser.getLoginName()); startPage(); - list = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo); - return getDataTable(list); + List list2 = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo); + return getDataTable(list2); } return getDataTable(list); }catch(NullPointerException e){ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/BaseExpenseAccount.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/BaseExpenseAccount.java index 93987c47..bedd7f70 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/BaseExpenseAccount.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/BaseExpenseAccount.java @@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; +import java.util.List; + /** * 报销单对象 base_emp_expense_account * @@ -80,6 +82,16 @@ public class BaseExpenseAccount extends BaseEntity private String del_flag; + private List expenseAccountChildList; + + public List getExpenseAccountChildList() { + return expenseAccountChildList; + } + + public void setExpenseAccountChildList(List expenseAccountChildList) { + this.expenseAccountChildList = expenseAccountChildList; + } + public String getDel_flag() { return del_flag; } diff --git a/ruoyi-admin/src/main/resources/mapper/system/BaseExpenseAccountMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/BaseExpenseAccountMapper.xml index 3ddc8565..13b44b1e 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/BaseExpenseAccountMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/BaseExpenseAccountMapper.xml @@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into base_emp_expense_account + insert into base_expense_account audit_status, manager_audit_status, @@ -103,7 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - update base_emp_expense_account + update base_expense_account audit_status = #{auditStatus}, manager_audit_status = #{managerAuditStatus}, @@ -130,22 +130,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from base_emp_expense_account where expense_id = #{expenseId} + delete from base_expense_account where expense_id = #{expenseId} - delete from base_emp_expense_account where expense_id in + delete from base_expense_account where expense_id in #{expenseId} - update base_emp_expense_account set del_flag = '1' where expense_id = #{expenseId} + update base_expense_account set del_flag = '1' where expense_id = #{expenseId} - update base_emp_expense_account set del_flag = '0' where expense_id = #{expenseId} + update base_expense_account set del_flag = '0' where expense_id = #{expenseId} \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/baseExpense/add.html b/ruoyi-admin/src/main/resources/templates/system/baseExpense/add.html index bfa9b111..c15ed92d 100644 --- a/ruoyi-admin/src/main/resources/templates/system/baseExpense/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/baseExpense/add.html @@ -90,12 +90,15 @@ \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/baseExpense/baseExpense.html b/ruoyi-admin/src/main/resources/templates/system/baseExpense/baseExpense.html index a7dfff00..35d9636c 100644 --- a/ruoyi-admin/src/main/resources/templates/system/baseExpense/baseExpense.html +++ b/ruoyi-admin/src/main/resources/templates/system/baseExpense/baseExpense.html @@ -54,13 +54,14 @@
  • - +
  • -
  • @@ -99,13 +100,14 @@ \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/baseExpenseChild/baseExpenseChild.html b/ruoyi-admin/src/main/resources/templates/system/baseExpenseChild/baseExpenseChild.html index 4022b236..807a99b6 100644 --- a/ruoyi-admin/src/main/resources/templates/system/baseExpenseChild/baseExpenseChild.html +++ b/ruoyi-admin/src/main/resources/templates/system/baseExpenseChild/baseExpenseChild.html @@ -17,8 +17,7 @@
  • @@ -92,69 +91,33 @@ restoreUrl: prefix + "/restore/{id}", exportUrl: prefix + "/export", modalName: "报销单分类子", - columns: [{ - checkbox: true - }, - { - title: '报销单分项子表', - field: 'expenseChildId', - visible: false - }, - { - title: '关联报销单号', - field: 'quoteId', - }, - { - title: '成本类型', - field: 'cost type', - }, - { - title: '成本小类', - field: 'costSmallType', - }, - { - title: '用途', - field: 'purpose', - }, - { - title: '金额', - field: 'amounts', - }, - { - title: '报销时间', - field: 'expenseTime', - }, - { - title: '出差单号', - field: 'evectionCode', - }, - { - title: '采购单号', - field: 'purcahseCode', - }, - { - title: '委外单号', - field: 'outsourceCode', - }, - { - title: '备注', - field: 'remark', - }, - { - title: '操作', - align: 'center', - formatter: function(value, row, index) { - var actions = []; - actions.push('编辑 '); - actions.push('删除 '); - if(row.delFlag == '0'){ - actions.push('作废 '); - }else{ - actions.push('恢复 '); + columns: [ + {checkbox: true}, + {title: '报销单分项子表',field: 'expenseChildId',visible: false}, + {title: '关联报销单号',field: 'quoteId',}, + {title: '成本类型',field: 'cosType',}, + {title: '成本小类',field: 'costSmallType',}, + {title: '用途',field: 'purpose',}, + {title: '金额',field: 'amounts',}, + {title: '报销时间',field: 'expenseTime',}, + {title: '出差单号',field: 'evectionCode',}, + {title: '采购单号',field: 'purcahseCode',}, + {title: '委外单号',field: 'outsourceCode',}, + {title: '备注',field: 'remark',}, + {title: '操作',align: 'center', + formatter: function(value, row, index) { + var actions = []; + actions.push('编辑 '); + actions.push('删除 '); + if(row.delFlag == '0'){ + actions.push('作废 '); + }else{ + actions.push('恢复 '); + } + return actions.join(''); } - return actions.join(''); } - }] + ] }; $.table.init(options); });