新增消息中心

This commit is contained in:
459816669@qq.com 2021-04-24 19:29:00 +08:00
parent ad87d00e2f
commit 132bd01023
21 changed files with 1728 additions and 123 deletions

View File

@ -0,0 +1,142 @@
package com.snow.web.controller.system;
import com.snow.common.annotation.Log;
import com.snow.common.annotation.RepeatSubmit;
import com.snow.common.core.controller.BaseController;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.core.page.TableDataInfo;
import com.snow.common.enums.BusinessType;
import com.snow.common.utils.poi.ExcelUtil;
import com.snow.flowable.config.FlowIdGenerator;
import com.snow.framework.util.ShiroUtils;
import com.snow.system.domain.SysMessageTemplate;
import com.snow.system.domain.SysMessageTransition;
import com.snow.system.domain.SysOaCustomer;
import com.snow.system.domain.SysUser;
import com.snow.system.service.ISysMessageTemplateService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 消息模板Controller
*
* @author qimingjin
* @date 2021-02-27
*/
@Controller
@RequestMapping("/system/messageCenter")
public class SysMessageCenterController extends BaseController
{
private String prefix = "system/messageCenter";
@Autowired
private ISysMessageTemplateService sysMessageTemplateService;
@RequiresPermissions("system:messageCenter:view")
@GetMapping()
public String messageCenter()
{
SysUser sysUser = ShiroUtils.getSysUser();
SysMessageTransition sysMessageTransition=new SysMessageTransition();
sysMessageTransition.setConsumerId(String.valueOf(sysUser.getUserId()));
sysMessageTransition.setMessageStatus(0L);
//List<SysMessageTemplate> sysMessageTemplates = sysMessageTemplateService.selectSysMessageTemplateList(sysMessageTransition);
return prefix + "/messageCenter";
}
/**
* 查询消息模板列表
*/
@RequiresPermissions("system:template:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysMessageTemplate sysMessageTemplate)
{
startPage();
List<SysMessageTemplate> list = sysMessageTemplateService.selectSysMessageTemplateList(sysMessageTemplate);
return getDataTable(list);
}
/**
* 导出消息模板列表
*/
@RequiresPermissions("system:template:export")
@Log(title = "消息模板", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysMessageTemplate sysMessageTemplate)
{
List<SysMessageTemplate> list = sysMessageTemplateService.selectSysMessageTemplateList(sysMessageTemplate);
ExcelUtil<SysMessageTemplate> util = new ExcelUtil<SysMessageTemplate>(SysMessageTemplate.class);
return util.exportExcel(list, "template");
}
/**
* 新增消息模板
*/
@GetMapping("/add")
public String add(ModelMap mmap)
{
FlowIdGenerator flowIdGenerator = new FlowIdGenerator();
mmap.put("templateCode", flowIdGenerator.getNextId());
return prefix + "/add";
}
/**
* 新增保存消息模板
*/
@RequiresPermissions("system:template:add")
@Log(title = "消息模板", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
@RepeatSubmit
public AjaxResult addSave(SysMessageTemplate sysMessageTemplate)
{
SysUser sysUser = ShiroUtils.getSysUser();
sysMessageTemplate.setCreateBy(String.valueOf(sysUser.getUserId()));
return toAjax(sysMessageTemplateService.insertSysMessageTemplate(sysMessageTemplate));
}
/**
* 修改消息模板
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
{
SysMessageTemplate sysMessageTemplate = sysMessageTemplateService.selectSysMessageTemplateById(id);
mmap.put("sysMessageTemplate", sysMessageTemplate);
return prefix + "/edit";
}
/**
* 修改保存消息模板
*/
@RequiresPermissions("system:template:edit")
@Log(title = "消息模板", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysMessageTemplate sysMessageTemplate)
{
SysUser sysUser = ShiroUtils.getSysUser();
sysMessageTemplate.setUpdateBy(String.valueOf(sysUser.getUserId()));
return toAjax(sysMessageTemplateService.updateSysMessageTemplate(sysMessageTemplate));
}
/**
* 删除消息模板
*/
@RequiresPermissions("system:template:remove")
@Log(title = "消息模板", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(sysMessageTemplateService.deleteSysMessageTemplateByIds(ids));
}
}

View File

@ -1,5 +1,6 @@
package com.snow.web.controller.system;
import com.google.common.collect.Sets;
import com.snow.common.annotation.Log;
import com.snow.common.annotation.RepeatSubmit;
import com.snow.common.constant.SequenceConstants;
@ -7,6 +8,7 @@ import com.snow.common.core.controller.BaseController;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.core.page.TableDataInfo;
import com.snow.common.enums.BusinessType;
import com.snow.common.enums.MessageEventType;
import com.snow.common.utils.StringUtils;
import com.snow.common.utils.poi.ExcelUtil;
import com.snow.flowable.domain.customer.DistributeCustomerTask;
@ -14,16 +16,20 @@ import com.snow.flowable.domain.customer.SysOaCustomerForm;
import com.snow.flowable.service.FlowableService;
import com.snow.flowable.service.FlowableTaskService;
import com.snow.framework.util.ShiroUtils;
import com.snow.framework.web.domain.common.MessageEventDTO;
import com.snow.system.domain.SysOaCustomer;
import com.snow.system.domain.SysOaCustomerVisitLog;
import com.snow.system.domain.SysOaRegion;
import com.snow.system.domain.SysUser;
import com.snow.system.service.ISysOaCustomerService;
import com.snow.system.service.ISysOaCustomerVisitLogService;
import com.snow.system.service.ISysOaRegionService;
import com.snow.system.service.ISysSequenceService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
@ -58,6 +64,12 @@ public class SysOaCustomerController extends BaseController
@Autowired
private FlowableTaskService flowableTaskService;
@Autowired
private ISysOaCustomerVisitLogService sysOaCustomerVisitLogService;
@Autowired
private ApplicationContext applicationContext;
@RequiresPermissions("system:customer:view")
@GetMapping()
public String customer()
@ -78,6 +90,35 @@ public class SysOaCustomerController extends BaseController
return getDataTable(list);
}
/**
* 查询客户拜访日志列表
*/
@RequiresPermissions("system:customer:visitLogList")
@PostMapping("/visitLogList")
@ResponseBody
public TableDataInfo visitLogList(SysOaCustomerVisitLog sysOaCustomerVisitLog)
{
startPage();
List<SysOaCustomerVisitLog> list = sysOaCustomerVisitLogService.selectSysOaCustomerVisitLogList(sysOaCustomerVisitLog);
return getDataTable(list);
}
/**
* 查询客户列表
*/
@RequiresPermissions("system:customer:myList")
@PostMapping("/myList")
@ResponseBody
public TableDataInfo myList(SysOaCustomer sysOaCustomer)
{
startPage();
SysUser sysUser = ShiroUtils.getSysUser();
sysOaCustomer.setCustomerManager(String.valueOf(sysUser.getUserId()));
sysOaCustomer.setCustomerStatus("ADMITED");
List<SysOaCustomer> list = sysOaCustomerService.selectSysOaCustomerList(sysOaCustomer);
return getDataTable(list);
}
/**
* 导出客户列表
*/
@ -228,7 +269,84 @@ public class SysOaCustomerController extends BaseController
public String detail(@PathVariable("id") Long id, ModelMap mmap)
{
SysOaCustomer sysOaCustomer = sysOaCustomerService.selectSysOaCustomerById(id);
SysOaCustomerVisitLog sysOaCustomerVisitLog=new SysOaCustomerVisitLog();
sysOaCustomerVisitLog.setCustomerNo(sysOaCustomer.getCustomerNo());
List<SysOaCustomerVisitLog> sysOaCustomerVisitLogs = sysOaCustomerVisitLogService.selectSysOaCustomerVisitLogList(sysOaCustomerVisitLog);
mmap.put("sysOaCustomer", sysOaCustomer);
mmap.put("sysOaCustomerVisitLogs", sysOaCustomerVisitLogs);
return prefix + "/detail";
}
/**
* 新增客户拜访日志
*/
@GetMapping("/visitAdd/{id}")
public String visitAdd(@PathVariable("id") Long id, ModelMap mmap)
{
SysOaCustomer sysOaCustomer = sysOaCustomerService.selectSysOaCustomerById(id);
mmap.put("sysOaCustomer", sysOaCustomer);
return prefix + "/visitAdd";
}
/**
* 新增保存客户拜访日志
*/
@RequiresPermissions("system:customer:visitLogAdd")
@Log(title = "客户拜访日志", businessType = BusinessType.INSERT)
@PostMapping("/visitAdd")
@ResponseBody
public AjaxResult visitAdd(SysOaCustomerVisitLog sysOaCustomerVisitLog)
{
SysUser sysUser = ShiroUtils.getSysUser();
sysUser.setCreateBy(String.valueOf(sysUser.getUserId()));
int i = sysOaCustomerVisitLogService.insertSysOaCustomerVisitLog(sysOaCustomerVisitLog);
//加入消息通知
if(StringUtils.isNotNull(sysOaCustomerVisitLog.getAcceptUser())){
MessageEventDTO messageEventDTO=new MessageEventDTO(MessageEventType.SEND_VISIT_LOG.getCode());
messageEventDTO.setProducerId(String.valueOf(sysUser.getUserId()));
messageEventDTO.setConsumerIds(Sets.newHashSet(sysOaCustomerVisitLog.getAcceptUser()));
messageEventDTO.setMessageEventType(MessageEventType.SEND_VISIT_LOG);
messageEventDTO.setMessageOutsideId(String.valueOf(sysOaCustomerVisitLog.getId()));
applicationContext.publishEvent(messageEventDTO);
}
return toAjax(i);
}
/**
* 修改客户拜访日志
*/
@GetMapping("/visitLogEdit/{id}")
public String visitLogEdit(@PathVariable("id") Long id, ModelMap mmap)
{
SysOaCustomerVisitLog sysOaCustomerVisitLog = sysOaCustomerVisitLogService.selectSysOaCustomerVisitLogById(id);
mmap.put("sysOaCustomerVisitLog", sysOaCustomerVisitLog);
return prefix + "/visitLogEdit";
}
/**
* 修改保存客户拜访日志
*/
@RequiresPermissions("system:customer:visitLogEdit")
@Log(title = "客户拜访日志", businessType = BusinessType.UPDATE)
@PostMapping("/visitLogEdit")
@ResponseBody
public AjaxResult visitLogEditSave(SysOaCustomerVisitLog sysOaCustomerVisitLog)
{
SysUser sysUser = ShiroUtils.getSysUser();
sysUser.setUpdateBy(String.valueOf(sysUser.getUserId()));
return toAjax(sysOaCustomerVisitLogService.updateSysOaCustomerVisitLog(sysOaCustomerVisitLog));
}
/**
* 删除客户拜访日志
*/
@RequiresPermissions("system:customer:visitLogRemove")
@Log(title = "客户拜访日志", businessType = BusinessType.DELETE)
@PostMapping( "/visitLogRemove")
@ResponseBody
public AjaxResult visitLogRemove(String ids)
{
return toAjax(sysOaCustomerVisitLogService.deleteSysOaCustomerVisitLogByIds(ids));
}
}

View File

@ -9,7 +9,7 @@ snow:
# 实例演示开关
demoEnabled: true
# 获取ip地址开关
addressEnabled: false
addressEnabled: true
# 开发环境配置
server:

View File

@ -148,7 +148,7 @@ var table = {
});
return optionsIds.substring(0, optionsIds.length - 1);
},
// 查询条件
// 查询条件queryParams
queryParams: function(params) {
var curParams = {
// 传递参数查询参数
@ -356,9 +356,12 @@ var table = {
search: function(formId, tableId, data) {
table.set(tableId);
var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
console.log(currentId);
var params = $.common.isEmpty(tableId) ? $("#" + table.options.id).bootstrapTable('getOptions') : $("#" + tableId).bootstrapTable('getOptions');
console.log(params);
params.queryParams = function(params) {
var search = $.common.formToJSON(currentId);
console.log("===="+search);
if($.common.isNotEmpty(data)){
$.each(data, function(key) {
search[key] = data[key];

View File

@ -4,65 +4,166 @@
<th:block th:include="include :: header('客户列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="wrapper wrapper-content animated fadeIn" >
<div class="row">
<div class="col-sm-12">
<div class="tabs-container">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">客户公海</a>
</li>
<li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">我的客户</a>
</li>
<li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">黑名单客户</a>
</li>
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane active">
<div class="panel-body">
<div class="col-sm-12 search-collapse">
<form id="formId3">
<div class="select-list">
<ul>
<li>
<label>客户编号:</label>
<input type="text" name="customerNo" id="seasCustomerNo"/>
</li>
<li>
<label>客户名称:</label>
<input type="text" name="customerName" id="seasCustomerName"/>
</li>
<li>
<label>客户状态:</label>
<select name="customerStatus" id="seasCustomerStatus" th:with="type=${@dict.getType('sys_customer_status')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>所属行业:</label>
<select name="customerIndustry" id="seasCustomerIndustry" th:with="type=${@dict.getType('sys_industry_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('formId3','bootstrap-table3')"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar1" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:customer:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:customer:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:customer:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel('formId3')" shiro:hasPermission="system:customer:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table3"></table>
</div>
</div>
</div>
<div id="tab-2" class="tab-pane">
<div class="panel-body">
<div class="col-sm-12 search-collapse">
<form id="formId1">
<div class="select-list">
<ul>
<li>
<label>客户编号:</label>
<input type="text" name="customerNo"/>
</li>
<li>
<label>客户名称:</label>
<input type="text" name="customerName"/>
</li>
<li>
<label>所属行业:</label>
<select name="customerIndustry" th:with="type=${@dict.getType('sys_industry_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('formId1','table1')"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar2" role="group">
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:customer:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table1"></table>
</div>
</div>
</div>
<div id="tab-3" class="tab-pane">
<div class="panel-body">
<div class="col-sm-12 search-collapse">
<form id="formId2">
<div class="select-list">
<ul>
<li>
<label>客户编号:</label>
<input type="text" name="customerNo"/>
</li>
<li>
<label>客户名称:</label>
<input type="text" name="customerName"/>
</li>
<li>
<label>所属行业:</label>
<select name="customerIndustry" th:with="type=${@dict.getType('sys_industry_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('formId2','table1')"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table2"></table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>客户编号:</label>
<input type="text" name="customerNo"/>
</li>
<li>
<label>客户名称:</label>
<input type="text" name="customerName"/>
</li>
<li>
<label>客户状态:</label>
<select name="customerStatus" th:with="type=${@dict.getType('sys_customer_status')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>所属行业:</label>
<select name="customerIndustry" th:with="type=${@dict.getType('sys_industry_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>负责人:</label>
<input type="text" name="customerManager"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:customer:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:customer:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:customer:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:customer:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
@ -70,13 +171,18 @@
var editFlag = [[${@permission.hasPermi('system:customer:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:customer:remove')}]];
var detailFlag = [[${@permission.hasPermi(' system:customer:detail')}]];
var visitLogAdd = [[${@permission.hasPermi('system:customer:visitLogAdd')}]];
var customerStatusDatas = [[${@dict.getType('sys_customer_status')}]];
var customerIndustryDatas = [[${@dict.getType('sys_industry_type')}]];
var visitTypeDatas = [[${@dict.getType('sys_customer_visit_type')}]];
var prefix = ctx + "system/customer";
$(function() {
var options = {
id:"bootstrap-table3",
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
@ -84,6 +190,10 @@
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "客户",
toolbar: "toolbar1",
queryParams:{
"isHighSeas":1
},
columns: [{
checkbox: true
},
@ -101,13 +211,13 @@
field: 'customerName',
title: '客户名称'
},
{
field: 'customerIndustry',
title: '所属行业',
formatter: function(value, row, index) {
return $.table.selectDictLabel(customerIndustryDatas, value);
}
},
{
field: 'customerIndustry',
title: '所属行业',
formatter: function(value, row, index) {
return $.table.selectDictLabel(customerIndustryDatas, value);
}
},
{
field: 'customerAreaCode',
title: '详细地址',
@ -123,10 +233,6 @@
return $.table.selectDictLabel(customerStatusDatas, value);
}
},
{
field: 'customerManagerName',
title: '客户负责人'
},
{
field: 'customerLinkeUser',
title: '联系人'
@ -146,7 +252,239 @@
}]
};
$.table.init(options);
$("#bootstrap-table").bootstrapTable('destroy');
var options1 = {
id: "bootstrap-table1",
url: prefix + "/myList",
createUrl: prefix + "/visitAdd/{id}",
detailUrl: prefix + "/detail/{id}",
toolbar: "toolbar2",
detailView: true,
onExpandRow : function(index, row, $detail) {
initChildTable(index, row, $detail);
},
modalName: "",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键ID',
visible: false
},
{
field: 'customerNo',
title: '客户编号'
},
{
field: 'customerName',
title: '客户名称'
},
{
field: 'customerIndustry',
title: '所属行业',
formatter: function(value, row, index) {
return $.table.selectDictLabel(customerIndustryDatas, value);
}
},
{
field: 'customerAreaCode',
title: '详细地址',
formatter: function(value, row, index) {
var address=row.customerProvinceName+row.customerCityName+row.customerAreaName+row.customerAddress;
return $.table.tooltip(address);
}
},
{
field: 'customerStatus',
title: '客户状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(customerStatusDatas, value);
}
},
{
field: 'customerManagerName',
title: '客户负责人'
},
{
field: 'customerLinkeUser',
title: '联系人'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + visitLogAdd + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.id + '\')"><i class="fa fa-plus"></i>填写日志</a> ');
actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-eye"></i>详情</a> ');
return actions.join('');
}
}]
};
$.table.init(options1);
var options2 = {
id: "bootstrap-table2",
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
detailUrl: prefix + "/detail/{id}",
exportUrl: prefix + "/export",
modalName: "客户",
queryParams:{"customerStatus":"BLACKLIST"},
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键ID',
visible: false
},
{
field: 'customerNo',
title: '客户编号'
},
{
field: 'customerName',
title: '客户名称'
},
{
field: 'customerIndustry',
title: '所属行业',
formatter: function(value, row, index) {
return $.table.selectDictLabel(customerIndustryDatas, value);
}
},
{
field: 'customerAreaCode',
title: '详细地址',
formatter: function(value, row, index) {
var address=row.customerProvinceName+row.customerCityName+row.customerAreaName+row.customerAddress;
return $.table.tooltip(address);
}
},
{
field: 'customerStatus',
title: '客户状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(customerStatusDatas, value);
}
},
{
field: 'customerLinkeUser',
title: '联系人'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-eye"></i>详情</a> ');
if(row.customerStatus=='WAIT_ADMIT') {
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>发起准入流程</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
}
return actions.join('');
}
}]
};
$.table.init(options2);
});
initChildTable = function(index, row, $detail) {
var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');
$(childTable).bootstrapTable({
url: prefix + "/visitLogList",
method: 'post',
sidePagination: "server",
contentType: "application/x-www-form-urlencoded",
queryParams : {
customerNo: row.customerNo
},
columns: [
{
field: 'id',
title: '主键ID',
visible: false
},
{
field: 'index',
align: 'center',
title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
}
},
{
field: 'customerNo',
title: '拜访客户编号'
},
{
field: 'visitType',
title: '拜访类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(visitTypeDatas, value);
}
},
{
field: 'visitContent',
title: '拜访内容',
formatter: function(value, row, index) {
return $.table.tooltip(value);
}
},
{
field: 'visitResult',
title: '拜访结果',
formatter: function(value, row, index) {
return $.table.tooltip(value);
}
},
/* {
field: 'acceptUser',
title: '拜访结果推送人'
},*/
{
field: 'visitTime',
title: '拜访时间'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="editLog(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="removeLog(\''+row.id+'\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
});
};
function removeLog(id) {
$.modal.confirm("确定删除该条拜访记录信息吗?", function() {
var url = prefix + '/visitLogRemove';
$.operate.submit(url, "post", "json", { "ids": id });
});
}
function editLog(id) {
var url = prefix + '/visitLogEdit/'+id;
$.modal.open("修改拜访记录信息", url);
}
</script>
</body>
</html>

View File

@ -12,62 +12,117 @@
</head>
<body class="white-bg" >
<form class="form-horizontal m-t" id="signupForm">
<form class="form-horizontal m-t">
<input name="id" th:value="${sysOaCustomer.id}" type="hidden">
<div class="form-group">
<label class="col-sm-2 control-label">客户编号:</label>
<div class="form-control-static" th:text="${sysOaCustomer.customerNo}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">标题:</label>
<div class="form-control-static" th:text="${sysOaCustomer.customerName}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">所属行业:</label>
<div class="form-control-static" th:text="${@dict.getLabel('sys_industry_type',sysOaCustomer.customerIndustry)}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">详细地址:</label>
<div class="form-control-static" >
[[${sysOaCustomer.customerProvinceName}]][[${sysOaCustomer.customerCityName}]][[${sysOaCustomer.customerAreaName}]][[${sysOaCustomer.customerAddress}]]
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">客户来源:</label>
<div class="form-control-static" th:text="${sysOaCustomer.customerSource}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">客户状态:</label>
<div class="form-control-static" th:text="${@dict.getLabel('sys_customer_status',sysOaCustomer.customerStatus)}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">联系人:</label>
<div class="form-control-static" th:text="${sysOaCustomer.customerLinkeUser}" >
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">联系电话:</label>
<div class="form-control-static" th:text="${sysOaCustomer.customerPhone}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">联系邮箱:</label>
<div class="form-control-static" th:text="${sysOaCustomer.customerEmail}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">客户负责人:</label>
<div class="form-control-static" th:text="${@user.getName(sysOaCustomer.customerManager)}">
</div>
</div>
<h2 class="form-header h2" align="center" >客户信息</h2>
<div class="row">
<div class="col-xs-1 col-sm-1 "></div>
<div class="col-xs-5 col-sm-5 ">
<label class="control-label">客户编号:</label>
<span class="form-control-static" th:text="${sysOaCustomer.customerNo}">
</span>
</div>
<div class="col-xs-5 col-sm-5 ">
<label class="control-label">标题:</label>
<span class="form-control-static" th:text="${sysOaCustomer.customerName}">
</span>
</div>
</div>
<div class="row">
<div class="col-xs-1 col-sm-1 "></div>
<div class="col-xs-5 col-sm-5">
<label class="control-label">所属行业:</label>
<span class="form-control-static" th:text="${@dict.getLabel('sys_industry_type',sysOaCustomer.customerIndustry)}">
</span>
</div>
<div class="col-xs-5 col-sm-5">
<label class="control-label">客户来源:</label>
<span class="form-control-static" th:text="${sysOaCustomer.customerSource}">
</span>
</div>
</div>
<div class="row">
<div class="col-xs-1 col-sm-1 "></div>
<div class="col-xs-5 col-sm-5 ">
<label class="control-label">客户状态:</label>
<span class="form-control-static" th:text="${@dict.getLabel('sys_customer_status',sysOaCustomer.customerStatus)}">
</span>
</div>
<div class="col-xs-5 col-sm-5">
<label class="control-label">联系人:</label>
<span class="form-control-static" th:text="${sysOaCustomer.customerLinkeUser}" >
</span>
</div>
</div>
<div class="row">
<div class="col-xs-1 col-sm-1 "></div>
<div class="col-xs-5 col-sm-5">
<label class=" control-label">联系电话:</label>
<span class="form-control-static" th:text="${sysOaCustomer.customerPhone}">
</span>
</div>
<div class="col-xs-5 col-sm-5">
<label class="control-label">联系邮箱:</label>
<span class="form-control-static" th:text="${sysOaCustomer.customerEmail}">
</span>
</div>
</div>
<div class="row">
<div class="col-xs-1 col-sm-1 "></div>
<div class="col-xs-6 col-sm-6">
<label class="control-label">详细地址:</label>
<span class="form-control-static" >
[[${sysOaCustomer.customerProvinceName}]][[${sysOaCustomer.customerCityName}]][[${sysOaCustomer.customerAreaName}]][[${sysOaCustomer.customerAddress}]]
</span>
</div>
<div class="col-xs-4 col-sm-4" th:if="${sysOaCustomer.customerStatus eq 'ADMITED'} ">
<label class="control-label">客户负责人:</label>
<span class="form-control-static" th:text="${@user.getName(sysOaCustomer.customerManager)}">
</span>
</div>
</div>
<h2 class="form-header h2" align="center" >拜访记录</h2>
<div class=" timeline">
<div class="timeline-item" >
<div class="row" th:each="logs,iterStat:${sysOaCustomerVisitLogs}">
<div class="col-xs-3 date">
<i class="fa fa-phone"></i>
<small class="text-navy" th:text="${#dates.format(logs.visitTime, 'yyyy-MM-dd')}"></small>
</div>
<div class="col-xs-7 content">
<p>
<strong>1.拜访类型:</strong>
<span class="m-b-xs" th:text="${@dict.getLabel('sys_customer_visit_type',logs.visitType)}">
</span>
</p>
<p>
<strong>2.拜访内容:</strong>
</p>
<p class="m-b-xs" th:text="${logs.visitContent}">
</p>
<p>
<strong>3.拜访结果:</strong>
</p>
<p th:text="${logs.visitResult}">
</p>
</div>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
</body>
</html>

View File

@ -0,0 +1,129 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增客户拜访日志')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-log-add">
<input name="customerNo" class="form-control" type="hidden" th:value="${sysOaCustomer.customerNo}" >
<div class="form-group">
<label class="col-sm-3 control-label ">拜访客户:</label>
<div class="col-sm-8">
<input name="customerName" class="form-control" type="text" readonly th:value="${sysOaCustomer.customerName}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">拜访类型:</label>
<div class="col-sm-8">
<select name="visitType" class="form-control m-b" th:with="type=${@dict.getType('sys_customer_visit_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">拜访时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="visitTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">拜访人:</label>
<div class="col-sm-8">
<input name="visitLinkUser" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">联系方式:</label>
<div class="col-sm-8">
<input name="visitLinkPhone" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">拜访内容:</label>
<div class="col-sm-8">
<textarea name="visitContent" class="form-control" required></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">拜访结果:</label>
<div class="col-sm-8">
<textarea name="visitResult" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">附件:</label>
<div class="col-sm-8">
<input type="hidden" name="visitUrl">
<div class="file-loading">
<input class="form-control file-upload" id="visitUrl" name="file" type="file">
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">推送人:</label>
<div class="col-sm-8">
<div class="input-group">
<input class="form-control" type="hidden" name="acceptUser" id="transitionPerson" required>
<input class="form-control" type="text" name="transitionPersonName" onclick="selectUserInfo()" id="transitionPersonName" readonly="true">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
var prefix ="/system/customer"
$("#form-log-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/visitAdd", $('#form-log-add').serialize());
}
}
$("input[name='visitTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$(".file-upload").fileinput({
uploadUrl: '/common/upload',
maxFileCount: 1,
autoReplace: true
}).on('fileuploaded', function (event, data, previewId, index) {
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
}).on('fileremoved', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('')
})
/*选择用户*/
function selectUserInfo() {
var url = "/system/resign/selectUser";
$.modal.open("选择用户",url,"","",doSubmit);
}
function doSubmit(index, layero){
var body = layer.getChildFrame('body', index);
var iframeWin = layero.find('iframe')[0];
iframeWin.contentWindow.submitHandler(index, layero);
$("#transitionPerson").val(body.find('#id').val());
$("#transitionPersonName").val(body.find('#userName').val());
layer.close(index);
}
</script>
</body>
</html>

View File

@ -0,0 +1,103 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改客户拜访日志')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-log-edit" th:object="${sysOaCustomerVisitLog}">
<input name="id" th:field="*{id}" type="hidden">
<input name="customerNo" th:field="*{customerNo}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">拜访类型:电话拜访,实地拜访:</label>
<div class="col-sm-8">
<select name="visitType" class="form-control m-b" th:with="type=${@dict.getType('sys_customer_visit_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{visitType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">拜访内容:</label>
<div class="col-sm-8">
<textarea name="visitContent" class="form-control" required>[[*{visitContent}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">拜访结果:</label>
<div class="col-sm-8">
<textarea name="visitResult" class="form-control">[[*{visitResult}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">拜访附件URL</label>
<div class="col-sm-8">
<input type="hidden" name="visitUrl" th:field="*{visitUrl}">
<div class="file-loading">
<input class="form-control file-upload" id="visitUrl" name="file" type="file">
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">拜访时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="visitTime" th:value="${#dates.format(sysOaCustomerVisitLog.visitTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">联系电话:</label>
<div class="col-sm-8">
<input name="visitLinkPhone" th:field="*{visitLinkPhone}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">联系人:</label>
<div class="col-sm-8">
<input name="visitLinkUser" th:field="*{visitLinkUser}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
var prefix = ctx + "system/customer";
$("#form-log-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/visitLogEdit", $('#form-log-edit').serialize());
}
}
$("input[name='visitTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$(".file-upload").each(function (i) {
var val = $("input[name='" + this.id + "']").val()
$(this).fileinput({
'uploadUrl': '/common/upload',
initialPreviewAsData: true,
initialPreview: [val],
maxFileCount: 1,
autoReplace: true
}).on('fileuploaded', function (event, data, previewId, index) {
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
}).on('fileremoved', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('')
})
$(this).fileinput('_initFileActions');
});
</script>
</body>
</html>

View File

@ -0,0 +1,178 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('离职审批单列表')" />
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeIn">
<div class="row m-b-lg ">
<div class="col-sm-12">
<div class="tabs-container">
<div class="tabs-left">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#tab-1"> 拜访日志</a>
</li>
<li class=""><a data-toggle="tab" href="#tab-2"> 第二个选项卡</a>
</li>
<li class=""><a data-toggle="tab" href="#tab-3"> 第二个选项卡</a>
</li>
<li class=""><a data-toggle="tab" href="#tab-4"> 第二个选项卡</a>
</li>
</ul>
<div class="tab-content ">
<div id="tab-1" class="tab-pane active">
<div class="panel-body">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>拜访日志</h5>
</div>
<div class="ibox-content">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>数据</th>
<th>用户</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td><span class="line">5,3,2,-1,-3,-2,2,3,5,2</span>
</td>
<td>张三</td>
<td class="text-navy"> <i class="fa fa-level-up"></i> 40%</td>
</tr>
<tr>
<td>2</td>
<td><span class="line">5,3,9,6,5,9,7,3,5,2</span>
</td>
<td>李四</td>
<td class="text-warning"> <i class="fa fa-level-down"></i> -20%</td>
</tr>
<tr>
<td>3</td>
<td><span class="line">1,6,3,9,5,9,5,3,9,6,4</span>
</td>
<td>王麻子</td>
<td class="text-navy"> <i class="fa fa-level-up"></i> 26%</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="tab-2" class="tab-pane">
<div class="panel-body">
<strong>栅格系统</strong>
<p>Bootstrap 提供了一套响应式、移动设备优先的流式栅格系统随着屏幕或视口viewport尺寸的增加系统会自动分为最多12列。它包含了易于使用的预定义类还有强大的mixin 用于生成更具语义的布局。</p>
</div>
</div>
<div id="tab-3" class="tab-pane">
<div class="panel-body">
<strong>栅格系统</strong>
<p>Bootstrap 提供了一套响应式、移动设备优先的流式栅格系统随着屏幕或视口viewport尺寸的增加系统会自动分为最多12列。它包含了易于使用的预定义类还有强大的mixin 用于生成更具语义的布局。</p>
</div>
</div>
<div id="tab-4" class="tab-pane">
<div class="panel-body">
<strong>栅格系统</strong>
<p>Bootstrap 提供了一套响应式、移动设备优先的流式栅格系统随着屏幕或视口viewport尺寸的增加系统会自动分为最多12列。它包含了易于使用的预定义类还有强大的mixin 用于生成更具语义的布局。</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:resign:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:resign:remove')}]];
var detailFlag = [[${@permission.hasPermi('system:resign:detail')}]];
var resignTypeDatas = [[${@dict.getType('sys_resign_type')}]];
var processStatusDatas = [[${@dict.getType('process_status')}]];
var prefix = ctx + "system/resign";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
detailUrl: prefix+"/detail/{id}",
modalName: "离职审批单",
columns: [{
checkbox: true
},
{
field: 'id',
title: 'id',
visible: false
},
{
field: 'resignNo',
title: '离职单号'
},
{
field: 'name',
title: '离职标题'
},
{
field: 'transitionPersonName',
title: '交接人'
},
{
field: 'resignTime',
title: '离职时间'
},
{
field: 'resignType',
title: '离职类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(resignTypeDatas, value);
}
},
{
field: 'processStatus',
title: '审批状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processStatusDatas, value);
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
/*if(row.processStatus!=0) {
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="printPur(\'' + row.id + '\')"><i class="fa fa-print"></i>打印</a> ');
}*/
actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-eye"></i>详情</a> ');
if(row.processStatus==0) {
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>发起审批</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
}
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -14,6 +14,9 @@ public enum MessageEventType {
SEND_EMAIL("SEND_EMAIL", "发送邮件"),
MARK_READED("MARK_READED", "标记已读"),
SEND_VISIT_LOG("SEND_VISIT_LOG", "发送拜访日志"),
;

View File

@ -14,7 +14,7 @@ import org.springframework.stereotype.Service;
* @author: 没用的阿吉
* @create: 2021-04-11 17:37
**/
@Service
@Service("customerErrorEndListener")
@Slf4j
public class CustomerErrorEndListener extends AbstractExecutionListener<SysOaCustomerForm> {

View File

@ -0,0 +1,79 @@
package com.snow.framework.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2021-04-17 12:17
**/
@MappedTypes(String[].class)
@MappedJdbcTypes({JdbcType.VARCHAR})
@Slf4j
public class JsonStringArrayTypeHandler extends BaseTypeHandler<String[]> {
private static final ObjectMapper mapper=new ObjectMapper();
/**
* 将数组以字符串的形式存在数据库
* @param preparedStatement
* @param i
* @param parameter
* @param jdbcType
* @throws SQLException
*/
@Override
public void setNonNullParameter(PreparedStatement preparedStatement, int i, String[] parameter, JdbcType jdbcType) throws SQLException {
log.info("存入数据库的数组数据:{}",toJson(parameter));
preparedStatement.setString(i,toJson(parameter));
}
@Override
public String[] getNullableResult(ResultSet resultSet, String columnName) throws SQLException {
log.info("读取数据库的数据columnName:{}",resultSet.getString(columnName));
return this.toObject(resultSet.getString(columnName));
}
@Override
public String[] getNullableResult(ResultSet resultSet, int columnIndex) throws SQLException {
log.info("读取数据库的数据columnIndex:{}",resultSet.getString(columnIndex));
return this.toObject(resultSet.getString(columnIndex));
}
@Override
public String[] getNullableResult(CallableStatement callableStatement, int columnIndex) throws SQLException {
log.info("读取数据库的数据callableStatement:{}",callableStatement.getString(columnIndex));
return this.toObject(callableStatement.getString(columnIndex));
}
private String toJson(String[] parameter){
try {
return mapper.writeValueAsString(parameter);
} catch (Exception e) {
e.printStackTrace();
}
return "[]";
}
private String[] toObject(String content){
if(content!=null&&!content.isEmpty()){
try {
return(String[]) mapper.readValue(content,String[].class);
} catch (Exception e) {
throw new RuntimeException(e);
}
}else {
return null;
}
}
}

View File

@ -4,6 +4,7 @@ import com.snow.common.utils.StringUtils;
import com.snow.framework.web.domain.common.MessageEventDTO;
import com.snow.framework.web.message.consumer.SysMarkReadedStrategy;
import com.snow.framework.web.message.producer.SysSendEmailStrategy;
import com.snow.framework.web.message.producer.SysSendVisitLogStrategy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
@ -38,6 +39,9 @@ public class MessageEventHandler implements ApplicationListener<MessageEventDTO>
case "MARK_READED":
messageEventContext.setMessageEventTypeStrategy(new SysMarkReadedStrategy());
break;
case "SEND_VISIT_LOG":
messageEventContext.setMessageEventTypeStrategy(new SysSendVisitLogStrategy());
break;
default:

View File

@ -0,0 +1,39 @@
package com.snow.framework.web.message.producer;
import cn.hutool.core.bean.BeanUtil;
import com.snow.common.enums.MessageEventType;
import com.snow.common.utils.spring.SpringUtils;
import com.snow.framework.web.domain.common.MessageEventDTO;
import com.snow.framework.web.message.MessageEventStrategy;
import com.snow.system.domain.SysMessageTransition;
import com.snow.system.service.ISysMessageTransitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Set;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2021-04-17 12:46
**/
@Component
public class SysSendVisitLogStrategy implements MessageEventStrategy {
@Autowired
private ISysMessageTransitionService messageTransitionService=SpringUtils.getBean(ISysMessageTransitionService.class);
@Override
public void messageHandle(MessageEventDTO messageEvent) {
SysMessageTransition sysMessageTransition=new SysMessageTransition();
BeanUtil.copyProperties(messageEvent,sysMessageTransition);
sysMessageTransition.setMessageType(MessageEventType.SEND_VISIT_LOG.getCode());
Set<String> consumerId = messageEvent.getConsumerIds();
consumerId.forEach(t->{
sysMessageTransition.setConsumerId(t);
messageTransitionService.insertSysMessageTransition(sysMessageTransition);
});
}
}

View File

@ -91,4 +91,9 @@ public class SysOaCustomer extends BaseEntity
@Excel(name = "删除标识")
private Long isDelete;
/**
* 0--不是公海1--公海
*/
private Integer isHighSeas=0;
}

View File

@ -0,0 +1,65 @@
package com.snow.system.domain;
import java.util.Date;
import com.snow.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 客户拜访日志对象 sys_oa_customer_visit_log
*
* @author 没用的阿吉
* @date 2021-04-14
*/
@Data
public class SysOaCustomerVisitLog extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 拜访客户编号 */
@Excel(name = "拜访客户编号")
private String customerNo;
/** 拜访内容 */
@Excel(name = "拜访内容")
private String visitContent;
/** 拜访类型:电话拜访,实地拜访 */
@Excel(name = "拜访类型:电话拜访,实地拜访")
private String visitType;
/** 拜访结果 */
@Excel(name = "拜访结果")
private String visitResult;
/** 拜访附件URL */
@Excel(name = "拜访附件URL")
private String visitUrl;
/** 拜访结果推送人 */
@Excel(name = "拜访结果推送人")
private String[] acceptUser;
/** 拜访时间 */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@Excel(name = "拜访时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date visitTime;
/** 联系电话 */
@Excel(name = "联系电话")
private String visitLinkPhone;
/** 联系人 */
@Excel(name = "联系人")
private String visitLinkUser;
/** 删除标识 */
private Long isDelete;
}

View File

@ -0,0 +1,61 @@
package com.snow.system.mapper;
import java.util.List;
import com.snow.system.domain.SysOaCustomerVisitLog;
/**
* 客户拜访日志Mapper接口
*
* @author 没用的阿吉
* @date 2021-04-14
*/
public interface SysOaCustomerVisitLogMapper
{
/**
* 查询客户拜访日志
*
* @param id 客户拜访日志ID
* @return 客户拜访日志
*/
public SysOaCustomerVisitLog selectSysOaCustomerVisitLogById(Long id);
/**
* 查询客户拜访日志列表
*
* @param sysOaCustomerVisitLog 客户拜访日志
* @return 客户拜访日志集合
*/
public List<SysOaCustomerVisitLog> selectSysOaCustomerVisitLogList(SysOaCustomerVisitLog sysOaCustomerVisitLog);
/**
* 新增客户拜访日志
*
* @param sysOaCustomerVisitLog 客户拜访日志
* @return 结果
*/
public int insertSysOaCustomerVisitLog(SysOaCustomerVisitLog sysOaCustomerVisitLog);
/**
* 修改客户拜访日志
*
* @param sysOaCustomerVisitLog 客户拜访日志
* @return 结果
*/
public int updateSysOaCustomerVisitLog(SysOaCustomerVisitLog sysOaCustomerVisitLog);
/**
* 删除客户拜访日志
*
* @param id 客户拜访日志ID
* @return 结果
*/
public int deleteSysOaCustomerVisitLogById(Long id);
/**
* 批量删除客户拜访日志
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysOaCustomerVisitLogByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.snow.system.service;
import java.util.List;
import com.snow.system.domain.SysOaCustomerVisitLog;
/**
* 客户拜访日志Service接口
*
* @author 没用的阿吉
* @date 2021-04-14
*/
public interface ISysOaCustomerVisitLogService
{
/**
* 查询客户拜访日志
*
* @param id 客户拜访日志ID
* @return 客户拜访日志
*/
public SysOaCustomerVisitLog selectSysOaCustomerVisitLogById(Long id);
/**
* 查询客户拜访日志列表
*
* @param sysOaCustomerVisitLog 客户拜访日志
* @return 客户拜访日志集合
*/
public List<SysOaCustomerVisitLog> selectSysOaCustomerVisitLogList(SysOaCustomerVisitLog sysOaCustomerVisitLog);
/**
* 新增客户拜访日志
*
* @param sysOaCustomerVisitLog 客户拜访日志
* @return 结果
*/
public int insertSysOaCustomerVisitLog(SysOaCustomerVisitLog sysOaCustomerVisitLog);
/**
* 修改客户拜访日志
*
* @param sysOaCustomerVisitLog 客户拜访日志
* @return 结果
*/
public int updateSysOaCustomerVisitLog(SysOaCustomerVisitLog sysOaCustomerVisitLog);
/**
* 批量删除客户拜访日志
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysOaCustomerVisitLogByIds(String ids);
/**
* 删除客户拜访日志信息
*
* @param id 客户拜访日志ID
* @return 结果
*/
public int deleteSysOaCustomerVisitLogById(Long id);
}

View File

@ -0,0 +1,102 @@
package com.snow.system.service.impl;
import com.snow.common.core.text.Convert;
import com.snow.common.utils.DateUtils;
import com.snow.system.domain.SysOaCustomerVisitLog;
import com.snow.system.mapper.SysOaCustomerVisitLogMapper;
import com.snow.system.service.ISysOaCustomerVisitLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 客户拜访日志Service业务层处理
*
* @author 没用的阿吉
* @date 2021-04-14
*/
@Service
public class SysOaCustomerVisitLogServiceImpl implements ISysOaCustomerVisitLogService
{
@Autowired
private SysOaCustomerVisitLogMapper sysOaCustomerVisitLogMapper;
/**
* 查询客户拜访日志
*
* @param id 客户拜访日志ID
* @return 客户拜访日志
*/
@Override
public SysOaCustomerVisitLog selectSysOaCustomerVisitLogById(Long id)
{
return sysOaCustomerVisitLogMapper.selectSysOaCustomerVisitLogById(id);
}
/**
* 查询客户拜访日志列表
*
* @param sysOaCustomerVisitLog 客户拜访日志
* @return 客户拜访日志
*/
@Override
public List<SysOaCustomerVisitLog> selectSysOaCustomerVisitLogList(SysOaCustomerVisitLog sysOaCustomerVisitLog)
{
return sysOaCustomerVisitLogMapper.selectSysOaCustomerVisitLogList(sysOaCustomerVisitLog);
}
/**
* 新增客户拜访日志
*
* @param sysOaCustomerVisitLog 客户拜访日志
* @return 结果
*/
@Override
public int insertSysOaCustomerVisitLog(SysOaCustomerVisitLog sysOaCustomerVisitLog)
{
sysOaCustomerVisitLog.setCreateTime(DateUtils.getNowDate());
sysOaCustomerVisitLog.setUpdateTime(DateUtils.getNowDate());
return sysOaCustomerVisitLogMapper.insertSysOaCustomerVisitLog(sysOaCustomerVisitLog);
}
/**
* 修改客户拜访日志
*
* @param sysOaCustomerVisitLog 客户拜访日志
* @return 结果
*/
@Override
public int updateSysOaCustomerVisitLog(SysOaCustomerVisitLog sysOaCustomerVisitLog)
{
sysOaCustomerVisitLog.setUpdateTime(DateUtils.getNowDate());
return sysOaCustomerVisitLogMapper.updateSysOaCustomerVisitLog(sysOaCustomerVisitLog);
}
/**
* 删除客户拜访日志对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSysOaCustomerVisitLogByIds(String ids)
{
return sysOaCustomerVisitLogMapper.deleteSysOaCustomerVisitLogByIds(Convert.toStrArray(ids));
}
/**
* 删除客户拜访日志信息
*
* @param id 客户拜访日志ID
* @return 结果
*/
@Override
public int deleteSysOaCustomerVisitLogById(Long id)
{
return sysOaCustomerVisitLogMapper.deleteSysOaCustomerVisitLogById(id);
}
}

View File

@ -52,7 +52,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customerIndustry != null and customerIndustry != ''"> and customer_industry = #{customerIndustry}</if>
<if test="customerManager != null and customerManager != ''"> and customer_manager = #{customerManager}</if>
<if test="customerLinkeUser != null and customerLinkeUser != ''"> and customer_linke_user = #{customerLinkeUser}</if>
<if test="isHighSeas == 1"> and (customer_status = 'WAIT_ADMIT' or customer_status='ADMIT_ING') </if>
</where>
order by update_time desc
</select>
<select id="selectSysOaCustomerById" parameterType="Long" resultMap="SysOaCustomerResult">

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.snow.system.mapper.SysOaCustomerVisitLogMapper">
<resultMap type="SysOaCustomerVisitLog" id="SysOaCustomerVisitLogResult">
<result property="id" column="id" />
<result property="customerNo" column="customer_no" />
<result property="visitContent" column="visit_content" />
<result property="visitType" column="visit_type" />
<result property="visitResult" column="visit_result" />
<result property="visitUrl" column="visit_url" />
<result property="acceptUser" column="accept_user" typeHandler="com.snow.framework.config.JsonStringArrayTypeHandler" />
<result property="visitTime" column="visit_time" />
<result property="visitLinkPhone" column="visit_link_phone" />
<result property="visitLinkUser" column="visit_link_user" />
<result property="createBy" column="create_by" />
<result property="isDelete" column="is_delete" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSysOaCustomerVisitLogVo">
select id, customer_no, visit_content, visit_type, visit_result, visit_url, accept_user, visit_time, visit_link_phone, visit_link_user, create_by, is_delete, create_time, update_by, update_time from sys_oa_customer_visit_log
</sql>
<select id="selectSysOaCustomerVisitLogList" parameterType="SysOaCustomerVisitLog" resultMap="SysOaCustomerVisitLogResult">
<include refid="selectSysOaCustomerVisitLogVo"/>
<where>
<if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo}</if>
<if test="visitContent != null and visitContent != ''"> and visit_content = #{visitContent}</if>
<if test="visitType != null and visitType != ''"> and visit_type = #{visitType}</if>
<if test="visitResult != null and visitResult != ''"> and visit_result = #{visitResult}</if>
<if test="visitUrl != null and visitUrl != ''"> and visit_url = #{visitUrl}</if>
<if test="acceptUser != null and acceptUser != ''"> and accept_user = #{acceptUser}</if>
<if test="visitTime != null "> and visit_time = #{visitTime}</if>
<if test="visitLinkPhone != null and visitLinkPhone != ''"> and visit_link_phone = #{visitLinkPhone}</if>
<if test="visitLinkUser != null and visitLinkUser != ''"> and visit_link_user = #{visitLinkUser}</if>
</where>
order by visit_time desc
</select>
<select id="selectSysOaCustomerVisitLogById" parameterType="Long" resultMap="SysOaCustomerVisitLogResult">
<include refid="selectSysOaCustomerVisitLogVo"/>
where id = #{id}
</select>
<insert id="insertSysOaCustomerVisitLog" parameterType="SysOaCustomerVisitLog" useGeneratedKeys="true" keyProperty="id">
insert into sys_oa_customer_visit_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerNo != null and customerNo != ''">customer_no,</if>
<if test="visitContent != null and visitContent != ''">visit_content,</if>
<if test="visitType != null">visit_type,</if>
<if test="visitResult != null">visit_result,</if>
<if test="visitUrl != null">visit_url,</if>
<if test="acceptUser != null">accept_user,</if>
<if test="visitTime != null">visit_time,</if>
<if test="visitLinkPhone != null">visit_link_phone,</if>
<if test="visitLinkUser != null">visit_link_user,</if>
<if test="createBy != null">create_by,</if>
<if test="isDelete != null">is_delete,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerNo != null and customerNo != ''">#{customerNo},</if>
<if test="visitContent != null and visitContent != ''">#{visitContent},</if>
<if test="visitType != null">#{visitType},</if>
<if test="visitResult != null">#{visitResult},</if>
<if test="visitUrl != null">#{visitUrl},</if>
<if test="acceptUser != null">#{acceptUser,typeHandler=com.snow.framework.config.JsonStringArrayTypeHandler},</if>
<if test="visitTime != null">#{visitTime},</if>
<if test="visitLinkPhone != null">#{visitLinkPhone},</if>
<if test="visitLinkUser != null">#{visitLinkUser},</if>
<if test="createBy != null">#{createBy},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSysOaCustomerVisitLog" parameterType="SysOaCustomerVisitLog">
update sys_oa_customer_visit_log
<trim prefix="SET" suffixOverrides=",">
<if test="customerNo != null and customerNo != ''">customer_no = #{customerNo},</if>
<if test="visitContent != null and visitContent != ''">visit_content = #{visitContent},</if>
<if test="visitType != null">visit_type = #{visitType},</if>
<if test="visitResult != null">visit_result = #{visitResult},</if>
<if test="visitUrl != null">visit_url = #{visitUrl},</if>
<if test="acceptUser != null">accept_user = #{acceptUser,typeHandler=com.snow.framework.config.JsonStringArrayTypeHandler},</if>
<if test="visitTime != null">visit_time = #{visitTime},</if>
<if test="visitLinkPhone != null">visit_link_phone = #{visitLinkPhone},</if>
<if test="visitLinkUser != null">visit_link_user = #{visitLinkUser},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysOaCustomerVisitLogById" parameterType="Long">
delete from sys_oa_customer_visit_log where id = #{id}
</delete>
<delete id="deleteSysOaCustomerVisitLogByIds" parameterType="String">
delete from sys_oa_customer_visit_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>