Browse Source

[update]客户资料:业务员回显,默认业务员字段不可选,且当前以当前用户做匹配业务组对象,包含业务经理,业务主管,业务员。

dev
zhangsiqi 7 months ago
parent
commit
204206bf24
  1. 18
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java
  3. 41
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java
  4. 9
      ruoyi-admin/src/main/resources/templates/system/customer/add.html
  5. 2
      ruoyi-admin/src/main/resources/templates/system/customer/detail.html
  6. 3
      ruoyi-admin/src/main/resources/templates/system/customer/edit.html
  7. 2
      ruoyi-admin/src/main/resources/templates/system/customer/taskModifyApply.html
  8. 2
      ruoyi-admin/src/main/resources/templates/system/customer/taskYwjlVerify.html
  9. 2
      ruoyi-admin/src/main/resources/templates/system/customer/taskYwzgVerify.html
  10. 3
      ruoyi-admin/src/main/resources/templates/system/customer/taskZozjVerify.html

18
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java

@ -103,11 +103,12 @@ public class SysCustomerController extends BaseController
{
SysUser curUser = ShiroUtils.getSysUser();
Long userId = curUser.getUserId();
Set<String> roleKeys = roleService.selectRoleKeys(userId);
// 业务员角色只能看到自己创建的数据
SysRole role = roleService.selectRoleById(curUser.getRoleId());
if (role.getRoleKey().equals("ywyRole")){
sysCustomerVo.setCreateBy(curUser.getUserName());
if (roleKeys.contains("ywyRole")) {
sysCustomerVo.setApplyUser(curUser.getLoginName());
}
startPage();
List<SysCustomerVo> list = sysCustomerService.selectSysCustomerList(sysCustomerVo);
return getDataTable(list);
@ -148,9 +149,11 @@ public class SysCustomerController extends BaseController
public AjaxResult addSave(SysCustomer sysCustomer)
{
//判断是否客户对象增加重复
SysUser sysUser = ShiroUtils.getSysUser();
SysCustomerVo sysCustomer1 = new SysCustomerVo();
sysCustomer1.setEnterpriseName(sysCustomer.getEnterpriseName());
sysCustomer1.setCustomerPurser(sysCustomer.getCustomerPurser());
List<SysPost> sysPostsList = sysPostService.selectPostsByUserId(sysUser.getUserId());
SysCustomerVo sysCustomerVo2 = sysCustomerService.selectSysCustomerByCustomer(sysCustomer1);
if(ObjectUtil.isNotNull(sysCustomerVo2)){
return AjaxResult.error("该客户已被其他业务员添加,"+" 客户名称 :" +
@ -158,9 +161,8 @@ public class SysCustomerController extends BaseController
"事业部 : "+ sysCustomerVo2.getCustomerPurser() +
" 业务员 : " + sysCustomerVo2.getBusinessMembers());
}
SysUser sysUser = ShiroUtils.getSysUser();
List<SysPost> sysPostsList = sysPostService.selectPostsByUserId(sysUser.getUserId());
sysPostsList.get(0).getPostName();
String operPeople = sysUser.getDept().getDeptName() + "/" + sysPostsList.get(0).getPostName()+"/" + sysUser.getUserName();
//通过用户获取部门信息
// 使用状态-否
@ -233,7 +235,7 @@ public class SysCustomerController extends BaseController
sysCustomerOper.setOperPeople(operPeople);
sysCustomerOper.setOperStatus(sysCustomer.getAuditStatus());
ProcessInstance processInstance = sysCustomerService.updateSysCustomerVo(sysCustomer);
if(processInstance != null){
if(processInstance.getId() != null){
sysCustomerOper.setOperStatus("0");
}else{
sysCustomerOper.setOperStatus("1");
@ -479,7 +481,7 @@ public class SysCustomerController extends BaseController
}
@RequestMapping("/getCustomerSelList")
@ResponseBody
public AjaxResult ggetCustomerQuoteSelList(@RequestParam(required = false,value = "keyword")String keyword){
public AjaxResult getCustomerQuoteSelList(@RequestParam(required = false,value = "keyword")String keyword){
SysCustomerVo sysCustomerVo = new SysCustomerVo();
sysCustomerVo.setKeyword(keyword);
return success(sysCustomerService.selectSysCustomerList(sysCustomerVo));

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

@ -494,7 +494,7 @@ public class SysSalesOrderController extends BaseController
@ResponseBody
public TableDataInfo getBinessMembers(){
startPage();
List<SysUser> list = sysUserService.selectRoleToUserList("ywyRole");
List<SysUser> list = sysUserService.selectRoleToUserList("ywyRole,ywjlRole,ywzgRole");
return getDataTable(list);
}
}

41
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java

@ -83,28 +83,28 @@ public class SysCustomerServiceImpl implements ISysCustomerService
/**
* 查询客户基本信息列表
*
* @param sysCustomerVo1
* @param sysCustomer
* @return 客户基本信息
*/
@Override
public List<SysCustomerVo> selectSysCustomerList(SysCustomerVo sysCustomerVo1)
public List<SysCustomerVo> selectSysCustomerList(SysCustomerVo sysCustomer)
{
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
Page<SysCustomerVo> list = (Page<SysCustomerVo>) sysCustomerMapper.selectSysCustomerList(sysCustomerVo1);
Page<SysCustomerVo> list = (Page<SysCustomerVo>) sysCustomerMapper.selectSysCustomerList(sysCustomer);
Page<SysCustomerVo> returnList = new Page<>();
//PageHelper 仅对第一List分页有效
for(SysCustomerVo sysCustomer : list){
SysUser sysUser = userMapper.selectUserByLoginName(sysCustomer.getCreateBy());
for(SysCustomerVo sysCustomerVo : list){
SysUser sysUser = userMapper.selectUserByLoginName(sysCustomerVo.getCreateBy());
if (sysUser != null) {
sysCustomer.setCreateBy(sysUser.getUserName());
sysCustomerVo.setCreateBy(sysUser.getUserName());
}
SysUser sysUser2 = userMapper.selectUserByLoginName(sysCustomer.getApplyUser());
SysUser sysUser2 = userMapper.selectUserByLoginName(sysCustomerVo.getApplyUser());
if (sysUser2!=null){
sysCustomer.setApplyUserName(sysUser2.getUserName());
sysCustomerVo.setApplyUserName(sysUser2.getUserName());
}
String instanceId = sysCustomer.getInstanceId();
String instanceId = sysCustomerVo.getInstanceId();
// 当前环节
if (StringUtils.isNotBlank(instanceId)) {
List<Task> taskList = taskService.createTaskQuery()
@ -114,27 +114,27 @@ public class SysCustomerServiceImpl implements ISysCustomerService
if (!CollectionUtils.isEmpty(taskList)) {
TaskEntityImpl task = (TaskEntityImpl) taskList.get(0);
String taskId = task.getId();
sysCustomer.setTaskId(taskId);
sysCustomerVo.setTaskId(taskId);
// 设置待办用户
List<String> todoUserList = todoItemMapper.selectUndealTodoUserList(taskId);
if(!CollectionUtils.isEmpty(taskList)){
sysCustomer.setTodoUserId(String.join(",",todoUserList));
sysCustomerVo.setTodoUserId(String.join(",",todoUserList));
}
if (task.getSuspensionState() == 2) {
sysCustomer.setTaskName("已挂起");
sysCustomer.setSuspendState("2");
sysCustomerVo.setTaskName("已挂起");
sysCustomerVo.setSuspendState("2");
} else {
sysCustomer.setTaskName(task.getName());
sysCustomer.setSuspendState("1");
sysCustomerVo.setTaskName(task.getName());
sysCustomerVo.setSuspendState("1");
}
} else {
// 已办结或者已撤销
sysCustomer.setTaskName("已结束");
sysCustomerVo.setTaskName("已结束");
}
} else {
sysCustomer.setTaskName("未启动");
sysCustomerVo.setTaskName("未启动");
}
returnList.add(sysCustomer);
returnList.add(sysCustomerVo);
}
returnList.setTotal(CollectionUtils.isEmpty(list) ? 0 : list.getTotal());
returnList.setPageNum(pageNum);
@ -281,7 +281,6 @@ public class SysCustomerServiceImpl implements ISysCustomerService
@Override
public int add(SysCustomer sysCustomer) {
return sysCustomerMapper.insertSysCustomer(sysCustomer);
}
@ -387,8 +386,8 @@ public class SysCustomerServiceImpl implements ISysCustomerService
private ProcessInstance startProcessInstance(String applyTitle, String instanceType, SysCustomer sysCustomer, SysUser user) {
Long materialId = sysCustomer.getId();
String businessKey = materialId.toString(); // 实体类 ID,作为流程的业务 key
Long customerId = sysCustomer.getId();
String businessKey = customerId.toString(); // 实体类 ID,作为流程的业务 key
String key = "customer";
Map<String,Object> variables = new HashMap<>();
// 构造authority传参

9
ruoyi-admin/src/main/resources/templates/system/customer/add.html

@ -76,7 +76,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-6 control-label" is-required>法人代表:</label>
<label class="col-sm-6 control-label is-required" >法人代表:</label>
<div class="col-sm-6">
<input required name="legalRepresentative" class="form-control" type="text">
</div>
@ -91,7 +91,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-6 control-label" is-required>开票公司名称:</label>
<label class="col-sm-6 control-label is-required">开票公司名称:</label>
<div class="col-sm-6">
<input required name="invoicingCompanyName" class="form-control" type="text">
</div>
@ -242,7 +242,7 @@
<div class="form-group">
<label class="col-sm-6 control-label">业务员:</label>
<div class="col-sm-6">
<select name="businessMembers" class="form-control" shiro:partial="customer:selectBusinessMembers">
<select name="businessMembers" class="form-control" disabled>
<option value=""></option>
</select>
</div>
@ -261,6 +261,7 @@
<script th:inline="javascript">
var prefix = ctx + "system/customer"
var userName = [[${@permission.getPrincipalProperty('userName')}]];
var loginName = [[${@permission.getPrincipalProperty('loginName')}]];
$(function() {
//获取单号
$.ajax({
@ -289,7 +290,7 @@
for (let i in usertData) {
$("select[name='businessMembers']").append("<option value='" + usertData[i].userName + "'>" + usertData[i].userName + "</option>");
}
$("select[name='businessMembers']").val(loginName);
} else {
$.modal.msgError(res.msg);
}

2
ruoyi-admin/src/main/resources/templates/system/customer/detail.html

@ -307,7 +307,7 @@
$("#form-customer-detail select[name='businessMembers']").append("<option value='" + usertData[i].userName + "'>" + usertData[i].userName + "</option>");
}
let userName = [[${@permission.getPrincipalProperty('userName')}]];
$("#form-customer-detail select[name='businessMembers']").val(userName).trigger("change")
$("#form-customer-detail select[name='businessMembers']").val(customer.businessMembers);
} else {
$.modal.msgError(res.msg);
}

3
ruoyi-admin/src/main/resources/templates/system/customer/edit.html

@ -268,8 +268,8 @@
<script th:src="@{/ajax/libs/vue/vue.js}"></script>
<script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script>
<script th:inline="javascript">
var prefix = ctx + "system/customer";
var customer = [[${sysCustomer}]];
$("#form-customer-edit").validate({focusCleanup: true});
function submitHandler() {
@ -289,6 +289,7 @@
$("select[name='businessMembers']").append("<option value='"
+ usertData[i].userName + "'>" + usertData[i].userName + "</option>");
}
$("select[name='businessMembers']").val(customer.businessMembers);
} else {
$.modal.msgError(res.msg);
}

2
ruoyi-admin/src/main/resources/templates/system/customer/taskModifyApply.html

@ -307,6 +307,7 @@
<script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script>
<script th:src="javascript">
var prefix = ctx + "system/customer";
var customer = [[${formData}]];
$("#form-edit").validate({onkeyup: false, rules:{}, messages: {},focusCleanup: true});
$(function(){
$.ajax({
@ -320,6 +321,7 @@
$("select[name='businessMembers']").append("<option value='"
+ usertData[i].userName + "'>" + usertData[i].userName + "</option>");
}
$("select[name='businessMembers']").val(customer.businessMembers);
} else {
$.modal.msgError(res.msg);
}

2
ruoyi-admin/src/main/resources/templates/system/customer/taskYwjlVerify.html

@ -308,6 +308,7 @@
<script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script>
<script th:inline="javascript">
var prefix = ctx + "system/customer";
var customer = [[${formData}]];
$("#form-edit").validate({focusCleanup: true});
$(function(){
$.ajax({
@ -321,6 +322,7 @@
$("select[name='businessMembers']").append("<option value='"
+ usertData[i].userName + "'>" + usertData[i].userName + "</option>");
}
$("select[name='businessMembers']").val(customer.businessMembers);
} else {
$.modal.msgError(res.msg);
}

2
ruoyi-admin/src/main/resources/templates/system/customer/taskYwzgVerify.html

@ -309,6 +309,7 @@
<script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script>
<script th:inline="javascript">
var prefix = ctx + "system/customer";
var customer = [[${formData}]];
$("#form-edit").validate({focusCleanup: true });
$(function(){
$.ajax({
@ -322,6 +323,7 @@
$("select[name='businessMembers']").append("<option value='"
+ usertData[i].userName + "'>" + usertData[i].userName + "</option>");
}
$("select[name='businessMembers']").val(customer.businessMembers);
} else {
$.modal.msgError(res.msg);
}

3
ruoyi-admin/src/main/resources/templates/system/customer/taskZozjVerify.html

@ -307,8 +307,8 @@
<script th:src="@{/ajax/libs/vue/vue.js}"></script>
<script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script>
<script th:inline="javascript">
var prefix = ctx + "system/customer";
var customer = [[${formData}]];
$("#form-edit").validate({focusCleanup: true});
$(function(){
$.ajax({
@ -322,6 +322,7 @@
$("select[name='businessMembers']").append("<option value='"
+ usertData[i].userName + "'>" + usertData[i].userName + "</option>");
}
$("select[name='businessMembers']").val(customer.businessMembers);
} else {
$.modal.msgError(res.msg);
}

Loading…
Cancel
Save