|
@@ -6,17 +6,22 @@ import com.fuint.common.dto.UserInfo;
|
|
import com.fuint.common.enums.StatusEnum;
|
|
import com.fuint.common.enums.StatusEnum;
|
|
import com.fuint.common.param.ShareListParam;
|
|
import com.fuint.common.param.ShareListParam;
|
|
import com.fuint.common.service.CommissionRelationService;
|
|
import com.fuint.common.service.CommissionRelationService;
|
|
|
|
+import com.fuint.common.service.MemberService;
|
|
|
|
+import com.fuint.common.service.MerchantService;
|
|
|
|
+import com.fuint.common.service.WeixinService;
|
|
import com.fuint.common.util.TokenUtil;
|
|
import com.fuint.common.util.TokenUtil;
|
|
import com.fuint.framework.exception.BusinessCheckException;
|
|
import com.fuint.framework.exception.BusinessCheckException;
|
|
import com.fuint.framework.pagination.PaginationRequest;
|
|
import com.fuint.framework.pagination.PaginationRequest;
|
|
import com.fuint.framework.pagination.PaginationResponse;
|
|
import com.fuint.framework.pagination.PaginationResponse;
|
|
import com.fuint.framework.web.BaseController;
|
|
import com.fuint.framework.web.BaseController;
|
|
import com.fuint.framework.web.ResponseObject;
|
|
import com.fuint.framework.web.ResponseObject;
|
|
|
|
+import com.fuint.repository.model.MtUser;
|
|
import com.fuint.utils.StringUtil;
|
|
import com.fuint.utils.StringUtil;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
+import org.springframework.core.env.Environment;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
@@ -34,11 +39,28 @@ import java.util.Map;
|
|
@RequestMapping(value = "/clientApi/share")
|
|
@RequestMapping(value = "/clientApi/share")
|
|
public class ClientShareController extends BaseController {
|
|
public class ClientShareController extends BaseController {
|
|
|
|
|
|
|
|
+ private Environment env;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 分佣提成关系服务接口
|
|
* 分佣提成关系服务接口
|
|
* */
|
|
* */
|
|
private CommissionRelationService commissionRelationService;
|
|
private CommissionRelationService commissionRelationService;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 微信相关服务接口
|
|
|
|
+ * */
|
|
|
|
+ private WeixinService weixinService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 商户服务接口
|
|
|
|
+ */
|
|
|
|
+ private MerchantService merchantService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 会员服务接口
|
|
|
|
+ * */
|
|
|
|
+ private MemberService memberService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取邀请列表
|
|
* 获取邀请列表
|
|
*/
|
|
*/
|
|
@@ -74,12 +96,44 @@ public class ClientShareController extends BaseController {
|
|
PaginationResponse<CommissionRelationDto> paginationResponse = commissionRelationService.queryRelationByPagination(paginationRequest);
|
|
PaginationResponse<CommissionRelationDto> paginationResponse = commissionRelationService.queryRelationByPagination(paginationRequest);
|
|
|
|
|
|
Map<String, Object> outParams = new HashMap();
|
|
Map<String, Object> outParams = new HashMap();
|
|
- outParams.put("content", paginationResponse.getContent());
|
|
|
|
- outParams.put("pageSize", paginationResponse.getPageSize());
|
|
|
|
- outParams.put("pageNumber", paginationResponse.getCurrentPage());
|
|
|
|
- outParams.put("totalRow", paginationResponse.getTotalElements());
|
|
|
|
- outParams.put("totalPage", paginationResponse.getTotalPages());
|
|
|
|
|
|
+ String url = env.getProperty("website.url");
|
|
|
|
+ outParams.put("url", url);
|
|
|
|
+ outParams.put("paginationResponse", paginationResponse);
|
|
|
|
|
|
return getSuccessResult(outParams);
|
|
return getSuccessResult(outParams);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 生成小程序链接
|
|
|
|
+ */
|
|
|
|
+ @ApiOperation(value = "生成小程序链接")
|
|
|
|
+ @RequestMapping(value = "/getMiniAppLink", method = RequestMethod.POST)
|
|
|
|
+ @CrossOrigin
|
|
|
|
+ public ResponseObject getMiniAppLink(HttpServletRequest request, @RequestBody Map<String, Object> param) throws BusinessCheckException {
|
|
|
|
+ String token = request.getHeader("Access-Token");
|
|
|
|
+ String merchantNo = request.getHeader("merchantNo") == null ? "" : request.getHeader("merchantNo");
|
|
|
|
+ UserInfo mtUser = TokenUtil.getUserInfoByToken(token);
|
|
|
|
+ if (null == mtUser) {
|
|
|
|
+ return getFailureResult(1001);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String path = param.get("path") == null ? "" : param.get("path").toString();
|
|
|
|
+ String query = param.get("query") == null ? "" : param.get("query").toString();
|
|
|
|
+ Integer merchantId = merchantService.getMerchantId(merchantNo);
|
|
|
|
+
|
|
|
|
+ if (merchantId == null || merchantId <= 0) {
|
|
|
|
+ MtUser userInfo = memberService.queryMemberById(mtUser.getId());
|
|
|
|
+ if (userInfo != null) {
|
|
|
|
+ merchantId = userInfo.getMerchantId();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String link = weixinService.createMiniAppLink(merchantId, path + query);
|
|
|
|
+
|
|
|
|
+ Map<String, Object> outParams = new HashMap();
|
|
|
|
+ outParams.put("link", link);
|
|
|
|
+
|
|
|
|
+ ResponseObject responseObject = getSuccessResult(outParams);
|
|
|
|
+ return getSuccessResult(responseObject.getData());
|
|
|
|
+ }
|
|
}
|
|
}
|