Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
7674527cbb
|
@ -14,6 +14,7 @@ import com.chint.infrastructure.util.PageResult;
|
||||||
import com.chint.infrastructure.util.Result;
|
import com.chint.infrastructure.util.Result;
|
||||||
import com.chint.infrastructure.util.StringCheck;
|
import com.chint.infrastructure.util.StringCheck;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
@ -44,10 +45,19 @@ public class OrderDetailController {
|
||||||
@ApiOperation("订单明细认证接口")
|
@ApiOperation("订单明细认证接口")
|
||||||
@PostMapping("/pubilc/authentication")
|
@PostMapping("/pubilc/authentication")
|
||||||
public Result<OrderSearchResult> queryAuthentication(@RequestBody AuthenticationDto authenticationDto) {
|
public Result<OrderSearchResult> queryAuthentication(@RequestBody AuthenticationDto authenticationDto) {
|
||||||
// Calendar calendar = Calendar.getInstance();
|
|
||||||
// long timestamp = calendar.getTimeInMillis();
|
OrderSearchResult orderSearchResult = null;
|
||||||
OrderSearchResult orderSearchResult = authenticateService.authenticateClient(authenticationDto);
|
try {
|
||||||
return Result.Success(SUCCESS, orderSearchResult);
|
orderSearchResult = authenticateService.authenticateClient(authenticationDto);
|
||||||
|
if (orderSearchResult != null){
|
||||||
|
return Result.Success(SUCCESS, orderSearchResult);
|
||||||
|
}else {
|
||||||
|
return Result.error("认证失败");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("订单明细查询接口")
|
@ApiOperation("订单明细查询接口")
|
||||||
|
@ -57,13 +67,14 @@ public class OrderDetailController {
|
||||||
String systemType = authenticationDto.getSystemType();
|
String systemType = authenticationDto.getSystemType();
|
||||||
String startTime = authenticationDto.getStartTime();
|
String startTime = authenticationDto.getStartTime();
|
||||||
String endTime = authenticationDto.getEndTime();
|
String endTime = authenticationDto.getEndTime();
|
||||||
String pageSize = authenticationDto.getEndTime().toString();
|
String pageSize = authenticationDto.getPageSize().toString();
|
||||||
String pageNum = authenticationDto.getPageNum().toString();
|
String pageNum = authenticationDto.getPageNum().toString();
|
||||||
String orgsign = authenticationDto.getSign();
|
String orgsign = authenticationDto.getSign();
|
||||||
String sign = Digest.md5(systemType + startTime + endTime + pageSize + pageNum);
|
String sign = Digest.md5(systemType + startTime + endTime + pageSize + pageNum);
|
||||||
System.out.println(sign);
|
System.out.println(sign);
|
||||||
|
|
||||||
if (orgsign.equals(sign)) {
|
|
||||||
|
if (StringUtils.isNotBlank(orgsign) && orgsign.equals(sign)) {
|
||||||
return Result.Success(SUCCESS,sign);
|
return Result.Success(SUCCESS,sign);
|
||||||
} else {
|
} else {
|
||||||
return Result.error("签名错误");
|
return Result.error("签名错误");
|
||||||
|
|
|
@ -8,5 +8,5 @@ import com.chint.domain.value_object.UserLoginResult;
|
||||||
public interface AuthenticateService {
|
public interface AuthenticateService {
|
||||||
UserLoginResult authenticateEmployeeNo(UserLoginParam userLoginParam);
|
UserLoginResult authenticateEmployeeNo(UserLoginParam userLoginParam);
|
||||||
|
|
||||||
OrderSearchResult authenticateClient(AuthenticationDto authenticationDto);
|
OrderSearchResult authenticateClient(AuthenticationDto authenticationDto)throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.chint.application.dtos.AuthenticationDto;
|
||||||
import com.chint.application.dtos.OrderSearchResult;
|
import com.chint.application.dtos.OrderSearchResult;
|
||||||
import com.chint.domain.aggregates.order.Client;
|
import com.chint.domain.aggregates.order.Client;
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
|
import com.chint.domain.exceptions.AuthException;
|
||||||
import com.chint.domain.factoriy.user.UserFactory;
|
import com.chint.domain.factoriy.user.UserFactory;
|
||||||
import com.chint.domain.repository.ClientRepository;
|
import com.chint.domain.repository.ClientRepository;
|
||||||
import com.chint.domain.repository.UserRepository;
|
import com.chint.domain.repository.UserRepository;
|
||||||
|
@ -83,7 +84,7 @@ public class AuthenticateServiceImpl implements AuthenticateService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrderSearchResult authenticateClient(AuthenticationDto authenticationDto) {
|
public OrderSearchResult authenticateClient(AuthenticationDto authenticationDto) throws Exception{
|
||||||
|
|
||||||
Client client = clientRepository.findByClientId(authenticationDto.getClientid());
|
Client client = clientRepository.findByClientId(authenticationDto.getClientid());
|
||||||
|
|
||||||
|
@ -95,15 +96,12 @@ public class AuthenticateServiceImpl implements AuthenticateService {
|
||||||
String jwt = JWTUtil.createJWT(AuthMessageConstant.SECRET,AuthMessageConstant.EXPIRATION_CLIENT_TIME_MS,
|
String jwt = JWTUtil.createJWT(AuthMessageConstant.SECRET,AuthMessageConstant.EXPIRATION_CLIENT_TIME_MS,
|
||||||
AuthMessageConstant.SUBJECT,claims);
|
AuthMessageConstant.SUBJECT,claims);
|
||||||
|
|
||||||
|
|
||||||
OrderSearchResult result = new OrderSearchResult();
|
OrderSearchResult result = new OrderSearchResult();
|
||||||
result.setToken(Token.of(jwt));
|
result.setToken(Token.of(jwt));
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
throw new AuthException(AuthMessageConstant.JWT_INVALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue