Commit ee2f9e08 by 陶光胜

Merge branch 'developer' into 'master'

Developer

See merge request !25
parents 63c101ac 77d012d0
......@@ -53,67 +53,86 @@ public class EnterpriseLicenseDTO implements Serializable{
*/
private String licenseName;
private String licenseCode;
public Integer getEnterpriseLicenseId() {
return enterpriseLicenseId;
}
public void setEnterpriseLicenseId(Integer enterpriseLicenseId) {
public EnterpriseLicenseDTO setEnterpriseLicenseId(Integer enterpriseLicenseId) {
this.enterpriseLicenseId = enterpriseLicenseId;
return this;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
public EnterpriseLicenseDTO setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
return this;
}
public Long getLicenseId() {
return licenseId;
}
public void setLicenseId(Long licenseId) {
public EnterpriseLicenseDTO setLicenseId(Long licenseId) {
this.licenseId = licenseId;
return this;
}
public Integer getLowerLimit() {
return lowerLimit;
}
public void setLowerLimit(Integer lowerLimit) {
public EnterpriseLicenseDTO setLowerLimit(Integer lowerLimit) {
this.lowerLimit = lowerLimit;
return this;
}
public Integer getUpperLimit() {
return upperLimit;
}
public void setUpperLimit(Integer upperLimit) {
public EnterpriseLicenseDTO setUpperLimit(Integer upperLimit) {
this.upperLimit = upperLimit;
return this;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
public EnterpriseLicenseDTO setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
public EnterpriseLicenseDTO setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
public String getLicenseName() {
return licenseName;
}
public void setLicenseName(String licenseName) {
public EnterpriseLicenseDTO setLicenseName(String licenseName) {
this.licenseName = licenseName;
return this;
}
public String getLicenseCode() {
return licenseCode;
}
public EnterpriseLicenseDTO setLicenseCode(String licenseCode) {
this.licenseCode = licenseCode;
return this;
}
}
package com.gic.enterprise.dto;
import com.gic.enterprise.constant.LicenseTypeEnum;
import com.gic.enterprise.utils.LicenseUtils;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author guojx
......@@ -25,8 +18,6 @@ public class EnterpriseListDTO implements Serializable{
private String logo;
private String licenseUpperLimitStr;
/**
* 自左向右显示会员卡、服务号、小程序、门店、商品5大业务对象的license授权额度。
* 受显示宽度限制,区间型license仅显示区间峰值。
......@@ -103,14 +94,6 @@ public class EnterpriseListDTO implements Serializable{
this.logo = logo;
}
public String getLicenseUpperLimitStr() {
return licenseUpperLimitStr;
}
public void setLicenseUpperLimitStr(String licenseUpperLimitStr) {
this.licenseUpperLimitStr = licenseUpperLimitStr;
}
public String getVersionCode() {
return versionCode;
}
......@@ -160,27 +143,7 @@ public class EnterpriseListDTO implements Serializable{
}
public String getServiceInfo() {
if (licenseUpperLimitStr == null || licenseUpperLimitStr == "") {
return "--";
} else {
//按照会员卡、服务号、小程序、门店分别展示
//数据格式 名称:数值-名称2:数值2
Map<String, Object> map = Arrays.stream(licenseUpperLimitStr.split("-"))
.map(e -> e.split(":"))
.collect(Collectors.toMap(e -> e[0], e -> e[1]));
Object memberCard = map.get(LicenseUtils.MEMBER_CARD_LICENSE_NAME);
Object serviceCard = map.get(LicenseUtils.SERVICE_CARD_LICENSE_NAME);
Object weChat = map.get(LicenseUtils.WECHAT_LICENSE_NAME);
Object store = map.get(LicenseUtils.STORE_LICENSE_NAME);
//商品license,用于前端license扩容的时候判断:商品数量不变,不提交商品license数据给接口
Object goods = map.get(LicenseUtils.GOODS_LICENSE_NAME);
setGoodsCount(goods == null ? 0 : Integer.parseInt(goods.toString()));
return (memberCard == null ? "0" : memberCard.toString()) + "-"
+ (serviceCard == null ? "0" : serviceCard.toString()) + "-"
+ (weChat == null ? "0" : weChat.toString()) + "-"
+ (store == null ? "0" : store.toString());
}
return serviceInfo;
}
public void setServiceInfo(String serviceInfo) {
......
......@@ -63,6 +63,8 @@ public class LicenseDTO implements Serializable{
*/
private Integer alreadyBuyQuantity;
private ServeLicenseDTO licenseDetail;
private boolean licenseEditFlag;
public String getServeId() {
......@@ -201,4 +203,13 @@ public class LicenseDTO implements Serializable{
this.licenseEditFlag = licenseEditFlag;
return this;
}
public ServeLicenseDTO getLicenseDetail() {
return licenseDetail;
}
public LicenseDTO setLicenseDetail(ServeLicenseDTO licenseDetail) {
this.licenseDetail = licenseDetail;
return this;
}
}
package com.gic.enterprise.dto.market;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* license 详情
* @ClassName: ServeLicenseDTO

* @Description: 

* @author guojuxing

* @date 2020/7/23 1:54 PM

*/
public class ServeLicenseDTO implements Serializable{
private static final long serialVersionUID = -8500185445615084852L;
/**
* 主键
*/
private Long licenseId;
/**
* 名称
*/
private String licenseName;
/**
* 单位
*/
private String licenseUnit;
/**
* 服务商
*/
private Long isvId;
/**
* 图片
*/
private String imageUrl;
/**
* 图片ID(用于删除)
*/
private String imageFileId;
/**
* 应用ID
*/
private Long applicationId;
/**
* 服务ID
*/
private Long serveId;
/**
* 审核状态(-1: 未审核; 0:审核失败;1:已审核)
*/
private Integer auditStatus;
/**
* 审核拒绝原因
*/
private String refuseReason;
/**
* 服务状态(0:未上架; 1: 已上架)
*/
private Integer licenseStatus;
/**
* 简介
*/
private String licenseIntro;
/**
* 适用版本 1通用 2部分版本
*/
private Integer versionType;
/**
* 最小数量
*/
private Integer minQuantity;
/**
* 最大数量
*/
private Integer maxQuantity;
/**
* 计价方式1单价 2区间价 3阶梯价
*/
private Integer priceType;
/**
* 单价
*/
private BigDecimal unitPrice;
/**
* 价格详情[{min:1,max:100,price:100}...]
*/
private String priceDetail;
/**
* 0gic 1好办
*/
private Integer appType;
private Integer deleteFlag;
private Date createTime;
private Date updateTime;
private String licenseCode;
/**
* 应用名称
*/
private String serveName;
/**
* 应用名称
*/
private String applicationName;
/**
* 应用分类名称
*/
private String appCategoryName;
/**
* 应用图片
*/
private String applicationUrl;
/**
* 服务商账号
*/
private String isvAccount;
/**
* 服务商名称
*/
private String isvName;
/**
* 服务图片
*/
private String serveImageUrl;
//购买数量
private Integer buyQuantity;
//购买价格
private BigDecimal buyPrice;
// 是否已购买
private boolean isBuy = false;
// 已购数量
private Integer validQuantity = 0;
public Long getLicenseId() {
return licenseId;
}
public ServeLicenseDTO setLicenseId(Long licenseId) {
this.licenseId = licenseId;
return this;
}
public String getLicenseName() {
return licenseName;
}
public ServeLicenseDTO setLicenseName(String licenseName) {
this.licenseName = licenseName;
return this;
}
public String getLicenseUnit() {
return licenseUnit;
}
public ServeLicenseDTO setLicenseUnit(String licenseUnit) {
this.licenseUnit = licenseUnit;
return this;
}
public Long getIsvId() {
return isvId;
}
public ServeLicenseDTO setIsvId(Long isvId) {
this.isvId = isvId;
return this;
}
public String getImageUrl() {
return imageUrl;
}
public ServeLicenseDTO setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
return this;
}
public String getImageFileId() {
return imageFileId;
}
public ServeLicenseDTO setImageFileId(String imageFileId) {
this.imageFileId = imageFileId;
return this;
}
public Long getApplicationId() {
return applicationId;
}
public ServeLicenseDTO setApplicationId(Long applicationId) {
this.applicationId = applicationId;
return this;
}
public Long getServeId() {
return serveId;
}
public ServeLicenseDTO setServeId(Long serveId) {
this.serveId = serveId;
return this;
}
public Integer getAuditStatus() {
return auditStatus;
}
public ServeLicenseDTO setAuditStatus(Integer auditStatus) {
this.auditStatus = auditStatus;
return this;
}
public String getRefuseReason() {
return refuseReason;
}
public ServeLicenseDTO setRefuseReason(String refuseReason) {
this.refuseReason = refuseReason;
return this;
}
public Integer getLicenseStatus() {
return licenseStatus;
}
public ServeLicenseDTO setLicenseStatus(Integer licenseStatus) {
this.licenseStatus = licenseStatus;
return this;
}
public String getLicenseIntro() {
return licenseIntro;
}
public ServeLicenseDTO setLicenseIntro(String licenseIntro) {
this.licenseIntro = licenseIntro;
return this;
}
public Integer getVersionType() {
return versionType;
}
public ServeLicenseDTO setVersionType(Integer versionType) {
this.versionType = versionType;
return this;
}
public Integer getMinQuantity() {
return minQuantity;
}
public ServeLicenseDTO setMinQuantity(Integer minQuantity) {
this.minQuantity = minQuantity;
return this;
}
public Integer getMaxQuantity() {
return maxQuantity;
}
public ServeLicenseDTO setMaxQuantity(Integer maxQuantity) {
this.maxQuantity = maxQuantity;
return this;
}
public Integer getPriceType() {
return priceType;
}
public ServeLicenseDTO setPriceType(Integer priceType) {
this.priceType = priceType;
return this;
}
public BigDecimal getUnitPrice() {
return unitPrice;
}
public ServeLicenseDTO setUnitPrice(BigDecimal unitPrice) {
this.unitPrice = unitPrice;
return this;
}
public String getPriceDetail() {
return priceDetail;
}
public ServeLicenseDTO setPriceDetail(String priceDetail) {
this.priceDetail = priceDetail;
return this;
}
public Integer getAppType() {
return appType;
}
public ServeLicenseDTO setAppType(Integer appType) {
this.appType = appType;
return this;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public ServeLicenseDTO setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
return this;
}
public Date getCreateTime() {
return createTime;
}
public ServeLicenseDTO setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public ServeLicenseDTO setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
public String getLicenseCode() {
return licenseCode;
}
public ServeLicenseDTO setLicenseCode(String licenseCode) {
this.licenseCode = licenseCode;
return this;
}
public String getServeName() {
return serveName;
}
public ServeLicenseDTO setServeName(String serveName) {
this.serveName = serveName;
return this;
}
public String getApplicationName() {
return applicationName;
}
public ServeLicenseDTO setApplicationName(String applicationName) {
this.applicationName = applicationName;
return this;
}
public String getAppCategoryName() {
return appCategoryName;
}
public ServeLicenseDTO setAppCategoryName(String appCategoryName) {
this.appCategoryName = appCategoryName;
return this;
}
public String getApplicationUrl() {
return applicationUrl;
}
public ServeLicenseDTO setApplicationUrl(String applicationUrl) {
this.applicationUrl = applicationUrl;
return this;
}
public String getIsvAccount() {
return isvAccount;
}
public ServeLicenseDTO setIsvAccount(String isvAccount) {
this.isvAccount = isvAccount;
return this;
}
public String getIsvName() {
return isvName;
}
public ServeLicenseDTO setIsvName(String isvName) {
this.isvName = isvName;
return this;
}
public String getServeImageUrl() {
return serveImageUrl;
}
public ServeLicenseDTO setServeImageUrl(String serveImageUrl) {
this.serveImageUrl = serveImageUrl;
return this;
}
public Integer getBuyQuantity() {
return buyQuantity;
}
public ServeLicenseDTO setBuyQuantity(Integer buyQuantity) {
this.buyQuantity = buyQuantity;
return this;
}
public BigDecimal getBuyPrice() {
return buyPrice;
}
public ServeLicenseDTO setBuyPrice(BigDecimal buyPrice) {
this.buyPrice = buyPrice;
return this;
}
public boolean isBuy() {
return isBuy;
}
public ServeLicenseDTO setBuy(boolean buy) {
isBuy = buy;
return this;
}
public Integer getValidQuantity() {
return validQuantity;
}
public ServeLicenseDTO setValidQuantity(Integer validQuantity) {
this.validQuantity = validQuantity;
return this;
}
}
......@@ -2,13 +2,13 @@ package com.gic.enterprise.utils;
public class LicenseUtils {
public static final String GOODS_LICENSE_NAME = "商品数量";
public static final String MEMBER_CARD_LICENSE_NAME = "会员卡";
public static final String SERVICE_CARD_LICENSE_NAME = "服务号";
public static final String WECHAT_LICENSE_NAME = "小程序";
public static final String STORE_LICENSE_NAME = "门店";
public static final String GOODS_LICENSE_CODE = "Item_Number";
public static final String MEMBER_CARD_LICENSE_CODE = "member_card";
public static final String SERVICE_CARD_LICENSE_CODE = "wxfwh";
public static final String WECHAT_LICENSE_CODE = "wxapp";
public static final String STORE_LICENSE_CODE = "165165";
public static boolean isGoodsLicense(String licenseName) {
return GOODS_LICENSE_NAME.equals(licenseName);
public static boolean isGoodsLicense(String licenseCode) {
return GOODS_LICENSE_CODE.equals(licenseCode);
}
}
......@@ -22,18 +22,8 @@ public class CustomUdeskFieldApiServiceImpl implements CustomUdeskFieldApiServic
@Override
public ServiceResponse<List<CustomChatFiledDTO>> listAllField() {
String key = "custom:chat:field";
Object cache = RedisUtil.getCache(key);
if(cache != null){
List<CustomChatFiledDTO> list = (List<CustomChatFiledDTO>) cache;
return ServiceResponse.success(list);
}
List<CustomChatFiledDTO> list = new ArrayList<>();
for (WechatServiceFieldEnum fieldEnum : WechatServiceFieldEnum.values()) {
list.add(new CustomChatFiledDTO(fieldEnum.getMessage(), String.valueOf(fieldEnum.getCode()), fieldEnum.getFieldType()));
}
RedisUtil.setCache(key, list);
return ServiceResponse.success(list);
return ServiceResponse.success();
}
@Override
......
......@@ -2,10 +2,14 @@ package com.gic.enterprise.service.outer.impl;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import com.gic.commons.util.CollectionUtil;
import com.gic.enterprise.constant.BillingAuditStatusEnum;
import com.gic.enterprise.dto.market.ServeLicenseDTO;
import com.gic.enterprise.utils.LicenseUtils;
import com.gic.marketing.process.api.service.sms.SmsSendApiService;
import com.gic.open.api.service.EnterpriseLicenseApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -90,6 +94,8 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
private DataConfigApiService dataConfigApiService;
@Autowired
private SmsSendApiService smsSendApiService;
@Autowired
private EnterpriseLicenseApiService enterpriseLicenseApiService;
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -438,24 +444,24 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
List<com.gic.enterprise.dto.market.OrderBuyLicenseDTO> orderBuyLicenseDTOList = basicParams.getLicenseList();
List<OrderBuyLicenseDTO> licenseListParams = EntityUtil.changeEntityListNew(OrderBuyLicenseDTO.class,
orderBuyLicenseDTOList);
if (basicParams.getOrderType() != null && basicParams.getOrderType().intValue() == 4
&& CollectionUtils.isEmpty(licenseListParams)) {
//扩容
if (!basicParams.isCommitFlag()) {
//获取基本数据信息
List<EnterpriseLicenseDTO> gicLicenseList = enterpriseLicenseService
.listByEnterpriseId(basicParams.getEnterpriseId().intValue());
if (CollectionUtils.isNotEmpty(gicLicenseList)) {
licenseListParams = new ArrayList<>();
for (EnterpriseLicenseDTO licenseDTO : gicLicenseList) {
OrderBuyLicenseDTO temp = new OrderBuyLicenseDTO();
temp.setLicenseId(licenseDTO.getLicenseId());
temp.setNum(licenseDTO.getUpperLimit());
licenseListParams.add(temp);
}
}
}
}
// if (basicParams.getOrderType() != null && basicParams.getOrderType().intValue() == 4
// && CollectionUtils.isEmpty(licenseListParams)) {
// //扩容
// if (!basicParams.isCommitFlag()) {
// //获取基本数据信息
// List<EnterpriseLicenseDTO> gicLicenseList = enterpriseLicenseService
// .listByEnterpriseId(basicParams.getEnterpriseId().intValue());
// if (CollectionUtils.isNotEmpty(gicLicenseList)) {
// licenseListParams = new ArrayList<>();
// for (EnterpriseLicenseDTO licenseDTO : gicLicenseList) {
// OrderBuyLicenseDTO temp = new OrderBuyLicenseDTO();
// temp.setLicenseId(licenseDTO.getLicenseId());
// temp.setNum(licenseDTO.getUpperLimit());
// licenseListParams.add(temp);
// }
// }
// }
// }
ServiceResponse<OrderCheckDTO> result = orderPurchaseApiService.buyForGic(basicParams.getEnterpriseId(),
basicParams.getName(), basicParams.getSkuId(), basicParams.getCouponLogId(), basicParams.getOrderType(),
......@@ -486,9 +492,10 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
} else if (serviceType == 2) {
//license
LicenseDTO license = EntityUtil.changeEntityNew(LicenseDTO.class, orderItem);
license.setLicenseDetail(EntityUtil.changeEntityNew(ServeLicenseDTO.class, orderItem.getLicenseDetail()));
//没有商品权限
if (!hasGoodsAuth) {
if (LicenseUtils.GOODS_LICENSE_NAME.equals(orderItem.getServeName())) {
if (LicenseUtils.isGoodsLicense(orderItem.getLicenseDetail().getLicenseCode())) {
continue;
}
}
......@@ -517,7 +524,20 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
@Override
public ServiceResponse<List<EnterpriseLicenseDTO>> listEnterpriseLicense(Integer enterpriseId) {
return ServiceResponse.success(enterpriseLicenseService.listByEnterpriseId(enterpriseId));
ServiceResponse<List<ApplicationLicenseDTO>> hasBuyLicense = enterpriseLicenseApiService.listEnterpriseBuyLicense(Arrays.asList(enterpriseId));
if (hasBuyLicense.isSuccess()) {
List<ApplicationLicenseDTO> licenseList = hasBuyLicense.getResult();
if (CollectionUtils.isNotEmpty(licenseList)) {
return ServiceResponse.success(licenseList.stream()
.map(e -> new EnterpriseLicenseDTO()
.setLicenseId(e.getLicenseId())
.setUpperLimit(e.getQuantity())
.setLicenseName(e.getLicenseName())
.setLicenseCode(e.getLicenseCode())
).collect(Collectors.toList()));
}
}
return ServiceResponse.success(Collections.emptyList());
}
@Override
......
......@@ -143,4 +143,6 @@
<dubbo:reference interface="com.gic.wechat.business.api.service.wxa.WeixinWxaFunService" id="weixinWxaFunService" timeout="60000" />
<dubbo:reference interface="com.gic.weimob.api.service.WeimobMerchantService" id="weimobMerchantService" timeout="6000"/>
<dubbo:reference interface="com.gic.open.api.service.EnterpriseLicenseApiService" id="enterpriseLicenseApiService" timeout="6000" />
</beans>
......@@ -196,7 +196,10 @@
</update>
<select id="listByParams" resultMap="BaseResultMap" parameterType="com.gic.enterprise.qo.AppletPageQO">
select <include refid="Base_Column_List"></include>
select
<include refid="Base_Column_List"></include>
,
<include refid="Blob_Column_List" />
from tab_applet_custom_page
where status between 1 and 2
<if test="search != null and search != '' ">
......@@ -233,7 +236,10 @@
</update>
<select id="listEnablePage" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
select
<include refid="Base_Column_List"></include>
,
<include refid="Blob_Column_List" />
from tab_applet_custom_page
where status = 1
and enterprise_id = #{enterpriseId}
......@@ -252,7 +258,10 @@
</select>
<select id="getDefault" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
select
<include refid="Base_Column_List"></include>
,
<include refid="Blob_Column_List" />
from tab_applet_custom_page
where status = 1
and enterprise_id = -1
......
......@@ -89,7 +89,7 @@
#{appId,jdbcType=VARCHAR},
</if>
<if test="fieldType != null">
#{field_type,jdbcType=INTEGER},
#{fieldType,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
......
......@@ -283,7 +283,6 @@
a.company_name companyName,
a.create_time createTime,
a.is_init_complete isInitComplete,
GROUP_CONCAT(concat(b.license_name,':',b.upper_limit) separator '-') licenseUpperLimitStr,
a.version_code versionCode,
a.version_name versionName,
a.audit_time expirationTime,
......@@ -291,7 +290,6 @@
if(a.audit_time is not null, DATEDIFF(a.audit_time, now()), 0) aboutToExpireDay
FROM
tab_enterprise a
LEFT JOIN tab_enterprise_license b ON a.enterprise_id = b.enterprise_id
where status = 1
<if test="search != null and search != '' ">
......
......@@ -8,6 +8,7 @@ import com.gic.enterprise.constant.applet.AppletPageTypeEnum;
import com.gic.enterprise.dto.AppletCustomPageDTO;
import com.gic.enterprise.dto.CustomChatFiledDTO;
import com.gic.enterprise.dto.CustomUdeskFieldDTO;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.qo.AppletPageQO;
import com.gic.enterprise.service.AppletCustomPageApiService;
import com.gic.enterprise.service.CustomUdeskFieldApiService;
......@@ -15,6 +16,7 @@ import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import org.apache.catalina.User;
import org.apache.commons.collections.CollectionUtils;
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;
......@@ -64,6 +66,9 @@ public class CustomChatController {
@RequestMapping("list-enterprise-field")
public RestResponse listEnterpriseField(String appId) {
if (StringUtils.isBlank(appId)) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "appId不能为空");
}
//初始化
for (WechatServiceFieldEnum fieldEnum : WechatServiceFieldEnum.values()) {
customUdeskFieldApiService.saveEnterpriseField(new CustomUdeskFieldDTO()
......@@ -71,7 +76,7 @@ public class CustomChatController {
.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId())
.setGicFieldId(fieldEnum.getCode())
.setGicFieldName(fieldEnum.getMessage())
.setStatus(0)
.setStatus(2)
.setFieldType(fieldEnum.getFieldType()));
}
......
......@@ -7,9 +7,12 @@ import java.util.stream.Collectors;
import com.gic.authcenter.security.core.constant.DataResourceEnum;
import com.gic.authcenter.security.core.dto.AuthcenterUserDetails;
import com.gic.enterprise.constants.Constants;
import com.gic.enterprise.dto.*;
import com.gic.marketing.api.service.sms.SmsOuterApiService;
import com.gic.member.config.api.dto.OwnerMemberCardDTO;
import com.gic.member.config.api.service.MemberCardApiService;
import com.gic.open.api.dto.ApplicationLicenseDTO;
import com.gic.open.api.service.*;
import com.gic.operation.web.vo.MemberCardVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
......@@ -36,10 +39,6 @@ import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.constant.EnterpriseInitCodeEnum;
import com.gic.enterprise.constant.EnterpriseListOrderByEnum;
import com.gic.enterprise.constant.EnterpriseVersionStatusEnum;
import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.dto.EnterpriseInitDTO;
import com.gic.enterprise.dto.EnterpriseLicenseDTO;
import com.gic.enterprise.dto.EnterpriseResourceRelDTO;
import com.gic.enterprise.dto.market.OrderBuyLicenseDTO;
import com.gic.enterprise.dto.market.OrderGicDTO;
import com.gic.enterprise.error.ErrorCode;
......@@ -60,10 +59,6 @@ import com.gic.open.api.dto.ApplicationTokenDTO;
import com.gic.open.api.dto.OrderDTO;
import com.gic.open.api.dto.OrderItemDTO;
import com.gic.open.api.dto.market.MarketUserDTO;
import com.gic.open.api.service.AppTokenApiService;
import com.gic.open.api.service.CouponApiService;
import com.gic.open.api.service.OrderApiService;
import com.gic.open.api.service.ServeApiService;
import com.gic.open.api.service.market.MarketAppCategoryApiService;
import com.gic.open.api.service.market.MarketUserApiService;
import com.gic.operation.web.qo.PageQO;
......@@ -112,6 +107,8 @@ public class EnterpriseController {
private MemberCardApiService memberCardApiService;
@Autowired
private SmsOuterApiService smsOuterApiService;
@Autowired
private EnterpriseLicenseApiService enterpriseLicenseApiService;
@RequestMapping("/save-enterprise")
public RestResponse saveEnterprise(
......@@ -186,7 +183,48 @@ public class EnterpriseController {
if (permissionAll) {
params.setListAll(1);
}
return ResultControllerUtils.commonResult(enterpriseApiService.listEnterprise(params));
ServiceResponse<Page<EnterpriseListDTO>> response = enterpriseApiService.listEnterprise(params);
if (response.isSuccess()) {
Page<EnterpriseListDTO> pageResult = response.getResult();
if (pageResult != null) {
List<EnterpriseListDTO> listResult = pageResult.getResult();
if (CollectionUtils.isNotEmpty(listResult)) {
List<Integer> tempEnterpriseIdList = listResult.stream()
.filter(e -> e.getServiceStatus().intValue() != 0)
.map(e -> e.getEnterpriseId())
.collect(Collectors.toList());
//实时查询license数据
ServiceResponse<List<ApplicationLicenseDTO>> hasBuyLicense = enterpriseLicenseApiService.listEnterpriseBuyLicense(tempEnterpriseIdList);
if (hasBuyLicense.isSuccess()) {
List<ApplicationLicenseDTO> licenseList = hasBuyLicense.getResult();
if (CollectionUtils.isNotEmpty(licenseList)) {
Map<String, List<ApplicationLicenseDTO>> licenseMap = CollectionUtil.group(licenseList, "enterpriseId");
listResult.forEach(e -> {
List<ApplicationLicenseDTO> tempLicense = licenseMap.get(Long.valueOf(e.getEnterpriseId()));
if (CollectionUtils.isNotEmpty(tempLicense)) {
Set<String> licenseCodeSet = new HashSet<>(Arrays.asList("165165", "member_card", "wxapp", "wxfwh"));
Map<String, Integer> showLicenseMap = new HashMap<>(8);
tempLicense.forEach(license -> {
if (licenseCodeSet.contains(license.getLicenseCode())) {
showLicenseMap.put(license.getLicenseCode(), license.getQuantity());
}
});
Integer memberCardNum = showLicenseMap.get("member_card") == null ? 0 : showLicenseMap.get("member_card");
Integer wxfwhNum = showLicenseMap.get("wxfwh") == null ? 0 : showLicenseMap.get("wxfwh");
Integer wxappNum = showLicenseMap.get("wxapp") == null ? 0 : showLicenseMap.get("wxapp");
Integer storeNum = showLicenseMap.get("165165") == null ? 0 : showLicenseMap.get("165165");
e.setServiceInfo(memberCardNum + "-" + wxfwhNum + "-" + wxappNum + "-" + storeNum);
}
});
}
}
}
return RestResponse.success(pageResult);
}
}
return ResultControllerUtils.commonResult(response);
}
/**
......
......@@ -92,4 +92,5 @@
<dubbo:reference interface="com.gic.authcenter.api.service.GicDepartmentService" id="gicDepartmentService" timeout="6000" />
<dubbo:reference interface="com.gic.member.config.api.service.MemberCardApiService" id="memberCardApiService" timeout="6000" />
<dubbo:reference interface="com.gic.open.api.service.EnterpriseLicenseApiService" id="enterpriseLicenseApiService" timeout="6000" />
</beans>
\ 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