Commit 0df1a732 by guojuxing

小程序装修:小程序列表

parent de0c3c2c
package com.gic.enterprise.web.controller;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.web.vo.AppletServiceConfigVO;
import com.gic.member.config.api.dto.AppletsConfigSimpleOutputDTO;
import com.gic.member.config.api.dto.ServiceConfigSimpleOutputDTO;
import com.gic.member.config.api.service.AppletsConfigApiService;
import com.gic.member.config.api.service.ServiceConfigApiService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -15,6 +22,12 @@ import com.gic.enterprise.service.AppletServiceConfigApiService;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
* @Description:
......@@ -26,11 +39,31 @@ public class AppletServiceConfigController {
@Autowired
private AppletServiceConfigApiService appletServiceConfigApiService;
@Autowired
private AppletsConfigApiService appletsConfigApiService;
@RequestMapping("list-applet")
public RestResponse listApplet(AppletServiceConfigQO appletServiceConfigQO) {
ServiceResponse<Page<AppletServiceConfigDTO>> serviceResponse = appletServiceConfigApiService.listApplet(UserDetailUtils.getUserDetail().getEnterpriseId(), appletServiceConfigQO);
return ResultControllerUtils.commonResult(serviceResponse);
Map<String, String> appIdMapImage = getAppletAppIdMapImage();
if (serviceResponse.isSuccess()) {
Page<AppletServiceConfigDTO> page = serviceResponse.getResult();
if (page != null && CollectionUtils.isNotEmpty(page.getResult())) {
Page<AppletServiceConfigVO> resultPage = EntityUtil.changeEntityNew(Page.class, page);
List<AppletServiceConfigDTO> list = page.getResult();
resultPage.setResult(list.stream().map(e -> {
AppletServiceConfigVO vo = EntityUtil.changeEntityNew(AppletServiceConfigVO.class, e);
vo.setImage(appIdMapImage.get(e.getAppId()));
return vo;
}).collect(Collectors.toList()));
return RestResponse.success(resultPage);
}
return RestResponse.success(page);
}
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
@RequestMapping("list-service")
......@@ -67,4 +100,13 @@ public class AppletServiceConfigController {
return ResultControllerUtils.commonResult(response);
}
private Map<String, String> getAppletAppIdMapImage() {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
ServiceResponse<List<AppletsConfigSimpleOutputDTO>> serviceResponse = appletsConfigApiService.listValidAppletConfigAppId(enterpriseId);
if (serviceResponse.isSuccess() && CollectionUtils.isNotEmpty(serviceResponse.getResult())) {
return serviceResponse.getResult().stream().collect(Collectors.toMap(AppletsConfigSimpleOutputDTO::getAppId, AppletsConfigSimpleOutputDTO::getImg));
}
return new HashMap<>();
}
}
package com.gic.enterprise.web.vo;
import java.io.Serializable;
import java.util.Date;
/**
* 小程序装修:小程序列表
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/6/8 5:27 PM

*/
public class AppletServiceConfigVO implements Serializable{
private static final long serialVersionUID = 942114498830821546L;
/**
*
*/
private Integer appletServiceId;
/**
*
*/
private Integer enterpriseId;
/**
*
*/
private String appId;
/**
*
*/
private String name;
/**
* 1小程序 2服务号
*/
private Integer type;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 小程序logo
*/
private String image;
public Integer getAppletServiceId() {
return appletServiceId;
}
public AppletServiceConfigVO setAppletServiceId(Integer appletServiceId) {
this.appletServiceId = appletServiceId;
return this;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public AppletServiceConfigVO setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
return this;
}
public String getAppId() {
return appId;
}
public AppletServiceConfigVO setAppId(String appId) {
this.appId = appId;
return this;
}
public String getName() {
return name;
}
public AppletServiceConfigVO setName(String name) {
this.name = name;
return this;
}
public Integer getType() {
return type;
}
public AppletServiceConfigVO setType(Integer type) {
this.type = type;
return this;
}
public Date getCreateTime() {
return createTime;
}
public AppletServiceConfigVO setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public AppletServiceConfigVO setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
public String getImage() {
return image;
}
public AppletServiceConfigVO setImage(String image) {
this.image = image;
return this;
}
}
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