Commit 51ded2ca by guojuxing

达摩产品情报站

parent 3c420c65
package com.gic.enterprise.constant;
/**
* 情报
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/5/18 2:38 PM

*/
public enum ProductMarketTypeEnum {
/**
* 功能更新
*/
FUNCTION_UPDATE("功能更新", 1),
/**
* 产品推广
*/
PRODUCT_PROMOTION("产品推广", 2),
/**
* 成功案例
*/
SUCCESS_STORIES("成功案例", 3);
private String name;
private int code;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
private ProductMarketTypeEnum(String name, int code) {
this.name = name;
this.code = code;
}
/**
* 用于switch
* @param code
* @return
*/
public static ProductMarketTypeEnum getByCode(int code){
for(ProductMarketTypeEnum transactType : values()){
if (transactType.getCode() == code) {
return transactType;
}
}
return null;
}
}
......@@ -25,6 +25,11 @@ public class ProductMarketQO implements Serializable{
private Integer pageSize;
/**
* 是否显示在gic后台的,如果是,则发布时间小于等于此刻的数据 1:是
*/
private Integer isShowGic;
public String getTitle() {
return title;
}
......@@ -67,6 +72,15 @@ public class ProductMarketQO implements Serializable{
return this;
}
public Integer getShowGic() {
return isShowGic;
}
public ProductMarketQO setShowGic(Integer showGic) {
isShowGic = showGic;
return this;
}
@Override
public String toString() {
return "ProductMarketQO{" +
......@@ -74,6 +88,7 @@ public class ProductMarketQO implements Serializable{
", infoType=" + infoType +
", pageNum=" + pageNum +
", pageSize=" + pageSize +
", isShowGic=" + isShowGic +
'}';
}
}
......@@ -135,6 +135,9 @@
<if test="infoType != null">
and info_type = #{infoType}
</if>
<if test="isShowGic != null and isShowGic == 1">
and release_time &lt;=now()
</if>
order by release_time desc
</select>
......
package com.gic.enterprise.web.controller;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.constant.ProductMarketTypeEnum;
import com.gic.enterprise.dto.ProductMarketDTO;
import com.gic.enterprise.qo.ProductMarketQO;
import com.gic.enterprise.service.ProductMarketApiService;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 达摩产品情报站
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/5/18 2:35 PM

*/
@RestController
@RequestMapping("/product-market")
public class ProductMarketController {
@Autowired
private ProductMarketApiService productMarketApiService;
@RequestMapping("query-product-market")
@ResponseBody
public RestResponse queryProductMarket(Integer showCount) {
Map<String, List<ProductMarketDTO>> result = new HashMap<>(8);
//功能更新
ProductMarketQO params = new ProductMarketQO();
if (showCount == null) {
showCount = 5;
}
params.setShowGic(1);
params.setPageNum(1);
params.setPageSize(showCount);
params.setInfoType(ProductMarketTypeEnum.FUNCTION_UPDATE.getCode());
ServiceResponse<Page<ProductMarketDTO>> functionUpdate = productMarketApiService.pageProductMarket(params);
if (isNotEmptyList(functionUpdate)) {
result.put("functionUpdate", functionUpdate.getResult().getResult());
} else {
result.put("functionUpdate", Collections.EMPTY_LIST);
}
//
params.setInfoType(ProductMarketTypeEnum.PRODUCT_PROMOTION.getCode());
ServiceResponse<Page<ProductMarketDTO>> productPromotion = productMarketApiService.pageProductMarket(params);
if (isNotEmptyList(productPromotion)) {
result.put("productPromotion", productPromotion.getResult().getResult());
} else {
result.put("productPromotion", Collections.EMPTY_LIST);
}
//
params.setInfoType(ProductMarketTypeEnum.SUCCESS_STORIES.getCode());
ServiceResponse<Page<ProductMarketDTO>> successStories = productMarketApiService.pageProductMarket(params);
if (isNotEmptyList(successStories)) {
result.put("successStories", successStories.getResult().getResult());
} else {
result.put("successStories", Collections.EMPTY_LIST);
}
return RestResponse.success(result);
}
/**
* 首页前端是否需要弹窗
* @return
*/
@RequestMapping("is-need-to-popup")
@ResponseBody
public RestResponse isNeedToPopup() {
return ResultControllerUtils.commonResult(productMarketApiService
.isNeedToPopup(UserDetailUtils.getUserDetail().getEnterpriseId(),
UserDetailUtils.getUserDetail().getUserId()));
}
private boolean isNotEmptyList(ServiceResponse<Page<ProductMarketDTO>> response) {
return response.isSuccess() && response.getResult() != null && CollectionUtils.isNotEmpty(response.getResult().getResult());
}
}
......@@ -154,4 +154,5 @@
<dubbo:reference interface="com.gic.auth.service.AccountGroupApiService" id="accountGroupApiService" timeout="6000" />
<!--短信签名-->
<dubbo:reference interface="com.gic.marketing.api.service.sms.SmsApiService" id="smsApiService" timeout="6000" />
<dubbo:reference interface="com.gic.enterprise.service.ProductMarketApiService" id="productMarketApiService" timeout="6000" />
</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