Commit 5c7d8d4b authored by 谢希宇's avatar 谢希宇

Aidea product update by Strive Date 2020-10-13

parent 497cacd8
......@@ -99,10 +99,10 @@
<label>二维码类别</label>
<select class="form-control select2" name="typeselect"
id="typeselect" style="width: 100%;">
<option value="1">医师二维码</option>
<option value="2">客服二维码</option>
<option value="3">医生二维码</option>
<option value="4">组织二维码</option>
<option value="0">客服二维码</option>
<option value="1">药师二维码</option>
<option value="2">医生二维码</option>
<option value="3">组织二维码</option>
</select>
</div>
......
......@@ -97,7 +97,7 @@
<select class="form-control select2" name="type"
id="type">
<option value="-1" selected="selected">全部</option>
<option value="1">师二维码</option>
<option value="1">师二维码</option>
<option value="2">客服二维码</option>
<option value="3">医生二维码</option>
<option value="4">组织二维码</option>
......@@ -283,7 +283,7 @@
"aTargets": [1],
"mData": "ticket",
"mRender": function (a, b, c, d) {
return '<img src="https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket='+a+'" style="width: 160px;height: 120px;">';
return '<img src="https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket='+a+'" style="width: 120px;height: 120px;">';
}
},{
......@@ -313,7 +313,7 @@
if (a == '0') {
return '客服二维码';
} else if (a == '1') {
return '师二位码';
return '师二位码';
}else if(a == '2'){
return '医生二维码';
}else if(a=="3"){
......
......@@ -302,16 +302,13 @@ public class WxQrcodeController {
String uri = SystemConfig.p.getProperty("WX_MP_QRCODE_URI") + obj.getTicket();
String name = "";
String type = obj.getType();
if (type.equals("0")) {
name = obj.getStoreName();
} else if (type.equals("1")) {
name = obj.getEmpName();
} else if (type.equals("2")) {
name = obj.getCarName();
}
if (StringUtils.isEmpty(name)) {
if (StringUtils.isEmpty(obj.getQrcodeNames())) {
name = "未被绑定";
} else {
name = obj.getQrcodeNames();
}
ZipEntry entry = new ZipEntry(name + String.valueOf(i) + ".png");
// 设置压缩包的入口
zos.putNextEntry(entry);
......
......@@ -21,7 +21,7 @@
*/
//var URL = base + '/ueditor-min-1.4.3/';
//var URL = 'plugins/ueditor-min-1.4.3/';
var URL = '/schaeffler/assets/adminlte/plugins/ueditor-min-1.4.3/';
var URL = '/aidea/assets/adminlte/plugins/ueditor-min-1.4.3/';
/**
* 配置项主体。注意,此处所有涉及到路径的配置别遗漏URL变量。
......
......@@ -118,7 +118,7 @@
#if($shiro.hasPermission("sys:orgunit:edit"))
<a href="#springUrl('/a/orgunit/form')" class="btn btn-primary">新增</a>
<!--<a onclick="importExcel();" class="btn btn-primary">导入</a>-->
<a onclick="importExcel();" class="btn btn-primary">导入</a>
#end
</div>
......
......@@ -93,7 +93,7 @@
<div class="input-group">
<input type="text" id="orgId" name="orgId" value="$!{data.orgId}"
class="form-control" style="display: none">
<input type="text" id="orgName" name="orgName" value="$!{orgName}"
<input type="text" id="orgName" name="orgName" value="$!{orgName}" required="required"
class="form-control" disabled>
<span class="input-group-btn">
<button type="button" id="orgSelect"
......@@ -140,6 +140,17 @@
maxlength="50" placeholder="email"
value="$!{data.email}">
</div>
<div class="form-group form-md-line-input col-md-4">
<label>职业</label>
<select name="userType" class="form-control pull-right">
<option label="其他" value="4">其他</option>
<option label="订单员" value="3" #if($data.userType == '3') selected #end>订单员</option>
<option label="医生" value="2" #if($data.userType == '2') selected #end>医生</option>
<option label="药师" value="1" #if($data.userType == '1') selected #end>药师</option>
<option label="客服" value="0" #if($data.userType == '0') selected #end>客服</option>
</select>
</div>
<!--<div class="form-group form-md-line-input col-md-4">-->
<!--<label for="description">部门</label>-->
<!--<input type="text"-->
......@@ -459,10 +470,11 @@
return;
}
// if ($("#storeName").val() == null || $("#storeName").val() == "") {
// $("#storeName").after("<label class='error'>请选择门店</label>");
// return;
// }
if ($("#orgName").val() == null || $("#orgName").val() == "") {
//$("#orgName").after("<label class='error'>请选择所属组织</label>");
alert("请选择所属组织");
return;
}
$("#save").attr("disabled", true);
if ($('.select2').val()) {
......
......@@ -160,9 +160,10 @@
<th>姓名</th>
<th>手机号</th>
<th>邮箱</th>
<th>所属门店</th>
<th>所属部门</th>
<th>粉丝关注数</th>
<th>职位</th>
<!--<th>所属门店</th>-->
<!--<th>所属部门</th>-->
<!--<th>粉丝关注数</th>-->
<th>操作</th>
</tr>
</thead>
......@@ -296,13 +297,15 @@
"mData": "mobile"
}, {
"mData": "email"
}, {
},{
"mData": "userType"
},/* {
"mData": "storeName"
},{
"mData": "description"
},{
"mData": "fanssCount"
}, {
}, */{
"mData": "id"
}],
"aoColumnDefs": [{ // set default column settings
......@@ -318,7 +321,31 @@
return "<font color='red'>未绑定</font>";
}
},{
"aTargets": [9],
"aTargets": [6],
"mData": "userType",
"mRender": function (a, b, c, d) {//a表示对应mData的值,c表示当前记录行对象
let postion = null;
switch (a) {
case "0":
postion = "客服";
break;
case "1":
postion = "药师";
break;
case "2":
postion = "医生";
break;
case "3":
postion = "订单员";
break;
case "4":
postion = "其他";
break;
}
return "<font color='blue'>" +postion + "</font>";
}
},{
"aTargets": [7],
"mData": "id",
"mRender": function (a, b, c, d) {//a表示id对应的值,c表示当前记录行对象
var html = '#if($shiro.hasPermission("sys:qyuser:edit"))';//
......@@ -330,9 +357,10 @@
' </button>\n' +
' <ul class="dropdown-menu" role="menu">\n';
html += "<li><a href=#springUrl('/a/qyuser/form?id=" + a +"') >修改</a></li>";
html += "<li><a href='javascript:bindQrCode(" + a + ")' >绑定二维码</a></li>";
html += "<li><a href='javascript:unBindQrCode(" + a + ")' >取消绑定二维码</a></li>";
html += '<li><a href="javascript:unBindStore(' + a + ')" >清除门店角色</a></li>';
if (c.userType == '0' || c.userType == '1' || c.userType == '2')
html += "<li><a href='javascript:bindQrCode(" + a + ", "+ c.userType +")' >绑定二维码</a></li>";
if (c.qrcode != null)
html += "<li><a href='javascript:unBindQrCode(" + a + ", "+ c.userType +")' >取消绑定二维码</a></li>";
html += '<li><a href="javascript:removeData(' + a + ')" >删除</a></li>#end';
html+= '</ul></div>';
return html;
......@@ -358,8 +386,8 @@
//initOrgTree();
});
function unBindQrCode(id) {
var unBindQrcodeUri = "#springUrl('/a/qyuser/unBindQrcode')";
function unBindQrCode(id, type) {
var unBindQrcodeUri = "#springUrl('/a/qyuser/unBindQrcode?type="+type+"')";
Cfapp.confirm({
message: "确定要解除二维码绑定吗",
btnoktext: "确定",
......@@ -400,8 +428,8 @@
//绑定门店二维码
function bindQrCode(id) {
var qrCodeUri = "#springUrl('/a/wxQrcode/listData?type=1&isempty=1')";
function bindQrCode(id, type) {
var qrCodeUri = "#springUrl('/a/wxQrcode/listData?type="+type+"&isempty=1')";
var bindQrcodeUri = "#springUrl('/a/qyuser/bindQrcode')";
Cfapp.f7({
dataUrl: qrCodeUri, //导入的action Url
......@@ -589,7 +617,7 @@
function importExcel() {
var templateExcelUrl = "#springUrl('/a/qyuser/templateExcel')";
var importExcelUrl = "#springUrl('/a/qyuser/importExcel')";
var importExcelUrl = "#springUrl('/a/qyuser/importExcel')?_csrf_header=" + csrfheader.value + "&_csrf=" + csrftoken.value;
Cfapp.importExcel({
title: '人员导入',
......
......@@ -60,6 +60,9 @@ public class QyUserUtil {
}
public boolean exist(Qyuser qyuser) {
if (StringUtils.isEmpty(qyuser.getWxuserId()))
return false;
JSONObject retObj = WxApiUtils.userGet(qyTokenUtil.getToken(qyuser.getAccountsId()), qyuser.getWxuserId());
return retObj.getIntValue("errcode") == 0;
}
......@@ -114,6 +117,26 @@ public class QyUserUtil {
if (!StringUtils.isEmpty(qyuser.getWxno()))
postObj.put("weixinid", qyuser.getWxno());
if (!StringUtils.isEmpty(qyuser.getUserType())) {
switch (qyuser.getUserType()) {
case "0":
postObj.put("position", "客服");
break;
case "1":
postObj.put("position", "药师");
break;
case "2":
postObj.put("position", "医生");
break;
case "3":
postObj.put("position", "订单员");
break;
case "4":
postObj.put("position", "其他");
break;
}
}
JSONObject retObj = WxApiUtils.userCreate(qyTokenUtil.getToken(qyuser.getAccountsId()), postObj);
......@@ -145,6 +168,26 @@ public class QyUserUtil {
if (!StringUtils.isEmpty(qyuser.getWxno()))
postObj.put("weixinid", qyuser.getWxno());
if (!StringUtils.isEmpty(qyuser.getUserType())) {
switch (qyuser.getUserType()) {
case "0":
postObj.put("position", "客服");
break;
case "1":
postObj.put("position", "药师");
break;
case "2":
postObj.put("position", "医生");
break;
case "3":
postObj.put("position", "订单员");
break;
case "4":
postObj.put("position", "其他");
break;
}
}
JSONObject retObj = WxApiUtils.userUpdate(qyTokenUtil.getToken(qyuser.getAccountsId()), postObj);
return retObj.getIntValue("errcode") == 0;
......
......@@ -19,6 +19,8 @@
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="orgtype_id" property="orgtypeId"/>
<result column="parentName" property="parentName"/>
<result column="parentCode" property="parentCode"/>
</resultMap>
<resultMap id="resultMapVO" type="com.cftech.base.org.model.vo.OrgUnitVO">
......@@ -95,10 +97,13 @@
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT <include refid="sqlColumns" />
SELECT
t.id, t.`number`, t.create_by, t.create_time, t.update_by, t.update_time, t.del_flag, t.org_name, t.accounts_id, t.status, t.parent_id,
t.parent_ids, t.isadminunit, t.issalesunit, t.wxorg_id, t.orgtype_id, parent.number parentCode, parent.org_name parentName
FROM t_orgunit t
LEFT JOIN t_orgunit parent ON parent.id = t.parent_id
<include refid="sqlWhere"/>
and instr(t.parent_ids,'${orgId},')>0
-- and instr(t.parent_ids,'${orgId},')>0
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
......
......@@ -26,7 +26,7 @@
<result column="del_flag" property="delFlag" />
<result column="create_by" property="createBy" />
<result column="update_by" property="updateBy" />
<result column="is_ver" property="isVer" />
<result column="user_type" property="userType" />
</resultMap>
<resultMap id="resultMapVO" type="com.cftech.base.org.model.vo.QyuserVO">
......@@ -42,7 +42,8 @@
<result column="wxno" property="wxno" />
<result column="email" property="email" />
<result column="wxuser_id" property="wxuserId" />
<result column="is_ver" property="isVer" />
<result column="user_type" property="userType" />
<result column="gender" property="gender" />
</resultMap>
<sql id="sqlWhere">
......@@ -77,13 +78,13 @@
<sql id="sqlColumns">
id, name, qrcode, avatar, mobile, email, role, wxno, gender, accounts_id,
position_id, store_id, store_name, wxuser_id, org_id, tag_ids, status, create_time,
update_time, description, del_flag, create_by, update_by,is_ver
update_time, description, del_flag, create_by, update_by
</sql>
<sql id="sqlColumnsT">
t.id, t.name, t.qrcode, t.avatar, t.mobile, t.email,t.role, t.wxno, t.gender, t.accounts_id,
t.position_id, t.store_id, t.store_name, t.wxuser_id, t.org_id, t.tag_ids, t.status, t.create_time,
t.update_time, t.description, t.del_flag, t.create_by, t.update_by,is_ver
t.update_time, t.description, t.del_flag, t.create_by, t.update_by
</sql>
<insert id="save" parameterType="com.cftech.base.org.model.Qyuser"
......@@ -92,11 +93,11 @@
(
id, name, qrcode,
avatar, mobile, email, role,
wxno, gender, accounts_id, position_id,store_id,store_name,
wxno, gender, accounts_id,store_id,store_name,
wxuser_id, org_id, tag_ids,
status, create_time, update_time,
description, del_flag, create_by,
update_by,is_ver
update_by, user_type
)
values
(
......@@ -108,22 +109,20 @@
jdbcType=VARCHAR}, #{role,
jdbcType=VARCHAR}, #{wxno, jdbcType=VARCHAR}, #{gender,
jdbcType=VARCHAR}, #{accountsId, jdbcType=BIGINT},
#{positionId,
jdbcType=BIGINT}, #{storeId,
jdbcType=BIGINT}, #{storeName, jdbcType=VARCHAR},#{wxuserId, jdbcType=VARCHAR}, #{orgId,
#{storeId, jdbcType=BIGINT}, #{storeName, jdbcType=VARCHAR},#{wxuserId, jdbcType=VARCHAR}, #{orgId,
jdbcType=BIGINT}, #{tagIds, jdbcType=VARCHAR},
#{status,
jdbcType=VARCHAR}, now(), now(), #{description, jdbcType=VARCHAR},
#{delFlag, jdbcType=TINYINT}, #{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT},#{isVer, jdbcType=VARCHAR}
#{updateBy, jdbcType=BIGINT}, #{userType, jdbcType=VARCHAR}
)
</insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT
t.id, t.name, t.qrcode, t.avatar, t.mobile, t.email, t.role, t.wxno, t.gender, t.accounts_id,
t.position_id, t.store_id, t.store_name, t.wxuser_id, t.org_id, t.tag_ids, t.status, t.create_time,
t.update_time, t.description, t.del_flag, t.create_by, t.update_by,u.username loginName,is_ver
t.store_id, t.store_name, t.wxuser_id, t.org_id, t.tag_ids, t.status, t.create_time,
t.update_time, t.description, t.del_flag, t.create_by, t.update_by,u.username loginName
FROM t_qyuser t
left join user u on u.userid=t.id
WHERE t.id=#{id}
......@@ -143,8 +142,8 @@
resultMap="resultMap">
SELECT
t.id, t.name, t.qrcode, t.avatar, t.mobile, t.email, t.role, t.wxno, t.gender, t.accounts_id,
t.position_id, t.store_id, t.store_name, t.wxuser_id, t.org_id, t.tag_ids, t.status, t.create_time,
t.update_time, t.description, t.del_flag, t.create_by, t.update_by,u.username loginName,is_ver
t.store_id, t.store_name, t.wxuser_id, t.org_id, t.tag_ids, t.status, t.create_time,
t.update_time, t.description, t.del_flag, t.create_by, t.update_by,u.username loginName
FROM t_qyuser t
left join t_orgunit o on o.id = t.org_id
left join user u on u.userid=t.id
......@@ -228,9 +227,6 @@
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
<if test="isVer != null">
is_ver = #{isVer, jdbcType=VARCHAR},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
......@@ -242,17 +238,17 @@
<select id="fetchSearchVOByPage" parameterType="java.util.Map"
resultMap="resultMapVO">
SELECT t.id id, t.qrcode qrcode, t.avatar avatar,t.role role, p.name position_name, s.name store_name,
o.org_name org_name,
t.name name, t.mobile mobile, t.wxno wxno, t.email email,t.description,
t.wxuser_id
wxuser_id,
u.username loginName,(select count(1) from wx_mp_fanss fanss where fanss.recommender=t.id and fanss.mpaccountid=t.accounts_id and fanss.delflag=0) fanssCount,is_ver
SELECT
t.id id, t.qrcode qrcode, t.avatar avatar,t.role role,
o.org_name org_name,
t.name name, t.mobile mobile, t.wxno wxno, t.email email,t.description,
t.wxuser_id
wxuser_id,
u.username loginName, t.user_type, t.gender, qrcode.ticket qrcode
FROM t_qyuser t
left join t_position p on p.id =t.position_id
left join t_dc_store s on s.id = t.store_id
left join t_orgunit o on o.id = t.org_id
left join user u on u.userid=t.id
left join user u on u.userid = t.id
left join t_shop_wxqrcode qrcode on qrcode.bind_id = t.id AND (qrcode.type = '0' or qrcode.type = '1' or qrcode.type = '2')
<include refid="sqlWhere" />
<if test="orgId > 0">
and instr(o.parent_ids,',${orgId},')>0
......@@ -342,9 +338,6 @@
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
<if test="isVer != null">
is_ver = #{isVer, jdbcType=VARCHAR},
</if>
</set>
<include refid="sqlWhere" />
</update>
......@@ -468,7 +461,7 @@
<select id="getLogInfo" parameterType="java.util.Map" resultMap="resultMap">
select b.id,b.name,b.store_id, b.role,c.name store_name,b.qrcode,b.is_ver from user a INNER JOIN t_qyuser b on b.id = a.userid
select b.id,b.name,b.store_id, b.role,c.name store_name,b.qrcode from user a INNER JOIN t_qyuser b on b.id = a.userid
INNER JOIN t_dc_store c on c.id = b.store_id
where a.id = #{id} and a.delflag = '0'
</select>
......
......@@ -21,21 +21,29 @@ public class OrgUnit implements Serializable {
/**
* 组织编码
*/
@ExportConfig(value = "组织编码", width = 100)
@ExportConfig(value = "组织编码", width = 120)
private String number;
/**
* 组织名称
*/
@ExportConfig(value = "组织名称", width = 100)
@ExportConfig(value = "组织名称", width = 120)
private String orgName;
/**
* 微信组织id
*/
//@ExportConfig(value = "微信组织id", width = 100, showLevel = 1)
private String wxorgId;
/* 父级组织 */
@ExportConfig(value = "上级组织编码", width = 100, showLevel = 2)
//@ExportConfig(value = "上级组织编码", width = 100, showLevel = 2)
private Long parentId;
@ExportConfig(value = "上级组织编码", width = 120)
private String parentCode;
@ExportConfig(value = "上级组织名称", width = 120)
private String parentName;
/**
* 组织分类
*/
......
......@@ -137,9 +137,9 @@ public class Qyuser implements Serializable {
private String qrcode;
/**
*是否可以核销 0:可核销 1:不可核销
* 用户类型 0:客服 ;1:药师; 2:医生; 3:订单员 4:其他
*/
private String isVer;
private String userType;
public Qyuser() {
......
......@@ -30,22 +30,22 @@ public class QyuserVO implements Serializable {
private String wxuserId;
@ExportConfig(value = "部门", width = 100)
private String description;
@ExportConfig(value = "门店编码", width = 100,showLevel=2)
private String storeId;
// @ExportConfig(value = "门店编码", width = 100,showLevel=2)
// private String storeId;
@ExportConfig(value = "门店名称", width = 100,showLevel=1)
private String storeName;
// @ExportConfig(value = "门店名称", width = 100,showLevel=1)
// private String storeName;
@ExportConfig(value = "登录账号(密码同账号)", width = 100)
private String loginName;
@ExportConfig(value = "粉丝关注数", width = 100,showLevel=1)
private String fanssCount;
@ExportConfig(value = "职业(0:客服;1:药师;2:医生;3:订单员;4:其他)", width = 200)
private String userType;
/**
*是否可以核销 0:可核销 1:不可核销
*/
@ExportConfig(value = "是否可核销 0:可核销 1:不可核销(默认)")
private String isVer;
@ExportConfig(value = "性别", width = 120)
private String gender;
// @ExportConfig(value = "粉丝关注数", width = 100,showLevel=1)
// private String fanssCount;
}
......@@ -81,11 +81,12 @@ public class OrgUnitServiceImpl extends GenericServiceImpl<OrgUnit> implements O
@Override
public List<OrgUnit> fetchSearchByPage(Long orgId, Conds conds, Sort sort, int page, int pageSize) {
Map<String, Object> params = new HashMap<>();
if (orgId == 0) {
params.put("orgId", orgId);
} else {
params.put("orgId", "," + orgId);
}
// if (orgId == 0) {
// params.put("orgId", orgId);
// } else {
// params.put("orgId", "," + orgId);
// }
params.put("conds", conds);
params.put("offset", page > 0 ? page : 0);
......@@ -117,10 +118,9 @@ public class OrgUnitServiceImpl extends GenericServiceImpl<OrgUnit> implements O
@Override
public OrgUnit findByAccountIdAndNumber(Long accountId, String number) {
Conds myCond = new Conds();
myCond.equal("del_flag", Constants.DEL_FLAG_0);
myCond.equal("accounts_id", accountId);
myCond.equal("number", number);
myCond.equal("t.del_flag", Constants.DEL_FLAG_0);
myCond.equal("t.accounts_id", accountId);
myCond.equal("t.number", number);
return fetchSearchByConds(myCond);
}
......
......@@ -53,26 +53,26 @@ public class MobileGuideLoginController {
rtnJson.put("errorMsg", "用户名或者密码不正确,请重试!");
}else
{
//根据ID, 查询对应的QY 用户身份
Map<String,Object> map = new HashMap<String,Object>();
map.put("id",authentication.getId());
List<Qyuser> users = qyuserService.getLogInfo(map);
if(users==null||users.size()==0)
{
rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "用户名或者密码不正确,请重试!");
}else
{
Qyuser currUser=users.get(0);
if(currUser.getIsVer().equals("0")){
rtnJson.put("errorNo", "0");
rtnJson.put("data", users.get(0));
}else{
rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "无核销权限!");
}
}
// //根据ID, 查询对应的QY 用户身份
// Map<String,Object> map = new HashMap<String,Object>();
// map.put("id",authentication.getId());
// List<Qyuser> users = qyuserService.getLogInfo(map);
// if(users==null||users.size()==0)
// {
// rtnJson.put("errorNo", "1");
// rtnJson.put("errorMsg", "用户名或者密码不正确,请重试!");
// }else
// {
// Qyuser currUser=users.get(0);
// if(currUser.getIsVer().equals("0")){
// rtnJson.put("errorNo", "0");
// rtnJson.put("data", users.get(0));
// }else{
// rtnJson.put("errorNo", "1");
// rtnJson.put("errorMsg", "无核销权限!");
// }
//
// }
}
return rtnJson.toString();
}
......
......@@ -120,7 +120,8 @@ public class OrgUnitController {
parentOrgUnit = orgUnitService.fetchById(orgUnit.getParentId());
orgUnit.setParentIds(parentOrgUnit.getParentIds() + orgUnit.getId() + ",");
} else {
orgUnit.setParentIds("0," + orgUnit.getId() + ",");
orgUnit.setParentId(1L);
orgUnit.setParentIds("0,1," + orgUnit.getId() + ",");
}
//同步至企业号
......@@ -141,17 +142,18 @@ public class OrgUnitController {
rtnJson.put("errorNo", 0);
} else {
orgUnit.setAccountsId(accountsId);
// orgUnit.setIsSalesUnit(true);
orgUnit.setNumber(codingruleUtils.getNumber(accountsId, OrgUnit.class.getName()));
// do create
OrgUnit parentOrgUnit = null;
if (!StringUtils.isEmpty(orgUnit.getParentId())) {
parentOrgUnit = orgUnitService.fetchById(orgUnit.getParentId());
} else {
orgUnit.setParentId(1L);
}
orgUnit.setDelFlag(false);
orgUnit.setStatus("0");
orgUnit.setParentIds(parentOrgUnit == null ? 0 + "," : parentOrgUnit.getParentIds());
orgUnit.setParentIds(parentOrgUnit == null ? "0,1," : parentOrgUnit.getParentIds());
orgUnit.setCreateBy(UserUtils.getUser().getId());
orgUnit.setUpdateBy(UserUtils.getUser().getId());
orgUnitService.saveCache(orgUnit);
......@@ -254,12 +256,12 @@ public class OrgUnitController {
Long accountId = Long.parseLong(qyAccounts);
Sort sort = new Sort("parent_id", OrderType.ASC);
Conds conds = new Conds();
conds.equal("del_flag", 0);
conds.equal("accounts_id", accountId);
User user = UserUtils.getUser();
Qyuser qyuser = qyuserService.fetchById(user.getUserid());
Long orgId = qyuser.getOrgId();
List<OrgUnit> orgunits = orgUnitService.fetchSearchByPage(orgId, conds, sort, 0, 0);
conds.equal("t.del_flag", 0);
conds.equal("t.accounts_id", accountId);
// User user = UserUtils.getUser();
// Qyuser qyuser = qyuserService.fetchById(user.getUserid());
// Long orgId = qyuser.getOrgId();
List<OrgUnit> orgunits = orgUnitService.fetchSearchByPage(null, conds, sort, 0, 0);
// 生成Excel并使用浏览器下载
ExcelKit.$Export(OrgUnit.class, response).toExcel(orgunits, "组织信息");
......@@ -390,8 +392,8 @@ public class OrgUnitController {
JSONArray array = new JSONArray();
Sort sort = new Sort("parent_id", OrderType.ASC);
Conds conds = new Conds();
conds.equal("del_flag",0);
conds.equal("accounts_id", accountId);
conds.equal("t.del_flag",0);
conds.equal("t.accounts_id", accountId);
//用户
// User user = UserUtils.getUser();
// Qyuser qyuser = qyuserService.fetchById(user.getUserid());
......
......@@ -12,11 +12,14 @@ import com.cftech.base.org.service.PositionService;
import com.cftech.base.org.service.QyuserService;
import com.cftech.base.org.service.TerminalUserService;
import com.cftech.core.poi.ExcelKit;
import com.cftech.core.scope.CondType;
import com.cftech.core.scope.OrderType;
import com.cftech.core.sql.Cond;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants;
import com.cftech.core.util.Encrypt;
import com.cftech.core.util.SystemConfig;
import com.cftech.shop.qrcode.model.WxQrcode;
import com.cftech.shop.qrcode.service.WxQrcodeService;
import com.cftech.sys.model.User;
......@@ -38,6 +41,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -68,11 +72,13 @@ public class QyuserController {
@Autowired
private UserService userService;
private final static String qyAccounts = SystemConfig.p.getProperty("AIDEA_QY_ACCOUNTS");
//返回列表页面
@RequiresPermissions(value = PermissionSign.QYUSER_VIEW)
@RequestMapping(value = "/list",method = {RequestMethod.GET,RequestMethod.POST})
public String qyuserList(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
Long accountId = Long.parseLong(qyAccounts);
model.addAttribute("accountId", accountId);
return "managerqyuser/qyuserlist";
}
......@@ -81,7 +87,7 @@ public class QyuserController {
@RequiresPermissions(value = PermissionSign.QYUSER_VIEW)
@RequestMapping(value = "/form",method = {RequestMethod.GET,RequestMethod.POST})
public String form(HttpServletRequest request, String id, Model model) {
Long accountId = Long.parseLong(qyAccounts);
if (!StringUtils.isEmpty(id)) {
Qyuser qyuser = qyuserService.fetchById(id);
if (qyuser.getOrgId() != null) {
......@@ -100,7 +106,7 @@ public class QyuserController {
model.addAttribute("data", qyuser);
model.addAttribute("accountId", qyuser.getAccountsId());
} else {
Long accountId = UserUtils.getmpaccounts(request);
model.addAttribute("accountId", accountId);
}
return "managerqyuser/qyuseradd";
......@@ -111,6 +117,7 @@ public class QyuserController {
@RequestMapping(value = "/formData",method = {RequestMethod.POST})
@ResponseBody
public JSONObject qyuserListformData(Qyuser qyuser, Model model, HttpServletRequest request,String terminalIds,String passwordQyUser,String loginNameQyUser) {
Long accountId = Long.parseLong(qyAccounts);
JSONObject rtnJson = new JSONObject();
Long userId = UserUtils.getUser().getId();
Conds userConds = new Conds();
......@@ -123,7 +130,7 @@ public class QyuserController {
Conds conds = new Conds();
conds.equal("t.username",loginNameQyUser);
conds.equal("t.delflag",0);
conds.equal("t.state",1);
conds.equal("t.state",0);
conds.notEqual("t.id",user.getId());
User userExits = userService.fetchSearchByConds(conds);
if(userExits!=null){
......@@ -132,9 +139,10 @@ public class QyuserController {
return rtnJson;
}
qyuser.setUpdateBy(userId);
qyuser.setWxuserId(loginNameQyUser);
//update
// 2017-10-27 取消同步微信企业号标签操作
// qyUserUtil.updateQyUser(qyuser);
qyUserUtil.updateQyUser(qyuser);
qyuserService.update(qyuser);
if(!StringUtils.isEmpty(loginNameQyUser)){
user.setUsername(loginNameQyUser);
......@@ -148,9 +156,9 @@ public class QyuserController {
rtnJson.put("errorNo", 0);
} else {
Conds conds = new Conds();
conds.equal("t.username",loginNameQyUser);
conds.equal("t.username", loginNameQyUser);
conds.equal("t.delflag",0);
conds.equal("t.state",1);
conds.equal("t.state",0);
User userExits = userService.fetchSearchByConds(conds);
if(userExits!=null){
//登录账号重复
......@@ -161,16 +169,18 @@ public class QyuserController {
user = new User();
//新增
qyuser.setDelFlag(false);
qyuser.setAccountsId(UserUtils.getmpaccounts(request));
qyuser.setAccountsId(accountId);
qyuser.setCreateBy(UserUtils.getUser().getId());
qyuser.setUpdateBy(UserUtils.getUser().getId());
// 2017-10-27 取消同步微信操作
// qyUserUtil.updateQyUser(qyuser);
qyuser.setWxuserId(loginNameQyUser);
//同步至企业微信
qyUserUtil.updateQyUser(qyuser);
user.setPassword(passwordQyUser);
user.setUsername(loginNameQyUser);
user.setState("1");
user.setState("0");
qyuserService.save(qyuser);
user.setUserid(qyuser.getId());
user.setDefaultAccId(UserUtils.getmpaccounts(request));
userService.save(user);
//2017-10-27 取消同步微信企业号标签操作 qyTagUtil.syncTag(qyuser);
rtnJson.put("errorNo", 2);
......@@ -189,10 +199,10 @@ public class QyuserController {
@RequestMapping(value = "/listData",method = {RequestMethod.GET,RequestMethod.POST})
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, Qyuser qyuser, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
Long accountId = Long.parseLong(qyAccounts);
Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.accounts_id", accountsId);
conds.equal("t.accounts_id", accountId);
if (!StringUtils.isEmpty(qyuser.getName())) {
conds.like("t.name", qyuser.getName());
}
......@@ -219,7 +229,7 @@ public class QyuserController {
Conds myCond = new Conds();
myCond.equal("t.del_flag", Constants.DEL_FLAG_0);
myCond.equal("t.accounts_id", accountsId);
myCond.equal("t.accounts_id", accountId);
if (!StringUtils.isEmpty(qyuser.getName())) {
myCond.like("t.name", qyuser.getName());
}
......@@ -243,16 +253,16 @@ public class QyuserController {
@RequiresPermissions(value = PermissionSign.QYUSER_EDIT)
@RequestMapping(value = "/unBindQrcode",method = {RequestMethod.POST})
@ResponseBody
public JSONObject unBindQrcode(HttpServletRequest request,Long userId) {
public JSONObject unBindQrcode(HttpServletRequest request,Long userId, String type) {
JSONObject retObj = new JSONObject();
Qyuser qyuser = qyuserService.fetchById(userId);
if (com.cftech.core.util.StringUtils.isNotBlank(qyuser.getQrcode())) {
//如果原来有数据,需要先取消绑定原有的记录
Long accountsId = UserUtils.getmpaccounts(request);
Long accountId = Long.parseLong(qyAccounts);
Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.accounts_id", accountsId);
conds.equal("t.type", "1");
conds.equal("t.accounts_id", UserUtils.getmpaccounts(request));
conds.equal("t.type", type);
conds.equal("t.bind_id", userId);
List<WxQrcode> list = wxQrcodeService.fetchSearchByPage(0L, conds, null, 0, 0);
......@@ -297,10 +307,10 @@ public class QyuserController {
// }
if (com.cftech.core.util.StringUtils.isNotBlank(qyuser.getQrcode())) {
//如果原来有数据,需要先取消绑定原有的记录
Long accountsId = UserUtils.getmpaccounts(request);
Long accountId = Long.parseLong(qyAccounts);
Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.accounts_id", accountsId);
conds.equal("t.accounts_id", accountId);
conds.equal("t.type", "1");
conds.equal("t.bind_id", id);
......@@ -328,7 +338,7 @@ public class QyuserController {
@RequestMapping(value = "/exportExcel",method = {RequestMethod.GET,RequestMethod.POST})
@RequiresPermissions(value = PermissionSign.QYUSER_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response, Qyuser qyuser) {
Long accountId = UserUtils.getmpaccounts(request);
Long accountId = Long.parseLong(qyAccounts);
Sort sort = new Sort("t.create_time", OrderType.DESC);
Conds conds = new Conds();
conds.equal("t.del_flag", 0);
......@@ -345,10 +355,30 @@ public class QyuserController {
if (!StringUtils.isEmpty(qyuser.getDescription())) {
conds.like("t.description", qyuser.getDescription());
}
User user = UserUtils.getUser();
// User user = UserUtils.getUser();
// Qyuser currentQyyuser = qyuserService.fetchById(user.getUserid());
// Long orgId = currentQyyuser.getOrgId();
List<QyuserVO> qyusers = qyuserService.fetchSearchVOByPage(null, conds, sort, 0, 0);
qyusers.stream().forEach(o -> {
String position = o.getUserType();
switch (position) {
case "0":
o.setUserType("客服");
break;
case "1":
o.setUserType("药师");
break;
case "2":
o.setUserType("医生");
break;
case "3":
o.setUserType("订单员");
break;
case "4":
o.setUserType("其他");
break;
}
});
// 生成Excel并使用浏览器下载
ExcelKit.$Export(QyuserVO.class, response).toExcel(qyusers, "企业人员信息");
......@@ -364,7 +394,7 @@ public class QyuserController {
@RequestMapping(value = "/importExcel",method = {RequestMethod.GET,RequestMethod.POST})
@RequiresPermissions(value = PermissionSign.QYUSER_EDIT)
public String importExcel(HttpServletRequest request, MultipartFile file, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
Long accountId = Long.parseLong(qyAccounts);
StringBuffer stringBuffer = new StringBuffer();
if (file == null) {
return qyuserList(request, model);
......@@ -382,14 +412,14 @@ public class QyuserController {
file.transferTo(storeFile);
ExcelKit.$Import().setEmptyCellValue(null).readExcel(storeFile, rowData -> {
//2是姓名
if (!StringUtils.isEmpty(rowData.get(5))) {
if (!StringUtils.isEmpty(rowData.get(4))) {
Qyuser qyuser = new Qyuser();
qyuser.setAccountsId(accountId);
Conds isConds = new Conds();
isConds.equal("t.mobile",rowData.get(1));
isConds.equal("u.username",rowData.get(5));
isConds.equal("u.username",rowData.get(4));
isConds.equal("u.delflag",0);
isConds.equal("u.state",1);
isConds.equal("u.state",0);
Qyuser qyuserExits = qyuserService.fetchSearchByConds(isConds);
if(qyuserExits!=null){
stringBuffer.append("重复导入,"+rowData.toString()+"<br/>");
......@@ -400,19 +430,27 @@ public class QyuserController {
qyuser.setName(rowData.get(0));
qyuser.setEmail(rowData.get(2));
qyuser.setMobile(rowData.get(1));
qyuser.setDescription(rowData.get(3));
if(com.cftech.core.util.StringUtils.isNotBlank(rowData.get(6))){
qyuser.setIsVer(rowData.get(6));
}else{
qyuser.setIsVer("1");
qyuser.setWxuserId(rowData.get(4));
qyuser.setUserType(rowData.get(5));
qyuser.setGender(rowData.get(6));
if (!StringUtils.isEmpty(rowData.get(3).toString())){
OrgUnit orgUnit = orgUnitService.findByAccountIdAndNumber(accountId, rowData.get(3).toString());
qyuser.setOrgId(orgUnit.getId());
} else {
stringBuffer.append("组织导入为空,"+rowData.toString()+"<br/>");
log.info("导入SA人员时出现重复账号,重复账号的行数据是:"+rowData.toString());
return;
}
//qyUserUtil.updateQyUser(qyuser);
//qyuser.setDescription(rowData.get(3));
qyUserUtil.updateQyUser(qyuser);
qyuserService.save(qyuser);
User user = new User();
user.setState("1");
user.setUsername(rowData.get(5));
user.setPassword(Encrypt.SHA256(rowData.get(5)));
user.setState("0");
user.setUsername(rowData.get(4));
user.setPassword(Encrypt.SHA256(rowData.get(4)));
user.setDelflag(0);
user.setUserid(qyuser.getId());
userService.save(user);
......@@ -434,10 +472,10 @@ public class QyuserController {
@RequestMapping(value = "/listDataNoAuth",method = {RequestMethod.GET,RequestMethod.POST})
@ResponseBody
public JSONObject listDataNoAuth(int iDisplayStart, int iDisplayLength, Qyuser qyuser, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
Long accountId = Long.parseLong(qyAccounts);
Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.accounts_id", accountsId);
conds.equal("t.accounts_id", accountId);
if (!StringUtils.isEmpty(qyuser.getName())) {
conds.like("t.name", qyuser.getName());
}
......@@ -461,7 +499,7 @@ public class QyuserController {
Conds myCond = new Conds();
myCond.equal("t.del_flag", Constants.DEL_FLAG_0);
myCond.equal("t.accounts_id", accountsId);
myCond.equal("t.accounts_id", accountId);
if (!StringUtils.isEmpty(qyuser.getName())) {
myCond.like("t.name", qyuser.getName());
}
......@@ -480,7 +518,7 @@ public class QyuserController {
@RequiresPermissions(value = PermissionSign.QYUSER_EDIT)
@ResponseBody
public JSONObject sync(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
Long accountId = Long.parseLong(qyAccounts);
// 同步微信端的人员,下拉到本地为主
JSONObject retObj = qyUserUtil.sync(accountId);
log.info("同步结果: {}", retObj.toJSONString());
......@@ -606,10 +644,10 @@ public class QyuserController {
Qyuser qyuser = qyuserService.fetchById(id);
if (!StringUtils.isEmpty(qyuser.getQrcode())) {
//如果原来有数据,需要先取消绑定原有的记录
Long accountsId = UserUtils.getmpaccounts(request);
Long accountId = Long.parseLong(qyAccounts);
Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.accounts_id", accountsId);
conds.equal("t.accounts_id", accountId);
conds.equal("t.type", "1");
conds.equal("t.bind_id", id);
......
......@@ -6,7 +6,7 @@ var G = (function () {
//'use strict';
var baseUri = function () {
return '/schaeffler';
return '/aidea';
};
var devMode = function () {
......
......@@ -19,7 +19,7 @@ var cfApp = (function () {
p.OAUTH_URL = baseUri + '/mobile/wxjs/oauth';
// TODO 需要替换
p.registerHtml = baseUri + "/static/mp/schaeffler/invitation-code.html";
p.registerHtml = baseUri + "/static/mp/aidea/invitation-code.html";
//当前的用户信息
p.mpInfoObj = null;
......
......@@ -457,7 +457,7 @@ var form = (function () {
keyword1: date.trim(),
keyword2: begintime + "-" + endtime,
keyword3: content,
paperUrl: window.location.protocol + "//" + window.location.host + G.baseUri() + "/static/mp/schaeffler/process/showroom_evaluate.html?appid=" + p.params.appid
paperUrl: window.location.protocol + "//" + window.location.host + G.baseUri() + "/static/mp/aidea/process/showroom_evaluate.html?appid=" + p.params.appid
};
$("#next_step").css("pointer-events", "none");
G.ajax('post', p.params.isAppointmentApi, formdata, function (retdata) {
......
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