Commit 596aa78c by 陶光胜

通过电话号码查询商户

parent 48926546
......@@ -14,14 +14,18 @@ public interface UnionEnterpriseApiService {
ServiceResponse<Integer> delUnionEnterprise(Integer unionId, Integer enterpriseId);
ServiceResponse<Integer> delUnionEnterpriseSource(Long resourceId);
ServiceResponse<UnionEnterpriseDTO> getUnionEnterpriseById(Integer unionId);
ServiceResponse<Page<UnionEnterpriseDTO>> pageUnionEnterprise(String search, Integer enterpriseId, Integer pageNum,
Integer pageSize, Integer authorizationStatus);
ServiceResponse<Void> updateStoreAuthorizationStatus(int authOrizationStatus, Integer enterpriseId, String ...message);
ServiceResponse<Void> updateStoreAuthorizationStatus(int authOrizationStatus, Integer enterpriseId, String message, String key);
ServiceResponse<List<UnionEnterpriseResourceDTO>> listStoreResourceByEnterpriseId(Integer enterpriseId);
ServiceResponse<List<UnionEnterpriseResourceDTO>> listResourceByUnionId(Integer unionId);
ServiceResponse<Void> reAuthorizationResource(Long resourceId, Integer resourceType);
}
......@@ -63,10 +63,15 @@ public interface TabSysUnionEnterpriseResourceMapper {
int updateAuthorizationStatus(@Param("authOrizationStatus") int authOrizationStatus,
@Param("enterpriseId") Integer enterpriseId,
@Param("resourceType") Integer resourceType,
@Param("authOrizationMessage") String authOrizationMessage);
@Param("authOrizationMessage") String authOrizationMessage,
@Param("key") String key);
List<UnionEnterpriseResourceDTO> listResourceByEnterpriseIdAndType(@Param("enterpriseId") Integer enterpriseId,
@Param("type") int type);
List<TabSysUnionEnterpriseResource> listResourceByUnionId(@Param("unionId") Integer unionId);
int delResourceByResourceId(Long resourceId);
List<String> getKeyByResourceId(@Param("resourceId") Long resourceId);
}
\ No newline at end of file
......@@ -13,9 +13,14 @@ public interface UnionEnterpriseResourceService {
int delResource(Integer unionId, Integer enterpriseId);
void updateAuthorizationStatus(int authOrizationStatus, Integer enterpriseId, Integer resourceType, String authOrizationMessage);
int delResource(Long resouceId);
void updateAuthorizationStatus(int authOrizationStatus, Integer enterpriseId, Integer resourceType,
String authOrizationMessage, String key);
List<UnionEnterpriseResourceDTO> listResourceByEnterpriseIdAndType(Integer enterpriseId, int type);
List<TabSysUnionEnterpriseResource> listResourceByUnionId(Integer unionId);
String getKeyByResourceId(Long resourceId);
}
......@@ -54,8 +54,15 @@ public class UnionEnterrpiseResourceServiceImpl implements UnionEnterpriseResour
}
@Override
public void updateAuthorizationStatus(int authOrizationStatus, Integer enterpriseId, Integer resourceType,String authOrizationMessage) {
this.tabSysUnionEnterpriseResourceMapper.updateAuthorizationStatus(authOrizationStatus, enterpriseId, resourceType, authOrizationMessage);
public int delResource(Long resouceId) {
return this.tabSysUnionEnterpriseResourceMapper.delResourceByResourceId(resouceId);
}
@Override
public void updateAuthorizationStatus(int authOrizationStatus, Integer enterpriseId,
Integer resourceType,String authOrizationMessage, String key) {
this.tabSysUnionEnterpriseResourceMapper.updateAuthorizationStatus(authOrizationStatus, enterpriseId,
resourceType, authOrizationMessage, key);
}
@Override
......@@ -67,4 +74,13 @@ public class UnionEnterrpiseResourceServiceImpl implements UnionEnterpriseResour
public List<TabSysUnionEnterpriseResource> listResourceByUnionId(Integer unionId) {
return this.tabSysUnionEnterpriseResourceMapper.listResourceByUnionId(unionId);
}
@Override
public String getKeyByResourceId(Long resourceId) {
List<String> list = this.tabSysUnionEnterpriseResourceMapper.getKeyByResourceId(resourceId);
if(CollectionUtils.isNotEmpty(list)){
return list.get(0);
}
return null;
}
}
......@@ -74,6 +74,12 @@ public class UnionEnterpriseApiServiceImpl implements UnionEnterpriseApiService
}
@Override
public ServiceResponse<Integer> delUnionEnterpriseSource(Long resourceId) {
int i = this.unionEnterpriseResourceService.delResource(resourceId);
return ServiceResponse.success(i);
}
@Override
public ServiceResponse<UnionEnterpriseDTO> getUnionEnterpriseById(Integer unionId) {
TabSysUnionEnterprise enterprise = this.unionEnterpriseService.getUnionEnterpriseById(unionId);
UnionEnterpriseDTO enterpriseDTO = EntityUtil.changeEntityByJSON(UnionEnterpriseDTO.class, enterprise);
......@@ -89,12 +95,9 @@ public class UnionEnterpriseApiServiceImpl implements UnionEnterpriseApiService
}
@Override
public ServiceResponse<Void> updateStoreAuthorizationStatus(int authOrizationStatus, Integer enterpriseId, String ...message) {
String authOrizationMessage = null;
if(message != null && message.length != 0){
authOrizationMessage = message[0];
}
this.unionEnterpriseResourceService.updateAuthorizationStatus(authOrizationStatus, enterpriseId, ResourceTypeEnum.STORE_RESOURCE.getCode(), authOrizationMessage);
public ServiceResponse<Void> updateStoreAuthorizationStatus(int authOrizationStatus, Integer enterpriseId, String message, String key) {
this.unionEnterpriseResourceService.updateAuthorizationStatus(authOrizationStatus, enterpriseId,
ResourceTypeEnum.STORE_RESOURCE.getCode(), message , key);
return ServiceResponse.success();
}
......@@ -110,6 +113,20 @@ public class UnionEnterpriseApiServiceImpl implements UnionEnterpriseApiService
return ServiceResponse.success(EntityUtil.changeEntityListByJSON(UnionEnterpriseResourceDTO.class, list));
}
@Override
public ServiceResponse<Void> reAuthorizationResource(Long resourceId, Integer resourceType) {
if(resourceType == ResourceTypeEnum.STORE_RESOURCE.getCode()){
}else if(resourceType == ResourceTypeEnum.GOODS_RESOURCE.getCode()){
}else if(resourceType == ResourceTypeEnum.MEMBER_RESOURCE.getCode()){
}else if(resourceType == ResourceTypeEnum.ORDER_RESOURCE.getCode()){
}
return ServiceResponse.success();
}
private int saveResource(Integer unionId, UnionEnterpriseDTO enterpriseDTO){
int i = 0;
i = this.unionEnterpriseResourceService.saveResource(unionId, enterpriseDTO.getMemberResourceId(),
......
......@@ -179,7 +179,7 @@
</update>
<update id="updateAuthorizationStatus" >
update tab_sys_union_enterprise_resource
set authorization_status=#{authOrizationStatus},authorization_time=now(),authorization_message=#{authOrizationMessage}
set authorization_status=#{authOrizationStatus},authorization_time=now(),authorization_message=#{authOrizationMessage}, key=#{key}
where enterprise_id= #{enterpriseId} and resource_type=#{resourceType} and status = 1
</update>
<select id="listResourceByEnterpriseIdAndType" resultType="com.gic.auth.dto.UnionEnterpriseResourceDTO">
......@@ -198,4 +198,16 @@
where union_id=#{unionId}
and status = 1
</select>
<update id="delResourceByResourceId" >
update tab_sys_union_enterprise_resource
set status=0
where resource = #{resourceId}
</update>
<select id="getKeyByResourceId" resultMap="BaseResultMap">
select
key
from tab_sys_union_enterprise_resource
where resource=#{resourceId}
and status = 1
</select>
</mapper>
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.gic.auth.web.controller;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.constant.ResourceTypeEnum;
import com.gic.auth.dto.AuthCodeDTO;
import com.gic.auth.dto.UnionEnterpriseDTO;
import com.gic.auth.dto.UnionEnterpriseResourceDTO;
......@@ -17,6 +18,7 @@ import com.gic.auth.web.vo.StoreResouceVO;
import com.gic.auth.web.vo.UnionEnterpriseVO;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.download.utils.log.LogUtils;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseRestResponse;
import com.gic.enterprise.utils.UserDetailUtils;
......@@ -67,6 +69,7 @@ public class UnionEnterpriseController {
}
ServiceResponse<Integer> response = this.unionEnterpriseApiService.saveUnionEnterprise(enterpriseDTO);
if(response.isSuccess()){
LogUtils.createLog("联合商户创建", unionEnterpriseQO.getUnionEnterpriseName());
return RestResponse.success(response.getResult());
}
return EnterpriseRestResponse.failure(response);
......@@ -112,17 +115,28 @@ public class UnionEnterpriseController {
return EnterpriseRestResponse.failure(response);
}
@RequestMapping("del-union-enterprise")
public RestResponse delUnionEnterprise(Integer unionId){
if(unionId == null){
@RequestMapping("del-union-enterprise-resource")
public RestResponse delUnionEnterprise(Long resourceId, Integer resourceType){
if(resourceId == null){
return EnterpriseRestResponse.failure(ErrorCode.MISS_PARAMETER);
}
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
ServiceResponse<Integer> response = this.unionEnterpriseApiService.delUnionEnterprise(unionId, enterpriseId);
if(response.isSuccess()){
return RestResponse.success(response.getResult());
ServiceResponse<Integer> response = this.unionEnterpriseApiService.delUnionEnterpriseSource(resourceId);
if(response.getResult()>0){
ResourceTypeEnum[] values = ResourceTypeEnum.values();
for(ResourceTypeEnum typeEnum : values){
if(resourceType == typeEnum.getCode()){
LogUtils.createLog(typeEnum.getMessage(), "资源id:"+resourceId);
}
}
return RestResponse.success();
}
return EnterpriseRestResponse.failure(response);
return RestResponse.failure(ErrorCode.NOTEXISTS.getCode(), "资源不存在");
}
@RequestMapping("re-authorization-resource")
public RestResponse reAuthorizationResouce(Long resourceId, int resourceType){
this.unionEnterpriseApiService.reAuthorizationResource(resourceId, resourceType);
return RestResponse.success();
}
@RequestMapping("page-union-enterprise")
......
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