Commit be6f6bb0 by qwmqiuwenmin

fix

parent 8776e2f5
......@@ -14,7 +14,7 @@ public class MaterialDTO {
private String materialContent;
private String wxLastUploadTime;
private Date wxLastUploadTime;
private String mediaId;
......@@ -78,12 +78,12 @@ public class MaterialDTO {
this.materialContent = materialContent == null ? null : materialContent.trim();
}
public String getWxLastUploadTime() {
public Date getWxLastUploadTime() {
return wxLastUploadTime;
}
public void setWxLastUploadTime(String wxLastUploadTime) {
this.wxLastUploadTime = wxLastUploadTime == null ? null : wxLastUploadTime.trim();
public void setWxLastUploadTime(Date wxLastUploadTime) {
this.wxLastUploadTime = wxLastUploadTime;
}
public String getMediaId() {
......
......@@ -29,4 +29,6 @@ public interface MaterialApiService {
Page<MaterialDTO> listMaterial(String wxEnterpriseId, String keyword, String categoryId, Integer materialType,BasePageInfo pageInfo);
String reUpdalodMetail(String materialId);
}
......@@ -3,6 +3,8 @@ package com.gic.haoban.manage.api.service;
import java.util.Date;
import java.util.List;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.MemberStoreDTO;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
......@@ -28,4 +30,9 @@ public interface MemberUnionidRelatedApiService {
public void cleanByCid(String cid);
Page<MemberUnionidRelatedDTO> pageMemberUnionByParams(List<String> userIdList, List<String> sendMemberIds,
String enterpriseId, BasePageInfo pageInfo);
void sendMessage(String wxEnterpriseId, String userId, List<String> extendUserList, String materialId);
}
......@@ -80,4 +80,6 @@ public interface StaffApiService {
public ServiceResponse<String> getStaffQrcode(String clerkCode, String storeId);
void wxFristAdd(String userJson, String wxEnterpriseId);
List<String> listBindClerkUserId(String storeId);
}
......@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.service.entity.MemberUnionidRelated;
import com.github.pagehelper.Page;
public interface MemberUnionidRelatedMapper {
int deleteByPrimaryKey(String memberUnionidRelatedId);
......@@ -35,4 +36,7 @@ public interface MemberUnionidRelatedMapper {
@Param("externalName")String name, @Param("addCreateTime")String createTime);
List<MemberUnionidRelated> listByExTernalUseridAndWxUserId(@Param("externalUserid")String externalUserid, @Param("wxUserId")String wxUserId);
Page<MemberUnionidRelated> pageMemberUnionByParams(@Param("userIdList")List<String> userIdList, @Param("sendMemberIds")List<String> sendMemberIds,
@Param("enterpriseId")String enterpriseId);
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service;
import java.util.List;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.service.entity.MemberUnionidRelated;
public interface MemberUnionRelatedService {
......@@ -19,4 +20,7 @@ public interface MemberUnionRelatedService {
void update(MemberUnionidRelatedDTO exsitDTO);
void clean(String cid);
com.github.pagehelper.Page<MemberUnionidRelated> pageMemberUnionByParams(List<String> userIdList, List<String> sendMemberIds,
String enterpriseId);
}
......@@ -13,6 +13,7 @@ import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.service.dao.mapper.MemberUnionidRelatedMapper;
import com.gic.haoban.manage.service.entity.MemberUnionidRelated;
import com.gic.haoban.manage.service.service.MemberUnionRelatedService;
import com.github.pagehelper.Page;
@Service
public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService {
......@@ -60,4 +61,10 @@ public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService
public void clean(String cid) {
mapper.cleanByCid(cid);
}
@Override
public Page<MemberUnionidRelated> pageMemberUnionByParams(List<String> userIdList, List<String> sendMemberIds,
String enterpriseId) {
return mapper.pageMemberUnionByParams(userIdList,sendMemberIds,enterpriseId);
}
}
......@@ -176,6 +176,41 @@ public class MaterialApiServiceImpl implements MaterialApiService {
}
}
@Override
public String reUpdalodMetail(String materialId){
MaterialDTO old = materialService.selectMaterialById(materialId);
Integer type = old.getMaterialType();
if(type == null){
return "";
}
String wxEnterpriseId = old.getWxEnterpriseId();
WxEnterpriseDTO enterprise = wxEnterpriseService.selectById(wxEnterpriseId);
if(enterprise == null){
return "";
}
String url = "";
String oldUrl = "";
QywxMediaTypeEnum fileType = null;
if(type == 2){
fileType = QywxMediaTypeEnum.IMAGE;
url = old.getImgUrl();
}
if(type == 4){
fileType = QywxMediaTypeEnum.VIDEO;
url = old.getLink();
}
if(type == 5){
fileType = QywxMediaTypeEnum.FILE;
url = old.getLink();
}
JSONResponse jp = qywxSuiteApiService.uploadMedia(enterprise.getCorpid(), config.getWxSuiteid(), getFileByte(url), fileType.getCode());
if(jp.getErrorCode() == 0){
old.setMediaId(jp.getResult().toString());
materialService.edit(old);
}
return old.getMediaId();
}
@Override
public Page<MaterialDTO> listMaterial(String wxEnterpriseId, String keyword, String categoryId,
......
......@@ -6,7 +6,12 @@ import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gic.wechat.api.dto.qywx.QywxIinkExternalMessageDTO;
import com.gic.wechat.api.dto.qywx.QywxImageExternalMessageDTO;
import com.gic.wechat.api.dto.qywx.QywxTextExternalMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.github.pagehelper.PageHelper;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -20,21 +25,27 @@ import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.api.base.commons.Page;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.MD5Utils;
import com.gic.commons.util.Md5Util;
import com.gic.commons.util.StringUtil;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.contacts.manage.api.dto.SearchDataDTO;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.MaterialDTO;
import com.gic.haoban.manage.api.dto.MemberStoreDTO;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.MaterialApiService;
import com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
......@@ -109,6 +120,10 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
private StoreService storeService;
@Autowired
private Config config;
@Autowired
private QywxSuiteApiService qywxSuiteApiService;
@Autowired
private MaterialApiService materialApiService;
@Override
public List<MemberStoreDTO> listByExTernalUseridAndWxUserId(String externalUserid, String wxUserId) {
......@@ -658,4 +673,49 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
memberUnionRelatedService.clean(null);
}
}
@Override
public Page<MemberUnionidRelatedDTO> pageMemberUnionByParams(List<String> userIdList, List<String> sendMemberIds,
String enterpriseId, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
return PageUtil.changePageHelperToCurrentPage(memberUnionRelatedService.pageMemberUnionByParams(userIdList,sendMemberIds,enterpriseId),MemberUnionidRelatedDTO.class);
}
@Override
public void sendMessage(String wxEnterpriseId,String userId,List<String> extendUserList,String materialId){
WxEnterpriseDTO enterprise = wxEnterpriseService.selectById(wxEnterpriseId);
MaterialDTO material = materialApiService.selectMaterialById(materialId);
if(material == null){
return;
}
if(material.getMaterialType() == 2 || material.getMaterialType() == 4 || material.getMaterialType() == 5){
Date wxLastTime = material.getWxLastUploadTime();
String maerialId = material.getMaterialId();
if(DateUtil.addDay(wxLastTime, 3).getTime() < System.currentTimeMillis()){
maerialId = materialApiService.reUpdalodMetail(materialId);
}
QywxImageExternalMessageDTO dto = new QywxImageExternalMessageDTO();
dto.setMediaId(maerialId);
dto.setChatType("");
dto.setExternalUserid(extendUserList);
dto.setSenderUserId(userId);
qywxSuiteApiService.sendExternalMessage(enterprise.getCorpid(), config.getWxSuiteid(), dto);
}else if(material.getMaterialType() == 1){
QywxTextExternalMessageDTO dto = new QywxTextExternalMessageDTO();
dto.setChatType("");
dto.setExternalUserid(extendUserList);
dto.setSenderUserId(userId);
dto.setText(material.getMaterialContent());
qywxSuiteApiService.sendExternalMessage(enterprise.getCorpid(), config.getWxSuiteid(), dto);
}else if(material.getMaterialType() == 3){
QywxIinkExternalMessageDTO dto = new QywxIinkExternalMessageDTO();
dto.setChatType("");
dto.setExternalUserid(extendUserList);
dto.setSenderUserId(userId);
dto.setDesc(material.getMaterialDesc());
dto.setPicurl(material.getImgUrl());
dto.setTitle(material.getMaterialTitle());
dto.setUrl(material.getLink());
qywxSuiteApiService.sendExternalMessage(enterprise.getCorpid(), config.getWxSuiteid(), dto);
}
}
}
......@@ -1223,6 +1223,18 @@ public class StaffApiServiceImpl implements StaffApiService {
List<TabHaobanStaff> list = staffMapper.listByWxUserId(wxUserId);
return EntityUtil.changeEntityListByJSON(StaffDTO.class, list);
}
@Override
public List<String> listBindClerkUserId(String storeId) {
TabHaobanDepartment department = departmentService.selectByRelatedId(storeId);
if(department == null){
return Collections.EMPTY_LIST;
}
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listByDepartmentId(department.getDepartmentId());
List<String> userIdList = list.stream().filter(s->s.getClerkCode()!=null).map(s->s.getWxUserId()).collect(Collectors.toList());
return userIdList;
}
// private String getMobile(String phoneNumber,String nationcode){
// String mobile = nationcode + phoneNumber;
......
......@@ -52,5 +52,9 @@
<dubbo:reference interface="com.gic.haoban.manage.api.service.MaidianLogApiService" id="maidianLogApiService"/>
<dubbo:reference interface="com.gic.haoban.app.customer.service.api.service.StaffMemberRelationApiService" id="staffMemberRelationApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.MaterialApiService" id="materialApiService"/>
</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