Commit 140f9e2f by fudahua

Merge branch 'feature-daiban-12-14' into 'developer'

Feature daiban 12 14

See merge request !134
parents 63ce9493 d3077062
...@@ -56,6 +56,12 @@ ...@@ -56,6 +56,12 @@
<artifactId>java-jwt</artifactId> <artifactId>java-jwt</artifactId>
<version>${jwt.version}</version> <version>${jwt.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-commons</artifactId>
<version>3.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -59,6 +59,10 @@ public class PendingTaskDetailDTO implements Serializable { ...@@ -59,6 +59,10 @@ public class PendingTaskDetailDTO implements Serializable {
*/ */
private Integer statusFlag; private Integer statusFlag;
private Integer finishFlag;
private Integer overdueFlag;
/** /**
* 创建时间 * 创建时间
*/ */
...@@ -69,6 +73,22 @@ public class PendingTaskDetailDTO implements Serializable { ...@@ -69,6 +73,22 @@ public class PendingTaskDetailDTO implements Serializable {
*/ */
private static final long serialVersionUID = 1L; 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() { public String getEnterpriseId() {
return enterpriseId; 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;
}
}
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 { ...@@ -40,4 +40,38 @@ public interface PendingTaskApiService {
*/ */
public ServiceResponse<List<PendingTaskDetailDTO>> listPendingTaskToday(String enterpriseId, String storeId, String clerkId, boolean seeSelf); 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 { ...@@ -67,4 +67,16 @@ public interface PendingTaskMapper {
@Param("clerkId") String clerkId, @Param("clerkId") String clerkId,
@Param("startDate") String startDate, @Param("endDate") String endDate); @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
...@@ -46,5 +46,13 @@ public interface PendingTaskService { ...@@ -46,5 +46,13 @@ public interface PendingTaskService {
*/ */
public List<PendingTaskBO> listPendingTaskByCreateTime(String enterpriseId, String storeId, String clerkId, String startDate, String endDate); 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; ...@@ -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.pojo.BO.PendingTaskBO;
import com.gic.haoban.manage.service.service.notify.PendingTaskService; import com.gic.haoban.manage.service.service.notify.PendingTaskService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -54,4 +55,12 @@ public class PendingTaskServiceImpl implements PendingTaskService { ...@@ -54,4 +55,12 @@ public class PendingTaskServiceImpl implements PendingTaskService {
return EntityUtil.changeEntityListByJSON(PendingTaskBO.class, tabPendingTasks); 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; ...@@ -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.dto.PendingTaskDetailDTO;
import com.gic.haoban.manage.api.dto.notify.qdto.PendingListQDTO; 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.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.enums.PendingTaskTypeEnum;
import com.gic.haoban.manage.api.service.notify.PendingTaskApiService; import com.gic.haoban.manage.api.service.notify.PendingTaskApiService;
import com.gic.haoban.manage.service.pojo.BO.PendingTaskBO; import com.gic.haoban.manage.service.pojo.BO.PendingTaskBO;
...@@ -34,7 +35,7 @@ public class PendingTaskApiServiceImpl implements PendingTaskApiService { ...@@ -34,7 +35,7 @@ public class PendingTaskApiServiceImpl implements PendingTaskApiService {
@Override @Override
public void addPendingTask(PendingTaskQDTO qdto) { public void addPendingTask(PendingTaskQDTO qdto) {
//新增待办 //新增待办 todo 后续优化以及完善
pendingTaskService.addOrUpdatePendingTask(EntityUtil.changeEntityByOrika(PendingTaskBO.class, qdto)); pendingTaskService.addOrUpdatePendingTask(EntityUtil.changeEntityByOrika(PendingTaskBO.class, qdto));
} }
...@@ -48,13 +49,21 @@ public class PendingTaskApiServiceImpl implements PendingTaskApiService { ...@@ -48,13 +49,21 @@ public class PendingTaskApiServiceImpl implements PendingTaskApiService {
if (CollectionUtils.isEmpty(retPage.getResult())) { if (CollectionUtils.isEmpty(retPage.getResult())) {
return ServiceResponse.success(retPage); 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(); String title = dto.getTitle();
PendingTaskTypeEnum taskTypeEnum = PendingTaskTypeEnum.getByType(dto.getTaskType()); PendingTaskTypeEnum taskTypeEnum = PendingTaskTypeEnum.getByType(dto.getTaskType());
if (null == taskTypeEnum) {
return;
}
dto.setDescription(taskTypeEnum.getDescription().replace("{}", title)); dto.setDescription(taskTypeEnum.getDescription().replace("{}", title));
dto.setStatusFlag(dto.getOverdueFlag() == 1 ? PendingStatusFlagEnum.OVERDUE.getType() : PendingStatusFlagEnum.NORMAL.getType());
dto.setTitle(taskTypeEnum.getName()); dto.setTitle(taskTypeEnum.getName());
}); });
return ServiceResponse.success(retPage);
} }
@Override @Override
...@@ -67,12 +76,41 @@ public class PendingTaskApiServiceImpl implements PendingTaskApiService { ...@@ -67,12 +76,41 @@ public class PendingTaskApiServiceImpl implements PendingTaskApiService {
if (CollectionUtils.isEmpty(retList)) { if (CollectionUtils.isEmpty(retList)) {
return ServiceResponse.success(retList); return ServiceResponse.success(retList);
} }
retList.forEach(dto -> { buildPending(retList);
String title = dto.getTitle();
PendingTaskTypeEnum taskTypeEnum = PendingTaskTypeEnum.getByType(dto.getTaskType());
dto.setDescription(taskTypeEnum.getDescription().replace("{}", title));
dto.setTitle(taskTypeEnum.getName());
});
return ServiceResponse.success(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);
}
} }
...@@ -274,4 +274,15 @@ ...@@ -274,4 +274,15 @@
</if> </if>
order by create_time desc limit 20 order by create_time desc limit 20
</select> </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> </mapper>
\ No newline at end of file
...@@ -623,8 +623,8 @@ public class ClerkController extends WebBaseController { ...@@ -623,8 +623,8 @@ public class ClerkController extends WebBaseController {
//精确查,根据手机号或者code,查找 //精确查,根据手机号或者code,查找
@RequestMapping("query-clerk-list-by-code") @RequestMapping("query-clerk-list-by-code")
public HaobanResponse queryClerkListByCode(String keyword,String wxEnterpriseId){ public HaobanResponse queryClerkListByCode(String keyword, String wxEnterpriseId, String staffId) {
if(StringUtils.isAnyBlank(keyword,wxEnterpriseId)){ if (StringUtils.isAnyBlank(staffId, wxEnterpriseId)) {
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
List<EnterpriseDetailDTO> list = wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId(wxEnterpriseId); List<EnterpriseDetailDTO> list = wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId(wxEnterpriseId);
...@@ -636,8 +636,9 @@ public class ClerkController extends WebBaseController { ...@@ -636,8 +636,9 @@ public class ClerkController extends WebBaseController {
return !over; return !over;
}).map(s->s.getEnterpriseId()).collect(Collectors.toList()); }).map(s->s.getEnterpriseId()).collect(Collectors.toList());
List<String> storeIds = wxEnterpriseRelatedApiService.listStoreIdByWxEnterpriseId(wxEnterpriseId); List<String> storeIds = wxEnterpriseRelatedApiService.listStoreIdByWxEnterpriseId(wxEnterpriseId);
List<ClerkDTO> clerkList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIdList, storeIds, keyword); List<ClerkDTO> clerkList = this.getClerkListBySearch(enterpriseIdList, storeIds, keyword, staffId);
List<ClerkStoreVO> clerkStoreList = new ArrayList<>(); // List<ClerkDTO> clerkList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIdList, storeIds, keyword);
List<ClerkStoreVO> clerkStoreList = new ArrayList<>();
if(CollectionUtil.isEmpty(clerkList)){ if(CollectionUtil.isEmpty(clerkList)){
return resultResponse(HaoBanErrCode.ERR_1,clerkStoreList); return resultResponse(HaoBanErrCode.ERR_1,clerkStoreList);
} }
...@@ -674,6 +675,47 @@ public class ClerkController extends WebBaseController { ...@@ -674,6 +675,47 @@ public class ClerkController extends WebBaseController {
} }
return resultResponse(HaoBanErrCode.ERR_1,clerkStoreList); 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 @HttpLimit
@RequestMapping("bind-staff") @RequestMapping("bind-staff")
......
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