@Component
public class OpenApiUtils {
@Resource
private WeixinAccountService weixinAccountService;
private static OpenApiUtils openApiUtils;
@PostConstruct
public void init() {
openApiUtils = this;
openApiUtils.weixinAccountService = this.weixinAccountService;
}
public static WeixinAccount getWeixinAccount(String tenantId) throws Exception {
Criteria cria = new Criteria();
cria.add(Restrictions.limit("0","1"));
cria.add(Restrictions.eq("tenantId", tenantId));
List<WeixinAccount> list = openApiUtils.weixinAccountService.getList(net.viservice.Constants.DEFAULT_DB_SIGN,cria);
WeixinAccount account = list.get(0);
return account;
}