Commit 48915690 by guojuxing

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

parents ce7296ec 557c7cfb
package com.gic.enterprise.dto;
import java.io.Serializable;
public class AppletQrcodePathDTO implements Serializable {
private String fileId;
private String url;
private String downloadUrl;
private String path;
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDownloadUrl() {
return downloadUrl;
}
public void setDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}
......@@ -2,11 +2,11 @@ package com.gic.enterprise.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.AppletQrcodeDTO;
import com.gic.enterprise.dto.AppletQrcodePathDTO;
import java.util.Map;
public interface AppletQrcodeApiService {
ServiceResponse<Map<String, Object>> takeAppletQrcode(Integer enterpriseId, String appid, String path, String params);
ServiceResponse<AppletQrcodePathDTO> takeAppletQrcode(Integer enterpriseId, String appid, String path, String params);
ServiceResponse<AppletQrcodeDTO> getAppletQrcode(Integer id);
}
package com.gic.enterprise.service.outer.impl;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.dto.AppletQrcodeDTO;
import com.gic.enterprise.dto.AppletQrcodePathDTO;
import com.gic.enterprise.entity.TabAppletQrcode;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.AppletQrcodeApiService;
......@@ -23,30 +25,31 @@ public class AppletQrcodeApiServiceImpl implements AppletQrcodeApiService {
private WeixinWxaFunService weixinWxaFunService;
@Override
public ServiceResponse<Map<String, Object>> takeAppletQrcode(Integer enterpriseId, String appid, String path, String params) {
public ServiceResponse<AppletQrcodePathDTO> takeAppletQrcode(Integer enterpriseId, String appid, String path, String params) {
TabAppletQrcode tabAppletQrcode = new TabAppletQrcode();
tabAppletQrcode.setAppid(appid);
tabAppletQrcode.setEnterpriseId(enterpriseId);
tabAppletQrcode.setPath(path);
tabAppletQrcode.setParams(params);
int i = this.appletQrcodeService.saveQrcode(tabAppletQrcode);
ServiceResponse<Map<String, Object>> wxaQrcode = this.weixinWxaFunService.createWxaQrcode(appid, path, 1280);
ServiceResponse<Map<String, Object>> wxaQrcode = this.weixinWxaFunService.getWxaCodeUnlimit(appid, "pages/transfer-station/transfer-station", i+"");
if(wxaQrcode.isSuccess()){
Map<String, Object> result = wxaQrcode.getResult();
byte[] contents = (byte[]) result.get("content");
UploadResult uploadResult = QQCloudPicUtils.uploadLocalPicStream("pic01", "", contents);
Map<String, Object> pic = new HashMap<>();
pic.put("fileId", uploadResult.getFileId());
pic.put("url", uploadResult.getUrl());
pic.put("downloadUrl", uploadResult.getDownloadUrl());
pic.put("path", path+"?pageId="+i);
ServiceResponse.success(pic);
AppletQrcodePathDTO qrcodePathDTO = new AppletQrcodePathDTO();
qrcodePathDTO.setFileId(uploadResult.getFileId());
qrcodePathDTO.setUrl(uploadResult.getUrl());
qrcodePathDTO.setDownloadUrl(uploadResult.getDownloadUrl());
qrcodePathDTO.setPath(path+"?pageId="+i);
ServiceResponse.success(qrcodePathDTO);
}
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "生成小程序二维码异常");
}
@Override
public ServiceResponse<AppletQrcodeDTO> getAppletQrcode(Integer id) {
return null;
TabAppletQrcode qrcode = this.appletQrcodeService.getQrcode(id);
return ServiceResponse.success(EntityUtil.changeEntityByJSON(AppletQrcodeDTO.class, qrcode));
}
}
......@@ -2,7 +2,6 @@ package com.gic.enterprise.service.outer.impl;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.CollectionUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GlobalInfo;
import com.gic.commons.util.PageHelperUtils;
......@@ -21,8 +20,10 @@ import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
......@@ -98,13 +99,19 @@ public class ProjectApiServiceImpl implements ProjectApiService{
public ServiceResponse<List<ProjectDTO>> listAllProject() {
List<TabProject> tabProjectList = projectService.listAllProject();
List<ProjectDTO> projectList = EntityUtil.changeEntityListByJSON(ProjectDTO.class, tabProjectList);
if (CollectionUtils.isEmpty(projectList)) {
return ServiceResponse.success(Collections.emptyList());
}
List<TabProjectItem> tabItemList = projectItemService.listAllProjectItem();
List<ProjectItemDTO> itemList = EntityUtil.changeEntityListByJSON(ProjectItemDTO.class, tabItemList);
Map<Integer, List<ProjectItemDTO>> group = CollectionUtil.group(itemList, "projectId");
Map<Integer, List<ProjectItemDTO>> group = Optional.ofNullable(itemList).orElse(Collections.emptyList()).stream()
.filter(e -> e.getUseStatus() == 1).collect(Collectors.groupingBy(ProjectItemDTO::getProjectId, Collectors.mapping(e -> e, Collectors.toList())));
// Map<Integer, List<ProjectItemDTO>> group = CollectionUtil.group(itemList, "projectId");
for (ProjectDTO projectDTO : projectList) {
projectDTO.setItemList(group.get(projectDTO.getProjectId()));
}
return ServiceResponse.success(projectList);
List<ProjectDTO> result = projectList.stream().filter(e -> CollectionUtils.isNotEmpty(e.getItemList())).collect(Collectors.toList());
return ServiceResponse.success(result);
}
......
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