Commit 40052939 by fudahua

Merge remote-tracking branch 'origin/developer' into developer

parents ed317973 8e38029c
package com.gic.haoban.manage.api.dto; package com.gic.haoban.manage.api.dto;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* Created by tgs on 2020/2/9. * Created by tgs on 2020/2/9.
...@@ -17,6 +18,9 @@ public class EnterpriseDetailDTO implements Serializable{ ...@@ -17,6 +18,9 @@ public class EnterpriseDetailDTO implements Serializable{
private String version; private String version;
private int nodeCount; private int nodeCount;
private String enterpriseLogo; private String enterpriseLogo;
private String staffId;
private String staffName;
private Date createTime;
public String getWxEnterpriseRelatedId() { public String getWxEnterpriseRelatedId() {
return wxEnterpriseRelatedId; return wxEnterpriseRelatedId;
} }
...@@ -59,6 +63,24 @@ public class EnterpriseDetailDTO implements Serializable{ ...@@ -59,6 +63,24 @@ public class EnterpriseDetailDTO implements Serializable{
public void setEnterpriseLogo(String enterpriseLogo) { public void setEnterpriseLogo(String enterpriseLogo) {
this.enterpriseLogo = enterpriseLogo; this.enterpriseLogo = enterpriseLogo;
} }
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
} }
...@@ -6,6 +6,7 @@ import com.gic.api.base.commons.Page; ...@@ -6,6 +6,7 @@ import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.GicClerkDTO; import com.gic.haoban.manage.api.dto.GicClerkDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.UserLoginLogDTO; import com.gic.haoban.manage.api.dto.UserLoginLogDTO;
...@@ -90,4 +91,6 @@ public interface StaffApiService { ...@@ -90,4 +91,6 @@ public interface StaffApiService {
void wxFristAdd(String userJson, String wxEnterpriseId); void wxFristAdd(String userJson, String wxEnterpriseId);
List<String> listBindClerkUserId(String storeId); List<String> listBindClerkUserId(String storeId);
public List<StaffClerkRelationDTO> listBindRelationUserId(String storeId);
} }
...@@ -39,7 +39,7 @@ public interface StaffClerkRelationApiService { ...@@ -39,7 +39,7 @@ public interface StaffClerkRelationApiService {
String delByStoreIdAndCode(String storeId,String clerkCode); String delByStoreIdAndCode(String storeId,String clerkCode);
StaffClerkRelationDTO getOneByClerkId(String clerkId);
List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkIds); List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkIds);
...@@ -57,5 +57,12 @@ public interface StaffClerkRelationApiService { ...@@ -57,5 +57,12 @@ public interface StaffClerkRelationApiService {
* @return * @return
*/ */
boolean unbindByStaffAndClerkId(String staffId,String clerkId); boolean unbindByStaffAndClerkId(String staffId,String clerkId);
/**
* 查询导购信息
* @param clerkId
* @return
*/
StaffClerkRelationDTO getByClerkId(String clerkId);
} }
...@@ -26,4 +26,6 @@ public interface WxEnterpriseRelatedApiService { ...@@ -26,4 +26,6 @@ public interface WxEnterpriseRelatedApiService {
*/ */
List<EnterpriseDetailDTO> queryBindGicEnterpriseByTime(String seqTime); List<EnterpriseDetailDTO> queryBindGicEnterpriseByTime(String seqTime);
int wxEnterpriseBind(String enterpriseId, String wxEnterpriseId, String version, String staffId, String staffName);
} }
...@@ -68,4 +68,6 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -68,4 +68,6 @@ public interface TabHaobanStaffClerkRelationMapper {
TabHaobanStaffClerkRelation getOneBindCodeNoStatus(@Param("enterpriseId")String enterpriseId, @Param("clerkCode")String clerkCode); TabHaobanStaffClerkRelation getOneBindCodeNoStatus(@Param("enterpriseId")String enterpriseId, @Param("clerkCode")String clerkCode);
TabHaobanStaffClerkRelation getOneBindStoreId(@Param("staffId")String staffId, @Param("storeId")String storeId); TabHaobanStaffClerkRelation getOneBindStoreId(@Param("staffId")String staffId, @Param("storeId")String storeId);
TabHaobanStaffClerkRelation getByClerkId(@Param("clerkId")String clerkId);
} }
\ No newline at end of file
...@@ -17,6 +17,10 @@ public class TabHaobanWxEnterpriseRelated implements Serializable { ...@@ -17,6 +17,10 @@ public class TabHaobanWxEnterpriseRelated implements Serializable {
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
private String staffId;
private String staffName;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -75,4 +79,22 @@ public class TabHaobanWxEnterpriseRelated implements Serializable { ...@@ -75,4 +79,22 @@ public class TabHaobanWxEnterpriseRelated implements Serializable {
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
} }
\ No newline at end of file
...@@ -51,4 +51,8 @@ public interface StaffClerkRelationService { ...@@ -51,4 +51,8 @@ public interface StaffClerkRelationService {
StaffClerkRelationDTO getOneBindByStoreId(String staffId, String storeId); StaffClerkRelationDTO getOneBindByStoreId(String staffId, String storeId);
StaffClerkRelationDTO getByClerkId(String clerkId);
List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkList);
} }
...@@ -100,4 +100,12 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -100,4 +100,12 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
public StaffClerkRelationDTO getOneBindByStoreId(String staffId, String storeId) { public StaffClerkRelationDTO getOneBindByStoreId(String staffId, String storeId) {
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class,mapper.getOneBindStoreId(staffId,storeId)); return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class,mapper.getOneBindStoreId(staffId,storeId));
} }
@Override
public StaffClerkRelationDTO getByClerkId(String clerkId) {
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class,mapper.getByClerkId(clerkId));
}
@Override
public List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkList) {
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class,mapper.listByClerkIds(clerkList));
}
} }
...@@ -204,6 +204,7 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -204,6 +204,7 @@ public class AuditApiServiceImpl implements AuditApiService{
staffClerkRelation.setStoreId(tab.getCommitStoreId()); staffClerkRelation.setStoreId(tab.getCommitStoreId());
staffClerkRelation.setWxEnterpriseId(tab.getWxEnterpriseId()); staffClerkRelation.setWxEnterpriseId(tab.getWxEnterpriseId());
staffClerkRelation.setWxUserId(obj.getWxUserId()); staffClerkRelation.setWxUserId(obj.getWxUserId());
staffClerkRelation.setStaffId(obj.getStaffId());
staffClerkRelationApiService.insert(staffClerkRelation); staffClerkRelationApiService.insert(staffClerkRelation);
} }
} }
......
...@@ -1107,17 +1107,15 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1107,17 +1107,15 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override @Override
public List<String> listUnBindClerk(String storeId) { public List<String> listUnBindClerk(String storeId) {
TabHaobanDepartment department = departmentService.selectByRelatedId(storeId); List<String> storeIds = new ArrayList<String>();
if(department == null){ storeIds.add(storeId);
return Collections.EMPTY_LIST; List<String> clerkList = clerkService.getclerkListByStoreIds(storeIds);
} List<StaffClerkRelationDTO> staffRelationList = staffClerkRelationService.listByClerkIds(clerkList);
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listByDepartmentId(department.getDepartmentId()); List<String> clerkIds = staffRelationList.stream().filter(s->s.getClerkId()!=null).map(s->s.getClerkId()).collect(Collectors.toList());
List<String> clerkCodes = list.stream().filter(s->s.getClerkCode()!=null).map(s->s.getClerkCode()).collect(Collectors.toList());
List<String> unBindList = new ArrayList<>(); List<String> unBindList = new ArrayList<>();
if(CollectionUtil.isNotEmpty(clerkCodes)){ for (String clerkId : clerkList) {
List<ClerkDTO> clerkList = clerkService.listClerk(storeId, clerkCodes, false); if(!clerkIds.contains(clerkId)){
for (ClerkDTO clerkDTO : clerkList) { unBindList.add(clerkId);
unBindList.add(clerkDTO.getClerkId());
} }
} }
return unBindList; return unBindList;
...@@ -1370,14 +1368,44 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1370,14 +1368,44 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override @Override
public List<String> listBindClerkUserId(String storeId) { public List<String> listBindClerkUserId(String storeId) {
TabHaobanDepartment department = departmentService.selectByRelatedId(storeId); // TabHaobanDepartment department = departmentService.selectByRelatedId(storeId);
if(department == null){ // if(department == null){
return Collections.EMPTY_LIST; // return Collections.EMPTY_LIST;
// }
// List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listByDepartmentId(department.getDepartmentId());
// List<String> userIdList = list.stream().filter(s->StringUtils.isNotBlank(s.getClerkCode())).map(s->s.getWxUserId()).collect(Collectors.toList());
List<String> userIdList = new ArrayList<String>();
List<String> storeIds = new ArrayList<String>();
storeIds.add(storeId);
List<String> clerkList = clerkService.getclerkListByStoreIds(storeIds);
List<StaffClerkRelationDTO> staffRelationList = staffClerkRelationService.listByClerkIds(clerkList);
Map<String,StaffClerkRelationDTO> clerkIdMap = staffRelationList.stream().filter(s->s.getClerkId()!=null).collect(Collectors.toMap(StaffClerkRelationDTO::getClerkId, s->s));
Set<String> keySet = clerkIdMap.keySet();
for (String clerkId : clerkList) {
if(keySet.contains(clerkId)){
userIdList.add(clerkIdMap.get(clerkId).getWxUserId());
}
} }
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listByDepartmentId(department.getDepartmentId());
List<String> userIdList = list.stream().filter(s->StringUtils.isNotBlank(s.getClerkCode())).map(s->s.getWxUserId()).collect(Collectors.toList());
return userIdList; return userIdList;
} }
@Override
public List<StaffClerkRelationDTO> listBindRelationUserId(String storeId) {
List<StaffClerkRelationDTO> bindList = new ArrayList<StaffClerkRelationDTO>();
List<String> storeIds = new ArrayList<String>();
storeIds.add(storeId);
List<String> clerkList = clerkService.getclerkListByStoreIds(storeIds);
List<StaffClerkRelationDTO> staffRelationList = staffClerkRelationService.listByClerkIds(clerkList);
Map<String,StaffClerkRelationDTO> clerkIdMap = staffRelationList.stream().filter(s->s.getClerkId()!=null).collect(Collectors.toMap(StaffClerkRelationDTO::getClerkId, s->s));
Set<String> keySet = clerkIdMap.keySet();
for (String clerkId : clerkList) {
if(keySet.contains(clerkId)){
bindList.add(clerkIdMap.get(clerkId));
}
}
return bindList;
}
// private String getMobile(String phoneNumber,String nationcode){ // private String getMobile(String phoneNumber,String nationcode){
// String mobile = nationcode + phoneNumber; // String mobile = nationcode + phoneNumber;
......
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
...@@ -19,6 +20,7 @@ import com.gic.haoban.manage.api.service.StaffClerkRelationApiService; ...@@ -19,6 +20,7 @@ import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper; import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation; import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.service.StaffClerkRelationService; import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -170,4 +172,14 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -170,4 +172,14 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
boolean b = staffClerkRelatinService.delBind(clerkId); boolean b = staffClerkRelatinService.delBind(clerkId);
return b; return b;
} }
@Override
public StaffClerkRelationDTO getOneByClerkId(String clerkId) {
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
StaffClerkRelationDTO result = EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, tab);
return result;
}
public StaffClerkRelationDTO getByClerkId(String clerkId) {
StaffClerkRelationDTO staffRelation = staffClerkRelatinService.getByClerkId(clerkId);
return staffRelation;
}
} }
...@@ -157,4 +157,36 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -157,4 +157,36 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
List<EnterpriseDetailDTO> details = EntityUtil.changeEntityListByJSON(EnterpriseDetailDTO.class, list); List<EnterpriseDetailDTO> details = EntityUtil.changeEntityListByJSON(EnterpriseDetailDTO.class, list);
return details; return details;
} }
@Override
public int wxEnterpriseBind(String enterpriseId, String wxEnterpriseId, String version, String staffId,
String staffName) {
TabHaobanWxEnterpriseRelated tab = wxEnterpriseRelatedMapper.findOneByEnterpriseId(enterpriseId);
if(tab!= null){
logger.info("该gicEnterpriseId已经绑定过了");
return 1;
}else{
tab = new TabHaobanWxEnterpriseRelated();
tab.setEnterpriseId(enterpriseId);
tab.setWxEnterpriseId(wxEnterpriseId);
tab.setStatusFlag(1);
tab.setVersion(version);
tab.setStaffId(staffId);
tab.setStaffName(staffName);
tab.setCreateTime(new Date());
tab.setUpdateTime(new Date());
tab.setWxEnterpriseRelatedId(UuidUtil.randomUUID());
wxEnterpriseRelatedMapper.insertSelective(tab);
TabHaobanStaff sStaff = staffMapper.selectSuperByWxEnterpriseId(wxEnterpriseId);
if(sStaff == null){
TabHaobanStaff staff = new TabHaobanStaff();
staff.setStaffName("超级管理员");
staff.setWxEnterpriseId(wxEnterpriseId);
staff.setSuperManagerFlag(1);
staffService.add(staff);
}
}
return 0;
}
} }
...@@ -294,4 +294,12 @@ ...@@ -294,4 +294,12 @@
and status_flag=1 and status_flag=1
order by update_time desc limit 1 order by update_time desc limit 1
</select> </select>
<select id="getByClerkId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff_clerk_relation
where clerk_id = #{clerkId,jdbcType=VARCHAR}
and status_flag=1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -6,13 +6,15 @@ ...@@ -6,13 +6,15 @@
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" /> <result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" />
<result column="enterprise_id" property="enterpriseId" jdbcType="VARCHAR" /> <result column="enterprise_id" property="enterpriseId" jdbcType="VARCHAR" />
<result column="version" property="version" jdbcType="VARCHAR" /> <result column="version" property="version" jdbcType="VARCHAR" />
<result column="staff_id" property="staffId" jdbcType="VARCHAR" />
<result column="staffName" property="staffName" jdbcType="VARCHAR" />
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" /> <result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
wx_enterprise_related_id, wx_enterprise_id, enterprise_id, version, status_flag, wx_enterprise_related_id, wx_enterprise_id, enterprise_id, version, status_flag,
create_time, update_time create_time, update_time,staff_id,staff_name
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select select
...@@ -27,10 +29,10 @@ ...@@ -27,10 +29,10 @@
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated" > <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated" >
insert into tab_haoban_wx_enterprise_related (wx_enterprise_related_id, wx_enterprise_id, insert into tab_haoban_wx_enterprise_related (wx_enterprise_related_id, wx_enterprise_id,
enterprise_id, version, status_flag, enterprise_id, version, status_flag,
create_time, update_time) create_time, update_time,staff_id,staff_name)
values (#{wxEnterpriseRelatedId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, values (#{wxEnterpriseRelatedId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
#{enterpriseId,jdbcType=VARCHAR}, #{version,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{enterpriseId,jdbcType=VARCHAR}, #{version,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{staffId},#{staffName})
</insert> </insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated" > <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated" >
insert into tab_haoban_wx_enterprise_related insert into tab_haoban_wx_enterprise_related
...@@ -56,6 +58,12 @@ ...@@ -56,6 +58,12 @@
<if test="updateTime != null" > <if test="updateTime != null" >
update_time, update_time,
</if> </if>
<if test="staffId != null" >
staff_id,
</if>
<if test="staffName != null" >
staff_name,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="wxEnterpriseRelatedId != null" > <if test="wxEnterpriseRelatedId != null" >
...@@ -102,6 +110,12 @@ ...@@ -102,6 +110,12 @@
<if test="updateTime != null" > <if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="staffId != null" >
#{staffId,jdbcType=VARCHAR},
</if>
<if test="staffName != null" >
#{staffName,jdbcType=VARCHAR},
</if>
</set> </set>
where wx_enterprise_related_id = #{wxEnterpriseRelatedId,jdbcType=VARCHAR} where wx_enterprise_related_id = #{wxEnterpriseRelatedId,jdbcType=VARCHAR}
</update> </update>
...@@ -112,7 +126,9 @@ ...@@ -112,7 +126,9 @@
version = #{version,jdbcType=VARCHAR}, version = #{version,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER}, status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP},
staff_id = #{staffId,jdbcType=VARCHAR},
staff_name = #{staffName,jdbcType=VARCHAR},
where wx_enterprise_related_id = #{wxEnterpriseRelatedId,jdbcType=VARCHAR} where wx_enterprise_related_id = #{wxEnterpriseRelatedId,jdbcType=VARCHAR}
</update> </update>
<select id="listByWxenterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="listByWxenterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String" >
......
...@@ -4,13 +4,16 @@ import cn.hutool.crypto.SecureUtil; ...@@ -4,13 +4,16 @@ import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.symmetric.AES; import cn.hutool.crypto.symmetric.AES;
import com.alibaba.dubbo.common.URL; import com.alibaba.dubbo.common.URL;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.ToolUtil; import com.gic.commons.util.ToolUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO; import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.WxApplicationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxApplicationApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService; import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService; import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.anno.IgnoreLogin; import com.gic.haoban.manage.web.anno.IgnoreLogin;
...@@ -21,6 +24,8 @@ import com.gic.haoban.manage.web.vo.LoginVO; ...@@ -21,6 +24,8 @@ import com.gic.haoban.manage.web.vo.LoginVO;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.UserDTO; import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService; import com.gic.wechat.api.service.qywx.QywxCorpApiService;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -35,6 +40,8 @@ import javax.servlet.http.HttpServletResponse; ...@@ -35,6 +40,8 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
@RestController @RestController
...@@ -56,6 +63,12 @@ public class LoginController extends WebBaseController{ ...@@ -56,6 +63,12 @@ public class LoginController extends WebBaseController{
@Autowired @Autowired
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService; private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService;
@Autowired
private QywxSuiteApiService qywxSuiteApiService;
@Autowired
private WxApplicationApiService wxApplicationApiService;
@Autowired @Autowired
private Config config; private Config config;
...@@ -201,6 +214,35 @@ public class LoginController extends WebBaseController{ ...@@ -201,6 +214,35 @@ public class LoginController extends WebBaseController{
ModelAndView model = new ModelAndView(new RedirectView("/haoban-3/#/gic-error", false,false)); ModelAndView model = new ModelAndView(new RedirectView("/haoban-3/#/gic-error", false,false));
return model; return model;
} }
String wxEnterpriseId = detailDTO.getWxEnterpriseId();
WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId, 2);
if (null == application) {
logger.info("登录企业应用 没授权!{}");
ModelAndView model = new ModelAndView(new RedirectView("/haoban-3/#/gic-error", false,false));
return model;
}
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
if (null == enterprise) {
logger.info("登录失败,不存在对应企业:{}",o);
ModelAndView model = new ModelAndView(new RedirectView("/haoban-3/#/gic-error", false,false));
return model;
}
//获取管理员列表
String adminList = qywxSuiteApiService.getAdminList(enterprise.getCorpid(), application.getSiteId(), Integer.parseInt(application.getAgentId()));
List<String> userIds = new ArrayList<String>();
if(StringUtils.isNotBlank(adminList)){
JSONArray jsonArr = JSON.parseArray(adminList);
for (Object object : jsonArr) {
JSONObject json = JSON.parseObject(JSON.toJSONString(object));
userIds.add(json.getString("userid"));
}
}
if(!userIds.contains(staff.getWxUserId())){
logger.info("登录失败,当前用户不是管理员:{}",JSON.toJSONString(userIds));
ModelAndView model = new ModelAndView(new RedirectView("/haoban-3/#/gic-error", false,false));
return model;
}
// StaffDTO staff = staffApiService.selectById("1"); // StaffDTO staff = staffApiService.selectById("1");
LoginVO loginVO = new LoginVO(); LoginVO loginVO = new LoginVO();
loginVO.setWxEnterpriseId(detailDTO.getWxEnterpriseId()); loginVO.setWxEnterpriseId(detailDTO.getWxEnterpriseId());
......
...@@ -16,6 +16,7 @@ import com.gic.haoban.common.utils.HaobanResponse; ...@@ -16,6 +16,7 @@ import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO; import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.SecretSettingDTO; import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
...@@ -146,7 +147,10 @@ public class WxEnterpriseController extends WebBaseController{ ...@@ -146,7 +147,10 @@ public class WxEnterpriseController extends WebBaseController{
} }
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser(); LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
wxEnterpriseId = login.getWxEnterpriseId(); wxEnterpriseId = login.getWxEnterpriseId();
int i = wxEnterpriseRelatedApiService.wxEnterpriseBind(enterpriseId,wxEnterpriseId,version); StaffDTO staff = login.getStaffDTO();
String staffId = staff.getStaffId();
String staffName = staff.getStaffName();
int i = wxEnterpriseRelatedApiService.wxEnterpriseBind(enterpriseId,wxEnterpriseId,version,staffId,staffName);
if(i==1){ if(i==1){
return resultResponse(HaoBanErrCode.ERR_10006); return resultResponse(HaoBanErrCode.ERR_10006);
} }
......
...@@ -223,6 +223,7 @@ public class AuditController extends WebBaseController{ ...@@ -223,6 +223,7 @@ public class AuditController extends WebBaseController{
staffClerkRelation.setStoreId(storeId); staffClerkRelation.setStoreId(storeId);
staffClerkRelation.setWxEnterpriseId(wxEnterpriseId); staffClerkRelation.setWxEnterpriseId(wxEnterpriseId);
staffClerkRelation.setWxUserId(wxUserId); staffClerkRelation.setWxUserId(wxUserId);
staffClerkRelation.setStaffId(staffId);
staffClerkRelationApiService.insert(staffClerkRelation); staffClerkRelationApiService.insert(staffClerkRelation);
audit.setAuditStatus(1); audit.setAuditStatus(1);
//发送消息 //发送消息
......
...@@ -115,15 +115,16 @@ public class ClerkController extends WebBaseController{ ...@@ -115,15 +115,16 @@ public class ClerkController extends WebBaseController{
List<StaffClerkRelationDTO> list = staffClerkRelationApiService.listByStoreId(storeId); List<StaffClerkRelationDTO> list = staffClerkRelationApiService.listByStoreId(storeId);
List<String> staffIds = list.stream().map(s->s.getStaffId()).collect(Collectors.toList()); List<String> staffIds = list.stream().map(s->s.getStaffId()).collect(Collectors.toList());
List<StaffDTO> resultlist= staffApiService.listByIds(staffIds); List<StaffDTO> resultlist= staffApiService.listByIds(staffIds);
Map<String,StaffClerkRelationDTO> map = com.gic.commons.util.CollectionUtil.toMap(list, "staffId"); Map<String,StaffDTO> map = com.gic.commons.util.CollectionUtil.toMap(resultlist, "staffId");
int size = 0; int size = 0;
if(resultlist != null){ if(resultlist != null){
size = resultlist.size(); size = resultlist.size();
} }
for(StaffDTO dto :resultlist){
StaffClerkRelationDTO staffClerkRelationDTO = map.get(dto.getStaffId()); List<StaffDTO> resultList = new ArrayList<>();
dto.setClerkCode(staffClerkRelationDTO.getClerkCode()); for(StaffClerkRelationDTO staffClerkRelationDTO : list){
dto.setClerkId(staffClerkRelationDTO.getClerkId()); StaffDTO dto = map.get(staffClerkRelationDTO.getStaffId());
if(size < 20){ if(size < 20){
ClerkDTO clerk = clerkService.getClerkByClerkCode(staffClerkRelationDTO.getEnterpriseId(), staffClerkRelationDTO.getClerkCode()); ClerkDTO clerk = clerkService.getClerkByClerkCode(staffClerkRelationDTO.getEnterpriseId(), staffClerkRelationDTO.getClerkCode());
if(clerk != null){ if(clerk != null){
...@@ -136,6 +137,7 @@ public class ClerkController extends WebBaseController{ ...@@ -136,6 +137,7 @@ public class ClerkController extends WebBaseController{
}else{ }else{
dto.setMemberCount(0); dto.setMemberCount(0);
} }
resultList.add(dto);
} }
return resultResponse(HaoBanErrCode.ERR_1,resultlist); return resultResponse(HaoBanErrCode.ERR_1,resultlist);
...@@ -646,4 +648,42 @@ public class ClerkController extends WebBaseController{ ...@@ -646,4 +648,42 @@ public class ClerkController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1,list); return resultResponse(HaoBanErrCode.ERR_1,list);
} }
//刷新导购信息
@RequestMapping("/fresh-clerk-info")
public HaobanResponse freshClerkInfo(String clerkId,String wxEnterpriseId) {
StaffClerkRelationDTO staffRelation = staffClerkRelationApiService.getByClerkId(clerkId);
if(staffRelation == null){
return resultResponse(HaoBanErrCode.ERR_10006);
}
String staffId = staffRelation.getStaffId();
StaffDTO staff = staffApiService.selectById(staffId);
if(staff == null){
return resultResponse(HaoBanErrCode.ERR_10006);
}
String headPic = staff.getHeadImg();
String phoneNumber = staff.getPhoneNumber();
String nationCode = staff.getNationCode();
Integer sex = staff.getSex();
ClerkDTO clerk = clerkService.getClerkByClerkId(clerkId);
if(clerk == null){
return resultResponse(HaoBanErrCode.ERR_10006);
}
if(StringUtils.isNotBlank(headPic)){
clerk.setHeadImgUrl(headPic);
}
if(StringUtils.isNotBlank(phoneNumber)){
clerk.setPhoneNumber(phoneNumber);
}
if(StringUtils.isNotBlank(nationCode)){
clerk.setNationcode(nationCode);
}
if(sex != null){
clerk.setClerkGender(sex.toString());
}
clerkService.updateClerk(clerk);
return resultResponse(HaoBanErrCode.ERR_1);
}
} }
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