Commit 32cf4f7c by fudahua

Merge remote-tracking branch 'origin/developer' into developer

parents eb593ce4 0b92514b
package com.gic.haoban.manage.api.dto; package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
public class MaterialCategoryDTO { public class MaterialCategoryDTO implements Serializable{
private String categoryId; private String categoryId;
......
package com.gic.haoban.manage.api.dto; package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
public class MaterialDTO { public class MaterialDTO implements Serializable{
private String materialId; private String materialId;
...@@ -14,7 +15,7 @@ public class MaterialDTO { ...@@ -14,7 +15,7 @@ public class MaterialDTO {
private String materialContent; private String materialContent;
private String wxLastUploadTime; private Date wxLastUploadTime;
private String mediaId; private String mediaId;
...@@ -78,12 +79,12 @@ public class MaterialDTO { ...@@ -78,12 +79,12 @@ public class MaterialDTO {
this.materialContent = materialContent == null ? null : materialContent.trim(); this.materialContent = materialContent == null ? null : materialContent.trim();
} }
public String getWxLastUploadTime() { public Date getWxLastUploadTime() {
return wxLastUploadTime; return wxLastUploadTime;
} }
public void setWxLastUploadTime(String wxLastUploadTime) { public void setWxLastUploadTime(Date wxLastUploadTime) {
this.wxLastUploadTime = wxLastUploadTime == null ? null : wxLastUploadTime.trim(); this.wxLastUploadTime = wxLastUploadTime;
} }
public String getMediaId() { public String getMediaId() {
......
...@@ -29,4 +29,6 @@ public interface MaterialApiService { ...@@ -29,4 +29,6 @@ public interface MaterialApiService {
Page<MaterialDTO> listMaterial(String wxEnterpriseId, String keyword, String categoryId, Integer materialType,BasePageInfo pageInfo); Page<MaterialDTO> listMaterial(String wxEnterpriseId, String keyword, String categoryId, Integer materialType,BasePageInfo pageInfo);
String reUpdalodMetail(String materialId);
} }
...@@ -3,6 +3,9 @@ package com.gic.haoban.manage.api.service; ...@@ -3,6 +3,9 @@ package com.gic.haoban.manage.api.service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.gic.api.base.commons.JSONResponse;
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.MemberStoreDTO;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO; import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
...@@ -28,4 +31,11 @@ public interface MemberUnionidRelatedApiService { ...@@ -28,4 +31,11 @@ public interface MemberUnionidRelatedApiService {
public void cleanByCid(String cid); public void cleanByCid(String cid);
Page<MemberUnionidRelatedDTO> pageMemberUnionByParams(List<String> userIdList, List<String> sendMemberIds,
String enterpriseId, BasePageInfo pageInfo);
String sendMessage(String wxEnterpriseId, String userId, List<String> extendUserList, String materialId);
JSONResponse getMessageStatus(String wxEnterpriseId, String wxMessageId);
} }
...@@ -80,4 +80,6 @@ public interface StaffApiService { ...@@ -80,4 +80,6 @@ public interface StaffApiService {
public ServiceResponse<String> getStaffQrcode(String clerkCode, String storeId); public ServiceResponse<String> getStaffQrcode(String clerkCode, String storeId);
void wxFristAdd(String userJson, String wxEnterpriseId); void wxFristAdd(String userJson, String wxEnterpriseId);
List<String> listBindClerkUserId(String storeId);
} }
...@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO; import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.service.entity.MemberUnionidRelated; import com.gic.haoban.manage.service.entity.MemberUnionidRelated;
import com.github.pagehelper.Page;
public interface MemberUnionidRelatedMapper { public interface MemberUnionidRelatedMapper {
int deleteByPrimaryKey(String memberUnionidRelatedId); int deleteByPrimaryKey(String memberUnionidRelatedId);
...@@ -35,4 +36,7 @@ public interface MemberUnionidRelatedMapper { ...@@ -35,4 +36,7 @@ public interface MemberUnionidRelatedMapper {
@Param("externalName")String name, @Param("addCreateTime")String createTime); @Param("externalName")String name, @Param("addCreateTime")String createTime);
List<MemberUnionidRelated> listByExTernalUseridAndWxUserId(@Param("externalUserid")String externalUserid, @Param("wxUserId")String wxUserId); 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
...@@ -14,7 +14,7 @@ public class TabHaobanMaterial implements Serializable { ...@@ -14,7 +14,7 @@ public class TabHaobanMaterial implements Serializable {
private String materialContent; private String materialContent;
private String wxLastUploadTime; private Date wxLastUploadTime;
private String mediaId; private String mediaId;
...@@ -78,12 +78,13 @@ public class TabHaobanMaterial implements Serializable { ...@@ -78,12 +78,13 @@ public class TabHaobanMaterial implements Serializable {
this.materialContent = materialContent == null ? null : materialContent.trim(); this.materialContent = materialContent == null ? null : materialContent.trim();
} }
public String getWxLastUploadTime() {
public Date getWxLastUploadTime() {
return wxLastUploadTime; return wxLastUploadTime;
} }
public void setWxLastUploadTime(String wxLastUploadTime) { public void setWxLastUploadTime(Date wxLastUploadTime) {
this.wxLastUploadTime = wxLastUploadTime == null ? null : wxLastUploadTime.trim(); this.wxLastUploadTime = wxLastUploadTime;
} }
public String getMediaId() { public String getMediaId() {
......
...@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service; ...@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service;
import java.util.List; import java.util.List;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO; import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.service.entity.MemberUnionidRelated;
public interface MemberUnionRelatedService { public interface MemberUnionRelatedService {
...@@ -19,4 +20,7 @@ public interface MemberUnionRelatedService { ...@@ -19,4 +20,7 @@ public interface MemberUnionRelatedService {
void update(MemberUnionidRelatedDTO exsitDTO); void update(MemberUnionidRelatedDTO exsitDTO);
void clean(String cid); 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; ...@@ -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.dao.mapper.MemberUnionidRelatedMapper;
import com.gic.haoban.manage.service.entity.MemberUnionidRelated; import com.gic.haoban.manage.service.entity.MemberUnionidRelated;
import com.gic.haoban.manage.service.service.MemberUnionRelatedService; import com.gic.haoban.manage.service.service.MemberUnionRelatedService;
import com.github.pagehelper.Page;
@Service @Service
public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService { public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService {
...@@ -60,4 +61,10 @@ public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService ...@@ -60,4 +61,10 @@ public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService
public void clean(String cid) { public void clean(String cid) {
mapper.cleanByCid(cid); mapper.cleanByCid(cid);
} }
@Override
public Page<MemberUnionidRelated> pageMemberUnionByParams(List<String> userIdList, List<String> sendMemberIds,
String enterpriseId) {
return mapper.pageMemberUnionByParams(userIdList,sendMemberIds,enterpriseId);
}
} }
...@@ -42,7 +42,7 @@ public class MaidianDictApiServiceImpl implements MaidianDictApiService{ ...@@ -42,7 +42,7 @@ public class MaidianDictApiServiceImpl implements MaidianDictApiService{
}else{ }else{
//更新 //更新
tab.setUpdateTime(new Date()); tab.setUpdateTime(new Date());
tabHaobanMaidianDictModuleMapper.updateByPrimaryKey(tab); tabHaobanMaidianDictModuleMapper.updateByPrimaryKeySelective(tab);
} }
} }
@Override @Override
...@@ -53,12 +53,12 @@ public class MaidianDictApiServiceImpl implements MaidianDictApiService{ ...@@ -53,12 +53,12 @@ public class MaidianDictApiServiceImpl implements MaidianDictApiService{
tab.setCreateTime(new Date()); tab.setCreateTime(new Date());
tab.setUpdateTime(new Date()); tab.setUpdateTime(new Date());
tab.setStatus(1); tab.setStatus(1);
tab.setModuleId(UuidUtil.randomUUID()); tab.setDictId(UuidUtil.randomUUID());
tabHaobanMaidianDictMapper.insert(tab); tabHaobanMaidianDictMapper.insert(tab);
}else{ }else{
//更新 //更新
tab.setUpdateTime(new Date()); tab.setUpdateTime(new Date());
tabHaobanMaidianDictMapper.updateByPrimaryKey(tab); tabHaobanMaidianDictMapper.updateByPrimaryKeySelective(tab);
} }
} }
......
...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service.out.impl; ...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service.out.impl;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
...@@ -11,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -11,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.JSONResponse; import com.gic.api.base.commons.JSONResponse;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.commons.util.GlobalInfo; import com.gic.commons.util.GlobalInfo;
...@@ -23,6 +25,7 @@ import com.gic.haoban.manage.api.dto.MaterialDTO; ...@@ -23,6 +25,7 @@ import com.gic.haoban.manage.api.dto.MaterialDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.MaterialApiService; import com.gic.haoban.manage.api.service.MaterialApiService;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.TabHaobanMaterial;
import com.gic.haoban.manage.service.service.MaterialCategoryService; import com.gic.haoban.manage.service.service.MaterialCategoryService;
import com.gic.haoban.manage.service.service.MaterialService; import com.gic.haoban.manage.service.service.MaterialService;
import com.gic.haoban.manage.service.service.WxEnterpriseService; import com.gic.haoban.manage.service.service.WxEnterpriseService;
...@@ -121,6 +124,7 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -121,6 +124,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
if(fileType != null){ if(fileType != null){
JSONResponse jp = qywxSuiteApiService.uploadMedia(enterprise.getCorpid(), config.getWxSuiteid(), getFileByte(url), fileType.getCode()); JSONResponse jp = qywxSuiteApiService.uploadMedia(enterprise.getCorpid(), config.getWxSuiteid(), getFileByte(url), fileType.getCode());
if(jp.getErrorCode() == 0){ if(jp.getErrorCode() == 0){
materialDTO.setWxLastUploadTime(new Date());
materialDTO.setMediaId(jp.getResult().toString()); materialDTO.setMediaId(jp.getResult().toString());
materialService.insertMaterial(materialDTO); materialService.insertMaterial(materialDTO);
} }
...@@ -168,6 +172,7 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -168,6 +172,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
if(fileType != null && !url.equals(oldUrl)){ if(fileType != null && !url.equals(oldUrl)){
JSONResponse jp = qywxSuiteApiService.uploadMedia(enterprise.getCorpid(), config.getWxSuiteid(), getFileByte(url), fileType.getCode()); JSONResponse jp = qywxSuiteApiService.uploadMedia(enterprise.getCorpid(), config.getWxSuiteid(), getFileByte(url), fileType.getCode());
if(jp.getErrorCode() == 0){ if(jp.getErrorCode() == 0){
materialDTO.setWxLastUploadTime(new Date());
materialDTO.setMediaId(jp.getResult().toString()); materialDTO.setMediaId(jp.getResult().toString());
materialService.edit(materialDTO); materialService.edit(materialDTO);
} }
...@@ -178,20 +183,62 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -178,20 +183,62 @@ public class MaterialApiServiceImpl implements MaterialApiService {
} }
@Override @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.setWxLastUploadTime(new Date());
old.setMediaId(jp.getResult().toString());
materialService.edit(old);
}
return old.getMediaId();
}
@Override
public Page<MaterialDTO> listMaterial(String wxEnterpriseId, String keyword, String categoryId, public Page<MaterialDTO> listMaterial(String wxEnterpriseId, String keyword, String categoryId,
Integer materialType,BasePageInfo pageInfo) { Integer materialType,BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize()); PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
return PageUtil.changePageHelperToCurrentPage(materialService.listMaterial(wxEnterpriseId,keyword,categoryId,materialType),MaterialDTO.class); com.github.pagehelper.Page<TabHaobanMaterial> page = materialService.listMaterial(wxEnterpriseId,keyword,categoryId,materialType);
return PageUtil.changePageHelperToCurrentPage(page,MaterialDTO.class);
} }
private byte[] getFileByte(String url) { public static void main(String[] args) {
String str = "{errcode=0, errmsg=ok, media_id=3ymUzyvUwcIohAXb1lbrL-6Fa-yD3njQpgFCYrEDUHpDaja_ZThd-6XW95NEVjY1l, created_at=1589335350, type=image}";
JSON.parseObject(str);
}
private static byte[] getFileByte(String url) {
try { try {
InputStream in = new URL(url).openStream(); InputStream in = new URL(url).openStream();
byte[] data = IOUtils.toByteArray(in); byte[] data = IOUtils.toByteArray(in);
return data; return data;
}catch (Exception e){ }catch (Exception e){
logger.info("【异常】"+e.getMessage(),e);
} }
return null; return null;
} }
......
...@@ -6,7 +6,12 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -6,7 +6,12 @@ import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; 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.gic.wechat.api.service.qywx.QywxUserApiService;
import com.github.pagehelper.PageHelper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -20,21 +25,28 @@ import org.apache.logging.log4j.Logger; ...@@ -20,21 +25,28 @@ import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.api.base.commons.JSONResponse;
import com.gic.api.base.commons.Page;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.MD5Utils; import com.gic.commons.util.MD5Utils;
import com.gic.commons.util.Md5Util; import com.gic.commons.util.Md5Util;
import com.gic.commons.util.StringUtil; import com.gic.commons.util.StringUtil;
import com.gic.enterprise.api.dto.StoreDTO; import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.contacts.manage.api.dto.SearchDataDTO; import com.gic.haoban.contacts.manage.api.dto.SearchDataDTO;
import com.gic.haoban.manage.api.dto.DepartmentDTO; 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.MemberStoreDTO;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO; import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService; 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.MemberUnionidRelatedApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService; import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService; import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
...@@ -109,6 +121,10 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -109,6 +121,10 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
private StoreService storeService; private StoreService storeService;
@Autowired @Autowired
private Config config; private Config config;
@Autowired
private QywxSuiteApiService qywxSuiteApiService;
@Autowired
private MaterialApiService materialApiService;
@Override @Override
public List<MemberStoreDTO> listByExTernalUseridAndWxUserId(String externalUserid, String wxUserId) { public List<MemberStoreDTO> listByExTernalUseridAndWxUserId(String externalUserid, String wxUserId) {
...@@ -658,4 +674,66 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -658,4 +674,66 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
memberUnionRelatedService.clean(null); 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 String sendMessage(String wxEnterpriseId,String userId,List<String> extendUserList,String materialId){
WxEnterpriseDTO enterprise = wxEnterpriseService.selectById(wxEnterpriseId);
MaterialDTO material = materialApiService.selectMaterialById(materialId);
if(material == null){
return "";
}
JSONResponse jp = null;
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("single");
dto.setExternalUserid(extendUserList);
dto.setSenderUserId(userId);
log.info("【发送消息】dto = {}",JSON.toJSONString(dto));
jp = qywxSuiteApiService.sendExternalMessage(enterprise.getCorpid(), config.getWxSuiteid(), dto);
}else if(material.getMaterialType() == 1){
QywxTextExternalMessageDTO dto = new QywxTextExternalMessageDTO();
dto.setChatType("single");
dto.setExternalUserid(extendUserList);
dto.setSenderUserId(userId);
dto.setText(material.getMaterialContent());
log.info("【发送消息】dto = {}",JSON.toJSONString(dto));
jp = qywxSuiteApiService.sendExternalMessage(enterprise.getCorpid(), config.getWxSuiteid(), dto);
}else if(material.getMaterialType() == 3){
QywxIinkExternalMessageDTO dto = new QywxIinkExternalMessageDTO();
dto.setChatType("single");
dto.setExternalUserid(extendUserList);
dto.setSenderUserId(userId);
dto.setDesc(material.getMaterialDesc());
dto.setPicurl(material.getImgUrl());
dto.setTitle(material.getMaterialTitle());
dto.setUrl(material.getLink());
log.info("【发送消息】dto = {}",JSON.toJSONString(dto));
jp = qywxSuiteApiService.sendExternalMessage(enterprise.getCorpid(), config.getWxSuiteid(), dto);
}
log.info("【发送消息】jp = {}",JSON.toJSONString(jp));
String josnStr = jp.getReturnMap().toString();
JSONObject json = JSONObject.parseObject(josnStr);
return json.getString("msgid");
}
@Override
public JSONResponse getMessageStatus(String wxEnterpriseId, String wxMessageId) {
WxEnterpriseDTO enterprise = wxEnterpriseService.selectById(wxEnterpriseId);
if(enterprise == null){
return null;
}
JSONResponse jp = qywxSuiteApiService.resultExternalMessage(enterprise.getCorpid(), config.getWxSuiteid(), wxMessageId);
return jp;
}
} }
...@@ -1227,6 +1227,18 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1227,6 +1227,18 @@ public class StaffApiServiceImpl implements StaffApiService {
return EntityUtil.changeEntityListByJSON(StaffDTO.class, list); 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){ // private String getMobile(String phoneNumber,String nationcode){
// String mobile = nationcode + phoneNumber; // String mobile = nationcode + phoneNumber;
// return mobile; // return mobile;
......
...@@ -250,4 +250,20 @@ ...@@ -250,4 +250,20 @@
and external_name = #{externalName} and external_name = #{externalName}
and add_create_time = #{addCreateTime} and add_create_time = #{addCreateTime}
</select> </select>
<select id="pageMemberUnionByParams" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_member_unionid_related
where enterprise_id = #{enterpriseId}
and status_flag = 1
and member_id in
<foreach item="memberId" index="index" collection="sendMemberIds" open="(" separator="," close=")">
#{memberId, jdbcType=CHAR}
</foreach>
and wx_user_id in
<foreach item="wxUserId" index="index" collection="userIdList" open="(" separator="," close=")">
#{wxUserId, jdbcType=CHAR}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<result column="material_type" property="materialType" jdbcType="INTEGER" /> <result column="material_type" property="materialType" jdbcType="INTEGER" />
<result column="category_id" property="categoryId" jdbcType="VARCHAR" /> <result column="category_id" property="categoryId" jdbcType="VARCHAR" />
<result column="material_content" property="materialContent" jdbcType="VARCHAR" /> <result column="material_content" property="materialContent" jdbcType="VARCHAR" />
<result column="wx_last_upload_time" property="wxLastUploadTime" jdbcType="VARCHAR" /> <result column="wx_last_upload_time" property="wxLastUploadTime" jdbcType="TIMESTAMP" />
<result column="media_id" property="mediaId" jdbcType="VARCHAR" /> <result column="media_id" property="mediaId" jdbcType="VARCHAR" />
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" /> <result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" />
<result column="staff_id" property="staffId" jdbcType="VARCHAR" /> <result column="staff_id" property="staffId" jdbcType="VARCHAR" />
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
status_flag, link, create_time, status_flag, link, create_time,
update_time) update_time)
values (#{materialId,jdbcType=VARCHAR}, #{materialTitle,jdbcType=VARCHAR}, #{materialType,jdbcType=INTEGER}, values (#{materialId,jdbcType=VARCHAR}, #{materialTitle,jdbcType=VARCHAR}, #{materialType,jdbcType=INTEGER},
#{categoryId,jdbcType=VARCHAR}, #{materialContent,jdbcType=VARCHAR}, #{wxLastUploadTime,jdbcType=VARCHAR}, #{categoryId,jdbcType=VARCHAR}, #{materialContent,jdbcType=VARCHAR}, #{wxLastUploadTime,jdbcType=TIMESTAMP},
#{mediaId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR}, #{mediaId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR},
#{staffName,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}, #{materialDesc,jdbcType=VARCHAR}, #{staffName,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}, #{materialDesc,jdbcType=VARCHAR},
#{statusFlag,jdbcType=INTEGER}, #{link,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{statusFlag,jdbcType=INTEGER}, #{link,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
#{materialContent,jdbcType=VARCHAR}, #{materialContent,jdbcType=VARCHAR},
</if> </if>
<if test="wxLastUploadTime != null" > <if test="wxLastUploadTime != null" >
#{wxLastUploadTime,jdbcType=VARCHAR}, #{wxLastUploadTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="mediaId != null" > <if test="mediaId != null" >
#{mediaId,jdbcType=VARCHAR}, #{mediaId,jdbcType=VARCHAR},
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
material_content = #{materialContent,jdbcType=VARCHAR}, material_content = #{materialContent,jdbcType=VARCHAR},
</if> </if>
<if test="wxLastUploadTime != null" > <if test="wxLastUploadTime != null" >
wx_last_upload_time = #{wxLastUploadTime,jdbcType=VARCHAR}, wx_last_upload_time = #{wxLastUploadTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="mediaId != null" > <if test="mediaId != null" >
media_id = #{mediaId,jdbcType=VARCHAR}, media_id = #{mediaId,jdbcType=VARCHAR},
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
material_type = #{materialType,jdbcType=INTEGER}, material_type = #{materialType,jdbcType=INTEGER},
category_id = #{categoryId,jdbcType=VARCHAR}, category_id = #{categoryId,jdbcType=VARCHAR},
material_content = #{materialContent,jdbcType=VARCHAR}, material_content = #{materialContent,jdbcType=VARCHAR},
wx_last_upload_time = #{wxLastUploadTime,jdbcType=VARCHAR}, wx_last_upload_time = #{wxLastUploadTime,jdbcType=TIMESTAMP},
media_id = #{mediaId,jdbcType=VARCHAR}, media_id = #{mediaId,jdbcType=VARCHAR},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}, wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
staff_id = #{staffId,jdbcType=VARCHAR}, staff_id = #{staffId,jdbcType=VARCHAR},
...@@ -236,5 +236,14 @@ ...@@ -236,5 +236,14 @@
from tab_haoban_material from tab_haoban_material
where status_flag = 1 where status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId} and wx_enterprise_id = #{wxEnterpriseId}
<if test="keyword != null and keyword != ''">
and keyword like CONCAT('%',#{keyWord},'%')
</if>
<if test="materialType != null">
and material_type = #{materialType}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -94,7 +94,7 @@ public class MaterialController extends WebBaseController{ ...@@ -94,7 +94,7 @@ public class MaterialController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_10016); return resultResponse(HaoBanErrCode.ERR_10016);
} }
List<MaterialDTO> list = materialApiService.listMaterialByCategoryId(categoryId); List<MaterialDTO> list = materialApiService.listMaterialByCategoryId(categoryId);
if(!list.isEmpty()){ if(list!= null && !list.isEmpty()){
return resultResponse(HaoBanErrCode.ERR_10017); return resultResponse(HaoBanErrCode.ERR_10017);
} }
dto.setStatusFlag(0); dto.setStatusFlag(0);
...@@ -142,7 +142,7 @@ public class MaterialController extends WebBaseController{ ...@@ -142,7 +142,7 @@ public class MaterialController extends WebBaseController{
* 素材修改 * 素材修改
* @return * @return
*/ */
@RequestMapping("/material-eidt") @RequestMapping("/material-edit")
public HaobanResponse materialEdit(MaterialDTO materialDTO) { public HaobanResponse materialEdit(MaterialDTO materialDTO) {
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser(); LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
......
package com.gic.haoban.manage.web.controller;
import java.io.File;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashSet;
import java.util.Set;
import org.apache.commons.io.FileUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.DateUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.qcloud.BucketNameEnum;
import com.gic.qcloud.FileUploadUtil;
@RestController
public class UploadController extends WebBaseController{
private static Set<String> FILE_TYPE = new HashSet<>( );
static {
for(BucketNameEnum value: BucketNameEnum.values()){
FILE_TYPE.add( value.getName() );
}
}
@RequestMapping("/upload-file")
@ResponseBody
public HaobanResponse upload(@RequestParam MultipartFile file,@RequestParam String fileType) throws Exception{
if(file == null || file.isEmpty()){
return resultResponse(HaoBanErrCode.ERR_2);
}
String name = file.getOriginalFilename();
String suffix = name.substring(name.lastIndexOf(".") + 1);
String location = System.getProperty( "user.dir" )+"/data/tmp/";
//b
long len = file.getSize();
File templateFile = new File( location+name );
FileUtils.copyInputStreamToFile( file.getInputStream(),templateFile );
// 2.上传腾讯云
String dayFilePath = LocalDateTime.now().format( DateTimeFormatter.ofPattern( DateUtil.FORMAT_DATETIME_14 ) );
String key = "haoban/"+dayFilePath+"/"+name;
fileType = FILE_TYPE.contains( fileType )?fileType:BucketNameEnum.OTHER_90000.getName();
String url = FileUploadUtil.simpleUploadFileFromLocal( templateFile,key,fileType);
if(templateFile != null){
templateFile.delete();
}
JSONObject res = new JSONObject( );
res.put( "name",name );
res.put( "ext", suffix );
res.put( "size",len );
res.put( "key",key );
res.put( "url", "https://"+url );
return resultResponse(HaoBanErrCode.ERR_1, res);
}
}
...@@ -313,5 +313,22 @@ public class WxEnterpriseController extends WebBaseController{ ...@@ -313,5 +313,22 @@ public class WxEnterpriseController extends WebBaseController{
} }
//企业信息
@RequestMapping("enterprise-is-over")
public HaobanResponse enterpriseIsOver(String enterpriseId) {
if(StringUtils.isEmpty(enterpriseId)){
return resultResponse(HaoBanErrCode.ERR_2);
}
EnterpriseDTO enterprise = enterpriseService.getEnterpriseByEid(enterpriseId);
if(enterprise == null || enterprise.getExpireTime() == null){
return resultResponse(HaoBanErrCode.ERR_1,true);
}
if(enterprise.getExpireTime().getTime() > System.currentTimeMillis()){
return resultResponse(HaoBanErrCode.ERR_1,false);
}
return resultResponse(HaoBanErrCode.ERR_1,true);
}
} }
package com.gic.haoban.manage.web.init; package com.gic.haoban.manage.web.init;
import com.gic.dict.api.dto.GlobalDictMap;
import com.gic.dict.api.service.ManagerDictService;
import com.gic.quartz.api.dto.QuartzTaskDTO; import com.gic.quartz.api.dto.QuartzTaskDTO;
import com.gic.quartz.api.service.QuartzService; import com.gic.quartz.api.service.QuartzService;
...@@ -19,10 +17,26 @@ public class MyApplicationContextAware implements ApplicationContextAware { ...@@ -19,10 +17,26 @@ public class MyApplicationContextAware implements ApplicationContextAware {
private static ApplicationContext applicationContext; private static ApplicationContext applicationContext;
@Autowired
private QuartzService quartzService;
@Override @Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
// TODO Auto-generated method stub QuartzTaskDTO taskDTO = buildQuartzMessageDTO("haoban-message-status-time");
taskDTO.setTaskParam("");
taskDTO.setTaskStatus(1);
taskDTO.setTaskTimeInfo("0 30 0 * * *");
// taskDTO.setTaskTimeInfo("0 0/1 * * * *");
quartzService.addOrUpdateQuartzTask(taskDTO);
}
private QuartzTaskDTO buildQuartzMessageDTO(String id) {
QuartzTaskDTO taskDTO = new QuartzTaskDTO();
taskDTO.setReferId(id);
taskDTO.setTaskMethod("quartzUpdateMessageStatus");
taskDTO.setTaskService("com.gic.haoban.app.customer.service.api.service.messageLogApiService");
return taskDTO;
} }
......
...@@ -61,4 +61,6 @@ ...@@ -61,4 +61,6 @@
<dubbo:reference interface="com.gic.haoban.manage.api.service.DealSyncOperationApiService" <dubbo:reference interface="com.gic.haoban.manage.api.service.DealSyncOperationApiService"
id="dealSyncOperationApiService"/> id="dealSyncOperationApiService"/>
<dubbo:reference id="quartzService" interface="com.gic.quartz.api.service.QuartzService" timeout="10000"/>
</beans> </beans>
...@@ -5,14 +5,19 @@ import java.util.List; ...@@ -5,14 +5,19 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.PageResult2;
import com.gic.haoban.common.utils.EntityUtil; import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.MaterialCategoryDTO; import com.gic.haoban.manage.api.dto.MaterialCategoryDTO;
import com.gic.haoban.manage.api.dto.MaterialDTO; import com.gic.haoban.manage.api.dto.MaterialDTO;
import com.gic.haoban.manage.api.service.MaterialApiService; import com.gic.haoban.manage.api.service.MaterialApiService;
...@@ -22,6 +27,8 @@ import com.gic.haoban.manage.web.vo.MaterialVO; ...@@ -22,6 +27,8 @@ import com.gic.haoban.manage.web.vo.MaterialVO;
@RestController @RestController
public class MaterialController extends WebBaseController{ public class MaterialController extends WebBaseController{
private static Logger logger = LoggerFactory.getLogger(MaterialController.class);
@Autowired @Autowired
private MaterialApiService materialApiService; private MaterialApiService materialApiService;
/** /**
...@@ -31,7 +38,9 @@ public class MaterialController extends WebBaseController{ ...@@ -31,7 +38,9 @@ public class MaterialController extends WebBaseController{
@RequestMapping("/material-list") @RequestMapping("/material-list")
public HaobanResponse materialList(String wxEnterpriseId,String keyword,String categoryId,Integer materialType,BasePageInfo pageInfo) { public HaobanResponse materialList(String wxEnterpriseId,String keyword,String categoryId,Integer materialType,BasePageInfo pageInfo) {
Page<MaterialDTO> page = materialApiService.listMaterial(wxEnterpriseId,keyword,categoryId,materialType,pageInfo); Page<MaterialDTO> page = materialApiService.listMaterial(wxEnterpriseId,keyword,categoryId,materialType,pageInfo);
return resultResponse(HaoBanErrCode.ERR_1,page); //暂时转换
PageResult2 pageResult2 = PageUtil.getPageInfo(page);
return resultResponse(HaoBanErrCode.ERR_1, pageResult2);
} }
/** /**
...@@ -42,6 +51,12 @@ public class MaterialController extends WebBaseController{ ...@@ -42,6 +51,12 @@ public class MaterialController extends WebBaseController{
public HaobanResponse materialType(String wxEnterpriseId) { public HaobanResponse materialType(String wxEnterpriseId) {
List<MaterialCategoryDTO> list = materialApiService.listCategory(wxEnterpriseId); List<MaterialCategoryDTO> list = materialApiService.listCategory(wxEnterpriseId);
List<MaterialVO> handerList = new ArrayList<MaterialVO>(); List<MaterialVO> handerList = new ArrayList<MaterialVO>();
MaterialVO vo = new MaterialVO();
vo.setCategoryId("-1");
vo.setCategoryName("未分组");
vo.setCategoryParentId("0");
vo.setWxEnterpriseId(wxEnterpriseId);
handerList.add(vo);
for (MaterialCategoryDTO materialCategoryDTO : list) { for (MaterialCategoryDTO materialCategoryDTO : list) {
if("0".equals(materialCategoryDTO.getCategoryParentId())){ if("0".equals(materialCategoryDTO.getCategoryParentId())){
handerList.add(EntityUtil.changeEntityByJSON(MaterialVO.class, materialCategoryDTO)); handerList.add(EntityUtil.changeEntityByJSON(MaterialVO.class, materialCategoryDTO));
...@@ -54,12 +69,13 @@ public class MaterialController extends WebBaseController{ ...@@ -54,12 +69,13 @@ public class MaterialController extends WebBaseController{
private void handerSonMaterial(List<MaterialVO> handerList,Map<String,List<MaterialCategoryDTO>> map){ private void handerSonMaterial(List<MaterialVO> handerList,Map<String,List<MaterialCategoryDTO>> map){
for (MaterialVO materialVO : handerList) { for (MaterialVO materialVO : handerList) {
List<MaterialCategoryDTO> sonList = map.get(materialVO.getCategoryParentId()); List<MaterialCategoryDTO> sonList = map.get(materialVO.getCategoryId());
List<MaterialVO> sonVoList = EntityUtil.changeEntityListByJSON(MaterialVO.class, sonList); List<MaterialVO> sonVoList = EntityUtil.changeEntityListByJSON(MaterialVO.class, sonList);
materialVO.setList(sonVoList); materialVO.setList(sonVoList);
while(sonList != null){ // logger.info("map={},handerList={},categoryId={},sonVoList={}",JSON.toJSONString(map),JSON.toJSONString(handerList),materialVO.getCategoryId(),JSON.toJSONString(sonVoList));
handerSonMaterial(sonVoList, map); // while(sonVoList != null && sonVoList.size() > 0){
} // handerSonMaterial(sonVoList, map);
// }
} }
} }
......
...@@ -53,4 +53,8 @@ ...@@ -53,4 +53,8 @@
<dubbo:reference interface="com.gic.haoban.app.customer.service.api.service.StaffMemberRelationApiService" id="staffMemberRelationApiService"/> <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> </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