Commit 2f9ea9b2 authored by 廖旭伟's avatar 廖旭伟

查询产品列表

parent 7eba45c4
......@@ -14,6 +14,7 @@ public class RespData<T> {
private T data;
private T entity;
private PageInfo pageInfo;
private Object dict;
public static void main(String[] args) {
......
package com.mortals.xhx.common.pdu.product;
import com.mortals.framework.model.BaseEntityLong;
public class ProductPdu extends BaseEntityLong {
private static final long serialVersionUID = 1L;
/**
* 关联平台
*/
private Long platformId;
/**
* 产品名称,名称唯一
*/
private String productName;
/**
* 产品编码
*/
private String productCode;
/**
* 皮肤id
*/
private Long skinId;
/**
* 皮肤名称
*/
private String skinName;
/**
* 首页地址
*/
private String homeUrl;
/**
* 事件地址,评价器使用
*/
private String eventUrl;
/**
* 备注
*/
private String productRemark;
public ProductPdu(){}
/**
* 获取 关联平台
* @return Long
*/
public Long getPlatformId(){
return platformId;
}
/**
* 设置 关联平台
* @param platformId
*/
public void setPlatformId(Long platformId){
this.platformId = platformId;
}
/**
* 获取 产品名称,名称唯一
* @return String
*/
public String getProductName(){
return productName;
}
/**
* 设置 产品名称,名称唯一
* @param productName
*/
public void setProductName(String productName){
this.productName = productName;
}
/**
* 获取 产品编码
* @return String
*/
public String getProductCode(){
return productCode;
}
/**
* 设置 产品编码
* @param productCode
*/
public void setProductCode(String productCode){
this.productCode = productCode;
}
/**
* 获取 皮肤id
* @return Long
*/
public Long getSkinId(){
return skinId;
}
/**
* 设置 皮肤id
* @param skinId
*/
public void setSkinId(Long skinId){
this.skinId = skinId;
}
/**
* 获取 皮肤名称
* @return String
*/
public String getSkinName(){
return skinName;
}
/**
* 设置 皮肤名称
* @param skinName
*/
public void setSkinName(String skinName){
this.skinName = skinName;
}
/**
* 获取 首页地址
* @return String
*/
public String getHomeUrl(){
return homeUrl;
}
/**
* 设置 首页地址
* @param homeUrl
*/
public void setHomeUrl(String homeUrl){
this.homeUrl = homeUrl;
}
/**
* 获取 事件地址,评价器使用
* @return String
*/
public String getEventUrl(){
return eventUrl;
}
/**
* 设置 事件地址,评价器使用
* @param eventUrl
*/
public void setEventUrl(String eventUrl){
this.eventUrl = eventUrl;
}
/**
* 获取 备注
* @return String
*/
public String getProductRemark(){
return productRemark;
}
/**
* 设置 备注
* @param productRemark
*/
public void setProductRemark(String productRemark){
this.productRemark = productRemark;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof ProductPdu) {
ProductPdu tmp = (ProductPdu) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",platformId:").append(getPlatformId());
sb.append(",productName:").append(getProductName());
sb.append(",productCode:").append(getProductCode());
sb.append(",skinId:").append(getSkinId());
sb.append(",skinName:").append(getSkinName());
sb.append(",homeUrl:").append(getHomeUrl());
sb.append(",eventUrl:").append(getEventUrl());
sb.append(",productRemark:").append(getProductRemark());
return sb.toString();
}
public void initAttrValue(){
this.platformId = null;
this.productName = "";
this.productCode = "";
this.skinId = null;
this.skinName = "";
this.homeUrl = "";
this.eventUrl = "";
this.productRemark = "";
}
}
package com.mortals.xhx.feign.product;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.product.ProductPdu;
import com.mortals.xhx.feign.IFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@FeignClient(name = "device-manager", path = "/m", fallbackFactory = ProductFeignFallbackFactory.class)
public interface IProductFeign extends IFeign {
/**
* 查看产品列表
*
* @param productPdu
* @return
*/
@PostMapping(value = "/product/list")
Rest<RespData<List<ProductPdu>>> list(@RequestBody ProductPdu productPdu);
}
@Slf4j
@Component
class ProductFeignFallbackFactory implements FallbackFactory<IProductFeign> {
@Override
public IProductFeign create(Throwable throwable) {
return new IProductFeign(){
@Override
public Rest<RespData<List<ProductPdu>>> list(ProductPdu productPdu) {
return Rest.fail("暂时无法获取产品列表,请稍后再试!");
}
};
}
}
......@@ -5465,13 +5465,15 @@ data|object|数据对象
productId|Long|是|产品id
dateTimeStart|String|是|开始时间
dateTimeStart|String|是|结束时间
businessCode|String|否|业务功能code,多个code使用","隔开
**请求样例:**
```
{
"productId":1,
"dateTimeStart":"2023-04-10",
"dateTimeEnd":"2023-05-11"
"dateTimeEnd":"2023-05-11",
"businessCode":"非必填,业务功能code,多个code使用逗号隔开"
}
```
......@@ -5537,6 +5539,8 @@ data|array|数据对象
productId|Long|是|产品id
dateTimeStart|String|是|开始时间
dateTimeStart|String|是|结束时间
particleType|int|是|时间颗粒度 1:10分钟,2:30分钟,3:1小时
isRatio|int|是|是否开启日对比1是0否
**请求样例:**
```
......
package com.mortals.xhx.module.page.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.module.page.model.PageInfoEntity;
import com.mortals.xhx.module.page.model.PageRouteEntity;
import com.mortals.xhx.module.page.model.pdu.AccessPdu;
import com.mortals.xhx.module.page.model.pdu.BuryPointPdu;
import com.mortals.xhx.module.page.service.*;
import org.apache.commons.collections4.CollectionUtils;
......@@ -20,7 +17,10 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 页面埋点
......
package com.mortals.xhx.module.page.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.product.ProductPdu;
import com.mortals.xhx.feign.product.IProductFeign;
import com.mortals.xhx.module.page.model.PageInfoEntity;
import com.mortals.xhx.module.page.service.PageInfoService;
import com.mortals.xhx.module.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
......@@ -23,6 +32,8 @@ public class PageInfoController extends BaseCRUDJsonBodyMappingController<PageIn
@Autowired
private ParamService paramService;
@Autowired
private IProductFeign productFeign;
public PageInfoController(){
super.setModuleDesc( "产品页面配置");
......@@ -34,5 +45,35 @@ public class PageInfoController extends BaseCRUDJsonBodyMappingController<PageIn
super.init(model, context);
}
@PostMapping({"product/list"})
@UnAuth
public Rest<Object> list(@RequestBody ProductPdu query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询产品列表";
int code;
try {
Rest<RespData<List<ProductPdu>>> result = productFeign.list(query);
code = result.getCode();
if(code > 0) {
model.put("data", result.getData().getData());
model.put("pageInfo", result.getData().getPageInfo());
model.put("dict", result.getData().getDict());
}
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
ret.setCode(code);
ret.setData(model);
ret.setDict(model.get("dict"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
}
\ No newline at end of file
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