Commit 80b372dc by 陶光胜

Merge branch 'developer' of http://115.159.76.241/haoban3.0/haoban-manage3.0 into developer

parents f60f1933 3ba449da
...@@ -14,6 +14,8 @@ public class DepartmentDTO implements Serializable { ...@@ -14,6 +14,8 @@ public class DepartmentDTO implements Serializable {
private String relatedId; private String relatedId;
private String chainId; private String chainId;
private String chainName;
private Integer isStore; private Integer isStore;
...@@ -146,6 +148,14 @@ public class DepartmentDTO implements Serializable { ...@@ -146,6 +148,14 @@ public class DepartmentDTO implements Serializable {
public void setWxEnterpriseId(String wxEnterpriseId) { public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId; this.wxEnterpriseId = wxEnterpriseId;
} }
public String getChainName() {
return chainName;
}
public void setChainName(String chainName) {
this.chainName = chainName;
}
......
package com.gic.haoban.manage.api.dto; package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
/** /**
* Created by tgs on 2020/2/9. * Created by tgs on 2020/2/9.
*/ */
public class EnterpriseDetailDTO { public class EnterpriseDetailDTO implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private String wxEnterpriseRelatedId; private String wxEnterpriseRelatedId;
private String enterpriseName; private String enterpriseName;
private String wxEnterpriseId; private String wxEnterpriseId;
......
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
public class QywxCorpInfoSimpleDTO implements Serializable{
private static final long serialVersionUID = 1L;
private Integer errcode;
private String errmsg;
/* 授权方企业微信id */
private String corpid;
/* 授权方企业微信名称 */
private String corpName;
/* 授权方企业微信类型,认证号:verified, 注册号:unverified */
private String corpType;
/* 授权方企业微信方形头像 */
private String corpSquareLogoUrl;
/* 授权管理员的userid,可能为空(内部管理员一定有,不可更改) */
private String userid;
/* 授权管理员的name,可能为空(内部管理员一定有,不可更改) */
private String name;
/* 授权管理员的头像url */
private String avatar;
/* 授权方应用id */
private String agentid;
/* 授权方应用名字 */
private String agentName;
/* 授权方应用方形头像 */
private String agentSquareLogoUrl;
/* 授权方应用圆形头像 */
private String roundLogoUrl;
/* 授权方(企业)access_token,最长为512字节 */
private String accessToken;
/* 授权方access_token 更新时间戳 */
private String updateAccessTokenTimestamp;
/* 企业微信永久授权码,最长为512字节 */
private String permanentCode;
/* 应用id */
private String suiteId;
/* 有效0 删除1 */
private Integer delStatus = 0;
public Integer getErrcode() {
return errcode;
}
public void setErrcode(Integer errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public String getCorpName() {
return corpName;
}
public void setCorpName(String corpName) {
this.corpName = corpName;
}
public String getCorpType() {
return corpType;
}
public void setCorpType(String corpType) {
this.corpType = corpType;
}
public String getCorpSquareLogoUrl() {
return corpSquareLogoUrl;
}
public void setCorpSquareLogoUrl(String corpSquareLogoUrl) {
this.corpSquareLogoUrl = corpSquareLogoUrl;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getAgentid() {
return agentid;
}
public void setAgentid(String agentid) {
this.agentid = agentid;
}
public String getAgentName() {
return agentName;
}
public void setAgentName(String agentName) {
this.agentName = agentName;
}
public String getAgentSquareLogoUrl() {
return agentSquareLogoUrl;
}
public void setAgentSquareLogoUrl(String agentSquareLogoUrl) {
this.agentSquareLogoUrl = agentSquareLogoUrl;
}
public String getRoundLogoUrl() {
return roundLogoUrl;
}
public void setRoundLogoUrl(String roundLogoUrl) {
this.roundLogoUrl = roundLogoUrl;
}
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public String getUpdateAccessTokenTimestamp() {
return updateAccessTokenTimestamp;
}
public void setUpdateAccessTokenTimestamp(String updateAccessTokenTimestamp) {
this.updateAccessTokenTimestamp = updateAccessTokenTimestamp;
}
public String getPermanentCode() {
return permanentCode;
}
public void setPermanentCode(String permanentCode) {
this.permanentCode = permanentCode;
}
public String getSuiteId() {
return suiteId;
}
public void setSuiteId(String suiteId) {
this.suiteId = suiteId;
}
public Integer getDelStatus() {
return delStatus;
}
public void setDelStatus(Integer delStatus) {
this.delStatus = delStatus;
}
}
...@@ -2,10 +2,13 @@ package com.gic.haoban.manage.api.dto; ...@@ -2,10 +2,13 @@ package com.gic.haoban.manage.api.dto;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
public class StaffDTO implements Serializable{ public class StaffDTO implements Serializable{
private String staffId; private String staffId;
private String wxEnterpriseId;
private String wxUserId; private String wxUserId;
...@@ -30,6 +33,14 @@ public class StaffDTO implements Serializable{ ...@@ -30,6 +33,14 @@ public class StaffDTO implements Serializable{
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
private String departmentIds;
private String headImg;
private Integer sort;
private List<DepartmentDTO> departmentList;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -40,8 +51,50 @@ public class StaffDTO implements Serializable{ ...@@ -40,8 +51,50 @@ public class StaffDTO implements Serializable{
public void setStaffId(String staffId) { public void setStaffId(String staffId) {
this.staffId = staffId == null ? null : staffId.trim(); this.staffId = staffId == null ? null : staffId.trim();
} }
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getExtendPostion() {
return extendPostion;
}
public void setExtendPostion(String extendPostion) {
this.extendPostion = extendPostion;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getWxUserId() { public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getWxUserId() {
return wxUserId; return wxUserId;
} }
...@@ -105,5 +158,37 @@ public class StaffDTO implements Serializable{ ...@@ -105,5 +158,37 @@ public class StaffDTO implements Serializable{
this.activeFlag = activeFlag; this.activeFlag = activeFlag;
} }
public String getDepartmentIds() {
return departmentIds;
}
public void setDepartmentIds(String departmentIds) {
this.departmentIds = departmentIds;
}
public String getHeadImg() {
return headImg;
}
public void setHeadImg(String headImg) {
this.headImg = headImg;
}
public List<DepartmentDTO> getDepartmentList() {
return departmentList;
}
public void setDepartmentList(List<DepartmentDTO> departmentList) {
this.departmentList = departmentList;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
} }
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
public class WxEnterpriseDTO implements Serializable {
private String wxEnterpriseId;
private String corpid;
private String permanentCode;
private String corpName;
private String corpType;
private String corpSquareLogoUrl;
private String corpUserMax;
private String corpFullName;
private String subjectType;
private Date verifiedEndTime;
private String corpWxqrcode;
private String corpScale;
private String corpIndustry;
private String corpSubIndustry;
private String location;
private String authInfo;
private String agent;
private String agentid;
private String appid;
private String name;
private String squareLogoUrl;
private String roundLogoUrl;
private Integer level;
private Integer bindFlag;
private Integer statusFlag;
private Date createTime;
private Date updateTime;
private static final long serialVersionUID = 1L;
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId == null ? null : wxEnterpriseId.trim();
}
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid == null ? null : corpid.trim();
}
public String getPermanentCode() {
return permanentCode;
}
public void setPermanentCode(String permanentCode) {
this.permanentCode = permanentCode == null ? null : permanentCode.trim();
}
public String getCorpName() {
return corpName;
}
public void setCorpName(String corpName) {
this.corpName = corpName == null ? null : corpName.trim();
}
public String getCorpType() {
return corpType;
}
public void setCorpType(String corpType) {
this.corpType = corpType == null ? null : corpType.trim();
}
public String getCorpSquareLogoUrl() {
return corpSquareLogoUrl;
}
public void setCorpSquareLogoUrl(String corpSquareLogoUrl) {
this.corpSquareLogoUrl = corpSquareLogoUrl == null ? null : corpSquareLogoUrl.trim();
}
public String getCorpUserMax() {
return corpUserMax;
}
public void setCorpUserMax(String corpUserMax) {
this.corpUserMax = corpUserMax == null ? null : corpUserMax.trim();
}
public String getCorpFullName() {
return corpFullName;
}
public void setCorpFullName(String corpFullName) {
this.corpFullName = corpFullName == null ? null : corpFullName.trim();
}
public String getSubjectType() {
return subjectType;
}
public void setSubjectType(String subjectType) {
this.subjectType = subjectType == null ? null : subjectType.trim();
}
public Date getVerifiedEndTime() {
return verifiedEndTime;
}
public void setVerifiedEndTime(Date verifiedEndTime) {
this.verifiedEndTime = verifiedEndTime;
}
public String getCorpWxqrcode() {
return corpWxqrcode;
}
public void setCorpWxqrcode(String corpWxqrcode) {
this.corpWxqrcode = corpWxqrcode == null ? null : corpWxqrcode.trim();
}
public String getCorpScale() {
return corpScale;
}
public void setCorpScale(String corpScale) {
this.corpScale = corpScale == null ? null : corpScale.trim();
}
public String getCorpIndustry() {
return corpIndustry;
}
public void setCorpIndustry(String corpIndustry) {
this.corpIndustry = corpIndustry == null ? null : corpIndustry.trim();
}
public String getCorpSubIndustry() {
return corpSubIndustry;
}
public void setCorpSubIndustry(String corpSubIndustry) {
this.corpSubIndustry = corpSubIndustry == null ? null : corpSubIndustry.trim();
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location == null ? null : location.trim();
}
public String getAuthInfo() {
return authInfo;
}
public void setAuthInfo(String authInfo) {
this.authInfo = authInfo == null ? null : authInfo.trim();
}
public String getAgent() {
return agent;
}
public void setAgent(String agent) {
this.agent = agent == null ? null : agent.trim();
}
public String getAgentid() {
return agentid;
}
public void setAgentid(String agentid) {
this.agentid = agentid == null ? null : agentid.trim();
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid == null ? null : appid.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getSquareLogoUrl() {
return squareLogoUrl;
}
public void setSquareLogoUrl(String squareLogoUrl) {
this.squareLogoUrl = squareLogoUrl == null ? null : squareLogoUrl.trim();
}
public String getRoundLogoUrl() {
return roundLogoUrl;
}
public void setRoundLogoUrl(String roundLogoUrl) {
this.roundLogoUrl = roundLogoUrl == null ? null : roundLogoUrl.trim();
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public Integer getBindFlag() {
return bindFlag;
}
public void setBindFlag(Integer bindFlag) {
this.bindFlag = bindFlag;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
public class YwWxEnterpriseDTO implements Serializable {
private String wxEnterpriseId;
private String corpid;
private String permanentCode;
private String corpName;
private String corpType;
private String corpSquareLogoUrl;
private String corpUserMax;
private String corpFullName;
private String subjectType;
private Date verifiedEndTime;
private String corpWxqrcode;
private String corpScale;
private String corpIndustry;
private String corpSubIndustry;
private String location;
private String authInfo;
private String agent;
private String agentid;
private String appid;
private String name;
private String squareLogoUrl;
private String roundLogoUrl;
private Integer level;
private Integer bindFlag;
private Integer statusFlag;
private Date createTime;
private Date updateTime;
//gic通讯录助手
private String gicContactHelper;
//订购状态
private String buyStatus;
//订购时间
private Date buyDate;
//版本号
private String version;
private static final long serialVersionUID = 1L;
public String getGicContactHelper() {
return gicContactHelper;
}
public void setGicContactHelper(String gicContactHelper) {
this.gicContactHelper = gicContactHelper;
}
public String getBuyStatus() {
return buyStatus;
}
public void setBuyStatus(String buyStatus) {
this.buyStatus = buyStatus;
}
public Date getBuyDate() {
return buyDate;
}
public void setBuyDate(Date buyDate) {
this.buyDate = buyDate;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId == null ? null : wxEnterpriseId.trim();
}
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid == null ? null : corpid.trim();
}
public String getPermanentCode() {
return permanentCode;
}
public void setPermanentCode(String permanentCode) {
this.permanentCode = permanentCode == null ? null : permanentCode.trim();
}
public String getCorpName() {
return corpName;
}
public void setCorpName(String corpName) {
this.corpName = corpName == null ? null : corpName.trim();
}
public String getCorpType() {
return corpType;
}
public void setCorpType(String corpType) {
this.corpType = corpType == null ? null : corpType.trim();
}
public String getCorpSquareLogoUrl() {
return corpSquareLogoUrl;
}
public void setCorpSquareLogoUrl(String corpSquareLogoUrl) {
this.corpSquareLogoUrl = corpSquareLogoUrl == null ? null : corpSquareLogoUrl.trim();
}
public String getCorpUserMax() {
return corpUserMax;
}
public void setCorpUserMax(String corpUserMax) {
this.corpUserMax = corpUserMax == null ? null : corpUserMax.trim();
}
public String getCorpFullName() {
return corpFullName;
}
public void setCorpFullName(String corpFullName) {
this.corpFullName = corpFullName == null ? null : corpFullName.trim();
}
public String getSubjectType() {
return subjectType;
}
public void setSubjectType(String subjectType) {
this.subjectType = subjectType == null ? null : subjectType.trim();
}
public Date getVerifiedEndTime() {
return verifiedEndTime;
}
public void setVerifiedEndTime(Date verifiedEndTime) {
this.verifiedEndTime = verifiedEndTime;
}
public String getCorpWxqrcode() {
return corpWxqrcode;
}
public void setCorpWxqrcode(String corpWxqrcode) {
this.corpWxqrcode = corpWxqrcode == null ? null : corpWxqrcode.trim();
}
public String getCorpScale() {
return corpScale;
}
public void setCorpScale(String corpScale) {
this.corpScale = corpScale == null ? null : corpScale.trim();
}
public String getCorpIndustry() {
return corpIndustry;
}
public void setCorpIndustry(String corpIndustry) {
this.corpIndustry = corpIndustry == null ? null : corpIndustry.trim();
}
public String getCorpSubIndustry() {
return corpSubIndustry;
}
public void setCorpSubIndustry(String corpSubIndustry) {
this.corpSubIndustry = corpSubIndustry == null ? null : corpSubIndustry.trim();
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location == null ? null : location.trim();
}
public String getAuthInfo() {
return authInfo;
}
public void setAuthInfo(String authInfo) {
this.authInfo = authInfo == null ? null : authInfo.trim();
}
public String getAgent() {
return agent;
}
public void setAgent(String agent) {
this.agent = agent == null ? null : agent.trim();
}
public String getAgentid() {
return agentid;
}
public void setAgentid(String agentid) {
this.agentid = agentid == null ? null : agentid.trim();
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid == null ? null : appid.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getSquareLogoUrl() {
return squareLogoUrl;
}
public void setSquareLogoUrl(String squareLogoUrl) {
this.squareLogoUrl = squareLogoUrl == null ? null : squareLogoUrl.trim();
}
public String getRoundLogoUrl() {
return roundLogoUrl;
}
public void setRoundLogoUrl(String roundLogoUrl) {
this.roundLogoUrl = roundLogoUrl == null ? null : roundLogoUrl.trim();
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public Integer getBindFlag() {
return bindFlag;
}
public void setBindFlag(Integer bindFlag) {
this.bindFlag = bindFlag;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
...@@ -11,6 +11,18 @@ public interface DepartmentApiService { ...@@ -11,6 +11,18 @@ public interface DepartmentApiService {
List<DepartmentDTO> listByParentId(String parentId); List<DepartmentDTO> listByParentId(String parentId);
/** /**
* 查门店/部门列表
* @param parentId
* @return
*/
List<DepartmentDTO> listByDepartmentIds(List<String> departmentIds,int storeFlag);
/**
* 查wxEnterprise下所有门店
* @param wxEnterpriseId
* @return
*/
List<DepartmentDTO> listStoreByWxEnterpriseId(String wxEnterpriseId);
/**
* 根据部门id查询部门 * 根据部门id查询部门
* @param departmentId * @param departmentId
* @return * @return
...@@ -63,5 +75,11 @@ public interface DepartmentApiService { ...@@ -63,5 +75,11 @@ public interface DepartmentApiService {
* @param departmentId * @param departmentId
*/ */
HaobanResponse repairRecycle(String departmentId); HaobanResponse repairRecycle(String departmentId);
/**
* 获取根节点
* @param wxEnterpriseId
* @return
*/
DepartmentDTO getRootByEnterpriseId(String wxEnterpriseId);
} }
package com.gic.haoban.manage.api.service; package com.gic.haoban.manage.api.service;
import java.util.List;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
public interface StaffApiService { public interface StaffApiService {
public StaffDTO selectById(String staffId); public StaffDTO selectById(String staffId);
public List<StaffDTO> listByIds(List<String> staffIds);
public StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber);
public HaobanResponse add(StaffDTO staff, String departmentIds);
public List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId);
public Page<StaffDTO> pageStaff(String departmentId, Integer activeFlag, String keyword, BasePageInfo pageInfo);
public void del(String staffDepartmentStaffRelatedId);
public void wxGetAdd(String userId,String wxEnterpriseId);
public void staffEdit(StaffDTO staffDTO, String departmentIds);
} }
...@@ -6,6 +6,24 @@ import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; ...@@ -6,6 +6,24 @@ import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
public interface StaffDepartmentRelatedApiService { public interface StaffDepartmentRelatedApiService {
List<StaffDepartmentRelatedDTO> listByDepartmentId(String departmentId); List<StaffDepartmentRelatedDTO> listByDepartmentId(String departmentId);
List<StaffDepartmentRelatedDTO> listByStaffId(String staffId);
void updateById(StaffDepartmentRelatedDTO dto);
StaffDepartmentRelatedDTO getOneByClerkCode(String clerkCode);
/**
* 根据员工与部门的关联关系查询
*
* @param staffDepartmentRelatedId
* @return
*/
StaffDepartmentRelatedDTO getByStaffDepartmentRelatedId(String staffDepartmentRelatedId);
void deleteCode(StaffDepartmentRelatedDTO dto);
} }
package com.gic.haoban.manage.api.service;
import java.util.List;
import com.gic.haoban.manage.api.dto.QywxCorpInfoSimpleDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
public interface WxEnterpriseApiService {
/**
* 接收企业回调信息
* @param dto
*/
void callbackReviceEnterprise(QywxCorpInfoSimpleDTO dto);
/**
* 运维后台获取微信企业id列表
* @return
*/
List<YwWxEnterpriseDTO> list();
}
...@@ -7,5 +7,7 @@ import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO; ...@@ -7,5 +7,7 @@ import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
public interface WxEnterpriseRelatedApiService { public interface WxEnterpriseRelatedApiService {
List<EnterpriseDetailDTO> listEnterpriseByWxEnterpriseId(String wxEnterpriseId); List<EnterpriseDetailDTO> listEnterpriseByWxEnterpriseId(String wxEnterpriseId);
void wxEnterpriseBind(String enterpriseId,String wxEnterpriseId,String version); int wxEnterpriseBind(String enterpriseId,String wxEnterpriseId,String version);
String getGicEnterpriseIdByEnterpriseRelatedId(String wxEnterpriseRelatedId);
} }
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>haoban-manage3-operation-web</artifactId>
<version>${libraryVersion}</version>
<packaging>war</packaging>
<name>haoban-manage3-operation-web Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<haobanService>1.0-SNAPSHOT</haobanService>
<commonVersion>3.0-SNAPSHOT</commonVersion>
<libraryVersion>1.0-SNAPSHOT</libraryVersion>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.2.4.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
<version>1.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-dict-api</artifactId>
<version>${gic-dict-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-commons</artifactId>
<version>${gic-commons}</version>
<exclusions>
<exclusion>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>httpcore</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>spring-beans</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-platform-config</artifactId>
<version>${gic-platform-config}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-contacts-api</artifactId>
<version>${haoban-contacts-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-manage3-api</artifactId>
<version>${haoban-manage3-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-manage-api</artifactId>
<version>${haoban-manage-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-contacts-manage-api</artifactId>
<version>${haoban-contacts-manage-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-common</artifactId>
<version>${haoban-common}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-auth-api</artifactId>
<version>${haoban-auth-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-operation-api</artifactId>
<version>${haoban-operation-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-config</artifactId>
<version>${haoban-config}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-thirdparty-api</artifactId>
<version>${gic-thirdparty-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-message-api</artifactId>
<version>${haoban-message-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-app-announcement-api</artifactId>
<version>${haoban-app-announcement-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-communicate-api</artifactId>
<version>${haoban-communicate-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-mobile-app-api</artifactId>
<version>${haoban-mobile-app-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-thirdparty-sdk</artifactId>
<version>${gic-thirdparty-sdk}</version>
</dependency>
<dependency>
<groupId>com.gic.operation</groupId>
<artifactId>gic-operation-api</artifactId>
<version>${gic-operation-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-enterprise-api</artifactId>
<version>${gic-enterprise-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-clerk-api</artifactId>
<version>${gic-clerk-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-quartz-api</artifactId>
<version>${gic-quartz-api}</version>
</dependency>
</dependencies>
<build>
<finalName>haoban-manage3-operation-web</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<type>jar</type>
<includeTypes>jar</includeTypes>
<outputDirectory>
${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.12.RC2</version>
<configuration>
<stopKey>gic-mall</stopKey>
<httpConnector>
<port>802</port>
</httpConnector>
<webApp>
<contextPath>/</contextPath>
</webApp>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.gic.haoban.manage.web.auth;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* Created 2018/7/26.
*
* @author hua
*/
public class AuthRequestUtil {
private static final Logger logger = LoggerFactory.getLogger(AuthRequestUtil.class);
public static final String REDIS_LOGIN_USER_TOKEN_PREFIX = "GIC:HAOBAN:HAOBAN_MOBILE_APP:LOGIN_USER:";
public static final String REDIS_FAKE_LOGIN_FLAG_PREFIX = "GIC:HAOBAN:HAOBAN_MOBILE_APP:FAKE_LOGIN_TOKEN:";
public static String LOGIN_SESSION_KEY = "HAOBAN:LOGINUSER";
public static Object getSessionUser() {
return getSession().getAttribute(LOGIN_SESSION_KEY);
}
public static void setSessionUser(Object obj) {
getSession().setAttribute(LOGIN_SESSION_KEY, obj);
}
public static void delSessionUser() {
getSession().removeAttribute(LOGIN_SESSION_KEY);
}
public static Object getAppLoginUser() {
String token = getRequest().getHeader("token");
logger.info("token1111111111=" + token);
if (StringUtils.isBlank(token)) {
return null;
}
Object cache = RedisUtil.getCache(token);
return cache;
}
private static void setLoginUserLastToken(String token, Object obj) {
try {
String userId = BeanUtils.getProperty(obj, "user.userId");
if (StringUtils.isNotBlank(userId) && StringUtils.isNotBlank(token)) {
RedisUtil.setCache(REDIS_LOGIN_USER_TOKEN_PREFIX + userId, token, 31L, TimeUnit.DAYS);
}
} catch (Exception e) {
logger.error(e.getMessage());
}
}
/**
* 是否为用户最后一次登录token
*
* @param token
* @param userId
* @return
*/
public static boolean isLoginUserLastToken(String token, String userId) {
Object lastUserLoginToken = RedisUtil.getCache(REDIS_LOGIN_USER_TOKEN_PREFIX + userId);
// 如果用户最后一次登录token不符则返回false
return !(lastUserLoginToken instanceof CharSequence) || StringUtils.equals(token, (CharSequence) lastUserLoginToken);
}
private static void setFakeLoginFlag(String token) {
if (StringUtils.isNotBlank(token)) {
RedisUtil.setCache(REDIS_FAKE_LOGIN_FLAG_PREFIX + token, new Date(), 30L, TimeUnit.DAYS);
}
}
/**
* 是否为伪登录token
*
* @param token
* @return
*/
public static boolean isFakeLoginToken(String token) {
return StringUtils.isNotBlank(token) && RedisUtil.getCache(REDIS_FAKE_LOGIN_FLAG_PREFIX + token) != null;
}
public static void setAppLoginUser(String token, Object obj) {
RedisUtil.setCache(token, obj, 30L, TimeUnit.DAYS);
getResponse().setHeader("token", token);
setLoginUserLastToken(token, obj);
}
public static void setAppFakeLoginUser(String token, Object obj) {
RedisUtil.setCache(token, obj, 30L, TimeUnit.DAYS);
getResponse().setHeader("token", token);
setFakeLoginFlag(token);
}
public static void delToken() {
String token = getRequest().getHeader("token");
RedisUtil.delCache(token);
}
public static void setAppLoginUser(Object obj) {
String token = getRequest().getHeader("token");
RedisUtil.setCache(token, obj, 30L, TimeUnit.DAYS);
getResponse().setHeader("token", token);
setLoginUserLastToken(token, obj);
}
public static void setAppFakeLoginUser(Object obj) {
String token = getRequest().getHeader("token");
RedisUtil.setCache(token, obj, 30L, TimeUnit.DAYS);
getResponse().setHeader("token", token);
}
public static HttpSession getSession() {
HttpSession session = null;
try {
session = getRequest().getSession();
} catch (Exception e) {
}
return session;
}
public static HttpServletRequest getRequest() {
ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder
.getRequestAttributes();
return attrs.getRequest();
}
public static HttpServletResponse getResponse() {
ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder
.getRequestAttributes();
return attrs.getResponse();
}
}
package com.gic.haoban.manage.web.controller;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.commons.util.GlobalVar;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
@RestController
public class EnterpriseController extends WebBaseController{
private static final String LOGIN_URL = "haoban-manage-web/yw-login";
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
//企业列表
@RequestMapping("wx-enterprise-list")
public HaobanResponse wxEnterpriseList() {
List<YwWxEnterpriseDTO> list = wxEnterpriseApiService.list();
return resultResponse(HaoBanErrCode.ERR_1, list);
}
//登录
@RequestMapping("yw-login")
public void ywLogin(String wxEnterpriseId,HttpServletResponse httpServletResponse) throws IOException {
String host = GlobalVar.ctxPropertiesMap.get("haoban_service_host");
String url=host+LOGIN_URL+"?wxEnterpriseId="+wxEnterpriseId;
httpServletResponse.sendRedirect(url);
}
}
package com.gic.haoban.manage.web.controller;
import com.gic.haoban.auth.api.dto.DisplayRelationShortInfoDTO;
import com.gic.haoban.auth.api.dto.UserRightDetailDTO;
import com.gic.haoban.common.utils.AuthRequestUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* Created 2018/7/18.
*
* @author hua
*/
public class WebBaseController {
protected final String defaultReturn = "json";
public HaobanResponse resultResponse(HaoBanErrCode errCode, Object data, String detailError) {
HaobanResponse response = new HaobanResponse();
response.setMessage(errCode.getMsg());
response.setErrorCode(errCode.getCode());
response.setResult(data);
response.setDetailError(detailError);
return response;
}
public HaobanResponse resultResponse(HaoBanErrCode errCode, Object data) {
return resultResponse(errCode, data, null);
}
public HaobanResponse resultResponse(HaoBanErrCode errCode) {
return resultResponse(errCode, null, null);
}
public HaobanResponse resultResponse(HaoBanErrCode errCode, String message) {
HaobanResponse response = new HaobanResponse();
response.setMessage(message);
response.setErrorCode(errCode.getCode());
return response;
}
/**
* 获取登陆信息
*
* @return
*/
protected UserRightDetailDTO getLoginUser() {
return (UserRightDetailDTO) AuthRequestUtil.getSessionUser();
}
public boolean haveRight(List<DisplayRelationShortInfoDTO> list){
List<String> groupList = new ArrayList<String>();
List<String> storeList = new ArrayList<String>();
List<String> clerkList = new ArrayList<String>();
if(list==null){
return false;
}
for(DisplayRelationShortInfoDTO showDto :list){
if(showDto.getGroupId()!=null){
groupList.add(showDto.getGroupId());
}
if(showDto.getStoreId()!=null){
storeList.add(showDto.getStoreId());
}
if(showDto.getClerkId()!=null){
clerkList.add(showDto.getClerkId());
}
}
if(CollectionUtils.isEmpty(groupList) && CollectionUtils.isEmpty(storeList) && CollectionUtils.isEmpty(clerkList)){
return false;
}
return true;
}
}
package com.gic.haoban.manage.web.controller.test;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.CheckContainUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.TestDTO;
import com.gic.haoban.manage.api.service.TestService;
import com.gic.haoban.manage.web.controller.WebBaseController;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.TestQo;
import com.gic.haoban.manage.web.vo.TestVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* Created 2018/12/17.
*
* @author hua
*/
@Controller
@RequestMapping("/test")
public class TestController extends WebBaseController {
// @Autowired
// private TestService testService;
//
// @RequestMapping("/testList")
// @ResponseBody
// public HaobanResponse testList(String id, BasePageInfo info) {
// HaoBanErrCode errCode = HaoBanErrCode.ERR_1;
// Page<TestDTO> testDTOPage = testService.queryPage(info);
// return resultResponse(errCode, testDTOPage);
// }
//
// @RequestMapping("/imcallback")
// @ResponseBody
// public JSONObject imcallback(@RequestBody JSONObject msg) {
// System.out.println(msg);
// System.out.println(msg.toJSONString());
// String rest = "{\n" +
// " \"ActionStatus\": \"OK\",\n" +
// " \"ErrorInfo\": \"\",\n" +
// " \"ErrorCode\": 0 // 0 为允许发言\n" +
// "}";
// return JSONObject.parseObject(rest);
// }
//
//
// @RequestMapping("/testListVo")
// @ResponseBody
// public HaobanResponse testListVo(TestQo qo, BasePageInfo info) {
// HaoBanErrCode errCode = HaoBanErrCode.ERR_1;
// String s = CheckContainUtil.checkAttr(qo);
// if (s != null) {
// System.out.println("缺少参数");
// errCode = HaoBanErrCode.ERR_5;
// return resultResponse(errCode);
// }
// Page<TestDTO> testDTOPage = testService.queryPage(info);
// List<TestVo> res = EntityUtil.changeEntityListByJSON(TestVo.class, testDTOPage.getResult());
// return resultResponse(errCode, res);
// }
}
package com.gic.haoban.manage.web.errCode;
/**
* Created by fudh on 2018/3/4.
*/
public enum HaoBanErrCode {
//update by 牧峰 2018-7-25 19:58:06
/**
* 操作失败
*/
ERR_0(0, "操作失败"),
/**
* 操作成功
*/
ERR_1(1, "操作成功"),
/**
* 缺少参数
*/
ERR_2(2, "缺少参数"),
/**
* 系统异常
*/
ERR_3(3, "系统异常"),
/**
* 登录异常
*/
ERR_4(4, "登录异常"),
/**
* 输入参数错误
*/
ERR_5(5, "输入参数错误"),
/**
* 该企业登录用户不存在
*/
ERR_6(6, "该企业登录用户不存在"),
/**
* 该用户缺少该权限
*/
ERR_7(7, "该用户缺少该权限"),
/**
* 查无数据
*/
ERR_8(8, "查无数据"),
/**
* 非法操作
*/
ERR_9(9, "非法操作"),
/**
* 用户已经登录
*/
ERR_10(10, "用户已经登录"),
/**
* 验证码发送失败
*/
ERR_11(11, "验证码发送失败"),
/**
* 验证码校验失败
*/
ERR_12(12, "验证码校验失败"),
ERR_10001(10001,"父部门不存在"),
ERR_10002(10002,"门店类型部门不能新增子节点"),
ERR_10003(10003,"部门不存在"),
ERR_10004(10004,"成员名称不能为空"),
ERR_10005(10005,"成员已存在"),
ERR_DEFINE(-888, "自定义错误"),
ERR_OTHER(-999, "未知错误code");
private int code;
private String msg;
private HaoBanErrCode(int code, String value) {
this.code = code;
this.msg = value;
}
public static HaoBanErrCode getValue(int code) {
for (HaoBanErrCode sec : HaoBanErrCode.values()) {
if (code == sec.getCode()) {
return sec;
}
}
ERR_OTHER.setMsg("未知错误code:" + code);
return ERR_OTHER;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
package com.gic.haoban.manage.web.exception;
/**
* Created 2018/7/24.
*
* @author hua
*/
public class ControllerException extends Exception {
}
package com.gic.haoban.manage.web.exception;
import com.gic.haoban.base.api.common.ShowFrontMessageException;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.controller.WebBaseController;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created 2018/7/24.
*
* @author hua
*/
@ControllerAdvice
public class GlobalExceptionHandler extends WebBaseController {
private static Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
private static final Pattern pattern = Pattern.compile("(.*: )(.*)(\\n.*)");
@ResponseBody
@ExceptionHandler(ShowFrontMessageException.class)
public HaobanResponse ControllerException(HttpServletResponse response, ShowFrontMessageException ex) {
HaobanResponse res = new HaobanResponse();
res.setErrorCode(HaoBanErrCode.ERR_0.getCode());
res.setMessage(ex.getMessage());
return res;
}
@ResponseBody
@ExceptionHandler(RuntimeException.class)
public HaobanResponse ControllerException(HttpServletResponse response, RuntimeException ex) {
HaobanResponse res = new HaobanResponse();
res.setErrorCode(HaoBanErrCode.ERR_3.getCode());
String message = ex.getMessage();
if (message != null && message.indexOf(ShowFrontMessageException.class.getName()) > -1) {
Matcher matcher = pattern.matcher(message);
while (matcher.find()) {
message = (matcher.group(2));
}
} else {
message = HaoBanErrCode.ERR_3.getMsg();
}
res.setMessage(message);
return res;
}
@ResponseBody
@ExceptionHandler(Exception.class)
public HaobanResponse ControllerException(HttpServletResponse response, Exception ex) {
logger.error("err");
ex.printStackTrace();
HaoBanErrCode errCode = HaoBanErrCode.ERR_3;
StringBuilder sb = new StringBuilder();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (PrintWriter printWriter = new PrintWriter(baos)) {
ex.printStackTrace(printWriter);
}
try {
sb.append(baos.toString());
} catch (Exception ignored) {
}
if (sb.length() == 0) {
sb.append(ex.getMessage());
}
// 输出详细错误信息,便于调试
return resultResponse(errCode, null, sb.toString());
}
@ResponseBody
@ExceptionHandler(NoLoginException.class)
public HaobanResponse ControllerException(HttpServletResponse response, NoLoginException ex) {
return resultResponse(HaoBanErrCode.ERR_4);
}
}
package com.gic.haoban.manage.web.exception;
/**
* 用户未登陆异常
*
* @author zhurz
*/
public class NoLoginException extends RuntimeException {
}
package com.gic.haoban.manage.web.init;
import com.gic.dict.api.dto.GlobalDictMap;
import com.gic.dict.api.service.ManagerDictService;
import com.gic.quartz.api.dto.QuartzTaskDTO;
import com.gic.quartz.api.service.QuartzService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class MyApplicationContextAware implements ApplicationContextAware {
private Logger log = LogManager.getLogger(MyApplicationContextAware.class);
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
// TODO Auto-generated method stub
}
}
package com.gic.haoban.manage.web.interceptor;
import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.common.utils.HaobanResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
import java.lang.reflect.Method;
/**
* Created 2019/2/20.
*
* @author hua
*/
@ControllerAdvice
public class ResponseInterceptor implements ResponseBodyAdvice<HaobanResponse> {
private Logger logger = LoggerFactory.getLogger(ResponseInterceptor.class);
@Override
public boolean supports(MethodParameter methodParameter, Class<? extends HttpMessageConverter<?>> aClass) {
Method method = methodParameter.getMethod();
String name = method.getName();
logger.info("method:{}", name);
return true;
}
@Override
public HaobanResponse beforeBodyWrite(HaobanResponse haobanResponse, MethodParameter methodParameter, MediaType mediaType, Class<? extends HttpMessageConverter<?>> aClass, ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse) {
String response = JSONObject.toJSONString(haobanResponse);
logger.info("response:{}", response);
return haobanResponse;
}
}
package com.gic.haoban.manage.web.interceptor;
import com.gic.haoban.auth.api.dto.UserRightDetailDTO;
import com.gic.haoban.common.utils.AuthRequestUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 测试登录拦截器
*
* @author zhurz
*/
public class TestLoginInterceptor extends HandlerInterceptorAdapter {
private static Logger logger = LoggerFactory.getLogger(TestLoginInterceptor.class);
@Override
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
// 测试用
HttpServletRequest request = AuthRequestUtil.getRequest();
String testFlag = request.getHeader("testFlag");
if (!"Y".equals(testFlag)) return true;
String testEnterpriseId = request.getHeader("testEnterpriseId");
String testUserId = request.getHeader("testUserId");
UserRightDetailDTO sessionUser = new UserRightDetailDTO();
sessionUser.setUserId(testUserId);
sessionUser.setEnterpriseId(testEnterpriseId);
AuthRequestUtil.setSessionUser(sessionUser);
return true;
}
}
package com.gic.haoban.manage.web.interceptor;
import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.auth.api.anno.MenuCheck;
import com.gic.haoban.auth.api.dto.UserRightDetailDTO;
import com.gic.haoban.auth.api.enums.RoleCodeEnum;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Map;
/**
* Created 2018/7/20.
*
* @author hua
*/
public class WebInterceptor extends HandlerInterceptorAdapter {
private static Logger logger= LoggerFactory.getLogger(WebInterceptor.class);
// @Autowired
// private ClerkRightManageService clerkRightManageService;
private void errorResult(HttpServletResponse httpServletResponse, HaoBanErrCode errCode) {
HaobanResponse response = new HaobanResponse();
response.setErrorCode(errCode.getCode());
response.setMessage(errCode.getMsg());
PrintWriter writer = null;
try {
httpServletResponse.setHeader("Content-type", "application/json;charset=UTF-8");
writer = httpServletResponse.getWriter();
writer.append(JSONObject.toJSONString(response));
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
String requestURI = httpServletRequest.getRequestURI();
logger.info("post-url:{}", requestURI);
Map<String, String[]> parameterMap = httpServletRequest.getParameterMap();
logger.info("post-params:{}", JSONObject.toJSONString(parameterMap));
HandlerMethod method = null;
if (o instanceof HandlerMethod) {
method = (HandlerMethod) (o);
}
if (method == null) {
return true;
}
MenuCheck methodAnnotation = method.getMethodAnnotation(MenuCheck.class);
return true;
}
@Override
public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
logger.info("end");
}
@Override
public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
logger.info("end");
}
}
package com.gic.haoban.manage.web.qo;
import com.gic.haoban.base.api.common.AppJSONField;
import java.io.Serializable;
/**
* Created 2018/10/22.
*
* @author hua
*/
public class TestQo implements Serializable {
private String id;
@AppJSONField(format = "ignore")
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
package com.gic.haoban.manage.web.response;
import com.gic.haoban.auth.api.dto.MenuRightDTO;
import java.io.Serializable;
import java.util.List;
/**
* Created 2018/12/27.
*
* @author hua
*/
public class MenuDetailResponse implements Serializable {
private MenuRightDTO top;
private List<MenuRightDTO> leftMenu;
private MenuRightDTO current;
public MenuRightDTO getTop() {
return top;
}
public void setTop(MenuRightDTO top) {
this.top = top;
}
public List<MenuRightDTO> getLeftMenu() {
return leftMenu;
}
public void setLeftMenu(List<MenuRightDTO> leftMenu) {
this.leftMenu = leftMenu;
}
public MenuRightDTO getCurrent() {
return current;
}
public void setCurrent(MenuRightDTO current) {
this.current = current;
}
}
package com.gic.haoban.manage.web.response;
import com.gic.haoban.auth.api.dto.MenuRightInfoDTO;
import com.gic.haoban.auth.api.dto.RoleDTO;
import java.io.Serializable;
import java.util.List;
/**
* Created 2018/12/17.
*
* @author hua
*/
public class RoleDetailResponse implements Serializable {
public RoleDTO role;
public List<MenuRightInfoDTO> menuRightList;
public RoleDTO getRole() {
return role;
}
public void setRole(RoleDTO role) {
this.role = role;
}
public List<MenuRightInfoDTO> getMenuRightList() {
return menuRightList;
}
public void setMenuRightList(List<MenuRightInfoDTO> menuRightList) {
this.menuRightList = menuRightList;
}
}
\ No newline at end of file
package com.gic.haoban.manage.web.utils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
public class IOUtils {
/**
* 6.编写一个程序,将D:\\java目录下的所有.java文件复制到D:\\jad目录下,
* 并将原来文件的扩展名从.java改为.jad。
*/
// public static class FileCopy {
// public static void main(String[] args) {
//
// File oriFile = new File("D:\\java");//原文件目录
// //file.exists():判断文件目录是否存在
// //file.isDirectory():判断文件目录是否是一个目录
// if(!(oriFile.exists() && oriFile.isDirectory())){
// System.out.println("文件目录不存在!");
// }
//
// File[] files = oriFile.listFiles(
// new FilenameFilter(){ //文件名称过滤器
// public boolean accept(File file, String name) {
// return name.endsWith(".java");
// }
// }
// );
// System.out.println(files.length);//原文件个数
//
// File objFile = new File("D:\\jad");//目标文件目录
// //objFile.exists():判断目标文件目录是否存在
// //objFile.mkdir():创建目标文件目录
// if(!objFile.exists()){
// objFile.mkdir();
// }
//
// //copyByte(files,objFile);
// copyChar(files,objFile);
// System.out.println("写入完成!");
//
// }
//使用字节流进行文件复制(字节缓冲流可以不使用,使用其目的主要是为了提高性能)
private static void copyByte(File[] files,File objFile){
InputStream inputStream = null;
OutputStream outputStream = null;
BufferedInputStream bufferedInputStream = null;
BufferedOutputStream bufferedOutputStream = null;
for(File f : files){
//替换文件后缀
String objFileName = f.getName().replaceAll("\\.ACC$", ".mp3");
try {
inputStream = new FileInputStream(f);
outputStream = new FileOutputStream(new File(objFile,objFileName));
bufferedInputStream = new BufferedInputStream(inputStream);
bufferedOutputStream = new BufferedOutputStream(outputStream);
int c = 0;
while((c = bufferedInputStream.read()) != -1){
bufferedOutputStream.write(c);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
bufferedOutputStream.close();
bufferedInputStream.close();
outputStream.close();
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
//使用字符流进行文件复制(字符缓冲流可以不使用,使用其目的主要是为了提高性能)
public static void copyChar(File file,File objFile){
Reader reader = null;
Writer writer = null;
BufferedReader bufferedReader = null;
BufferedWriter bufferedWriter = null;
//替换文件后缀
String objFileName = file.getName().replaceAll("\\.AAC$", ".mp3");
try {
reader = new FileReader(file);
writer = new FileWriter(new File(objFile,objFileName));
bufferedReader = new BufferedReader(reader);
bufferedWriter = new BufferedWriter(writer);
int c = 0;
while ((c=bufferedReader.read()) != -1) {
bufferedWriter.write(c);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
bufferedWriter.close();
bufferedReader.close();
writer.close();
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
package com.gic.haoban.manage.web.utils;
import org.apache.commons.lang3.StringUtils;
/**
* @author yao
* NationCodePhoneFormater
*/
public class NationCodePhoneFormater {
/**
* 大陆手机号码
*/
public static final String CHINA = "86";
public static String format(String nationCode, String phone) {
if (CHINA.equals(nationCode)) {
return phone;
}
if (StringUtils.isBlank(phone)){
return "";
}
return StringUtils.isBlank(nationCode)? phone: ("+" + nationCode + "-" + phone);
}
}
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
/**
* Created 2018/10/22.
*
* @author hua
*/
public class TestVo implements Serializable {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
dubbo.registry.file=haoban-manage3-operation-web
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath*:gic-haoban-init.xml" />
<import resource="dubbo-haoban-manage3-operation-web.xml"/>
<import resource="classpath*:dubbo-setting.xml"/>
<import resource="classpath*:redis-init.xml"/>
<import resource="redis-session.xml"/>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<context:component-scan base-package="com.gic.haoban" />
<!-- 应用名称 -->
<dubbo:application name="haoban-manage3-operation-web"/>
<dubbo:protocol name="dubbo" port="300112"/>
<!-- 使用zookeeper注册中心暴露服务地址 -->
<!-- <dubbo:registry address="zookeeper://192.168.1.118:2181" protocol="dubbo" id="localAdd"/> -->
<!--<dubbo:registry address="zookeeper://115.159.182.172:2199" protocol="dubbo" id="remoteAdd"/>-->
<!--<dubbo:registry address="zookeeper://localhost:2181|zookeeper://115.159.182.172:2199" protocol="dubbo"/>-->
<dubbo:reference interface="com.gic.haoban.manage.api.service.StaffApiService" id="staffApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService" id="wxEnterpriseRelatedApiService" />
<dubbo:reference interface="com.gic.haoban.manage.api.service.ApplicationApiService" id="applicationApiService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.EnterpriseService" id="enterpriseService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.StoreService" id="storeService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="departmentService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.DepartmentApiService" id="departmentApiService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.StoreGroupService" id="storeGroupService"/>
<dubbo:reference interface="com.gic.clerk.api.service.ClerkService" id="clerkService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService" id="staffDepartmentRelatedApiService"/>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-4.1.xsd">
<util:constant static-field="org.springframework.session.data.redis.config.ConfigureRedisAction.NO_OP"/>
<bean id="redisHttpSessionConfiguration"
class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration">
<property name="maxInactiveIntervalInSeconds" value="1800"/>
<property name="cookieSerializer" ref="defaultCookieSerializer"/>
</bean>
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxTotal" value="100"/>
<property name="maxIdle" value="10"/>
</bean>
<bean id="jedisConnectionFactory"
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" destroy-method="destroy">
<property name="hostName" value="${redis.host}"/>
<property name="port" value="${redis.port}"/>
<property name="password" value="${redis.password}"/>
<property name="timeout" value="3000"/>
<property name="usePool" value="true"/>
<property name="poolConfig" ref="jedisPoolConfig"/>
<property name="database" value="${redis.database}"/>
</bean>
<bean id="defaultCookieSerializer" class="org.springframework.session.web.http.DefaultCookieSerializer">
<property name="cookieName" value="customSessionId"/>
<property name="cookiePath" value="/"></property>
</bean>
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<mvc:interceptors>
<bean class="com.gic.haoban.common.interceptor.CORSInterceptor"/>
<bean class="com.gic.commons.interceptor.HeaderTagInterceptor"/>
<bean class="com.gic.haoban.common.ext.PropertyViewClearInterceptor"/>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<mvc:exclude-mapping path="/login.json"/>
<mvc:exclude-mapping path="/login-*"/>
<mvc:exclude-mapping path="/gic-login*"/>
<mvc:exclude-mapping path="/*test.json"/>
<mvc:exclude-mapping path="/test/*"/>
<mvc:exclude-mapping path="/login"/>
<mvc:exclude-mapping path="/nationcode/get-nationcode-list"/>
<mvc:exclude-mapping path="/get-pic-code"/>
<mvc:exclude-mapping path="/phone-login"/>
<mvc:exclude-mapping path="/upload-file*"/>
<mvc:exclude-mapping path="/upload-file-voice"/>
<bean class="com.gic.haoban.manage.web.interceptor.WebInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
</beans>
\ No newline at end of file
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 扫描注解包路径,多个包用逗号分隔,不填pacakge表示扫描当前ApplicationContext中所有的类 -->
<context:component-scan base-package="com.gic.haoban.*" />
<!-- 启动对@AspectJ注解的支持 -->
<aop:aspectj-autoproxy />
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="defaultEncoding" value="UTF-8"></property>
<property name="maxUploadSize" value="-1"></property>
</bean>
<bean class="com.gic.redis.data.aop.RedisCacheAop" id="redisCacheAop"/>
<!-- 明确js/css/jpg/gif等静态资源的访问不通过Constroller -->
<mvc:default-servlet-handler />
<!-- 启动注解驱动的Spring MVC功能,注册请求url和注解POJO类方法的映射 -->
<mvc:annotation-driven>
<!-- 设置不使用默认的消息转换器 -->
<mvc:message-converters register-defaults="false">
<bean class="com.gic.haoban.common.ext.MappingJackson2HttpMessagePropertyViewConverter"/>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/x-www-form-urlencoded;charset=UTF-8</value>
<!--默认是 iso-8859-1 -->
</list>
</property>
</bean>
<bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
</mvc:message-converters>
</mvc:annotation-driven>
<!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 (解决中文乱码) -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/x-www-form-urlencoded;charset=UTF-8</value>
<!--默认是 iso-8859-1 -->
</list>
</property>
</bean>
<bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
</list>
</property>
</bean>
<!---->
<!--<bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">-->
<!--<property name="converters">-->
<!--<set>-->
<!--<bean class="com.gic.commons.util.DateConverter"></bean>-->
<!--</set>-->
<!--</property>-->
<!--</bean>-->
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<!-- 扩展名至mimeType的映射,即 /user.json => application/json -->
<property name= "favorPathExtension" value= "true" />
<!-- 用于开启 /userinfo/123?format=json 的支持 -->
<property name= "favorParameter" value= "true" />
<property name= "parameterName" value= "format"/>
<!-- 是否忽略Accept Header -->
<property name= "ignoreAcceptHeader" value= "false"/>
<property name="mediaTypes">
<value>
html=text/html
json=application/json
</value>
</property>
<property name="defaultContentType" value="text/html"/>
</bean>
<!-- 视图解析器配置 -->
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver" />
<!-- If no extension matched, use JSP view -->
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="order" value="0"/>
<property name="contentNegotiationManager" ref="contentNegotiationManager"/>
<property name="defaultViews">
<list>
<bean class="com.gic.haoban.common.ext.MappingJackson2JsonPropertyView" />
</list>
</property>
</bean>
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Archetype Created Web Application</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext-conf.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-*.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>springSessionRepositoryFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSessionRepositoryFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
...@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.dao.mapper; ...@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.dao.mapper;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.xpath.operations.Bool;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment; import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
...@@ -25,7 +26,13 @@ public interface DepartmentMapper { ...@@ -25,7 +26,13 @@ public interface DepartmentMapper {
int selectMaxSort(@Param("parentDepartmentId")String parentDepartmentId); int selectMaxSort(@Param("parentDepartmentId")String parentDepartmentId);
TabHaobanDepartment selectByRelatedId(@Param("relatedId")String relatedId); TabHaobanDepartment selectByRelatedId(@Param("relatedId")String relatedId);
List<TabHaobanDepartment> listByDepartmentIds(@Param("departmentIds")List<String> departmentIds,@Param("storeFlag")int storeFlag);
Page<TabHaobanDepartment> pageDepartmentByParams(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("keyword")String keyword, Page<TabHaobanDepartment> pageDepartmentByParams(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("keyword")String keyword,
@Param("storeFlag")Integer storeFlag, @Param("recycleFlag")Integer recycleFlag); @Param("storeFlag")Integer storeFlag, @Param("recycleFlag")Integer recycleFlag);
List<TabHaobanDepartment> listStoreByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
TabHaobanDepartment getRootByEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
} }
\ No newline at end of file
...@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.dao.mapper; ...@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.dao.mapper;
import java.util.List; import java.util.List;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
public interface StaffDepartmentRelatedMapper { public interface StaffDepartmentRelatedMapper {
...@@ -18,4 +20,15 @@ public interface StaffDepartmentRelatedMapper { ...@@ -18,4 +20,15 @@ public interface StaffDepartmentRelatedMapper {
int updateByPrimaryKey(TabHaobanStaffDepartmentRelated record); int updateByPrimaryKey(TabHaobanStaffDepartmentRelated record);
List<TabHaobanStaffDepartmentRelated> listByDepartmentId(String departmentId); List<TabHaobanStaffDepartmentRelated> listByDepartmentId(String departmentId);
TabHaobanStaffDepartmentRelated getOneByClerkCode(String clerkCode);
void deleteCode(TabHaobanStaffDepartmentRelated dto);
List<TabHaobanStaffDepartmentRelated> listStaffDepartmentByStaffId(String staffId);
Page<TabHaobanStaffDepartmentRelated> pageStaff(String departmentId, Integer activeFlag, String keyword);
TabHaobanStaffDepartmentRelated getById(String staffDepartmentRelatedId);
} }
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper; package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.github.pagehelper.Page;
public interface StaffMapper { public interface StaffMapper {
int deleteByPrimaryKey(String staffId); int deleteByPrimaryKey(String staffId);
...@@ -14,4 +20,12 @@ public interface StaffMapper { ...@@ -14,4 +20,12 @@ public interface StaffMapper {
int updateByPrimaryKeySelective(TabHaobanStaff record); int updateByPrimaryKeySelective(TabHaobanStaff record);
int updateByPrimaryKey(TabHaobanStaff record); int updateByPrimaryKey(TabHaobanStaff record);
TabHaobanStaff selectByNationcodeAndPhoneNumber(String wxEnterpriseId, String nationcode, String phoneNumber);
List<TabHaobanStaff> listByIds(@Param("staffIds")List<String> staffIds);
Page<TabHaobanStaff> pageStaff(@Param("staffIds")Set<String> staffIds, @Param("activeFlag")Integer activeFlag, @Param("keyword")String keyword);
TabHaobanStaff selectByUserId(@Param("userId")String userId);
} }
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
public interface WxEnterpriseMapper {
int deleteByPrimaryKey(String wxEnterpriseId);
int insert(TabHaobanWxEnterprise record);
int insertSelective(TabHaobanWxEnterprise record);
TabHaobanWxEnterprise selectByPrimaryKey(String wxEnterpriseId);
int updateByPrimaryKeySelective(TabHaobanWxEnterprise record);
int updateByPrimaryKey(TabHaobanWxEnterprise record);
List<TabHaobanWxEnterprise> list();
}
\ No newline at end of file
...@@ -13,6 +13,8 @@ public class TabHaobanDepartment implements Serializable { ...@@ -13,6 +13,8 @@ public class TabHaobanDepartment implements Serializable {
private String relatedId; private String relatedId;
private String chainId; private String chainId;
private String chainName;
private Integer isStore; private Integer isStore;
...@@ -145,6 +147,14 @@ public class TabHaobanDepartment implements Serializable { ...@@ -145,6 +147,14 @@ public class TabHaobanDepartment implements Serializable {
public void setWxEnterpriseId(String wxEnterpriseId) { public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId; this.wxEnterpriseId = wxEnterpriseId;
} }
public String getChainName() {
return chainName;
}
public void setChainName(String chainName) {
this.chainName = chainName;
}
} }
\ No newline at end of file
...@@ -17,6 +17,8 @@ public class TabHaobanStaff implements Serializable { ...@@ -17,6 +17,8 @@ public class TabHaobanStaff implements Serializable {
private String nickName; private String nickName;
private Integer sex; private Integer sex;
private String wxEnterpriseId;
private String postion; private String postion;
...@@ -29,6 +31,10 @@ public class TabHaobanStaff implements Serializable { ...@@ -29,6 +31,10 @@ public class TabHaobanStaff implements Serializable {
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
private String headImg;
private Integer sort;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -135,4 +141,30 @@ public class TabHaobanStaff implements Serializable { ...@@ -135,4 +141,30 @@ public class TabHaobanStaff implements Serializable {
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getHeadImg() {
return headImg;
}
public void setHeadImg(String headImg) {
this.headImg = headImg;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
} }
\ No newline at end of file
...@@ -23,6 +23,7 @@ public class TabHaobanStaffDepartmentRelated implements Serializable { ...@@ -23,6 +23,7 @@ public class TabHaobanStaffDepartmentRelated implements Serializable {
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -105,4 +106,7 @@ public class TabHaobanStaffDepartmentRelated implements Serializable { ...@@ -105,4 +106,7 @@ public class TabHaobanStaffDepartmentRelated implements Serializable {
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
} }
\ No newline at end of file
package com.gic.haoban.manage.service.entity;
import java.io.Serializable;
import java.util.Date;
public class TabHaobanWxEnterprise implements Serializable {
private String wxEnterpriseId;
private String corpid;
private String permanentCode;
private String corpName;
private String corpType;
private String corpSquareLogoUrl;
private String corpUserMax;
private String corpFullName;
private String subjectType;
private Date verifiedEndTime;
private String corpWxqrcode;
private String corpScale;
private String corpIndustry;
private String corpSubIndustry;
private String location;
private String authInfo;
private String agent;
private String agentid;
private String appid;
private String name;
private String squareLogoUrl;
private String roundLogoUrl;
private Integer level;
private Integer bindFlag;
private Integer statusFlag;
private Date createTime;
private Date updateTime;
private static final long serialVersionUID = 1L;
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId == null ? null : wxEnterpriseId.trim();
}
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid == null ? null : corpid.trim();
}
public String getPermanentCode() {
return permanentCode;
}
public void setPermanentCode(String permanentCode) {
this.permanentCode = permanentCode == null ? null : permanentCode.trim();
}
public String getCorpName() {
return corpName;
}
public void setCorpName(String corpName) {
this.corpName = corpName == null ? null : corpName.trim();
}
public String getCorpType() {
return corpType;
}
public void setCorpType(String corpType) {
this.corpType = corpType == null ? null : corpType.trim();
}
public String getCorpSquareLogoUrl() {
return corpSquareLogoUrl;
}
public void setCorpSquareLogoUrl(String corpSquareLogoUrl) {
this.corpSquareLogoUrl = corpSquareLogoUrl == null ? null : corpSquareLogoUrl.trim();
}
public String getCorpUserMax() {
return corpUserMax;
}
public void setCorpUserMax(String corpUserMax) {
this.corpUserMax = corpUserMax == null ? null : corpUserMax.trim();
}
public String getCorpFullName() {
return corpFullName;
}
public void setCorpFullName(String corpFullName) {
this.corpFullName = corpFullName == null ? null : corpFullName.trim();
}
public String getSubjectType() {
return subjectType;
}
public void setSubjectType(String subjectType) {
this.subjectType = subjectType == null ? null : subjectType.trim();
}
public Date getVerifiedEndTime() {
return verifiedEndTime;
}
public void setVerifiedEndTime(Date verifiedEndTime) {
this.verifiedEndTime = verifiedEndTime;
}
public String getCorpWxqrcode() {
return corpWxqrcode;
}
public void setCorpWxqrcode(String corpWxqrcode) {
this.corpWxqrcode = corpWxqrcode == null ? null : corpWxqrcode.trim();
}
public String getCorpScale() {
return corpScale;
}
public void setCorpScale(String corpScale) {
this.corpScale = corpScale == null ? null : corpScale.trim();
}
public String getCorpIndustry() {
return corpIndustry;
}
public void setCorpIndustry(String corpIndustry) {
this.corpIndustry = corpIndustry == null ? null : corpIndustry.trim();
}
public String getCorpSubIndustry() {
return corpSubIndustry;
}
public void setCorpSubIndustry(String corpSubIndustry) {
this.corpSubIndustry = corpSubIndustry == null ? null : corpSubIndustry.trim();
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location == null ? null : location.trim();
}
public String getAuthInfo() {
return authInfo;
}
public void setAuthInfo(String authInfo) {
this.authInfo = authInfo == null ? null : authInfo.trim();
}
public String getAgent() {
return agent;
}
public void setAgent(String agent) {
this.agent = agent == null ? null : agent.trim();
}
public String getAgentid() {
return agentid;
}
public void setAgentid(String agentid) {
this.agentid = agentid == null ? null : agentid.trim();
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid == null ? null : appid.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getSquareLogoUrl() {
return squareLogoUrl;
}
public void setSquareLogoUrl(String squareLogoUrl) {
this.squareLogoUrl = squareLogoUrl == null ? null : squareLogoUrl.trim();
}
public String getRoundLogoUrl() {
return roundLogoUrl;
}
public void setRoundLogoUrl(String roundLogoUrl) {
this.roundLogoUrl = roundLogoUrl == null ? null : roundLogoUrl.trim();
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public Integer getBindFlag() {
return bindFlag;
}
public void setBindFlag(Integer bindFlag) {
this.bindFlag = bindFlag;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
...@@ -26,4 +26,6 @@ public interface DepartmentService { ...@@ -26,4 +26,6 @@ public interface DepartmentService {
void repairRecycle(String departmentId); void repairRecycle(String departmentId);
DepartmentDTO getRootByEnterpriseId(String wxEnterpriseId);
} }
...@@ -2,10 +2,21 @@ package com.gic.haoban.manage.service.service; ...@@ -2,10 +2,21 @@ package com.gic.haoban.manage.service.service;
import java.util.List; import java.util.List;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
public interface StaffDepartmentRelatedService { public interface StaffDepartmentRelatedService {
List<TabHaobanStaffDepartmentRelated> listByDepartmentId(String departmentId); List<TabHaobanStaffDepartmentRelated> listByDepartmentId(String departmentId);
String add(StaffDepartmentRelatedDTO related);
List<TabHaobanStaffDepartmentRelated> listStaffDepartmentByStaffId(String staffId);
StaffDepartmentRelatedDTO selectById(String staffDepartmentStaffRelatedId);
void del(StaffDepartmentRelatedDTO related);
} }
package com.gic.haoban.manage.service.service; package com.gic.haoban.manage.service.service;
import java.util.Set;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.github.pagehelper.Page;
public interface StaffService { public interface StaffService {
TabHaobanStaff selectById(String staffId); TabHaobanStaff selectById(String staffId);
TabHaobanStaff selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber);
String add(TabHaobanStaff tab);
Page<TabHaobanStaff> pageStaff(Set<String> staffIds, Integer activeFlag, String keyword);
TabHaobanStaff selectByUserId(String userId);
void updateByPrimaryKey(TabHaobanStaff tab);
} }
package com.gic.haoban.manage.service.service; package com.gic.haoban.manage.service.service;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
public interface WxEnterpriseRelatedService { public interface WxEnterpriseRelatedService {
TabHaobanWxEnterpriseRelated getByGicEnterpriseIdByEnterpriseRelatedId(String wxEnterpriseRelatedId);
} }
package com.gic.haoban.manage.service.service;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
public interface WxEnterpriseService {
String add(WxEnterpriseDTO wxDTO);
}
...@@ -104,4 +104,10 @@ public class DepartmentServiceImpl implements DepartmentService { ...@@ -104,4 +104,10 @@ public class DepartmentServiceImpl implements DepartmentService {
} }
@Override
public DepartmentDTO getRootByEnterpriseId(String wxEnterpriseId) {
TabHaobanDepartment tab = mapper.getRootByEnterpriseId(wxEnterpriseId);
return EntityUtil.changeEntityByJSON(DepartmentDTO.class, tab);
}
} }
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService; import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
...@@ -22,4 +27,38 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated ...@@ -22,4 +27,38 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
return mapper.listByDepartmentId(departmentId); return mapper.listByDepartmentId(departmentId);
} }
@Override
public String add(StaffDepartmentRelatedDTO related) {
Date now = new Date();
related.setCreateTime(now);
related.setUpdateTime(now);
related.setStatusFlag(1);
related.setStaffDepartmentRelatedId(StringUtil.randomUUID());
TabHaobanStaffDepartmentRelated tab = EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, related);
mapper.insert(tab);
return related.getStaffDepartmentRelatedId();
}
@Override
public List<TabHaobanStaffDepartmentRelated> listStaffDepartmentByStaffId(String staffId) {
return mapper.listStaffDepartmentByStaffId(staffId);
}
@Override
public StaffDepartmentRelatedDTO selectById(String staffDepartmentStaffRelatedId) {
return EntityUtil.changeEntityByJSON(StaffDepartmentRelatedDTO.class, mapper.selectByPrimaryKey(staffDepartmentStaffRelatedId));
}
@Override
public void del(StaffDepartmentRelatedDTO related) {
TabHaobanStaffDepartmentRelated tab = EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, related);
tab.setStatusFlag(0);
tab.setUpdateTime(new Date());
mapper.updateByPrimaryKeySelective(tab);
}
} }
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper; import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
import com.github.pagehelper.Page;
@Service @Service
public class StaffServiceImpl implements StaffService { public class StaffServiceImpl implements StaffService {
...@@ -19,4 +24,36 @@ public class StaffServiceImpl implements StaffService { ...@@ -19,4 +24,36 @@ public class StaffServiceImpl implements StaffService {
return mapper.selectByPrimaryKey(id); return mapper.selectByPrimaryKey(id);
} }
@Override
public TabHaobanStaff selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber) {
return mapper.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber);
}
@Override
public String add(TabHaobanStaff tab) {
Date now = new Date();
tab.setCreateTime(now);
tab.setUpdateTime(now);
tab.setStaffId(StringUtil.randomUUID());
tab.setStatusFlag(1);
return tab.getStaffId();
}
@Override
public Page<TabHaobanStaff> pageStaff(Set<String> staffIds, Integer activeFlag, String keyword) {
return mapper.pageStaff(staffIds,activeFlag,keyword);
}
@Override
public TabHaobanStaff selectByUserId(String userId) {
return mapper.selectByUserId(userId);
}
@Override
public void updateByPrimaryKey(TabHaobanStaff tab) {
mapper.updateByPrimaryKey(tab);
}
} }
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService; import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
@Service @Service
public class WxEnterpriseRelatedServiceImpl implements WxEnterpriseRelatedService { public class WxEnterpriseRelatedServiceImpl implements WxEnterpriseRelatedService {
@Autowired
private WxEnterpriseRelatedMapper mapper;
@Override
public TabHaobanWxEnterpriseRelated getByGicEnterpriseIdByEnterpriseRelatedId(String wxEnterpriseRelatedId) {
return mapper.selectByPrimaryKey(wxEnterpriseRelatedId);
}
} }
package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
@Service
public class WxEnterpriseServiceImpl implements WxEnterpriseService {
@Autowired
WxEnterpriseMapper mapper;
@Override
public String add(WxEnterpriseDTO wxDTO) {
Date now = new Date();
wxDTO.setWxEnterpriseId(StringUtil.randomUUID());
wxDTO.setCreateTime(now);
wxDTO.setUpdateTime(now);
mapper.insertSelective(EntityUtil.changeEntityByJSON(TabHaobanWxEnterprise.class, wxDTO));
return wxDTO.getWxEnterpriseId();
}
}
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -15,6 +16,7 @@ import com.gic.haoban.common.utils.PageUtil; ...@@ -15,6 +16,7 @@ import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.StringUtil; import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.service.dao.mapper.DepartmentMapper;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment; import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.DepartmentService; import com.gic.haoban.manage.service.service.DepartmentService;
...@@ -28,7 +30,10 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -28,7 +30,10 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
private DepartmentService departmentService; private DepartmentService departmentService;
@Autowired @Autowired
private StaffDepartmentRelatedService staffDepartmentService; private StaffDepartmentRelatedService staffDepartmentService;
@Autowired
private DepartmentMapper departmentMapper;
@Override @Override
public List<DepartmentDTO> listByParentId(String parentId) { public List<DepartmentDTO> listByParentId(String parentId) {
List<TabHaobanDepartment> list = departmentService.listByParentId(parentId); List<TabHaobanDepartment> list = departmentService.listByParentId(parentId);
...@@ -135,4 +140,26 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -135,4 +140,26 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
} }
@Override
public List<DepartmentDTO> listByDepartmentIds(List<String> departmentIds,
int storeFlag) {
List<TabHaobanDepartment> list= departmentMapper.listByDepartmentIds(departmentIds, storeFlag);
if(list==null){
return new ArrayList<DepartmentDTO>();
}
return EntityUtil.changeEntityListByJSON(DepartmentDTO.class, list);
}
@Override
public DepartmentDTO getRootByEnterpriseId(String wxEnterpriseId) {
return departmentService.getRootByEnterpriseId(wxEnterpriseId);
}
@Override
public List<DepartmentDTO> listStoreByWxEnterpriseId(String wxEnterpriseId) {
List<TabHaobanDepartment> list = departmentMapper.listStoreByWxEnterpriseId(wxEnterpriseId);
return EntityUtil.changeEntityListByJSON(DepartmentDTO.class, list);
}
} }
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import cn.hutool.core.collection.CollectionUtil;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.StringUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
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.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
import com.github.pagehelper.PageHelper;
@Service @Service
public class StaffApiServiceImpl implements StaffApiService { public class StaffApiServiceImpl implements StaffApiService {
@Autowired @Autowired
StaffService staffService; StaffService staffService;
@Autowired
StaffMapper staffMapper;
@Autowired
StaffDepartmentRelatedService staffDepartmentRelatedService;
@Autowired
private StaffDepartmentRelatedMapper staffDepartmentRelatedMapper;
@Override @Override
public StaffDTO selectById(String staffId) { public StaffDTO selectById(String staffId) {
TabHaobanStaff staff = staffService.selectById(staffId); TabHaobanStaff staff = staffService.selectById(staffId);
return EntityUtil.changeEntityByJSON(StaffDTO.class, staff); return EntityUtil.changeEntityByJSON(StaffDTO.class, staff);
} }
@Override
public StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber) {
TabHaobanStaff staff = staffService.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber);
return EntityUtil.changeEntityByJSON(StaffDTO.class, staff);
}
@Override
public HaobanResponse add(StaffDTO staff, String departmentIds) {
HaobanResponse hr = new HaobanResponse();
hr.setErrorCode(1);
Integer activeFlag = staff.getActiveFlag();
TabHaobanStaff tab = EntityUtil.changeEntityByJSON(TabHaobanStaff.class, staff);
String staffId = staffService.add(tab);
//调接口获取
String wxUserId = "";
if(StringUtils.isNotBlank(wxUserId)){
String[] departmentIdArr = departmentIds.split(",");
for (String string : departmentIdArr) {
StaffDepartmentRelatedDTO related = new StaffDepartmentRelatedDTO();
related.setDepartmentId(string);
related.setNationCode(staff.getNationCode());
related.setPhoneNumber(staff.getPhoneNumber());
related.setStaffId(staffId);
related.setWxUserId(wxUserId);
staffDepartmentRelatedService.add(related);
}
}else {
hr.setErrorCode(0);
hr.setMessage("微信端新增失败");
}
return hr;
}
@Override
public List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId) {
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staffId);
return EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list);
}
@Override
public Page<StaffDTO> pageStaff(String departmentId, Integer activeFlag, String keyword, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listByDepartmentId(departmentId);
Set<String> staffIds = new HashSet<String>();
for (TabHaobanStaffDepartmentRelated tabHaobanStaffDepartmentRelated : list) {
staffIds.add(tabHaobanStaffDepartmentRelated.getStaffId());
}
return PageUtil.changePageHelperToCurrentPage(staffService.pageStaff(staffIds, activeFlag, keyword),StaffDTO.class);
}
@Override
public List<StaffDTO> listByIds(List<String> staffIds) {
List<TabHaobanStaff> staffs = staffMapper.listByIds(staffIds);
if(CollectionUtil.isNotEmpty(staffs)){
List<StaffDTO> resultList = EntityUtil.changeEntityListByJSON(StaffDTO.class, staffs);
return resultList;
}else{
return new ArrayList<StaffDTO>();
}
}
@Override
public void del(String staffDepartmentStaffRelatedId) {
StaffDepartmentRelatedDTO related = staffDepartmentRelatedService.selectById(staffDepartmentStaffRelatedId);
if(related != null) {
List<TabHaobanStaffDepartmentRelated> relatedList = staffDepartmentRelatedService.listStaffDepartmentByStaffId(related.getStaffId());
//只在当前门店
if(relatedList.size() <= 1) {
//微信接口删除
staffDepartmentRelatedService.del(related);
//走修改流程
}else {
}
}
}
@Override
public void wxGetAdd(String userId,String wxEnterpriseId) {
//获取微信用户信息
TabHaobanStaff staff = staffService.selectByUserId(userId);
if(staff == null) {
TabHaobanStaff tab = new TabHaobanStaff();
staffService.add(tab);
StaffDepartmentRelatedDTO dto = new StaffDepartmentRelatedDTO();
staffDepartmentRelatedService.add(dto);
}
}
@Override
public void staffEdit(StaffDTO staffDTO, String departmentIds) {
TabHaobanStaff oldStaff = staffMapper.selectByPrimaryKey(staffDTO.getStaffId());
//1、先更新staff
TabHaobanStaff tab = EntityUtil.changeEntityByJSON(TabHaobanStaff.class, staffDTO);
staffService.updateByPrimaryKey(tab);
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staffDTO.getStaffId());
Map<String,TabHaobanStaffDepartmentRelated> map = com.gic.commons.util.CollectionUtil.toMap(list, "departmentId");
//2、该员工新增部门
if(StringUtils.isNotBlank(departmentIds)){
String [] addIds = departmentIds.split(",");
for(String addId : addIds){
if(!map.containsKey(addId)){
//该员工新增了部门
StaffDepartmentRelatedDTO related = new StaffDepartmentRelatedDTO();
related.setStaffDepartmentRelatedId(UuidUtil.randomUUID());
related.setStaffId(staffDTO.getStaffId());
related.setClerkCode(null);
related.setCreateTime(new Date());
related.setDepartmentId(addId);
related.setNationCode(staffDTO.getNationCode());
related.setPhoneNumber(staffDTO.getPhoneNumber());
related.setStatusFlag(1);
related.setUpdateTime(new Date());
related.setWxUserId(staffDTO.getWxUserId());
staffDepartmentRelatedService.add(related);
}else{
//该员工部门没做改变(只更新手机号即可)
TabHaobanStaffDepartmentRelated related = map.get(addId);
if(!staffDTO.getPhoneNumber().equals(related.getPhoneNumber())){
related.setPhoneNumber(staffDTO.getPhoneNumber());
related.setNationCode(staffDTO.getNationCode());
related.setUpdateTime(new Date());
staffDepartmentRelatedMapper.updateByPrimaryKeySelective(related);
}
if(org.apache.commons.lang3.StringUtils.isNoneBlank(related.getClerkCode())){
if(!staffDTO.getPhoneNumber().equals(related.getPhoneNumber())||!staffDTO.getStaffName().equals(oldStaff.getStaffName())){
//TODO 通知gic同步修改姓名和手机号
}
}
}
}
}
//3、该员工删除部门
for(TabHaobanStaffDepartmentRelated tab1 : list){
if(departmentIds == null){
departmentIds = "";
}
//不包含,则说明员工删除了该部门
if(!departmentIds.contains(tab1.getDepartmentId())){
StaffDepartmentRelatedDTO related = EntityUtil.changeEntityByJSON(StaffDepartmentRelatedDTO.class, tab1);
staffDepartmentRelatedService.del(related);
if(org.apache.commons.lang3.StringUtils.isNoneBlank(tab1.getClerkCode())){
//TODO 通知gic解绑
}
}
}
}
} }
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import cn.hutool.core.collection.CollectionUtil;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.dto.ApplicationDTO; import com.gic.haoban.manage.api.dto.ApplicationDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.service.ApplicationApiService; import com.gic.haoban.manage.api.service.ApplicationApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService; import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanApplication; import com.gic.haoban.manage.service.entity.TabHaobanApplication;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.ApplicationService; import com.gic.haoban.manage.service.service.ApplicationService;
...@@ -21,7 +26,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -21,7 +26,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
@Autowired @Autowired
private StaffDepartmentRelatedService staffDepartmentRelatedService; private StaffDepartmentRelatedService staffDepartmentRelatedService;
@Autowired
private StaffDepartmentRelatedMapper staffDepartmentRelatedMapper;
@Override @Override
public List<StaffDepartmentRelatedDTO> listByDepartmentId( public List<StaffDepartmentRelatedDTO> listByDepartmentId(
String departmentId) { String departmentId) {
...@@ -30,5 +36,46 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -30,5 +36,46 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
return resultList; return resultList;
} }
@Override
public void updateById(StaffDepartmentRelatedDTO dto) {
TabHaobanStaffDepartmentRelated tab = EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, dto);
staffDepartmentRelatedMapper.updateByPrimaryKeySelective(tab);
}
@Override
public void deleteCode(StaffDepartmentRelatedDTO dto) {
staffDepartmentRelatedMapper.deleteCode(EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, dto));
}
@Override
public StaffDepartmentRelatedDTO getOneByClerkCode(String clerkCode) {
TabHaobanStaffDepartmentRelated tab = staffDepartmentRelatedMapper.getOneByClerkCode(clerkCode);
if(tab== null){
return null;
}
StaffDepartmentRelatedDTO dto = EntityUtil.changeEntity(StaffDepartmentRelatedDTO.class, tab);
return dto;
}
@Override
public StaffDepartmentRelatedDTO getByStaffDepartmentRelatedId(String staffDepartmentRelatedId) {
TabHaobanStaffDepartmentRelated tab = staffDepartmentRelatedMapper.getById(staffDepartmentRelatedId);
if(Objects.isNull(tab)){
return null;
}
StaffDepartmentRelatedDTO dto = EntityUtil.changeEntity(StaffDepartmentRelatedDTO.class, tab);
return dto;
}
@Override
public List<StaffDepartmentRelatedDTO> listByStaffId(String staffId) {
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedMapper.listStaffDepartmentByStaffId(staffId);
if(CollectionUtil.isEmpty(list)){
return new ArrayList<StaffDepartmentRelatedDTO>();
}
List<StaffDepartmentRelatedDTO> resultList = EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list);
return resultList;
}
} }
package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.hutool.core.collection.CollectionUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.dto.QywxCorpInfoSimpleDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
@Service
public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private WxEnterpriseMapper wxEnterpriseMapper;
@Override
public void callbackReviceEnterprise(QywxCorpInfoSimpleDTO dto) {
WxEnterpriseDTO wxDTO = EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, dto.getClass());
String wxEnterpriseId = wxEnterpriseService.add(wxDTO);
String userId = dto.getUserid();
String name = dto.getName();
staffApiService.wxGetAdd(userId,wxEnterpriseId);
}
@Override
public List<YwWxEnterpriseDTO> list() {
List<TabHaobanWxEnterprise> list = wxEnterpriseMapper.list();
if(CollectionUtil.isEmpty(list)){
return new ArrayList<YwWxEnterpriseDTO>();
}
List<YwWxEnterpriseDTO> resultList = EntityUtil.changeEntityListByJSON(YwWxEnterpriseDTO.class, list);
return resultList;
}
}
...@@ -5,6 +5,7 @@ import java.util.List; ...@@ -5,6 +5,7 @@ import java.util.List;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
...@@ -13,12 +14,15 @@ import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO; ...@@ -13,12 +14,15 @@ import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService; import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
@Service @Service
public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApiService { public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApiService {
private static final Logger logger = LogManager.getLogger(WxEnterpriseRelatedApiServiceImpl.class); private static final Logger logger = LogManager.getLogger(WxEnterpriseRelatedApiServiceImpl.class);
@Autowired
private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper; private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper;
@Autowired
private WxEnterpriseRelatedService wxEnterpriseRelatedService;
@Override @Override
public List<EnterpriseDetailDTO> listEnterpriseByWxEnterpriseId( public List<EnterpriseDetailDTO> listEnterpriseByWxEnterpriseId(
String wxEnterpriseId) { String wxEnterpriseId) {
...@@ -29,11 +33,12 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -29,11 +33,12 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
return result; return result;
} }
@Override @Override
public void wxEnterpriseBind(String enterpriseId, String wxEnterpriseId, public int wxEnterpriseBind(String enterpriseId, String wxEnterpriseId,
String version) { String version) {
TabHaobanWxEnterpriseRelated tab = wxEnterpriseRelatedMapper.findOneByEnterpriseId(enterpriseId); TabHaobanWxEnterpriseRelated tab = wxEnterpriseRelatedMapper.findOneByEnterpriseId(enterpriseId);
if(tab!= null){ if(tab!= null){
logger.info("该gicEnterpriseId已经绑定过了"); logger.info("该gicEnterpriseId已经绑定过了");
return 1;
}else{ }else{
tab = new TabHaobanWxEnterpriseRelated(); tab = new TabHaobanWxEnterpriseRelated();
tab.setEnterpriseId(enterpriseId); tab.setEnterpriseId(enterpriseId);
...@@ -45,6 +50,16 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -45,6 +50,16 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
tab.setWxEnterpriseRelatedId(UuidUtil.randomUUID()); tab.setWxEnterpriseRelatedId(UuidUtil.randomUUID());
wxEnterpriseRelatedMapper.insertSelective(tab); wxEnterpriseRelatedMapper.insertSelective(tab);
} }
return 0;
}
@Override
public String getGicEnterpriseIdByEnterpriseRelatedId(String wxEnterpriseRelatedId) {
TabHaobanWxEnterpriseRelated tab = wxEnterpriseRelatedService.getByGicEnterpriseIdByEnterpriseRelatedId(wxEnterpriseRelatedId);
if(tab != null) {
return tab.getEnterpriseId();
}
return null;
} }
} }
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<dubbo:service interface="com.gic.haoban.manage.api.service.StaffApiService" ref="staffApiServiceImpl" timeout="10000" /> <dubbo:service interface="com.gic.haoban.manage.api.service.StaffApiService" ref="staffApiServiceImpl" timeout="10000" />
<dubbo:service interface="com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService" ref="wxEnterpriseRelatedApiServiceImpl" timeout="10000" /> <dubbo:service interface="com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService" ref="wxEnterpriseRelatedApiServiceImpl" timeout="10000" />
<dubbo:service interface="com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService" ref="staffDepartmentRelatedApiServiceImpl" timeout="10000" /> <dubbo:service interface="com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService" ref="staffDepartmentRelatedApiServiceImpl" timeout="10000" />
<dubbo:service interface="com.gic.haoban.manage.api.service.WxEnterpriseApiService" ref="wxEnterpriseApiServiceImpl" timeout="10000" />
</beans> </beans>
\ No newline at end of file
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<result column="parent_department_id" property="parentDepartmentId" jdbcType="VARCHAR" /> <result column="parent_department_id" property="parentDepartmentId" jdbcType="VARCHAR" />
<result column="related_id" property="relatedId" jdbcType="VARCHAR" /> <result column="related_id" property="relatedId" jdbcType="VARCHAR" />
<result column="chain_id" property="chainId" jdbcType="VARCHAR" /> <result column="chain_id" property="chainId" jdbcType="VARCHAR" />
<result column="chain_name" property="chainName" jdbcType="VARCHAR" />
<result column="is_store" property="isStore" jdbcType="INTEGER" /> <result column="is_store" property="isStore" jdbcType="INTEGER" />
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" /> <result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
<result column="recycle_flag" property="recycleFlag" jdbcType="INTEGER" /> <result column="recycle_flag" property="recycleFlag" jdbcType="INTEGER" />
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
department_id, department_name, parent_department_id, related_id, chain_id, is_store, department_id, department_name, parent_department_id, related_id, chain_id, is_store,
status_flag, recycle_flag, create_time, update_time,wx_department_id,sort,level,wx_enterprise_id status_flag, recycle_flag, create_time, update_time,wx_department_id,sort,level,wx_enterprise_id,chain_name
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select select
...@@ -35,11 +36,11 @@ ...@@ -35,11 +36,11 @@
insert into tab_haoban_department (department_id, department_name, parent_department_id, insert into tab_haoban_department (department_id, department_name, parent_department_id,
related_id, chain_id, is_store, related_id, chain_id, is_store,
status_flag, recycle_flag, create_time, status_flag, recycle_flag, create_time,
update_time,wx_department_id,sort,level,wx_enterprise_id) update_time,wx_department_id,sort,level,wx_enterprise_id,chain_name)
values (#{departmentId,jdbcType=VARCHAR}, #{departmentName,jdbcType=VARCHAR}, #{parentDepartmentId,jdbcType=VARCHAR}, values (#{departmentId,jdbcType=VARCHAR}, #{departmentName,jdbcType=VARCHAR}, #{parentDepartmentId,jdbcType=VARCHAR},
#{relatedId,jdbcType=VARCHAR}, #{chainId,jdbcType=VARCHAR}, #{isStore,jdbcType=INTEGER}, #{relatedId,jdbcType=VARCHAR}, #{chainId,jdbcType=VARCHAR}, #{isStore,jdbcType=INTEGER},
#{statusFlag,jdbcType=INTEGER}, #{recycleFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{statusFlag,jdbcType=INTEGER}, #{recycleFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},#{wxDepartmentId},#{sort},#{level},#{wxEnterpriseId}) #{updateTime,jdbcType=TIMESTAMP},#{wxDepartmentId},#{sort},#{level},#{wxEnterpriseId},#{chainName})
</insert> </insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment" > <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment" >
insert into tab_haoban_department insert into tab_haoban_department
...@@ -59,6 +60,9 @@ ...@@ -59,6 +60,9 @@
<if test="chainId != null" > <if test="chainId != null" >
chain_id, chain_id,
</if> </if>
<if test="chainName != null" >
chain_name,
</if>
<if test="isStore != null" > <if test="isStore != null" >
is_store, is_store,
</if> </if>
...@@ -100,6 +104,9 @@ ...@@ -100,6 +104,9 @@
<if test="chainId != null" > <if test="chainId != null" >
#{chainId,jdbcType=VARCHAR}, #{chainId,jdbcType=VARCHAR},
</if> </if>
<if test="chainName != null" >
#{chainName,jdbcType=VARCHAR},
</if>
<if test="isStore != null" > <if test="isStore != null" >
#{isStore,jdbcType=INTEGER}, #{isStore,jdbcType=INTEGER},
</if> </if>
...@@ -141,6 +148,9 @@ ...@@ -141,6 +148,9 @@
<if test="chainId != null" > <if test="chainId != null" >
chain_id = #{chainId,jdbcType=VARCHAR}, chain_id = #{chainId,jdbcType=VARCHAR},
</if> </if>
<if test="chainName != null" >
chain_name = #{chainName,jdbcType=VARCHAR},
</if>
<if test="isStore != null" > <if test="isStore != null" >
is_store = #{isStore,jdbcType=INTEGER}, is_store = #{isStore,jdbcType=INTEGER},
</if> </if>
...@@ -177,6 +187,7 @@ ...@@ -177,6 +187,7 @@
parent_department_id = #{parentDepartmentId,jdbcType=VARCHAR}, parent_department_id = #{parentDepartmentId,jdbcType=VARCHAR},
related_id = #{relatedId,jdbcType=VARCHAR}, related_id = #{relatedId,jdbcType=VARCHAR},
chain_id = #{chainId,jdbcType=VARCHAR}, chain_id = #{chainId,jdbcType=VARCHAR},
chain_name = #{chainName,jdbcType=VARCHAR},
wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR}, wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR},
is_store = #{isStore,jdbcType=INTEGER}, is_store = #{isStore,jdbcType=INTEGER},
status_flag = #{statusFlag,jdbcType=INTEGER}, status_flag = #{statusFlag,jdbcType=INTEGER},
...@@ -213,4 +224,58 @@ ...@@ -213,4 +224,58 @@
where related_id = #{relatedId,jdbcType=VARCHAR} where related_id = #{relatedId,jdbcType=VARCHAR}
and status_flag = 1 and status_flag = 1
</select> </select>
<select id="pageDepartmentByParams" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where status_flag = 1
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="keyword != null and keyword != ''">
and department_name like CONCAT('%',#{keyWord},'%')
</if>
<if test="recycleFlag != null">
and recycle_flag = #{recycleFlag}
</if>
<if test="departmentId != null and departmentId != ''">
and department_id = #{departmentId}
</if>
</select>
<select id="listByDepartmentIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where status_flag = 1
and is_store = #{storeFlag,jdbcType=INTEGER}
<if test="staffIds != null and staffIds.size() > 0">
and department_id IN
<foreach collection="departmentIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
order by create_time
</select>
<select id="listStoreByWxEnterpriseId" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where status_flag = 1
and is_store = #{storeFlag,jdbcType=INTEGER}
and wx_enterprise_id = #{wxEnterpriseId}
order by create_time
</select>
<select id="getRootByEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where level = 0
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
<if test="updateTime != null" > <if test="updateTime != null" >
update_time, update_time,
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="staffDepartmentRelatedId != null" > <if test="staffDepartmentRelatedId != null" >
...@@ -158,4 +159,38 @@ ...@@ -158,4 +159,38 @@
from tab_haoban_staff_department_related from tab_haoban_staff_department_related
where department_id = #{departmentId,jdbcType=VARCHAR} where department_id = #{departmentId,jdbcType=VARCHAR}
</select> </select>
<select id="getOneByClerkCode" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff_department_related
where clerk_code = #{clerkCode,jdbcType=VARCHAR}
and status_flag = 1
</select>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff_department_related
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
and status_flag = 1
</select>
<update id="deleteCode" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated" >
update tab_haoban_staff_department_related
set
clerk_code = #{clerkCode,jdbcType=VARCHAR}
and update_time = #{updateTime,jdbcType=TIMESTAMP}
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</update>
<select id="listStaffDepartmentByStaffId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff_department_related
where staff_id = #{staffId,jdbcType=VARCHAR}
and status_flag = 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -4,13 +4,16 @@ ...@@ -4,13 +4,16 @@
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanStaff" > <resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanStaff" >
<id column="staff_id" property="staffId" jdbcType="VARCHAR" /> <id column="staff_id" property="staffId" jdbcType="VARCHAR" />
<result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR" /> <result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR" />
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" />
<result column="phone_number" property="phoneNumber" jdbcType="VARCHAR" /> <result column="phone_number" property="phoneNumber" jdbcType="VARCHAR" />
<result column="staff_name" property="staffName" jdbcType="VARCHAR" /> <result column="staff_name" property="staffName" jdbcType="VARCHAR" />
<result column="nation_code" property="nationCode" jdbcType="VARCHAR" /> <result column="nation_code" property="nationCode" jdbcType="VARCHAR" />
<result column="nick_name" property="nickName" jdbcType="VARCHAR" /> <result column="nick_name" property="nickName" jdbcType="VARCHAR" />
<result column="sex" property="sex" jdbcType="INTEGER" /> <result column="sex" property="sex" jdbcType="INTEGER" />
<result column="head_img" property="headImg" jdbcType="VARCHAR" />
<result column="postion" property="postion" jdbcType="VARCHAR" /> <result column="postion" property="postion" jdbcType="VARCHAR" />
<result column="active_flag" property="activeFlag" jdbcType="INTEGER" /> <result column="active_flag" property="activeFlag" jdbcType="INTEGER" />
<result column="sort" property="sort" jdbcType="INTEGER" />
<result column="extend_postion" property="extendPostion" jdbcType="VARCHAR" /> <result column="extend_postion" property="extendPostion" 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" />
...@@ -18,7 +21,7 @@ ...@@ -18,7 +21,7 @@
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
staff_id, wx_user_id, phone_number, staff_name, nation_code, nick_name, sex, postion, staff_id, wx_user_id, phone_number, staff_name, nation_code, nick_name, sex, postion,
active_flag, extend_postion, status_flag, create_time, update_time active_flag, extend_postion, status_flag, create_time, update_time,wx_enterprise_id,head_img,sort
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select select
...@@ -35,12 +38,12 @@ ...@@ -35,12 +38,12 @@
staff_name, nation_code, nick_name, staff_name, nation_code, nick_name,
sex, postion, active_flag, sex, postion, active_flag,
extend_postion, status_flag, create_time, extend_postion, status_flag, create_time,
update_time) update_time,wx_enterprise_id,head_img,sort)
values (#{staffId,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR}, values (#{staffId,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR},
#{staffName,jdbcType=VARCHAR}, #{nationCode,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR}, #{staffName,jdbcType=VARCHAR}, #{nationCode,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR},
#{sex,jdbcType=INTEGER}, #{postion,jdbcType=VARCHAR}, #{activeFlag,jdbcType=INTEGER}, #{sex,jdbcType=INTEGER}, #{postion,jdbcType=VARCHAR}, #{activeFlag,jdbcType=INTEGER},
#{extendPostion,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{extendPostion,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}) #{updateTime,jdbcType=TIMESTAMP},#{wxEnterpriseId},#{headImg},#{sort})
</insert> </insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff" > <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff" >
insert into tab_haoban_staff insert into tab_haoban_staff
...@@ -51,6 +54,9 @@ ...@@ -51,6 +54,9 @@
<if test="wxUserId != null" > <if test="wxUserId != null" >
wx_user_id, wx_user_id,
</if> </if>
<if test="wxEnterpriseId != null" >
wx_enterprise_id,
</if>
<if test="phoneNumber != null" > <if test="phoneNumber != null" >
phone_number, phone_number,
</if> </if>
...@@ -75,6 +81,9 @@ ...@@ -75,6 +81,9 @@
<if test="extendPostion != null" > <if test="extendPostion != null" >
extend_postion, extend_postion,
</if> </if>
<if test="headImg != null" >
head_img,
</if>
<if test="statusFlag != null" > <if test="statusFlag != null" >
status_flag, status_flag,
</if> </if>
...@@ -84,6 +93,9 @@ ...@@ -84,6 +93,9 @@
<if test="updateTime != null" > <if test="updateTime != null" >
update_time, update_time,
</if> </if>
<if test="sort != null" >
sort,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="staffId != null" > <if test="staffId != null" >
...@@ -92,6 +104,9 @@ ...@@ -92,6 +104,9 @@
<if test="wxUserId != null" > <if test="wxUserId != null" >
#{wxUserId,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR},
</if> </if>
<if test="wxEnterpriseId != null" >
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="phoneNumber != null" > <if test="phoneNumber != null" >
#{phoneNumber,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR},
</if> </if>
...@@ -116,6 +131,9 @@ ...@@ -116,6 +131,9 @@
<if test="extendPostion != null" > <if test="extendPostion != null" >
#{extendPostion,jdbcType=VARCHAR}, #{extendPostion,jdbcType=VARCHAR},
</if> </if>
<if test="headImg != null" >
#{headImg,jdbcType=VARCHAR},
</if>
<if test="statusFlag != null" > <if test="statusFlag != null" >
#{statusFlag,jdbcType=INTEGER}, #{statusFlag,jdbcType=INTEGER},
</if> </if>
...@@ -125,6 +143,9 @@ ...@@ -125,6 +143,9 @@
<if test="updateTime != null" > <if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="sort != null" >
#{sort,jdbcType=INTEGER},
</if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff" > <update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff" >
...@@ -133,6 +154,9 @@ ...@@ -133,6 +154,9 @@
<if test="wxUserId != null" > <if test="wxUserId != null" >
wx_user_id = #{wxUserId,jdbcType=VARCHAR}, wx_user_id = #{wxUserId,jdbcType=VARCHAR},
</if> </if>
<if test="wxEnterpriseId != null" >
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="phoneNumber != null" > <if test="phoneNumber != null" >
phone_number = #{phoneNumber,jdbcType=VARCHAR}, phone_number = #{phoneNumber,jdbcType=VARCHAR},
</if> </if>
...@@ -157,6 +181,9 @@ ...@@ -157,6 +181,9 @@
<if test="extendPostion != null" > <if test="extendPostion != null" >
extend_postion = #{extendPostion,jdbcType=VARCHAR}, extend_postion = #{extendPostion,jdbcType=VARCHAR},
</if> </if>
<if test="headImg != null" >
head_img = #{headImg,jdbcType=VARCHAR},
</if>
<if test="statusFlag != null" > <if test="statusFlag != null" >
status_flag = #{statusFlag,jdbcType=INTEGER}, status_flag = #{statusFlag,jdbcType=INTEGER},
</if> </if>
...@@ -166,12 +193,16 @@ ...@@ -166,12 +193,16 @@
<if test="updateTime != null" > <if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="sort != null" >
sort = #{sort,jdbcType=INTEGER},
</if>
</set> </set>
where staff_id = #{staffId,jdbcType=VARCHAR} where staff_id = #{staffId,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff" > <update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff" >
update tab_haoban_staff update tab_haoban_staff
set wx_user_id = #{wxUserId,jdbcType=VARCHAR}, set wx_user_id = #{wxUserId,jdbcType=VARCHAR},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
phone_number = #{phoneNumber,jdbcType=VARCHAR}, phone_number = #{phoneNumber,jdbcType=VARCHAR},
staff_name = #{staffName,jdbcType=VARCHAR}, staff_name = #{staffName,jdbcType=VARCHAR},
nation_code = #{nationCode,jdbcType=VARCHAR}, nation_code = #{nationCode,jdbcType=VARCHAR},
...@@ -180,9 +211,61 @@ ...@@ -180,9 +211,61 @@
postion = #{postion,jdbcType=VARCHAR}, postion = #{postion,jdbcType=VARCHAR},
active_flag = #{activeFlag,jdbcType=INTEGER}, active_flag = #{activeFlag,jdbcType=INTEGER},
extend_postion = #{extendPostion,jdbcType=VARCHAR}, extend_postion = #{extendPostion,jdbcType=VARCHAR},
head_img = #{headImg,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},
sort = #{sort}
where staff_id = #{staffId,jdbcType=VARCHAR} where staff_id = #{staffId,jdbcType=VARCHAR}
</update> </update>
<select id="selectByNationcodeAndPhoneNumber" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff
where nation_code = #{nationCode}
and phone_number = #{phoneNumber}
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</select>
<select id="pageStaff" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff
where status_flag = 1
<if test="keyword != null and keyword != ''">
and staff_name like CONCAT('%',#{keyWord},'%')
</if>
<if test="activeFlag != null">
and active_flag = #{activeFlag}
</if>
<if test="staffIds != null and staffIds.size() > 0">
and staff_id IN
<foreach collection="staffIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
</select>
<select id="listByIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff
where status_flag = 1
<if test="staffIds != null and staffIds.size() > 0">
and staff_id IN
<foreach collection="staffIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
</select>
<select id="selectByUserId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff
where user_id = #{userId,jdbcType=VARCHAR}
and staus_flag = 1
</select>
</mapper> </mapper>
\ No newline at end of file
package com.gic.haoban.manage.web.controller;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.clerk.api.service.ClerkService;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
@RestController
public class ClerkController extends WebBaseController{
@Autowired
private ClerkService clerkService;
@Autowired
private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService;
//成员绑定
@RequestMapping("/staff-bind")
public HaobanResponse staffBind(String clerkCode,String staffDepartmentRelatedId) {
StaffDepartmentRelatedDTO dto = new StaffDepartmentRelatedDTO();
dto.setStaffDepartmentRelatedId(staffDepartmentRelatedId);
dto.setClerkCode(clerkCode);
dto.setUpdateTime(new Date());
staffDepartmentRelatedApiService.updateById(dto);
return resultResponse(HaoBanErrCode.ERR_1);
}
//成员换绑定
@RequestMapping("/clerk-unbind")
public HaobanResponse clerkUnbind(String clerkCode,String staffDepartmentRelatedId) {
StaffDepartmentRelatedDTO one = staffDepartmentRelatedApiService.getOneByClerkCode(clerkCode);
if(one != null){
//存在,则先置空
one.setClerkCode(null);
one.setUpdateTime(new Date());
staffDepartmentRelatedApiService.deleteCode(one);
}
//不存在,则更新
StaffDepartmentRelatedDTO dto = new StaffDepartmentRelatedDTO();
dto.setStaffDepartmentRelatedId(staffDepartmentRelatedId);
dto.setClerkCode(clerkCode);
dto.setUpdateTime(new Date());
staffDepartmentRelatedApiService.updateById(dto);
return resultResponse(HaoBanErrCode.ERR_1);
}
}
...@@ -10,33 +10,39 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -10,33 +10,39 @@ import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.enterprise.api.dto.StoreDTO; import com.gic.enterprise.api.dto.GicTreeDTO;
import com.gic.enterprise.api.service.DepartmentService; import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.Constant; import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.common.utils.AuthRequestUtil; import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.common.utils.HaobanResponse; 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.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.DepartmentAddQO; import com.gic.haoban.manage.web.qo.DepartmentAddQO;
import com.gic.haoban.manage.web.qo.DepartmentEditQO; import com.gic.haoban.manage.web.qo.DepartmentEditQO;
import com.gic.haoban.manage.web.utils.ListUtils;
import com.gic.haoban.manage.web.vo.LoginVO; import com.gic.haoban.manage.web.vo.LoginVO;
@RestController @RestController
public class DepartmentContoller extends WebBaseController{ public class DepartmentContoller extends WebBaseController{
@Autowired @Autowired
private DepartmentApiService departmentApiService; private DepartmentApiService departmentApiService;
@Autowired
private DepartmentService departmentService;
@Autowired @Autowired
private StoreService storeService; private StoreGroupService storeGroupService;
@RequestMapping("department-list") @RequestMapping("department-list")
public HaobanResponse departmentList(String parentId) { public HaobanResponse departmentList(String parentId) {
List<DepartmentDTO> list = departmentApiService.listByParentId(parentId); LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser();
String wxEnterpriseId = login.getWxEnterpriseId();
List<DepartmentDTO> list = new ArrayList<DepartmentDTO>();
if(StringUtils.isNotBlank(parentId)) {
list = departmentApiService.listByParentId(parentId);
}else {
DepartmentDTO dto = departmentApiService.getRootByEnterpriseId(wxEnterpriseId);
list.add(dto);
}
return resultResponse(HaoBanErrCode.ERR_1,list); return resultResponse(HaoBanErrCode.ERR_1,list);
...@@ -125,6 +131,7 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -125,6 +131,7 @@ public class DepartmentContoller extends WebBaseController{
department.setWxDepartmentId(dto.getWxDepartmentId()); department.setWxDepartmentId(dto.getWxDepartmentId());
department.setDepartmentName(departmentAddQO.getDepartmentName()); department.setDepartmentName(departmentAddQO.getDepartmentName());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId()); department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setChainName(dto.getChainName() + Constant.NAME_SEPARATOR + dto.getDepartmentName());
department.setIsStore(0); department.setIsStore(0);
department.setIsStore(departmentAddQO.getStoreFlag()); department.setIsStore(departmentAddQO.getStoreFlag());
department.setLevel(dto.getLevel() + 1); department.setLevel(dto.getLevel() + 1);
...@@ -153,7 +160,10 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -153,7 +160,10 @@ public class DepartmentContoller extends WebBaseController{
department.setParentDepartmentId(parentId); department.setParentDepartmentId(parentId);
department.setDepartmentName(departmentQO.getDepartmentName()); department.setDepartmentName(departmentQO.getDepartmentName());
department.setChainId(parent.getChainId() + Constant.ID_SEPARATOR + parent.getDepartmentId()); department.setChainId(parent.getChainId() + Constant.ID_SEPARATOR + parent.getDepartmentId());
department.setChainName(parent.getChainName() + Constant.NAME_SEPARATOR + parent.getDepartmentName());
department.setLevel(parent.getLevel() + 1); department.setLevel(parent.getLevel() + 1);
handerSonDepartment(departmentQO.getCurrDepartment());
HaobanResponse hr = departmentApiService.edit(department); HaobanResponse hr = departmentApiService.edit(department);
} }
...@@ -179,36 +189,43 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -179,36 +189,43 @@ public class DepartmentContoller extends WebBaseController{
} }
/**
* 修改子孙部门
* @param departmentId
*/
private void handerSonDepartment(String departmentId) {
DepartmentDTO department = departmentApiService.selectById(departmentId);
List<DepartmentDTO> list = departmentApiService.listByParentId(departmentId);
if(!list.isEmpty()) {
for (DepartmentDTO departmentDTO : list) {
departmentDTO.setChainId(department.getChainId() + Constant.ID_SEPARATOR + department.getDepartmentId());
departmentDTO.setChainName(department.getChainName() + Constant.NAME_SEPARATOR + department.getDepartmentName());
departmentDTO.setLevel(department.getLevel());
departmentApiService.edit(departmentDTO);
}
}
}
@RequestMapping("unbind-department-list") @RequestMapping("unbind-department-list")
public HaobanResponse unbindDepartmentList(String departmentId,String enterpriseId) { public HaobanResponse unbindDepartmentList(String departmentId,String enterpriseId,Integer type) {
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
list.add(departmentId); list.add(departmentId);
List<com.gic.enterprise.api.dto.DepartmentDTO> departmentList = departmentService.getDeptmentByPids(list); List<GicTreeDTO> departmentList = storeGroupService.listGicTree(enterpriseId,type, departmentId);
List<StoreDTO> storeList = storeService.listStoreByStoreGroupId(departmentId);
List<DepartmentDTO> dtoList = new ArrayList<DepartmentDTO>(); List<DepartmentDTO> dtoList = new ArrayList<DepartmentDTO>();
for (com.gic.enterprise.api.dto.DepartmentDTO departmentDTO : departmentList) { for (GicTreeDTO departmentDTO : departmentList) {
DepartmentDTO dto = departmentApiService.selectByRelatedId(departmentDTO.getDepartId()); DepartmentDTO dto = departmentApiService.selectByRelatedId(departmentDTO.getId());
if(dto == null) { if(dto == null) {
DepartmentDTO unBindDTO = new DepartmentDTO(); DepartmentDTO unBindDTO = new DepartmentDTO();
unBindDTO.setRelatedId(departmentDTO.getDepartId()); unBindDTO.setRelatedId(departmentDTO.getId());
unBindDTO.setIsStore(0); unBindDTO.setIsStore(departmentDTO.getType());
unBindDTO.setDepartmentName(departmentDTO.getDepartName()); unBindDTO.setDepartmentName(departmentDTO.getName());
dtoList.add(unBindDTO); dtoList.add(unBindDTO);
} }
} }
for (StoreDTO storeDTO : storeList) {
DepartmentDTO dto = departmentApiService.selectByRelatedId(storeDTO.getStoreId());
if(dto == null) {
DepartmentDTO unBindDTO = new DepartmentDTO();
unBindDTO.setRelatedId(storeDTO.getStoreId());
unBindDTO.setIsStore(0);
unBindDTO.setDepartmentName(storeDTO.getStoreName());
dtoList.add(unBindDTO);
}
}
return resultResponse(HaoBanErrCode.ERR_1,dtoList); return resultResponse(HaoBanErrCode.ERR_1,dtoList);
} }
...@@ -236,7 +253,11 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -236,7 +253,11 @@ public class DepartmentContoller extends WebBaseController{
} }
/**
* 处理子节点
* @param sonDepartment
* @param parentId
*/
private void handler(String sonDepartment, String parentId) { private void handler(String sonDepartment, String parentId) {
if(StringUtils.isNotBlank(sonDepartment)) { if(StringUtils.isNotBlank(sonDepartment)) {
List<DepartmentAddQO> list = JSONArray.parseArray(sonDepartment, DepartmentAddQO.class); List<DepartmentAddQO> list = JSONArray.parseArray(sonDepartment, DepartmentAddQO.class);
...@@ -258,6 +279,7 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -258,6 +279,7 @@ public class DepartmentContoller extends WebBaseController{
department.setWxEnterpriseId(dto.getWxEnterpriseId()); department.setWxEnterpriseId(dto.getWxEnterpriseId());
department.setDepartmentName(departmentAddQO.getDepartmentName()); department.setDepartmentName(departmentAddQO.getDepartmentName());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId()); department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setChainName(dto.getChainName() + Constant.NAME_SEPARATOR + dto.getDepartmentName());
department.setIsStore(0); department.setIsStore(0);
department.setIsStore(departmentAddQO.getStoreFlag()); department.setIsStore(departmentAddQO.getStoreFlag());
department.setLevel(dto.getLevel() + 1); department.setLevel(dto.getLevel() + 1);
...@@ -278,6 +300,7 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -278,6 +300,7 @@ public class DepartmentContoller extends WebBaseController{
department.setParentDepartmentId(parentId); department.setParentDepartmentId(parentId);
department.setDepartmentName(departmentAddQO.getDepartmentName()); department.setDepartmentName(departmentAddQO.getDepartmentName());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId()); department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setChainName(dto.getChainName() + Constant.NAME_SEPARATOR + dto.getDepartmentName());
HaobanResponse hr = departmentApiService.edit(department); HaobanResponse hr = departmentApiService.edit(department);
if(hr.getErrorCode() != 1) { if(hr.getErrorCode() != 1) {
continue; continue;
...@@ -294,6 +317,34 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -294,6 +317,34 @@ public class DepartmentContoller extends WebBaseController{
} }
} }
//溢出门店列表
@RequestMapping("store-full-list")
public HaobanResponse storeFullList(BasePageInfo basePageInfo) {
LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser();
String wxEnterpriseId = login.getWxEnterpriseId();
int pageNum = basePageInfo.getPageNum();
int pageSize = basePageInfo.getPageSize();
Page<DepartmentDTO> page = new Page<>(pageNum, pageSize, 0);
//TODO 获取版本容量
int maxSize = 0;
List<DepartmentDTO> list = departmentApiService.listStoreByWxEnterpriseId(wxEnterpriseId);
if(list == null||list.size()==0){
return resultResponse(HaoBanErrCode.ERR_1,new Page<>());
}
page.setTotalCount(list.size());
if(maxSize != 0){
if(list.size() <= maxSize){
//小于版本容量(无溢出门店)
return resultResponse(HaoBanErrCode.ERR_1,new Page<>());
}else{
//大于版本容量(有溢出门店)
list = list.subList(maxSize,list.size()-1);
}
}
List resultList = ListUtils.Pager(pageSize, pageNum, list);
return resultResponse(HaoBanErrCode.ERR_1,resultList);
}
} }
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.gic.haoban.common.utils.AuthRequestUtil; import com.alibaba.fastjson.JSON;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.LoginVO; import com.gic.haoban.manage.web.vo.LoginVO;
@RestController @RestController
public class LoginController extends WebBaseController{ public class LoginController extends WebBaseController{
private static Logger logger= LoggerFactory.getLogger(LoginController.class);
@Autowired @Autowired
StaffApiService staffApiService; StaffApiService staffApiService;
...@@ -20,12 +26,27 @@ public class LoginController extends WebBaseController{ ...@@ -20,12 +26,27 @@ public class LoginController extends WebBaseController{
public HaobanResponse login() { public HaobanResponse login() {
LoginVO loginVO = new LoginVO(); LoginVO loginVO = new LoginVO();
StaffDTO staff = staffApiService.selectById("1"); StaffDTO staff = staffApiService.selectById("1");
logger.info("【好办登录】staff={}",JSON.toJSONString(staff));
loginVO.setWxEnterpriseId("1"); loginVO.setWxEnterpriseId("1");
loginVO.setStaffDTO(staff); loginVO.setStaffDTO(staff);
AuthRequestUtil.setSessionUser(loginVO); AuthRequestUtil.setSessionUser(loginVO);
return resultResponse(HaoBanErrCode.ERR_1, loginVO); return resultResponse(HaoBanErrCode.ERR_1, loginVO);
} }
//运维登录
@RequestMapping("yw-login")
public HaobanResponse login(String wxEnterpriseId) {
//TODO 获取超级管理员账号接口
StaffDTO staff = new StaffDTO();
LoginVO loginVO = new LoginVO();
loginVO.setWxEnterpriseId(wxEnterpriseId);
loginVO.setStaffDTO(staff);
AuthRequestUtil.setSessionUser(loginVO);
return resultResponse(HaoBanErrCode.ERR_1, loginVO);
}
@RequestMapping("login-out") @RequestMapping("login-out")
public HaobanResponse loginOut() { public HaobanResponse loginOut() {
......
package com.gic.haoban.manage.web.controller;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.LoginVO;
@RestController
public class StaffController extends WebBaseController{
@Autowired
private StaffApiService staffApiService;
@Autowired
private DepartmentApiService departmentApiService;
@RequestMapping("staff-add")
public HaobanResponse staffAdd(StaffDTO staffDTO,String departmentIds){
LoginVO login = (LoginVO) AuthRequestUtil.getAppLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
String staffName = staffDTO.getStaffName();
String phoneNumber = staffDTO.getPhoneNumber();
String nationcode = staffDTO.getNationCode();
if(StringUtils.isBlank(staffName)) {
return resultResponse(HaoBanErrCode.ERR_10004);
}
StaffDTO staff = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber);
if(staff != null) {
return resultResponse(HaoBanErrCode.ERR_10005);
}
HaobanResponse hr = staffApiService.add(staff,departmentIds);
return resultResponse(HaoBanErrCode.ERR_1);
}
@RequestMapping("staff-sel")
public HaobanResponse staffSel(String staffId,String staffDepartmentRelatedId){
StaffDTO staff = staffApiService.selectById(staffId);
List<StaffDepartmentRelatedDTO> list = staffApiService.listStaffDepartmentByStaffId(staffId);
List<DepartmentDTO> departmentList = new ArrayList<DepartmentDTO>();
for (StaffDepartmentRelatedDTO staffDepartmentRelatedDTO : list) {
DepartmentDTO dto = departmentApiService.selectById(staffDepartmentRelatedDTO.getDepartmentId());
departmentList.add(dto);
}
staff.setDepartmentList(departmentList);
return resultResponse(HaoBanErrCode.ERR_1,staff);
}
@RequestMapping("staff-list")
public HaobanResponse staffList(String departmentId,Integer activeFlag,String keyword,BasePageInfo pageInfo){
Page<StaffDTO> page = staffApiService.pageStaff(departmentId,activeFlag,keyword,pageInfo);
return resultResponse(HaoBanErrCode.ERR_1,page);
}
@RequestMapping("staff-del")
public HaobanResponse staffDel(String staffDepartmentStaffRelatedId){
staffApiService.del(staffDepartmentStaffRelatedId);
return resultResponse(HaoBanErrCode.ERR_1);
}
@RequestMapping("staff-batch-del")
public HaobanResponse staffBatchDel(String staffDepartmentStaffRelatedIds){
String[] staffArr = staffDepartmentStaffRelatedIds.split(",");
for (String string : staffArr) {
staffApiService.del(string);
}
return resultResponse(HaoBanErrCode.ERR_1);
}
@RequestMapping("staff-edit")
public HaobanResponse staffEdit(StaffDTO staffDTO,String departmentIds){
String staffId = staffDTO.getStaffId();
staffApiService.staffEdit(staffDTO,departmentIds);
return resultResponse(HaoBanErrCode.ERR_1);
}
}
...@@ -38,7 +38,10 @@ public class WxEnterpriseController extends WebBaseController{ ...@@ -38,7 +38,10 @@ public class WxEnterpriseController extends WebBaseController{
//微信企业绑定接口 //微信企业绑定接口
@RequestMapping("wx-enterprise-bind") @RequestMapping("wx-enterprise-bind")
public HaobanResponse wxEnterpriseBind(String enterpriseId,String wxEnterpriseId,String version) { public HaobanResponse wxEnterpriseBind(String enterpriseId,String wxEnterpriseId,String version) {
wxEnterpriseRelatedApiService.wxEnterpriseBind(enterpriseId,wxEnterpriseId,version); int i = wxEnterpriseRelatedApiService.wxEnterpriseBind(enterpriseId,wxEnterpriseId,version);
if(i==1){
return resultResponse(HaoBanErrCode.ERR_10006);
}
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
......
...@@ -64,6 +64,10 @@ public enum HaoBanErrCode { ...@@ -64,6 +64,10 @@ public enum HaoBanErrCode {
ERR_10001(10001,"父部门不存在"), ERR_10001(10001,"父部门不存在"),
ERR_10002(10002,"门店类型部门不能新增子节点"), ERR_10002(10002,"门店类型部门不能新增子节点"),
ERR_10003(10003,"部门不存在"), ERR_10003(10003,"部门不存在"),
ERR_10004(10004,"成员名称不能为空"),
ERR_10005(10005,"成员已存在"),
ERR_10006(10006,"该企业已经绑定过了"),
ERR_DEFINE(-888, "自定义错误"), ERR_DEFINE(-888, "自定义错误"),
ERR_OTHER(-999, "未知错误code"); ERR_OTHER(-999, "未知错误code");
......
...@@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.auth.api.anno.MenuCheck; import com.gic.haoban.auth.api.anno.MenuCheck;
import com.gic.haoban.auth.api.dto.UserRightDetailDTO; import com.gic.haoban.auth.api.dto.UserRightDetailDTO;
import com.gic.haoban.auth.api.enums.RoleCodeEnum; import com.gic.haoban.auth.api.enums.RoleCodeEnum;
import com.gic.haoban.common.utils.AuthRequestUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.LoginVO;
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;
...@@ -54,7 +56,7 @@ public class WebInterceptor extends HandlerInterceptorAdapter { ...@@ -54,7 +56,7 @@ public class WebInterceptor extends HandlerInterceptorAdapter {
logger.info("post-url:{}", requestURI); logger.info("post-url:{}", requestURI);
Map<String, String[]> parameterMap = httpServletRequest.getParameterMap(); Map<String, String[]> parameterMap = httpServletRequest.getParameterMap();
logger.info("post-params:{}", JSONObject.toJSONString(parameterMap)); logger.info("post-params:{}", JSONObject.toJSONString(parameterMap));
UserRightDetailDTO loginUser = (UserRightDetailDTO) AuthRequestUtil.getSessionUser(); LoginVO loginUser = (LoginVO) AuthRequestUtil.getSessionUser();
if (loginUser == null) { if (loginUser == null) {
this.errorResult(httpServletResponse, HaoBanErrCode.ERR_4); this.errorResult(httpServletResponse, HaoBanErrCode.ERR_4);
...@@ -69,31 +71,11 @@ public class WebInterceptor extends HandlerInterceptorAdapter { ...@@ -69,31 +71,11 @@ public class WebInterceptor extends HandlerInterceptorAdapter {
return true; return true;
} }
MenuCheck methodAnnotation = method.getMethodAnnotation(MenuCheck.class); MenuCheck methodAnnotation = method.getMethodAnnotation(MenuCheck.class);
if (StringUtils.isNotBlank(loginUser.getEnterpriseId())) { if (StringUtils.isNotBlank(loginUser.getWxEnterpriseId())) {
httpServletRequest.setAttribute("enterpriseId", loginUser.getEnterpriseId()); httpServletRequest.setAttribute("wxEnterpriseId", loginUser.getWxEnterpriseId());
}
if (StringUtils.isNotBlank(loginUser.getUserId())) {
httpServletRequest.setAttribute("clerkId", loginUser.getUserId());
} }
if (null != methodAnnotation) { if (loginUser.getStaffDTO() != null) {
String value = methodAnnotation.value(); httpServletRequest.setAttribute("staffDTO", loginUser.getStaffDTO());
RoleCodeEnum[] roleCodes = methodAnnotation.roleCodes();
boolean b = true;
//权限判断
if (StringUtils.isNotBlank(value)) {
b = loginUser.checkRight(value);
}
//角色判读
if (b) {
if (roleCodes.length > 0) {
b = Arrays.stream(roleCodes).anyMatch(codeEnum -> loginUser.checkRole(codeEnum.getCode()));
}
}
if (!b) {
logger.info("缺少权限");
errorResult(httpServletResponse, HaoBanErrCode.ERR_7);
}
return b;
} }
return true; return true;
} }
......
package com.gic.haoban.manage.web.utils;
import java.util.ArrayList;
import java.util.List;
/**
* list集合工具类
*/
public class ListUtils {
/**
*
* @param pageSize 当前页面大小
* @param pageIndex 当前页码
* @param list 需要分页的集合
* @return
*/
public static List Pager(int pageSize,int pageIndex,List list){
//使用list 中的sublist方法分页
List resultList = new ArrayList<>();
// 每页显示多少条记录
int currentPage; //当前第几页数据
int totalRecord = list.size(); // 一共多少条记录
int totalPage = totalRecord % pageSize; // 一共多少页
if (totalPage > 0) {
totalPage = totalRecord / pageSize + 1;
} else {
totalPage = totalRecord / pageSize;
}
System.out.println("总页数:" + totalPage);
// 当前第几页数据
currentPage = totalPage < pageIndex ? totalPage : pageIndex;
// 起始索引
int fromIndex = pageSize * (currentPage - 1);
// 结束索引
int toIndex = pageSize * currentPage > totalRecord ? totalRecord : pageSize * currentPage;
try{
resultList = list.subList(fromIndex, toIndex);
}catch(IndexOutOfBoundsException e){
e.printStackTrace();
}
return resultList;
}
}
...@@ -28,4 +28,11 @@ ...@@ -28,4 +28,11 @@
<dubbo:reference interface="com.gic.enterprise.api.service.StoreService" id="storeService"/> <dubbo:reference interface="com.gic.enterprise.api.service.StoreService" id="storeService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="departmentService"/> <dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="departmentService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.DepartmentApiService" id="departmentApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.DepartmentApiService" id="departmentApiService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.StoreGroupService" id="storeGroupService"/>
<dubbo:reference interface="com.gic.clerk.api.service.ClerkService" id="clerkService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService" id="staffDepartmentRelatedApiService"/>
</beans> </beans>
...@@ -113,6 +113,12 @@ ...@@ -113,6 +113,12 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>haoban-data-api</artifactId>
<version>${haoban-data-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-contacts-api</artifactId> <artifactId>haoban-contacts-api</artifactId>
<version>${haoban-contacts-api}</version> <version>${haoban-contacts-api}</version>
</dependency> </dependency>
......
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.collection.CollectionUtil;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.ApplicationDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.service.ApplicationApiService; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.ClerkVo;
@RestController @RestController
public class ClerkController extends WebBaseController{ public class ClerkController extends WebBaseController{
@Autowired @Autowired
private ApplicationApiService applicationApiService; private ClerkService clerkService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService;
//导购列表
@RequestMapping("/clerk-list") @RequestMapping("/clerk-list")
public HaobanResponse clerkList(String storeId,String bindFlag,String departmentId) { public HaobanResponse clerkList(String storeId,String bindFlag,String departmentId) {
List<StaffDepartmentRelatedDTO> list = staffDepartmentRelatedApiService.listByDepartmentId(departmentId);
List<ClerkVo> result = new ArrayList<ClerkVo>();
// if(CollectionUtil.isNotEmpty(list)){
// if("1".equals(bindFlag)){
// List<StaffDepartmentRelatedDTO> bindList = list.stream().filter(s->s.getClerkCode() != null).collect(Collectors.toList());
// if(CollectionUtil.isNotEmpty(bindList)){
// result = EntityUtil.changeEntityListByJSON(ClerkVo.class, bindList);
// }
// }else{
//
// List<StaffDepartmentRelatedDTO> unBindList = list.stream().filter(s->s.getClerkCode() == null).collect(Collectors.toList());
// if(CollectionUtil.isNotEmpty(unBindList)){
// result = EntityUtil.changeEntityListByJSON(ClerkVo.class, unBindList);
// }
// }
// }
// return resultResponse(HaoBanErrCode.ERR_1,result);
//绑定的clerk
if("1".equals(bindFlag)){
// 调陶接口获取详情数据
if(CollectionUtil.isNotEmpty(list)){
List<String> clerkCodes = list.stream().filter(s->s.getClerkCode()!=null).map(s->s.getClerkCode()).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(clerkCodes)){
List<ClerkDTO> clerkList = clerkService.listClerk(storeId, clerkCodes, true);
result = EntityUtil.changeEntityListByJSON(ClerkVo.class, clerkList);
}
}
}else{
//未绑定的clerk
// 调陶接口获取详情数据
if(CollectionUtil.isNotEmpty(list)){
List<String> clerkCodes = list.stream().filter(s->s.getClerkCode()!=null).map(s->s.getClerkCode()).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(clerkCodes)){
List<ClerkDTO> clerkList = clerkService.listClerk(storeId, clerkCodes, false);
result = EntityUtil.changeEntityListByJSON(ClerkVo.class, clerkList);
}
}else{
//检查下是否会报错
List<ClerkDTO> clerkList = clerkService.listClerk(storeId, new ArrayList<>(), false);
result = EntityUtil.changeEntityListByJSON(ClerkVo.class, clerkList);
}
}
return resultResponse(HaoBanErrCode.ERR_1,result);
}
//选择成员列表
@RequestMapping("/staff-list")
return resultResponse(HaoBanErrCode.ERR_1,list); public HaobanResponse staffList(String departmentId) {
List<StaffDepartmentRelatedDTO> list = staffDepartmentRelatedApiService.listByDepartmentId(departmentId);
List<String> staffIds = list.stream().map(s->s.getStaffId()).collect(Collectors.toList());
List<StaffDTO> resultlist= staffApiService.listByIds(staffIds);
return resultResponse(HaoBanErrCode.ERR_1,resultlist);
} }
//成员绑定
@RequestMapping("/staff-bind")
public HaobanResponse staffBind(String clerkCode,String staffDepartmentRelatedId) {
StaffDepartmentRelatedDTO dto = new StaffDepartmentRelatedDTO();
dto.setStaffDepartmentRelatedId(staffDepartmentRelatedId);
dto.setClerkCode(clerkCode);
dto.setUpdateTime(new Date());
staffDepartmentRelatedApiService.updateById(dto);
return resultResponse(HaoBanErrCode.ERR_1);
}
//成员换绑定
@RequestMapping("/clerk-unbind")
public HaobanResponse clerkUnbind(String clerkCode,String staffDepartmentRelatedId) {
StaffDepartmentRelatedDTO one = staffDepartmentRelatedApiService.getOneByClerkCode(clerkCode);
if(one != null){
//存在,则先置空
one.setClerkCode(null);
one.setUpdateTime(new Date());
staffDepartmentRelatedApiService.deleteCode(one);
}
//不存在,则更新
StaffDepartmentRelatedDTO dto = new StaffDepartmentRelatedDTO();
dto.setStaffDepartmentRelatedId(staffDepartmentRelatedId);
dto.setClerkCode(clerkCode);
dto.setUpdateTime(new Date());
staffDepartmentRelatedApiService.updateById(dto);
return resultResponse(HaoBanErrCode.ERR_1);
}
//店长转让
@RequestMapping("/clerk-manager-tranfer")
public HaobanResponse clerkManagerTranfer(String clerkCode,String storeId,String staffDepartmentRelatedId) {
StaffDepartmentRelatedDTO one = staffDepartmentRelatedApiService.getOneByClerkCode(clerkCode);
if(one != null){
//存在,则先置空
one.setClerkCode(null);
one.setUpdateTime(new Date());
staffDepartmentRelatedApiService.deleteCode(one);
}
//不存在,则更新
StaffDepartmentRelatedDTO dto = new StaffDepartmentRelatedDTO();
dto.setStaffDepartmentRelatedId(staffDepartmentRelatedId);
dto.setClerkCode(clerkCode);
dto.setUpdateTime(new Date());
staffDepartmentRelatedApiService.updateById(dto);
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