|
@@ -1,14 +1,18 @@
|
|
|
package com.yonge.cooleshow.admin.controller.open;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.microsvc.toolkit.config.jwt.utils.RsaKeyHelper;
|
|
|
import com.yonge.cooleshow.admin.io.request.coupon.CouponOrderVO;
|
|
|
import com.yonge.cooleshow.api.feign.dto.CouponInfoApi;
|
|
|
import com.yonge.cooleshow.api.feign.dto.EmployeeApi;
|
|
|
import com.yonge.cooleshow.api.feign.dto.StudentApi;
|
|
|
import com.yonge.cooleshow.api.feign.dto.TeacherApi;
|
|
|
+import com.yonge.cooleshow.api.feign.dto.TenantWrapper;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.Employee;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.Student;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.Teacher;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.TenantStaff;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.coupon.CouponCategoryEnum;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.coupon.CouponUseStateEnum;
|
|
@@ -17,6 +21,8 @@ import com.yonge.cooleshow.biz.dal.service.CouponInfoService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.EmployeeService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.StudentService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.TeacherService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.TenantInfoService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.TenantStaffService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.UserFirstTimeService;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.StudentWrapper;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.coupon.CouponOrderWrapper;
|
|
@@ -24,12 +30,13 @@ import com.yonge.cooleshow.common.controller.BaseController;
|
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
import com.yonge.cooleshow.common.enums.UserFirstTimeTypeEnum;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.joda.time.DateTime;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.jwt.Jwt;
|
|
@@ -46,12 +53,13 @@ import java.math.BigDecimal;
|
|
|
import java.security.interfaces.RSAPublicKey;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+@Slf4j
|
|
|
@RestController
|
|
|
@RequestMapping("/open/adminClient")
|
|
|
public class AdminClient extends BaseController {
|
|
|
- private final static Logger log = LoggerFactory.getLogger(UserOrderClient.class);
|
|
|
|
|
|
@Autowired
|
|
|
private UserFirstTimeService userFirstTimeService;
|
|
@@ -68,6 +76,12 @@ public class AdminClient extends BaseController {
|
|
|
@Autowired
|
|
|
private CouponInfoService couponInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TenantStaffService tenantStaffService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TenantInfoService tenantInfoService;
|
|
|
+
|
|
|
@GetMapping("/recordTime")
|
|
|
public HttpResponseResult<Boolean> recordTime(
|
|
|
@RequestParam("userId") Long userId,
|
|
@@ -132,6 +146,40 @@ public class AdminClient extends BaseController {
|
|
|
return succeed(employeeApi);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "机构信息查询", notes = "tenantId -> 机构ID")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "tenantId", value = "机构ID", required = true, dataType = "Long", paramType = "query")
|
|
|
+ })
|
|
|
+ @GetMapping("/getTenant")
|
|
|
+ public HttpResponseResult<TenantWrapper.Tenant> getTenant(@RequestParam("tenantId") Long tenantId) {
|
|
|
+
|
|
|
+ TenantWrapper.Tenant build = TenantWrapper.Tenant.builder().build();
|
|
|
+
|
|
|
+ TenantInfo tenantInfo = tenantInfoService.getById(tenantId);
|
|
|
+ if (Objects.nonNull(tenantInfo)) {
|
|
|
+ build = TenantWrapper.Tenant.from(JSON.toJSONString(tenantInfo));
|
|
|
+ }
|
|
|
+
|
|
|
+ return succeed(build);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "机构员工信息查询", notes = "userId -> 机构用户ID")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "userId", value = "机构用户ID", required = true, dataType = "Long", paramType = "query")
|
|
|
+ })
|
|
|
+ @GetMapping("/getTenantStaff")
|
|
|
+ public HttpResponseResult<TenantWrapper.Staff> getTenantStaff(@RequestParam("userId") Long userId) {
|
|
|
+
|
|
|
+ // 默认返回值
|
|
|
+ TenantWrapper.Staff ret = TenantWrapper.Staff.builder().build();
|
|
|
+
|
|
|
+ TenantStaff staff = tenantStaffService.getByUserId(userId);
|
|
|
+ if (Objects.nonNull(staff)) {
|
|
|
+ ret = TenantWrapper.Staff.from(JSON.toJSONString(staff));
|
|
|
+ }
|
|
|
+ return succeed(ret);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 订单优惠券信息
|
|
|
* @return HttpResponseResult<CouponOrderVO.CouponPageInfo>
|