刘光辉
13 小时以前 34981c30a78e8bbd7791131059a9210f9928b62c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package jnpf.base.controller;
 
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.database.util.LoginSaasUtil;
import jnpf.exception.DataException;
import jnpf.model.login.JoinCompanyVo;
import jnpf.util.DesUtil;
import jnpf.util.JsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import java.text.SimpleDateFormat;
import java.util.Date;
 
@Slf4j
@Tag(name = "租户", description = "tenant")
@RestController
@RequestMapping("/tenant/saas")
public class TenantController {
 
 
 
    @Operation(summary = "企业信息数据")
    @GetMapping("/inviteurl")
    public ActionResult<Object> analysisUrl(@RequestParam("encryption") String encryption) {
 
 
        String decrypt = DesUtil.aesOrDecode(encryption, false, true);
        String[] split = decrypt.split("\\|");
        if (split.length != 2) {
            throw new DataException("链接失效");
        }
        String time = split[1];
        String now = new SimpleDateFormat("yyyyMMdd").format(new Date());
        if (time.compareTo(now) < 0) {
            throw new DataException("邀请链接过期");
        }
        JoinCompanyVo joinCompanyVo = LoginSaasUtil.getJoinCompanyVo(split[0]);
        String encrypt = DesUtil.aesOrDecode(JsonUtil.getObjectToString(joinCompanyVo), true, true);
        return ActionResult.success("",encrypt);
    }
 
 
}