修改代码,去除apollo、security和seata配置,替换为nacos
This commit is contained in:
99
pom.xml
99
pom.xml
@ -4,11 +4,11 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.chinaunicom.ebtp</groupId>
|
||||
<artifactId>mall-ebtp-cloud-parent</artifactId>
|
||||
<version>2.4.1-zyhy-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>com.chinaunicom.ebtp</groupId>
|
||||
<artifactId>mall-ebtp-cloud-parent</artifactId>
|
||||
<version>2.4.1-zyhy-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.chinaunicom.mall.ebtp</groupId>
|
||||
<artifactId>biz_service_ebtp_extend</artifactId>
|
||||
@ -17,23 +17,23 @@
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.chinaunicom.mall.ebtp</groupId>
|
||||
<artifactId>uboot-core</artifactId>
|
||||
<version>2.4.1-zyhy-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.chinaunicom.mall.ebtp</groupId>
|
||||
<artifactId>uboot-core</artifactId>
|
||||
<version>2.4.1-zyhy-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 证书加密签名 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.cuca</groupId>-->
|
||||
<!-- <artifactId>cucasecuritysdk</artifactId>-->
|
||||
<!-- <version>1.7</version>-->
|
||||
<!--<!– <scope>system</scope>–>-->
|
||||
<!--<!– <systemPath>${project.basedir}/libs/cucasecuritysdk-1.7.jar</systemPath>–>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.cuca</groupId>-->
|
||||
<!-- <artifactId>cucasecuritysdk</artifactId>-->
|
||||
<!-- <version>1.7</version>-->
|
||||
<!--<!– <scope>system</scope>–>-->
|
||||
<!--<!– <systemPath>${project.basedir}/libs/cucasecuritysdk-1.7.jar</systemPath>–>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>com.deepoove</groupId>
|
||||
<artifactId>poi-tl</artifactId>
|
||||
<version>1.9.1</version>
|
||||
@ -75,11 +75,11 @@
|
||||
<systemPath>${basedir}/lib/access_token1.3.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>cn.chinaunicom.sdsi</groupId>-->
|
||||
<!-- <artifactId>mall-xxljob-core</artifactId>-->
|
||||
<!-- <version>0.0.1</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>cn.chinaunicom.sdsi</groupId>-->
|
||||
<!-- <artifactId>mall-xxljob-core</artifactId>-->
|
||||
<!-- <version>0.0.1</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-tools</artifactId>
|
||||
@ -91,11 +91,11 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>e-iceblue</groupId>-->
|
||||
<!-- <artifactId>spire.doc.free</artifactId>-->
|
||||
<!-- <version>3.9.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>e-iceblue</groupId>-->
|
||||
<!-- <artifactId>spire.doc.free</artifactId>-->
|
||||
<!-- <version>3.9.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org</groupId>
|
||||
@ -109,21 +109,24 @@
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>3.10.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven-snapshot-local</id>
|
||||
<name>maven-snapshot-local</name>
|
||||
<url>http://ccp.tianti.tg.unicom.local/artifactory/tianti-maven-snapshot-local/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven-snapshot-local</id>
|
||||
<name>maven-snapshot-local</name>
|
||||
<url>http://ccp.tianti.tg.unicom.local/artifactory/tianti-maven-snapshot-local/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>com.e-iceblue</id>
|
||||
@ -133,7 +136,7 @@
|
||||
<id>maven-virtual</id>
|
||||
<url>http://ccp.tianti.tg.unicom.local/artifactory/maven-virtual</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
@ -155,12 +158,12 @@
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<!-- <plugins>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
|
||||
<!-- </plugin>-->
|
||||
<!-- </plugins>-->
|
||||
<!-- <plugins>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
|
||||
<!-- </plugin>-->
|
||||
<!-- </plugins>-->
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
@ -3,7 +3,6 @@ package com.chinaunicom.mall.ebtp.extend;
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -12,7 +11,6 @@ import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCusto
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
@ -20,7 +18,6 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class})
|
||||
@EnableFeignClients
|
||||
@EnableEurekaClient
|
||||
@MapperScan({"com.chinaunicom.mall.ebtp.extend.**.dao"})
|
||||
@ComponentScan("com.chinaunicom.mall.ebtp.*")
|
||||
@EnableAsync
|
||||
|
@ -13,7 +13,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -64,7 +63,6 @@ public class BizBidNoticeController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查询所有列表")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PostMapping("/allList")
|
||||
public BaseResponse<IPage<BizBidNotice>> getAll(@RequestBody BizBidNoticeVO bizBidNotice) {
|
||||
|
||||
@ -85,7 +83,6 @@ public class BizBidNoticeController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("插入新数据")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PostMapping("/add")
|
||||
public BaseResponse<Boolean> insert(
|
||||
@ApiParam(value = "对象数据", required = true) @RequestBody @Valid BizBidNotice bizBidNotice) {
|
||||
@ -103,7 +100,6 @@ public class BizBidNoticeController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("修改数据")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PostMapping("/update")
|
||||
public BaseResponse<Boolean> update(
|
||||
@ApiParam(value = "对象数据", required = true) @RequestBody BizBidNotice bizBidNotice) {
|
||||
@ -118,7 +114,6 @@ public class BizBidNoticeController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("发布数据")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PostMapping("/fabu/{id}")
|
||||
public BaseResponse<Boolean> fabu(@ApiParam(value = "主键id", required = true) @PathVariable String id) {
|
||||
BizBidNotice notice = new BizBidNotice();
|
||||
@ -134,7 +129,6 @@ public class BizBidNoticeController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("发布数据")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PostMapping("/qxfabu/{id}")
|
||||
public BaseResponse<Boolean> qxfabu(@ApiParam(value = "主键id", required = true) @PathVariable String id) {
|
||||
|
||||
@ -151,7 +145,6 @@ public class BizBidNoticeController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("置顶数据")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PostMapping("/top/{id}")
|
||||
public BaseResponse<Boolean> top(@ApiParam(value = "主键id", required = true) @PathVariable String id) {
|
||||
|
||||
@ -169,7 +162,6 @@ public class BizBidNoticeController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("取消置顶数据")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PostMapping("/qxtop/{id}")
|
||||
public BaseResponse<Boolean> qxtop(@ApiParam(value = "主键id", required = true) @PathVariable String id) {
|
||||
|
||||
@ -198,7 +190,6 @@ public class BizBidNoticeController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("删除数据")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PostMapping("/delete/{id}")
|
||||
public BaseResponse<Boolean> delete(@ApiParam(value = "主键id", required = true) @PathVariable String id) {
|
||||
return BaseResponse.success(ibizBidNoticeService.removeById(id));
|
||||
|
@ -12,7 +12,6 @@ import com.chinaunicom.mall.ebtp.extend.bizbidshared.service.IBizBidSharedServic
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -47,7 +46,6 @@ public class BizBidSharedController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("插入新数据")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PostMapping("/add")
|
||||
public BaseResponse<Boolean> insert(@ApiParam(value = "对象数据", required = true) @RequestBody @Valid BizBidShared bizBidShared) {
|
||||
if (StringUtils.isEmpty(bizBidShared.getId())) {
|
||||
@ -67,7 +65,6 @@ public class BizBidSharedController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("修改数据")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PostMapping("")
|
||||
public BaseResponse<Boolean> update(@ApiParam(value = "对象数据", required = true) @RequestBody BizBidShared bizBidShared) {
|
||||
return BaseResponse.success(ibizBidSharedService.updateById(bizBidShared));
|
||||
@ -92,7 +89,6 @@ public class BizBidSharedController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("删除数据")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PostMapping("/delete/{id}")
|
||||
public BaseResponse<Boolean> delete(@ApiParam(value = "主键id", required = true) @PathVariable String id) {
|
||||
return BaseResponse.success(ibizBidSharedService.removeById(id));
|
||||
|
@ -12,7 +12,6 @@ import com.chinaunicom.mall.ebtp.extend.bizbidsharedrecord.service.IBizBidShared
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -35,7 +34,6 @@ public class BizBidSharedRecordController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查询数据列表")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PostMapping("/list/{id}")
|
||||
public BasePageResponse<BizBidSharedRecord> getList(@PathVariable("id") String id,
|
||||
@ApiParam(value = "对象数据", required = true) @RequestBody @Valid BizBidSharedRecordVO bizBidShared) {
|
||||
@ -75,7 +73,6 @@ public class BizBidSharedRecordController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("修改数据")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PostMapping("/update")
|
||||
public BaseResponse<Boolean> update(
|
||||
@ApiParam(value = "对象数据", required = true) @RequestBody BizBidSharedRecord bizBidSharedRecord) {
|
||||
|
@ -4,8 +4,6 @@ import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
|
||||
import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
@ -24,11 +22,11 @@ public class AuthorizeController {
|
||||
@ResponseStatus(code = HttpStatus.OK)
|
||||
public Object user(Principal principal) {
|
||||
BaseCacheUser cacheUser = service.getCacheUser();
|
||||
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||
|
||||
System.out.println(auth.getName());
|
||||
System.out.println(auth.getAuthorities());
|
||||
System.out.println(principal);
|
||||
// Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||
//
|
||||
// System.out.println(auth.getName());
|
||||
// System.out.println(auth.getAuthorities());
|
||||
// System.out.println(principal);
|
||||
|
||||
return cacheUser;
|
||||
}
|
||||
|
@ -1,36 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.config;
|
||||
|
||||
import io.seata.core.context.RootContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* seata拦截器配置类 解除seata绑定
|
||||
*
|
||||
* @author fqj
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
@Configuration
|
||||
public class SeataInterceptorConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
InterceptorRegistration interceptor = registry.addInterceptor(new HandlerInterceptor() {
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
if (!Objects.isNull(RootContext.getXID())) {
|
||||
RootContext.unbind();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
interceptor.addPathPatterns("/**");
|
||||
}
|
||||
}
|
@ -14,8 +14,6 @@
|
||||
|
||||
package com.chinaunicom.mall.ebtp.extend.crypconfigure.crypto.helper;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.Timestamp;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@ -221,16 +219,6 @@ public final class Utils {
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Timestamp} instance based on the current time
|
||||
*
|
||||
* @return timestamp
|
||||
*/
|
||||
public static Timestamp generateTimestamp() {
|
||||
Instant time = Instant.now();
|
||||
return Timestamp.newBuilder().setSeconds(time.getEpochSecond())
|
||||
.setNanos(time.getNano()).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a file or directory
|
||||
@ -378,15 +366,6 @@ public final class Utils {
|
||||
return values;
|
||||
}
|
||||
|
||||
public static String toHexString(ByteString byteString) {
|
||||
if (byteString == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return encodeHexString(byteString.toByteArray());
|
||||
|
||||
}
|
||||
|
||||
public static String toHexString(byte[] bytes) {
|
||||
if (bytes == null) {
|
||||
return null;
|
||||
|
@ -7,7 +7,7 @@ import com.chinaunicom.mall.ebtp.extend.export.service.ExportServiceFactory;
|
||||
import com.chinaunicom.mall.ebtp.extend.export.service.dict.IBizExportDictService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
//import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -39,7 +39,7 @@ public class ExportController {
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-purchase','ebtp-agency-project-manager')")
|
||||
// @PreAuthorize("hasAnyAuthority('ebtp-purchase','ebtp-agency-project-manager')")
|
||||
@GetMapping(value = "/{type}")
|
||||
public void export(@PathVariable String type, ExportParam param, HttpServletRequest request, HttpServletResponse response) {
|
||||
exportServiceFactory.getService(type).doExport(param, request, response);
|
||||
@ -51,7 +51,7 @@ public class ExportController {
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-purchase','ebtp-agency-project-manager')")
|
||||
// @PreAuthorize("hasAnyAuthority('ebtp-purchase','ebtp-agency-project-manager')")
|
||||
@GetMapping("/list/{roomId}")
|
||||
public BaseResponse<Map<String, List<BizExportDict>>> list(@PathVariable String roomId) {
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.iam.client;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
// 定义 Feign 客户端,服务名为 bid-ratio-service,请求地址为 http://localhost:18012
|
||||
@FeignClient(name = "bid-ratio-service", url = "http://localhost:18012")
|
||||
public interface BidRatioClient {
|
||||
|
||||
/**
|
||||
* 根据 ID 获取投标比率信息
|
||||
* @param id 用于查询的 ID
|
||||
* @return 响应体,这里使用 String 类型示例,实际可替换为具体的 DTO 类
|
||||
*/
|
||||
@GetMapping("/v1/bidratio/{id}")
|
||||
String getBidRatio(@PathVariable("id") String id);
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.iam.client;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.extend.iam.entity.AuthRequestDTO;
|
||||
import com.chinaunicom.mall.ebtp.extend.iam.entity.AuthResponseDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@FeignClient(name = "iam-service", url = "${iam.service.url}")
|
||||
public interface IamClient {
|
||||
|
||||
|
||||
@PostMapping("/access_token")
|
||||
AuthResponseDTO getAccessToken(@RequestBody AuthRequestDTO request);
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.iam.controller;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.extend.iam.client.BidRatioClient;
|
||||
import com.chinaunicom.mall.ebtp.extend.iam.service.IamAuthService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/iam/auth")
|
||||
public class IamAuthController {
|
||||
|
||||
private final IamAuthService iamAuthService;
|
||||
private final BidRatioClient bidRatioClient;
|
||||
|
||||
public IamAuthController(IamAuthService iamAuthService, BidRatioClient bidRatioClient) {
|
||||
this.iamAuthService = iamAuthService;
|
||||
this.bidRatioClient = bidRatioClient;
|
||||
}
|
||||
|
||||
@GetMapping("/token")
|
||||
public String getToken() {
|
||||
String appId = "ap_idsss";
|
||||
String appSecret = "abcss";
|
||||
return iamAuthService.getAccessToken(appId, appSecret);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用 Feign 客户端获取投标比率信息
|
||||
* @param id 用于查询的 ID
|
||||
* @return 投标比率信息
|
||||
*/
|
||||
@GetMapping("/bidratio/{id}")
|
||||
public String getBidRatio(@PathVariable("id") String id) {
|
||||
return bidRatioClient.getBidRatio(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.iam.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AuthRequestDTO {
|
||||
private String appId;
|
||||
private String appSecret;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.iam.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AuthResponseDTO {
|
||||
private int errorCode;
|
||||
private String accessToken;
|
||||
private long expiresInMS;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.iam.service;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.extend.iam.client.IamClient;
|
||||
import com.chinaunicom.mall.ebtp.extend.iam.entity.AuthRequestDTO;
|
||||
import com.chinaunicom.mall.ebtp.extend.iam.entity.AuthResponseDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class IamAuthService {
|
||||
|
||||
private final IamClient iamClient;
|
||||
|
||||
public IamAuthService(IamClient iamClient) {
|
||||
this.iamClient = iamClient;
|
||||
}
|
||||
|
||||
public String getAccessToken(String appId, String appSecret) {
|
||||
AuthRequestDTO request = new AuthRequestDTO();
|
||||
request.setAppId(appId);
|
||||
request.setAppSecret(appSecret);
|
||||
AuthResponseDTO response = iamClient.getAccessToken(request);
|
||||
if (response.getErrorCode() == 0) {
|
||||
return response.getAccessToken();
|
||||
}
|
||||
throw new RuntimeException("Failed to get access token, error code: " + response.getErrorCode());
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@ import com.chinaunicom.mall.ebtp.extend.signature.entity.ExpertSignature;
|
||||
import com.chinaunicom.mall.ebtp.extend.signature.service.ExpertSignatureService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -31,7 +30,6 @@ public class ExpertSignatureController {
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-purchase','ebtp-agency-project-manager')")
|
||||
@PostMapping(value = "")
|
||||
public BaseResponse<String> export(@RequestBody ExpertSignature signature, HttpServletRequest request, HttpServletResponse response) {
|
||||
return BaseResponse.success(expertSignatureService.addSignature(signature));
|
||||
|
@ -2,18 +2,15 @@ package com.chinaunicom.mall.ebtp.extend.singlePoint.controller;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseCacheUserServiceImpl;
|
||||
import com.chinaunicom.mall.ebtp.extend.signature.entity.ExpertSignature;
|
||||
import com.chinaunicom.mall.ebtp.extend.signature.service.ExpertSignatureService;
|
||||
import com.chinaunicom.mall.ebtp.extend.singlePoint.service.SinglePointService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
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;
|
||||
|
||||
|
||||
@RestController
|
||||
|
@ -10,7 +10,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
@ -99,7 +98,6 @@ public class TimeServiceController {
|
||||
*/
|
||||
@ApiOperation("获取开标剩余时间倒数")
|
||||
@GetMapping("/getDescOpenRoomTime")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-agency-project-manager','ebtp-purchase','ebtp-supplier')")
|
||||
public BaseResponse<SystemTime> getDescOpenRoomTime(@RequestParam(name = "openTime", required = true) String openTime) {
|
||||
try {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
@ -3,32 +3,11 @@ server:
|
||||
servlet:
|
||||
context-path: /
|
||||
|
||||
seata:
|
||||
service:
|
||||
vgroup-mapping:
|
||||
biz-service-ebtp-extend-service-group: default
|
||||
grouplist:
|
||||
default: 10.242.37.148:18035
|
||||
|
||||
#registry:
|
||||
# type: eureka
|
||||
# eureka:
|
||||
# serviceUrl: http://10.242.37.148:5001/eureka,http://10.242.37.148:5002/eureka,http://10.242.37.148:5003/eureka
|
||||
|
||||
# 对应 apollo 配置中心的应用名
|
||||
app:
|
||||
id: biz-service-ebtp-extend
|
||||
|
||||
# Apollo 配置信息
|
||||
apollo:
|
||||
meta: http://localhost:8070
|
||||
bootstrap:
|
||||
namespace: application
|
||||
enabled: true
|
||||
eagerLoad:
|
||||
enabled: true
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 127.0.0.1:8848
|
||||
aop:
|
||||
auto: true #开启spring的aop配置
|
||||
proxy-target-class: true
|
||||
@ -59,7 +38,7 @@ spring:
|
||||
testOnReturn: false
|
||||
poolPreparedStatements: true
|
||||
maxOpenPreparedStatements: 20
|
||||
connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000
|
||||
connection-properties: druid.stat.mergeSql=ture;druid.stat.slowSqlMillis=5000
|
||||
props:
|
||||
sql:
|
||||
show: true
|
||||
@ -96,26 +75,15 @@ spring:
|
||||
# 天宫 redis 需要使用哨兵进行访问
|
||||
redis:
|
||||
sentinel:
|
||||
master: eshop-redis
|
||||
master: mymaster
|
||||
# nodes: 10.125.164.124:32718, 10.125.164.118:32716, 10.125.164.121:32716
|
||||
nodes: localhost:6379
|
||||
# password: Unicom#135
|
||||
nodes: localhost:26379, localhost:26380, localhost:26381
|
||||
password: pass
|
||||
database:
|
||||
idempotent: 1
|
||||
sharding: 1
|
||||
cache: 1
|
||||
userinfo: 1
|
||||
# 天宫Eureka配置
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
# defaultZone: http://eureka-1-svc:8080/eureka, http://eureka-2-svc:8080/eureka, http://eureka-3-svc:8080/eureka
|
||||
defaultZone: http://localhost:8080/eureka/
|
||||
instance:
|
||||
prefer-ip-address: true
|
||||
instance-id: http://10.242.37.148:${server.port}
|
||||
# 这是客户端的注册地址, eureka 会通过这个地址建立管道
|
||||
ip-address: 10.242.37.148
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
|
@ -91,6 +91,10 @@ mconfig:
|
||||
process: 1
|
||||
notification: 1
|
||||
documentcenter: 2
|
||||
|
||||
iam:
|
||||
service:
|
||||
url: https://iam.com/api
|
||||
#jasypt:
|
||||
# encryptor:
|
||||
# bean: stringEncryptor
|
||||
|
Reference in New Issue
Block a user