Browse Source

[add:]客户列表模块,新增客户表操作记录。

erp、
zhangsiqi 1 year ago
parent
commit
555dc1a925
  1. 73
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java
  2. 2
      ruoyi-admin/src/main/resources/mapper/system/SysCustomerOperMapper.xml
  3. 42
      ruoyi-admin/src/main/resources/templates/system/customer/customer.html
  4. BIN
      ruoyi-framework/target/classes/com/ruoyi/framework/web/service/DictService.class
  5. BIN
      ruoyi-generator/target/classes/com/ruoyi/generator/controller/GenController.class

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

@ -5,51 +5,34 @@ import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.util.MapUtils; import com.alibaba.excel.util.MapUtils;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData; 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.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; 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.remind.mapper.RemindMapper;
import com.ruoyi.system.domain.SysCustomer; import com.ruoyi.system.domain.SysCustomer;
import com.ruoyi.system.domain.SysCustomerOper; import com.ruoyi.system.domain.SysCustomerOper;
import com.ruoyi.system.domain.exportDto.SysCustomerDto; import com.ruoyi.system.domain.exportDto.SysCustomerDto;
import com.ruoyi.system.mapper.SysCustomerMapper;
import com.ruoyi.system.mapper.SysCustomerOperMapper; import com.ruoyi.system.mapper.SysCustomerOperMapper;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.service.ISysCustomerService; import com.ruoyi.system.service.ISysCustomerService;
import com.ruoyi.system.service.ISysDictTypeService; 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.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.omg.PortableInterceptor.INACTIVE;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mapping.IdentifierAccessor;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.*; import java.util.List;
import java.util.Map;
/** /**
* 客户基本信息Controller * 客户基本信息Controller
@ -262,57 +245,5 @@ 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<SysCustomer> 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 +"一条数据");
}
} }

2
ruoyi-admin/src/main/resources/mapper/system/SysCustomerOperMapper.xml

@ -19,7 +19,7 @@
</sql> </sql>
<select id="selectSysCustomerOperList" parameterType="SysCustomerOper" resultMap="SysCustomerOperResult"> <select id="selectSysCustomerOperList" parameterType="SysCustomerOper" resultMap="SysCustomerOperResult">
<include refid="selectSysCustomerVo"/> <include refid="selectSysCustomerOperVo"/>
<where> <where>
<if test="sysCustomerPuser != null and sysCustomerPuser != ''"> and sys_customer_purser like concat('%', #{sysCustomerPuser}, '%')</if> <if test="sysCustomerPuser != null and sysCustomerPuser != ''"> and sys_customer_purser like concat('%', #{sysCustomerPuser}, '%')</if>
<if test="sysCustomerEnterPriseName!= null and sysCustomerEnterPriseName != ''"> and sys_customer_enterpriseName = #{sysCustomerEnterPriseName}</if> <if test="sysCustomerEnterPriseName!= null and sysCustomerEnterPriseName != ''"> and sys_customer_enterpriseName = #{sysCustomerEnterPriseName}</if>

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

@ -116,6 +116,10 @@
<i class="fa fa-ambulance"></i> 添加送货地址 <i class="fa fa-ambulance"></i> 添加送货地址
</a> </a>
<a class="btn btn-primary" onclick="showCustomerAudit()" shiro:hasPermission="system:customer:audit">
<i class="fa fa-edit"></i> 审核
</a>
<a class="btn btn-success" onclick="showdetails()" > <a class="btn btn-success" onclick="showdetails()" >
<i class="fa fa-file-text"></i> 详情列表 <i class="fa fa-file-text"></i> 详情列表
</a> </a>
@ -674,9 +678,9 @@
<div class="modal-body" style="height: 180px"> <div class="modal-body" style="height: 180px">
<form id="form-audit-edit"> <form id="form-audit-edit">
<div class="form-group" style="display: none"> <div class="form-group" style="display: none">
<label class="col-sm-3 control-label is-required">供应商报价id:</label> <label class="col-sm-3 control-label is-required">客户表id:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="supplierQuotationId" name="supplierQuotationId" class="form-control" type="text" <input id="customerId" name="customerId" class="form-control" type="text"
required required
readonly> readonly>
</div> </div>
@ -684,7 +688,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">审核否:</label> <label class="col-sm-3 control-label">审核否:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select id="auditNo" name="auditNo" class="form-control" <select id="deginflag" name="deginflag" class="form-control"
th:with="type=${@dict.getType('sys_whether')}"> th:with="type=${@dict.getType('sys_whether')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option> th:value="${dict.dictValue}"></option>
@ -695,7 +699,7 @@
<label class="col-sm-3 control-label">审核时间:</label> <label class="col-sm-3 control-label">审核时间:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group date"> <div class="input-group date">
<input id="auditTime" name="auditTime" class="form-control " <input id="updatetime" name="updateTime" class="form-control "
placeholder="yyyy-MM-dd HH:mm:ss" type="text"> placeholder="yyyy-MM-dd HH:mm:ss" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div> </div>
@ -704,15 +708,16 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">审核人:</label> <label class="col-sm-3 control-label">审核人:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="auditName" name="auditName" class="form-control" type="text"> <input id="" name="" class="form-control" type="text">
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button> <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" onclick="AuditConfirmSubmit()" class="btn btn-danger" data-dismiss="modal">审核拒绝</button>
<button type="button" onclick="AuditConfirmSubmit2()" class="btn btn-success" data-dismiss="modal">审核通过</button> <button type="button" onclick="AuditConfirmSubmit(1)" class="btn btn-danger" data-dismiss="modal" editFlag>审核拒绝</button>
<button type="button" onclick="AuditConfirmSubmit(2)" class="btn btn-success" data-dismiss="modal" editFlag>审核通过</button>
</div> </div>
</div> </div>
</div> </div>
@ -754,7 +759,7 @@
if (value == 0){ if (value == 0){
return "待审核"; return "待审核";
} }
if(value==1){ if (value == 1){
return "审核通过"; return "审核通过";
} }
if (value == 2){ if (value == 2){
@ -769,7 +774,7 @@
if (value == 0){ if (value == 0){
return "否"; return "否";
} }
if(value==1){ if (value==1){
return "是"; return "是";
} }
if (value == 2){ if (value == 2){
@ -1071,11 +1076,9 @@
function submitHandler() { function submitHandler() {
if ($.validate.form('form-contacts-add')) { if ($.validate.form('form-contacts-add')) {
$.operate.save(prefix1 + "/add", $('#form-contacts-add').serialize()); $.operate.save(prefix + "/add", $('#form-contacts-add').serialize());
$('#infoModal').modal("hide") $('#infoModal').modal("hide")
} }
} }
// 列表联系人明细 // 列表联系人明细
@ -1642,22 +1645,23 @@
}); });
$("#detailsModal").modal("show"); $("#detailsModal").modal("show");
}) })
function quotationAudit() { function showCustomerAudit() {
let data = $("#bootstrap-table").bootstrapTable("getSelections"); let data = $("#bootstrap-table").bootstrapTable("getSelections");
let userName = [[${@permission.getPrincipalProperty('userName')}]]; let userName = [[${@permission.getPrincipalProperty('userName')}]];
if (data.length === 1) { if (data.length === 1) {
$("#supplierQuotationId").val(data[0].supplierQuotationId) $("#customerId").val(data[0].customerId)
$("#auditNo").val(1).trigger("change") $("#deginflag").val(1).trigger("change")
$("#auditName").val(userName) $("#identifyingPeople").val(userName)
$("#auditTime").datetimepicker("setDate", new Date()); $("#updateTime").datetimepicker("setDate", new Date());
$("#AuditModel").modal("show"); $("#AuditModel").modal("show");
} else { } else {
$.modal.alert("请选择一条数据"); $.modal.alert("请选择一条数据");
} }
} }
function AuditConfirmSubmit() { function AuditConfirmSubmit(e) {
var auditNo = $("#auditNo").val() $("#deginflag").val(e).trigger("change")
var auditNo = $("#deginflag").val();
$.ajax({ $.ajax({
url: prefix + "/edit", url: prefix + "/edit",
type: "post", type: "post",

BIN
ruoyi-framework/target/classes/com/ruoyi/framework/web/service/DictService.class

Binary file not shown.

BIN
ruoyi-generator/target/classes/com/ruoyi/generator/controller/GenController.class

Binary file not shown.
Loading…
Cancel
Save