Commit eb3fec3a by qwmqiuwenmin

fix

parent 373d979c
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
public class ClerkMainStoreRelatedDTO implements Serializable{
private String clerkMainStoreRelatedId;
private String staffId;
private String wxEnterpriseId;
private String storeId;
private Integer mainStoreFlag;
private Integer statusFlag;
private Date createTime;
private Date updateTime;
private static final long serialVersionUID = 1L;
public String getClerkMainStoreRelatedId() {
return clerkMainStoreRelatedId;
}
public void setClerkMainStoreRelatedId(String clerkMainStoreRelatedId) {
this.clerkMainStoreRelatedId = clerkMainStoreRelatedId == null ? null : clerkMainStoreRelatedId.trim();
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId == null ? null : storeId.trim();
}
public Integer getMainStoreFlag() {
return mainStoreFlag;
}
public void setMainStoreFlag(Integer mainStoreFlag) {
this.mainStoreFlag = mainStoreFlag;
}
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.service;
import com.gic.haoban.manage.api.dto.ClerkMainStoreRelatedDTO;
public interface ClerkMainStoreRelatedApiService {
void setMainStore(String staffId, String storeId, String wxEnterpriseId);
ClerkMainStoreRelatedDTO getWxEnterpriseIdAndStaffId(String wxEnterpriseId, String staffId);
}
package com.gic.haoban.manage.service.dao.mapper; package com.gic.haoban.manage.service.dao.mapper;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated; import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
public interface TabHaobanClerkMainStoreRelatedMapper { public interface TabHaobanClerkMainStoreRelatedMapper {
...@@ -14,4 +16,6 @@ public interface TabHaobanClerkMainStoreRelatedMapper { ...@@ -14,4 +16,6 @@ public interface TabHaobanClerkMainStoreRelatedMapper {
int updateByPrimaryKeySelective(TabHaobanClerkMainStoreRelated record); int updateByPrimaryKeySelective(TabHaobanClerkMainStoreRelated record);
int updateByPrimaryKey(TabHaobanClerkMainStoreRelated record); int updateByPrimaryKey(TabHaobanClerkMainStoreRelated record);
TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(@Param("staffId")String staffId, @Param("wxEnterpriseId")String wxEnterpriseId);
} }
\ No newline at end of file
...@@ -6,9 +6,9 @@ import java.util.Date; ...@@ -6,9 +6,9 @@ import java.util.Date;
public class TabHaobanClerkMainStoreRelated implements Serializable { public class TabHaobanClerkMainStoreRelated implements Serializable {
private String clerkMainStoreRelatedId; private String clerkMainStoreRelatedId;
private String clerkId; private String staffId;
private String enterpriseId; private String wxEnterpriseId;
private String storeId; private String storeId;
...@@ -30,23 +30,24 @@ public class TabHaobanClerkMainStoreRelated implements Serializable { ...@@ -30,23 +30,24 @@ public class TabHaobanClerkMainStoreRelated implements Serializable {
this.clerkMainStoreRelatedId = clerkMainStoreRelatedId == null ? null : clerkMainStoreRelatedId.trim(); this.clerkMainStoreRelatedId = clerkMainStoreRelatedId == null ? null : clerkMainStoreRelatedId.trim();
} }
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) { public String getStaffId() {
this.clerkId = clerkId == null ? null : clerkId.trim(); return staffId;
} }
public String getEnterpriseId() { public void setStaffId(String staffId) {
return enterpriseId; this.staffId = staffId;
} }
public void setEnterpriseId(String enterpriseId) { public String getWxEnterpriseId() {
this.enterpriseId = enterpriseId == null ? null : enterpriseId.trim(); return wxEnterpriseId;
} }
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getStoreId() { public String getStoreId() {
return storeId; return storeId;
} }
......
package com.gic.haoban.manage.service.service;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
public interface ClerkMainStoreRelatedService {
void setMainStore(String staffId, String storeId, String wxEnterpriseId);
TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(String staffId, String wxEnterpriseId);
void update(TabHaobanClerkMainStoreRelated r);
}
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.haoban.manage.service.dao.mapper.TabHaobanClerkMainStoreRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
@Service
public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedService {
@Autowired
private TabHaobanClerkMainStoreRelatedMapper mapper;
@Override
public void setMainStore(String staffId, String storeId, String wxEnterpriseId) {
String uuId = com.gic.haoban.common.utils.StringUtil.randomUUID();
Date now = new Date();
TabHaobanClerkMainStoreRelated t = new TabHaobanClerkMainStoreRelated();
t.setStaffId(staffId);
t.setWxEnterpriseId(wxEnterpriseId);
t.setStoreId(storeId);
t.setCreateTime(now);
t.setUpdateTime(now);
t.setStatusFlag(1);
t.setClerkMainStoreRelatedId(uuId);
mapper.insert(t);
}
@Override
public TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(String staffId, String wxEnterpriseId) {
return mapper.selectByWxEnterpriseIdAndStoreId(staffId,wxEnterpriseId);
}
@Override
public void update(TabHaobanClerkMainStoreRelated r) {
r.setUpdateTime(new Date());
mapper.updateByPrimaryKeySelective(r);
}
}
package com.gic.haoban.manage.service.service.out.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.dto.ClerkMainStoreRelatedDTO;
import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
@Service
public class ClerkMainStoreRelatedApiServiceImpl implements ClerkMainStoreRelatedApiService {
@Autowired
ClerkMainStoreRelatedService clerkMainStoreRelatedService;
@Override
public void setMainStore(String staffId, String storeId, String wxEnterpriseId) {
TabHaobanClerkMainStoreRelated r = clerkMainStoreRelatedService.selectByWxEnterpriseIdAndStoreId(staffId,wxEnterpriseId);
if(r != null){
r.setStoreId(storeId);
clerkMainStoreRelatedService.update(r);
}else{
clerkMainStoreRelatedService.setMainStore(staffId, storeId, wxEnterpriseId);
}
}
@Override
public ClerkMainStoreRelatedDTO getWxEnterpriseIdAndStaffId(String wxEnterpriseId, String staffId) {
return EntityUtil.changeEntityByJSON(ClerkMainStoreRelatedDTO.class, clerkMainStoreRelatedService.selectByWxEnterpriseIdAndStoreId(staffId,wxEnterpriseId));
}
}
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.TabHaobanClerkMainStoreRelatedMapper" > <mapper namespace="com.gic.haoban.manage.service.dao.mapper.TabHaobanClerkMainStoreRelatedMapper" >
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" > <resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
<id column="clerk_main_store_related_id" property="clerkMainStoreRelatedId" jdbcType="VARCHAR" /> <id column="clerk_main_store_related_id" property="clerkMainStoreRelatedId" jdbcType="VARCHAR" />
<result column="clerk_id" property="clerkId" jdbcType="VARCHAR" /> <result column="staff_id" property="staffId" jdbcType="VARCHAR" />
<result column="enterprise_id" property="enterpriseId" jdbcType="VARCHAR" /> <result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" />
<result column="store_id" property="storeId" jdbcType="VARCHAR" /> <result column="store_id" property="storeId" jdbcType="VARCHAR" />
<result column="main_store_flag" property="mainStoreFlag" jdbcType="INTEGER" /> <result column="main_store_flag" property="mainStoreFlag" jdbcType="INTEGER" />
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" /> <result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
clerk_main_store_related_id, clerk_id, enterprise_id, store_id, main_store_flag, clerk_main_store_related_id, staff_id, wx_enterprise_id, store_id, main_store_flag,
status_flag, create_time, update_time status_flag, create_time, update_time
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR} where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</delete> </delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" > <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
insert into tab_haoban_clerk_main_store_related (clerk_main_store_related_id, clerk_id, insert into tab_haoban_clerk_main_store_related (clerk_main_store_related_id, staff_id,
enterprise_id, store_id, main_store_flag, wx_enterprise_id, store_id, main_store_flag,
status_flag, create_time, update_time status_flag, create_time, update_time
) )
values (#{clerkMainStoreRelatedId,jdbcType=VARCHAR}, #{clerkId,jdbcType=VARCHAR}, values (#{clerkMainStoreRelatedId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR},
#{enterpriseId,jdbcType=VARCHAR}, #{storeId,jdbcType=VARCHAR}, #{mainStoreFlag,jdbcType=INTEGER}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{storeId,jdbcType=VARCHAR}, #{mainStoreFlag,jdbcType=INTEGER},
#{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
) )
</insert> </insert>
...@@ -41,11 +41,11 @@ ...@@ -41,11 +41,11 @@
<if test="clerkMainStoreRelatedId != null" > <if test="clerkMainStoreRelatedId != null" >
clerk_main_store_related_id, clerk_main_store_related_id,
</if> </if>
<if test="clerkId != null" > <if test="staffId != null" >
clerk_id, staff_id,
</if> </if>
<if test="enterpriseId != null" > <if test="wxEnterpriseId != null" >
enterprise_id, wx_enterprise_id,
</if> </if>
<if test="storeId != null" > <if test="storeId != null" >
store_id, store_id,
...@@ -67,11 +67,11 @@ ...@@ -67,11 +67,11 @@
<if test="clerkMainStoreRelatedId != null" > <if test="clerkMainStoreRelatedId != null" >
#{clerkMainStoreRelatedId,jdbcType=VARCHAR}, #{clerkMainStoreRelatedId,jdbcType=VARCHAR},
</if> </if>
<if test="clerkId != null" > <if test="staffId != null" >
#{clerkId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR},
</if> </if>
<if test="enterpriseId != null" > <if test="wxEnterpriseId != null" >
#{enterpriseId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
</if> </if>
<if test="storeId != null" > <if test="storeId != null" >
#{storeId,jdbcType=VARCHAR}, #{storeId,jdbcType=VARCHAR},
...@@ -93,11 +93,11 @@ ...@@ -93,11 +93,11 @@
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" > <update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
update tab_haoban_clerk_main_store_related update tab_haoban_clerk_main_store_related
<set > <set >
<if test="clerkId != null" > <if test="staffId != null" >
clerk_id = #{clerkId,jdbcType=VARCHAR}, staff_id = #{staffId,jdbcType=VARCHAR},
</if> </if>
<if test="enterpriseId != null" > <if test="wxEnterpriseId != null" >
enterprise_id = #{enterpriseId,jdbcType=VARCHAR}, wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if> </if>
<if test="storeId != null" > <if test="storeId != null" >
store_id = #{storeId,jdbcType=VARCHAR}, store_id = #{storeId,jdbcType=VARCHAR},
...@@ -119,8 +119,8 @@ ...@@ -119,8 +119,8 @@
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" > <update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
update tab_haoban_clerk_main_store_related update tab_haoban_clerk_main_store_related
set clerk_id = #{clerkId,jdbcType=VARCHAR}, set staff_id = #{staffId,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=VARCHAR}, wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
store_id = #{storeId,jdbcType=VARCHAR}, store_id = #{storeId,jdbcType=VARCHAR},
main_store_flag = #{mainStoreFlag,jdbcType=INTEGER}, main_store_flag = #{mainStoreFlag,jdbcType=INTEGER},
status_flag = #{statusFlag,jdbcType=INTEGER}, status_flag = #{statusFlag,jdbcType=INTEGER},
...@@ -128,4 +128,14 @@ ...@@ -128,4 +128,14 @@
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR} where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</update> </update>
<select id="selectByWxEnterpriseIdAndStoreId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_clerk_main_store_related
where staff_id = #{staffId,jdbcType=VARCHAR}
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
limit 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -220,6 +220,12 @@ ...@@ -220,6 +220,12 @@
<artifactId>gic-quartz-api</artifactId> <artifactId>gic-quartz-api</artifactId>
<version>${gic-quartz-api}</version> <version>${gic-quartz-api}</version>
</dependency> </dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-app-customer-api</artifactId>
<version>${haoban-app-customer-api}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -19,14 +19,19 @@ import com.alibaba.csp.sentinel.util.StringUtil; ...@@ -19,14 +19,19 @@ import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.StoreDTO; import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.app.customer.service.api.service.DistributeApiService;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi;
import com.gic.haoban.manage.api.dto.DepartmentDTO; 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.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.service.BindApiService; import com.gic.haoban.manage.api.service.BindApiService;
import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService; import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
...@@ -35,6 +40,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode; ...@@ -35,6 +40,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.interceptor.WebInterceptor; import com.gic.haoban.manage.web.interceptor.WebInterceptor;
import com.gic.haoban.manage.web.vo.ClerkVo; import com.gic.haoban.manage.web.vo.ClerkVo;
import com.gic.haoban.manage.web.vo.StoreVO; import com.gic.haoban.manage.web.vo.StoreVO;
import com.gic.redis.data.util.RedisUtil;
@RestController @RestController
public class ClerkController extends WebBaseController{ public class ClerkController extends WebBaseController{
...@@ -52,6 +58,12 @@ public class ClerkController extends WebBaseController{ ...@@ -52,6 +58,12 @@ public class ClerkController extends WebBaseController{
private DepartmentApiService departmentApiService; private DepartmentApiService departmentApiService;
@Autowired @Autowired
private BindApiService bindApiService; private BindApiService bindApiService;
@Autowired
private SyncHaobanToGicServiceApi syncHaobanToGicServiceApi;
@Autowired
private ClerkMainStoreRelatedApiService clerkMainStoreRelatedApiService;
@Autowired
private DistributeApiService distributeApiService;
//导购列表 //导购列表
@RequestMapping("/clerk-list") @RequestMapping("/clerk-list")
...@@ -212,4 +224,87 @@ public class ClerkController extends WebBaseController{ ...@@ -212,4 +224,87 @@ public class ClerkController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
//新增店员
@RequestMapping("/satff-add")
public HaobanResponse staffAdd(StaffDTO staffDTO,String storeId,String clerkCode) {
String wxEnterpriseId = staffDTO.getWxEnterpriseId();
String staffName = staffDTO.getStaffName();
String phoneNumber = staffDTO.getPhoneNumber();
String nationcode = staffDTO.getNationCode();
String postion = staffDTO.getPostion();
Integer sex = staffDTO.getSex();
staffDTO.setWxEnterpriseId(wxEnterpriseId);
if(StringUtils.isBlank(staffName)) {
return resultResponse(HaoBanErrCode.ERR_10004);
}
StaffDTO staff = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber);
if(staff != null) {
return resultResponse(HaoBanErrCode.ERR_10005);
}
syncHaobanToGicServiceApi.syncClerkToGicClerkAdd(storeId, clerkCode, sex, staffName, phoneNumber, nationcode, postion);
return resultResponse(HaoBanErrCode.ERR_1);
}
//删除店员
@RequestMapping("/staff-del")
public HaobanResponse staffDel(String staffDepartmentRelatedId,String storeId) {
DepartmentDTO departmentDTO = departmentApiService.selectByRelatedId(storeId);
if(departmentDTO == null){
return resultResponse(HaoBanErrCode.ERR_10006);
}
StaffDepartmentRelatedDTO related = staffDepartmentRelatedApiService.getByStaffDepartmentRelatedId(staffDepartmentRelatedId);
if(related == null){
return resultResponse(HaoBanErrCode.ERR_10006);
}
if(StringUtils.isBlank(related.getClerkCode())){
staffApiService.del(staffDepartmentRelatedId);
}else{
ClerkDTO clerk = clerkService.getClerkByClerkCode(departmentDTO.getEnterpriseId(), related.getClerkCode());
if(clerk != null && distributeApiService.getClerkMemberCount(departmentDTO.getEnterpriseId(), clerk.getClerkId(), storeId) == 0){
syncHaobanToGicServiceApi.delGicClerk(clerk.getClerkId());
}
}
return resultResponse(HaoBanErrCode.ERR_1);
}
//设置主导购
@RequestMapping("/set-main-store")
public HaobanResponse setMainStore(String staffId,String storeId,String wxEnterpriseId,String staffDepartmentRelatedId) {
StaffDTO staff = staffApiService.selectById(staffId);
String yyyyMM = DateUtil.dateToStr(new Date(), "yyyyMM");
if(staff == null){
return resultResponse(HaoBanErrCode.ERR_10006);
}
String key = "haoban_set_main_store_" + yyyyMM + staffId;
Object hasSet = RedisUtil.getCache(key);
if(hasSet == null){
RedisUtil.setCache(key,true,31 * 24 * 60 * 60l);
clerkMainStoreRelatedApiService.setMainStore(staffId,storeId,wxEnterpriseId);
}else{
return resultResponse(HaoBanErrCode.ERR_10007);
}
return resultResponse(HaoBanErrCode.ERR_1);
}
//刷新微信好友
@RequestMapping("/fresh-wx-friend")
public HaobanResponse freshWxFrend(String staffId,String storeId,String wxEnterpriseId,String staffDepartmentRelatedId,String wxUserId) {
StaffDTO staff = staffApiService.selectById(staffId);
String yyyyMM = DateUtil.dateToStr(new Date(), "yyyyMM");
if(staff == null){
return resultResponse(HaoBanErrCode.ERR_10006);
}
String key = "haoban_set_main_store_" + yyyyMM + staffId;
Object hasSet = RedisUtil.getCache(key);
if(hasSet == null){
RedisUtil.setCache(key,true,31 * 24 * 60 * 60l);
clerkMainStoreRelatedApiService.setMainStore(staffId,storeId,wxEnterpriseId);
}else{
return resultResponse(HaoBanErrCode.ERR_10007);
}
return resultResponse(HaoBanErrCode.ERR_1);
}
} }
...@@ -36,12 +36,14 @@ import com.gic.haoban.data.api.dto.HaobanDataDTO; ...@@ -36,12 +36,14 @@ import com.gic.haoban.data.api.dto.HaobanDataDTO;
import com.gic.haoban.data.api.service.HaobanDataApiService; import com.gic.haoban.data.api.service.HaobanDataApiService;
import com.gic.haoban.manage.api.dto.AuditDTO; import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.AuditSettingDTO; import com.gic.haoban.manage.api.dto.AuditSettingDTO;
import com.gic.haoban.manage.api.dto.ClerkMainStoreRelatedDTO;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO; import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.enums.StoreFieldEnum; import com.gic.haoban.manage.api.enums.StoreFieldEnum;
import com.gic.haoban.manage.api.service.AuditApiService; import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.AuditSettingApiService; import com.gic.haoban.manage.api.service.AuditSettingApiService;
import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService; import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
...@@ -73,6 +75,8 @@ public class StoreController extends WebBaseController{ ...@@ -73,6 +75,8 @@ public class StoreController extends WebBaseController{
private AuditApiService auditApiService; private AuditApiService auditApiService;
@Autowired @Autowired
private AuditSettingApiService auditSettingApiService; private AuditSettingApiService auditSettingApiService;
@Autowired
private ClerkMainStoreRelatedApiService clerkMainStoreRelatedApiService;
//门店列表 //门店列表
@RequestMapping("/store-list") @RequestMapping("/store-list")
public HaobanResponse storeList(String staffId,String wxEnterpriseId) { public HaobanResponse storeList(String staffId,String wxEnterpriseId) {
...@@ -121,6 +125,8 @@ public class StoreController extends WebBaseController{ ...@@ -121,6 +125,8 @@ public class StoreController extends WebBaseController{
} }
} }
} }
ClerkMainStoreRelatedDTO mainStore = clerkMainStoreRelatedApiService.getWxEnterpriseIdAndStaffId(wxEnterpriseId,staffId);
//3、判断是否是店长 //3、判断是否是店长
for(StoreVO VO : resultList){ for(StoreVO VO : resultList){
//查gic门店 //查gic门店
...@@ -149,6 +155,12 @@ public class StoreController extends WebBaseController{ ...@@ -149,6 +155,12 @@ public class StoreController extends WebBaseController{
if(CollectionUtil.isNotEmpty(imgList)){ if(CollectionUtil.isNotEmpty(imgList)){
VO.setStoreImg(imgList.get(0).getQcloudImageUrl());; VO.setStoreImg(imgList.get(0).getQcloudImageUrl());;
} }
if(mainStore != null && mainStore.getStoreId().equals(VO.getStoreId())){
VO.setMainStoreFlag(1);
}else{
VO.setMainStoreFlag(0);
}
} }
if(CollectionUtils.isNotEmpty(resultList)){ if(CollectionUtils.isNotEmpty(resultList)){
Map<Integer,StoreVO> map = com.gic.commons.util.CollectionUtil.toMap(resultList, "clerkType"); Map<Integer,StoreVO> map = com.gic.commons.util.CollectionUtil.toMap(resultList, "clerkType");
...@@ -312,6 +324,13 @@ public class StoreController extends WebBaseController{ ...@@ -312,6 +324,13 @@ public class StoreController extends WebBaseController{
if(vo.getStoreArea() == null||vo.getStoreArea()==-1 ){ if(vo.getStoreArea() == null||vo.getStoreArea()==-1 ){
vo.setStoreArea(-1d); vo.setStoreArea(-1d);
} }
ClerkMainStoreRelatedDTO mainStore = clerkMainStoreRelatedApiService.getWxEnterpriseIdAndStaffId(staffDepartmentRelatedDTO.getWxEnterpriseId(),staffDepartmentRelatedDTO.getStaffId());
if(mainStore != null && mainStore.getStoreId().equals(storeId)){
vo.setMainStoreFlag(1);
}else{
vo.setMainStoreFlag(0);
}
return resultResponse(HaoBanErrCode.ERR_1,vo); return resultResponse(HaoBanErrCode.ERR_1,vo);
} }
......
...@@ -35,6 +35,14 @@ public class WebBaseController { ...@@ -35,6 +35,14 @@ public class WebBaseController {
public HaobanResponse resultResponse(HaoBanErrCode errCode) { public HaobanResponse resultResponse(HaoBanErrCode errCode) {
return resultResponse(errCode, null, null); return resultResponse(errCode, null, null);
} }
public HaobanResponse resultResponse(HaoBanErrCode errCode, String message,Object data,String detailError) {
HaobanResponse response = new HaobanResponse();
response.setMessage(message);
response.setDetailError(detailError);
response.setErrorCode(errCode.getCode());
return response;
}
/** /**
* 获取登陆信息 * 获取登陆信息
......
...@@ -185,6 +185,11 @@ public enum HaoBanErrCode { ...@@ -185,6 +185,11 @@ public enum HaoBanErrCode {
ERR_500001(500001, "该企业没关联好办"), ERR_500001(500001, "该企业没关联好办"),
ERR_600001(600001, "成员不存在,请联系管理员后台授权通讯录权限"), ERR_600001(600001, "成员不存在,请联系管理员后台授权通讯录权限"),
ERR_600002(600002, "无手机号"), ERR_600002(600002, "无手机号"),
ERR_10004(10004,"成员名称不能为空"),
ERR_10005(10005,"成员已存在"),
ERR_10006(10006,"成员不存在"),
ERR_10007(10007,"本月已经设置过主导购"),
ERR_DEFINE(-888, "自定义错误"), ERR_DEFINE(-888, "自定义错误"),
......
...@@ -42,6 +42,8 @@ public class StoreDetailVO implements Serializable { ...@@ -42,6 +42,8 @@ public class StoreDetailVO implements Serializable {
private Object auditDetail; private Object auditDetail;
private Integer auditFlag = 0; private Integer auditFlag = 0;
private Integer MainStoreFlag;
public Integer getAuditFlag() { public Integer getAuditFlag() {
return auditFlag; return auditFlag;
...@@ -230,4 +232,14 @@ public class StoreDetailVO implements Serializable { ...@@ -230,4 +232,14 @@ public class StoreDetailVO implements Serializable {
this.storeArea = storeArea; this.storeArea = storeArea;
} }
public Integer getMainStoreFlag() {
return MainStoreFlag;
}
public void setMainStoreFlag(Integer mainStoreFlag) {
MainStoreFlag = mainStoreFlag;
}
} }
...@@ -24,6 +24,7 @@ public class StoreVO implements Serializable { ...@@ -24,6 +24,7 @@ public class StoreVO implements Serializable {
private int clerkType; private int clerkType;
private String wxEnterpriseRelatedId; private String wxEnterpriseRelatedId;
private Date createTime; private Date createTime;
private Integer mainStoreFlag;
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
...@@ -110,6 +111,12 @@ public class StoreVO implements Serializable { ...@@ -110,6 +111,12 @@ public class StoreVO implements Serializable {
public void setWxEnterpriseRelatedId(String wxEnterpriseRelatedId) { public void setWxEnterpriseRelatedId(String wxEnterpriseRelatedId) {
this.wxEnterpriseRelatedId = wxEnterpriseRelatedId; this.wxEnterpriseRelatedId = wxEnterpriseRelatedId;
} }
public Integer getMainStoreFlag() {
return mainStoreFlag;
}
public void setMainStoreFlag(Integer mainStoreFlag) {
this.mainStoreFlag = mainStoreFlag;
}
} }
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
<dubbo:reference interface="com.gic.haoban.manage.api.service.ApplicationSettingApiService" id="applicationSettingApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.ApplicationSettingApiService" id="applicationSettingApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService" id="memberUnionidRelatedApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService" id="memberUnionidRelatedApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService" id="clerkMainStoreRelatedApiService"/>
<dubbo:reference interface="com.gic.haoban.app.customer.service.api.service.DistributeApiService" id="distributeApiService"/>
<dubbo:reference interface="com.gic.haoban.communicate.api.service.valid.ValidationCodeService" id="validationCodeService"/> <dubbo:reference interface="com.gic.haoban.communicate.api.service.valid.ValidationCodeService" id="validationCodeService"/>
......
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