Commit f14bd76b by 王祖波

Merge branch 'master' into feature-content4-2

# Conflicts:
#	haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/role/HaobanRoleApiServiceImpl.java
parents e01b3c26 fd4201b2
......@@ -30,6 +30,12 @@ public class ContentMaterialROleInitQDTO implements Serializable {
*/
private Integer version;
/**
* 老版本
* null 代表是新增
*/
private Integer oldVersion;
public enum Version {
LOW(1, "基础版本"),
HIGH(2, "高级版");
......@@ -81,4 +87,12 @@ public class ContentMaterialROleInitQDTO implements Serializable {
public void setVersion(Integer version) {
this.version = version;
}
public Integer getOldVersion() {
return oldVersion;
}
public void setOldVersion(Integer oldVersion) {
this.oldVersion = oldVersion;
}
}
......@@ -9,20 +9,22 @@ package com.gic.haoban.manage.api.enums;
**/
public enum HaobanClerkTypeEnum {
;
CLERK(0, "导购/店员"),
STORE_MANAGER(1, "店长"),
AREA_MANAGER(2, "区经");
HaobanClerkTypeEnum(Integer type, String desc){
this.code = type;
this.desc = desc;
}
private int code;
private Integer code;
private String desc;
public int getCode() {
public Integer getCode() {
return code;
}
public void setCode(int code) {
public void setCode(Integer code) {
this.code = code;
}
......
......@@ -28,7 +28,6 @@ public interface DealSyncOperationApiService {
/**
* mq拆分
* 部门同步处理
* "routerName": "departmentSyncDealMq2"
*
* @param params
*/
......
......@@ -30,6 +30,9 @@ public interface StaffApiService {
*/
ServiceResponse getWxSaveNew(String userId, String wxEnterpriseId);
// 是否是同步通讯录,如果是不用每次都查询开启联系我的列表
ServiceResponse getWxSaveNew(String userId, String wxEnterpriseId ,boolean isSyncDepart);
/**
* 新增成员
*
......
......@@ -170,4 +170,6 @@ public interface WxEnterpriseRelatedApiService {
public int getRelationCount(String enterpriseId) ;
public com.gic.api.base.commons.ServiceResponse<Integer> getEnterprieseQwType(String enterpriseId) ;
}
......@@ -207,6 +207,12 @@
<artifactId>gic-operating-api</artifactId>
<version>${gic-operating-api}</version>
</dependency>
<!-- 数仓 -->
<dependency>
<groupId>com.alibaba.hologres</groupId>
<artifactId>holo-client</artifactId>
<version>2.2.10</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-content-api</artifactId>
......
package com.gic.haoban.manage.service.dao.mapper.content.holo;
import com.alibaba.hologres.client.HoloClient;
import com.alibaba.hologres.client.HoloConfig;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
/**
* @Author MUSI
* @Date 2023/9/4 4:11 PM
* @Description
* @Version
**/
@Slf4j
@Component
public class HoloDataSource implements InitializingBean, DisposableBean {
HoloClient client;
public synchronized void init() {
try {
Config appConfig = ConfigService.getAppConfig();
String holoUrl = appConfig.getProperty("holo.url", "");
String holoUserName = appConfig.getProperty("holo.username", "");
String holoPassword = appConfig.getProperty("holo.password", "");
HoloConfig holoConfig = new HoloConfig();
holoConfig.setJdbcUrl(holoUrl);
holoConfig.setUsername(holoUserName);
holoConfig.setPassword(holoPassword);
this.client = new HoloClient(holoConfig);
this.client.setAsyncCommit(false);
log.info("holo链接初始化完成");
}catch (Exception ex) {
log.info("初始化client 异常 >>>", ex);
}
}
@Override
public void destroy() throws Exception {
if (client != null) {
client.close();
}
}
@Override
public void afterPropertiesSet() throws Exception {
if (client == null) {
this.init();
}
}
public HoloClient getClient() {
if (this.client == null) {
this.init();
}
return this.client;
}
}
package com.gic.haoban.manage.service.entity.content;
import com.alibaba.fastjson.annotation.JSONField;
import java.util.Date;
import java.io.Serializable;
......@@ -56,10 +58,12 @@ public class TabHaobanTriggerCustomerDetail implements Serializable {
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:dd:ss")
private Date createTime;
/**
* 修改时间
*/
@JSONField(format = "yyyy-MM-dd HH:dd:ss")
private Date updateTime;
/**
* 0正常; 1删除
......
......@@ -86,4 +86,6 @@ public class InteractRecordMessageBO implements Serializable {
* @see com.gic.haoban.manage.api.enums.content.ShareBizType
*/
private Integer bizType;
private String appKey;
}
......@@ -113,4 +113,6 @@ public interface StoreRangeService {
List<String> listStoreIdByName( String wxEnterpriseId, String enterpriseId, String storeName) ;
public boolean hasStore(String wxEnterpriseId , String enterpriseId, String storeId) ;
}
......@@ -136,7 +136,11 @@ public class MaterialDataAdaptor {
if (result.get("data") == null) {
return null;
}
JSONObject jsonObject = DataApiUtils.getPageOne(result);
List<JSONObject> dataList = DataApiUtils.getDataList(result);
if (CollectionUtils.isEmpty(dataList)) {
return null;
}
JSONObject jsonObject = dataList.get(0);
if (jsonObject.isEmpty()) {
return null;
}
......
package com.gic.haoban.manage.service.service.content.adaptor;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
/**
* @Author MUSI
* @Date 2023/9/4 3:14 PM
* @Description
* @Version
**/
@Slf4j
@Component
public class MessageConvertHelper {
/**
* 转换消息
* @param text
* @return
*/
public InteractRecordMessageBO convertMessageBo(String text) {
JSONObject jsonObject = JSON.parseObject(text);
if (MapUtils.isEmpty(jsonObject)) {
return null;
}
InteractRecordMessageBO interactRecordMessageBO = new InteractRecordMessageBO();
String appKey = jsonObject.getString("app_key");
interactRecordMessageBO.setAppKey(appKey);
String gp = jsonObject.getString("gp");
JSONObject gpJson = JSON.parseObject(gp);
String cusp = jsonObject.getString("cusp");
JSONObject cuspJson = JSON.parseObject(cusp);
String sysp = jsonObject.getString("sysp");
JSONObject syspJson = JSON.parseObject(sysp);
String enterpriseId = gpJson.getString("merch_id");
interactRecordMessageBO.setEnterpriseId(enterpriseId);
String memberId = gpJson.getString("member_id");
interactRecordMessageBO.setMemberId(memberId);
String unionId = gpJson.getString("union_id");
interactRecordMessageBO.setUnionId(unionId);
String clerkId = cuspJson.getString("share_id");
interactRecordMessageBO.setClerkId(clerkId);
String storeId = cuspJson.getString("share_shop_id");
interactRecordMessageBO.setStoreId(storeId);
String materialId = cuspJson.getString("material_id");
interactRecordMessageBO.setMaterialId(materialId);
String shareMaterialChannel = cuspJson.getString("share_material_channel");
interactRecordMessageBO.setChannelSource(this.convertChannelSource(shareMaterialChannel));
String eventCode = jsonObject.getString("event_code");
interactRecordMessageBO.setEventType(this.convertEventType(eventCode));
Integer duration = jsonObject.getInteger("duration");
interactRecordMessageBO.setDurationTime(duration);
String orderNumber = cuspJson.getString("order_number");
interactRecordMessageBO.setOrderNumber(orderNumber);
String goodsId = cuspJson.getString("goods_id");
interactRecordMessageBO.setGoodsId(goodsId);
String runningUuid = jsonObject.getString("runningUuid");
interactRecordMessageBO.setBusinessUUId(runningUuid);
Long lastAccessTime = jsonObject.getLong("server_timestamp");
interactRecordMessageBO.setLastAccessTime(lastAccessTime);
String refUrl = syspJson.getString("ref_url");
interactRecordMessageBO.setRefUrl(refUrl);
return interactRecordMessageBO;
}
private Integer convertChannelSource(String shareMaterialChannel) {
if (StringUtils.isBlank(shareMaterialChannel)) {
return null;
}
switch (shareMaterialChannel) {
case "null" :
case "NULL":
return null;
case "朋友圈":
return 1;
case "客户群":
return 2;
case "对话框":
return 3;
default:
return 0;
}
}
private Integer convertEventType(String eventCode) {
if (StringUtils.isBlank(eventCode)) {
return null;
}
switch (eventCode) {
case "material_page":
case "material_page_duration":
return 1;
case "store_goods_detail":
return 2;
case "store_buy_sucess":
return 3;
case "store_add_cart":
return 4;
default:
return null;
}
}
}
package com.gic.haoban.manage.service.service.content.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.hologres.client.HoloClient;
import com.alibaba.hologres.client.Put;
import com.alibaba.hologres.client.model.TableSchema;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import com.gic.haoban.common.utils.DateUtil;
import com.gic.haoban.manage.service.dao.mapper.content.TabHaobanTriggerCustomerDetailMapper;
import com.gic.haoban.manage.service.dao.mapper.content.holo.HoloDataSource;
import com.gic.haoban.manage.service.entity.content.TabHaobanTriggerCustomerDetail;
import com.gic.haoban.manage.service.pojo.bo.content.TriggerCustomerDetailBO;
import com.gic.haoban.manage.service.pojo.qo.content.TriggerCustomerDetailQO;
import com.gic.haoban.manage.service.service.content.TriggerCustomerDetailService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -29,6 +43,9 @@ public class TriggerCustomerDetailServiceImpl implements TriggerCustomerDetailSe
@Autowired
private TabHaobanTriggerCustomerDetailMapper triggerCustomerDetailMapper;
@Autowired
private HoloDataSource holoDataSource;
@Override
public void save(TriggerCustomerDetailBO triggerCustomerDetailBO) {
......@@ -42,17 +59,53 @@ public class TriggerCustomerDetailServiceImpl implements TriggerCustomerDetailSe
@Override
public void batchSave(List<TriggerCustomerDetailBO> triggerCustomerDetailBos) {
if (CollectionUtils.isEmpty(triggerCustomerDetailBos)) {
log.info("无客户触达日志 >>>> ");
return;
}
List<TabHaobanTriggerCustomerDetail> customerDetails = triggerCustomerDetailBos
.stream()
.map(item -> {
TabHaobanTriggerCustomerDetail temp = new TabHaobanTriggerCustomerDetail();
BeanUtils.copyProperties(item, temp);
return temp;
})
.collect(Collectors.toList());
triggerCustomerDetailMapper.insertBatch(customerDetails);
Config appConfig = ConfigService.getAppConfig();
// 当前阶段 0双写 1 只写数据表
String triggerProcess = appConfig.getProperty("trigger.write", "1");
if (StringUtils.equals(triggerProcess, "0")) {
List<TabHaobanTriggerCustomerDetail> customerDetails = triggerCustomerDetailBos
.stream()
.map(item -> {
TabHaobanTriggerCustomerDetail temp = new TabHaobanTriggerCustomerDetail();
BeanUtils.copyProperties(item, temp);
return temp;
})
.collect(Collectors.toList());
triggerCustomerDetailMapper.insertBatch(customerDetails);
}
try {
HoloClient client = holoDataSource.getClient();
if (client == null) {
log.error("数仓数据源链接异常, 请检查!!!!{}", JSON.toJSONString(triggerCustomerDetailBos));
return;
}
TableSchema tableSchema = client.getTableSchema("tab_haoban_trigger_customer_detail");
SerializeConfig serializeConfig = new SerializeConfig();
serializeConfig.setPropertyNamingStrategy(PropertyNamingStrategy.SnakeCase);
// id, enterprise_id, wx_enterprise_id, biz_id, biz_type, clerk_id, staff_id,store_id, channel_type, customer_id, create_time, update_time, delete_flag
List<Put> puts = triggerCustomerDetailBos
.stream()
.map(item -> {
Put temp = new Put(tableSchema);
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(item, serializeConfig));
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
temp.setObject(entry.getKey(), entry.getValue());
}
// 时间戳格式不行
temp.setObject("create_time", DateUtil.dateToStr(item.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
temp.setObject("update_time", DateUtil.dateToStr(item.getUpdateTime(), "yyyy-MM-dd HH:mm:ss"));
return temp;
})
.collect(Collectors.toList());
client.put(puts);
log.info("客户触达写数据组完成 >>>>>");
}catch (Exception ex) {
log.info("数据组写入异常 {}", JSON.toJSONString(triggerCustomerDetailBos), ex);
}
}
/**
......
package com.gic.haoban.manage.service.service.content.message;
import com.alibaba.fastjson.JSON;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import com.gic.dubbo.entity.ProviderLocalTag;
import com.gic.haoban.manage.api.enums.content.MaterialInteractRecordEventType;
import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO;
import com.gic.haoban.manage.service.service.content.adaptor.MessageConvertHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.kafka.clients.consumer.ConsumerRecord;
......@@ -25,6 +28,8 @@ public class InteractRecordMessageListener implements MessageListener<String, St
@Autowired
InteractRecordMessageService interactRecordMessageService;
@Autowired
MessageConvertHelper messageConvertHelper;
private static final List<Integer> dealEventType = new ArrayList<>();
......@@ -40,11 +45,21 @@ public class InteractRecordMessageListener implements MessageListener<String, St
providerLocalTag.traceId = UUID.randomUUID().toString();
String value = consumerRecord.value();
log.info("【InteractRecordMessageListener】处理埋点事件 {}", value);
InteractRecordMessageBO recordMessageBO = JSON.parseObject(value, InteractRecordMessageBO.class);
InteractRecordMessageBO recordMessageBO = messageConvertHelper.convertMessageBo(value);
if (recordMessageBO == null) {
log.info("互动记录解析异常 {}", value);
return;
}
// 过滤环境
Config config = ConfigService.getAppConfig();
String envKey = config.getProperty("bury.point.env.app.key", "");
if (!StringUtils.equalsIgnoreCase(envKey, recordMessageBO.getAppKey())) {
log.info("埋点数据环境不正确 config.env: {}, appKey: {}", envKey, recordMessageBO.getAppKey());
return;
}
if (recordMessageBO.getEventType() == null || !dealEventType.contains(recordMessageBO.getEventType())) {
log.info("埋点事件类型非相关类型 {}", recordMessageBO.getEventType());
return;
......
......@@ -3,6 +3,8 @@ package com.gic.haoban.manage.service.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.ToolUtil;
import com.gic.enterprise.api.dto.StoreGroupDTO;
import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
......@@ -45,6 +47,8 @@ public class StoreRangeServiceImpl implements StoreRangeService {
@Autowired
private StaffClerkRelationService staffClerkRelationService;
@Autowired
private StoreGroupService storeGroupService;
@Override
......@@ -267,4 +271,24 @@ public class StoreRangeServiceImpl implements StoreRangeService {
public List<String> listStoreIdByName(String wxEnterpriseId, String enterpriseId, String storeName) {
return tabHaobanStoreRelationMapper.listStoreIdByName(wxEnterpriseId,enterpriseId,storeName);
}
@Override
public boolean hasStore(String wxEnterpriseId , String enterpriseId, String storeId) {
List<String> storeGroupIds = this.listStoreGroupIdByWxEnterpriseId(wxEnterpriseId, enterpriseId);
if (CollectionUtils.isEmpty(storeGroupIds)) {
logger.info("好办门店分组id为空");
return false ;
}
String[] array = storeGroupIds.toArray(new String[0]);
List<StoreGroupDTO> storeGroupDTOS = storeGroupService.listStoreGroup(array, enterpriseId);
List<String> parentGroupIds = storeGroupDTOS.stream().map(StoreGroupDTO::getParentGroupId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(parentGroupIds) && parentGroupIds.contains("0")) {
logger.info("企微包含所有门店",wxEnterpriseId);
return true ;
}
if(isFlagByStoreId(storeId,wxEnterpriseId,enterpriseId)) {
return true ;
}
return false ;
}
}
......@@ -95,7 +95,6 @@ public class AuditApiServiceImpl implements AuditApiService {
return PageUtil.changePageHelperToCurrentPage(page, AuditDTO.class);
}
@Transactional
@Override
public String audit(String batchId, String auditId, String auditName, String optStaffId) {
TabHaobanAudit tab = auditMapper.selectByPrimaryKey(auditId);
......
......@@ -526,9 +526,10 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
return page;
}
// 同步通讯录
@Override
public String dealQywxDepartment(String taskId, String wxEnterpriseId) {
logger.info("同步通讯录开始={},taskId={}",wxEnterpriseId,taskId);
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null == secretSetting || secretSetting.getCheckFlag() == 0) {
......@@ -732,7 +733,7 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
logger.info("放入mq={},{}",mqName,JSON.toJSONString(listRet));
clientInstance.sendBatchMessages(mqName, listRet, 1);
clientInstance.sendBatchMessages(mqName, listRet, 10);
} catch (Exception e) {
logger.info("发送失败:{},{}", taskId, JSONObject.toJSONString(listRet));
e.printStackTrace();
......@@ -894,8 +895,9 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
this.syncTaskService.updateTaskStatus(taskId,4) ;
}
if(task.getCreateTime().getTime()+1000*60*60*3< System.currentTimeMillis()) {
logger.info("超过3小时taskId={},{}",taskId);
logger.info("超过3小时taskId={}",taskId);
it.remove();
RedisUtil.delLocalCache("department-list-cache-" + task.getWxEnterpriseId());
continue;
}
boolean flag = this.syncDepartmentStaffTask(taskId,type) ;
......@@ -934,7 +936,10 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
TabHaobanSyncTask syncTask = syncTaskService.getSyncTask(taskId);
String wxEnterpriseId = syncTask.getWxEnterpriseId();
this.unlockTask(wxEnterpriseId) ;
this.cleanDiffrence(wxEnterpriseId, taskId);
logger.info("同步通讯录完成");
String conectkey = "get_follow_user_list:"+wxEnterpriseId ;
RedisUtil.delCache(conectkey) ;
RedisUtil.unlock(key);
}
return true ;
......@@ -970,6 +975,8 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
List<String> dataIds = preDealService.listReDataIdByPDataId(taskId, stffId, PreDealTypeEnum.friend.getVal());
if (CollectionUtils.isEmpty(dataIds)) {
logger.info("无第三方的数据/自建");
String staffLockKey = DealSyncOperationApiServiceImpl.FRIEND_LOCK + stffId;
RedisUtil.delCache(staffLockKey);
preDealService.updateStatusByDataId(taskId, stffId, PreDealTypeEnum.friend_clerk.getVal(), PreDealStatusEnum.computed.getVal(), "成功");
} else {
sendToMq(taskId, new HashSet<>(dataIds), SyncTaskStatusEnum.friend_sync,null);
......
......@@ -498,6 +498,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
private void addToMq2Mark(String wxEnterpriseId) {
String key = "qwadd:count2:"+wxEnterpriseId ;
if(null != RedisUtil.getCache("qwadd:count:"+wxEnterpriseId)) {
RedisUtil.delCache("qwadd:count:"+wxEnterpriseId) ;
}
RedisUtil.setCache(key, 1,600L);
}
......
......@@ -205,9 +205,9 @@ public class MessageApiServiceImpl implements MessageApiService {
Set<String> wxSet = Sets.newHashSet(
// 鸿星尔克
"e034e2bd5d0b44d3bf553c9f8204094c",
// 润臣测试环境
// 达摩科技
"b18ffdc9d0644912865a248859914d80",
// 尊兴
// 达摩科技-生产
"fb40256db41142a196b21ccf03e58507",
// 金华悦行
"ac451a350eed4a96958dd5c7377f8bd9");
......@@ -243,7 +243,15 @@ public class MessageApiServiceImpl implements MessageApiService {
log.info("职务名称:position:{}", position);
clerkQwDTO.setClerkType(StringUtils.isBlank(position) ? 0 : position.contains("店长") ? 1 : 0);
clerkQwDTO.setClerkGener(dto.getGender());
clerkQwDTO.setPhoneNumber(dto.getMobile());
if(StringUtils.isBlank(dto.getMobile()) && dto.getUserid().startsWith("51") && dto.getUserid().length()==12) {
clerkQwDTO.setPhoneNumber(dto.getUserid().substring(1));
}else {
clerkQwDTO.setPhoneNumber(dto.getMobile());
}
if(StringUtils.isBlank(clerkQwDTO.getPhoneNumber())) {
log.info("导购手机号不存在{}",dto.getUserid());
return ;
}
clerkQwDTO.setNationcode(dto.getTelephone());
// 调用换导购接口逻辑
clerkService.syncClerkForQw(clerkQwDTO);
......
......@@ -25,6 +25,7 @@ import com.gic.haoban.manage.service.util.DingUtils;
import com.gic.member.api.dto.MemberTagDTO;
import com.gic.member.api.service.MemberTagService;
import com.gic.member.tag.api.dto.MemberTagItemDTO;
import com.gic.member.tag.api.service.MemberTagApiService;
import com.gic.member.tag.api.service.MemberTagItemApiService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil;
......@@ -89,6 +90,8 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
private MemberTagItemApiService memberTagItemApiService;
@Autowired
private QywxTagRelationMapper qywxTagRelationMapper;
@Autowired
private MemberTagApiService memberTagApiService;
@Override
public void pullQywxTag(String wxEnterpriseId) {
......@@ -111,13 +114,42 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
@Override
public ServiceResponse syncTagToQywx(String wxEnterpriseId, String enterpriseId, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items) {
logger.info("保存标签同步");
String memberTagId = infoDTO.getMemberTagId() ;
logger.info("标签同步到企业微信,wxEnterpriseId={},memberTagId={}",wxEnterpriseId,memberTagId);
List<MemberTagItemDTO> tagItems = memberTagApiService.queryMemberTagItem(memberTagId);
items = tagItems.stream().map(item -> {
QywxTagItemDTO mid = new QywxTagItemDTO();
mid.setMemberTagItemId(item.getTagItemId());
mid.setQywxTagKey(item.getTagItemId());
mid.setQywxTagName(item.getTagItemName());
return mid;
}).collect(Collectors.toList());
ServiceResponse ret = new ServiceResponse();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
// 如果
List<TabQywxTagRelation> list = this.qywxTagRelationMapper.listByMemberTagId(wxEnterpriseId,infoDTO.getMemberTagId()) ;
if(CollectionUtils.isNotEmpty(list) && list.size() >= items.size()) {
logger.info("标签已存在,直接处理会员");
// 判断更新
List<QywxTagItemDTO> needAddList = new ArrayList<>() ;
List<TabQywxTagRelation> relationList = this.qywxTagRelationMapper.listByMemberTagId(wxEnterpriseId,memberTagId) ;
if(CollectionUtils.isNotEmpty(relationList)) {
String hbTagId = relationList.get(0).getQywxTagId() ;
TabQywxTag tag = this.qywxTagService.getQywxTagByQywxTagId(wxEnterpriseId,hbTagId) ;
String qwGroupKey = tag.getQywxGroupKey() ;
logger.info("已经存在企微标签,进行更新处理={}",qwGroupKey);
QywxGetCorpTagListDTO tagListDTO = this.qywxSuiteApiService.getCorpTagList(qwDTO.getThirdCorpid(),qwDTO.getSelf3thSecret(),Arrays.asList(qwGroupKey),0,qwDTO.isSelf(),qwDTO.getUrlHost()) ;
logger.info("企微侧标签={}",JSONObject.toJSONString(tagListDTO));
// 更新赋值
infoDTO.setQywxGroupKey(qwGroupKey);
// 需要添加的标签值
List<String> existMemberTagIdList = relationList.stream().map(o->o.getTagItemId()).collect(Collectors.toList());
for(QywxTagItemDTO memberTag : items) {
if(!existMemberTagIdList.contains(memberTag.getMemberTagItemId())) {
needAddList.add(memberTag) ;
}
}
items = needAddList ;
logger.info("更新标签,新增={}",needAddList);
}
if(CollectionUtils.isEmpty(items)) {
logger.info("没有需要处理的标签");
return ret ;
}
//调用企业微信接口保存
......@@ -140,7 +172,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
return ret;
}
//保存关联关系
saveRelation(wxEnterpriseId, enterpriseId, infoDTO, items, savePair);
this.saveRelation(wxEnterpriseId, enterpriseId, infoDTO, items, savePair);
return ret;
}
......@@ -183,7 +215,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
itemRelation.setMemberTagId(infoDTO.getMemberTagId());
itemRelation.setEnterpriseId(enterpriseId);
itemRelation.setQywxTagItemId(tab.getQywxTagItemId());
itemRelation.setTagItemId(orgItem.getQywxTagKey());
itemRelation.setTagItemId(orgItem.getMemberTagItemId());
return itemRelation;
}).collect(Collectors.toList());
saveRelationList.addAll(itemList);
......@@ -192,8 +224,6 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
/**
* 调用企业微信接口 保存标签
*
* @param wxEnterpriseDTO
* @param infoDTO
* @param items
* @return
......
......@@ -46,6 +46,7 @@ import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.chat.GroupChatService;
import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderAccountService;
import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderService;
import com.gic.haoban.manage.service.util.DingUtils;
import com.gic.haoban.manage.service.util.EmojiFilterUtil;
import com.gic.redis.data.util.RedisUtil;
import com.gic.thirdparty.cloudfile.CloudFileUtil;
......@@ -248,8 +249,12 @@ public class StaffApiServiceImpl implements StaffApiService {
}
}
@Override
public ServiceResponse getWxSaveNew(String wxUserId, String wxEnterpriseId) {
return this.getWxSaveNew(wxUserId,wxEnterpriseId,false) ;
}
@Override
public ServiceResponse getWxSaveNew(String wxUserId, String wxEnterpriseId,boolean isSyncDepart) {
ServiceResponse res = new ServiceResponse();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (null == qwDTO) {
......@@ -299,22 +304,7 @@ public class StaffApiServiceImpl implements StaffApiService {
TabHaobanStaff staff = new TabHaobanStaff();
List<StaffDTO> staffDTOList = staffService.listByUserIdsAndWxEnterpriseId(Lists.newArrayList(wxUserId,openUserid), wxEnterpriseId);
if (CollUtil.isNotEmpty(staffDTOList) && staffDTOList.size()>1) {
//只保留一个staff
for (int i =0;i<staffDTOList.size()-1;i++){
StaffDTO dto = staffDTOList.get(i);
String staffId = dto.getStaffId();
// 员工解绑
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService
.listByStaffId(wxEnterpriseId, staffId);
if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) {
for (StaffClerkRelationDTO staffClerkRelationDTO : staffClerkRelationDTOS) {
staffClerkRelationService.delBind(staffId, staffClerkRelationDTO.getClerkId(),
ChannelCodeEnum.ADMIN_UNBIND.getCode(),null, wxEnterpriseId);
}
}
this.staffService.delByStaffId(staffId);
staffDTOList.remove(i);
}
com.gic.haoban.common.utils.DingUtils.send("告警【多条重复staff】,企业ID"+wxEnterpriseId,true);
}
if (CollUtil.isNotEmpty(staffDTOList)){
staff = JSONObject.parseObject(JSONObject.toJSONString(staffDTOList.get(0)), TabHaobanStaff.class);
......@@ -348,8 +338,7 @@ public class StaffApiServiceImpl implements StaffApiService {
staff.setQrCode(qr_code);
}
//判断成员是否开启联系我
if (this.openConcatFlag(wxEnterpriseId,wxUserId)) {
logger.info("成员开启联系我");
if (this.openConcatFlag(wxEnterpriseId,wxUserId,isSyncDepart,qwDTO)) {
staff.setOpenConcatFlag(1);
}
//成员更改或更新
......@@ -369,15 +358,27 @@ public class StaffApiServiceImpl implements StaffApiService {
res.setResult(staff.getStaffName());
return res;
}
private Boolean openConcatFlag(String wxEnterpriseId,String userId){
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
//企微已经开启联系我
private Boolean openConcatFlag(String wxEnterpriseId,String userId , boolean isSyncDepart,WxEnterpriseQwDTO qwDTO){
List<String> wxUserIdsList = null ;
//企微已经开启联系我
Boolean flag = false;
if(qwDTO.isSelf()) {
wxUserIdsList = qywxUserApiService.listCorpExternalUserSelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(),qwDTO.getUrlHost());
}else {
wxUserIdsList = qywxUserApiService.listCorpExternalUser(qwDTO.getThirdCorpid(), config.getWxSuiteid());
String key = "get_follow_user_list:"+wxEnterpriseId ;
if(isSyncDepart) {
Object o = RedisUtil.getCache(key) ;
if(null != o) {
logger.info("从缓存中获取联系我列表={}",wxEnterpriseId);
wxUserIdsList = (List<String>) o ;
}
}
if(null == wxUserIdsList) {
if(qwDTO.isSelf()) {
wxUserIdsList = qywxUserApiService.listCorpExternalUserSelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(),qwDTO.getUrlHost());
}else {
wxUserIdsList = qywxUserApiService.listCorpExternalUser(qwDTO.getThirdCorpid(), config.getWxSuiteid());
}
if(isSyncDepart) {
RedisUtil.setCache(key,wxUserIdsList,60*60L);
}
}
if (CollUtil.isNotEmpty(wxUserIdsList) && wxUserIdsList.contains(userId)) {
logger.info("成员开启联系我");
......
......@@ -75,7 +75,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Autowired
private HmQrcodeService hmQrcodeService;
@Autowired
private Config config;
private StoreRangeService storeRangeService;
@Override
public void bindLogMq(String params) {
......@@ -303,17 +303,18 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public ServiceResponse wxBindStaffClerk(StaffClerkRelationDTO staffClerkRelation, String optStaffId, int channelCode) {
Integer manageFlag = staffClerkRelation.getManageFlag();
if (manageFlag != null && manageFlag == 1) {
if (manageFlag != null && manageFlag.intValue() == 1) {
ServiceResponse serviceResponse = getManageFlagBind(staffClerkRelation);
if (!serviceResponse.isSuccess()) {
return serviceResponse;
}
}
String staffId = staffClerkRelation.getStaffId();
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listManageBindByStaffId(staffId);
if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) {
logger.info("该导购已绑定区经,不允许绑定导购");
return ServiceResponse.failure("3", "该导购已绑定区经,不允许绑定导购");
}else {
String staffId = staffClerkRelation.getStaffId();
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listManageBindByStaffId(staffId);
if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) {
logger.info("该导购已绑定区经,不允许绑定导购");
return ServiceResponse.failure("3", "该导购已绑定区经,不允许绑定导购");
}
}
if (StringUtils.isNotBlank(staffClerkRelation.getStaffClerkRelationId())) {
TabHaobanStaffClerkRelation oldStaffClerkRelation = tabHaobanStaffClerkRelationMapper.selectByPrimaryKey(staffClerkRelation.getStaffClerkRelationId());
......@@ -513,11 +514,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
logger.info("导购未关联成员,oldClerkId={}", oldClerkId);
return;
}
/* StaffClerkRelationDTO oldRelationDTO = staffClerkRelationService.getByClerkId(oldClerkId);
if (null == oldRelationDTO) {
logger.info("导购未关联成员,clerkCode={}", clerkCode);
return;
}*/
// 如果新门店未关联好办,进行解绑
boolean hasFlag = this.storeRangeService.hasStore(oldRelationDTO.getWxEnterpriseId(),enterpriseId,clerkDTO.getStoreId()) ;
if(!hasFlag) {
logger.info("新门店未关联好办,storeId={}",clerkDTO.getStoreId());
staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.STORE_CHANGE_UNBIND.getCode(), null,null);
return ;
}
logger.info("导购门店转移,老的绑定导购id={}", oldRelationDTO.getClerkId());
this.moveOrAddClerk(clerkSyncQDTO, oldRelationDTO);
} else if (type == 3) {
......
......@@ -730,4 +730,9 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
public int getRelationCount(String enterpriseId) {
return this.wxEnterpriseRelatedService.getRelationCount(enterpriseId);
}
@Override
public com.gic.api.base.commons.ServiceResponse<Integer> getEnterprieseQwType(String enterpriseId) {
return this.wxEnterpriseRelatedService.getEnterprieseQwType(enterpriseId);
}
}
......@@ -304,6 +304,10 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
appOrderEndTime = now;
}
logger.info("已购买付费应用的到期时间:{},合同到期时间:{}",DateUtil.dateToStr(appOrderEndTime,DateUtil.FORMAT_DATETIME_19),DateUtil.dateToStr(endTime,DateUtil.FORMAT_DATETIME_19));
//如果过期时间小于当前时间,取当前时间
if (now.after(appOrderEndTime)){
appOrderEndTime = now;
}
int i = DateUtil.daysBetween(appOrderEndTime, endTime);
if(i< 0){
i = 0;
......
......@@ -527,25 +527,44 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
// 查询企微下 导购、店长、区经 的role_id
String wxEnterpriseId = wxEnterpris.getWxEnterpriseId();
// 处理商户权限
handlerMaterchant(contentMaterialROleInitQDTO, wxEnterpriseId);
handlerMerchant(contentMaterialROleInitQDTO, wxEnterpriseId);
}
return ServiceResponse.success();
}
private void handlerMaterchant(ContentMaterialROleInitQDTO contentMaterialROleInitQDTO, String wxEnterpriseId) {
private void handlerMerchant(ContentMaterialROleInitQDTO contentMaterialROleInitQDTO, String wxEnterpriseId) {
// 运维 + 好办后台
List<HaobanRoleBO> haobanRoleBOS = haobanRoleService.getListByWxEnterpriseId(wxEnterpriseId, null);
if (CollectionUtils.isEmpty(haobanRoleBOS)) {
logger.info("企业{} 企微 {} 下没有角色 ", contentMaterialROleInitQDTO.getEnterpriseId(), wxEnterpriseId);
return;
}
// 为role 添加菜单
if (contentMaterialROleInitQDTO.getOldVersion() != null
&& MaterialEnterpriseAdaptor.MaterialLevel.HIGH.getCode().equals(contentMaterialROleInitQDTO.getOldVersion())
&& MaterialEnterpriseAdaptor.MaterialLevel.LOW.getCode().equals(contentMaterialROleInitQDTO.getVersion()) ) {
logger.info("从高级版到低级版, 菜单不做调整 {}", JSON.toJSONString(contentMaterialROleInitQDTO));
return;
}
List<TabHaobanRoleMenu> haobanRoleMenus = new ArrayList<>();
for (HaobanRoleBO haobanRoleBO : haobanRoleBOS) {
List<String> menuCodes = menuCodeMap.get(haobanRoleBO.getClerkType() + "" + contentMaterialROleInitQDTO.getVersion());
if (CollectionUtils.isEmpty(menuCodes)) {
continue;
}
// 处理当前版本 如果是低到高 只处理版本差异的
if (contentMaterialROleInitQDTO.getOldVersion() != null
&& MaterialEnterpriseAdaptor.MaterialLevel.LOW.getCode().equals(contentMaterialROleInitQDTO.getOldVersion())
&& MaterialEnterpriseAdaptor.MaterialLevel.HIGH.getCode().equals(contentMaterialROleInitQDTO.getVersion())) {
// 从低版本 升级到 高版本, 此时菜单code只取 版本 差异的菜单
List<String> lowMenuCodes = menuCodeMap.get(haobanRoleBO.getClerkType() + "" + contentMaterialROleInitQDTO.getOldVersion());
List<String> highMenuCodes = menuCodeMap.get(haobanRoleBO.getClerkType() + "" + contentMaterialROleInitQDTO.getVersion());
if (CollectionUtils.isEmpty(highMenuCodes) || CollectionUtils.isEmpty(lowMenuCodes)) {
continue;
}
menuCodes = highMenuCodes
.stream()
.filter(item -> !lowMenuCodes.contains(item))
.collect(Collectors.toList());
}
logger.info("本次对应的menuCode:{}", JSON.toJSONString(menuCodes));
List<String> hasExistMenuCodes = haobanRoleMenuService.getByWxEnterpriseIdAndRoleId(wxEnterpriseId, haobanRoleBO.getRoleId());
if (CollectionUtils.isEmpty(hasExistMenuCodes)) {
......@@ -568,6 +587,29 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
.collect(Collectors.toList());
logger.info("企微:{} roleId:{} 新增权限code: {}", wxEnterpriseId, haobanRoleBO.getRoleId(), JSON.toJSONString(tabHaobanRoleMenus));
haobanRoleMenus.addAll(tabHaobanRoleMenus);
if (haobanRoleBO.getSystemFlag() == 0) {
// 处理只加运维权限逻辑
List<String> adminMenuCodes = superManagementMenuCode.get(haobanRoleBO.getClerkType() + "" + contentMaterialROleInitQDTO.getVersion());
if (CollectionUtils.isNotEmpty(adminMenuCodes)) {
List<TabHaobanRoleMenu> roleMenus = adminMenuCodes
.stream()
.filter(item -> StringUtils.isNotBlank(item) && !excludeMenuCodes.contains(item))
.map(item -> {
TabHaobanRoleMenu temp = new TabHaobanRoleMenu();
temp.setRoleMenuId(UniqueIdUtils.uniqueLong());
temp.setRoleId(haobanRoleBO.getRoleId());
temp.setWxEnterpriseId(wxEnterpriseId);
temp.setStatusFlag(1);
temp.setMenuCode(item);
temp.setCreateTime(new Date());
temp.setUpdateTime(new Date());
return temp;
})
.collect(Collectors.toList());
haobanRoleMenus.addAll(roleMenus);
}
}
}
logger.info("企微:{} 新增权限code: {}", wxEnterpriseId, JSON.toJSONString(haobanRoleMenus));
if (CollectionUtils.isNotEmpty(haobanRoleMenus)) {
......@@ -576,6 +618,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
}
private static final Map<String, List<String> > menuCodeMap = new HashMap<>();
private static final Map<String, List<String>> superManagementMenuCode = new HashMap<>();
static {
// 导购
......@@ -591,7 +634,15 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
// 区经
menuCodeMap.put("2" + ContentMaterialROleInitQDTO.Version.LOW.getCode(), Arrays.asList("materialMain", "commodityCenter", "commodityCenterTab", "materialCenterTab", "goodsDetail_material", "goodsCenter_Count", "materialManage","AICreate"));
menuCodeMap.put("2" + ContentMaterialROleInitQDTO.Version.HIGH.getCode(), Arrays.asList("materialMain", "commodityCenter", "commodityCenterTab", "materialCenterTab",
"goodsDetail_material", "goodsCenter_Count", "materialManage", "publishMaterial", "userCenter_createCenter","AICreate"));
"goodsDetail_material", "goodsCenter_Count", "materialManage", "publishMaterial", "userCenter_createCenter"));
// 只添加(勾选)好办运维权限 不加商户权限
superManagementMenuCode.put("0" + ContentMaterialROleInitQDTO.Version.LOW.getCode(), Arrays.asList("knowledgeBase"));
superManagementMenuCode.put("0" + ContentMaterialROleInitQDTO.Version.HIGH.getCode(), Arrays.asList("knowledgeBase"));
superManagementMenuCode.put("1" + ContentMaterialROleInitQDTO.Version.LOW.getCode(), Arrays.asList("knowledgeBase"));
superManagementMenuCode.put("1" + ContentMaterialROleInitQDTO.Version.HIGH.getCode(), Arrays.asList("knowledgeBase"));
superManagementMenuCode.put("2" + ContentMaterialROleInitQDTO.Version.LOW.getCode(), Arrays.asList("knowledgeBase"));
superManagementMenuCode.put("2" + ContentMaterialROleInitQDTO.Version.HIGH.getCode(), Arrays.asList("knowledgeBase"));
}
......@@ -608,28 +659,24 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
// 获取所有开通内容高级版的企业
List<String> enterpriseIds = materialEnterpriseAdaptor.queryHasRightEnterpriseIds(MaterialEnterpriseAdaptor.MaterialLevel.LOW.getCode());
// 执行刷新权限
String enterpriseId = "";
if (StringUtils.isNotBlank(params) && !StringUtils.equals("-1", params)) {
enterpriseId = params;
}
List<String> menuCodes = new ArrayList<>();
menuCodes.add("AICreate");
menuCodes.add("knowledgeBase");
for (String tempId : enterpriseIds) {
if (StringUtils.isNotBlank(enterpriseId) && !StringUtils.equalsIgnoreCase(enterpriseId, tempId)) {
logger.info("【flushRightOneTime】当前企业:{} 不是目标企业:{}, 忽略", tempId, enterpriseId);
continue;
}
ContentMaterialROleInitQDTO contentMaterialROleInitQDTO = new ContentMaterialROleInitQDTO();
contentMaterialROleInitQDTO.setEnterpriseId(tempId);
contentMaterialROleInitQDTO.setVersion(MaterialEnterpriseAdaptor.MaterialLevel.HIGH.getCode());
logger.info("【flushRightOneTime】添加企业素材纬度权限: {}", JSON.toJSONString(contentMaterialROleInitQDTO));
logger.info("【flushRightOneTime】添加企业素材纬度权限: {}", tempId);
// 查询企业下所有的微信企业id
List<TabHaobanWxEnterprise> tabHaobanWxEnterprises = wxEnterpriseRelatedService.listByEnterpriseId(contentMaterialROleInitQDTO.getEnterpriseId());
List<TabHaobanWxEnterprise> tabHaobanWxEnterprises = wxEnterpriseRelatedService.listByEnterpriseId(tempId);
if (CollectionUtils.isEmpty(tabHaobanWxEnterprises)) {
logger.info("【flushRightOneTime】企业 {} 未关联企微 ", contentMaterialROleInitQDTO.getEnterpriseId());
logger.info("【flushRightOneTime】企业 {} 未关联企微 ", tempId);
continue;
}
......@@ -637,10 +684,10 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
// 查询企微下 导购、店长、区经 的role_id
String wxEnterpriseId = wxEnterpris.getWxEnterpriseId();
// 处理商户权限
// 运维 + 好办后台
List<HaobanRoleBO> haobanRoleBOS = haobanRoleService.getListByWxEnterpriseId(wxEnterpriseId, null);
// 运维
List<HaobanRoleBO> haobanRoleBOS = haobanRoleService.getListByWxEnterpriseId(wxEnterpriseId, 0);
if (CollectionUtils.isEmpty(haobanRoleBOS)) {
logger.info("【flushRightOneTime】企业{} 企微 {} 下没有角色 ", contentMaterialROleInitQDTO.getEnterpriseId(), wxEnterpriseId);
logger.info("【flushRightOneTime】企业{} 企微 {} 下没有角色 ", tempId, wxEnterpriseId);
continue;
}
logger.info("【flushRightOneTime】企业 {} 企微 {} 下角色个数: {}", enterpriseId, wxEnterpriseId, haobanRoleBOS.size());
......
......@@ -61,7 +61,7 @@ public class QywxStaffSyncOperation implements BaseSyncOperation {
try {
String taskId = dataPre.getTaskId() ;
String wxUserId = dealParamMqDTO.getData() ;
ServiceResponse response = staffApiService.getWxSaveNew(wxUserId, dataPre.getWxEnterpriseId());
ServiceResponse response = staffApiService.getWxSaveNew(wxUserId, dataPre.getWxEnterpriseId(),true);
if (response.getCode() != 1) {
dealFlag = false;
reason = response.getMessage();
......
......@@ -169,7 +169,7 @@ public class SelfFriendSyncNewOperation implements BaseSyncOperation {
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
Log.info("发送队列SelfFriendSyncNewOperation={}",JSON.toJSONString(ret));
clientInstance.sendBatchMessages("departmentSyncDealMq2", ret);
clientInstance.sendBatchMessages("departmentSyncDealMq", ret);
} catch (Exception e) {
logger.info("发送失败:{},{}", taskId);
e.printStackTrace();
......
......@@ -12,7 +12,7 @@
<constructor-arg>
<map>
<entry key="bootstrap.servers" value="${kafka.data.service}"/>
<entry key="group.id" value="haoban-3-data"/>
<entry key="group.id" value="${kafka.data.group}"/>
<entry key="key.deserializer"
value="org.apache.kafka.common.serialization.StringDeserializer"/>
<entry key="value.deserializer"
......
......@@ -27,10 +27,11 @@
<!-- from tab_haoban_qywx_tag_relation-->
<!-- where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR}-->
<!-- </select>-->
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tab_haoban_qywx_tag_relation
<update id="deleteByPrimaryKey" parameterType="java.lang.String">
update tab_haoban_qywx_tag_relation set status_flag = 0 , update_time =now()
where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR}
</delete>
</update>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagRelation">
insert into tab_haoban_qywx_tag_relation (qywx_tag_relation_id, wx_enterprise_id,
enterprise_id, member_tag_id, tag_item_id,
......
......@@ -92,7 +92,7 @@
<include refid="Base_Column_List"/>
from tab_haoban_qywx_fee_order_account
where wx_enterprise_id = #{wxEnterpriseId}
and status in (1,4)
and status in (1)
</select>
<update id="updateByActiveCode">
......
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerBO;
import com.gic.haoban.manage.service.pojo.bo.content.TriggerCustomerDetailBO;
import com.gic.haoban.manage.service.pojo.qo.content.PotentialCustomerQO;
import com.gic.haoban.manage.service.service.MemberQueryService;
import com.gic.haoban.manage.service.service.content.PotentialCustomerService;
import com.gic.haoban.manage.service.service.content.TriggerCustomerDetailService;
import com.gic.member.api.dto.MemberDTO;
import com.gic.member.api.service.MemberService;
import org.junit.Test;
......@@ -13,6 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Collections;
import java.util.Date;
/**
* @Author MUSI
* @Date 2023/3/30 10:15 PM
......@@ -29,6 +37,8 @@ public class PotentialCustomerServiceTest {
private MemberService memberService;
@Autowired
MemberQueryService memberQueryService;
@Autowired
private TriggerCustomerDetailService triggerCustomerDetailService;
String eid = "ff8080815dacd3a2015dacd3ef5c0000";
String wxEid = "ca66a01b79474c40b3e7c7f93daf1a3b";
......@@ -56,4 +66,32 @@ public class PotentialCustomerServiceTest {
JSONObject jsonObject = memberQueryService.queryDataSingle(eid, "ff8080818215878101821949a845003c", null);
System.out.println(jsonObject.toJSONString());
}
@Test
public void triggerTest(){
TriggerCustomerDetailBO triggerCustomerDetailBO = new TriggerCustomerDetailBO();
triggerCustomerDetailBO.setId(UniqueIdUtils.uniqueLong());
triggerCustomerDetailBO.setCustomerId("dadadada");
triggerCustomerDetailBO.setEnterpriseId(eid);
triggerCustomerDetailBO.setWxEnterpriseId(wxEid);
triggerCustomerDetailBO.setBizId("musidanxieru091210");
triggerCustomerDetailBO.setBizType(1);
triggerCustomerDetailBO.setClerkId(clerkId);
triggerCustomerDetailBO.setStaffId(staffId);
triggerCustomerDetailBO.setStoreId(staffId);
triggerCustomerDetailBO.setChannelType(1);
triggerCustomerDetailBO.setCustomerId(staffId);
triggerCustomerDetailBO.setCreateTime(new Date());
triggerCustomerDetailBO.setUpdateTime(new Date());
triggerCustomerDetailBO.setDeleteFlag(1);
triggerCustomerDetailBO.setId(UniqueIdUtils.uniqueLong());
triggerCustomerDetailService.batchSave(Collections.singletonList(triggerCustomerDetailBO));
triggerCustomerDetailBO.setId(UniqueIdUtils.uniqueLong());
triggerCustomerDetailBO.setBizId("musidanxieru091211");
triggerCustomerDetailService.batchSave(Collections.singletonList(triggerCustomerDetailBO));
long time = new Date().getTime();
System.out.println((int)time);
}
}
import com.alibaba.fastjson.JSON;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.dto.QywxTagInfoDTO;
import com.gic.haoban.manage.api.dto.QywxTagItemDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.manage.api.service.QywxTagApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.hm.HmClerkRelationService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactDTO;
import org.apache.commons.collections.CollectionUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class TagTest3 {
@Autowired
private QywxTagApiService qywxTagApiService ;
@Autowired
private HmQrcodeService hmQrcodeService ;
@Autowired
private WxEnterpriseService wxEnterpriseService ;
@Autowired
private Config config ;
@Autowired
private HmClerkRelationService hmClerkRelationService ;
@Autowired
private ExternalClerkRelatedApiService externalClerkRelatedApiService ;
@Test
public void tt() throws InterruptedException {
// String wxEnterpriseId, String enterpriseId, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items
String wxEnterpriseId = "ca66a01b79474c40b3e7c7f93daf1a3b" ;
String enterpriseId = "ff8080815dacd3a2015dacd3ef5c0000" ;
QywxTagInfoDTO infoDTO = new QywxTagInfoDTO() ;
infoDTO.setWxEnterpriseId(wxEnterpriseId);
infoDTO.setMemberTagId("5b1db406e21748e88737a4cbe194d24f");
List<QywxTagItemDTO> items = new ArrayList<>() ;
QywxTagItemDTO mid = new QywxTagItemDTO();
mid.setMemberTagItemId("0f08ddb354654638bc8f71ce39fce688");
mid.setQywxTagName("企微1");
items.add(mid) ;
QywxTagItemDTO mid2 = new QywxTagItemDTO();
mid2.setMemberTagItemId("1e3f324af76842a0a3b7697f95419414");
mid2.setQywxTagName("企微2");
items.add(mid2) ;
QywxTagItemDTO mid3 = new QywxTagItemDTO();
mid3.setMemberTagItemId("qw5");
mid3.setQywxTagKey("qw5");
mid3.setQywxTagName("企微5");
items.add(mid3) ;
this.qywxTagApiService.syncTagToQywx(wxEnterpriseId,enterpriseId,infoDTO,items) ;
}
}
......@@ -336,7 +336,7 @@ public class DepartmentContoller extends WebBaseController {
Object cache = RedisUtil.getLocalCache("department-list-cache-" + wxEnterpriseId);
if (null == cache) {
List<DepartmentShortDTO> list = departmentApiService.listAllDepartment(wxEnterpriseId);
RedisUtil.setLocalCache("department-list-cache-" + wxEnterpriseId, list, -1L);
RedisUtil.setLocalCache("department-list-cache-" + wxEnterpriseId, list, 60*60*24L);
return resultResponse(HaoBanErrCode.ERR_1, list);
} else {
return resultResponse(HaoBanErrCode.ERR_1, cache);
......
......@@ -20,6 +20,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import com.gic.haoban.manage.api.service.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RRateLimiter;
......@@ -48,13 +49,6 @@ import com.gic.haoban.manage.api.dto.WxApplicationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.MaidianLogApiService;
import com.gic.haoban.manage.api.service.QwFriendApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.TestApiService;
import com.gic.haoban.manage.api.service.WxApplicationApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.api.service.out.SecretSettingApiService;
import com.gic.haoban.manage.web.config.Config;
......@@ -103,8 +97,7 @@ public class TestController extends WebBaseController {
private QywxCorpApiService qywxCorpApiService;
@Autowired
private QwFriendApiService qwFriendApiService ;
@RequestMapping("/qwcode")
public HaobanResponse qwcode(String enterpriseId, String unionid,String openid,String wxaUnionid ,String code) {
return this.resultResponse(HaoBanErrCode.ERR_0,code);
......
......@@ -166,6 +166,12 @@ public class GroupChatController {
qdto.setEnterpriseId(loginUser.getEnterpriseId());
qdto.setSearchParams(searchParams);
qdto.setUserType(userType);
if(null == startDate || null == endDate) {
return RestResponse.failure("9999","时间不能为空");
}
if(DateUtil.daysBetween(startDate,endDate) >= 32) {
return RestResponse.failure("9999","导出区间不能超过一个月");
}
qdto.setStartDate(startDate);
qdto.setEndDate(endDate);
qdto.setStatus(status);
......
......@@ -14,7 +14,6 @@
<dubbo:application name="haoban-manage3-web"/>
<dubbo:protocol name="dubbo" port="30009"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseActiveDataApiService" id="wxEnterpriseActiveDataApiService" timeout="10000"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DownloadReportService" id="downloadReportService" timeout="10000"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.chat.GroupChatDataApiService" id="groupChatDataApiService" timeout="10000"/>
......
package com.gic.haoban.manage.web.controller;
import com.alibaba.fastjson.JSON;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.common.utils.CheckSmsCodeUtil;
import com.gic.haoban.common.utils.GooglePhoneNumberUtil;
......@@ -24,9 +25,8 @@ public class SendCodeController extends WebBaseController {
@Autowired
private ValidationCodeApiService validationCodeService;
@Autowired
private StoreService storeService;
private ClerkService clerkService ;
/**
* 验证码发送
......@@ -36,7 +36,7 @@ public class SendCodeController extends WebBaseController {
*/
@RequestMapping("/send-code")
public HaobanResponse sendCode(String phoneNumber, @RequestParam(defaultValue = "86") String nationcode,
Integer type, @RequestParam(defaultValue = "0") int isTest, String wxEnterpriseId, String staffId,
Integer type, String wxEnterpriseId, String staffId,
String storeId, String clerkId) {
logger.info("短信验证码发送:wxEnterpriseId:{},storeId:{},staffId:{}", wxEnterpriseId, storeId, staffId);
if (StringUtils.isBlank(phoneNumber) || null == type) {
......@@ -70,26 +70,18 @@ public class SendCodeController extends WebBaseController {
CheckSmsCodeUtil.cacheSmsCode(nationcode + "-" + phoneNumber, smsCode, type);
}
logger.info("{}-{} 的 验证码:{}", nationcode, phoneNumber, smsCode);
//非测试
if (isTest != 1) {
SendSmsResponse smsResponse = null;
if (StringUtils.isAnyBlank(storeId, clerkId)) {
smsResponse = validationCodeService.sendValidationCode(nationcode, phoneNumber, smsCode);
} else {
StoreDTO storeDTO = storeService.getStore(storeId);
smsResponse = validationCodeService.sendValidationCodeHb3(nationcode, phoneNumber, smsCode, storeDTO.getEnterpriseId(), storeId, clerkId, true);
}
logger.info("{}-{} 的 验证码 发送结果回执:{}", nationcode, phoneNumber, JSON.toJSONString(smsResponse));
if (!smsResponse.isSuccess()) {
HaobanResponse response = new HaobanResponse();
response.setMessage(smsResponse.getMessage());
response.setErrorCode(HaoBanErrCode.ERR_13.getCode());
return response;
}
return resultResponse(HaoBanErrCode.ERR_1);
} else {
return resultResponse(HaoBanErrCode.ERR_1, smsCode);
SendSmsResponse smsResponse = null;
ClerkDTO clerk = this.clerkService.getClerkByClerkId(clerkId) ;
smsResponse = validationCodeService.sendValidationCodeHb3(nationcode, phoneNumber, smsCode, clerk.getEnterpriseId(), storeId, clerkId, true);
logger.info("{}-{} 的 验证码 发送结果回执:{}", nationcode, phoneNumber, JSON.toJSONString(smsResponse));
if (!smsResponse.isSuccess()) {
HaobanResponse response = new HaobanResponse();
response.setMessage(smsResponse.getMessage());
response.setErrorCode(HaoBanErrCode.ERR_13.getCode());
return response;
}
return resultResponse(HaoBanErrCode.ERR_1);
}
/**
......
......@@ -937,7 +937,7 @@ public class WxStaffController extends WebBaseController {
}
String storeId = "";
String storeName = "";
if (manageFlag != null && manageFlag == 1) {
if (manageFlag != null && manageFlag.intValue() == 1) {
// 区经无门店
} else {
storeId = clerk.getStoreId();
......
package com.gic.haoban.manage.web.controller.content;
import cn.hutool.core.util.ObjectUtil;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.content.api.dto.comment.ListCommentDTO;
import com.gic.content.api.dto.comment.ListSonCommentDTO;
import com.gic.content.api.dto.comment.SonCommentInfoDTO;
import com.gic.content.api.enums.MaterialPurposeEnum;
import com.gic.content.api.enums.UserTypeEnum;
import com.gic.content.api.qdto.comment.ListMobileCommentQDTO;
import com.gic.content.api.qdto.comment.SaveCommentQDTO;
import com.gic.content.api.service.ContentMaterialCommentApiService;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.enums.HaobanClerkTypeEnum;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.web.qo.content.comment.CommentCountQO;
import com.gic.haoban.manage.web.qo.content.comment.CommentInfoVO;
import com.gic.haoban.manage.web.qo.content.comment.SaveCommentQO;
import com.gic.haoban.manage.web.qo.content.comment.SonCommentInfoVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 好办-知识库-评论
* @Author MUSI
* @Date 2023/9/19 3:16 PM
* @Description
* @Version
**/
@RestController
@RequestMapping(path = "/comment")
public class CommentController {
@Autowired
private ContentMaterialCommentApiService contentMaterialCommentApiService;
@Autowired
private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired
private StaffApiService staffApiService;
/**
* 评论总数(包含子评论)
* @return
*/
@RequestMapping(path = "/count-comment")
public RestResponse<Integer> countContentComment(CommentCountQO commentCountQO) {
ListMobileCommentQDTO mobileCommentQDTO = new ListMobileCommentQDTO();
mobileCommentQDTO.setEnterpriseId(commentCountQO.getEnterpriseId());
mobileCommentQDTO.setContentMaterialId(commentCountQO.getContentMaterialId());
mobileCommentQDTO.setMemberId(commentCountQO.getClerkId());
mobileCommentQDTO.setMaterialPurpose(3);
ServiceResponse<Integer> serviceResponse = contentMaterialCommentApiService.countCommentForWechat(mobileCommentQDTO);
return RestResponse.successResult(serviceResponse.getResult());
}
/**
* 评论列表
* @param commentCountQO
* @return
*/
@RequestMapping(path = "/list-comment")
public RestResponse<Page<CommentInfoVO>> listCommentInfoVo(CommentCountQO commentCountQO) {
ListMobileCommentQDTO mobileCommentQDTO = EntityUtil.changeEntityByJSON(ListMobileCommentQDTO.class, commentCountQO);
mobileCommentQDTO.setEnterpriseId(commentCountQO.getEnterpriseId());
mobileCommentQDTO.setContentMaterialId(commentCountQO.getContentMaterialId());
mobileCommentQDTO.setMemberId(commentCountQO.getClerkId());
mobileCommentQDTO.setMaterialPurpose(MaterialPurposeEnum.KNOWLEDGE.code);
ServiceResponse<Page<ListCommentDTO>> serviceResponse = contentMaterialCommentApiService.listComment(mobileCommentQDTO);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
if (CollectionUtils.isEmpty(serviceResponse.getResult().getResult())) {
return RestResponse.successResult();
}
List<Long> contentMaterialCommentIds = serviceResponse.getResult().getResult().stream().map(ListCommentDTO::getContentMaterialCommentId).collect(Collectors.toList());
//获取子评论信息
ServiceResponse<Map<Long, SonCommentInfoDTO>> filterAuditStatusByContentMaterialCommentIds = contentMaterialCommentApiService.getFilterAuditStatusByContentMaterialCommentIds(mobileCommentQDTO, contentMaterialCommentIds);
Map<Long, SonCommentInfoDTO> sonCommentInfoDTOMap = filterAuditStatusByContentMaterialCommentIds.getResult();
serviceResponse.getResult().getResult().forEach(comment -> {
if (sonCommentInfoDTOMap.containsKey(comment.getContentMaterialCommentId())) {
SonCommentInfoDTO sonCommentInfoDTO = sonCommentInfoDTOMap.get(comment.getContentMaterialCommentId());
comment.setSonComments(ObjectUtil.isNotNull(sonCommentInfoDTO.getListSonCommentDTO()) ? Collections.singletonList(sonCommentInfoDTO.getListSonCommentDTO()) : new ArrayList<>());
comment.setSonCommentNum(sonCommentInfoDTO.getTotal());
}
});
Page<CommentInfoVO> commentInfoVOPage = PageHelperUtils.changePageToCurrentPage(serviceResponse.getResult(), CommentInfoVO.class);
return RestResponse.successResult(commentInfoVOPage);
}
/**
* 子评论列表
* @return
*/
@RequestMapping(path = "/list-son-comment")
public RestResponse<Page<SonCommentInfoVO>> listSonComment(CommentCountQO commentCountQO) {
if (ObjectUtil.isEmpty(commentCountQO.getNextContentMaterialCommentId())){
commentCountQO.setNextContentMaterialCommentId(0L);
}
ListMobileCommentQDTO listMobileCommentQDTO = EntityUtil.changeEntityByJSON(ListMobileCommentQDTO.class, commentCountQO);
listMobileCommentQDTO.setMemberId(commentCountQO.getClerkId());
listMobileCommentQDTO.setMaterialPurpose(MaterialPurposeEnum.KNOWLEDGE.code);
ServiceResponse<Page<ListSonCommentDTO>> serviceResponse = contentMaterialCommentApiService.listSonCommentForWechat(listMobileCommentQDTO);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
Page<SonCommentInfoVO> commentInfoVOPage = PageHelperUtils.changePageToCurrentPage(serviceResponse.getResult(), SonCommentInfoVO.class);
return RestResponse.successResult(commentInfoVOPage);
}
/**
* 添加评论
* @param saveCommentQO
* @return
*/
@RequestMapping(path = "/save-comment")
public RestResponse<SonCommentInfoVO> saveComment(@RequestBody SaveCommentQO saveCommentQO) {
SaveCommentQDTO saveCommentQDTO = EntityUtil.changeEntityByJSON(SaveCommentQDTO.class, saveCommentQO);
saveCommentQDTO.setMemberId(saveCommentQO.getClerkId());
saveCommentQDTO.setReplyMemberId(saveCommentQO.getReplyClerkId());
List<String> clerkIds = new ArrayList<>();
clerkIds.add(saveCommentQO.getClerkId());
if (StringUtils.isNotBlank(saveCommentQO.getReplyClerkId())) {
clerkIds.add(saveCommentQO.getReplyClerkId());
}
Map<String, StaffClerkRelationDTO> clerkInfoMap = this.getClerkInfoMap(saveCommentQO.getWxEnterpriseId(), clerkIds);
List<String> staffIds = new ArrayList<>();
for (StaffClerkRelationDTO value : clerkInfoMap.values()) {
staffIds.add(value.getStaffId());
}
Map<String, StaffDTO> staffDTOMap = this.queryStaffInfoMap(staffIds);
StaffClerkRelationDTO staffClerkRelationDTO = clerkInfoMap.get(saveCommentQO.getClerkId());
saveCommentQDTO.setUserType(UserTypeEnum.CLERK.value);
if (staffClerkRelationDTO != null) {
saveCommentQDTO.setUserCode(staffClerkRelationDTO.getClerkCode());
StaffDTO staffDTO = staffDTOMap.get(staffClerkRelationDTO.getStaffId());
if (staffDTO != null) {
saveCommentQDTO.setUserHeadImage(staffDTO.getHeadImg());
}
if (HaobanClerkTypeEnum.AREA_MANAGER.getCode().equals(staffClerkRelationDTO.getClerkType())) {
saveCommentQDTO.setUserType(UserTypeEnum.AREA_MANAGER.value);
}else {
saveCommentQDTO.setUserType(UserTypeEnum.CLERK.value);
}
}
staffClerkRelationDTO = clerkInfoMap.get(saveCommentQO.getReplyClerkId());
if (staffClerkRelationDTO != null) {
saveCommentQDTO.setReplyUserCode(staffClerkRelationDTO.getClerkCode());
StaffDTO staffDTO = staffDTOMap.get(staffClerkRelationDTO.getStaffId());
if (staffDTO != null) {
saveCommentQDTO.setReplyUserHeadImage(staffDTO.getHeadImg());
}
if (HaobanClerkTypeEnum.AREA_MANAGER.getCode().equals(staffClerkRelationDTO.getClerkType())) {
saveCommentQDTO.setReplyUserType(UserTypeEnum.AREA_MANAGER.value);
}else {
saveCommentQDTO.setReplyUserType(UserTypeEnum.CLERK.value);
}
}
saveCommentQDTO.setAuditStatus(2);
saveCommentQDTO.setMaterialPurpose(MaterialPurposeEnum.KNOWLEDGE.code);
saveCommentQDTO.setShowFlag(1);
ServiceResponse<ListSonCommentDTO> serviceResponse = contentMaterialCommentApiService.saveComment(saveCommentQDTO);
SonCommentInfoVO sonCommentInfoVO = EntityUtil.changeEntityByJSON(SonCommentInfoVO.class, serviceResponse.getResult());
return RestResponse.successResult(sonCommentInfoVO);
}
public Map<String, StaffClerkRelationDTO> getClerkInfoMap(String wxEnterpriseId, List<String> clerkIds) {
List<StaffClerkRelationDTO> staffClerkRelations = staffClerkRelationApiService.listByClerkIdsWxEnterpriseId(clerkIds, wxEnterpriseId);
if (CollectionUtils.isEmpty(staffClerkRelations)) {
return Collections.emptyMap();
}
return staffClerkRelations
.stream()
.collect(Collectors.toMap(StaffClerkRelationDTO::getClerkId, Function.identity(), (v1, v2) -> v1));
}
public Map<String, StaffDTO> queryStaffInfoMap(List<String> staffIds) {
List<StaffDTO> staffDTOS = staffApiService.listByIds(staffIds);
return staffDTOS
.stream()
.collect(Collectors.toMap(StaffDTO::getStaffId, Function.identity(), (v1, v2) -> v1));
}
}
......@@ -7,10 +7,11 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.content.api.dto.column.ContentColumnListDTO;
import com.gic.content.api.dto.material.ContentMaterialDTO;
import com.gic.content.api.dto.material.ContentMaterialLikeDTO;
import com.gic.content.api.dto.material.ContentMaterialShareInfoDTO;
import com.gic.content.api.enums.ColumnEnum;
import com.gic.content.api.enums.MaterialSearchSceneEnum;
import com.gic.content.api.qdto.column.ContentColumnClerkQDTO;
import com.gic.content.api.qdto.like.ContentMaterialLikeQDTO;
import com.gic.content.api.qdto.material.ContentMaterialPageQDTO;
import com.gic.content.api.qdto.material.ContentMaterialShareQDTO;
import com.gic.content.api.service.ContentColumnApiService;
......@@ -19,15 +20,12 @@ import com.gic.content.api.service.ContentMaterialShareApiService;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.web.controller.commission.CommissionManager;
import com.gic.haoban.manage.web.controller.content.adaptor.ClerkStoreAdaptor;
import com.gic.haoban.manage.web.controller.content.adaptor.MaterialDataAdaptor;
import com.gic.haoban.manage.web.controller.goods.GoodsInfoAdaptor;
import com.gic.haoban.manage.web.qo.content.ContentColumnClerkViewQO;
import com.gic.haoban.manage.web.qo.content.ContentMaterialListQO;
import com.gic.haoban.manage.web.qo.content.ContentMaterialQO;
import com.gic.haoban.manage.web.qo.content.ContentMaterialShareQO;
import com.gic.haoban.manage.web.vo.content.ContentColumnInfoVO;
import com.gic.haoban.manage.web.vo.content.ContentMaterialInfoVO;
import com.gic.haoban.manage.web.vo.content.ContentMaterialShareInfoVO;
import com.gic.haoban.manage.web.vo.content.SimpleGoodsInfoVO;
import com.gic.haoban.manage.web.qo.content.*;
import com.gic.haoban.manage.web.qo.content.like.ContentMaterialLikeQO;
import com.gic.haoban.manage.web.vo.content.*;
import com.gic.haoban.manage.web.vo.content.statistics.ContentMaterialKnowVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
......@@ -44,8 +42,7 @@ import java.util.*;
import java.util.stream.Collectors;
/**
* 好办-素材中心(二期)
*
* 好办-素材
*/
@RestController
public class ContentMaterialController {
......@@ -63,16 +60,23 @@ public class ContentMaterialController {
private GoodsInfoAdaptor goodsInfoAdaptor;
@Autowired
private CommissionManager commissionManager;
@Autowired
private MaterialDataAdaptor materialDataAdaptor;
/**
* 获取栏目筛选条件
* 栏目列表
*
* @param enterpriseId
* @param enterpriseId 企业id
* @param wxEnterpriseId 微信企业id
* @param storeId 门店id
* @param clerkId 导购id
* @param columnType 1营销2商品3社区4知识库
* @return
*/
@RequestMapping(path = "/column-list")
public RestResponse<List<ContentColumnInfoVO>> queryContentColumn(String enterpriseId, String storeId, String wxEnterpriseId, String clerkId) {
public RestResponse<List<ContentColumnInfoVO>> queryContentColumn(String enterpriseId, String storeId, String wxEnterpriseId, String clerkId,
Integer columnType) {
List<String> storeIdList = new ArrayList<>();
if (StringUtils.isBlank(storeId)) {
// 区经 获取管辖的权限
......@@ -81,7 +85,10 @@ public class ContentMaterialController {
} else {
storeIdList.add(storeId);
}
ServiceResponse<List<ContentColumnListDTO>> serviceResponse = contentColumnApiService.listColumnFront(enterpriseId, ColumnEnum.MATERIAL.value, storeIdList, clerkId);
if (columnType == null) {
columnType = ColumnEnum.MATERIAL.value;
}
ServiceResponse<List<ContentColumnListDTO>> serviceResponse = contentColumnApiService.listColumnFront(enterpriseId, columnType, storeIdList, clerkId);
if (!serviceResponse.isSuccess() || CollectionUtils.isEmpty(serviceResponse.getResult())) {
return RestResponse.successResult(Collections.emptyList());
}
......@@ -104,11 +111,12 @@ public class ContentMaterialController {
}
List<Integer> goodsShowStatus = goodsInfoAdaptor.getGoodsShowStatus(contentMaterialQO.getEnterpriseId());
ContentMaterialPageQDTO pageQDTO = new ContentMaterialPageQDTO();
pageQDTO.setQueryScene(MaterialSearchSceneEnum.HAOBAN_MARKETING.value);
pageQDTO.setQueryScene(contentMaterialQO.getQueryScene());
pageQDTO.setEnterpriseId(contentMaterialQO.getEnterpriseId());
pageQDTO.setSearch(contentMaterialQO.getSearch());
pageQDTO.setContentColumnId(contentMaterialQO.getContentColumnId());
pageQDTO.setMaterialType(contentMaterialQO.getMaterialType());
pageQDTO.setClerkId(contentMaterialQO.getClerkId());
if (contentMaterialQO.getSortType() != null) {
if (contentMaterialQO.getSortType() == 2) {
......@@ -187,20 +195,32 @@ public class ContentMaterialController {
}
}
contentMaterialInfoVO.setPublishTime(item.getPublishBeginTime());
if (StringUtils.isNotBlank(item.getMaterialImageUrls())) {
String[] split = StringUtils.split(item.getMaterialImageUrls(), ",");
List<String> imageUrls = Arrays.stream(split).collect(Collectors.toList());
contentMaterialInfoVO.setMaterialImageUrls(imageUrls);
}
if (StringUtils.isNotBlank(item.getMaterialThumbnailImageUrls())) {
String[] split = StringUtils.split(item.getMaterialThumbnailImageUrls(), ",");
List<String> imageUrls = Arrays.stream(split).collect(Collectors.toList());
contentMaterialInfoVO.setMaterialThumbnailImageUrls(imageUrls);
}
contentMaterialInfoVO.convertMaterialImages(item.getMaterialImageUrls(),item.getMaterialThumbnailImageUrls());
return contentMaterialInfoVO;
}
/**
* 素材详情
* @param enterpriseId 企业id
* @param contentMaterialId 素材id
* @param clerkId 导购id
* @return
*/
@ResponseBody
@RequestMapping("/get-material")
public RestResponse<ContentMaterialInfoVO> getMaterialMember(String enterpriseId,Long contentMaterialId,String clerkId) {
ServiceResponse<ContentMaterialDTO> response = contentMaterialApiService.getMaterialMember(enterpriseId, contentMaterialId, clerkId);
if (!response.isSuccess()) {
return RestResponse.failure(response.getCode(), response.getMessage());
}
ContentMaterialDTO result = response.getResult();
ContentMaterialInfoVO detailVO = com.gic.commons.util.EntityUtil.changeEntityNew(ContentMaterialInfoVO.class, result);
detailVO.setPublishTime(result.getPublishBeginTime());
detailVO.convertMaterialImages(result.getMaterialImageUrls(),result.getMaterialThumbnailImageUrls());
return RestResponse.successResult(detailVO);
}
/**
* 分享商品素材
*
* @param contentMaterialShareQO
......@@ -261,4 +281,67 @@ public class ContentMaterialController {
}
return RestResponse.successResult(response.getResult());
}
/**
* 点赞素材
* @param likeQO qdto
* @return
*/
@ResponseBody
@RequestMapping("/like-material")
public RestResponse<Integer> likeMaterial(@RequestBody ContentMaterialLikeQO likeQO) {
ContentMaterialLikeQDTO likeQDTO = EntityUtil.changeEntityByOrika(ContentMaterialLikeQDTO.class, likeQO);
ServiceResponse<Integer> response = contentMaterialApiService.likeMaterial(likeQDTO);
if (!response.isSuccess()) {
return RestResponse.failure(response.getCode(), response.getMessage());
}
return RestResponse.successResult(response.getResult());
}
/**
* 素材列表数据
* @return
*/
@ResponseBody
@RequestMapping("/list-material-data")
public RestResponse<List<ContentMaterialDataVO>> listMaterialData(@RequestBody ContentMaterialClerkQO qo) {
List<Long> contentMaterialIdList = qo.getContentMaterialIdList();
String clerkId = qo.getClerkId();
String enterpriseId = qo.getEnterpriseId();
ServiceResponse<List<ContentMaterialLikeDTO>> response = contentMaterialApiService.listMaterialLike(enterpriseId, clerkId, contentMaterialIdList);
if (!response.isSuccess()) {
return RestResponse.failure(response.getCode(), response.getMessage());
}
//点赞数据
Map<Long, ContentMaterialLikeDTO> likeMap = new HashMap<>();
List<ContentMaterialLikeDTO> likeList = response.getResult();
if (CollectionUtils.isNotEmpty(likeList)) {
likeMap = likeList.stream().collect(Collectors.toMap(ContentMaterialLikeDTO::getContentMaterialId, t -> t));
}
//阅读、评论数据
List<ContentMaterialKnowVO> knowList = materialDataAdaptor.queryKnowData(enterpriseId, clerkId,contentMaterialIdList);
Map<Long, ContentMaterialKnowVO> knowMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(knowList)) {
knowMap = knowList.stream().collect(Collectors.toMap(ContentMaterialKnowVO::getContentMaterialId, t -> t));
}
List<ContentMaterialDataVO> dataList = new ArrayList<>();
ContentMaterialDataVO dataVO = null;
for (Long materialId : contentMaterialIdList) {
dataVO = new ContentMaterialDataVO();
dataVO.setContentMaterialId(materialId);
ContentMaterialLikeDTO likeDTO = likeMap.get(materialId);
if (likeDTO != null) {
Long likeCount = likeDTO.getLikeCount();
dataVO.setLikeCount(likeCount == null ? 0 : likeCount.intValue());
dataVO.setLikeFlag(likeDTO.getLikeFlag());
}
ContentMaterialKnowVO knowVO = knowMap.get(materialId);
if (knowVO != null) {
dataVO.setCmtCnt(knowVO.getCmtCnt());
dataVO.setReadCnt(knowVO.getReadCnt());
}
dataList.add(dataVO);
}
return RestResponse.successResult(dataList);
}
}
......@@ -16,10 +16,7 @@ import com.gic.haoban.manage.web.qo.content.statistics.MaterialReportQO;
import com.gic.haoban.manage.web.qo.content.statistics.MaterialStoreAnalyzeDataQO;
import com.gic.haoban.manage.web.qo.content.statistics.MaterialStoreReportQO;
import com.gic.haoban.manage.web.vo.content.creative.ContentMaterialConvsVO;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialAreaUsedDataVO;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialClerkUsedDataVO;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialDataOverviewVO;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialStoreUsedDataVO;
import com.gic.haoban.manage.web.vo.content.statistics.*;
import com.gic.haoban.manage.web.vo.content.statistics.bo.MaterialTodayDataBO;
import com.gic.haoban.manage.web.vo.content.statistics.bo.MemberVisitMaterialBO;
import com.gic.haoban.manage.web.vo.content.statistics.report.MaterialPersonalUsedDataVO;
......@@ -29,11 +26,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -105,6 +98,10 @@ public class MaterialDataAdaptor {
*/
private static final String MATERIAL_CREATIVE_CONVS_TOTAL_DATA = "data_cms_matl_examine_convs_total";
/**
* 知识库素材列表数据
*/
private static final String MATERIAL_KNOWL_HAOBAN_DATA = "data_cms_matl_knowl_haoban_list";
@Autowired
private EnterpriseService enterpriseService;
......@@ -521,4 +518,35 @@ public class MaterialDataAdaptor {
}
return new ContentMaterialConvsVO();
}
/**
* 知识库列表数据
* @param enterpriseId 企业id
* @param materialIdList 素材id列表
* @return
*/
public List<ContentMaterialKnowVO> queryKnowData(String enterpriseId, String clerkId,List<Long> materialIdList) {
Map<String, Object> inlineParams = new HashMap<>();
if (CollectionUtils.isEmpty(materialIdList)) {
return new ArrayList<>();
}
inlineParams.put("enterpriseId", enterpriseId);
inlineParams.put("contentMaterialId", StringUtils.join(materialIdList, ","));
inlineParams.put("visibleClerkId", clerkId);
inlineParams.put("pageNum", 1);
inlineParams.put("pageSize", materialIdList.size());
Map<String, Object> result = null;
try {
result = DataApiUtils.http(JSON.toJSONString(inlineParams), MATERIAL_KNOWL_HAOBAN_DATA);
} catch (Exception e) {
log.error("获取知识库数据异常",e);
return new ArrayList<>();
}
List<ContentMaterialKnowVO> list = DataApiUtils.parsePageDataList(result, ContentMaterialKnowVO.class);
if (CollectionUtils.isNotEmpty(list)) {
return list;
}
return new ArrayList<>();
}
}
package com.gic.haoban.manage.web.qo.content;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import java.util.List;
@JsonSerialize(using= ToStringSerializer.class)
public class ContentMaterialClerkQO {
/**
* 企业ID
*/
private String enterpriseId;
/**
* 素材id列表
*/
private List<Long> contentMaterialIdList;
/**
* 导购id
*/
private String clerkId;
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public List<Long> getContentMaterialIdList() {
return contentMaterialIdList;
}
public void setContentMaterialIdList(List<Long> contentMaterialIdList) {
this.contentMaterialIdList = contentMaterialIdList;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
}
......@@ -36,7 +36,7 @@ public class ContentMaterialListQO extends PageQo {
private String materialSearch;
/**
* 素材类型1图文2纯文字3纯图片4视频
* 素材类型1图文2纯文字3纯图片4视频5图文/视频6文件7富文本
*/
private Integer materialType;
......
package com.gic.haoban.manage.web.qo.content;
import com.gic.commons.web.qo.PageQo;
import com.gic.content.api.enums.MaterialSearchSceneEnum;
/**
* @Author MUSI
......@@ -10,7 +11,11 @@ import com.gic.commons.web.qo.PageQo;
**/
public class ContentMaterialQO extends PageQo {
/**
* 查询场景 1:gic后台营销素材 2:好办营销素材 3:gic后台社区素材 4:gic后台审核素材 5:好办审核素材 6:小程序社区素材 7:gic后台知识库 8:好办知识库
* @see com.gic.content.api.enums.MaterialSearchSceneEnum
*/
private Integer queryScene = MaterialSearchSceneEnum.HAOBAN_MARKETING.value;
/**
* 企业id
*/
......@@ -37,7 +42,7 @@ public class ContentMaterialQO extends PageQo {
private Integer sortType;
/**
* 素材类型1图文2纯文字3纯图片4视频
* 素材类型1图文2纯文字3纯图片4视频5图文/视频6文件7富文本
*/
private Integer materialType;
......@@ -58,6 +63,13 @@ public class ContentMaterialQO extends PageQo {
*/
private Integer searchType;
public Integer getQueryScene() {
return queryScene;
}
public void setQueryScene(Integer queryScene) {
this.queryScene = queryScene;
}
public Integer getSortType() {
return sortType;
......
package com.gic.haoban.manage.web.qo.content.comment;
import com.gic.api.base.commons.BasePageInfo;
import lombok.Data;
/**
* @Author MUSI
* @Date 2023/9/19 3:25 PM
* @Description
* @Version
**/
@Data
public class CommentCountQO extends BasePageInfo {
private static final long serialVersionUID = -4989542424690624006L;
/**
* 企业ID
*/
private String enterpriseId;
/**
* 素材ID
*/
private Long contentMaterialId;
/**
* 导购id
*/
private String clerkId;
/**
* 评论ID (查询子评论使用)取parentContentMaterialCommentId字段,如果有就传,没有就取contentMaterialCommentId
*/
private String contentMaterialCommentId;
/**
* 滚动查询,评论ID
*/
private Long nextContentMaterialCommentId;
}
package com.gic.haoban.manage.web.qo.content.comment;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author MUSI
* @Date 2023/9/19 4:41 PM
* @Description
* @Version
**/
@Data
public class CommentInfoVO implements Serializable {
private static final long serialVersionUID = -8820263048755899343L;
/**
* 素材评论id
*/
private Long contentMaterialCommentId;
/**
* 素材id
*/
private Long contentMaterialId;
/**
* 评论内容
*/
private String commentContent;
/**
* 审核状态0未审核1未通过2已通过
*/
private Integer auditStatus;
/**
* 是否置顶0不置顶1置顶
*/
private Integer topFlag;
/**
* 是否公开展示0隐藏1公开
*/
private Integer showFlag;
/**
* 会员ID
*/
private String memberId;
/**
* 会员昵称
*/
private String memberNick;
/**
* 会员头像
*/
private String memberHeadImage;
/**
* 会员删除标记 0:未删除 1:已删除
*/
private Integer memberDeleteFlag = 0;
/**
* 子评论
*/
private List<SonCommentInfoVO> sonComments;
/**
* 子评论数量(已经减去了展示的子评论)
*/
private Integer sonCommentNum;
/**
* 创建时间
*/
private Date createTime;
}
package com.gic.haoban.manage.web.qo.content.comment;
import lombok.Data;
import java.io.Serializable;
/**
* @Author MUSI
* @Date 2023/9/19 5:00 PM
* @Description
* @Version
**/
@Data
public class SaveCommentQO implements Serializable {
private static final long serialVersionUID = -1584226631161349430L;
/**
* 微信信息
*/
private String wxEnterpriseId;
/**
* 父级素材评论id
*/
private Long parentContentMaterialCommentId;
/**
* 素材id
*/
private Long contentMaterialId;
/**
* 评论内容
*/
private String commentContent;
/**
* 回复的导购ID
*/
private String replyClerkId;
/**
* 导购ID
*/
private String clerkId;
/**
* 企业ID
*/
private String enterpriseId;
/**
* 成员id
*/
private String staffId;
}
package com.gic.haoban.manage.web.qo.content.comment;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author MUSI
* @Date 2023/9/19 4:42 PM
* @Description
* @Version
**/
@Data
public class SonCommentInfoVO implements Serializable {
private static final long serialVersionUID = 2419520239887917983L;
/**
* 素材评论id
*/
private Long contentMaterialCommentId;
/**
* 父级素材评论id
*/
private Long parentContentMaterialCommentId;
/**
* 素材id
*/
private Long contentMaterialId;
/**
* 评论内容
*/
private String commentContent;
/**
* 审核状态0未审核1未通过2已通过
*/
private Integer auditStatus;
/**
* 是否置顶0不置顶1置顶
*/
private Integer topFlag;
/**
* 是否公开展示0隐藏1公开
*/
private Integer showFlag;
/**
* 会员ID
*/
private String memberId;
/**
* 会员昵称
*/
private String memberNick;
/**
* 会员删除标记 0:未删除 1:已删除
*/
private Integer memberDeleteFlag = 0;
/**
* 会员头像
*/
private String memberHeadImage;
/**
* 回复的会员ID
*/
private String replyMemberId;
/**
* 回复的会员昵称
*/
private String replyMemberNick;
/**
* 回复的会员头像
*/
private String replyMemberHeadImage;
/**
* 会员删除标记 0:未删除 1:已删除
*/
private Integer replyMemberDeleteFlag = 0;
private Boolean isMainComment = false;
/**
* 创建时间
*/
private Date createTime;
}
package com.gic.haoban.manage.web.qo.content.like;
import java.io.Serializable;
/**
* Created by wangzubo on 2023/9/22.
*/
public class ContentMaterialLikeQO implements Serializable {
private static final long serialVersionUID = -1L;
/**
* 企业id
*/
private String enterpriseId;
/**
* 用户id(导购id)
*/
private String memberId;
/**
* 用户类型0会员1导购2区经
*/
private Integer userType;
/**
* 用户code
*/
private String userCode;
/**
* 素材id
*/
private Long contentMaterialId;
public ContentMaterialLikeQO() {
}
public ContentMaterialLikeQO(String enterpriseId, String memberId, Integer userType, String userCode, Long contentMaterialId) {
this.enterpriseId = enterpriseId;
this.memberId = memberId;
this.userType = userType;
this.userCode = userCode;
this.contentMaterialId = contentMaterialId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public Integer getUserType() {
return userType;
}
public void setUserType(Integer userType) {
this.userType = userType;
}
public String getUserCode() {
return userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
public Long getContentMaterialId() {
return contentMaterialId;
}
public void setContentMaterialId(Long contentMaterialId) {
this.contentMaterialId = contentMaterialId;
}
}
package com.gic.haoban.manage.web.vo.content;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import java.io.Serializable;
public class ContentMaterialDataVO implements Serializable {
/**
* 素材id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long contentMaterialId;
/**
* 点赞数
*/
private Integer likeCount = 0;
/**
* 是否已点赞 1是0否
*/
private Integer likeFlag = 0;
/**
* 评论次数
*/
private Integer cmtCnt = 0;
/**
* 阅读次数
*/
private Integer readCnt = 0;
public Long getContentMaterialId() {
return contentMaterialId;
}
public void setContentMaterialId(Long contentMaterialId) {
this.contentMaterialId = contentMaterialId;
}
public Integer getLikeCount() {
return likeCount;
}
public void setLikeCount(Integer likeCount) {
this.likeCount = likeCount;
}
public Integer getLikeFlag() {
return likeFlag;
}
public void setLikeFlag(Integer likeFlag) {
this.likeFlag = likeFlag;
}
public Integer getCmtCnt() {
return cmtCnt;
}
public void setCmtCnt(Integer cmtCnt) {
this.cmtCnt = cmtCnt;
}
public Integer getReadCnt() {
return readCnt;
}
public void setReadCnt(Integer readCnt) {
this.readCnt = readCnt;
}
public void setDataVO(ContentMaterialDataVO dataVO) {
if (dataVO == null) {
this.setLikeCount(0);
this.setCmtCnt(0);
this.setReadCnt(0);
return;
}
this.setLikeCount(dataVO.getLikeCount());
this.setCmtCnt(dataVO.getCmtCnt());
this.setReadCnt(dataVO.getReadCnt());
}
}
......@@ -2,10 +2,14 @@ package com.gic.haoban.manage.web.vo.content;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.gic.content.api.dto.ext.ContentMaterialExt;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author MUSI
......@@ -33,11 +37,16 @@ public class ContentMaterialInfoVO implements Serializable {
private String materialContent;
/**
* 素材类型1图文2纯文字3纯图片4视频
* 素材类型1图文2纯文字3纯图片4视频5图文/视频6文件7富文本
*/
private Integer materialType;
/**
* 是否置顶0不置顶1置顶
*/
private Integer topFlag = 0;
/**
* 发布时间
*/
private Date publishTime;
......@@ -84,6 +93,23 @@ public class ContentMaterialInfoVO implements Serializable {
private String materialVideoFirstImageInfo;
/**
* 素材首图url
*/
private String materialFirstImageUrl;
/**
* 素材首图信息{width:px,height:px,size:Bytes}
*/
private String materialFirstImageInfo;
/**
* 素材文件url
*/
private String materialFileUrl;
/**
* 素材文件信息{size:Bytes,name:String}
*/
private String materialFileInfo;
/**
* 分享次数
*/
private Long shareCount;
......@@ -121,6 +147,21 @@ public class ContentMaterialInfoVO implements Serializable {
*/
private Integer sourceType;
/**
* 点赞数
*/
private Long likeCount;
/**
* 是否已点赞 1是0否
*/
private Integer likeFlag;
/**
* 素材额外信息
*/
private ContentMaterialExt ext;
public Long getContentMaterialId() {
return contentMaterialId;
......@@ -154,6 +195,14 @@ public class ContentMaterialInfoVO implements Serializable {
this.materialType = materialType;
}
public Integer getTopFlag() {
return topFlag;
}
public void setTopFlag(Integer topFlag) {
this.topFlag = topFlag;
}
public Date getPublishTime() {
return publishTime;
}
......@@ -194,6 +243,38 @@ public class ContentMaterialInfoVO implements Serializable {
this.materialVideoFirstImageUrl = materialVideoFirstImageUrl;
}
public String getMaterialFirstImageUrl() {
return materialFirstImageUrl;
}
public void setMaterialFirstImageUrl(String materialFirstImageUrl) {
this.materialFirstImageUrl = materialFirstImageUrl;
}
public String getMaterialFirstImageInfo() {
return materialFirstImageInfo;
}
public void setMaterialFirstImageInfo(String materialFirstImageInfo) {
this.materialFirstImageInfo = materialFirstImageInfo;
}
public String getMaterialFileUrl() {
return materialFileUrl;
}
public void setMaterialFileUrl(String materialFileUrl) {
this.materialFileUrl = materialFileUrl;
}
public String getMaterialFileInfo() {
return materialFileInfo;
}
public void setMaterialFileInfo(String materialFileInfo) {
this.materialFileInfo = materialFileInfo;
}
public Long getShareCount() {
return shareCount;
}
......@@ -289,4 +370,42 @@ public class ContentMaterialInfoVO implements Serializable {
public void setMaterialVideoFirstImageInfo(String materialVideoFirstImageInfo) {
this.materialVideoFirstImageInfo = materialVideoFirstImageInfo;
}
public Long getLikeCount() {
return likeCount;
}
public void setLikeCount(Long likeCount) {
this.likeCount = likeCount;
}
public Integer getLikeFlag() {
return likeFlag;
}
public void setLikeFlag(Integer likeFlag) {
this.likeFlag = likeFlag;
}
public ContentMaterialExt getExt() {
return ext;
}
public void setExt(ContentMaterialExt ext) {
this.ext = ext;
}
public void convertMaterialImages(String materialImageUrls, String materialThumbnailImageUrls) {
if (StringUtils.isNotBlank(materialImageUrls)) {
String[] split = StringUtils.split(materialImageUrls, ",");
List<String> imageUrls = Arrays.stream(split).collect(Collectors.toList());
this.setMaterialImageUrls(imageUrls);
}
if (StringUtils.isNotBlank(materialThumbnailImageUrls)) {
String[] split = StringUtils.split(materialThumbnailImageUrls, ",");
List<String> imageUrls = Arrays.stream(split).collect(Collectors.toList());
this.setMaterialThumbnailImageUrls(imageUrls);
}
}
}
package com.gic.haoban.manage.web.vo.content.statistics;
import java.io.Serializable;
public class ContentMaterialKnowVO implements Serializable {
/**
* 素材id
*/
private Long contentMaterialId;
/**
* 评论人数
*/
private Integer cmtNum;
/**
* 评论次数
*/
private Integer cmtCnt;
/**
* 阅读人数
*/
private Integer readNum;
/**
* 阅读次数
*/
private Integer readCnt;
/**
* 点赞人数
*/
private Integer likeNum;
/**
* 点赞次数
*/
private Integer likeCnt;
public ContentMaterialKnowVO() {
}
public ContentMaterialKnowVO(Integer cmtNum, Integer cmtCnt, Integer readNum, Integer readCnt, Integer likeNum, Integer likeCnt) {
this.cmtNum = cmtNum;
this.cmtCnt = cmtCnt;
this.readNum = readNum;
this.readCnt = readCnt;
this.likeNum = likeNum;
this.likeCnt = likeCnt;
}
public void setKnow(ContentMaterialKnowVO know) {
if (know == null) {
this.setCmtNum(0);
this.setCmtCnt(0);
this.setReadCnt(0);
this.setReadNum(0);
this.setLikeCnt(0);
this.setLikeNum(0);
return;
}
this.setCmtNum(know.getCmtNum());
this.setCmtCnt(know.getCmtCnt());
this.setReadCnt(know.getReadCnt());
this.setReadNum(know.getReadNum());
this.setLikeCnt(know.getLikeCnt());
this.setLikeNum(know.getLikeNum());
}
public Long getContentMaterialId() {
return contentMaterialId;
}
public void setContentMaterialId(Long contentMaterialId) {
this.contentMaterialId = contentMaterialId;
}
public Integer getCmtNum() {
return cmtNum;
}
public void setCmtNum(Integer cmtNum) {
this.cmtNum = cmtNum;
}
public Integer getCmtCnt() {
return cmtCnt;
}
public void setCmtCnt(Integer cmtCnt) {
this.cmtCnt = cmtCnt;
}
public Integer getReadNum() {
return readNum;
}
public void setReadNum(Integer readNum) {
this.readNum = readNum;
}
public Integer getReadCnt() {
return readCnt;
}
public void setReadCnt(Integer readCnt) {
this.readCnt = readCnt;
}
public Integer getLikeNum() {
return likeNum;
}
public void setLikeNum(Integer likeNum) {
this.likeNum = likeNum;
}
public Integer getLikeCnt() {
return likeCnt;
}
public void setLikeCnt(Integer likeCnt) {
this.likeCnt = likeCnt;
}
}
......@@ -150,5 +150,7 @@
id="goodsCenterApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.haoban.commission.api.service.local.CommissionSettleDetailApiService"
id="commissionSettleDetailApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.content.api.service.ContentMaterialCommentApiService"
id="contentMaterialCommentApiService" timeout="10000" retries="0" check="false" />
</beans>
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