@@ -8,6 +8,7 @@ dependencies { | |||
implementation "${groupname}:common-core:1.0.0-SNAPSHOT" | |||
implementation "${groupname}:comm-core:1.0.0-SNAPSHOT" | |||
implementation "${groupname}:dict-core:1.0.0-SNAPSHOT" | |||
implementation "${groupname}:ifmw-protocol:1.0.0-SNAPSHOT" | |||
implementation "${groupname}:sample-protocol:1.0.0-SNAPSHOT" | |||
implementation('cn.com.taiji.common:sso-client:2.3.10.7') | |||
implementation "org.springframework.boot:spring-boot-starter-security" |
@@ -0,0 +1,13 @@ | |||
package cn.com.taiji.ifmw.manager.handler; | |||
import cn.com.taiji.core.manager.comm.AbstractCommServiceHandler; | |||
import cn.com.taiji.core.model.comm.protocol.SignServiceCommand; | |||
import cn.com.taiji.core.model.comm.protocol.ifmw.IfmwServiceType; | |||
public abstract class AbstractIfmwServiceHandler<C extends SignServiceCommand> | |||
extends AbstractCommServiceHandler<IfmwServiceType> { | |||
protected AbstractIfmwServiceHandler(IfmwServiceType serviceType) { | |||
super(serviceType); | |||
} | |||
} |
@@ -0,0 +1,36 @@ | |||
package cn.com.taiji.ifmw.manager.handler; | |||
import cn.com.taiji.core.model.comm.protocol.ifmw.GetKeyRequest; | |||
import cn.com.taiji.core.model.comm.protocol.ifmw.GetKeyResponse; | |||
import cn.com.taiji.ifmw.entity.ImcSourceIdentSecret; | |||
import cn.com.taiji.ifmw.entity.ImcSourceIdentification; | |||
import cn.com.taiji.ifmw.repo.jpa.SourceIdentSecretRepo; | |||
import cn.com.taiji.ifmw.repo.jpa.SourceIdentificationRepo; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* @Author:ChenChao | |||
* @Date:2025/6/10 17:54 | |||
* @Filename:GetKeyManager | |||
* @description: | |||
*/ | |||
@Service | |||
public class GetKeyManager { | |||
@Autowired | |||
private SourceIdentSecretRepo sourceIdentSecretRepo; | |||
@Autowired | |||
private SourceIdentificationRepo sourceIdentificationRepo; | |||
public GetKeyResponse serviceHandle(GetKeyRequest request) { | |||
ImcSourceIdentification identification = sourceIdentificationRepo.findByInstitutionalCode(request.getAgencyId()); | |||
ImcSourceIdentSecret identSecret = sourceIdentSecretRepo.getBySourceIdentId(identification.getSourceIdentId()); | |||
GetKeyResponse response = new GetKeyResponse(); | |||
response.setAppId(identSecret.getSourceIdentId()); | |||
response.setKey(identSecret.getSm4PubKey()); | |||
response.setSingKey(identSecret.getSm3Key()); | |||
return response; | |||
} | |||
} |
@@ -0,0 +1,43 @@ | |||
package cn.com.taiji.ifmw.manager.handler; | |||
import cn.com.taiji.core.manager.comm.AbstractCommHandleManager; | |||
import cn.com.taiji.core.model.comm.protocol.SignServiceType; | |||
import cn.com.taiji.core.model.comm.protocol.ifmw.IfmwServiceSystem; | |||
import cn.com.taiji.core.model.comm.protocol.ifmw.IfmwServiceType; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import javax.annotation.PostConstruct; | |||
/** | |||
* | |||
* @author Peream <br> | |||
* Create Time:2019年7月28日 下午3:35:29<br> | |||
* @since 1.0 | |||
* @version 1.0 | |||
*/ | |||
@Service | |||
public class MyCommHandleManager extends AbstractCommHandleManager { | |||
@Autowired | |||
private MysqlServiceHandler mysqlServiceHandler; | |||
public MyCommHandleManager() { | |||
super(IfmwServiceSystem.IFMW); | |||
} | |||
@PostConstruct | |||
public void init() { | |||
registerJsonService(mysqlServiceHandler); | |||
} | |||
@Override | |||
protected SignServiceType getServiceType(String ifCode) { | |||
return IfmwServiceType.fromIfCode(ifCode); | |||
} | |||
} |
@@ -0,0 +1,42 @@ | |||
package cn.com.taiji.ifmw.manager.handler; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.common.model.file.FileProtocolSystemError; | |||
import cn.com.taiji.core.model.comm.protocol.AbstractSignTypeRequest; | |||
import cn.com.taiji.core.model.comm.protocol.AbstractSignTypeResponse; | |||
import cn.com.taiji.core.model.comm.protocol.SignJsonRequest; | |||
import cn.com.taiji.core.model.comm.protocol.ifmw.GetKeyRequest; | |||
import cn.com.taiji.core.model.comm.protocol.ifmw.IfmwServiceType; | |||
import cn.com.taiji.core.model.comm.protocol.ifmw.MysqlServiceCmd; | |||
import com.zgglyun.common.model.AbstractHttpRequestInfo; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* @Author:ChenChao | |||
* @Date:2025/6/10 15:10 | |||
* @Filename:NoticeServiceHandler | |||
* @description: 获取密钥 | |||
*/ | |||
@Service | |||
public class MysqlServiceHandler extends AbstractIfmwServiceHandler<MysqlServiceCmd> { | |||
@Autowired | |||
private GetKeyManager getKeyManager; | |||
protected MysqlServiceHandler() { | |||
super(IfmwServiceType.MYSQL); | |||
} | |||
@Override | |||
protected <T extends AbstractSignTypeRequest<?>> AbstractSignTypeResponse handleInternal(T request, | |||
SignJsonRequest jsonReq, AbstractHttpRequestInfo reqInfo) throws ServiceHandleException { | |||
MysqlServiceCmd cmd = MysqlServiceCmd.fromIfCode(jsonReq.getIfCode()); | |||
switch (cmd){ | |||
case GETKEY: | |||
return getKeyManager.serviceHandle((GetKeyRequest) request); | |||
default: | |||
throw FileProtocolSystemError.NOT_SUPPORT.toHandleException(jsonReq.getIfCode()); | |||
} | |||
} | |||
} |
@@ -0,0 +1,53 @@ | |||
/* | |||
* Date: 2015年4月9日 author: Peream (peream@gmail.com) | |||
* | |||
*/ | |||
package cn.com.taiji.ifmw.web; | |||
import cn.com.taiji.core.manager.comm.BaseJsonPostController; | |||
import cn.com.taiji.core.manager.comm.JsonPostHandleManager; | |||
import cn.com.taiji.core.model.comm.protocol.SignJsonRequest; | |||
import org.apache.skywalking.apm.toolkit.trace.Tag; | |||
import org.apache.skywalking.apm.toolkit.trace.Trace; | |||
import org.apache.skywalking.apm.toolkit.trace.TraceContext; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.io.IOException; | |||
/** | |||
* | |||
* @author Peream <br> | |||
* Create Time:2015年4月9日 下午7:08:46<br> | |||
* <a href="mailto:peream@gmail.com">peream@gmail.com</a> | |||
* @since 1.0 | |||
* @version 1.0 | |||
*/ | |||
@RestController | |||
public class JsonPostServiceController extends BaseJsonPostController { | |||
@Autowired | |||
private JsonPostHandleManager handleManager; | |||
@CrossOrigin | |||
@RequestMapping(value = "/api/json", method = RequestMethod.POST) | |||
public void jsonPostRequest(@RequestBody SignJsonRequest req, HttpServletRequest request, HttpServletResponse response) | |||
throws IOException { | |||
response.setCharacterEncoding("UTF-8"); | |||
super.handleComm(req, req.getReqId(), handleManager, request, response); | |||
} | |||
@Trace | |||
@Tag(key = "req", value = "arg[0]") | |||
@Tag(key = "reqId", value = "arg[1]") | |||
@CrossOrigin | |||
@RequestMapping(value = "/api/json/{reqId}", method = RequestMethod.POST) | |||
public void jsonPostRequest(@RequestBody SignJsonRequest req, @PathVariable("reqId") String reqId, | |||
HttpServletRequest request, HttpServletResponse response) throws IOException { | |||
String traceId = TraceContext.traceId(); | |||
logger.info("traceId:{},jsonReq:{}",traceId,req); | |||
response.setCharacterEncoding("UTF-8"); | |||
super.handleComm(req, req.getReqId(), handleManager, request, response); | |||
} | |||
} |