package com.steerinfo.meterwork;

import com.steerinfo.framework.controller.BaseRESTfulController;
import com.steerinfo.framework.controller.RESTfulResult;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sun.security.provider.MD5;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @Author zhangnan
 * @Date 2022-10-21 16:44
 * @Version 1.0
 */
@RestController
@RequestMapping("/${api.version}/authority")
public class AuthorityController extends BaseRESTfulController {
    @ApiOperation(value="获取密钥验证")
    @PostMapping(value = "/getVerification")
    public String getVerification() {
        String format = DateTimeFormatter.ofPattern("MM-yyyy-dd").format(LocalDateTime.now());
        String newdt = format.substring(0, 2) + "jisco" + format.substring(2);
        return DigestUtils.md5Hex(newdt);
    }
}
