diff --git a/ruoyi-admin/src/main/java/com/ruoyi/remind/domain/Remind.java b/ruoyi-admin/src/main/java/com/ruoyi/remind/domain/Remind.java index a2b1c82a..04e18965 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/remind/domain/Remind.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/remind/domain/Remind.java @@ -130,8 +130,4 @@ public class Remind { + receiver + "]"; } - - - - } \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java index 96a2797f..94697aab 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java @@ -5,29 +5,51 @@ import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.util.MapUtils; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.flow.domain.BizRequestItem; +import com.ruoyi.flow.service.FlowService; +import com.ruoyi.framework.shiro.realm.UserRealm; +import com.ruoyi.remind.domain.Remind; +import com.ruoyi.remind.mapper.RemindMapper; import com.ruoyi.system.domain.SysCustomer; +import com.ruoyi.system.domain.SysCustomerOper; import com.ruoyi.system.domain.exportDto.SysCustomerDto; +import com.ruoyi.system.mapper.SysCustomerMapper; +import com.ruoyi.system.mapper.SysCustomerOperMapper; +import com.ruoyi.system.mapper.SysDeptMapper; import com.ruoyi.system.service.ISysCustomerService; import com.ruoyi.system.service.ISysDictTypeService; +import org.activiti.engine.IdentityService; +import org.activiti.engine.TaskService; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.apache.shiro.authz.annotation.RequiresRoles; +import org.omg.PortableInterceptor.INACTIVE; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mapping.IdentifierAccessor; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; import java.net.URLEncoder; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 客户基本信息Controller @@ -45,6 +67,10 @@ public class SysCustomerController extends BaseController private ISysCustomerService sysCustomerService; @Autowired private ISysDictTypeService sysDictTypeService; + @Autowired + private RemindMapper remindMapper; + @Autowired + private SysCustomerOperMapper sysCustomerOperMapper; @RequiresPermissions("system:customer:view") @GetMapping() @@ -100,9 +126,39 @@ public class SysCustomerController extends BaseController @ResponseBody public AjaxResult addSave(SysCustomer sysCustomer) { - return toAjax(sysCustomerService.insertSysCustomer(sysCustomer)); + SysCustomer sysCustomer1 = new SysCustomer(); + sysCustomer1.setEnterpriseName(sysCustomer.getEnterpriseName()); + sysCustomer1.setCustomerPurser(sysCustomer.getCustomerPurser()); + List sysCustomerList = sysCustomerService.selectSysCustomerList(sysCustomer1); + if (sysCustomerList.size() == 1){ + SysCustomer sysCustomer2 = sysCustomerList.get(0); + return AjaxResult.error("该客户已被其他业务员添加"+"客户名称 :" + sysCustomerList.get(0).getEnterpriseName() + "事业部: "+ + "" + sysCustomerList.get(0).getCustomerPurser() + " 业务员" + sysCustomerList.get(0).getBusinessMembers()); + }else if (sysCustomerList.size() == 0){ + sysCustomerService.insertSysCustomer(sysCustomer); + Long customer_id = sysCustomerService.selectSysCustomerList(sysCustomer).get(0).getCustomerId(); + String keyNo = "KH" + 00 + customer_id; + sysCustomer.setEnterpriseCode(keyNo); + int ok = sysCustomerService.updateSysCustomer(sysCustomer); + //添加操作记录 + SysCustomerOper sysCustomerOper = new SysCustomerOper(); + sysCustomerOper.setSysCustomerPuser(sysCustomer.getCustomerPurser()); + sysCustomerOper.setSysCustomerEnterPriseName(sysCustomer.getEnterpriseName()); + sysCustomerOper.setOper("新增"); + sysCustomerOper.setUpdateBy(ShiroUtils.getLoginName()); + sysCustomerOper.setUpdateTime(DateUtils.getNowDate()); + if(ok==1){ + sysCustomerOper.setUpdateStatus("0"); + }else{ + sysCustomerOper.setUpdateStatus("1"); + } + sysCustomerOperMapper.insertSysCustomerOper(sysCustomerOper); + return AjaxResult.success("添加成功,等待审核"); + } + return AjaxResult.success(""); } + /** * 修改客户基本信息 */ @@ -206,4 +262,57 @@ public class SysCustomerController extends BaseController } } + // 添加修改客户表 + @RequiresPermissions("system:customer:add") + @Log(title = "客户基本信息", businessType = BusinessType.INSERT) + @PostMapping("/addCustomer") + @ResponseBody + public AjaxResult add(HttpServletRequest request) { + String keyNo = request.getParameter("enterpriseCode"); + SysUser user = ShiroUtils.getSysUser(); + SysCustomer sysCustomer = new SysCustomer(); + sysCustomer.setEnterpriseName(request.getParameter("enterpriseName")); + sysCustomer.setCustomerPurser(request.getParameter("customerPurser")); + sysCustomer.setEnterpriseCode(request.getParameter("enterpriseCode")); + //业务员 + sysCustomer.setBusinessMembers(request.getParameter("businessMembers")); + List sysCustomerList = sysCustomerService.selectSysCustomerList(sysCustomer); + if (sysCustomerList.size() == 0){ + sysCustomerService.insertSysCustomer(sysCustomer); + Long customer_id = sysCustomerService.selectSysCustomerList(sysCustomer).get(0).getCustomerId(); + keyNo = "KH" + 00 + customer_id; + sysCustomer.setCustomsCode(keyNo); + sysCustomer.setCreateBy(ShiroUtils.getLoginName()); + sysCustomerService.updateSysCustomer(sysCustomer); + //添加时间 + sysCustomer.setCreateTime(new Date()); + //发送添加客户提醒给上级 + Remind remind = new Remind(); + //接收人 + remind.setReceiverName(""); + //提示信息 + remind.setRemindContent(sysCustomer.getBusinessMembers()+"申请:客户"+sysCustomer.getEnterpriseName()+"事务部"+sysCustomer.getCustomerPurser()+""); + remindMapper.add(remind); + } + else{ + return AjaxResult.error("该客户已被其他业务员添加"+"客户名称 :" + sysCustomerList.get(0).getEnterpriseName() + "事业部: "+ + "" + sysCustomerList.get(0).getCustomerPurser() + " 业务员" + sysCustomerList.get(0).getBusinessMembers()); + } + //添加的时候插入记录到我的请求 +// if (add) { +// BizRequestItem bizRequestItem = new BizRequestItem(); +// bizRequestItem.setCreateBy(sysCustomer.getCreateBy()); +// bizRequestItem.setCreateTime(sysCustomer.getCreateTime()+""); +// bizRequestItem.setTitle(sysCustomer.getBusinessMembers() + "_" + sysCustomer.getEnterpriseName()); +// bizRequestItem.setModuleUrl("Syscustom"); +// bizRequestItem.setModuleName("客户表"); +// bizRequestItem.setKeyNo(sysCustomer.getCustomerId()+""); +// bizRequestItem.setDelSign("0"); +// flowService.add(bizRequestItem); +// +// +// } + return AjaxResult.success("添加成功," +1 +"一条数据"); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java index 1cc6d618..d4038bfa 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java @@ -100,6 +100,12 @@ public class SysCustomer extends BaseEntity @Excel(name = "客户简称") private String customerAbbreviation; + /** 事业部 */ + @Excel(name = "事业部") + private String customerPurser; + /** 职务 */ + @Excel(name = "职务") + private String customerOffice; /** 海关代码 */ @Excel(name = "海关代码") private String customsCode; @@ -204,7 +210,41 @@ public class SysCustomer extends BaseEntity @Excel(name = "修改时间") private String updateInfoTime; - public void setCustomerId(Long customerId) + @Excel(name = "客户审核状态表示") //0表示审核中,1标识审核通过,2表示审核拒绝 + private int deginflag; + @Excel(name = "客户的状态") + private int delflag; + public int getDeginflag() { + return deginflag; + } + + public void setDeginflag(int deginflag) { + this.deginflag = deginflag; + } + public int getDelflag() { + return delflag; + } + + public void setDelflag(int delflag) { + this.delflag = delflag; + } + public String getCustomerPurser() { + return customerPurser; + } + + public void setCustomerPurser(String customerPurser) { + this.customerPurser = customerPurser; + } + + public String getCustomerOffice() { + return customerOffice; + } + + public void setCustomerOffice(String customerOffice) { + this.customerOffice = customerOffice; + } + + public void setCustomerId(Long customerId) { this.customerId = customerId; } @@ -626,6 +666,8 @@ public class SysCustomer extends BaseEntity this.updateInfoTime = updateInfoTime; } + + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -650,6 +692,8 @@ public class SysCustomer extends BaseEntity .append("customerFax", getCustomerFax()) .append("customerEmail", getCustomerEmail()) .append("customerAbbreviation", getCustomerAbbreviation()) + .append("customerOffice", getCustomerOffice()) + .append("customerPurser", getCustomerPurser()) .append("customsCode", getCustomsCode()) .append("paymentTerms", getPaymentTerms()) .append("invoiceCode", getInvoiceCode()) @@ -676,6 +720,8 @@ public class SysCustomer extends BaseEntity .append("countryNumber", getCountryNumber()) .append("firstAddTime", getFirstAddTime()) .append("updateInfoTime", getUpdateInfoTime()) + .append("deginflag", getDeginflag()) + .append("delflag", getDelflag()) .toString(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java index 0924799f..65e8ab01 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java @@ -1,8 +1,10 @@ package com.ruoyi.system.service; import com.ruoyi.system.domain.SysCustomer; +import org.activiti.engine.runtime.ProcessInstance; import java.util.List; +import java.util.Map; /** * 客户基本信息Service接口 @@ -63,4 +65,7 @@ public interface ISysCustomerService public List selectSysCustomerBycode(); public SysCustomer selectSysCustomerByEnterpriseCode(String enterpriseCode); + + public int add(SysCustomer sysCustomer); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java index b06d1aca..0a0782b5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java @@ -1,13 +1,29 @@ package com.ruoyi.system.service.impl; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.flow.domain.BizRequestItem; +import com.ruoyi.flow.service.FlowService; +import com.ruoyi.process.leave.domain.BizLeaveVo; +import com.ruoyi.process.todoitem.domain.BizTodoItem; +import com.ruoyi.process.todoitem.service.IBizTodoItemService; import com.ruoyi.system.domain.SysCustomer; import com.ruoyi.system.mapper.SysCustomerMapper; import com.ruoyi.system.service.ISysCustomerService; +import org.activiti.engine.IdentityService; +import org.activiti.engine.RuntimeService; +import org.activiti.engine.TaskService; +import org.activiti.engine.runtime.ProcessInstance; +import org.apache.commons.lang3.BooleanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.ui.ModelMap; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 客户基本信息Service业务层处理 @@ -102,4 +118,10 @@ public class SysCustomerServiceImpl implements ISysCustomerService public SysCustomer selectSysCustomerByEnterpriseCode(String enterpriseCode) { return sysCustomerMapper.selectSysCustomerByEnterpriseCode(enterpriseCode); } + + @Override + public int add(SysCustomer sysCustomer) { + return sysCustomerMapper.insertSysCustomer(sysCustomer); + } + } diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 69151292..d367fe6c 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -23,10 +23,12 @@ spring: # username: root # password: RuiYi123 # url: jdbc:mysql://39.104.169.14:3306/wancaierpdemo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 - url: jdbc:mysql://120.24.213.253:3306/wancaierpdemo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 +# url: jdbc:mysql://120.24.213.253:3306/wancaierpdemo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 + url: jdbc:mysql://localhost:3306/wancaierpdemo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 username: root # password: RuiYi2022 - password: Read-in2023 +# password: Read-in2023 + password: RuiYi@2023 # username: root # password: RuiYi2022 # 从库数据源 diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml index a402bc88..6dee82af 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml @@ -26,8 +26,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -52,10 +54,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - select customer_id, enterprise_code, export_sales, enterprise_name, english_name, customer_address, delivery_address, postal_code, customer_country, common_currency, customer_remarks, legal_representative, invoicing_customer_name, invoicing_company_name, credit_limit, integrity_rating, customer_contact, contact_number, customer_fax, customer_email, customer_abbreviation, customs_code, payment_terms, invoice_code, port_of_destination, established_time, settlement_bank, exchange_settlement_account, deposit_bank, bank_account, rmb_registered_capital, registered_capital, order_length, shipping_template, business_members, destination_port_code, departure_potential_name, departure_potential_code, unified_numbering, shipment_usage, voucher_preparation, identifying_people, confirm_tax, tax_rate, country_number, first_add_time, update_info_time from sys_customer + select customer_id, enterprise_code, export_sales, enterprise_name, english_name, customer_address, delivery_address, postal_code, customer_country, common_currency, customer_remarks, legal_representative, invoicing_customer_name, invoicing_company_name, credit_limit, integrity_rating, customer_contact, contact_number, customer_fax, customer_email, customer_abbreviation,customer_purser,customer_office, customs_code, payment_terms, invoice_code, port_of_destination, established_time, settlement_bank, exchange_settlement_account, deposit_bank, bank_account, rmb_registered_capital, registered_capital, order_length, shipping_template, business_members, destination_port_code, departure_potential_name, departure_potential_code, unified_numbering, shipment_usage, voucher_preparation, identifying_people, confirm_tax, tax_rate, country_number, first_add_time, update_info_time,degin_flag,del_flag from sys_customer +
@@ -35,6 +35,18 @@
+
+ +
+ +
+
+
+ +
+ +
+
@@ -62,33 +74,33 @@
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
@@ -145,7 +157,7 @@
- +
@@ -165,26 +177,26 @@
-
+ -
+ -
+ -
+ -
+ -
+
- - - - + +
-
+ -
+ -
+ -
+ -
+ -
+ -
+
@@ -293,7 +305,7 @@
-
+ +
+ +
+ +
+
+
+ +
+ +
+
@@ -413,7 +426,7 @@
- +
+
+ +
+ +
+
@@ -458,12 +477,6 @@
-
- -
- -
-
@@ -476,13 +489,13 @@
-
+ -
+
-
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+
- + +
审核成功
@@ -680,6 +747,36 @@ columns: [{ checkbox: true }, + { + field: 'deginflag', + title: '审核状态', + formatter: function (value, row, index) { + if (value == 0){ + return "待审核"; + } + if(value==1){ + return "审核通过"; + } + if (value == 2){ + return "审核拒绝"; + } + }, + }, + { + field: 'delflag', + title: '客户状态', + formatter: function (value, row, index) { + if (value == 0){ + return "否"; + } + if(value==1){ + return "是"; + } + if (value == 2){ + return "作废"; + } + }, + }, { field: 'customerId', title: '客户id', @@ -1545,7 +1642,45 @@ }); $("#detailsModal").modal("show"); }) + function quotationAudit() { + let data = $("#bootstrap-table").bootstrapTable("getSelections"); + let userName = [[${@permission.getPrincipalProperty('userName')}]]; + if (data.length === 1) { + $("#supplierQuotationId").val(data[0].supplierQuotationId) + $("#auditNo").val(1).trigger("change") + $("#auditName").val(userName) + $("#auditTime").datetimepicker("setDate", new Date()); + $("#AuditModel").modal("show"); + } else { + $.modal.alert("请选择一条数据"); + } + } + function AuditConfirmSubmit() { + var auditNo = $("#auditNo").val() + $.ajax({ + url: prefix + "/edit", + type: "post", + resultType: "json", + data: $('#form-audit-edit').serialize(), + success: function (resp) { + console.log(resp) + $("#bootstrap-table").bootstrapTable('refresh'); + // $(".alert-success").addClass("show"); + // window.setTimeout(function () { + // $(".alert-success").removeClass("show"); + // }, 1000);//显示的时间 + if (auditNo == 1) { + $.modal.msgSuccess("审核成功!") + } else if (auditNo == 0) { + $.modal.msgSuccess("取消审核成功!") + } + }, + error: function () { + $.modal.msgError("出错了!"); + } + }); + } //导出 function exportCustomerInfo() { // rows为选中行的id diff --git a/ruoyi-admin/src/main/resources/templates/system/customer/edit.html b/ruoyi-admin/src/main/resources/templates/system/customer/edit.html index 92740f13..c584a8ee 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customer/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/customer/edit.html @@ -10,7 +10,7 @@
-
+ +
+ +
+ +
+
+
+ +
+ +
+
@@ -71,15 +83,21 @@
- + +
+ +
+
+
+
- +
- +
@@ -94,12 +112,6 @@
-
- -
- -
-
@@ -138,7 +150,7 @@
- +
@@ -164,13 +176,13 @@
-
+ -
+ -
+ -
+ -
+
@@ -204,7 +216,7 @@
-
+
- +
- +
-
+ -
+ -
+ -
+ -
+ -
- +
+
@@ -302,13 +314,19 @@
+ +
+ + +