Commit 5a172c6a by fudahua

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

parents c92ee089 140f9e2f
......@@ -56,6 +56,12 @@
<artifactId>java-jwt</artifactId>
<version>${jwt.version}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-commons</artifactId>
<version>3.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
......
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* @author mozhu
* @date 2021/12/16 19:50
*/
public class StaffPrivacyUseLogDTO implements Serializable {
private static final long serialVersionUID = -9137221776834569940L;
/**
* id
*/
private Long id;
/**
* 员工id
*/
private String staffId;
/**
* 微信企业id
*/
private String wxEnterpriseId;
/**
* 是否同意隐私协议,1:是;0:否
*/
private Integer privacyUseFlag;
/**
* 手机号
*/
private String phoneNumber;
/**
* 好办版本
*/
private String welldoneVersion;
/**
* 企微版本
*/
private String weworkVersion;
/**
* 用户手机品牌
*/
private String staffPhoneBrand;
/**
* 用户手机型号
*/
private String staffPhoneModel;
/**
* 用户手机版本
*/
private String staffPhoneVersion;
/**
* 登录ip
*/
private String staffIp;
/**
* create_time
*/
private Date createTime;
/**
* update_time
*/
private Date updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
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 Integer getPrivacyUseFlag() {
return privacyUseFlag;
}
public void setPrivacyUseFlag(Integer privacyUseFlag) {
this.privacyUseFlag = privacyUseFlag;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getWelldoneVersion() {
return welldoneVersion;
}
public void setWelldoneVersion(String welldoneVersion) {
this.welldoneVersion = welldoneVersion;
}
public String getWeworkVersion() {
return weworkVersion;
}
public void setWeworkVersion(String weworkVersion) {
this.weworkVersion = weworkVersion;
}
public String getStaffPhoneBrand() {
return staffPhoneBrand;
}
public void setStaffPhoneBrand(String staffPhoneBrand) {
this.staffPhoneBrand = staffPhoneBrand;
}
public String getStaffPhoneModel() {
return staffPhoneModel;
}
public void setStaffPhoneModel(String staffPhoneModel) {
this.staffPhoneModel = staffPhoneModel;
}
public String getStaffPhoneVersion() {
return staffPhoneVersion;
}
public void setStaffPhoneVersion(String staffPhoneVersion) {
this.staffPhoneVersion = staffPhoneVersion;
}
public String getStaffIp() {
return staffIp;
}
public void setStaffIp(String staffIp) {
this.staffIp = staffIp;
}
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;
}
}
......@@ -35,6 +35,11 @@ public class WelcomeDTO implements Serializable {
private String welcomeContent;
/**
* 图片
*/
private String welcomeImg;
/**
* 0删除 1正常
*/
private Integer openFlag;
......@@ -116,4 +121,12 @@ public class WelcomeDTO implements Serializable {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getWelcomeImg() {
return welcomeImg;
}
public void setWelcomeImg(String welcomeImg) {
this.welcomeImg = welcomeImg;
}
}
\ No newline at end of file
......@@ -59,6 +59,10 @@ public class PendingTaskDetailDTO implements Serializable {
*/
private Integer statusFlag;
private Integer finishFlag;
private Integer overdueFlag;
/**
* 创建时间
*/
......@@ -69,6 +73,22 @@ public class PendingTaskDetailDTO implements Serializable {
*/
private static final long serialVersionUID = 1L;
public Integer getFinishFlag() {
return finishFlag;
}
public void setFinishFlag(Integer finishFlag) {
this.finishFlag = finishFlag;
}
public Integer getOverdueFlag() {
return overdueFlag;
}
public void setOverdueFlag(Integer overdueFlag) {
this.overdueFlag = overdueFlag;
}
public String getEnterpriseId() {
return enterpriseId;
}
......
package com.gic.haoban.manage.api.dto.notify.qdto;
import java.io.Serializable;
import java.util.Map;
/**
* Created 2021/12/17.
*
* @author hua
*/
public class NoticeMessageQDTO implements Serializable {
private String enterpriseId;
private String clerkId;
private String storeId;
private int messageType;
private String templateCode;
private Map<String, String> contentMap;
/**
* 拓展内容
*/
private Map<String, Object> extendContent;
public Map<String, Object> getExtendContent() {
return extendContent;
}
public void setExtendContent(Map<String, Object> extendContent) {
this.extendContent = extendContent;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public int getMessageType() {
return messageType;
}
public void setMessageType(int messageType) {
this.messageType = messageType;
}
public String getTemplateCode() {
return templateCode;
}
public void setTemplateCode(String templateCode) {
this.templateCode = templateCode;
}
public Map<String, String> getContentMap() {
return contentMap;
}
public void setContentMap(Map<String, String> contentMap) {
this.contentMap = contentMap;
}
}
package com.gic.haoban.manage.api.enums;
/**
* Created 2021/12/17.
*
* @author hua
*/
public enum NoticeMessageCategoryTypeEnum {
ALL(-1, "全部"),
CUSTOMER(0, "客户相关"),
TASK(1, "任务相关"),
ACTIVITY(2, "活动相关"),
OTHER(3, "其它"),;
private int type;
private String name;
NoticeMessageCategoryTypeEnum(int type, String name) {
this.type = type;
this.name = name;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.gic.haoban.manage.api.enums;
/**
* Created by hua on 2021/12/17.
*/
public enum NoticeMessageTypeEnum {
ACTIVITY_START(1001, "活动开始通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType()),
ACTIVITY_NEW(1002, "活动上新通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType()),
ACTIVITY_DEL(1003, "活动删除通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType()),
ACTIVITY_OFFLINE(1004, "活动下线通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType()),
ACTIVITY_END(1005, "活动结束通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType()),
ACTIVITY_RANK(1006, "活动排名通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType()),
ACTIVITY_AWARD(1007, "活动奖励通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType());
/**
* 消息类型
*/
private int type;
/**
* 消息名称
*/
private String name;
/**
* 大类
*/
private int category;
NoticeMessageTypeEnum(int type, String name, int category) {
this.type = type;
this.name = name;
this.category = category;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getCategory() {
return category;
}
public void setCategory(int category) {
this.category = category;
}
}
package com.gic.haoban.manage.api.enums;
/**
* Created by hua on 2021/12/16.
*/
public enum PendingStatusFlagEnum {
NORMAL(1, "正常"),
OVERDUE(2, "逾期"),
INVALID(3, "逾期失效");
private int type;
private String name;
PendingStatusFlagEnum(int type, String name) {
this.type = type;
this.name = name;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
......@@ -9,71 +9,72 @@ import java.util.List;
public interface StaffApiService {
public StaffDTO selectById(String staffId);
public StaffDTO selectSuperByWxEnterpriseId(String wxEnterpriseId);
StaffDTO selectById(String staffId);
public List<StaffDTO> listByIds(List<String> staffIds);
StaffDTO selectSuperByWxEnterpriseId(String wxEnterpriseId);
public List<StaffDTO> listByWxUserId(String wxUserId);
List<StaffDTO> listByIds(List<String> staffIds);
public StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber);
List<StaffDTO> listByWxUserId(String wxUserId);
public ServiceResponse add(StaffDTO staff, String departmentIds);
StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId, String nationcode, String phoneNumber);
public List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId);
ServiceResponse add(StaffDTO staff, String departmentIds);
public Page<StaffDTO> pageStaff(List<String> departmentId, Integer activeFlag, String keyword, BasePageInfo pageInfo, Integer relationFlag);
List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId);
public void del(String staffDepartmentStaffRelatedId);
Page<StaffDTO> pageStaff(List<String> departmentId, Integer activeFlag, String keyword, BasePageInfo pageInfo, Integer relationFlag);
void del(String staffDepartmentStaffRelatedId);
/**
* 获取微信成员
*
* @param userId
* @param wxEnterpriseId
* @return
*/
public ServiceResponse getWxSaveNew(String userId,String wxEnterpriseId);
ServiceResponse getWxSaveNew(String userId, String wxEnterpriseId);
public void wxGetAdd(String userId,String wxEnterpriseId);
void wxGetAdd(String userId, String wxEnterpriseId);
public void staffEdit(StaffDTO staffDTO, String departmentIds);
void staffEdit(StaffDTO staffDTO, String departmentIds);
public void syscGicClerk(String fieldListString);
void syscGicClerk(String fieldListString);
public StaffDTO selectByUserIdAndEnterpriseId(String userId,String wxEnterpriseId);
StaffDTO selectByUserIdAndEnterpriseId(String userId, String wxEnterpriseId);
public StaffDepartmentRelatedDTO getDepartmentIdAndStaffId(String departmentId, String staffId);
StaffDepartmentRelatedDTO getDepartmentIdAndStaffId(String departmentId, String staffId);
public int countByDepartmentId(String departmentId);
int countByDepartmentId(String departmentId);
public void syncGicClerk(String fieldListString);
void syncGicClerk(String fieldListString);
public void addGicClerk(GicClerkDTO clerkDTO);
void addGicClerk(GicClerkDTO clerkDTO);
StaffDepartmentRelatedDTO getDepartmentIdAndCode(String departmentId, String code);
void initWxUser(String corpid, String contactSecret, String wxEnterpriseId, Integer wxDepartmentId,String taskId);
void initWxUser(String corpid, String contactSecret, String wxEnterpriseId, Integer wxDepartmentId, String taskId);
public List<String> listUnBindClerk(String storeId);
List<String> listUnBindClerk(String storeId);
public void cleanGicClerk(String clerkCode, String departmentId);
void cleanGicClerk(String clerkCode, String departmentId);
public String insertUserLoginLog(UserLoginLogDTO userLoginLogDTO);
String insertUserLoginLog(UserLoginLogDTO userLoginLogDTO);
public int countByDepartmentIds(List<String> departmentIds);
public List<StaffDTO> listByPhoneNumber(String phoneNumber);
int countByDepartmentIds(List<String> departmentIds);
public List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId);
List<StaffDTO> listByPhoneNumber(String phoneNumber);
/**
* 保存gic成员
*
* @param clerkDTO
* @return
*/
public ServiceResponse saveSyncStaffByGic(GicClerkDTO clerkDTO);
List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId);
/**
* 保存gic成员
*
* @param clerkDTO
* @return
*/
ServiceResponse saveSyncStaffByGic(GicClerkDTO clerkDTO);
/**
* 获取成员头像
......@@ -82,31 +83,44 @@ public interface StaffApiService {
* @param storeId
* @return
*/
public ServiceResponse<String> getStaffQrcode(String clerkCode, String storeId);
ServiceResponse<String> getStaffQrcode(String clerkCode, String storeId);
void wxFristAdd(String userJson, String wxEnterpriseId);
List<String> listBindClerkUserId(String storeId);
public List<StaffClerkRelationDTO> listBindRelationUserId(String storeId);
List<StaffClerkRelationDTO> listBindRelationUserId(String storeId);
/**
* 激活
*
* @param staffId
* @return
*/
public boolean activeStaff(String staffId);
boolean activeStaff(String staffId);
/**
* 获取一个staff
*
* @param wxEnterpriseId
* @return
*/
public StaffDTO getWxStaffOne(String wxEnterpriseId);
StaffDTO getWxStaffOne(String wxEnterpriseId);
/**
* @param wxEnterpriseId
* @return
*/
public StaffDTO getAndAddSupperAdmin(String wxEnterpriseId);
/**
* @param wxEnterpriseId
* @return
*/
StaffDTO getAndAddSupperAdmin(String wxEnterpriseId);
/**
* 是否隐私
*
* @param staffId 员工id
* @return {@link StaffPrivacyUseLogDTO }
* @author mozhu
* @date 2021-12-16 19:53:48
*/
StaffPrivacyUseLogDTO getStaffPrivacyByStaffId(String staffId);
}
package com.gic.haoban.manage.api.service.notify;
/**
* Created 2021/12/17.
*
* @author hua
*/
public interface NoticeMessageApiService {
public void noticeMessageMq(String json);
}
\ No newline at end of file
......@@ -40,4 +40,38 @@ public interface PendingTaskApiService {
*/
public ServiceResponse<List<PendingTaskDetailDTO>> listPendingTaskToday(String enterpriseId, String storeId, String clerkId, boolean seeSelf);
/**
* 完成任务
*
* @param relationId
* @return
*/
public ServiceResponse<Boolean> finishPending(String relationId);
/**
* 变更执行人
*
* @param relationId
* @param newExeutiveClerkId
* @return
*/
public ServiceResponse<Boolean> changeExecutiveClerkId(String relationId, String newExeutiveClerkId);
/**
* 在完成的同时更新执行人
*
* @param relationId
* @param newExeutiveClerkId
* @return
*/
public ServiceResponse<Boolean> changeExecutiveClerkAndFinishStatus(String relationId, String newExeutiveClerkId);
/**
* 删除执行人
*
* @param relationIds
* @return
*/
public ServiceResponse<Boolean> deletePendingTask(List<String> relationIds);
}
package com.gic.haoban.manage.api.util.notify;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.dto.notify.qdto.NoticeMessageQDTO;
import com.gic.mq.sdk.GicMQClient;
import org.slf4j.Logger;
import java.util.Map;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Created 2021/12/17.
*
* @author hua
*/
public class NoticeMessageUtil {
private static final Logger logger = getLogger(NoticeMessageUtil.class);
private static final String NOTICE_MESSAGE = "haobanNoticeMessage";
/**
* 发送消息
*
* @param enterpriseId 企业id
* @param clerkId 执行人导购
* @param messageType 消息类型 NoticeMessageTypeEnum
* @param templateCode 模板code
* @param fieldMap 解析模板的字段
* @param extendField 拓展字段给前端使用 没有可以为null
*/
public static void sendNoticeMessage(String enterpriseId, String clerkId, int messageType, String templateCode, Map<String, String> fieldMap, Map<String, Object> extendField) {
NoticeMessageQDTO noticeMessageQDTO = new NoticeMessageQDTO();
noticeMessageQDTO.setEnterpriseId(enterpriseId);
noticeMessageQDTO.setClerkId(clerkId);
noticeMessageQDTO.setMessageType(messageType);
noticeMessageQDTO.setTemplateCode(templateCode);
noticeMessageQDTO.setContentMap(fieldMap);
noticeMessageQDTO.setExtendContent(extendField);
String ret = JSONObject.toJSONString(noticeMessageQDTO);
logger.info("发送消息:{}", ret);
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
clientInstance.sendMessage(NOTICE_MESSAGE, ret);
} catch (Exception e) {
logger.info("发送消息异常:{}", e);
}
}
}
......@@ -67,4 +67,16 @@ public interface PendingTaskMapper {
@Param("clerkId") String clerkId,
@Param("startDate") String startDate, @Param("endDate") String endDate);
/**
* 分页查询待办任务表
*
* @param enterpriseId 企业id
* @param storeId 门店id
* @param clerkId 导购id
* @param startDate
* @param endDate
* @return
*/
public int deleteByRelationIds(@Param("enterpriseId") String enterpriseId, @Param("relationIds") List<String> relationIds);
}
\ No newline at end of file
......@@ -40,6 +40,6 @@ public interface StaffPrivacyUseLogMapper {
* @author mozhu
* @date 2021-12-15 10:49:02
*/
List<TabStaffPrivacyUseLog> getByStaffId(@Param("staffId") String staffId);
TabStaffPrivacyUseLog getByStaffId(@Param("staffId") String staffId);
}
......@@ -33,7 +33,12 @@ public class TabWelcome implements Serializable {
private String welcomeContent;
/**
* 0删除 1正常
* 图片
*/
private String welcomeImg;
/**
* 0关闭 1开启
*/
private Integer openFlag;
......@@ -115,4 +120,12 @@ public class TabWelcome implements Serializable {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getWelcomeImg() {
return welcomeImg;
}
public void setWelcomeImg(String welcomeImg) {
this.welcomeImg = welcomeImg;
}
}
\ No newline at end of file
......@@ -38,5 +38,5 @@ public interface StaffPrivacyUseLogService {
* @author mozhu
* @date 2021-12-15 10:51:32
*/
List<TabStaffPrivacyUseLogVO> getByStaffId(String staffId);
StaffPrivacyUseLogBO getByStaffId(String staffId);
}
......@@ -4,14 +4,12 @@ import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.service.dao.mapper.StaffPrivacyUseLogMapper;
import com.gic.haoban.manage.service.entity.TabStaffPrivacyUseLog;
import com.gic.haoban.manage.service.pojo.bo.StaffPrivacyUseLogBO;
import com.gic.haoban.manage.service.pojo.vo.TabStaffPrivacyUseLogVO;
import com.gic.haoban.manage.service.service.StaffPrivacyUseLogService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @author xuwenqian
......@@ -44,8 +42,8 @@ public class StaffPrivacyUseLogServiceImpl implements StaffPrivacyUseLogService
}
@Override
public List<TabStaffPrivacyUseLogVO> getByStaffId(String staffId) {
List<TabStaffPrivacyUseLog> staffPrivacyUseLogList = staffPrivacyUseLogMapper.getByStaffId(staffId);
return EntityUtil.changeEntityListByOrika(TabStaffPrivacyUseLogVO.class, staffPrivacyUseLogList);
public StaffPrivacyUseLogBO getByStaffId(String staffId) {
TabStaffPrivacyUseLog tabStaffPrivacyUseLog = staffPrivacyUseLogMapper.getByStaffId(staffId);
return EntityUtil.changeEntityByOrika(StaffPrivacyUseLogBO.class, tabStaffPrivacyUseLog);
}
}
......@@ -46,5 +46,13 @@ public interface PendingTaskService {
*/
public List<PendingTaskBO> listPendingTaskByCreateTime(String enterpriseId, String storeId, String clerkId, String startDate, String endDate);
/**
* 删除执行人列表
*
* @param relationIds
* @return
*/
public boolean deletePendingTask(List<String> relationIds);
}
......@@ -9,6 +9,7 @@ import com.gic.haoban.manage.service.entity.TabPendingTask;
import com.gic.haoban.manage.service.pojo.BO.PendingTaskBO;
import com.gic.haoban.manage.service.service.notify.PendingTaskService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -54,4 +55,12 @@ public class PendingTaskServiceImpl implements PendingTaskService {
return EntityUtil.changeEntityListByJSON(PendingTaskBO.class, tabPendingTasks);
}
@Override
public boolean deletePendingTask(List<String> relationIds) {
if (CollectionUtils.isEmpty(relationIds)) {
return true;
}
pendingTaskMapper.deleteByRelationIds(null, relationIds);
return true;
}
}
package com.gic.haoban.manage.service.service.notify.out;
import com.gic.haoban.manage.api.service.notify.NoticeMessageApiService;
import org.slf4j.Logger;
import org.springframework.stereotype.Service;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Created 2021/12/17.
*
* @author hua
*/
@Service
public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
private static final Logger logger = getLogger(NoticeMessageApiServiceImpl.class);
@Override
public void noticeMessageMq(String json) {
logger.info("Notice message");
}
}
......@@ -9,6 +9,7 @@ import com.gic.haoban.manage.api.dto.notify.dto.PendingTaskDTO;
import com.gic.haoban.manage.api.dto.notify.dto.PendingTaskDetailDTO;
import com.gic.haoban.manage.api.dto.notify.qdto.PendingListQDTO;
import com.gic.haoban.manage.api.dto.notify.qdto.PendingTaskQDTO;
import com.gic.haoban.manage.api.enums.PendingStatusFlagEnum;
import com.gic.haoban.manage.api.enums.PendingTaskTypeEnum;
import com.gic.haoban.manage.api.service.notify.PendingTaskApiService;
import com.gic.haoban.manage.service.pojo.BO.PendingTaskBO;
......@@ -34,7 +35,7 @@ public class PendingTaskApiServiceImpl implements PendingTaskApiService {
@Override
public void addPendingTask(PendingTaskQDTO qdto) {
//新增待办
//新增待办 todo 后续优化以及完善
pendingTaskService.addOrUpdatePendingTask(EntityUtil.changeEntityByOrika(PendingTaskBO.class, qdto));
}
......@@ -48,13 +49,21 @@ public class PendingTaskApiServiceImpl implements PendingTaskApiService {
if (CollectionUtils.isEmpty(retPage.getResult())) {
return ServiceResponse.success(retPage);
}
retPage.getResult().forEach(dto -> {
buildPending(retPage.getResult());
return ServiceResponse.success(retPage);
}
private void buildPending(List<PendingTaskDetailDTO> list) {
list.forEach(dto -> {
String title = dto.getTitle();
PendingTaskTypeEnum taskTypeEnum = PendingTaskTypeEnum.getByType(dto.getTaskType());
if (null == taskTypeEnum) {
return;
}
dto.setDescription(taskTypeEnum.getDescription().replace("{}", title));
dto.setStatusFlag(dto.getOverdueFlag() == 1 ? PendingStatusFlagEnum.OVERDUE.getType() : PendingStatusFlagEnum.NORMAL.getType());
dto.setTitle(taskTypeEnum.getName());
});
return ServiceResponse.success(retPage);
}
@Override
......@@ -67,12 +76,41 @@ public class PendingTaskApiServiceImpl implements PendingTaskApiService {
if (CollectionUtils.isEmpty(retList)) {
return ServiceResponse.success(retList);
}
retList.forEach(dto -> {
String title = dto.getTitle();
PendingTaskTypeEnum taskTypeEnum = PendingTaskTypeEnum.getByType(dto.getTaskType());
dto.setDescription(taskTypeEnum.getDescription().replace("{}", title));
dto.setTitle(taskTypeEnum.getName());
});
buildPending(retList);
return ServiceResponse.success(retList);
}
@Override
public ServiceResponse<Boolean> finishPending(String relationId) {
PendingTaskBO pendingTaskBO = new PendingTaskBO();
pendingTaskBO.setRelationId(relationId);
pendingTaskBO.setFinishFlag(1);
boolean b = pendingTaskService.addOrUpdatePendingTask(pendingTaskBO);
return ServiceResponse.success(b);
}
@Override
public ServiceResponse<Boolean> changeExecutiveClerkId(String relationId, String newExeutiveClerkId) {
PendingTaskBO pendingTaskBO = new PendingTaskBO();
pendingTaskBO.setRelationId(relationId);
pendingTaskBO.setClerkId(newExeutiveClerkId);
boolean b = pendingTaskService.addOrUpdatePendingTask(pendingTaskBO);
return ServiceResponse.success(b);
}
@Override
public ServiceResponse<Boolean> changeExecutiveClerkAndFinishStatus(String relationId, String newExeutiveClerkId) {
PendingTaskBO pendingTaskBO = new PendingTaskBO();
pendingTaskBO.setRelationId(relationId);
pendingTaskBO.setClerkId(newExeutiveClerkId);
pendingTaskBO.setFinishFlag(1);
boolean b = pendingTaskService.addOrUpdatePendingTask(pendingTaskBO);
return ServiceResponse.success(b);
}
@Override
public ServiceResponse<Boolean> deletePendingTask(List<String> relationIds) {
boolean b = pendingTaskService.deletePendingTask(relationIds);
return ServiceResponse.success(b);
}
}
......@@ -46,17 +46,25 @@ import com.gic.member.api.service.MemberOpenCardBusinessService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.*;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalMessageBaseDTO;
import com.gic.wechat.api.dto.qywx.welcome.QywxImageExternalBaseDTO;
import com.gic.wechat.api.dto.qywx.welcome.QywxMiniprogramExternalBaseDTO;
import com.gic.wechat.api.dto.qywx.welcome.QywxWelcomeMsgDTO;
import com.gic.wechat.api.enums.QywxMediaTypeEnum;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.InputStream;
import java.net.URL;
import java.util.*;
import java.util.stream.Collectors;
......@@ -483,6 +491,17 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
}
private static byte[] getFileByte(String url) {
try {
InputStream in = new URL(url).openStream();
byte[] data = IOUtils.toByteArray(in);
return data;
} catch (Exception e) {
log.info("【异常】" + e.getMessage(), e);
}
return null;
}
/**
* 发送欢迎语
*
......@@ -496,29 +515,46 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String wxEnterpriseId = staffClerkRelationDTO.getWxEnterpriseId();
TabWelcome tabWelcome = welcomeMapper.selectByWxEnterpriseId(wxEnterpriseId);
if (null == tabWelcome || tabWelcome.getOpenFlag() == 0) {
log.info("欢迎语未配置:{},{}", dto.getWxEnterpriseId(), JSONObject.toJSONString(tabWelcome));
log.info("欢迎语未配置:wxEnterpriseId:{}", wxEnterpriseId);
return;
}
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
if (wxEnterpriseDTO == null) {
log.info("微信企业不存在:wxEnterpriseId:{}", wxEnterpriseId);
return;
}
String externalName = dto.getExternalName();
String content = tabWelcome.getWelcomeContent().replaceAll("<微信昵称>", externalName);
QywxWelcomeMsgDTO qywxWelcomeMsgDTO = new QywxWelcomeMsgDTO();
qywxWelcomeMsgDTO.setText(tabWelcome == null ? "欢迎您!" : content);
qywxWelcomeMsgDTO.setText(content);
//发送小程序
if (sendApp) {
log.info("发送小程序:{}", wxEnterpriseId);
QywxMiniprogramExternalBaseDTO messageBaseDTO = new QywxMiniprogramExternalBaseDTO();
TabMiniprogramSetting miniprogramSetting = miniprogramSettingService.getMiniprogramSetting(wxEnterpriseId, staffClerkRelationDTO.getEnterpriseId());
if (null == miniprogramSetting) {
log.info("需要配置小程序配置:wxEnterpriseId:{},enterpriseId:{}", wxEnterpriseId, staffClerkRelationDTO.getEnterpriseId());
return;
}
List<QywxExternalMessageBaseDTO> attachments = new ArrayList<>();
QywxMiniprogramExternalBaseDTO messageBaseDTO = new QywxMiniprogramExternalBaseDTO();
messageBaseDTO.setAppid(miniprogramSetting.getAppId());
messageBaseDTO.setPicMediaId(miniprogramSetting.getMediaId());
messageBaseDTO.setTitle(miniprogramSetting.getTitle());
messageBaseDTO.setPage(config.getMemberOpenPage() + relationKey);
qywxWelcomeMsgDTO.setAttachments(new ArrayList<>());
qywxWelcomeMsgDTO.getAttachments().add(messageBaseDTO);
attachments.add(messageBaseDTO);
String welcomeImg = tabWelcome.getWelcomeImg();
if (StringUtils.isNotBlank(welcomeImg)) {
String[] arr = welcomeImg.split("/");
int count = arr.length;
JSONResponse jp = qywxSuiteApiService.uploadMedia(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), getFileByte(welcomeImg), arr[count - 1], QywxMediaTypeEnum.IMAGE.getCode());
log.info("欢迎语发送图片返回:{}", JSON.toJSONString(jp));
if (jp.getErrorCode() == 0) {
QywxImageExternalBaseDTO qywxImageExternalBaseDTO = new QywxImageExternalBaseDTO();
qywxImageExternalBaseDTO.setMediaId(jp.getResult().toString());
attachments.add(qywxImageExternalBaseDTO);
}
}
qywxWelcomeMsgDTO.setAttachments(attachments);
}
qywxWelcomeMsgDTO.setWelcomeCode(dto.getWelcomeCode());
if (dto.getSuiteid().equals(SELF_APP)) {
......
......@@ -97,6 +97,8 @@ public class StaffApiServiceImpl implements StaffApiService {
@Autowired
private SecretSettingService secretSettingService;
@Autowired
private StaffPrivacyUseLogService staffPrivacyUseLogService;
@Override
public StaffDTO selectById(String staffId) {
......@@ -1468,19 +1470,9 @@ public class StaffApiServiceImpl implements StaffApiService {
return staffDTO;
}
// private String getMobile(String phoneNumber,String nationcode){
// String mobile = nationcode + phoneNumber;
// return mobile;
// }
//
// private String getNationcode(String mobile){
// String nationcode = "";
// return nationcode;
// }
//
// private String getPhoneNumber(String mobile){
// String phoneNumber = "";
// return phoneNumber;
// }
@Override
public StaffPrivacyUseLogDTO getStaffPrivacyByStaffId(String staffId) {
return EntityUtil.changeEntity(StaffPrivacyUseLogDTO.class, staffPrivacyUseLogService.getByStaffId(staffId));
}
}
......@@ -23,7 +23,7 @@ import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.service.*;
import com.gic.wechat.api.dto.qywx.QywxExternalcontactDTO;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -175,7 +175,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
infoDTO.setStoreName(nameMap.get(infoDTO.getStoreId()));
if ((nameMap.get(infoDTO.getEnterpriseId())) != null) {
String EnterpriseandBrandName = nameMap.get(infoDTO.getEnterpriseId());
String split[] = EnterpriseandBrandName.split("_");
String[] split = EnterpriseandBrandName.split("_");
infoDTO.setEnterpriseName(split[0]);
if (split[1] != null) {
infoDTO.setBrandName(split[1]);
......
......@@ -234,6 +234,7 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
tabWelcome = new TabWelcome();
tabWelcome.setTitle(dto.getTitle());
tabWelcome.setWelcomeContent(dto.getWelcomeContent());
tabWelcome.setWelcomeImg(dto.getWelcomeImg());
tabWelcome.setCreateTime(new Date());
tabWelcome.setUpdateTime(new Date());
tabWelcome.setStatusFlag(1);
......@@ -244,6 +245,7 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
} else {
tabWelcome.setTitle(dto.getTitle());
tabWelcome.setWelcomeContent(dto.getWelcomeContent());
tabWelcome.setWelcomeImg(dto.getWelcomeImg());
tabWelcome.setUpdateTime(new Date());
tabWelcome.setOpenFlag(dto.getOpenFlag());
welcomeMapper.updateByPrimaryKeySelective(tabWelcome);
......@@ -302,6 +304,9 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
//插入隐私协议
StaffPrivacyUseLogBO staffPrivacyUseLogBO = new StaffPrivacyUseLogBO();
BeanUtils.copyProperties(staffLoginDTO, staffPrivacyUseLogBO);
staffPrivacyUseLogService.insert(staffPrivacyUseLogBO);
StaffPrivacyUseLogBO privacyUseLog = staffPrivacyUseLogService.getByStaffId(staffLoginDTO.getStaffId());
if (privacyUseLog == null) {
staffPrivacyUseLogService.insert(staffPrivacyUseLogBO);
}
}
}
......@@ -274,4 +274,15 @@
</if>
order by create_time desc limit 20
</select>
<update id="deleteByRelationIds">
update tab_haoban_pending_task
set
delete_flag = 1,
update_time = now()
where relation_id in
<foreach collection="relationIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</update>
</mapper>
\ No newline at end of file
......@@ -142,7 +142,7 @@
SELECT
<include refid="Base_Column_List"/>
FROM tab_staff_privacy_use_log
WHERE staff_id = #{staffId}
WHERE staff_id = #{staffId} order by create_time desc limit 1
</select>
</mapper>
\ No newline at end of file
......@@ -6,6 +6,7 @@
<result column="wx_enterprise_id" jdbcType="VARCHAR" property="wxEnterpriseId"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="welcome_content" jdbcType="VARCHAR" property="welcomeContent"/>
<result column="welcome_img" jdbcType="VARCHAR" property="welcomeImg"/>
<result column="status_flag" jdbcType="INTEGER" property="statusFlag"/>
<result column="open_flag" jdbcType="INTEGER" property="openFlag"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
......@@ -13,7 +14,7 @@
</resultMap>
<sql id="Base_Column_List">
welcome_id, wx_enterprise_id, title, welcome_content,open_flag, status_flag, create_time, update_time
welcome_id, wx_enterprise_id, title, welcome_content,welcome_img,open_flag, status_flag, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
......@@ -31,10 +32,10 @@
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabWelcome">
insert into tab_haoban_welcome (welcome_id, wx_enterprise_id, title,
welcome_content, open_flag, status_flag, create_time,
welcome_content, welcome_img, open_flag, status_flag, create_time,
update_time)
values (#{welcomeId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR},
#{welcomeContent,jdbcType=VARCHAR}, #{openFlag},
#{welcomeContent,jdbcType=VARCHAR}, #{welcomeImg}, #{openFlag},
#{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
......@@ -51,6 +52,9 @@
<if test="welcomeContent != null">
welcome_content = #{welcomeContent,jdbcType=VARCHAR},
</if>
<if test="welcomeImg != null">
welcome_img = #{welcomeImg,jdbcType=VARCHAR},
</if>
<if test="openFlag != null">
open_flag = #{openFlag,jdbcType=INTEGER},
</if>
......
......@@ -651,7 +651,7 @@ public class WxEnterpriseController extends WebBaseController {
}
/**
* 绑定小程序配置列表
* 保存小程序配置列表
*
* @return
*/
......@@ -675,7 +675,7 @@ public class WxEnterpriseController extends WebBaseController {
}
/**
* 绑定小程序配置列表
* 获取小程序配置
*
* @return
*/
......@@ -692,7 +692,7 @@ public class WxEnterpriseController extends WebBaseController {
}
/**
* 绑定小程序配置列表
* 删除小程序配置
*
* @return
*/
......@@ -745,13 +745,13 @@ public class WxEnterpriseController extends WebBaseController {
}
/**
* 绑定小程序配置列表
* 保存欢迎语
*
* @return
*/
@IgnoreLogin
@RequestMapping("save-welcome")
public HaobanResponse savewelcome(String title, String welcomeContent) {
public HaobanResponse savewelcome(String title, String welcomeContent, String welcomeImg) {
LoginDTO loginUser = this.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
if (StringUtils.isAnyBlank(title, welcomeContent)) {
......@@ -760,13 +760,14 @@ public class WxEnterpriseController extends WebBaseController {
WelcomeDTO welcomeDTO = new WelcomeDTO();
welcomeDTO.setTitle(title);
welcomeDTO.setWelcomeContent(welcomeContent);
welcomeDTO.setWelcomeImg(welcomeImg);
welcomeDTO.setWxEnterpriseId(wxEnterpriseId);
wxEnterpriseApiService.saveWelcome(welcomeDTO);
return resultResponse(HaoBanErrCode.ERR_1);
}
/**
* 绑定小程序配置列表
* 欢迎语列表
*
* @return
*/
......@@ -780,7 +781,7 @@ public class WxEnterpriseController extends WebBaseController {
}
/**
* 绑定小程序配置列表
* 删除欢迎语
*
* @return
*/
......@@ -794,7 +795,7 @@ public class WxEnterpriseController extends WebBaseController {
}
/**
* 绑定小程序配置列表
* 欢迎语开启关闭
*
* @return
*/
......
......@@ -18,6 +18,7 @@ import com.gic.haoban.app.customer.service.api.service.DistributeApiService;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.PageResult2;
import com.gic.haoban.common.anno.HttpLimit;
import com.gic.haoban.common.anno.IgnoreLogin;
import com.gic.haoban.common.utils.GooglePhoneNumberUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.PageUtil;
......@@ -622,8 +623,8 @@ public class ClerkController extends WebBaseController {
//精确查,根据手机号或者code,查找
@RequestMapping("query-clerk-list-by-code")
public HaobanResponse queryClerkListByCode(String keyword,String wxEnterpriseId){
if(StringUtils.isAnyBlank(keyword,wxEnterpriseId)){
public HaobanResponse queryClerkListByCode(String keyword, String wxEnterpriseId, String staffId) {
if (StringUtils.isAnyBlank(staffId, wxEnterpriseId)) {
return resultResponse(HaoBanErrCode.ERR_2);
}
List<EnterpriseDetailDTO> list = wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId(wxEnterpriseId);
......@@ -635,8 +636,9 @@ public class ClerkController extends WebBaseController {
return !over;
}).map(s->s.getEnterpriseId()).collect(Collectors.toList());
List<String> storeIds = wxEnterpriseRelatedApiService.listStoreIdByWxEnterpriseId(wxEnterpriseId);
List<ClerkDTO> clerkList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIdList, storeIds, keyword);
List<ClerkStoreVO> clerkStoreList = new ArrayList<>();
List<ClerkDTO> clerkList = this.getClerkListBySearch(enterpriseIdList, storeIds, keyword, staffId);
// List<ClerkDTO> clerkList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIdList, storeIds, keyword);
List<ClerkStoreVO> clerkStoreList = new ArrayList<>();
if(CollectionUtil.isEmpty(clerkList)){
return resultResponse(HaoBanErrCode.ERR_1,clerkStoreList);
}
......@@ -673,6 +675,47 @@ public class ClerkController extends WebBaseController {
}
return resultResponse(HaoBanErrCode.ERR_1,clerkStoreList);
}
/**
* @param enterpriseIdList
* @param storeIdList
* @param search
* @param staffId
* @return
*/
private List<ClerkDTO> getClerkListBySearch(List<String> enterpriseIdList, List<String> storeIdList, String search, String staffId) {
List<ClerkDTO> ret = new ArrayList<ClerkDTO>();
if (StringUtils.isBlank(search)) {
StaffDTO staffDTO = staffApiService.selectById(staffId);
if (staffDTO != null) {
List<ClerkDTO> clerkList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIdList, storeIdList, staffDTO.getPhoneNumber());
if (CollectionUtils.isEmpty(clerkList)) {
ret.addAll(clerkList);
}
}
List<StaffClerkInfoDTO> staffClerkInfoDTOS = staffClerkRelationApiService.listBindDetailByStaffId(staffId);
if (CollectionUtils.isEmpty(staffClerkInfoDTOS)) {
return ret;
}
Set<String> clerkIds = staffClerkInfoDTOS.stream().map(mid -> mid.getClerkId()).collect(Collectors.toSet());
List<ClerkDTO> clerkDTOS = clerkService.getClerkByClerkIds(clerkIds);
for (ClerkDTO clerkDTO : clerkDTOS) {
List<ClerkDTO> clerkList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIdList, storeIdList, clerkDTO.getPhoneNumber());
if (CollectionUtils.isEmpty(clerkList)) {
ret.addAll(clerkList);
}
}
} else {
List<ClerkDTO> clerkList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIdList, storeIdList, search);
if (CollectionUtils.isEmpty(clerkList)) {
ret.addAll(clerkList);
}
}
return ret;
}
//绑定
@HttpLimit
@RequestMapping("bind-staff")
......@@ -1077,6 +1120,7 @@ public class ClerkController extends WebBaseController {
* @return
*/
@RequestMapping("push-friend")
@IgnoreLogin
public HaobanResponse friendList(String relationKey) {
externalClerkRelatedApiService.pushExternalByRelationKey(relationKey);
return resultResponse(HaoBanErrCode.ERR_1);
......
package com.gic.haoban.manage.web.controller;
import com.gic.haoban.common.anno.IgnoreLogin;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DictDTO;
......@@ -8,9 +9,8 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.DictVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
......@@ -20,14 +20,13 @@ import java.util.List;
*
* @author hua
*/
@Controller
@RestController
public class DictController extends WebBaseController {
@Autowired
private DictApiService dictApiService;
@RequestMapping("/dict-list")
@ResponseBody
public HaobanResponse queryDictList(String dictKeys) {
if (StringUtils.isBlank(dictKeys)) {
return resultResponse(HaoBanErrCode.ERR_5);
......@@ -44,7 +43,7 @@ public class DictController extends WebBaseController {
* @return
*/
@RequestMapping("/find-dict-key")
@ResponseBody
@IgnoreLogin
public HaobanResponse queryDictByKey(String dictKey) {
if (StringUtils.isBlank(dictKey)) {
return resultResponse(HaoBanErrCode.ERR_5);
......
package com.gic.haoban.manage.web.controller;
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.alibaba.fastjson.JSON;
import com.gic.clerk.api.service.ClerkService;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.common.anno.IgnoreLogin;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.MaidianLogDTO;
import com.gic.haoban.manage.api.service.MaidianLogApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
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 java.util.List;
@RestController
public class MaidianLogController extends WebBaseController{
......@@ -25,8 +25,9 @@ public class MaidianLogController extends WebBaseController{
private ClerkService clerkService;
@Autowired
private StoreService storeService;
@RequestMapping("save-maidian-log")
@IgnoreLogin
public HaobanResponse saveUserLoginLog(String maidianLogStr) {
if(StringUtils.isBlank(maidianLogStr)){
return resultResponse(HaoBanErrCode.ERR_2);
......
......@@ -60,10 +60,13 @@ public class StoreController extends WebBaseController {
private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired
private EnterpriseService enterpriseService;
@Autowired
private StaffApiService staffApiService;
//门店列表
@RequestMapping("/store-list")
public HaobanResponse storeList(String staffId,String wxEnterpriseId,String version) {
@IgnoreLogin
public HaobanResponse storeList(String staffId, String wxEnterpriseId, String version) {
if (StringUtils.isAnyBlank(staffId, wxEnterpriseId)) {
return resultResponse(HaoBanErrCode.ERR_2);
}
......@@ -99,6 +102,10 @@ public class StoreController extends WebBaseController {
if (store == null) {
continue;
}
StaffDTO staffDTO = staffApiService.selectById(staffId);
if (staffDTO == null) {
continue;
}
//主门店标志
int mainStoreFlag = 0;
if (storeId.equals(store.getStoreId())) {
......@@ -121,6 +128,7 @@ public class StoreController extends WebBaseController {
vo.setStoreName(store.getStoreName());
vo.setWxEnterpriseId(wxEnterpriseId);
vo.setClerkName(clerk.getClerkName());
vo.setHeadImg(staffDTO.getHeadImg());
vo.setBindFlag(1);
list.add(vo);
}
......
package com.gic.haoban.manage.web.controller;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
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.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.gic.commons.util.GlobalInfo;
import com.gic.commons.util.GlobalVar;
import com.gic.haoban.common.anno.IgnoreLogin;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.thirdparty.api.dto.PicUploadResDTO;
import com.gic.thirdparty.api.service.QQCloudPicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@RestController
public class UploadController extends WebBaseController{
@Autowired
private QQCloudPicService qqCloudPicService;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.util.*;
@RequestMapping("upload-img")
public HaobanResponse imgUpload(HttpServletRequest request) throws Exception {
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
Iterator<String> iter = multiRequest.getFileNames();
java.util.List<Map<String, Object>> picList = new ArrayList<>();
while (iter.hasNext()) {
String fileName = iter.next();
List<MultipartFile> list = multiRequest.getMultiFileMap().get(fileName);
Map<String, Object> map = null;
for (int i = 0; i < list.size(); i++) {
map = new HashMap<>();
MultipartFile mf = list.get(i);
InputStream in = mf.getInputStream();
byte[] fileBuffer = null;
if (null != in) {
int len = in.available();
fileBuffer = new byte[len];
in.read(fileBuffer);
}
PicUploadResDTO picUploadResDTO = qqCloudPicService.uploadPic(
GlobalVar.ctxPropertiesMap.get(GlobalInfo.QQPIC_KEY_ENTERPRISE), fileBuffer);
if (picUploadResDTO != null) {
picUploadResDTO.print();
map.put("qcloudImageUrl", picUploadResDTO.downloadUrl);
map.put("imageFiledCode", picUploadResDTO.fileId);
}
picList.add(map);
}
}
return resultResponse(HaoBanErrCode.ERR_1, picList);
}
@RestController
public class UploadController extends WebBaseController {
@Autowired
private QQCloudPicService qqCloudPicService;
@RequestMapping("upload-img")
@IgnoreLogin
public HaobanResponse imgUpload(HttpServletRequest request) throws Exception {
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
Iterator<String> iter = multiRequest.getFileNames();
java.util.List<Map<String, Object>> picList = new ArrayList<>();
while (iter.hasNext()) {
String fileName = iter.next();
List<MultipartFile> list = multiRequest.getMultiFileMap().get(fileName);
Map<String, Object> map = null;
for (int i = 0; i < list.size(); i++) {
map = new HashMap<>();
MultipartFile mf = list.get(i);
InputStream in = mf.getInputStream();
byte[] fileBuffer = null;
if (null != in) {
int len = in.available();
fileBuffer = new byte[len];
in.read(fileBuffer);
}
PicUploadResDTO picUploadResDTO = qqCloudPicService.uploadPic(
GlobalVar.ctxPropertiesMap.get(GlobalInfo.QQPIC_KEY_ENTERPRISE), fileBuffer);
if (picUploadResDTO != null) {
picUploadResDTO.print();
map.put("qcloudImageUrl", picUploadResDTO.downloadUrl);
map.put("imageFiledCode", picUploadResDTO.fileId);
}
picList.add(map);
}
}
return resultResponse(HaoBanErrCode.ERR_1, picList);
}
}
......@@ -89,6 +89,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
@Autowired
private Config config;
/**
* code授权
*
......@@ -144,23 +145,27 @@ public class WxEnterpriseInfoController extends WebBaseController {
}
}
}
String staffId = loginStaff.getStaffId();
//激活状态
if (loginStaff.getActiveFlag() == 0) {
staffApiService.activeStaff(loginStaff.getStaffId());
staffApiService.activeStaff(staffId);
}
StaffPrivacyUseLogDTO staffPrivacyUseLogDTO = staffApiService.getStaffPrivacyByStaffId(staffId);
String wxEnterpriseId = loginStaff.getWxEnterpriseId();
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId);
String accesstoken = qywxCorpApiService.getCorpAccessToken(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid());
WellDoneLoginInfoVO wellDoneLoginInfoVo = new WellDoneLoginInfoVO();
wellDoneLoginInfoVo.setAccessToken(accesstoken);
wellDoneLoginInfoVo.setStaffId(loginStaff.getStaffId());
wellDoneLoginInfoVo.setStaffId(staffId);
wellDoneLoginInfoVo.setWxEnterpriseId(wxEnterpriseId);
wellDoneLoginInfoVo.setStaffName(loginStaff.getStaffName());
wellDoneLoginInfoVo.setPhoneNumber(loginStaff.getPhoneNumber());
wellDoneLoginInfoVo.setNationcode(loginStaff.getNationCode());
wellDoneLoginInfoVo.setWxUserId(loginStaff.getWxUserId());
if (staffPrivacyUseLogDTO != null) {
wellDoneLoginInfoVo.setPrivacyUseFlag(staffPrivacyUseLogDTO.getPrivacyUseFlag());
}
return resultResponse(HaoBanErrCode.ERR_1, wellDoneLoginInfoVo);
}
......@@ -204,10 +209,11 @@ public class WxEnterpriseInfoController extends WebBaseController {
* @date 2021-12-10 18:34:12
*/
@RequestMapping(value = "welldone-token-refresh", method = RequestMethod.GET)
@IgnoreLogin
public HaobanResponse welldoneTokenRefresh() {
String token = AuthRequestWellDoneUtil.getToken();
if (ObjectUtil.isNull(token)) {
return resultResponse(HaoBanErrCode.ERR_30004);
return resultResponse(HaoBanErrCode.ERR_30010);
}
Map<String, String> tokenMap = JwtUtil.parseToken(token);
if (MapUtil.isEmpty(tokenMap)) {
......@@ -388,6 +394,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
* @return
*/
@RequestMapping("get-send-message-info")
@IgnoreLogin
public HaobanResponse getMessageMember(String externalUserid, String wxUserId, String wxEnterpriseId, String gicEnterpriseId) {
if (StringUtils.isAnyBlank(externalUserid, wxUserId, wxEnterpriseId)) {
return resultResponse(HaoBanErrCode.ERR_2);
......@@ -433,7 +440,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
}
/**
* 绑定好友
* 绑定好友(会员小程序调用)
*
* @param memberId
* @param enterpriseId
......@@ -442,6 +449,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
* @return
*/
@RequestMapping("member-bind-friend")
@IgnoreLogin
public HaobanResponse memberBindFriend(String memberId, String enterpriseId, String unionid, String relationKey) {
if (StringUtils.isAnyBlank(memberId, enterpriseId, relationKey)) {
return resultResponse(HaoBanErrCode.ERR_2);
......
......@@ -123,6 +123,7 @@ public enum HaoBanErrCode {
ERR_30007(30007, "未设置密码,请先设置密码"),
ERR_30008(30008, "超级管理员不存在"),
ERR_30009(30009, "token不正确,请重新登录"),
ERR_30010(30010, "token为空,请授权登录登录"),
//角色
ERR_40001(40001, "角色异常"),
......
......@@ -48,10 +48,6 @@ public class MobileWebInterceptor extends HandlerInterceptorAdapter {
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
String requestURI = httpServletRequest.getRequestURI();
logger.info("post-url:{}", requestURI);
// TODO: 2021/12/15 先跳过
if (true) {
return true;
}
HandlerMethod handler = (HandlerMethod) o;
IgnoreLogin ignoreLogin = handler.getMethodAnnotation(IgnoreLogin.class);
if (null != ignoreLogin) {
......@@ -59,7 +55,7 @@ public class MobileWebInterceptor extends HandlerInterceptorAdapter {
}
WellDoneLoginDTO wellDoneLoginDTO = (WellDoneLoginDTO) AuthRequestWellDoneUtil.getLoginUser();
if (wellDoneLoginDTO == null) {
this.errorResult(httpServletResponse, HaoBanErrCode.ERR_4);
this.errorResult(httpServletResponse, HaoBanErrCode.ERR_30009);
logger.info("用户不存在!");
return false;
}
......
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
import java.util.Date;
/**
* Created 2018/10/22.
......@@ -19,7 +18,8 @@ public class StaffStoreVO implements Serializable {
private String clerkCode;
private String clerkId;
private String storeImg;
private int clerkType;
private String headImg;
private int clerkType;
private Integer mainStoreFlag;
private String phoneNumber;
private int bindFlag;
......@@ -115,16 +115,24 @@ public class StaffStoreVO implements Serializable {
public int getClerkType() {
return clerkType;
}
public void setClerkType(int clerkType) {
this.clerkType = clerkType;
}
public Integer getMainStoreFlag() {
return mainStoreFlag;
}
public void setMainStoreFlag(Integer mainStoreFlag) {
this.mainStoreFlag = mainStoreFlag;
}
public String getHeadImg() {
return headImg;
}
public void setHeadImg(String headImg) {
this.headImg = headImg;
}
}
......@@ -16,6 +16,7 @@ public class WellDoneLoginInfoVO implements Serializable {
private String phoneNumber;
private String nationcode;
private String wxUserId;
private Integer privacyUseFlag;
public String getWxUserId() {
return wxUserId;
......@@ -24,6 +25,7 @@ public class WellDoneLoginInfoVO implements Serializable {
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public String getStaffId() {
return staffId;
}
......@@ -51,14 +53,24 @@ public class WellDoneLoginInfoVO implements Serializable {
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getNationcode() {
return nationcode;
}
public void setNationcode(String nationcode) {
this.nationcode = nationcode;
}
public Integer getPrivacyUseFlag() {
return privacyUseFlag;
}
public void setPrivacyUseFlag(Integer privacyUseFlag) {
this.privacyUseFlag = privacyUseFlag;
}
}
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