Commit 740e5423 by 徐高华

Merge branch 'xgh_内容中台' into 'developer'

Xgh 内容中台

See merge request !446
parents a6ee177e f70d6fd1
......@@ -74,7 +74,6 @@ public class QywxSendServiceImpl implements QywxSendService {
@Autowired
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper;
@Override
public ServiceResponse<String> sendMessage(String wxEnterpriseId, String staffId, List<String> extendUserList,
List<String> materialIdList) {
......@@ -112,13 +111,13 @@ public class QywxSendServiceImpl implements QywxSendService {
JSONResponse respon = qywxSuiteApiService.sendExternalMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(),
messageDTO);
log.info("群发消息={},返回={}", JSON.toJSONString(messageDTO), JSON.toJSONString(respon));
String error = respon.getErrorMessage() ;
Map<String, Object> returnMap = respon.getReturnMap();
String msgIdKey = "msgid";
String msgId = returnMap.get(msgIdKey) == null ? "" : returnMap.get(msgIdKey).toString();
if (StringUtils.isNotEmpty(msgId)) {
return ServiceResponse.success(msgId);
}
String error = respon.getErrorMessage();
return ServiceResponse.failure("9999", error);
}
......@@ -128,7 +127,7 @@ public class QywxSendServiceImpl implements QywxSendService {
String imageUrl = dto.getImgUrl();
int type = dto.getMaterialType();
String md5 = Md5Util.MD5(imageUrl);
TabMaterialContent tab = this.tabMaterialContentMapper.selectByUrl(wxEnterpriseId, md5,mediaType);
TabMaterialContent tab = this.tabMaterialContentMapper.selectByUrl(wxEnterpriseId, md5, mediaType);
if (null != tab) {
materialIdList.add(tab.getMaterialId());
} else {
......@@ -159,8 +158,8 @@ public class QywxSendServiceImpl implements QywxSendService {
text.setContent(dto.getContent());
moment.setText(text);
List<String> sendUser = new ArrayList<>();
if(CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure("9999", "无导购") ;
if (CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure("9999", "无导购");
}
List<StaffClerkRelationDTO> clerkList = this.tabHaobanStaffClerkRelationMapper.listByClerkIds(clerkIdList,
wxEnterpriseId);
......@@ -199,7 +198,7 @@ public class QywxSendServiceImpl implements QywxSendService {
if (CollectionUtils.isNotEmpty(materialIdList)) {
materialIdList.forEach(materialId -> {
MaterialDTO material = materialService.getHasChangeMadieMaterialById(materialId, from);
log.info("JSON={}",JSON.toJSONString(material));
log.info("JSON={}", JSON.toJSONString(material));
if (material == null) {
return;
}
......
package com.gic.haoban.manage.web.controller;
import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.gic.commons.util.GlobalInfo;
import com.gic.commons.util.GlobalVar;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.common.anno.IgnoreLogin;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.thirdparty.api.dto.PicUploadResDTO;
import com.gic.thirdparty.api.service.QQCloudPicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.util.*;
import com.gic.thirdparty.cloudfile.CloudFileUtil;
import com.gic.thirdparty.cloudfile.enums.CloudFileBusinessOptEnum;
import com.gic.thirdparty.cloudfile.enums.CloudFileTypeEnum;
import com.gic.thirdparty.cloudfile.pojo.CloudFileInfo;
@RestController
public class UploadController extends WebBaseController {
@Autowired
private QQCloudPicService qqCloudPicService;
@Autowired
private EnterpriseService enterpriseService ;
@RequestMapping("upload-img")
@RequestMapping("upload-img11")
@IgnoreLogin
public HaobanResponse imgUpload(HttpServletRequest request) throws Exception {
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
......@@ -56,5 +72,48 @@ public class UploadController extends WebBaseController {
}
return resultResponse(HaoBanErrCode.ERR_1, picList);
}
// fileType image:图片 video:视频 file:文件 audio音频 other:其它
@RequestMapping("upload-img")
@IgnoreLogin
public HaobanResponse imgUploadFee(HttpServletRequest request , String fileType , String enterpriseId) throws Exception {
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
Iterator<String> iter = multiRequest.getFileNames();
java.util.List<Map<String, Object>> picList = new ArrayList<>();
while (iter.hasNext()) {
String fileName = iter.next();
List<MultipartFile> list = multiRequest.getMultiFileMap().get(fileName);
Map<String, Object> map = null;
for (int i = 0; i < list.size(); i++) {
map = new HashMap<>();
MultipartFile mf = list.get(i);
CloudFileTypeEnum type = getType(fileType) ;
EnterpriseDTO enterprise = this.enterpriseService.getEnterpriseById(enterpriseId) ;
File file = File.createTempFile("tmp", null);
mf.transferTo(file);
CloudFileInfo uploadInfo = CloudFileUtil.uploadTempFile(file, fileName, type, enterprise.getFactoryCode(), CloudFileBusinessOptEnum.COMMON, 7*24L) ;
if (uploadInfo != null) {
map.put("qcloudImageUrl", uploadInfo.getOrgFileUrl());
}
picList.add(map);
file.deleteOnExit();
}
}
return resultResponse(HaoBanErrCode.ERR_1, picList);
}
private CloudFileTypeEnum getType(String fileType) {
if(StringUtils.isBlank(fileType)) {
return CloudFileTypeEnum.IMAGE ;
}
CloudFileTypeEnum[] arr = CloudFileTypeEnum.values() ;
for(int i=0;i<arr.length;i++) {
if(arr[i].getType().equals(fileType)) {
return arr[i];
}
}
return CloudFileTypeEnum.IMAGE ;
}
}
......@@ -32,7 +32,6 @@ import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.dto.ClerkListDTO;
import com.gic.clerk.api.dto.ClerkStoreListDTO;
import com.gic.clerk.api.service.ClerkNewService;
import com.gic.clerk.api.service.ClerkService;
import com.gic.clerk.api.service.PowerService;
......@@ -45,7 +44,6 @@ import com.gic.enterprise.api.dto.StoreSearchDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.enterprise.api.service.StoreWidgetService;
import com.gic.haoban.app.customer.dto.ChildrenListDTO;
import com.gic.haoban.app.customer.service.api.service.CustomerApiService;
import com.gic.haoban.app.customer.service.api.service.DistributeApiService;
import com.gic.haoban.base.api.common.BasePageInfo;
......@@ -1738,28 +1736,16 @@ public class WxStaffController extends WebBaseController {
}
resultList = EntityUtil.changeEntityListByJSON(ClerkListVO.class, clerkList);
}else if(clerkType==2) {
Map<String, Object> params = new HashMap<>();
params.put("enterpriseId", enterpriseId);
// 只获取导购和店长
params.put("clerkTypeList", Arrays.asList(1));
if (StringUtils.isNotBlank(clerkSearchParams)) {
params.put("clerkSearchParams", "%" + clerkSearchParams + "%");
}
// 如果有权限控制,进行管辖门店过0滤
List<String> authStoreIdList = this.staffApiService.getHaoBanStoreIdsRolesByClerkId(clerkId,wxEnterpriseId);
if (CollectionUtils.isEmpty(authStoreIdList)) {
return RestResponse.failure("-1", "无授权门店");
}
if (!(authStoreIdList.size() == 1 && authStoreIdList.contains("-1"))) {
params.put("storeIdList", authStoreIdList);
if (authStoreIdList.size() == 1 && authStoreIdList.contains("-1")) {
authStoreIdList = null ;
}
Page<ClerkStoreListDTO> page = new Page<>();
page.setPageSize(basePageInfo.getPageSize());
page.setCurrentPage(basePageInfo.getPageNum());
page.setParams(params);
logger.info("查询条件:{}", JSON.toJSONString(params));
page = this.clerkService.listStoreClerkByPage(page);
resultList = EntityUtil.changeEntityListByJSON(ClerkListVO.class, page.getResult());
// 查询区经门店下的店长,eid,storelist,clerkSearchParams
logger.info("查询所有店长,返回={}", enterpriseId);
}
List<String> clerkIdList = resultList.stream().map(dto->dto.getClerkId()).collect(Collectors.toList()) ;
List<StaffClerkRelationDTO> relationList = this.staffClerkRelationApiService.listByClerkIdsWxEnterpriseId(clerkIdList, wxEnterpriseId) ;
......
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