diff --git a/pom.xml b/pom.xml index 68ed53d..fbb015d 100644 --- a/pom.xml +++ b/pom.xml @@ -227,6 +227,13 @@ ${ruoyi.version} + + + com.ruoyi + ruoyi-mongodb + ${ruoyi.version} + + @@ -237,6 +244,7 @@ ruoyi-common ruoyi-tenant ruoyi-crm + ruoyi-mongodb pom diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 2ed571b..c7e15ee 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -67,6 +67,13 @@ ruoyi-crm + + + com.ruoyi + ruoyi-mongodb + 3.8.1 + + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index 5b24f6d..a4ff1cd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -1,5 +1,6 @@ package com.ruoyi.web.controller.system; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.commons.lang3.ArrayUtils; @@ -88,6 +89,20 @@ public class SysDeptController extends BaseController return AjaxResult.success(deptService.buildDeptTreeSelect(depts)); } + /** + * 服务工单指定销售人员 + * @param dept + * @return + */ + @GetMapping("/designatedPerson") + public AjaxResult designatedPerson(SysDept dept) + { + List depts = deptService.selectDeptList(dept); + ArrayList list = new ArrayList<>(); + + return AjaxResult.success(depts); + } + /** * 加载对应角色部门列表树 */ diff --git a/ruoyi-crm/src/main/java/com/ruoyi/crm/controller/CrmCustomerController.java b/ruoyi-crm/src/main/java/com/ruoyi/crm/controller/CrmCustomerController.java index 632c3a7..2efa3ef 100644 --- a/ruoyi-crm/src/main/java/com/ruoyi/crm/controller/CrmCustomerController.java +++ b/ruoyi-crm/src/main/java/com/ruoyi/crm/controller/CrmCustomerController.java @@ -9,6 +9,8 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.crm.domain.CrmCustomer; import com.ruoyi.crm.domain.enums.CustomerFolder; import com.ruoyi.crm.service.ICrmCustomerService; +import com.ruoyi.crm.system.domain.ContactPerson; +import com.ruoyi.crm.system.service.IContactPersonService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -17,6 +19,7 @@ import javax.servlet.http.HttpServletResponse; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.List; +import java.util.UUID; /** * 客户Controller @@ -30,6 +33,8 @@ public class CrmCustomerController extends BaseController { @Autowired private ICrmCustomerService crmCustomerService; + @Autowired + private IContactPersonService contactPersonService; /** * 查询成交客户列表 @@ -136,7 +141,7 @@ public class CrmCustomerController extends BaseController DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); String formattedDate = currentDate.format(formatter); //根据当前时间生成客户编号 - crmCustomer.setCode("zy_"+formattedDate+crmCustomer.getId()); + crmCustomer.setCode("zy_"+formattedDate+crmCustomer.getId()+ UUID.randomUUID().toString().replace("-","").substring(0,6)); return toAjax(crmCustomerService.insertCrmCustomer(crmCustomer)); } @@ -148,7 +153,27 @@ public class CrmCustomerController extends BaseController @PutMapping public AjaxResult edit(@RequestBody CrmCustomer crmCustomer) { + //修改客户联系人时同步联系人信息(临时逻辑) + //找到这个客户原先联系人信息 + CrmCustomer customerById = crmCustomerService.selectCrmCustomerById(crmCustomer.getId()); + ContactPerson contactPerson = new ContactPerson(); + //设置更新者 crmCustomer.setUpdateBy(getUsername()); + //封装联系人信息 + contactPerson.setName(customerById.getLinkman()); + contactPerson.setPhoneNumber(customerById.getPhone()); + //查出联系人 + List list = contactPersonService.selectContactPersonList(contactPerson); + for (ContactPerson person : list) { + //找出对应联系人信息 + if (customerById.getLinkman().equals(person.getName()) && customerById.getPhone().equals(person.getPhoneNumber())){ + contactPerson.setPhoneNumber(crmCustomer.getPhone()); + contactPerson.setName(crmCustomer.getLinkman()); + contactPerson.setId(person.getId()); + //修改联系人 + contactPersonService.updateContactPerson(contactPerson); + } + } return toAjax(crmCustomerService.updateCrmCustomer(crmCustomer)); } diff --git a/ruoyi-crm/src/main/java/com/ruoyi/crm/system/controller/ContactPersonController.java b/ruoyi-crm/src/main/java/com/ruoyi/crm/system/controller/ContactPersonController.java index 5d77c79..a9ec445 100644 --- a/ruoyi-crm/src/main/java/com/ruoyi/crm/system/controller/ContactPersonController.java +++ b/ruoyi-crm/src/main/java/com/ruoyi/crm/system/controller/ContactPersonController.java @@ -6,6 +6,8 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.crm.domain.CrmCustomer; +import com.ruoyi.crm.service.ICrmCustomerService; import com.ruoyi.crm.system.domain.ContactPerson; import com.ruoyi.crm.system.service.IContactPersonService; import org.springframework.beans.factory.annotation.Autowired; @@ -27,6 +29,8 @@ public class ContactPersonController extends BaseController { @Autowired private IContactPersonService contactPersonService; + @Autowired + private ICrmCustomerService crmCustomerService; /** * 查询联系人列表 @@ -82,6 +86,14 @@ public class ContactPersonController extends BaseController @PutMapping public AjaxResult edit(@RequestBody ContactPerson contactPerson) { + //临时逻辑 + //未变动前的联系人 + ContactPerson contactPersonById = contactPersonService.selectContactPersonById(contactPerson.getId()); + //该联系人关联的客户 + CrmCustomer crmCustomer = crmCustomerService.selectCrmCustomerById(contactPersonById.getCustomerId()); + crmCustomer.setLinkman(contactPerson.getName()); + crmCustomer.setPhone(contactPerson.getPhoneNumber()); + crmCustomerService.updateCrmCustomer(crmCustomer); return toAjax(contactPersonService.updateContactPerson(contactPerson)); } diff --git a/ruoyi-mongodb/pom.xml b/ruoyi-mongodb/pom.xml new file mode 100644 index 0000000..c11a4bc --- /dev/null +++ b/ruoyi-mongodb/pom.xml @@ -0,0 +1,42 @@ + + + + ruoyi + com.ruoyi + 3.8.1 + + 4.0.0 + + ruoyi-mongodb + + + + + + com.ruoyi + ruoyi-common + + + + + com.ruoyi + ruoyi-system + 3.8.1 + + + org.projectlombok + lombok + + + + org.springframework.boot + spring-boot-starter-data-mongodb + + + + + + + \ No newline at end of file diff --git a/ruoyi-mongodb/src/main/java/com/ruoyi/mongodb/conreoller/DynamicDataController.java b/ruoyi-mongodb/src/main/java/com/ruoyi/mongodb/conreoller/DynamicDataController.java new file mode 100644 index 0000000..428a5c0 --- /dev/null +++ b/ruoyi-mongodb/src/main/java/com/ruoyi/mongodb/conreoller/DynamicDataController.java @@ -0,0 +1,35 @@ +package com.ruoyi.mongodb.conreoller; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.mongodb.domain.DynamicData; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Map; + +@RestController +public class DynamicDataController { + @Autowired + private MongoTemplate mongoTemplate; + + //保存数据 + @PostMapping("/saveDynamicData") + public AjaxResult saveDynamicData(@RequestBody Map requestData) { + DynamicData dynamicData = new DynamicData(); + dynamicData.setData(requestData); + mongoTemplate.save(dynamicData); + return AjaxResult.success(dynamicData); + } + + //查询数据 + @GetMapping("/selectDynamicData") + public AjaxResult selectDynamicData(String id) { + DynamicData data = mongoTemplate.findById(id, DynamicData.class); + return AjaxResult.success(data); + } + +} diff --git a/ruoyi-mongodb/src/main/java/com/ruoyi/mongodb/domain/DynamicData.java b/ruoyi-mongodb/src/main/java/com/ruoyi/mongodb/domain/DynamicData.java new file mode 100644 index 0000000..73f04cb --- /dev/null +++ b/ruoyi-mongodb/src/main/java/com/ruoyi/mongodb/domain/DynamicData.java @@ -0,0 +1,45 @@ +package com.ruoyi.mongodb.domain; + +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.util.Map; + +@Document(collection = "dynamicData") +public class DynamicData { + @Id + private String id; + private Map data; + + public DynamicData() { + } + + public DynamicData(String id, Map data) { + this.id = id; + this.data = data; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Map getData() { + return data; + } + + public void setData(Map data) { + this.data = data; + } + + @Override + public String toString() { + return "DynamicData{" + + "id='" + id + '\'' + + ", data=" + data + + '}'; + } +} diff --git a/ruoyi-ui/src/api/system/dept.js b/ruoyi-ui/src/api/system/dept.js index 2804676..1116ef8 100644 --- a/ruoyi-ui/src/api/system/dept.js +++ b/ruoyi-ui/src/api/system/dept.js @@ -33,6 +33,14 @@ export function treeselect() { }) } +// 查询服务工单下拉树结构 +export function designatedPerson() { + return request({ + url: '/system/dept/designatedPerson', + method: 'get' + }) +} + // 根据角色ID查询部门树结构 export function roleDeptTreeselect(roleId) { return request({ @@ -65,4 +73,4 @@ export function delDept(deptId) { url: '/system/dept/' + deptId, method: 'delete' }) -} \ No newline at end of file +} diff --git a/ruoyi-ui/src/assets/images/login-background.jpg b/ruoyi-ui/src/assets/images/login-background.jpg index 830e4ba..bd6e172 100644 Binary files a/ruoyi-ui/src/assets/images/login-background.jpg and b/ruoyi-ui/src/assets/images/login-background.jpg differ diff --git a/ruoyi-ui/src/assets/images/men.png b/ruoyi-ui/src/assets/images/men.png new file mode 100644 index 0000000..76be83d Binary files /dev/null and b/ruoyi-ui/src/assets/images/men.png differ diff --git a/ruoyi-ui/src/assets/left-img.png b/ruoyi-ui/src/assets/left-img.png new file mode 100644 index 0000000..64a7d06 Binary files /dev/null and b/ruoyi-ui/src/assets/left-img.png differ diff --git a/ruoyi-ui/src/assets/login-bg.png b/ruoyi-ui/src/assets/login-bg.png new file mode 100644 index 0000000..296812f Binary files /dev/null and b/ruoyi-ui/src/assets/login-bg.png differ diff --git a/ruoyi-ui/src/views/crm/ticket/index.vue b/ruoyi-ui/src/views/crm/ticket/index.vue index 61028c9..42e903b 100644 --- a/ruoyi-ui/src/views/crm/ticket/index.vue +++ b/ruoyi-ui/src/views/crm/ticket/index.vue @@ -524,6 +524,7 @@ :show-count="true" placeholder="请输入售后技术人员" /> + @@ -635,7 +636,7 @@ import { listTicket, getTicket, delTicket, addTicket, updateTicket } from "@/api/crm/ticket"; import CommentComponent from '../customer/Comment'; import { listOrder } from "@/api/crm/order"; -import { treeselect } from '@/api/system/dept' +import { designatedPerson } from '@/api/system/dept' import { dropDownList, getCustomer } from "@/api/crm/customer"; import Treeselect from '@riophae/vue-treeselect' import '@riophae/vue-treeselect/dist/vue-treeselect.css' @@ -673,6 +674,45 @@ export default { customerCustomerList: [], // 部门树选项 deptOptions: undefined, + data: [{ + label: '一级 1', + children: [{ + label: '二级 1-1', + // children: [{ + // label: '三级 1-1-1' + // }] + }] + }, { + label: '一级 2', + children: [{ + label: '二级 2-1', + // children: [{ + // label: '三级 2-1-1' + // }] + }, { + label: '二级 2-2', + // children: [{ + // label: '三级 2-2-1' + // }] + }] + }, { + label: '一级 3', + children: [{ + label: '二级 3-1', + // children: [{ + // label: '三级 3-1-1' + // }] + }, { + label: '二级 3-2', + // children: [{ + // label: '三级 3-2-1' + // }] + }] + }], + defaultProps: { + children: 'children', + label: 'label' + }, // 查询参数 queryParams: { pageNum: 1, @@ -753,9 +793,9 @@ export default { }, /** 查询部门下拉树结构 */ getTreeselect() { - treeselect().then((response) => { + designatedPerson().then((response) => { console.log(response,'res') - this.deptOptions = response.data + this.deptOptions.label = response.data.deptName }) }, //回显客户编号 diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue index b8fed44..c17e678 100644 --- a/ruoyi-ui/src/views/login.vue +++ b/ruoyi-ui/src/views/login.vue @@ -1,7 +1,8 @@