Commit afd61885 by zhiwj

渠道资源

parent 1c21910d
......@@ -9,7 +9,8 @@ package com.gic.auth.constant;
public enum OrderOrAppEnum {
ORDER(1, "订单"),
APP(2, "应用"),
SMS_SIGN(3, "短信签名")
SMS_SIGN(3, "短信签名"),
CHANNEL(4, "渠道")
;
private Integer code;
......
......@@ -95,6 +95,9 @@ public class ResourceDTO implements Serializable {
private Integer smsSignResource;
private String smsSignResourceJson;
private Integer channelResource;
private String channelResourceJson;
private Integer userResourceCount;
public Integer getResourceId() {
......@@ -224,4 +227,20 @@ public class ResourceDTO implements Serializable {
public void setUserResource(Long userResource) {
this.userResource = userResource;
}
public void setChannelResourceJson(String channelResourceJson) {
this.channelResourceJson = channelResourceJson;
}
public String getChannelResourceJson() {
return channelResourceJson;
}
public void setChannelResource(Integer channelResource) {
this.channelResource = channelResource;
}
public Integer getChannelResource() {
return channelResource;
}
}
......@@ -62,11 +62,16 @@ public class TabSysResource {
private Integer appResource;
/**
* 短信签名资源 [ { "type":1, // 全部签名:1, 部分签名:2 "ids":[1,2,3] } ]
* 短信签名资源 { "type":1, // 全部签名:1, 部分签名:2 "ids":[1,2,3] }
*/
private Integer smsSignResource;
/**
* 渠道资源
*/
private Integer channelResource;
/**
*
*/
private Date createTime;
......@@ -177,6 +182,14 @@ public class TabSysResource {
this.smsSignResource = smsSignResource;
}
public Integer getChannelResource() {
return channelResource;
}
public void setChannelResource(Integer channelResource) {
this.channelResource = channelResource;
}
public Date getCreateTime() {
return createTime;
}
......
......@@ -78,6 +78,14 @@ public class ResourceApiServiceImpl implements ResourceApiService {
Integer smsSign = orderAppResourceService.save(smsSignDTO);
resourceDTO.setSmsSignResource(smsSign);
OrderAppResourceDTO channelDTO = new OrderAppResourceDTO();
channelDTO.setEnterpriseId(resourceDTO.getEnterpriseId());
channelDTO.setType(OrderOrAppEnum.CHANNEL.getCode());
channelDTO.setContent(resourceDTO.getChannelResourceJson());
Integer channel = orderAppResourceService.save(channelDTO);
resourceDTO.setChannelResource(channel);
if (resourceDTO.getResourceId() == null) {
// save
resourceService.save(resourceDTO);
......@@ -88,6 +96,7 @@ public class ResourceApiServiceImpl implements ResourceApiService {
orderAppResourceService.del(resource.getOrderResource());
orderAppResourceService.del(resource.getAppResource());
orderAppResourceService.del(resource.getSmsSignResource());
orderAppResourceService.del(resource.getChannelResource());
resourceService.update(resourceDTO);
}
return ServiceResponse.success();
......@@ -139,6 +148,10 @@ public class ResourceApiServiceImpl implements ResourceApiService {
TabSysOrderAppResource smsSignResource = orderAppResourceService.getById(resourceDTO.getSmsSignResource());
resourceDTO.setSmsSignResourceJson(smsSignResource.getContent());
}
if (resourceDTO.getChannelResource() != null) {
TabSysOrderAppResource channelResource = orderAppResourceService.getById(resourceDTO.getChannelResource());
resourceDTO.setChannelResourceJson(channelResource.getContent());
}
return ServiceResponse.success(resourceDTO);
}
......
......@@ -14,6 +14,7 @@
<result column="order_resource" jdbcType="INTEGER" property="orderResource" />
<result column="app_resource" jdbcType="INTEGER" property="appResource" />
<result column="sms_sign_resource" jdbcType="INTEGER" property="smsSignResource" />
<result column="channel_resource" jdbcType="INTEGER" property="channelResource" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="status" jdbcType="INTEGER" property="status" />
......@@ -21,7 +22,7 @@
<sql id="Base_Column_List">
resource_id, resource_name, enterprise_id, user_resource, member_card_resource, fwh_resource,
applet_resource, store_resource, goods_resource_id, order_resource, app_resource,
sms_sign_resource, create_time, update_time, status
sms_sign_resource, channel_resource, create_time, update_time, status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -38,14 +39,14 @@
user_resource, member_card_resource, fwh_resource,
applet_resource, store_resource, goods_resource_id,
order_resource, app_resource, sms_sign_resource,
create_time, update_time, status
)
channel_resource, create_time, update_time,
status)
values (#{resourceId,jdbcType=INTEGER}, #{resourceName,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=INTEGER},
#{userResource,jdbcType=BIGINT}, #{memberCardResource,jdbcType=BIGINT}, #{fwhResource,jdbcType=BIGINT},
#{appletResource,jdbcType=BIGINT}, #{storeResource,jdbcType=BIGINT}, #{goodsResourceId,jdbcType=BIGINT},
#{orderResource,jdbcType=INTEGER}, #{appResource,jdbcType=INTEGER}, #{smsSignResource,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}
)
#{channelResource,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.auth.entity.TabSysResource">
insert into tab_sys_resource
......@@ -86,6 +87,9 @@
<if test="smsSignResource != null">
sms_sign_resource,
</if>
<if test="channelResource != null">
channel_resource,
</if>
<if test="createTime != null">
create_time,
</if>
......@@ -133,6 +137,9 @@
<if test="smsSignResource != null">
#{smsSignResource,jdbcType=INTEGER},
</if>
<if test="channelResource != null">
#{channelResource,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
......@@ -180,6 +187,9 @@
<if test="smsSignResource != null">
sms_sign_resource = #{smsSignResource,jdbcType=INTEGER},
</if>
<if test="channelResource != null">
channel_resource = #{channelResource,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
......@@ -205,6 +215,7 @@
order_resource = #{orderResource,jdbcType=INTEGER},
app_resource = #{appResource,jdbcType=INTEGER},
sms_sign_resource = #{smsSignResource,jdbcType=INTEGER},
channel_resource = #{channelResource,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER}
......
......@@ -24,6 +24,7 @@
<gic-redis-data>4.0-SNAPSHOT</gic-redis-data>
<gic-marketing-api>4.0-SNAPSHOT</gic-marketing-api>
<gic-open-platform-api>4.0-SNAPSHOT</gic-open-platform-api>
<gic-member-config-api>4.0-SNAPSHOT</gic-member-config-api>
</properties>
<dependencies>
......@@ -159,6 +160,11 @@
<artifactId>gic-marketing-process-api</artifactId>
<version>${gic-marketing-process-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-member-config-api</artifactId>
<version>${gic-member-config-api}</version>
</dependency>
</dependencies>
<build>
......
package com.gic.auth.web.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.constant.LoginUserTypeEnum;
import com.gic.auth.dto.MenuDTO;
import com.gic.auth.dto.ResourceDTO;
import com.gic.auth.dto.UserDTO;
import com.gic.auth.dto.UserResourceDTO;
import com.gic.auth.service.*;
import com.gic.enterprise.base.UserResourceInfo;
import com.gic.enterprise.constants.Constants;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.MenuDTO;
import com.gic.auth.dto.UserDTO;
import com.gic.auth.web.vo.ChannelResourceVO;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.Md5Util;
import com.gic.commons.webapi.reponse.RestResponse;
......@@ -33,6 +16,8 @@ import com.gic.enterprise.ano.IgnoreLogin;
import com.gic.enterprise.base.EnterpriseInfo;
import com.gic.enterprise.base.MenuInfo;
import com.gic.enterprise.base.UserInfo;
import com.gic.enterprise.base.UserResourceInfo;
import com.gic.enterprise.constants.Constants;
import com.gic.enterprise.context.UserContext;
import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.error.ErrorCode;
......@@ -40,6 +25,24 @@ import com.gic.enterprise.response.EnterpriseRestResponse;
import com.gic.enterprise.service.EnterpriseApiService;
import com.gic.enterprise.utils.UserDetail;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.member.config.api.service.AppletsConfigApiService;
import com.gic.member.config.api.service.MemberCardApiService;
import com.gic.member.config.api.service.ServiceConfigApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class LoginController {
......@@ -57,6 +60,12 @@ public class LoginController {
private UserResourceApiService userResourceApiService;
@Autowired
private ResourceApiService resourceApiService;
@Autowired
private MemberCardApiService memberCardApiService;
@Autowired
private AppletsConfigApiService appletsConfigApiService;
@Autowired
private ServiceConfigApiService serviceConfigApiService;
@RequestMapping("list-enterprise-by-phone")
public RestResponse listUserEnterprise(String phoneNumber, String nationCode) {
......@@ -219,6 +228,16 @@ public class LoginController {
userResourceInfo.setAppResource(serviceResource.getResult().getAppResource());
userResourceInfo.setOrderResource(serviceResource.getResult().getOrderResource());
userResourceInfo.setSmsSignResource(serviceResource.getResult().getSmsSignResource());
// 取的渠道资源
String channelResourceJson = serviceResource.getResult().getChannelResourceJson();
if (StringUtils.isNotBlank(channelResourceJson)) {
ChannelResourceVO channelResourceVO = JSON.parseObject(channelResourceJson, ChannelResourceVO.class);
userResourceInfo.setCardConfigIdList(channelResourceVO.getCardConfigIdList());
userResourceInfo.setAppletConfigIdList(channelResourceVO.getAppletConfigIdList());
userResourceInfo.setServiceConfigIdList(channelResourceVO.getServiceConfigIdList());
}
detail.setUserResourceInfo(userResourceInfo);
}
}
......
......@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.constant.OrderResourceChannelEnum;
import com.gic.auth.dto.ChannelResourceDTO;
import com.gic.auth.dto.ResourceDTO;
import com.gic.auth.dto.SmsSignResourceDTO;
import com.gic.auth.service.ResourceApiService;
......@@ -24,6 +25,12 @@ import com.gic.goods.api.dto.GoodsRightsSelectorDTO;
import com.gic.goods.api.service.GoodsRightsSelectorApiService;
import com.gic.marketing.api.dto.sms.EnterpriseSmsSignDTO;
import com.gic.marketing.api.service.sms.SmsApiService;
import com.gic.member.config.api.dto.AppletsConfigSimpleOutputDTO;
import com.gic.member.config.api.dto.OwnerMemberCardDTO;
import com.gic.member.config.api.dto.ServiceConfigSimpleOutputDTO;
import com.gic.member.config.api.service.AppletsConfigApiService;
import com.gic.member.config.api.service.MemberCardApiService;
import com.gic.member.config.api.service.ServiceConfigApiService;
import com.gic.open.api.dto.ApplicationDTO;
import com.gic.open.api.dto.ApplicationSubDTO;
import com.gic.open.api.service.AppTokenApiService;
......@@ -37,9 +44,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.*;
/**
*
......@@ -62,6 +67,12 @@ public class ResourceController {
private AppTokenApiService appTokenApiService;
@Autowired
private ApplicationSubApiService applicationSubApiService;
@Autowired
private MemberCardApiService memberCardApiService;
@Autowired
private AppletsConfigApiService appletsConfigApiService;
@Autowired
private ServiceConfigApiService serviceConfigApiService;
@RequestMapping("/list-resource-app")
public RestResponse listResourceApp() {
......@@ -135,6 +146,9 @@ public class ResourceController {
if (resourceQO.getSmsResourceJSON() != null) {
resourceDTO.setSmsSignResourceJson(JSON.toJSONString(resourceQO.getSmsResourceJSON()));
}
if (resourceQO.getChannelResourceVO() != null) {
resourceDTO.setChannelResourceJson(JSON.toJSONString(resourceQO.getChannelResourceVO()));
}
ServiceResponse<Integer> response = resourceApiService.saveOrUpdateResource(resourceDTO);
if(response.isSuccess()){
......@@ -192,6 +206,10 @@ public class ResourceController {
SmsSignResourceDTO smsSignResourceDTO = JSON.parseObject(dto.getSmsSignResourceJson(), SmsSignResourceDTO.class);
vo.setSmsResourceJSON(smsSignResourceDTO);
}
if (StringUtils.isNotBlank(dto.getChannelResourceJson())) {
ChannelResourceDTO channelResourceDTO = JSON.parseObject(dto.getChannelResourceJson(), ChannelResourceDTO.class);
vo.setChannelResourceJSON(channelResourceDTO);
}
ServiceResponse<GoodsRightsSelectorDTO> goodsResponse = this.goodsRightsSelectorApiService.getGoodsRightsSelector(response.getResult().getGoodsResourceId(), UserDetailUtils.getUserDetail().getEnterpriseId());
if(goodsResponse.isSuccess()){
if(goodsResponse.getResult() != null){
......@@ -203,6 +221,20 @@ public class ResourceController {
return EnterpriseRestResponse.failure(response);
}
@RequestMapping("/channel-resource")
public RestResponse channelResource() {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
List<OwnerMemberCardDTO> memberCardList = memberCardApiService.getAll(enterpriseId).getResult();
List<AppletsConfigSimpleOutputDTO> appletList = appletsConfigApiService.listValidAppletConfigAppId(enterpriseId).getResult();
List<ServiceConfigSimpleOutputDTO> serviceList = serviceConfigApiService.listValidServiceConfigAppId(enterpriseId).getResult();
Map<String, Object> map = new HashMap<>(4);
map.put("memberCardList", memberCardList);
map.put("appletList", appletList);
map.put("serviceList", serviceList);
return RestResponse.success(map);
}
private StoreResouceVO getStoreResouce(Integer storeWidgetId) {
StoreResouceVO storeResouceVO = null;
ServiceResponse<StoreWidgetDTO> storeWidget = this.storeWidgetApiService.getStoreWidget(storeWidgetId);
......
package com.gic.auth.web.qo;
import com.gic.auth.web.vo.ChannelResourceVO;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
......@@ -68,6 +70,8 @@ public class ResourceQO implements Serializable {
private SmsSignResourceQO smsResourceJSON;
private ChannelResourceVO channelResourceVO;
public Integer getResourceId() {
return resourceId;
}
......@@ -163,4 +167,12 @@ public class ResourceQO implements Serializable {
public void setSmsResourceJSON(SmsSignResourceQO smsResourceJSON) {
this.smsResourceJSON = smsResourceJSON;
}
public ChannelResourceVO getChannelResourceVO() {
return channelResourceVO;
}
public void setChannelResourceVO(ChannelResourceVO channelResourceVO) {
this.channelResourceVO = channelResourceVO;
}
}
package com.gic.auth.web.vo;
import java.io.Serializable;
import java.util.List;
/**
* @author zhiwj
* @Description:
* @date 2020-01-09 15:04
*/
public class ChannelResourceVO implements Serializable {
private static final long serialVersionUID = -7372101518056686792L;
private List<Long> cardConfigIdList;
private List<Long> appletConfigIdList;
private List<Long> serviceConfigIdList;
public List<Long> getCardConfigIdList() {
return cardConfigIdList;
}
public void setCardConfigIdList(List<Long> cardConfigIdList) {
this.cardConfigIdList = cardConfigIdList;
}
public List<Long> getAppletConfigIdList() {
return appletConfigIdList;
}
public void setAppletConfigIdList(List<Long> appletConfigIdList) {
this.appletConfigIdList = appletConfigIdList;
}
public List<Long> getServiceConfigIdList() {
return serviceConfigIdList;
}
public void setServiceConfigIdList(List<Long> serviceConfigIdList) {
this.serviceConfigIdList = serviceConfigIdList;
}
}
package com.gic.auth.web.vo;
import com.gic.auth.dto.ChannelResourceDTO;
import com.gic.auth.dto.SmsSignResourceDTO;
import java.io.Serializable;
......@@ -59,6 +60,9 @@ public class ResourceVO implements Serializable{
private Integer userResourceCount;
private StoreResouceVO storeResouce;
private GoodsResouceVO goodsResouce;
private ChannelResourceDTO channelResourceJSON;
public Integer getResourceId() {
return resourceId;
}
......@@ -162,4 +166,12 @@ public class ResourceVO implements Serializable{
public void setSmsResourceJSON(SmsSignResourceDTO smsResourceJSON) {
this.smsResourceJSON = smsResourceJSON;
}
public void setChannelResourceJSON(ChannelResourceDTO channelResourceJSON) {
this.channelResourceJSON = channelResourceJSON;
}
public ChannelResourceDTO getChannelResourceJSON() {
return channelResourceJSON;
}
}
......@@ -71,4 +71,10 @@
<!--短信发送-->
<dubbo:reference interface="com.gic.marketing.process.api.service.sms.SmsSendApiService" id="smsSendApiService" timeout="60000" />
<dubbo:reference interface="com.gic.auth.service.UserResourceApiService" id="userResourceApiService" timeout="60000" />
<!--渠道资源-->
<dubbo:reference interface="com.gic.member.config.api.service.MemberCardApiService" id="memberCardApiService" timeout="60000" />
<dubbo:reference interface="com.gic.member.config.api.service.AppletsConfigApiService" id="appletsConfigApiService" timeout="60000" />
<dubbo:reference interface="com.gic.member.config.api.service.ServiceConfigApiService" id="serviceConfigApiService" timeout="60000" />
</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