Commit 31b54800 authored by zoujintao's avatar zoujintao

【ID1003045】 排班管理

parent 2b5256cb
...@@ -19,6 +19,7 @@ public class DutyStaffEntity extends DomainObject { ...@@ -19,6 +19,7 @@ public class DutyStaffEntity extends DomainObject {
private String userId; private String userId;
private String onduty; private String onduty;
private Date updateTime; private Date updateTime;
private Integer order;
public Date getUpdateTime() { public Date getUpdateTime() {
return updateTime; return updateTime;
...@@ -51,4 +52,12 @@ public class DutyStaffEntity extends DomainObject { ...@@ -51,4 +52,12 @@ public class DutyStaffEntity extends DomainObject {
public void setOnduty(String onduty) { public void setOnduty(String onduty) {
this.onduty = onduty; this.onduty = onduty;
} }
public Integer getOrder() {
return order;
}
public void setOrder(Integer order) {
this.order = order;
}
} }
...@@ -520,7 +520,7 @@ public class UserController extends BaseController { ...@@ -520,7 +520,7 @@ public class UserController extends BaseController {
UserEntity userEntity = (UserEntity) httpRequest.getSession().getAttribute(SessionConstants.THREAD_USER_KEY); UserEntity userEntity = (UserEntity) httpRequest.getSession().getAttribute(SessionConstants.THREAD_USER_KEY);
//获取更新前用户信息 //获取更新前用户信息
UserEntity oldEntity = user.getById(entity.getId()); UserEntity oldEntity = user.getById(entity.getId());
UserEntity tempOldEntity=(UserEntity)oldEntity.clone(); UserEntity tempOldEntity = (UserEntity) oldEntity.clone();
oldEntity.setUpdateUserid(entity.getId()); oldEntity.setUpdateUserid(entity.getId());
oldEntity.setUpdateUsername(entity.getName()); oldEntity.setUpdateUsername(entity.getName());
oldEntity.setUpdateTime(new Date()); oldEntity.setUpdateTime(new Date());
...@@ -557,7 +557,7 @@ public class UserController extends BaseController { ...@@ -557,7 +557,7 @@ public class UserController extends BaseController {
//改变用户名需要同步给im //改变用户名需要同步给im
String env = MemoryPropertyPlaceholderConfigurer.getContextProperty("system.env"); String env = MemoryPropertyPlaceholderConfigurer.getContextProperty("system.env");
if ("production".equalsIgnoreCase(env) && !oldEntity.getRealName().equals(entity.getRealName())) { if ("production".equalsIgnoreCase(env) && !oldEntity.getRealName().equals(entity.getRealName())) {
if(org.apache.commons.lang.StringUtils.isNotBlank(oldEntity.getAccId())){ if (org.apache.commons.lang.StringUtils.isNotBlank(oldEntity.getAccId())) {
String token = getImToken(); String token = getImToken();
List<NameValuePair> cornetInParam = new ArrayList<>(); List<NameValuePair> cornetInParam = new ArrayList<>();
cornetInParam.add(new BasicNameValuePair("accid", oldEntity.getAccId())); cornetInParam.add(new BasicNameValuePair("accid", oldEntity.getAccId()));
...@@ -568,32 +568,33 @@ public class UserController extends BaseController { ...@@ -568,32 +568,33 @@ public class UserController extends BaseController {
} }
//获取用户的头像 //获取用户的头像
AttachmentListResponse headImgRes = attachmentInterface.queryByResourceIdAndResouceType(String.valueOf(id), "hgs_user_headImg"); AttachmentListResponse headImgRes = attachmentInterface.queryByResourceIdAndResouceType(String.valueOf(id), "hgs_user_headImg");
String headImgURL=null; String headImgURL = null;
if (null != headImgRes.getObjectList() && !headImgRes.getObjectList().isEmpty()) { if (null != headImgRes.getObjectList() && !headImgRes.getObjectList().isEmpty()) {
BaseAttachment attachment = (BaseAttachment) headImgRes.getObjectList().get(0); BaseAttachment attachment = (BaseAttachment) headImgRes.getObjectList().get(0);
headImgURL=attachment.getRemotePath(); headImgURL = attachment.getRemotePath();
} }
//调用团立方接口,同步修改的数据团立方,修改手机号或者姓名才发送数据 //调用团立方接口,同步修改的数据团立方,修改手机号或者姓名才发送数据
JsonConfig jsonConfig=new JsonConfig(); JsonConfig jsonConfig = new JsonConfig();
jsonConfig.registerDefaultValueProcessor(Integer.class, new DefaultValueProcessor() { jsonConfig.registerDefaultValueProcessor(Integer.class, new DefaultValueProcessor() {
@Override @Override
public Object getDefaultValue(Class type) { public Object getDefaultValue(Class type) {
return null; return null;
}}); }
});
jsonConfig.registerDefaultValueProcessor(String.class, new DefaultValueProcessor() { jsonConfig.registerDefaultValueProcessor(String.class, new DefaultValueProcessor() {
@Override @Override
public Object getDefaultValue(Class type) { public Object getDefaultValue(Class type) {
return null; return null;
} }
}); });
if(!entity.getRealName().equals(tempOldEntity.getRealName())||!entity.getMobile().equals(tempOldEntity.getMobile())) { if (!entity.getRealName().equals(tempOldEntity.getRealName()) || !entity.getMobile().equals(tempOldEntity.getMobile())) {
MessageDto mdto=new MessageDto(); MessageDto mdto = new MessageDto();
mdto.setUserId(entity.getId()); mdto.setUserId(entity.getId());
mdto.setAccid(oldEntity.getAccId()); mdto.setAccid(oldEntity.getAccId());
mdto.setName(entity.getRealName()); mdto.setName(entity.getRealName());
mdto.setTel(entity.getMobile()); mdto.setTel(entity.getMobile());
mdto.setAvatar(headImgURL); mdto.setAvatar(headImgURL);
String messObj = JSONObject.fromObject(mdto,jsonConfig).toString(); String messObj = JSONObject.fromObject(mdto, jsonConfig).toString();
logger.info("******SYNC_TO_TRL*******" + messObj); logger.info("******SYNC_TO_TRL*******" + messObj);
String res = HttpClientUtil.doPostJson(tlfSendMessageUrl, messObj, ""); String res = HttpClientUtil.doPostJson(tlfSendMessageUrl, messObj, "");
logger.info("******SYNC_TO_TRL_RESULT*******" + res); logger.info("******SYNC_TO_TRL_RESULT*******" + res);
...@@ -657,7 +658,7 @@ public class UserController extends BaseController { ...@@ -657,7 +658,7 @@ public class UserController extends BaseController {
} }
//针对该用户在平台管理中是否有客户进行判断设置值 //针对该用户在平台管理中是否有客户进行判断设置值
int countInfo = customer.queryCountById(userEntity.getId()); int countInfo = customer.queryCountById(userEntity.getId());
userVo.setHasCustomersInPlatform(countInfo>0); userVo.setHasCustomersInPlatform(countInfo > 0);
lstUserVo.add(userVo); lstUserVo.add(userVo);
} }
} }
...@@ -1127,20 +1128,20 @@ public class UserController extends BaseController { ...@@ -1127,20 +1128,20 @@ public class UserController extends BaseController {
* @param id 账户页面表单对象唯一标识 * @param id 账户页面表单对象唯一标识
* @return 用户的绑定信息结果 * @return 用户的绑定信息结果
*/ */
@RequestMapping(value = "/bindPeople/{id}",method = RequestMethod.GET) @RequestMapping(value = "/bindPeople/{id}", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ResponseBody @ResponseBody
public HResult getBindPeopleInfo(@PathVariable String id) { public HResult getBindPeopleInfo(@PathVariable String id) {
HResult result = new HResult(); HResult result = new HResult();
try { try {
Map<String, String> paramMap =new HashMap<>(); Map<String, String> paramMap = new HashMap<>();
paramMap.put("userId",id); paramMap.put("userId", id);
//通过http调用接口获取用户绑定楼盘信息 //通过http调用接口获取用户绑定楼盘信息
String res=HttpUtil.simpleGet(tlfBandPeopleUrl,paramMap,null); String res = HttpUtil.simpleGet(tlfBandPeopleUrl, paramMap, null);
HResult finalInfo=JSON.parse(res,HResult.class); HResult finalInfo = JSON.parse(res, HResult.class);
result.setStatus(finalInfo.getStatus()); result.setStatus(finalInfo.getStatus());
result.setData(finalInfo.getData()); result.setData(finalInfo.getData());
logger.info(id+" bindpeopleInfo:"+finalInfo.getData()); logger.info(id + " bindpeopleInfo:" + finalInfo.getData());
} catch (Exception e) { } catch (Exception e) {
result.setStatus(-1); result.setStatus(-1);
result.setErrorMessage("获取绑定用户信息失败"); result.setErrorMessage("获取绑定用户信息失败");
...@@ -1151,9 +1152,12 @@ public class UserController extends BaseController { ...@@ -1151,9 +1152,12 @@ public class UserController extends BaseController {
} }
@RequestMapping(value = "pblist", method = RequestMethod.GET) @RequestMapping(value = "pblist", method = RequestMethod.GET)
public String pbList( HttpServletRequest request, Model model) { public String pbList(HttpServletRequest request, Model model) {
//共多少条数据,今日新增多少条 //共多少条数据,今日新增多少条
String cityCode = (String) request.getSession().getAttribute(SessionConstants.SESSION_CITY_KEY); String cityCode = (String) request.getSession().getAttribute(SessionConstants.SESSION_CITY_KEY);
if (cityCode.equals("zb")) {
return getAutoUrl("pblist");
}
List<UserEntity> users = this.user.getDutyUserByCity(cityCode); List<UserEntity> users = this.user.getDutyUserByCity(cityCode);
List<UserVo> collect = users.stream().map(i -> { List<UserVo> collect = users.stream().map(i -> {
...@@ -1165,4 +1169,46 @@ public class UserController extends BaseController { ...@@ -1165,4 +1169,46 @@ public class UserController extends BaseController {
model.addAttribute("users", collect); model.addAttribute("users", collect);
return getAutoUrl("pblist"); return getAutoUrl("pblist");
} }
@RequestMapping(value = "/deleteDutyById/{userId}")
public void deleteDutyById(@PathVariable Integer userId) {
//共多少条数据,今日新增多少条
user.deleteDutyById(userId);
}
/**
* 新增的时候通过city查询用户
*
* @param model
* @param request
* @return
*/
@RequestMapping(value = "/userByCity")
public String userByCity(Model model, HttpServletRequest request) {
String cityCode = (String) request.getSession().getAttribute(SessionConstants.SESSION_CITY_KEY);
List<UserEntity> userByCity = user.getUserByCity(cityCode);
model.addAttribute("userByCity", userByCity);
return getAutoUrl("plform");
}
@RequestMapping(value = "/addDuty/{id_name}/{order}")
public void addDuty( @PathVariable("id_name") String id_name,
@PathVariable("order") Integer order) {
user.addDuty(id_name, order);
}
@RequestMapping(value = "/pbelist/{userId}")
public String pbelist(Model model, @PathVariable Integer userId) {
DutyStaffEntity entity = user.pbelist(userId);
model.addAttribute("entity", entity);
return getAutoUrl("pleform");
}
@RequestMapping(value = "/updateDuty/{userId}/{order}")
public void updateDuty( @PathVariable Integer userId, @PathVariable Integer order) {
user.updateDuty(order, userId);
}
} }
...@@ -110,13 +110,14 @@ ...@@ -110,13 +110,14 @@
</head> </head>
<body> <body>
<%@include file="/WEB-INF/common/layouts/topbar.jsp" %>
<!-- 面包屑 begin --> <!-- 面包屑 begin -->
<div class="container" style="width: 1200px;"> <div class="container" style="width: 1200px;">
<div class="row${fluid}"> <div class="row${fluid}">
<div class="span12"> <div class="span12">
<form id="filterForm" class="form-inline filterForm" action="${ctx}/user/" method="get"> <form id="filterForm" class="form-inline filterForm" action="${ctx}/user/" method="get">
<div class="buttons pull-right" style="margin-left:15px;"> <div class="buttons pull-right" style="margin-left:15px;">
<a href="${ctx}/user/?action=create" class="btn blue pull-right" title="新增"><i <a href="${ctx}/user/userByCity" class="btn blue pull-right" title="新增"><i
class="icon-plus"></i></a> class="icon-plus"></i></a>
</div> </div>
</form> </form>
...@@ -164,16 +165,14 @@ ...@@ -164,16 +165,14 @@
</c:choose> </c:choose>
</td> </td>
<%-- <shiro:hasPermission name="USER_EDIT"> --%>
<td nowrap="nowrap"> <td nowrap="nowrap">
<%--<i class="icon-edit pointer icon-large" title="编辑"--%>
<%--onclick="window.location='${ctx}/user/${user.entity.id}?action=edit'"></i>--%> <a href="${ctx}/user/pbelist/${user.entity.id}" class="icon-edit pointer icon-large" title="编辑"></a>
<i class="icon-edit pointer icon-large" title="编辑" &nbsp; &nbsp;&nbsp;
onclick="goEdit(${user.entity.id})"></i> <button class="icon-minus pointer icon-large"
&nbsp;&nbsp; onclick="deleteByIds(${user.entity.id}, ${user.entity.enabled})">删除
<i title="删除" </button>
class="icon-minus pointer icon-large"
onclick="deleteById('${user.entity.id}', ${user.hasCustomers},${user.hasCustomersInPlatform})"> </i>
</tr> </tr>
</c:forEach> </c:forEach>
...@@ -206,391 +205,50 @@ ...@@ -206,391 +205,50 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).keydown(function (event) { function goEdit(userId) {
if (event.keyCode == "13") {
//回车执行查询
$('#filterForm').submit();
}
});
function identityIM(uid, mobile) {
$.ajax({ $.ajax({
url: '${ctx}/user/judgeAdmin', url: '${ctx}/user/pbelist/' + userId,
type: 'GET', type: 'GET',
contentType: 'application/json', contentType: 'application/json',
data: '',
dataType: 'json', dataType: 'json',
cache: false, cache: false,
success: function (result) { async: false,
debugger; success: function (res) {
if (result.status != 0) {
$("#kefu").css("display", "none");
$("#fbs").css("display", "none");
}
var choosemask = document.getElementById("choosemask");
choosemask.style.display = "block";
$("#uid").val(uid);
$("#mobile").val(mobile);
}
});
}
function saveIM(identityType) { },
var userId = $("#uid").val(); error: function () {
var mobile = $("#mobile").val();
$.ajax({
url: '${ctx}/user/saveIM',
data: {"userId": userId, "mobile": mobile, "identityType": identityType},
type: "GET",
success: function () {
window.location.reload();
}
});
}
function hiddenChoosemask() {
var obj = document.getElementById("choosemask");
obj.style.display = "none";
}
function lock(obj) {
debugger;
if (obj == 257) {
alert("appstore账户,请勿操作");
return;
}
$.ajax({
url: '${ctx}/user/lock/' + obj,
type: "GET",
success: function () {
window.location.reload();
} }
}); });
} }
function unlock(obj) { function deleteByIds(userId, enabled) {
$.ajax({ if (enabled == 1) {
url: '${ctx}/user/unlock/' + obj, alert("当前值班人员不可删除!!!")
type: "GET", return
success: function () {
window.location.reload();
}
});
} }
var b = confirm("是否删除该员工的排班信息,删除后不可恢复!!!");
function goEdit(id) {
debugger; debugger;
if (id == 257) { if (b == true) {
alert("appstore账户,请勿操作"); //发送请求
return;
}
var url = "/house365-hgs-web/user/" + id + "?action=edit";
window.location = url;
// window.location.href = url;
<%--window.location='${ctx}/user/ + "" id + "" + ?action=edit';--%>
}
//全选
function checkAll(btn) {
if (btn.checked) {
for (i = 0; i < document.all("memberCheck").length; i++) {
document.all("memberCheck")[i].checked = "checked";
}
}
else {
for (i = 0; i < document.all("memberCheck").length; i++) {
document.all("memberCheck")[i].checked = "";
}
}
}
//单选
function checkMember(btn) {
if (btn.checked) {
var checkAll = true;
for (i = 0; i < document.all("memberCheck").length; i++) {
if (document.all("memberCheck")[i].checked == false) {
checkAll = false;
}
}
if (checkAll) {
document.getElementById("memberCheckAll").checked = true;
}
}
else {
document.getElementById("memberCheckAll").checked = false;
}
}
var deleteById = function (selectedId, hasCustomers,hasCustomersInPlatform) {
var localHasCustomers = false;
/*
id为空则是多选 判断是否为空
为空 提示选择
不为空 确认后删除
不为空单选确认后删除
*/
if (selectedId == "") {
for (i = 0; i < document.getElementsByName('memberCheck').length; i++) {
if (document.getElementsByName('memberCheck')[i].checked) {
selectedId += document.getElementsByName('memberCheck')[i].value + ",";
if ($("input[name='memberCheck']")[i].dataset.hascustomers == "true") {
localHasCustomers = true;
}
}
}
var str = "";
if (selectedId != "") {
str = selectedId.split(",");
if (str[str.length - 1] == "") {
selectedId = selectedId.substring(0, selectedId.length - 1);
}
}
}
if (selectedId == "") {
House365Util.createModal("删除员工", "请至少选择一条员工!", function () {
});
} else {
if (hasCustomers || localHasCustomers) {
House365Util.createModal("删除员工", "员工名下还有客户,请转移交接给其他置业顾问后再删除。", function () {
});
}else if(hasCustomersInPlatform){
House365Util.createModal("删除员工", "员工名下还有客户,请转移交接给其他平台人员后再删除。", function () {
});
} else {
//获取删除用户的绑定楼盘信息
$.ajax({
url: '${ctx}/user/bindPeople/' + selectedId,
type: "GET",
success: function (result) {
console.info(result.data)
if (result.status == 0) {
if(result.data!=null && result.data.length>0){
//员工有绑定的楼盘,不能删除
alert("请在团立方后台解绑该顾问");
return;
}else {
House365Util.createModal("删除员工", "删除后将无法恢复员工账号,请确认是否继续?", function () {
debugger;
if (selectedId.includes("257") == true) {
alert("appstore账户,请勿操作");
return;
}
$.ajax({
url: '${ctx}/user/' + selectedId,
type: "DELETE",
success: function () {
$("input[name='memberCheck']").removeAttr("checked");
window.location.reload();
}
});
});
}
}else{
alert(result.errorMessage);
}
}
});
<%--House365Util.createModal("删除员工", "删除后将无法恢复员工账号,请确认是否继续?", function () {--%>
<%-- debugger;--%>
<%-- if (selectedId.includes("257") == true) {--%>
<%-- alert("appstore账户,请勿操作");--%>
<%-- return;--%>
<%-- }--%>
<%-- $.ajax({--%>
<%-- url: '${ctx}/user/' + selectedId,--%>
<%-- type: "DELETE",--%>
<%-- success: function () {--%>
<%-- $("input[name='memberCheck']").removeAttr("checked");--%>
<%-- window.location.reload();--%>
<%-- }--%>
<%-- });--%>
<%--});--%>
}
}
};
var addWxUser = function () {
$.ajax({ $.ajax({
url: '${ctx}/user/saveWxUser', url: '${ctx}/user/deleteDutyById/' + userId,
type: 'POST', type: 'GET',
contentType: 'application/json', contentType: 'application/json',
data: '', data: '',
dataType: 'json', dataType: 'json',
cache: false, cache: false,
success: function (result) { async: false,
if (result.status == 0) {
alert("同步微信用户成功!");
window.location.reload();
} else {
alert(result.errorMessage);
}
}
});
};
function sycToWechat() {
var selectedId = "";
for (i = 0; i < document.getElementsByName('memberCheck').length; i++) {
if (document.getElementsByName('memberCheck')[i].checked) {
selectedId += document.getElementsByName('memberCheck')[i].value + ",";
}
}
var str = "";
if (selectedId != "") {
str = selectedId.split(",");
if (str[str.length - 1] == "") {
selectedId = selectedId.substring(0, selectedId.length - 1);
}
}
if (selectedId == "") {
House365Util.createModal("同步员工", "请至少选择一条员工!", function () {
});
} else {
House365Util.createModal("确认", "是否继续?", function () {
$.ajax({
url: '${ctx}/user/syncToWechat/' + selectedId,
type: "GET",
success: function (re) {
if ("success" == re) {
layer.open({
content: "操作成功",
time: 2
});
} else if ("fail" == re) {
layer.open({
content: "操作失败",
time: 2
});
}
}
});
});
}
}
function transferDept(obj) {
House365Util.createRemoteModal("请选择部门", "${ctx}/department/transferDept", null, function () {
var treeObj = $.fn.zTree.getZTreeObj("treeSelect1");
var nodes = treeObj.getCheckedNodes(true);
if (nodes[0] == undefined || nodes[0] == null) {
window.location.reload();
return true;
}
$.ajax({
url: '${ctx}/department/transferDept/' + nodes[0].id + '/' + obj,
data: {},
type: "GET",
success: function () { success: function () {
window.location.reload(); location.href = '${ctx}/user/pblist'
}
});
return true;
});
}
var openAdd = function (id) {
$("#userId").val(id);
$("#bindModal").modal('show');
};
$(document).ready(function () {
$("#searchName").select2({
placeholder: "请选择微信用户",
// 输入几个字符开始联想
minimumInputLength: 1,
// 最大返回记录数
minimumResultsForSearch: 10,
maximumSelectionLength: 1,
minimumSelectionLength: 1,
containerCssClass: "chosen, chosen-with-diselect",
query: function (query) {
$.ajax({
timeout: 1000,
url: "${ctx}/user/getByName",
data: {
userName: query.term
},
type: "GET",
dataType: "json",
success: function (data, status) {
var pageData = {
results: []
};
$.each(data.data, function (i, item) {
pageData.results.push({
id: item.wxId + ',' + item.userName,
text: item.userName + ',' + item.mobile
});
});
query.callback(pageData);
}, },
error: function () { error: function () {
var pageData = { location.href = '${ctx}/user/pblist'
results: []
};
query.callback(pageData);
}
});
} }
}); });
$("#searchName").change(function () {
var $this = $(this);
var chooseName = $this.val();
if (chooseName) {
var tag = chooseName.split(",");
var wxId = tag[0];
$("#wxId").val(wxId);
}
});
});
var bindRelation = function () {
var userId = $("#userId").val();
var wxId = $("#wxId").val();
if (typeof(wxId) == "undefined" || wxId == '' || wxId == null) {
alert("请填写微信用户");
return;
} }
var data = {userId: userId, wxId: wxId};
data = JSON.stringify(data);
$.ajax({
url: '${ctx}/user/saveRelation',
type: 'POST',
contentType: 'application/json',
data: data,
dataType: 'json',
cache: false,
success: function (result) {
if (result.status == 0) {
alert("绑定成功!");
$("#bindModal").modal('hide');
window.location.reload();
} else {
alert(result.errorMessage);
} }
}
});
};
var backAdd = function () {
$("#bindModal").modal('hide');
};
</script> </script>
......
<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
<title>排班新增</title>
</head>
<style type="text/css">
.img-show {
width: 160px;
height: 120px;
border: 1px solid #ccc;
padding: 2px;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
}
</style>
<body>
<%@include file="/WEB-INF/common/layouts/topbar.jsp" %>
<form id="input_form" class="form-horizontal valid"
<%-- action="${ctx}/user/pblist"
method="get"--%>>
<!-- 面包屑 end -->
<house365:flushMessage/>
<div class="row${fluid}">
<div class="span12">
<input type="hidden" id="entity_onduty"
name="entity.onduty" class="required" maxlength="24"
value="${entity.onduty}"/>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">ID:</label>
<div class="controls">
<input type="text" id="entity_userId" disabled="disabled"
name="entity.userId" class="required" maxlength="24"
value="${entity.userId}"/>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">姓名:</label>
<div class="controls">
<input type="text" id="entity_name" disabled="disabled"
name="entity.name" class="required" maxlength="24"
value="${entity.name}"/>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">排序值:</label>
<div class="controls">
<input type="text" id="entity_order"
name="entity.order" class="required" maxlength="24"
value="${entity.order}"/>
</div>
</div>
</div>
<div class="row-fluid">
<div class="portlet-header">
<div class="operation-btn col-md-offset-4 col-lg-offset-4col-xl-offset-4">
<%-- <a href="${ctx}/user/pbelist/${userId}" class="btn gray"><i
class="icon-mail-reply"></i>&nbsp;恢复原来值</a>--%>
<button class="btn blue btn col-lg-pull-12" onclick="save(${entity.userId},${entity.onduty})">
&nbsp;确认
</button>
<a href="${ctx}/user/pblist" class="btn gray"><i
class="icon-mail-reply"></i>&nbsp;返回</a>
</div>
</div>
</div>
</div>
</div>
</form>
<script language="javascript" type="text/javascript" src="${ctx}/resources/customize/js/layer.js"></script>
<script type="text/javascript">
function save(userId,onduty) {
var order = document.getElementById("entity_order").value;
if(onduty==1){
alert("当天值日不可修改!!!")
return;
}
if (order == "") {
alert("排序值不能为null!!!")
return;
}
$.ajax({
url: '${ctx}/user/updateDuty/' + userId + '/' + order,
type: 'GET',
contentType: 'application/json',
data: '',
dataType: 'json',
cache: false,
async:false,
success: function () {
alert("修改成功!!!")
location.href = '${ctx}/user/pblist'
},
error:function(){
alert("修改成功!!!")
location.href = '${ctx}/user/pblist'
}
});
}
</script>
</body>
</html>
<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
<title>排班新增</title>
</head>
<style type="text/css">
.img-show {
width: 160px;
height: 120px;
border: 1px solid #ccc;
padding: 2px;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
}
</style>
<body>
<%@include file="/WEB-INF/common/layouts/topbar.jsp" %>
<form id="input_form" class="form-horizontal valid"
<%--action="${ctx}/user/pblist"
method="get"--%>>
<!-- 面包屑 end -->
<house365:flushMessage/>
<div class="row${fluid}">
<div class="span12">
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">选择员工<span style="color: red;">*</span>:</label>
<div class="controls">
<select name="name" id="select" style="width: 95%">
<option value="0">==请选择==</option>
<c:forEach items="${userByCity}" var="var" varStatus="vs">
<option value="${var.id}_${var.realName}"> ${var.realName} ${var.position}</option>
</c:forEach>
</select>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">排序值<span style="color: #ff0000;">*</span>:</label>
<div class="controls">
<input type="text" id="order"
name="order" class="required" maxlength="64"
value="${order}"/>
</div>
</div>
</div>
<div class="portlet-header">
<div class="row-fluid">
<div class="operation-btn span18">
<a href="${ctx}/user/pblist" class="btn gray"><i
class="icon-mail-reply"></i>&nbsp;返回</a>
<button class="btn blue btn col-lg-pull-12" onclick="save1()">
&nbsp;确认
</button>
</div>
</div>
</div>
</div>
</div>
</form>
<script language="javascript" type="text/javascript" src="${ctx}/resources/customize/js/layer.js"></script>
<script type="text/javascript">
function save1() {
var order = document.getElementById("order").value;
var myselect = document.getElementById("select");
var index=myselect.selectedIndex;
var id_name =myselect.options[index].value
if (order == "") {
alert("排序值不能为null!!!")
}
$.ajax({
url: '${ctx}/user/addDuty/' + id_name + '/' + order,
type: 'GET',
contentType: 'application/json',
data: '',
dataType: 'json',
cache: false,
async:false,
success: function () {
alert("增加成功!!!")
location.href = '${ctx}/user/pblist'
},
error:function(){
alert("增加成功!!!")
location.href = '${ctx}/user/pblist'
}
});
}
</script>
</body>
</html>
...@@ -200,4 +200,13 @@ public interface IUser extends IService { ...@@ -200,4 +200,13 @@ public interface IUser extends IService {
*/ */
List<UserEntity> getUserByCity(String cityCode); List<UserEntity> getUserByCity(String cityCode);
void deleteDutyById(Integer userId);
void addDuty(String id_name ,Integer order);
void updateDutyStaff(DutyStaffEntity entity);
void updateDuty(Integer order,Integer id);
DutyStaffEntity pbelist(Integer userId);
} }
...@@ -4,8 +4,10 @@ import com.house365.beans.entity.DutyStaffEntity; ...@@ -4,8 +4,10 @@ import com.house365.beans.entity.DutyStaffEntity;
import com.house365.beans.entity.RequestLoginEntity; import com.house365.beans.entity.RequestLoginEntity;
import com.house365.beans.entity.UserEntity; import com.house365.beans.entity.UserEntity;
import com.house365.beans.entity.UserSimpleEntity; import com.house365.beans.entity.UserSimpleEntity;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -27,8 +29,6 @@ public interface UserMapper { ...@@ -27,8 +29,6 @@ public interface UserMapper {
UserEntity getLimitLoginById(String name); UserEntity getLimitLoginById(String name);
void updateDutyStaff(DutyStaffEntity staff);
List<DutyStaffEntity> getOndutyById(Integer uid); List<DutyStaffEntity> getOndutyById(Integer uid);
void addRequestLoginInfo(RequestLoginEntity requestlogin); void addRequestLoginInfo(RequestLoginEntity requestlogin);
...@@ -41,7 +41,7 @@ public interface UserMapper { ...@@ -41,7 +41,7 @@ public interface UserMapper {
RequestLoginEntity getRequestLoginInfoById(Integer id); RequestLoginEntity getRequestLoginInfoById(Integer id);
List<DutyStaffEntity> getDutyByCondition(Map<String,Object> map); List<DutyStaffEntity> getDutyByCondition(Map<String, Object> map);
List<UserEntity> queryManagers(Map<String, Object> map); List<UserEntity> queryManagers(Map<String, Object> map);
...@@ -49,7 +49,7 @@ public interface UserMapper { ...@@ -49,7 +49,7 @@ public interface UserMapper {
List<UserEntity> getManagerByPid(Map<String, Object> map); List<UserEntity> getManagerByPid(Map<String, Object> map);
void updateUserStatus(Map<String,Object> map); void updateUserStatus(Map<String, Object> map);
String getCityById(String userId); String getCityById(String userId);
...@@ -57,4 +57,16 @@ public interface UserMapper { ...@@ -57,4 +57,16 @@ public interface UserMapper {
List<UserEntity> getUserByCity(Map<String, Object> map); List<UserEntity> getUserByCity(Map<String, Object> map);
void deleteDutyById(Integer userId);
void addDuty(@Param("name")String name,@Param("userId") Integer userId, @Param("updateTime")Date updateTime, @Param("order")Integer order);
void updateDutyStaff(DutyStaffEntity staff);
DutyStaffEntity selectBuyDutyId(Integer userId);
void updateDuty(@Param("order")Integer order,@Param("userId") Integer userId,@Param("updateTime")Date updateTime);
void updateDutyOnduty(@Param("userId") Integer userId,@Param("updateTime")Date updateTime,@Param("onduty") Integer onduty);
} }
...@@ -132,7 +132,6 @@ public class UserImpl implements IUser { ...@@ -132,7 +132,6 @@ public class UserImpl implements IUser {
} }
@Override @Override
public List<LabelEntity> getCustomerLabelById(LabelEntity labelentity) { public List<LabelEntity> getCustomerLabelById(LabelEntity labelentity) {
return labelmapper.getCustomerLabelById(labelentity); return labelmapper.getCustomerLabelById(labelentity);
...@@ -452,7 +451,7 @@ public class UserImpl implements IUser { ...@@ -452,7 +451,7 @@ public class UserImpl implements IUser {
* @return 删除账户响应 * @return 删除账户响应
*/ */
@Override @Override
public UserResponse deleteUserById(Integer id,int userId) { public UserResponse deleteUserById(Integer id, int userId) {
UserResponse response = new UserResponse(); UserResponse response = new UserResponse();
try { try {
// 插入delete_user表 // 插入delete_user表
...@@ -721,7 +720,7 @@ public class UserImpl implements IUser { ...@@ -721,7 +720,7 @@ public class UserImpl implements IUser {
} }
@Override @Override
public List<UserEntity> getManagerByPid(Integer uid, String managername){ public List<UserEntity> getManagerByPid(Integer uid, String managername) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("id", uid); map.put("id", uid);
map.put("realName", managername); map.put("realName", managername);
...@@ -1145,15 +1144,49 @@ public class UserImpl implements IUser { ...@@ -1145,15 +1144,49 @@ public class UserImpl implements IUser {
@Override @Override
public List<UserEntity> getDutyUserByCity(String cityCode) { public List<UserEntity> getDutyUserByCity(String cityCode) {
Map<String,Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("cityCode",cityCode); param.put("cityCode", cityCode);
return userMapper.getDutyUserByCity(param); return userMapper.getDutyUserByCity(param);
} }
@Override @Override
public List<UserEntity> getUserByCity(String cityCode) { public List<UserEntity> getUserByCity(String cityCode) {
Map<String,Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("cityCode",cityCode); param.put("cityCode", cityCode);
return userMapper.getUserByCity(param); return userMapper.getUserByCity(param);
} }
@Override
public void deleteDutyById(Integer userId) {
userMapper.deleteDutyById(userId);
}
@Override
public void addDuty(String id_name, Integer order) {
String[] split = id_name.split("_");
Integer userId = Integer.valueOf(split[0]);
String name = split[1];
DutyStaffEntity dutyStaffEntity = userMapper.selectBuyDutyId(userId);
if (dutyStaffEntity != null) {
return;
}
userMapper.addDuty(name, userId, new Date(), order);
}
@Override
public void updateDutyStaff(DutyStaffEntity entity) {
userMapper.updateDutyStaff(entity);
}
@Override
public void updateDuty(Integer order, Integer id) {
userMapper.updateDuty(order, id, new Date());
}
@Override
public DutyStaffEntity pbelist(Integer userId) {
return userMapper.selectBuyDutyId(userId);
}
} }
...@@ -4,12 +4,16 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -4,12 +4,16 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.house365.beans.entity.*; import com.house365.beans.entity.*;
import com.house365.beans.system.Page;
import com.house365.commons.system.HttpClientUtil; import com.house365.commons.system.HttpClientUtil;
import com.house365.web.util.DateTimeUtils; import com.house365.web.util.DateTimeUtils;
import com.house365.web.util.MemoryPropertyPlaceholderConfigurer; import com.house365.web.util.MemoryPropertyPlaceholderConfigurer;
import com.house365.ws.beans.request.DepartmentListRequest;
import com.house365.ws.beans.response.DepartmentListResponse;
import com.house365.ws.cached.RedisUtilsInterface; import com.house365.ws.cached.RedisUtilsInterface;
import com.house365.ws.dao.mapper.*; import com.house365.ws.dao.mapper.*;
import com.house365.ws.interfaces.server.ICustomerProject; import com.house365.ws.interfaces.server.ICustomerProject;
import com.house365.ws.interfaces.server.IDepartment;
import com.house365.ws.service.interfaces.*; import com.house365.ws.service.interfaces.*;
import com.house365.ws.util.Constant; import com.house365.ws.util.Constant;
import com.house365.ws.util.OperateLogUtils; import com.house365.ws.util.OperateLogUtils;
...@@ -95,34 +99,45 @@ public class StaffDuty implements IStaffDuty { ...@@ -95,34 +99,45 @@ public class StaffDuty implements IStaffDuty {
@Value("${CRM.CUSTOMERQUERY.URL}") @Value("${CRM.CUSTOMERQUERY.URL}")
private String crmQueryUrl; private String crmQueryUrl;
@Autowired
IDepartment department;
@Override @Override
public void updateDutyStaff() { public void updateDutyStaff() {
List<DutyStaffEntity> list = usermapper.getStaffDutyList(); Map<String, Object> searchParams = new HashMap<>();
Page page = new Page(1000);
DepartmentListRequest listRequest = new DepartmentListRequest();
searchParams.put("EQ_parentId", 1);
listRequest.setOrderColumn("orderNum");
listRequest.setOrderMode("asc");
listRequest.setSearchParams(searchParams);
listRequest.setPaging(page);
List<DepartmentEntity> departmentList = department.getDepartmentList(listRequest).getObjectList();
Date date = new Date(); Date date = new Date();
if (CollectionUtils.isNotEmpty(list)) { for (DepartmentEntity department : departmentList) {
int size = list.size(); searchParams.clear();
searchParams.put("cityCode", department.getDescripition());
List<UserEntity> dutyUserByCity = usermapper.getDutyUserByCity(searchParams);
if (CollectionUtils.isNotEmpty(dutyUserByCity)) {
int size = dutyUserByCity.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
DutyStaffEntity staff = list.get(i); UserEntity userEntity = dutyUserByCity.get(i);
if ("1".equals(staff.getOnduty()) && staff.getId() == list.size()) { if (userEntity.getEnabled()) {
staff.setOnduty("0"); UserEntity entity = null;
staff.setUpdateTime(date); if (i < (size - 1)) {
usermapper.updateDutyStaff(staff); entity = dutyUserByCity.get(i + 1);
list.get(0).setOnduty("1");//循环到第一个轮询值日 } else {
list.get(0).setUpdateTime(date); entity = dutyUserByCity.get(0);
usermapper.updateDutyStaff(list.get(0)); }
break; usermapper.updateDutyOnduty(userEntity.getId(), date, 0);
} else if ("1".equals(staff.getOnduty()) && staff.getId() != list.size()) { usermapper.updateDutyOnduty(entity.getId(), date, 1);
staff.setOnduty("0");
staff.setUpdateTime(date);
usermapper.updateDutyStaff(staff);
list.get(i + 1).setOnduty("1");//下一个轮询值日
list.get(i + 1).setUpdateTime(date);
usermapper.updateDutyStaff(list.get(i + 1));
break;
} }
} }
} }
}
} }
@Override @Override
......
...@@ -5,41 +5,41 @@ ...@@ -5,41 +5,41 @@
<mapper namespace="com.house365.ws.dao.mapper.UserMapper"> <mapper namespace="com.house365.ws.dao.mapper.UserMapper">
<resultMap id="infoMap" type="com.house365.beans.entity.UserEntity"> <resultMap id="infoMap" type="com.house365.beans.entity.UserEntity">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="realName" column="realName" /> <result property="realName" column="realName"/>
<result property="password" column="password" /> <result property="password" column="password"/>
<result property="weiXinId" column="weiXinId" /> <result property="weiXinId" column="weiXinId"/>
<result property="mediaId" column="mediaId" /> <result property="mediaId" column="mediaId"/>
<result property="mobile" column="mobile" /> <result property="mobile" column="mobile"/>
<result property="cornet" column="cornet"/> <result property="cornet" column="cornet"/>
<result property="deptId" column="deptId" /> <result property="deptId" column="deptId"/>
<result property="deptUrlPath" column="deptUrlPath" /> <result property="deptUrlPath" column="deptUrlPath"/>
<result property="position" column="position" /> <result property="position" column="position"/>
<result property="gender" column="gender" /> <result property="gender" column="gender"/>
<result property="email" column="email" /> <result property="email" column="email"/>
<result property="extattr" column="extattr" /> <result property="extattr" column="extattr"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="enabled" column="enabled" /> <result property="enabled" column="enabled"/>
<result property="createUserid" column="createUserid" /> <result property="createUserid" column="createUserid"/>
<result property="createUsername" column="createUsername" /> <result property="createUsername" column="createUsername"/>
<result property="createTime" column="createTime" /> <result property="createTime" column="createTime"/>
<result property="createIp" column="createIp" /> <result property="createIp" column="createIp"/>
<result property="updateUserid" column="updateUserid" /> <result property="updateUserid" column="updateUserid"/>
<result property="updateUsername" column="updateUsername" /> <result property="updateUsername" column="updateUsername"/>
<result property="updateTime" column="updateTime" /> <result property="updateTime" column="updateTime"/>
<result property="updateIp" column="updateIp" /> <result property="updateIp" column="updateIp"/>
<result property="preLoginTime" column="preLoginTime" /> <result property="preLoginTime" column="preLoginTime"/>
<result property="lastLoginTime" column="lastLoginTime" /> <result property="lastLoginTime" column="lastLoginTime"/>
<result property="score" column="score"/> <result property="score" column="score"/>
<result property="evaluateCount" column="evaluateCount"/> <result property="evaluateCount" column="evaluateCount"/>
<result property="hotlinephone" column="hotlinephone" /> <result property="hotlinephone" column="hotlinephone"/>
<result property="goodat" column="goodat" /> <result property="goodat" column="goodat"/>
<result property="description" column="description" /> <result property="description" column="description"/>
<result property="headImgURL" column="headImgURL" /> <result property="headImgURL" column="headImgURL"/>
<result property="fullImgURL" column="fullImgURL" /> <result property="fullImgURL" column="fullImgURL"/>
<result property="isFreeMan" column="isFreeMan" /> <result property="isFreeMan" column="isFreeMan"/>
<result property="defaultVisit" column="defaultVisit" /> <result property="defaultVisit" column="defaultVisit"/>
<result property="accId" column="accid"/> <result property="accId" column="accid"/>
<result property="identityType" column="identityType"/> <result property="identityType" column="identityType"/>
<result property="token" column="token"/> <result property="token" column="token"/>
...@@ -47,54 +47,90 @@ ...@@ -47,54 +47,90 @@
<result property="wxCodeImgUrl" column="wx_code_imgUrl"/> <result property="wxCodeImgUrl" column="wx_code_imgUrl"/>
<result property="promoteId" column="promote_id"/> <result property="promoteId" column="promote_id"/>
<result property="onlineStatus" column="online_status"/> <result property="onlineStatus" column="online_status"/>
<result property="showMobile" column="showMobile" /> <result property="showMobile" column="showMobile"/>
</resultMap> </resultMap>
<resultMap id="infoMap2" type="com.house365.beans.entity.UserSimpleEntity"> <resultMap id="infoMap2" type="com.house365.beans.entity.UserSimpleEntity">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="realName" column="realName" /> <result property="realName" column="realName"/>
<result property="mobile" column="mobile" /> <result property="mobile" column="mobile"/>
<result property="hotlinephone" column="hotlinephone" /> <result property="hotlinephone" column="hotlinephone"/>
<result property="enabled" column="enabled" /> <result property="enabled" column="enabled"/>
<result property="cornet" column="cornet"/> <result property="cornet" column="cornet"/>
<result property="headImgURL" column="headImgURL" /> <result property="headImgURL" column="headImgURL"/>
<result property="fullImgURL" column="fullImgURL" /> <result property="fullImgURL" column="fullImgURL"/>
<result property="accId" column="accid"/> <result property="accId" column="accid"/>
<result property="goodat" column="goodat" /> <result property="goodat" column="goodat"/>
<result property="description" column="description" /> <result property="description" column="description"/>
<result property="score" column="score"/> <result property="score" column="score"/>
</resultMap> </resultMap>
<resultMap id="infoMap3" type="com.house365.beans.entity.DutyStaffEntity"> <resultMap id="infoMap3" type="com.house365.beans.entity.DutyStaffEntity">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="userId" column="userId" /> <result property="userId" column="userId"/>
<result property="onduty" column="onduty" /> <result property="onduty" column="onduty"/>
</resultMap> </resultMap>
<resultMap id="infoMap4" type="com.house365.beans.entity.RequestLoginEntity"> <resultMap id="infoMap4" type="com.house365.beans.entity.RequestLoginEntity">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="userId" column="userId" /> <result property="userId" column="userId"/>
<result property="realName" column="realName" /> <result property="realName" column="realName"/>
<result property="loginIp" column="loginIp" /> <result property="loginIp" column="loginIp"/>
<result property="loginCity" column="loginCity" /> <result property="loginCity" column="loginCity"/>
<result property="loginTime" column="loginTime" /> <result property="loginTime" column="loginTime"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="authorizationTime" column="authorizationTime" /> <result property="authorizationTime" column="authorizationTime"/>
</resultMap> </resultMap>
<select id="getById" resultMap="infoMap" parameterType="int"> <select id="getById" resultMap="infoMap" parameterType="int">
SELECT id, name,realName, password, weiXinId, mediaId, mobile, cornet, deptId, deptUrlPath, position, gender, SELECT id,
email, extattr, status, enabled, createUserid, createUsername, createTime, createIp, updateUserid, name,
updateUsername, updateTime, updateIp, preLoginTime, lastLoginTime, hotlinephone, goodat, realName,
description, headImgURL, fullImgURL,isFreeMan,defaultVisit,accid,identityType,token,wx_number,wx_code_imgUrl,showMobile password,
weiXinId,
mediaId,
mobile,
cornet,
deptId,
deptUrlPath,
position,
gender,
email,
extattr,
status,
enabled,
createUserid,
createUsername,
createTime,
createIp,
updateUserid,
updateUsername,
updateTime,
updateIp,
preLoginTime,
lastLoginTime,
hotlinephone,
goodat,
description,
headImgURL,
fullImgURL,
isFreeMan,
defaultVisit,
accid,
identityType,
token,
wx_number,
wx_code_imgUrl,
showMobile
FROM user FROM user
where id = #{id} AND enabled = 1 where id = #{id}
AND enabled = 1
</select> </select>
<select id="queryManagers" resultType="com.house365.beans.entity.UserEntity" parameterType="map"> <select id="queryManagers" resultType="com.house365.beans.entity.UserEntity" parameterType="map">
...@@ -166,10 +202,22 @@ ...@@ -166,10 +202,22 @@
</select> </select>
<select id="queryUserInfoByd" resultMap="infoMap2" parameterType="map"> <select id="queryUserInfoByd" resultMap="infoMap2" parameterType="map">
SELECT name,realName, mobile,hotlinephone,cornet,enabled, SELECT name,
headImgURL, fullImgURL,accid,description,goodat, realName,
(select ifnull(format(AVG(eucl.score),1),0) from evaluate_user_customer_log eucl where eucl.user_id = u.id and mobile,
eucl.check_status =1 and eucl.is_deleted = 0) hotlinephone,
cornet,
enabled,
headImgURL,
fullImgURL,
accid,
description,
goodat,
(select ifnull(format(AVG(eucl.score), 1), 0)
from evaluate_user_customer_log eucl
where eucl.user_id = u.id
and eucl.check_status = 1
and eucl.is_deleted = 0)
score score
FROM user u FROM user u
where id = #{userId} where id = #{userId}
...@@ -177,10 +225,24 @@ ...@@ -177,10 +225,24 @@
</select> </select>
<select id="queryUserInfoByPhone" resultMap="infoMap2" parameterType="map"> <select id="queryUserInfoByPhone" resultMap="infoMap2" parameterType="map">
SELECT id,accid,name,realName, mobile,hotlinephone,cornet,enabled, SELECT id,
headImgURL, fullImgURL,accid,description,goodat, accid,
(select ifnull(format(AVG(eucl.score),1),0) from evaluate_user_customer_log eucl where eucl.user_id = u.id and name,
eucl.check_status =1 and eucl.is_deleted = 0) realName,
mobile,
hotlinephone,
cornet,
enabled,
headImgURL,
fullImgURL,
accid,
description,
goodat,
(select ifnull(format(AVG(eucl.score), 1), 0)
from evaluate_user_customer_log eucl
where eucl.user_id = u.id
and eucl.check_status = 1
and eucl.is_deleted = 0)
score score
FROM user u FROM user u
where mobile = #{phone} where mobile = #{phone}
...@@ -188,17 +250,23 @@ ...@@ -188,17 +250,23 @@
</select> </select>
<select id="getStaffDutyList" resultMap="infoMap3"> <select id="getStaffDutyList" resultMap="infoMap3">
select id,name,userId,onduty from duty_staff select id, name, userId, onduty
from duty_staff order by `order`
</select> </select>
<select id="getDutyUserByCity" resultMap="infoMap"> <select id="getDutyUserByCity" resultMap="infoMap">
select a.id,a.name,a.`realName`,a.`position`,b.`onduty` as enabled,b.order as status from user a join `duty_staff` b on a.id = b.userId select a.id, a.name, a.`realName`, a.`position`, b.`onduty` as enabled, b.order as status
where a.`deptUrlPath` REGEXP CONCAT('^', (select urlPath from `department` where `descripition` = #{cityCode})) order by 'b.order' from user a
join `duty_staff` b on a.id = b.userId
where a.`deptUrlPath` REGEXP CONCAT('^', (select urlPath from `department` where `descripition` = #{cityCode}))
order by b.`order`
</select> </select>
<select id="getUserByCity" resultMap="infoMap"> <select id="getUserByCity" resultMap="infoMap">
select a.id,a.realName from user a where a.enabled=1 and select a.id, a.realName,a.position
a.`deptUrlPath` REGEXP CONCAT('^', (select urlPath from `department` where `descripition` = #{cityCode})) from user a
where a.enabled = 1
and a.`deptUrlPath` REGEXP CONCAT('^', (select urlPath from `department` where `descripition` = #{cityCode}))
</select> </select>
<select id="getDutyByCondition" resultMap="infoMap3" parameterType="map"> <select id="getDutyByCondition" resultMap="infoMap3" parameterType="map">
...@@ -211,44 +279,73 @@ ...@@ -211,44 +279,73 @@
</select> </select>
<select id="getOndutyById" resultMap="infoMap3" parameterType="map"> <select id="getOndutyById" resultMap="infoMap3" parameterType="map">
select id,name,userId,onduty from duty_staff where userId = #{uid}# select id, name, userId, onduty
from duty_staff
where userId = #{uid}#
</select> </select>
<update id="updateDutyStaff" parameterType="com.house365.beans.entity.DutyStaffEntity">
UPDATE duty_staff
SET
onduty = #{onduty},
updateTime = #{updateTime}
WHERE id = #{id}
</update>
<update id="authorizationById" parameterType="com.house365.beans.entity.RequestLoginEntity"> <update id="authorizationById" parameterType="com.house365.beans.entity.RequestLoginEntity">
UPDATE request_login UPDATE request_login
SET SET status = #{status},
status = #{status},
authorizationTime = CURRENT_TIMESTAMP authorizationTime = CURRENT_TIMESTAMP
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<update id="updateRequestById" parameterType="com.house365.beans.entity.RequestLoginEntity"> <update id="updateRequestById" parameterType="com.house365.beans.entity.RequestLoginEntity">
UPDATE request_login UPDATE request_login
SET SET status = 2
status = 2 WHERE userId = #{userId}
WHERE userId = #{userId} and status=1 and status = 1
</update> </update>
<select id="getLimitLoginById" resultMap="infoMap"> <select id="getLimitLoginById" resultMap="infoMap">
select id, name,realName, password, weiXinId, mediaId, mobile, cornet, deptId, deptUrlPath, position, gender, select id,
email, extattr, status, enabled, createUserid, createUsername, createTime, createIp, updateUserid, name,
updateUsername, updateTime, updateIp, preLoginTime, lastLoginTime, hotlinephone, goodat, realName,
description, headImgURL, fullImgURL,isFreeMan,defaultVisit,accid,identityType,token,limitLogin,showMobile password,
from user where name = #{name} weiXinId,
mediaId,
mobile,
cornet,
deptId,
deptUrlPath,
position,
gender,
email,
extattr,
status,
enabled,
createUserid,
createUsername,
createTime,
createIp,
updateUserid,
updateUsername,
updateTime,
updateIp,
preLoginTime,
lastLoginTime,
hotlinephone,
goodat,
description,
headImgURL,
fullImgURL,
isFreeMan,
defaultVisit,
accid,
identityType,
token,
limitLogin,
showMobile
from user
where name = #{name}
</select> </select>
<select id="getManagerByPid" resultMap="infoMap" parameterType="map"> <select id="getManagerByPid" resultMap="infoMap" parameterType="map">
select * from ( select * from (
SELECT id,realName FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{id} ) SELECT id,realName FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id =
#{id} )
union union
select id,realName from user where id=#{id} select id,realName from user where id=#{id}
) t where 1=1 ) t where 1=1
...@@ -258,38 +355,90 @@ ...@@ -258,38 +355,90 @@
</select> </select>
<select id="getRequestLoginInfoById" resultMap="infoMap4"> <select id="getRequestLoginInfoById" resultMap="infoMap4">
select id,name,realName,loginIp,loginCity,loginTime,status,authorizationTime,userId select id,
from request_login where id = #{id}# name,
realName,
loginIp,
loginCity,
loginTime,
status,
authorizationTime,
userId
from request_login
where id = #{id}#
</select> </select>
<insert id="addRequestLoginInfo" parameterType="com.house365.beans.entity.RequestLoginEntity"> <insert id="addRequestLoginInfo" parameterType="com.house365.beans.entity.RequestLoginEntity">
insert into request_login (name,realName,loginIp,loginCity,loginTime,authorizationTime, userId) values insert into request_login (name, realName, loginIp, loginCity, loginTime, authorizationTime, userId)
( values (#{name}, #{realName}, #{loginIp}, #{loginCity}, #{loginTime}, #{authorizationTime}, #{userId})
#{name},#{realName},#{loginIp},#{loginCity},#{loginTime},#{authorizationTime}, #{userId}
)
</insert> </insert>
<select id="getRequestLoginInfo" resultMap="infoMap4"> <select id="getRequestLoginInfo" resultMap="infoMap4">
select id,name,realName,loginIp,loginCity,loginTime,status,authorizationTime,userId select id,
from request_login where name = #{name}# and loginIp = #{loginIp}# name,
realName,
loginIp,
loginCity,
loginTime,
status,
authorizationTime,
userId
from request_login
where name = #{name}#
and loginIp = #{loginIp}#
order by loginTime desc order by loginTime desc
</select> </select>
<update id="updateUserStatus" parameterType="map"> <update id="updateUserStatus" parameterType="map">
UPDATE user UPDATE user
SET SET online_status = #{onlineStatus}
online_status = #{onlineStatus}
WHERE mobile = #{mobile} WHERE mobile = #{mobile}
</update> </update>
<select id="getCityById" parameterType="String" resultType="String"> <select id="getCityById" parameterType="String" resultType="String">
select select case c.city
case c.city
when 'zb001' then 'nj' when 'zb001' then 'nj'
else c.city end else c.city end
as city as city
from user u inner join city_urlpath c on SUBSTRING_INDEX(u.deptUrlPath,'/',3)=c.urlpath where u.id=#{userId} from user u
inner join city_urlpath c on SUBSTRING_INDEX(u.deptUrlPath, '/', 3) = c.urlpath
where u.id = #{userId}
</select> </select>
<delete id="deleteDutyById" parameterType="Integer">
delete
FROM duty_staff
where userId = #{userId}
</delete>
<delete id="addDuty" parameterType="Integer">
insert into duty_staff (`name`, userId, updateTime, `order`)
values (#{name}, #{userId}, #{updateTime}, #{order})
</delete>
<update id="updateDutyStaff" parameterType="com.house365.beans.entity.DutyStaffEntity">
UPDATE duty_staff
SET onduty = #{onduty},
updateTime = #{updateTime}
WHERE id = #{id}
</update>
<select id="selectBuyDutyId" parameterType="integer" resultType="com.house365.beans.entity.DutyStaffEntity">
select `name`,userId,`order`,`onduty` from duty_staff where userId=#{userId}
</select>
<update id="updateDuty">
UPDATE duty_staff
SET `order` = #{order},
updateTime = #{updateTime}
WHERE userId = #{userId}
</update>
<update id="updateDutyOnduty">
UPDATE duty_staff
SET `onduty` = #{onduty},
updateTime = #{updateTime}
WHERE userId = #{userId}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -5,41 +5,41 @@ ...@@ -5,41 +5,41 @@
<mapper namespace="com.house365.ws.dao.mapper.UserMapper"> <mapper namespace="com.house365.ws.dao.mapper.UserMapper">
<resultMap id="infoMap" type="com.house365.beans.entity.UserEntity"> <resultMap id="infoMap" type="com.house365.beans.entity.UserEntity">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="realName" column="realName" /> <result property="realName" column="realName"/>
<result property="password" column="password" /> <result property="password" column="password"/>
<result property="weiXinId" column="weiXinId" /> <result property="weiXinId" column="weiXinId"/>
<result property="mediaId" column="mediaId" /> <result property="mediaId" column="mediaId"/>
<result property="mobile" column="mobile" /> <result property="mobile" column="mobile"/>
<result property="cornet" column="cornet"/> <result property="cornet" column="cornet"/>
<result property="deptId" column="deptId" /> <result property="deptId" column="deptId"/>
<result property="deptUrlPath" column="deptUrlPath" /> <result property="deptUrlPath" column="deptUrlPath"/>
<result property="position" column="position" /> <result property="position" column="position"/>
<result property="gender" column="gender" /> <result property="gender" column="gender"/>
<result property="email" column="email" /> <result property="email" column="email"/>
<result property="extattr" column="extattr" /> <result property="extattr" column="extattr"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="enabled" column="enabled" /> <result property="enabled" column="enabled"/>
<result property="createUserid" column="createUserid" /> <result property="createUserid" column="createUserid"/>
<result property="createUsername" column="createUsername" /> <result property="createUsername" column="createUsername"/>
<result property="createTime" column="createTime" /> <result property="createTime" column="createTime"/>
<result property="createIp" column="createIp" /> <result property="createIp" column="createIp"/>
<result property="updateUserid" column="updateUserid" /> <result property="updateUserid" column="updateUserid"/>
<result property="updateUsername" column="updateUsername" /> <result property="updateUsername" column="updateUsername"/>
<result property="updateTime" column="updateTime" /> <result property="updateTime" column="updateTime"/>
<result property="updateIp" column="updateIp" /> <result property="updateIp" column="updateIp"/>
<result property="preLoginTime" column="preLoginTime" /> <result property="preLoginTime" column="preLoginTime"/>
<result property="lastLoginTime" column="lastLoginTime" /> <result property="lastLoginTime" column="lastLoginTime"/>
<result property="score" column="score"/> <result property="score" column="score"/>
<result property="evaluateCount" column="evaluateCount"/> <result property="evaluateCount" column="evaluateCount"/>
<result property="hotlinephone" column="hotlinephone" /> <result property="hotlinephone" column="hotlinephone"/>
<result property="goodat" column="goodat" /> <result property="goodat" column="goodat"/>
<result property="description" column="description" /> <result property="description" column="description"/>
<result property="headImgURL" column="headImgURL" /> <result property="headImgURL" column="headImgURL"/>
<result property="fullImgURL" column="fullImgURL" /> <result property="fullImgURL" column="fullImgURL"/>
<result property="isFreeMan" column="isFreeMan" /> <result property="isFreeMan" column="isFreeMan"/>
<result property="defaultVisit" column="defaultVisit" /> <result property="defaultVisit" column="defaultVisit"/>
<result property="accId" column="accid"/> <result property="accId" column="accid"/>
<result property="identityType" column="identityType"/> <result property="identityType" column="identityType"/>
<result property="token" column="token"/> <result property="token" column="token"/>
...@@ -47,54 +47,90 @@ ...@@ -47,54 +47,90 @@
<result property="wxCodeImgUrl" column="wx_code_imgUrl"/> <result property="wxCodeImgUrl" column="wx_code_imgUrl"/>
<result property="promoteId" column="promote_id"/> <result property="promoteId" column="promote_id"/>
<result property="onlineStatus" column="online_status"/> <result property="onlineStatus" column="online_status"/>
<result property="showMobile" column="showMobile" /> <result property="showMobile" column="showMobile"/>
</resultMap> </resultMap>
<resultMap id="infoMap2" type="com.house365.beans.entity.UserSimpleEntity"> <resultMap id="infoMap2" type="com.house365.beans.entity.UserSimpleEntity">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="realName" column="realName" /> <result property="realName" column="realName"/>
<result property="mobile" column="mobile" /> <result property="mobile" column="mobile"/>
<result property="hotlinephone" column="hotlinephone" /> <result property="hotlinephone" column="hotlinephone"/>
<result property="enabled" column="enabled" /> <result property="enabled" column="enabled"/>
<result property="cornet" column="cornet"/> <result property="cornet" column="cornet"/>
<result property="headImgURL" column="headImgURL" /> <result property="headImgURL" column="headImgURL"/>
<result property="fullImgURL" column="fullImgURL" /> <result property="fullImgURL" column="fullImgURL"/>
<result property="accId" column="accid"/> <result property="accId" column="accid"/>
<result property="goodat" column="goodat" /> <result property="goodat" column="goodat"/>
<result property="description" column="description" /> <result property="description" column="description"/>
<result property="score" column="score"/> <result property="score" column="score"/>
</resultMap> </resultMap>
<resultMap id="infoMap3" type="com.house365.beans.entity.DutyStaffEntity"> <resultMap id="infoMap3" type="com.house365.beans.entity.DutyStaffEntity">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="userId" column="userId" /> <result property="userId" column="userId"/>
<result property="onduty" column="onduty" /> <result property="onduty" column="onduty"/>
</resultMap> </resultMap>
<resultMap id="infoMap4" type="com.house365.beans.entity.RequestLoginEntity"> <resultMap id="infoMap4" type="com.house365.beans.entity.RequestLoginEntity">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="userId" column="userId" /> <result property="userId" column="userId"/>
<result property="realName" column="realName" /> <result property="realName" column="realName"/>
<result property="loginIp" column="loginIp" /> <result property="loginIp" column="loginIp"/>
<result property="loginCity" column="loginCity" /> <result property="loginCity" column="loginCity"/>
<result property="loginTime" column="loginTime" /> <result property="loginTime" column="loginTime"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="authorizationTime" column="authorizationTime" /> <result property="authorizationTime" column="authorizationTime"/>
</resultMap> </resultMap>
<select id="getById" resultMap="infoMap" parameterType="int"> <select id="getById" resultMap="infoMap" parameterType="int">
SELECT id, name,realName, password, weiXinId, mediaId, mobile, cornet, deptId, deptUrlPath, position, gender, SELECT id,
email, extattr, status, enabled, createUserid, createUsername, createTime, createIp, updateUserid, name,
updateUsername, updateTime, updateIp, preLoginTime, lastLoginTime, hotlinephone, goodat, realName,
description, headImgURL, fullImgURL,isFreeMan,defaultVisit,accid,identityType,token,wx_number,wx_code_imgUrl,showMobile password,
weiXinId,
mediaId,
mobile,
cornet,
deptId,
deptUrlPath,
position,
gender,
email,
extattr,
status,
enabled,
createUserid,
createUsername,
createTime,
createIp,
updateUserid,
updateUsername,
updateTime,
updateIp,
preLoginTime,
lastLoginTime,
hotlinephone,
goodat,
description,
headImgURL,
fullImgURL,
isFreeMan,
defaultVisit,
accid,
identityType,
token,
wx_number,
wx_code_imgUrl,
showMobile
FROM user FROM user
where id = #{id} AND enabled = 1 where id = #{id}
AND enabled = 1
</select> </select>
<select id="queryManagers" resultType="com.house365.beans.entity.UserEntity" parameterType="map"> <select id="queryManagers" resultType="com.house365.beans.entity.UserEntity" parameterType="map">
...@@ -148,12 +184,12 @@ ...@@ -148,12 +184,12 @@
<if test="onlineStatus != null and onlineStatus >= 0"> <if test="onlineStatus != null and onlineStatus >= 0">
AND online_status = #{onlineStatus} AND online_status = #{onlineStatus}
</if> </if>
<if test="deptId != null and deptId >= 0 ">
AND deptId = #{deptId}
</if>
<if test="showMobile != null and showMobile >= 0"> <if test="showMobile != null and showMobile >= 0">
AND showMobile = #{showMobile} AND showMobile = #{showMobile}
</if> </if>
<if test="deptId != null and deptId >= 0 ">
AND deptId = #{deptId}
</if>
<if test="deptIdList != null and deptIdList.size() > 0 "> <if test="deptIdList != null and deptIdList.size() > 0 ">
AND deptId in AND deptId in
<foreach collection="deptIdList" index="index" item="item" open="(" separator="," close=")"> <foreach collection="deptIdList" index="index" item="item" open="(" separator="," close=")">
...@@ -166,10 +202,22 @@ ...@@ -166,10 +202,22 @@
</select> </select>
<select id="queryUserInfoByd" resultMap="infoMap2" parameterType="map"> <select id="queryUserInfoByd" resultMap="infoMap2" parameterType="map">
SELECT name,realName, mobile,hotlinephone,cornet,enabled, SELECT name,
headImgURL, fullImgURL,accid,description,goodat, realName,
(select ifnull(format(AVG(eucl.score),1),0) from evaluate_user_customer_log eucl where eucl.user_id = u.id and mobile,
eucl.check_status =1 and eucl.is_deleted = 0) hotlinephone,
cornet,
enabled,
headImgURL,
fullImgURL,
accid,
description,
goodat,
(select ifnull(format(AVG(eucl.score), 1), 0)
from evaluate_user_customer_log eucl
where eucl.user_id = u.id
and eucl.check_status = 1
and eucl.is_deleted = 0)
score score
FROM user u FROM user u
where id = #{userId} where id = #{userId}
...@@ -177,10 +225,24 @@ ...@@ -177,10 +225,24 @@
</select> </select>
<select id="queryUserInfoByPhone" resultMap="infoMap2" parameterType="map"> <select id="queryUserInfoByPhone" resultMap="infoMap2" parameterType="map">
SELECT id,accid,name,realName, mobile,hotlinephone,cornet,enabled, SELECT id,
headImgURL, fullImgURL,accid,description,goodat, accid,
(select ifnull(format(AVG(eucl.score),1),0) from evaluate_user_customer_log eucl where eucl.user_id = u.id and name,
eucl.check_status =1 and eucl.is_deleted = 0) realName,
mobile,
hotlinephone,
cornet,
enabled,
headImgURL,
fullImgURL,
accid,
description,
goodat,
(select ifnull(format(AVG(eucl.score), 1), 0)
from evaluate_user_customer_log eucl
where eucl.user_id = u.id
and eucl.check_status = 1
and eucl.is_deleted = 0)
score score
FROM user u FROM user u
where mobile = #{phone} where mobile = #{phone}
...@@ -188,7 +250,23 @@ ...@@ -188,7 +250,23 @@
</select> </select>
<select id="getStaffDutyList" resultMap="infoMap3"> <select id="getStaffDutyList" resultMap="infoMap3">
select id,name,userId,onduty from duty_staff select id, name, userId, onduty
from duty_staff order by `order`
</select>
<select id="getDutyUserByCity" resultMap="infoMap">
select a.id, a.name, a.`realName`, a.`position`, b.`onduty` as enabled, b.order as status
from user a
join `duty_staff` b on a.id = b.userId
where a.`deptUrlPath` REGEXP CONCAT('^', (select urlPath from `department` where `descripition` = #{cityCode}))
order by b.`order`
</select>
<select id="getUserByCity" resultMap="infoMap">
select a.id, a.realName,a.position
from user a
where a.enabled = 1
and a.`deptUrlPath` REGEXP CONCAT('^', (select urlPath from `department` where `descripition` = #{cityCode}))
</select> </select>
<select id="getDutyByCondition" resultMap="infoMap3" parameterType="map"> <select id="getDutyByCondition" resultMap="infoMap3" parameterType="map">
...@@ -201,44 +279,73 @@ ...@@ -201,44 +279,73 @@
</select> </select>
<select id="getOndutyById" resultMap="infoMap3" parameterType="map"> <select id="getOndutyById" resultMap="infoMap3" parameterType="map">
select id,name,userId,onduty from duty_staff where userId = #{uid}# select id, name, userId, onduty
from duty_staff
where userId = #{uid}#
</select> </select>
<update id="updateDutyStaff" parameterType="com.house365.beans.entity.DutyStaffEntity">
UPDATE duty_staff
SET
onduty = #{onduty},
updateTime = #{updateTime}
WHERE id = #{id}
</update>
<update id="authorizationById" parameterType="com.house365.beans.entity.RequestLoginEntity"> <update id="authorizationById" parameterType="com.house365.beans.entity.RequestLoginEntity">
UPDATE request_login UPDATE request_login
SET SET status = #{status},
status = #{status},
authorizationTime = CURRENT_TIMESTAMP authorizationTime = CURRENT_TIMESTAMP
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<update id="updateRequestById" parameterType="com.house365.beans.entity.RequestLoginEntity"> <update id="updateRequestById" parameterType="com.house365.beans.entity.RequestLoginEntity">
UPDATE request_login UPDATE request_login
SET SET status = 2
status = 2 WHERE userId = #{userId}
WHERE userId = #{userId} and status=1 and status = 1
</update> </update>
<select id="getLimitLoginById" resultMap="infoMap"> <select id="getLimitLoginById" resultMap="infoMap">
select id, name,realName, password, weiXinId, mediaId, mobile, cornet, deptId, deptUrlPath, position, gender, select id,
email, extattr, status, enabled, createUserid, createUsername, createTime, createIp, updateUserid, name,
updateUsername, updateTime, updateIp, preLoginTime, lastLoginTime, hotlinephone, goodat, realName,
description, headImgURL, fullImgURL,isFreeMan,defaultVisit,accid,identityType,token,limitLogin,showMobile password,
from user where name = #{name} weiXinId,
mediaId,
mobile,
cornet,
deptId,
deptUrlPath,
position,
gender,
email,
extattr,
status,
enabled,
createUserid,
createUsername,
createTime,
createIp,
updateUserid,
updateUsername,
updateTime,
updateIp,
preLoginTime,
lastLoginTime,
hotlinephone,
goodat,
description,
headImgURL,
fullImgURL,
isFreeMan,
defaultVisit,
accid,
identityType,
token,
limitLogin,
showMobile
from user
where name = #{name}
</select> </select>
<select id="getManagerByPid" resultMap="infoMap" parameterType="map"> <select id="getManagerByPid" resultMap="infoMap" parameterType="map">
select * from ( select * from (
SELECT id,realName FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{id} ) SELECT id,realName FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id =
#{id} )
union union
select id,realName from user where id=#{id} select id,realName from user where id=#{id}
) t where 1=1 ) t where 1=1
...@@ -248,38 +355,90 @@ ...@@ -248,38 +355,90 @@
</select> </select>
<select id="getRequestLoginInfoById" resultMap="infoMap4"> <select id="getRequestLoginInfoById" resultMap="infoMap4">
select id,name,realName,loginIp,loginCity,loginTime,status,authorizationTime,userId select id,
from request_login where id = #{id}# name,
realName,
loginIp,
loginCity,
loginTime,
status,
authorizationTime,
userId
from request_login
where id = #{id}#
</select> </select>
<insert id="addRequestLoginInfo" parameterType="com.house365.beans.entity.RequestLoginEntity"> <insert id="addRequestLoginInfo" parameterType="com.house365.beans.entity.RequestLoginEntity">
insert into request_login (name,realName,loginIp,loginCity,loginTime,authorizationTime, userId) values insert into request_login (name, realName, loginIp, loginCity, loginTime, authorizationTime, userId)
( values (#{name}, #{realName}, #{loginIp}, #{loginCity}, #{loginTime}, #{authorizationTime}, #{userId})
#{name},#{realName},#{loginIp},#{loginCity},#{loginTime},#{authorizationTime}, #{userId}
)
</insert> </insert>
<select id="getRequestLoginInfo" resultMap="infoMap4"> <select id="getRequestLoginInfo" resultMap="infoMap4">
select id,name,realName,loginIp,loginCity,loginTime,status,authorizationTime,userId select id,
from request_login where name = #{name}# and loginIp = #{loginIp}# name,
realName,
loginIp,
loginCity,
loginTime,
status,
authorizationTime,
userId
from request_login
where name = #{name}#
and loginIp = #{loginIp}#
order by loginTime desc order by loginTime desc
</select> </select>
<update id="updateUserStatus" parameterType="map"> <update id="updateUserStatus" parameterType="map">
UPDATE user UPDATE user
SET SET online_status = #{onlineStatus}
online_status = #{onlineStatus}
WHERE mobile = #{mobile} WHERE mobile = #{mobile}
</update> </update>
<select id="getCityById" parameterType="String" resultType="String"> <select id="getCityById" parameterType="String" resultType="String">
select select case c.city
case c.city
when 'zb001' then 'nj' when 'zb001' then 'nj'
else c.city end else c.city end
as city as city
from user u inner join city_urlpath c on SUBSTRING_INDEX(u.deptUrlPath,'/',3)=c.urlpath where u.id=#{userId} from user u
inner join city_urlpath c on SUBSTRING_INDEX(u.deptUrlPath, '/', 3) = c.urlpath
where u.id = #{userId}
</select> </select>
<delete id="deleteDutyById" parameterType="Integer">
delete
FROM duty_staff
where userId = #{userId}
</delete>
<delete id="addDuty" parameterType="Integer">
insert into duty_staff (`name`, userId, updateTime, `order`)
values (#{name}, #{userId}, #{updateTime}, #{order})
</delete>
<update id="updateDutyStaff" parameterType="com.house365.beans.entity.DutyStaffEntity">
UPDATE duty_staff
SET onduty = #{onduty},
updateTime = #{updateTime}
WHERE id = #{id}
</update>
<select id="selectBuyDutyId" parameterType="integer" resultType="com.house365.beans.entity.DutyStaffEntity">
select `name`,userId,`order`,`onduty` from duty_staff where userId=#{userId}
</select>
<update id="updateDuty">
UPDATE duty_staff
SET `order` = #{order},
updateTime = #{updateTime}
WHERE userId = #{userId}
</update>
<update id="updateDutyOnduty">
UPDATE duty_staff
SET `onduty` = #{onduty},
updateTime = #{updateTime}
WHERE userId = #{userId}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -5,41 +5,41 @@ ...@@ -5,41 +5,41 @@
<mapper namespace="com.house365.ws.dao.mapper.UserMapper"> <mapper namespace="com.house365.ws.dao.mapper.UserMapper">
<resultMap id="infoMap" type="com.house365.beans.entity.UserEntity"> <resultMap id="infoMap" type="com.house365.beans.entity.UserEntity">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="realName" column="realName" /> <result property="realName" column="realName"/>
<result property="password" column="password" /> <result property="password" column="password"/>
<result property="weiXinId" column="weiXinId" /> <result property="weiXinId" column="weiXinId"/>
<result property="mediaId" column="mediaId" /> <result property="mediaId" column="mediaId"/>
<result property="mobile" column="mobile" /> <result property="mobile" column="mobile"/>
<result property="cornet" column="cornet"/> <result property="cornet" column="cornet"/>
<result property="deptId" column="deptId" /> <result property="deptId" column="deptId"/>
<result property="deptUrlPath" column="deptUrlPath" /> <result property="deptUrlPath" column="deptUrlPath"/>
<result property="position" column="position" /> <result property="position" column="position"/>
<result property="gender" column="gender" /> <result property="gender" column="gender"/>
<result property="email" column="email" /> <result property="email" column="email"/>
<result property="extattr" column="extattr" /> <result property="extattr" column="extattr"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="enabled" column="enabled" /> <result property="enabled" column="enabled"/>
<result property="createUserid" column="createUserid" /> <result property="createUserid" column="createUserid"/>
<result property="createUsername" column="createUsername" /> <result property="createUsername" column="createUsername"/>
<result property="createTime" column="createTime" /> <result property="createTime" column="createTime"/>
<result property="createIp" column="createIp" /> <result property="createIp" column="createIp"/>
<result property="updateUserid" column="updateUserid" /> <result property="updateUserid" column="updateUserid"/>
<result property="updateUsername" column="updateUsername" /> <result property="updateUsername" column="updateUsername"/>
<result property="updateTime" column="updateTime" /> <result property="updateTime" column="updateTime"/>
<result property="updateIp" column="updateIp" /> <result property="updateIp" column="updateIp"/>
<result property="preLoginTime" column="preLoginTime" /> <result property="preLoginTime" column="preLoginTime"/>
<result property="lastLoginTime" column="lastLoginTime" /> <result property="lastLoginTime" column="lastLoginTime"/>
<result property="score" column="score"/> <result property="score" column="score"/>
<result property="evaluateCount" column="evaluateCount"/> <result property="evaluateCount" column="evaluateCount"/>
<result property="hotlinephone" column="hotlinephone" /> <result property="hotlinephone" column="hotlinephone"/>
<result property="goodat" column="goodat" /> <result property="goodat" column="goodat"/>
<result property="description" column="description" /> <result property="description" column="description"/>
<result property="headImgURL" column="headImgURL" /> <result property="headImgURL" column="headImgURL"/>
<result property="fullImgURL" column="fullImgURL" /> <result property="fullImgURL" column="fullImgURL"/>
<result property="isFreeMan" column="isFreeMan" /> <result property="isFreeMan" column="isFreeMan"/>
<result property="defaultVisit" column="defaultVisit" /> <result property="defaultVisit" column="defaultVisit"/>
<result property="accId" column="accid"/> <result property="accId" column="accid"/>
<result property="identityType" column="identityType"/> <result property="identityType" column="identityType"/>
<result property="token" column="token"/> <result property="token" column="token"/>
...@@ -47,54 +47,90 @@ ...@@ -47,54 +47,90 @@
<result property="wxCodeImgUrl" column="wx_code_imgUrl"/> <result property="wxCodeImgUrl" column="wx_code_imgUrl"/>
<result property="promoteId" column="promote_id"/> <result property="promoteId" column="promote_id"/>
<result property="onlineStatus" column="online_status"/> <result property="onlineStatus" column="online_status"/>
<result property="showMobile" column="showMobile" /> <result property="showMobile" column="showMobile"/>
</resultMap> </resultMap>
<resultMap id="infoMap2" type="com.house365.beans.entity.UserSimpleEntity"> <resultMap id="infoMap2" type="com.house365.beans.entity.UserSimpleEntity">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="realName" column="realName" /> <result property="realName" column="realName"/>
<result property="mobile" column="mobile" /> <result property="mobile" column="mobile"/>
<result property="hotlinephone" column="hotlinephone" /> <result property="hotlinephone" column="hotlinephone"/>
<result property="enabled" column="enabled" /> <result property="enabled" column="enabled"/>
<result property="cornet" column="cornet"/> <result property="cornet" column="cornet"/>
<result property="headImgURL" column="headImgURL" /> <result property="headImgURL" column="headImgURL"/>
<result property="fullImgURL" column="fullImgURL" /> <result property="fullImgURL" column="fullImgURL"/>
<result property="accId" column="accid"/> <result property="accId" column="accid"/>
<result property="goodat" column="goodat" /> <result property="goodat" column="goodat"/>
<result property="description" column="description" /> <result property="description" column="description"/>
<result property="score" column="score"/> <result property="score" column="score"/>
</resultMap> </resultMap>
<resultMap id="infoMap3" type="com.house365.beans.entity.DutyStaffEntity"> <resultMap id="infoMap3" type="com.house365.beans.entity.DutyStaffEntity">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="userId" column="userId" /> <result property="userId" column="userId"/>
<result property="onduty" column="onduty" /> <result property="onduty" column="onduty"/>
</resultMap> </resultMap>
<resultMap id="infoMap4" type="com.house365.beans.entity.RequestLoginEntity"> <resultMap id="infoMap4" type="com.house365.beans.entity.RequestLoginEntity">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="userId" column="userId" /> <result property="userId" column="userId"/>
<result property="realName" column="realName" /> <result property="realName" column="realName"/>
<result property="loginIp" column="loginIp" /> <result property="loginIp" column="loginIp"/>
<result property="loginCity" column="loginCity" /> <result property="loginCity" column="loginCity"/>
<result property="loginTime" column="loginTime" /> <result property="loginTime" column="loginTime"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="authorizationTime" column="authorizationTime" /> <result property="authorizationTime" column="authorizationTime"/>
</resultMap> </resultMap>
<select id="getById" resultMap="infoMap" parameterType="int"> <select id="getById" resultMap="infoMap" parameterType="int">
SELECT id, name,realName, password, weiXinId, mediaId, mobile, cornet, deptId, deptUrlPath, position, gender, SELECT id,
email, extattr, status, enabled, createUserid, createUsername, createTime, createIp, updateUserid, name,
updateUsername, updateTime, updateIp, preLoginTime, lastLoginTime, hotlinephone, goodat, realName,
description, headImgURL, fullImgURL,isFreeMan,defaultVisit,accid,identityType,token,wx_number,wx_code_imgUrl,showMobile password,
weiXinId,
mediaId,
mobile,
cornet,
deptId,
deptUrlPath,
position,
gender,
email,
extattr,
status,
enabled,
createUserid,
createUsername,
createTime,
createIp,
updateUserid,
updateUsername,
updateTime,
updateIp,
preLoginTime,
lastLoginTime,
hotlinephone,
goodat,
description,
headImgURL,
fullImgURL,
isFreeMan,
defaultVisit,
accid,
identityType,
token,
wx_number,
wx_code_imgUrl,
showMobile
FROM user FROM user
where id = #{id} AND enabled = 1 where id = #{id}
AND enabled = 1
</select> </select>
<select id="queryManagers" resultType="com.house365.beans.entity.UserEntity" parameterType="map"> <select id="queryManagers" resultType="com.house365.beans.entity.UserEntity" parameterType="map">
...@@ -148,12 +184,12 @@ ...@@ -148,12 +184,12 @@
<if test="onlineStatus != null and onlineStatus >= 0"> <if test="onlineStatus != null and onlineStatus >= 0">
AND online_status = #{onlineStatus} AND online_status = #{onlineStatus}
</if> </if>
<if test="deptId != null and deptId >= 0 ">
AND deptId = #{deptId}
</if>
<if test="showMobile != null and showMobile >= 0"> <if test="showMobile != null and showMobile >= 0">
AND showMobile = #{showMobile} AND showMobile = #{showMobile}
</if> </if>
<if test="deptId != null and deptId >= 0 ">
AND deptId = #{deptId}
</if>
<if test="deptIdList != null and deptIdList.size() > 0 "> <if test="deptIdList != null and deptIdList.size() > 0 ">
AND deptId in AND deptId in
<foreach collection="deptIdList" index="index" item="item" open="(" separator="," close=")"> <foreach collection="deptIdList" index="index" item="item" open="(" separator="," close=")">
...@@ -166,10 +202,22 @@ ...@@ -166,10 +202,22 @@
</select> </select>
<select id="queryUserInfoByd" resultMap="infoMap2" parameterType="map"> <select id="queryUserInfoByd" resultMap="infoMap2" parameterType="map">
SELECT name,realName, mobile,hotlinephone,cornet,enabled, SELECT name,
headImgURL, fullImgURL,accid,description,goodat, realName,
(select ifnull(format(AVG(eucl.score),1),0) from evaluate_user_customer_log eucl where eucl.user_id = u.id and mobile,
eucl.check_status =1 and eucl.is_deleted = 0) hotlinephone,
cornet,
enabled,
headImgURL,
fullImgURL,
accid,
description,
goodat,
(select ifnull(format(AVG(eucl.score), 1), 0)
from evaluate_user_customer_log eucl
where eucl.user_id = u.id
and eucl.check_status = 1
and eucl.is_deleted = 0)
score score
FROM user u FROM user u
where id = #{userId} where id = #{userId}
...@@ -177,10 +225,24 @@ ...@@ -177,10 +225,24 @@
</select> </select>
<select id="queryUserInfoByPhone" resultMap="infoMap2" parameterType="map"> <select id="queryUserInfoByPhone" resultMap="infoMap2" parameterType="map">
SELECT id,accid,name,realName, mobile,hotlinephone,cornet,enabled, SELECT id,
headImgURL, fullImgURL,accid,description,goodat, accid,
(select ifnull(format(AVG(eucl.score),1),0) from evaluate_user_customer_log eucl where eucl.user_id = u.id and name,
eucl.check_status =1 and eucl.is_deleted = 0) realName,
mobile,
hotlinephone,
cornet,
enabled,
headImgURL,
fullImgURL,
accid,
description,
goodat,
(select ifnull(format(AVG(eucl.score), 1), 0)
from evaluate_user_customer_log eucl
where eucl.user_id = u.id
and eucl.check_status = 1
and eucl.is_deleted = 0)
score score
FROM user u FROM user u
where mobile = #{phone} where mobile = #{phone}
...@@ -188,7 +250,23 @@ ...@@ -188,7 +250,23 @@
</select> </select>
<select id="getStaffDutyList" resultMap="infoMap3"> <select id="getStaffDutyList" resultMap="infoMap3">
select id,name,userId,onduty from duty_staff select id, name, userId, onduty
from duty_staff order by `order`
</select>
<select id="getDutyUserByCity" resultMap="infoMap">
select a.id, a.name, a.`realName`, a.`position`, b.`onduty` as enabled, b.order as status
from user a
join `duty_staff` b on a.id = b.userId
where a.`deptUrlPath` REGEXP CONCAT('^', (select urlPath from `department` where `descripition` = #{cityCode}))
order by b.`order`
</select>
<select id="getUserByCity" resultMap="infoMap">
select a.id, a.realName,a.position
from user a
where a.enabled = 1
and a.`deptUrlPath` REGEXP CONCAT('^', (select urlPath from `department` where `descripition` = #{cityCode}))
</select> </select>
<select id="getDutyByCondition" resultMap="infoMap3" parameterType="map"> <select id="getDutyByCondition" resultMap="infoMap3" parameterType="map">
...@@ -201,44 +279,73 @@ ...@@ -201,44 +279,73 @@
</select> </select>
<select id="getOndutyById" resultMap="infoMap3" parameterType="map"> <select id="getOndutyById" resultMap="infoMap3" parameterType="map">
select id,name,userId,onduty from duty_staff where userId = #{uid}# select id, name, userId, onduty
from duty_staff
where userId = #{uid}#
</select> </select>
<update id="updateDutyStaff" parameterType="com.house365.beans.entity.DutyStaffEntity">
UPDATE duty_staff
SET
onduty = #{onduty},
updateTime = #{updateTime}
WHERE id = #{id}
</update>
<update id="authorizationById" parameterType="com.house365.beans.entity.RequestLoginEntity"> <update id="authorizationById" parameterType="com.house365.beans.entity.RequestLoginEntity">
UPDATE request_login UPDATE request_login
SET SET status = #{status},
status = #{status},
authorizationTime = CURRENT_TIMESTAMP authorizationTime = CURRENT_TIMESTAMP
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<update id="updateRequestById" parameterType="com.house365.beans.entity.RequestLoginEntity"> <update id="updateRequestById" parameterType="com.house365.beans.entity.RequestLoginEntity">
UPDATE request_login UPDATE request_login
SET SET status = 2
status = 2 WHERE userId = #{userId}
WHERE userId = #{userId} and status=1 and status = 1
</update> </update>
<select id="getLimitLoginById" resultMap="infoMap"> <select id="getLimitLoginById" resultMap="infoMap">
select id, name,realName, password, weiXinId, mediaId, mobile, cornet, deptId, deptUrlPath, position, gender, select id,
email, extattr, status, enabled, createUserid, createUsername, createTime, createIp, updateUserid, name,
updateUsername, updateTime, updateIp, preLoginTime, lastLoginTime, hotlinephone, goodat, realName,
description, headImgURL, fullImgURL,isFreeMan,defaultVisit,accid,identityType,token,limitLogin,showMobile password,
from user where name = #{name} weiXinId,
mediaId,
mobile,
cornet,
deptId,
deptUrlPath,
position,
gender,
email,
extattr,
status,
enabled,
createUserid,
createUsername,
createTime,
createIp,
updateUserid,
updateUsername,
updateTime,
updateIp,
preLoginTime,
lastLoginTime,
hotlinephone,
goodat,
description,
headImgURL,
fullImgURL,
isFreeMan,
defaultVisit,
accid,
identityType,
token,
limitLogin,
showMobile
from user
where name = #{name}
</select> </select>
<select id="getManagerByPid" resultMap="infoMap" parameterType="map"> <select id="getManagerByPid" resultMap="infoMap" parameterType="map">
select * from ( select * from (
SELECT id,realName FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{id} ) SELECT id,realName FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id =
#{id} )
union union
select id,realName from user where id=#{id} select id,realName from user where id=#{id}
) t where 1=1 ) t where 1=1
...@@ -248,38 +355,90 @@ ...@@ -248,38 +355,90 @@
</select> </select>
<select id="getRequestLoginInfoById" resultMap="infoMap4"> <select id="getRequestLoginInfoById" resultMap="infoMap4">
select id,name,realName,loginIp,loginCity,loginTime,status,authorizationTime,userId select id,
from request_login where id = #{id}# name,
realName,
loginIp,
loginCity,
loginTime,
status,
authorizationTime,
userId
from request_login
where id = #{id}#
</select> </select>
<insert id="addRequestLoginInfo" parameterType="com.house365.beans.entity.RequestLoginEntity"> <insert id="addRequestLoginInfo" parameterType="com.house365.beans.entity.RequestLoginEntity">
insert into request_login (name,realName,loginIp,loginCity,loginTime,authorizationTime, userId) values insert into request_login (name, realName, loginIp, loginCity, loginTime, authorizationTime, userId)
( values (#{name}, #{realName}, #{loginIp}, #{loginCity}, #{loginTime}, #{authorizationTime}, #{userId})
#{name},#{realName},#{loginIp},#{loginCity},#{loginTime},#{authorizationTime}, #{userId}
)
</insert> </insert>
<select id="getRequestLoginInfo" resultMap="infoMap4"> <select id="getRequestLoginInfo" resultMap="infoMap4">
select id,name,realName,loginIp,loginCity,loginTime,status,authorizationTime,userId select id,
from request_login where name = #{name}# and loginIp = #{loginIp}# name,
realName,
loginIp,
loginCity,
loginTime,
status,
authorizationTime,
userId
from request_login
where name = #{name}#
and loginIp = #{loginIp}#
order by loginTime desc order by loginTime desc
</select> </select>
<update id="updateUserStatus" parameterType="map"> <update id="updateUserStatus" parameterType="map">
UPDATE user UPDATE user
SET SET online_status = #{onlineStatus}
online_status = #{onlineStatus}
WHERE mobile = #{mobile} WHERE mobile = #{mobile}
</update> </update>
<select id="getCityById" parameterType="String" resultType="String"> <select id="getCityById" parameterType="String" resultType="String">
select select case c.city
case c.city
when 'zb001' then 'nj' when 'zb001' then 'nj'
else c.city end else c.city end
as city as city
from user u inner join city_urlpath c on SUBSTRING_INDEX(u.deptUrlPath,'/',3)=c.urlpath where u.id=#{userId} from user u
inner join city_urlpath c on SUBSTRING_INDEX(u.deptUrlPath, '/', 3) = c.urlpath
where u.id = #{userId}
</select> </select>
<delete id="deleteDutyById" parameterType="Integer">
delete
FROM duty_staff
where userId = #{userId}
</delete>
<delete id="addDuty" parameterType="Integer">
insert into duty_staff (`name`, userId, updateTime, `order`)
values (#{name}, #{userId}, #{updateTime}, #{order})
</delete>
<update id="updateDutyStaff" parameterType="com.house365.beans.entity.DutyStaffEntity">
UPDATE duty_staff
SET onduty = #{onduty},
updateTime = #{updateTime}
WHERE id = #{id}
</update>
<select id="selectBuyDutyId" parameterType="integer" resultType="com.house365.beans.entity.DutyStaffEntity">
select `name`,userId,`order`,`onduty` from duty_staff where userId=#{userId}
</select>
<update id="updateDuty">
UPDATE duty_staff
SET `order` = #{order},
updateTime = #{updateTime}
WHERE userId = #{userId}
</update>
<update id="updateDutyOnduty">
UPDATE duty_staff
SET `onduty` = #{onduty},
updateTime = #{updateTime}
WHERE userId = #{userId}
</update>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment