Browse Source

[update]销售管理;销售订单划分角色权限,查询对象

dev
zhangsiqi 7 months ago
parent
commit
8bc9ebe04c
  1. 54
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java
  2. 2
      ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html
  3. 16
      ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html

54
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java

@ -46,6 +46,7 @@ import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
import static com.ruoyi.common.config.datasource.DynamicDataSourceContextHolder.log;
@ -100,16 +101,63 @@ public class SysSalesOrderController extends BaseController
@ResponseBody
public TableDataInfo list(SysSalesOrderVo sysSalesOrderVo)
{
startPage();
List<SysSalesOrderVo> list = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo);
try {
SysUser curUser = ShiroUtils.getSysUser();
Long userId = curUser.getUserId();
Set<String> roleKeys = roleService.selectRoleKeys(userId);
List<SysUser> sysUserlist = sysUserService.selectRoleToUserList("ywy");
if(roleKeys.contains("ywjlRole")){
sysUserlist = sysUserlist.stream().filter(item -> {
return item.getDept().getDeptId() == curUser.getDeptId();
}).collect(Collectors.toList());
List<SysUser> finalSysUserlist = sysUserlist;
finalSysUserlist.add(curUser);
startPage();
list = list.stream().filter(item -> {
for (SysUser sysUser : finalSysUserlist) {
if (sysUser.getLoginName().equals(item.getApplyUser())) {
return true;
}
}
return false;
}).collect(Collectors.toList());
return getDataTable(list);
}
if(roleKeys.contains("ywzgRole")){
sysUserlist = sysUserlist.stream().filter(item -> {
return item.getDept().getDeptId() == curUser.getDeptId();
}).collect(Collectors.toList());
List<SysUser> finalSysUserlist = sysUserlist;
finalSysUserlist.add(curUser);
startPage();
list = list.stream().filter(item -> {
for (SysUser sysUser : finalSysUserlist) {
if (sysUser.getLoginName().equals(item.getApplyUser())) {
return true;
}
}
return false;
}).collect(Collectors.toList());
return getDataTable(list);
}
// 业务员角色只能看到自己创建的数据
if(roleKeys.contains("ywyRole")){
sysSalesOrderVo.setApplyUser(curUser.getLoginName());
startPage();
list = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo);
return getDataTable(list);
}
if(!roleKeys.contains("ywzjRole") && !roleKeys.contains("ywzjRole") && !roleKeys.contains("ywzjRole")){
sysSalesOrderVo.setApplyUser(curUser.getLoginName());
startPage();
List<SysSalesOrderVo> list = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo);
list = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrderVo);
}
}catch (NullPointerException e){
throw new NullPointerException("当前用户没有申请客户资料");
}
return getDataTable(list);
}
@ -398,7 +446,7 @@ public class SysSalesOrderController extends BaseController
public AjaxResult complete(@PathVariable("taskId") String taskId,@RequestParam(value = "saveEntity", required = false) String saveEntity,
@RequestParam(value = "salesOrderChildList", required = false) String salesOrderChildList,
@ModelAttribute("preloadObj") SysSalesOrderVo sysSalesOrderVo,HttpServletRequest request){
System.out.println("taskId = " + taskId + ", saveEntity = " + saveEntity + ", salesOrderChildList = " + salesOrderChildList + ", sysSalesOrderVo = " + sysSalesOrderVo + ", request = " + request);
// System.out.println("taskId = " + taskId + ", saveEntity = " + saveEntity + ", salesOrderChildList = " + salesOrderChildList + ", sysSalesOrderVo = " + sysSalesOrderVo + ", request = " + request);
sysSalesOrderVo.setSysSalesOrderChildList(JSON.parseArray(salesOrderChildList, SysSalesOrderChild.class));
boolean saveEntityBoolean = BooleanUtils.toBoolean(saveEntity);
if (saveEntityBoolean) {

2
ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html

@ -640,6 +640,8 @@
});
$("input[name='taxRate']").val(data.taxRate);
$("input[name='confirmFax']").val(data.confirmTax);
$("select[name='customerContact']").val(data.customerContact).trigger('change');
$("select[name='customerDelivery']").val(data.customerDelivery).trigger('change');
$("#commonCurrency_add").val(data.commonCurrency).trigger('change');
commonCurrency = $("#commonCurrency_add option:selected").val();
console.log("commonCurrency",commonCurrency);

16
ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html

@ -102,7 +102,7 @@
<div class="form-group">
<label class="col-sm-3 control-label is-required">客户联系人:</label>
<div class="col-sm-8">
<input id="customerContact_edit" name="customerContact" th:field="*{customerContact}" class="form-control m-b" required readonly />
<input id="customerContact_edit" name="customerContact" th:field="*{customerContact}" class="form-control" required readonly />
</div>
</div>
<div class="form-group">
@ -175,7 +175,7 @@
<label class="col-sm-3 control-label is-required">报价币种:</label>
<div class="col-sm-8">
<select class="form-control" id="commonCurrency_edit" name="commonCurrency"
th:with="dictList=${@dict.getType('sys_common_currency')}" th:field="*{commonCurrency}" required>
th:with="dictList=${@dict.getType('sys_common_currency')}" th:field="*{commonCurrency}">
<option value="">请选择</option>
<option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
</select>
@ -191,23 +191,23 @@
<label class="col-sm-3 control-label is-required">是否含税:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_confirm_tax')}">
<input required type="radio" th:id="${'confirmTax_' + dict.dictCode}" th:field="*{confirmTax}"
name="confirmTax" th:value="${dict.dictValue}">
<input type="radio" th:id="${'confirmTax_' + dict.dictCode}" th:field="*{confirmTax}"
name="confirmTax" th:value="${dict.dictValue}" required>
<label th:for="${'confirmTax_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">税率:</label>
<label class="col-sm-3 control-label is-required">国内税率:</label>
<div class="col-sm-8">
<input name="taxRate" id="taxRate_edit" th:field="*{taxRate}" class="form-control" type="number" >
<input name="taxRate" id="taxRate_edit" th:field="*{taxRate}" class="form-control" type="number" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">是否开票:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_whether')}">
<input required type="radio" th:id="${'invoice_' + dict.dictCode}" th:field="*{invoice}"
<input type="radio" th:id="${'invoice_' + dict.dictCode}" th:field="*{invoice}" required
name="invoice" th:value="${dict.dictValue}">
<label th:for="${'invoice_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
@ -265,7 +265,7 @@
<div class="form-group">
<label class="col-sm-3 control-label is-required">业务员:</label>
<div class="col-sm-8">
<select name="businessMembers" class="form-control m-b" th:field="*{businessMembers}" required>
<select name="businessMembers" class="form-control m-b" th:field="*{businessMembers}">
</select>
</div>
</div>

Loading…
Cancel
Save