Commit ca3f71b1 by songyinghui

feature: 好办授权接口

parent b7ff4b9c
package com.gic.haoban.manage.web.controller.content;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.content.api.dto.account.AccountAuthorizeDTO;
import com.gic.content.api.dto.account.AccountAuthorizeResultDTO;
import com.gic.content.api.dto.account.ContentAccountInfoDTO;
import com.gic.content.api.enums.ContentAccountQrCodeSourceType;
import com.gic.content.api.qdto.account.AccountGenerateQrCodeQDTO;
import com.gic.content.api.qdto.account.AccountScanQrCodeResultQDTO;
import com.gic.content.api.qdto.account.ContentAccountQDTO;
import com.gic.content.api.service.ContentAccountApiService;
import com.gic.haoban.manage.web.controller.content.adaptor.ClerkStoreAdaptor;
import com.gic.haoban.manage.web.qo.content.account.AccountGenerateQrCodeQo;
import com.gic.haoban.manage.web.qo.content.account.AccountInfoQo;
import com.gic.haoban.manage.web.qo.content.account.AccountScanResultQo;
import com.gic.haoban.manage.web.vo.content.account.AccountAuthorizeResultVo;
import com.gic.haoban.manage.web.vo.content.account.AccountAuthorizeVo;
import com.gic.haoban.manage.web.vo.content.account.ContentAccountInfoVo;
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.List;
import java.util.stream.Collectors;
/**
* 好办-视频号-授权
......@@ -25,6 +41,10 @@ import java.util.List;
@RequestMapping(path = "/content/account")
public class ContentAccountController {
@Autowired
private ContentAccountApiService contentAccountApiService;
@Autowired
private ClerkStoreAdaptor clerkStoreAdaptor;
/**
* 查询导购当前账号视频号列表
......@@ -33,7 +53,27 @@ public class ContentAccountController {
*/
@RequestMapping(path = "/list")
private RestResponse<List<ContentAccountInfoVo>> queryAccountList(AccountInfoQo accountInfoQo) {
return RestResponse.successResult();
ClerkDTO clerkDTO = clerkStoreAdaptor.queryClerkInfo(accountInfoQo.getEnterpriseId(), accountInfoQo.getClerkId());
if (clerkDTO == null) {
return RestResponse.successResult(Collections.emptyList());
}
ContentAccountQDTO contentAccountQDTO = new ContentAccountQDTO();
contentAccountQDTO.setEnterpriseId(accountInfoQo.getEnterpriseId());
contentAccountQDTO.setQueryForClerk(Boolean.TRUE);
contentAccountQDTO.setUserCodes(Collections.singletonList(clerkDTO.getClerkCode()));
contentAccountQDTO.setStoreIds(Collections.singletonList(clerkDTO.getStoreId()));
ServiceResponse<Page<ContentAccountInfoDTO>> serviceResponse =
contentAccountApiService.queryAccountList(contentAccountQDTO);
if (!serviceResponse.isSuccess()) {
return RestResponse.successResult();
}
List<ContentAccountInfoVo> contentAccountInfoVos = serviceResponse.getResult()
.getResult()
.stream()
.map(item -> EntityUtil.changeEntityByJSON(ContentAccountInfoVo.class, item))
.collect(Collectors.toList());
return RestResponse.successResult(contentAccountInfoVos);
}
......@@ -45,7 +85,15 @@ public class ContentAccountController {
@ResponseBody
@RequestMapping(value = "/generate/qrcode")
public RestResponse<AccountAuthorizeVo> generateQrCode(AccountGenerateQrCodeQo accountGenerateQrCodeQo) {
return RestResponse.successResult();
AccountGenerateQrCodeQDTO accountGenerateQrCodeQDTO = new AccountGenerateQrCodeQDTO();
accountGenerateQrCodeQDTO.setEnterpriseId(accountGenerateQrCodeQo.getEnterpriseId());
accountGenerateQrCodeQDTO.setSourceType(ContentAccountQrCodeSourceType.HAOBAN.getCode());
ServiceResponse<AccountAuthorizeDTO> serviceResponse = contentAccountApiService.generateQrCode(accountGenerateQrCodeQDTO);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure("500", "生成二维码异常");
}
return RestResponse.successResult(EntityUtil.changeEntityByJSON(AccountAuthorizeVo.class, serviceResponse.getResult()));
}
/**
......@@ -56,6 +104,12 @@ public class ContentAccountController {
@ResponseBody
@RequestMapping(value = "/loop/query/scan/qrcode/result")
public RestResponse<AccountAuthorizeResultVo> queryScanQrCodeResult(AccountScanResultQo accountScanResultQo) {
return RestResponse.successResult();
AccountScanQrCodeResultQDTO accountScanQrCodeResultQDTO = EntityUtil.changeEntityByJSON(AccountScanQrCodeResultQDTO.class, accountScanResultQo);
ServiceResponse<AccountAuthorizeResultDTO> serviceResponse =
contentAccountApiService.queryScanQrcodeResult(accountScanQrCodeResultQDTO);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure("500", "获取结果异常");
}
return RestResponse.successResult(EntityUtil.changeEntityByJSON(AccountAuthorizeResultVo.class, serviceResponse.getResult()));
}
}
package com.gic.haoban.manage.web.controller.content.adaptor;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.role.StoreRoleDTO;
......@@ -28,6 +30,8 @@ public class ClerkStoreAdaptor {
private StaffApiService staffApiService;
@Autowired
private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired
private ClerkService clerkService;
/**
* 查询区经角色下管辖的门店权限
......@@ -73,4 +77,8 @@ public class ClerkStoreAdaptor {
return null;
}
public ClerkDTO queryClerkInfo(String enterpriseId, String clerkId) {
return clerkService.getClerkByClerkId(clerkId);
}
}
......@@ -155,5 +155,7 @@
id="contentMaterialCommentApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference id="cmeFileApiService" interface="com.gic.content.api.service.CmeFileApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.content.api.service.ContentAccountApiService" id="contentAccountApiService" timeout="10000" retries="0" check="false" />
</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