| @@ -5,6 +5,7 @@ import com.nsgk.agentcentersdk.api.NSSDK; | |||
| import com.nsgk.agentcentersdk.api.NSSDKClient; | |||
| import com.nsgk.agentcentersdk.core.NSProtocol; | |||
| import com.nsgk.agentcentersdk.entity.NSContractionEntity; | |||
| import com.nsgk.agentcentersdk.entity.NSEntity; | |||
| import com.nsgk.agentcentersdk.utility.NSReflect; | |||
| public final class NSMain | |||
| @@ -40,20 +41,19 @@ public final class NSMain | |||
| public static void Test() | |||
| { | |||
| NSSDKClient client; | |||
| NSContractionEntity entity; | |||
| NSEntity entity; | |||
| NSApiResult result; | |||
| NSSDK.InitClient("http://localhost", (short) 8081, "test", "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==", 0); | |||
| client = NSSDK.InstanceClient(); | |||
| entity = new NSContractionEntity(); | |||
| entity.setBuildingTime("2000-12-23") | |||
| .setName("测试合同") | |||
| .setDeptId(187L) | |||
| entity = new NSEntity(); | |||
| entity.setDeptId(187L) | |||
| .setBookId(166L) | |||
| .setOrgCode("371081") | |||
| ; | |||
| entity.Parm("buildingTime", "2000-12-25"); | |||
| entity.Parm("buildingTime222", "2000-12-11"); | |||
| entity.Parm("name", "测试合同"); | |||
| entity.Parm("outId", "123"); | |||
| result = client.Send(NSProtocol.NS_PROTOCOL_CONTRACTION, entity); | |||
| System.err.println(result); | |||
| @@ -4,7 +4,7 @@ import cn.hutool.core.util.URLUtil; | |||
| import com.nsgk.agentcentersdk.core.NSConstants; | |||
| import com.nsgk.agentcentersdk.core.NSProtocol; | |||
| import com.nsgk.agentcentersdk.core.NSReportObject; | |||
| import com.nsgk.agentcentersdk.entity.NSEntityBase; | |||
| import com.nsgk.agentcentersdk.entity.NSEntity; | |||
| import com.nsgk.agentcentersdk.err.NSAssert; | |||
| import com.nsgk.agentcentersdk.err.NSErrGlobal; | |||
| import com.nsgk.agentcentersdk.err.NSErrno; | |||
| @@ -48,7 +48,7 @@ public final class NSSDKClient | |||
| } | |||
| // 发送请求 | |||
| public <T extends NSEntityBase> NSApiResult Send(int protocol, T object) | |||
| public <T extends NSEntity> NSApiResult Send(int protocol, T object) | |||
| { | |||
| String url; | |||
| NSReportObject<T> reportObject; | |||
| @@ -63,6 +63,7 @@ public final class NSSDKClient | |||
| request.setUrl(BuildUrl(url)); | |||
| request.setTimeout(timeout); | |||
| WriteDataObject(request, reportObject); | |||
| request.AddHeader("Content-Type", "text/plain"); | |||
| NSNetworkResponse response = NSNetworkManager.Post(request); | |||
| NSErrGlobal.ASSERT(response.IsSuccess(), NSErrno.ERRNO_SYS_HTTP); | |||
| String json = response.getData(); | |||
| @@ -1,8 +1,9 @@ | |||
| package com.nsgk.agentcentersdk.api; | |||
| import com.nsgk.agentcentersdk.core.NSConstants; | |||
| import com.nsgk.agentcentersdk.core.NSProtocol; | |||
| import com.nsgk.agentcentersdk.core.NSReportObject; | |||
| import com.nsgk.agentcentersdk.entity.NSEntityBase; | |||
| import com.nsgk.agentcentersdk.entity.NSEntity; | |||
| import com.nsgk.agentcentersdk.err.NSAssert; | |||
| import com.nsgk.agentcentersdk.err.NSErrGlobal; | |||
| import com.nsgk.agentcentersdk.err.NSErrno; | |||
| @@ -10,6 +11,7 @@ import com.nsgk.agentcentersdk.utility.NSArr; | |||
| import com.nsgk.agentcentersdk.utility.NSCrypto; | |||
| import com.nsgk.agentcentersdk.utility.NSHttp; | |||
| import javax.servlet.ServletInputStream; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| // SDK服务端 | |||
| @@ -22,8 +24,21 @@ public final class NSSDKServer | |||
| this.privateKey = privateKey; | |||
| } | |||
| public static int GetProtocol(HttpServletRequest request) | |||
| { | |||
| try | |||
| { | |||
| return Integer.parseInt(request.getParameter(NSConstants.QUERY_PROTOCOL)); | |||
| } | |||
| catch(Exception e) | |||
| { | |||
| e.printStackTrace(); | |||
| return NSProtocol.NS_PROTOCOL_INVALID; | |||
| } | |||
| } | |||
| // 解析请求 | |||
| public <T extends NSEntityBase> NSReportObject<T> Recv(HttpServletRequest request, Class<T> clazz) | |||
| public <T extends NSEntity> NSReportObject<T> Recv(HttpServletRequest request, Class<T> clazz) | |||
| { | |||
| NSReportObject<T> res; | |||
| String sign; | |||
| @@ -54,10 +69,19 @@ public final class NSSDKServer | |||
| { | |||
| return NSErrGlobal.ThrowAndReturn(NSErrno.ERRNO_SYS_INVALID_SIGN, null); | |||
| } | |||
| if(!res.CheckTime(ServerTime(), NSConstants.MAX_TIME_DIFF * 1000)) | |||
| { | |||
| return NSErrGlobal.ThrowAndReturn(NSErrno.ERRNO_SYS_TIME_DIFF, null); | |||
| } | |||
| res.setSign(sign); | |||
| return res; | |||
| } | |||
| private static long ServerTime() | |||
| { | |||
| return System.currentTimeMillis(); | |||
| } | |||
| // 响应客户端 | |||
| public static NSApiResult Resp(int code, String msg, Object...data) | |||
| { | |||
| @@ -8,5 +8,7 @@ public final class NSConstants | |||
| public static final String QUERY_IDENTIFIER = "identifier"; | |||
| public static final String QUERY_PROTOCOL = "protocol"; | |||
| public static final int MAX_TIME_DIFF = 300; // 秒 | |||
| private NSConstants() {} | |||
| } | |||
| @@ -92,6 +92,13 @@ public class NSReportObject<T> | |||
| return src.equals(Sign()); | |||
| } | |||
| public boolean CheckTime(long serverTime, long limit) | |||
| { | |||
| if(null == timestamp || timestamp <= 0L) | |||
| return false; | |||
| return serverTime - timestamp <= limit; | |||
| } | |||
| public NSReportObject<T> SetTimestampStr(String str) | |||
| { | |||
| timestamp = Long.parseLong(str); | |||
| @@ -6,7 +6,7 @@ import lombok.experimental.Accessors; | |||
| // 合同实体 | |||
| @Data | |||
| @Accessors(chain = true) | |||
| public class NSContractionEntity extends NSEntityBase | |||
| public class NSContractionEntity extends NSEntity | |||
| { | |||
| private static final long serialVersionUID = 1L; | |||
| @@ -3,8 +3,6 @@ package com.nsgk.agentcentersdk.entity; | |||
| import cn.hutool.core.bean.BeanUtil; | |||
| import cn.hutool.core.collection.CollectionUtil; | |||
| import com.alibaba.fastjson2.JSON; | |||
| import com.nsgk.agentcentersdk.err.NSErrGlobal; | |||
| import com.nsgk.agentcentersdk.err.NSErrno; | |||
| import com.nsgk.agentcentersdk.utility.NSArr; | |||
| import com.nsgk.agentcentersdk.utility.NSReflect; | |||
| import com.nsgk.agentcentersdk.utility.NSStr; | |||
| @@ -20,7 +18,7 @@ import java.util.Map; | |||
| // 基本实体 | |||
| @Data | |||
| @Accessors(chain = true) | |||
| public class NSEntityBase implements Serializable | |||
| public class NSEntity implements Serializable | |||
| { | |||
| private static final long serialVersionUID = 1L; | |||
| @@ -33,7 +31,10 @@ public class NSEntityBase implements Serializable | |||
| /** 外部ID */ | |||
| protected Long outId; | |||
| // 存储其他没有声明的属性, 用于当客户与服务端字段不一致时, 在不更新sdk的情况下, 保持兼容性 | |||
| /** 外部ID */ | |||
| protected String orgCode; | |||
| // 存储其他没有声明的属性, 用于当客户端与服务端字段不一致时, 在不更新sdk的情况下, 保持兼容性 | |||
| // 不会覆盖已设置的属性 | |||
| protected Map<String, Object> parms; | |||
| @@ -45,14 +46,14 @@ public class NSEntityBase implements Serializable | |||
| } | |||
| @SuppressWarnings("unchecked") | |||
| public <T extends NSEntityBase> T Parm(String name, Object val) | |||
| public <T extends NSEntity> T Parm(String name, Object val) | |||
| { | |||
| PARMS().put(name, val); | |||
| return (T)this; | |||
| } | |||
| @SuppressWarnings("unchecked") | |||
| public <T extends NSEntityBase> T DelParm(String...name) | |||
| public <T extends NSEntity> T DelParm(String...name) | |||
| { | |||
| if(null != parms && NSArr.IsNotEmpty(name)) | |||
| { | |||
| @@ -44,6 +44,7 @@ public final class NSErrGlobal | |||
| { | |||
| if(err == NSErrno.ERRNO_OK) | |||
| return t; | |||
| Err(err); | |||
| throw new NSException(err); | |||
| } | |||
| @@ -14,6 +14,7 @@ public final class NSErrno | |||
| public static final int ERRNO_SYS_SIGN_FAIL = 0x01005; | |||
| public static final int ERRNO_SYS_HTTP = 0x01006; | |||
| public static final int ERRNO_SYS_INVALID_FIELD = 0x01007; | |||
| public static final int ERRNO_SYS_TIME_DIFF = 0x01008; | |||
| public static final int ERRNO_CLI_PARAMETER_MISSING = 0x03001; | |||
| public static final int ERRNO_CLI_DATA_MISSING = 0x03002; | |||
| @@ -33,7 +34,7 @@ public final class NSErrno | |||
| case ERRNO_SYS_INVALID_PROTOCOL: return "无效协议"; | |||
| case ERRNO_SYS_SIGN_FAIL: return "签名失败"; | |||
| case ERRNO_SYS_HTTP: return "Http请求错误"; | |||
| case ERRNO_SYS_INVALID_FIELD: return "无效字段"; | |||
| case ERRNO_SYS_TIME_DIFF: return "数据过期"; | |||
| case ERRNO_CLI_PARAMETER_MISSING: return "参数缺失"; | |||
| case ERRNO_CLI_DATA_MISSING: return "数据缺失"; | |||
| @@ -9,15 +9,20 @@ import com.nsgk.agentcentersdk.entity.NSContractionEntity; | |||
| import com.nsgk.agentcentersdk.err.NSErrGlobal; | |||
| import com.nsgk.agentcentersdk.err.NSErrno; | |||
| import com.nsgk.agentcentersdk.err.NSException; | |||
| import com.ruoyi.agentcenter.object.ContractionMessage; | |||
| import com.ruoyi.agentcenter.object.ContractionSession; | |||
| import com.ruoyi.agentcenter.object.Message; | |||
| import com.ruoyi.agentcenter.object.Result; | |||
| import com.ruoyi.agentcenter.object.Session; | |||
| import com.ruoyi.agentcenter.service.IAgentCenter; | |||
| import com.ruoyi.common.config.RuoYiConfig; | |||
| import com.ruoyi.common.core.controller.BaseController; | |||
| import com.ruoyi.common.utils.EventBusEngine; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import javax.servlet.ServletInputStream; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| /** | |||
| @@ -29,6 +34,9 @@ import javax.servlet.http.HttpServletRequest; | |||
| @RequestMapping("/agentcenter/api") | |||
| public class AgentCenterController extends BaseController | |||
| { | |||
| @Autowired | |||
| private IAgentCenter agentCenter; | |||
| @PostMapping("/test") | |||
| public NSApiResult test(HttpServletRequest request) | |||
| { | |||
| @@ -45,18 +53,10 @@ public class AgentCenterController extends BaseController | |||
| @PostMapping("/report") | |||
| public NSApiResult report(HttpServletRequest request) | |||
| { | |||
| NSSDKServer server; | |||
| NSReportObject<NSContractionEntity> recv; | |||
| NSSDK.InitServer(RuoYiConfig.Secret.privateKey); | |||
| try | |||
| { | |||
| server = NSSDK.InstanceServer(); | |||
| recv = server.Recv(request, NSContractionEntity.class); | |||
| EventBusEngine.Post(convMsg(recv)); | |||
| return NSSDKServer.Success("上报成功"); | |||
| Result<?> result = agentCenter.postHandle(request); | |||
| return response(result); | |||
| } | |||
| catch(NSException e) | |||
| { | |||
| @@ -64,21 +64,8 @@ public class AgentCenterController extends BaseController | |||
| } | |||
| } | |||
| private Message<?> convMsg(NSReportObject<?> reportObject) | |||
| private NSApiResult response(Result<?> result) | |||
| { | |||
| Message<?> msg; | |||
| int protocol; | |||
| protocol = reportObject.getProtocol(); | |||
| switch(reportObject.getProtocol()) | |||
| { | |||
| case NSProtocol.NS_PROTOCOL_CONTRACTION: | |||
| msg = new ContractionMessage(protocol, reportObject.getIdentifier(), reportObject.getTimestamp(), (NSContractionEntity)reportObject.getData()); | |||
| break; | |||
| default: | |||
| NSErrGlobal.Err(NSErrno.ERRNO_SYS_INVALID_PROTOCOL); | |||
| throw new RuntimeException(String.format("未知的协议类型: 0x%x", protocol)); | |||
| } | |||
| return msg; | |||
| return NSSDKServer.Resp(result.getCode(), result.getMessage(), result.getData()); | |||
| } | |||
| } | |||
| @@ -0,0 +1,83 @@ | |||
| package com.ruoyi.agentcenter.domain; | |||
| import java.util.Date; | |||
| import cn.hutool.core.date.DateUtil; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import lombok.Data; | |||
| import lombok.experimental.Accessors; | |||
| import org.apache.commons.lang3.builder.ToStringBuilder; | |||
| import org.apache.commons.lang3.builder.ToStringStyle; | |||
| import com.ruoyi.common.annotation.Excel; | |||
| import com.ruoyi.common.core.domain.BaseEntity; | |||
| /** | |||
| * 合同任务对象 t_agent_contraction | |||
| * | |||
| * @author zhao | |||
| * @date 2023-07-14 | |||
| */ | |||
| @Data | |||
| @Accessors(chain = true) | |||
| public class TAgentContraction extends BaseEntity | |||
| { | |||
| private static final long serialVersionUID = 1L; | |||
| /** ID */ | |||
| private Long id; | |||
| /** 任务id(关联任务表) */ | |||
| @Excel(name = "任务id(关联任务表)") | |||
| private Long taskId; | |||
| /** 行政区划代码 */ | |||
| @Excel(name = "行政区划代码") | |||
| private String orgCode; | |||
| /** 外部业务ID */ | |||
| @Excel(name = "外部业务ID") | |||
| private Long outId; | |||
| /** 账套ID */ | |||
| @Excel(name = "账套ID") | |||
| private Long bookId; | |||
| /** 部门id */ | |||
| @Excel(name = "部门id") | |||
| private Long deptId; | |||
| /** 合同名称 */ | |||
| @Excel(name = "合同名称") | |||
| private String name; | |||
| /** 签订日期 */ | |||
| @Excel(name = "签订日期") | |||
| private String buildingTime; | |||
| /** 上报时间 */ | |||
| @JsonFormat(pattern = "yyyy-MM-dd") | |||
| @Excel(name = "上报时间", width = 30, dateFormat = "yyyy-MM-dd") | |||
| private Date orderAt; | |||
| /** 上报年度(截) */ | |||
| @Excel(name = "上报年度(截)") | |||
| private String orderYear; | |||
| /** 上报月份(截) */ | |||
| @Excel(name = "上报月份(截)") | |||
| private String orderMonth; | |||
| /** 任务状态 字典 agent_status */ | |||
| @Excel(name = "任务状态 字典 agent_status") | |||
| private String agentStatus; | |||
| /** 记账状态 字典 order_status */ | |||
| @Excel(name = "记账状态 字典 order_status") | |||
| private String orderStatus; | |||
| public void normalized() | |||
| { | |||
| orderYear = DateUtil.format(orderAt, "yyyy"); | |||
| orderMonth = DateUtil.format(orderAt, "MM"); | |||
| } | |||
| } | |||
| @@ -2,15 +2,25 @@ package com.ruoyi.agentcenter.listener; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import com.google.common.eventbus.Subscribe; | |||
| import com.ruoyi.agentcenter.object.ContractionMessage; | |||
| import com.nsgk.agentcentersdk.entity.NSContractionEntity; | |||
| import com.ruoyi.agentcenter.domain.TAgentContraction; | |||
| import com.ruoyi.agentcenter.object.ContractionSession; | |||
| import com.ruoyi.agentcenter.object.Message; | |||
| import com.ruoyi.agentcenter.object.Result; | |||
| import com.ruoyi.agentcenter.service.ITAgentContractionService; | |||
| import com.ruoyi.common.utils.EventBusEngine; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Component; | |||
| import javax.annotation.PostConstruct; | |||
| import java.util.Date; | |||
| @Component | |||
| public class ContractionListener | |||
| { | |||
| @Autowired | |||
| private ITAgentContractionService itAgentContractionService; | |||
| @PostConstruct | |||
| public void init() | |||
| { | |||
| @@ -19,8 +29,31 @@ public class ContractionListener | |||
| @Subscribe | |||
| //@AllowConcurrentEvents | |||
| public void handle(ContractionMessage msg) | |||
| public void handle(ContractionSession session) | |||
| { | |||
| TAgentContraction contraction = conv(session.message); | |||
| Result result = session.result; | |||
| itAgentContractionService.insertTAgentContraction(contraction); | |||
| result.setData(contraction); | |||
| } | |||
| private TAgentContraction conv(Message<NSContractionEntity> message) | |||
| { | |||
| System.err.println(JSONObject.toJSONString(msg)); | |||
| TAgentContraction contraction = new TAgentContraction(); | |||
| NSContractionEntity data = message.getData(); | |||
| contraction.setBookId(data.getBookId()) | |||
| .setDeptId(data.getDeptId()) | |||
| .setOutId(data.getOutId()) | |||
| .setOrgCode(data.getOrgCode()) | |||
| .setName(data.getName()) | |||
| .setBuildingTime(data.getBuildingTime()) | |||
| .setOrderAt(new Date()) | |||
| .setAgentStatus("1") | |||
| .setOrderStatus("2") | |||
| .normalized(); | |||
| ; | |||
| return contraction; | |||
| } | |||
| } | |||
| @@ -0,0 +1,102 @@ | |||
| package com.ruoyi.agentcenter.mapper; | |||
| import java.util.List; | |||
| import com.ruoyi.agentcenter.domain.TAgentContraction; | |||
| /** | |||
| * 合同任务Mapper接口 | |||
| * | |||
| * @author zhao | |||
| * @date 2023-07-14 | |||
| */ | |||
| public interface TAgentContractionMapper | |||
| { | |||
| /** | |||
| * 查询合同任务 | |||
| * | |||
| * @param id 合同任务主键 | |||
| * @return 合同任务 | |||
| */ | |||
| public TAgentContraction selectTAgentContractionById(Long id); | |||
| /** | |||
| * 查询合同任务列表 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 合同任务集合 | |||
| */ | |||
| public List<TAgentContraction> selectTAgentContractionList(TAgentContraction tAgentContraction); | |||
| /** | |||
| * 新增合同任务 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 结果 | |||
| */ | |||
| public int insertTAgentContraction(TAgentContraction tAgentContraction); | |||
| /** | |||
| * 批量新增合同任务 | |||
| * | |||
| * @param list 合同任务 | |||
| * @return 结果 | |||
| */ | |||
| public int insertTAgentContractionBatch(List<TAgentContraction> list); | |||
| /** | |||
| * 批量修改 合同任务 | |||
| * | |||
| * @param list 合同任务 | |||
| * @return 结果 | |||
| */ | |||
| public int updateTAgentContractionBatch(List<TAgentContraction> list); | |||
| /** | |||
| * 修改合同任务 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 结果 | |||
| */ | |||
| public int updateTAgentContraction(TAgentContraction tAgentContraction); | |||
| /** | |||
| * 删除合同任务 | |||
| * | |||
| * @param id 合同任务主键 | |||
| * @return 结果 | |||
| */ | |||
| public int deleteTAgentContractionById(Long id); | |||
| /** | |||
| * 批量删除合同任务 | |||
| * | |||
| * @param ids 需要删除的数据主键集合 | |||
| * @return 结果 | |||
| */ | |||
| public int deleteTAgentContractionByIds(Long[] ids); | |||
| // Harm | |||
| /** | |||
| * 条件单条查询合同任务 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 合同任务条目 | |||
| */ | |||
| public TAgentContraction selectTAgentContraction(TAgentContraction tAgentContraction); | |||
| /** | |||
| * 条件查询合同任务数量 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 合同任务数量 | |||
| */ | |||
| public Long selectTAgentContractionCount(TAgentContraction tAgentContraction); | |||
| /** | |||
| * 条件查询合同任务是否存在 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 合同任务是否存在 | |||
| */ | |||
| public int selectTAgentContractionExists(TAgentContraction tAgentContraction); | |||
| } | |||
| @@ -1,11 +0,0 @@ | |||
| package com.ruoyi.agentcenter.object; | |||
| import com.nsgk.agentcentersdk.entity.NSContractionEntity; | |||
| public class ContractionMessage extends Message<NSContractionEntity> | |||
| { | |||
| public ContractionMessage(int protocol, String identifier, Long timestamp, NSContractionEntity data) | |||
| { | |||
| super(protocol, identifier, timestamp, data); | |||
| } | |||
| } | |||
| @@ -0,0 +1,11 @@ | |||
| package com.ruoyi.agentcenter.object; | |||
| import com.nsgk.agentcentersdk.entity.NSContractionEntity; | |||
| public class ContractionSession extends Session<NSContractionEntity, Result<?>> | |||
| { | |||
| public ContractionSession(Message<NSContractionEntity> message) | |||
| { | |||
| super(message, new Result<>()); | |||
| } | |||
| } | |||
| @@ -6,7 +6,7 @@ import lombok.experimental.Accessors; | |||
| @Data | |||
| @Accessors(chain = true) | |||
| public abstract class Message<T> | |||
| public class Message<T> | |||
| { | |||
| private final int protocol; // 协议 | |||
| private final String identifier; // 识别ID | |||
| @@ -0,0 +1,14 @@ | |||
| package com.ruoyi.agentcenter.object; | |||
| import lombok.Data; | |||
| import lombok.experimental.Accessors; | |||
| @Data | |||
| @Accessors(chain = true) | |||
| public class Result<R> | |||
| { | |||
| private boolean success; | |||
| private int code; | |||
| private String message; | |||
| private R data; | |||
| } | |||
| @@ -0,0 +1,18 @@ | |||
| package com.ruoyi.agentcenter.object; | |||
| public class Session<T, R> | |||
| { | |||
| public final Message<T> message; | |||
| public final Result<R> result; | |||
| protected Session() | |||
| { | |||
| throw new RuntimeException("Session<T, R>不能默认实例化"); | |||
| } | |||
| protected Session(Message<T> message, Result<R> result) | |||
| { | |||
| this.message = message; | |||
| this.result = result; | |||
| } | |||
| } | |||
| @@ -0,0 +1,10 @@ | |||
| package com.ruoyi.agentcenter.service; | |||
| import com.ruoyi.agentcenter.object.Result; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| public interface IAgentCenter | |||
| { | |||
| public Result<?> postHandle(HttpServletRequest request); | |||
| } | |||
| @@ -0,0 +1,102 @@ | |||
| package com.ruoyi.agentcenter.service; | |||
| import java.util.List; | |||
| import com.ruoyi.agentcenter.domain.TAgentContraction; | |||
| /** | |||
| * 合同任务Service接口 | |||
| * | |||
| * @author zhao | |||
| * @date 2023-07-14 | |||
| */ | |||
| public interface ITAgentContractionService | |||
| { | |||
| /** | |||
| * 查询合同任务 | |||
| * | |||
| * @param id 合同任务主键 | |||
| * @return 合同任务 | |||
| */ | |||
| public TAgentContraction selectTAgentContractionById(Long id); | |||
| /** | |||
| * 查询合同任务列表 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 合同任务集合 | |||
| */ | |||
| public List<TAgentContraction> selectTAgentContractionList(TAgentContraction tAgentContraction); | |||
| /** | |||
| * 新增合同任务 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 结果 | |||
| */ | |||
| public int insertTAgentContraction(TAgentContraction tAgentContraction); | |||
| /** | |||
| * 批量新增合同任务 | |||
| * | |||
| * @param list 合同任务 | |||
| * @return 结果 | |||
| */ | |||
| public int insertTAgentContractionBatch(List<TAgentContraction> list); | |||
| /** | |||
| * 修改合同任务 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 结果 | |||
| */ | |||
| public int updateTAgentContraction(TAgentContraction tAgentContraction); | |||
| /** | |||
| * 批量修改 合同任务 | |||
| * | |||
| * @param list 合同任务 | |||
| * @return 结果 | |||
| */ | |||
| public int updateTAgentContractionBatch(List<TAgentContraction> list); | |||
| /** | |||
| * 批量删除合同任务 | |||
| * | |||
| * @param ids 需要删除的合同任务主键集合 | |||
| * @return 结果 | |||
| */ | |||
| public int deleteTAgentContractionByIds(Long[] ids); | |||
| /** | |||
| * 删除合同任务信息 | |||
| * | |||
| * @param id 合同任务主键 | |||
| * @return 结果 | |||
| */ | |||
| public int deleteTAgentContractionById(Long id); | |||
| // Harm | |||
| /** | |||
| * 条件单条查询合同任务 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 合同任务条目 | |||
| */ | |||
| public TAgentContraction selectTAgentContraction(TAgentContraction tAgentContraction); | |||
| /** | |||
| * 条件查询合同任务数量 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 合同任务数量 | |||
| */ | |||
| public Long selectTAgentContractionCount(TAgentContraction tAgentContraction); | |||
| /** | |||
| * 条件查询合同任务是否存在 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 合同任务是否存在 | |||
| */ | |||
| public boolean selectTAgentContractionExists(TAgentContraction tAgentContraction); | |||
| } | |||
| @@ -0,0 +1,86 @@ | |||
| package com.ruoyi.agentcenter.service.impl; | |||
| import com.nsgk.agentcentersdk.api.NSSDK; | |||
| import com.nsgk.agentcentersdk.api.NSSDKServer; | |||
| import com.nsgk.agentcentersdk.core.NSProtocol; | |||
| import com.nsgk.agentcentersdk.core.NSReportObject; | |||
| import com.nsgk.agentcentersdk.entity.NSContractionEntity; | |||
| import com.nsgk.agentcentersdk.entity.NSEntity; | |||
| import com.nsgk.agentcentersdk.err.NSErrGlobal; | |||
| import com.nsgk.agentcentersdk.err.NSErrno; | |||
| import com.nsgk.agentcentersdk.err.NSException; | |||
| import com.ruoyi.agentcenter.object.ContractionSession; | |||
| import com.ruoyi.agentcenter.object.Message; | |||
| import com.ruoyi.agentcenter.object.Result; | |||
| import com.ruoyi.agentcenter.object.Session; | |||
| import com.ruoyi.agentcenter.service.IAgentCenter; | |||
| import com.ruoyi.common.config.RuoYiConfig; | |||
| import com.ruoyi.common.utils.EventBusEngine; | |||
| import org.springframework.stereotype.Service; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| @Service | |||
| public class AgentCenterImpl implements IAgentCenter | |||
| { | |||
| public int getProtocol(HttpServletRequest request) | |||
| { | |||
| int protocol = NSSDKServer.GetProtocol(request); | |||
| if(!NSProtocol.IsValid(protocol)) | |||
| { | |||
| NSErrGlobal.Err(NSErrno.ERRNO_SYS_INVALID_PROTOCOL); | |||
| throw new NSException(NSErrno.ERRNO_SYS_INVALID_PROTOCOL, String.format("未知的协议类型: 0x%x", protocol)); | |||
| } | |||
| return protocol; | |||
| } | |||
| public Message<?> getMessage(HttpServletRequest request) | |||
| { | |||
| NSSDKServer server; | |||
| NSReportObject<?> reportObject; | |||
| Message<?> message; | |||
| NSSDK.InitServer(RuoYiConfig.Secret.privateKey); | |||
| server = NSSDK.InstanceServer(); | |||
| int protocol = getProtocol(request); | |||
| Class<? extends NSEntity> clazz; | |||
| switch(protocol) | |||
| { | |||
| case NSProtocol.NS_PROTOCOL_CONTRACTION: | |||
| clazz = NSContractionEntity.class; | |||
| break; | |||
| default: | |||
| return null; | |||
| } | |||
| reportObject = server.Recv(request, clazz); | |||
| message = new Message<>(protocol, reportObject.getIdentifier(), reportObject.getTimestamp(), reportObject.getData()); | |||
| return message; | |||
| } | |||
| public Session<?, ?> createSession(Message<?> message) | |||
| { | |||
| Session<?, ?> session; | |||
| int protocol; | |||
| protocol = message.getProtocol(); | |||
| switch(protocol) | |||
| { | |||
| case NSProtocol.NS_PROTOCOL_CONTRACTION: | |||
| session = new ContractionSession((Message<NSContractionEntity>) message); | |||
| break; | |||
| default: | |||
| return null; | |||
| } | |||
| return session; | |||
| } | |||
| @Override | |||
| public Result<?> postHandle(HttpServletRequest request) | |||
| { | |||
| Message<?> message = getMessage(request); | |||
| Session<?, ?> session = createSession(message); | |||
| EventBusEngine.Post(session); | |||
| return session.result; | |||
| } | |||
| } | |||
| @@ -0,0 +1,164 @@ | |||
| package com.ruoyi.agentcenter.service.impl; | |||
| import java.util.List; | |||
| import com.ruoyi.common.utils.DateUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import org.apache.commons.collections4.ListUtils; | |||
| import com.ruoyi.agentcenter.mapper.TAgentContractionMapper; | |||
| import com.ruoyi.agentcenter.domain.TAgentContraction; | |||
| import com.ruoyi.agentcenter.service.ITAgentContractionService; | |||
| /** | |||
| * 合同任务Service业务层处理 | |||
| * | |||
| * @author zhao | |||
| * @date 2023-07-14 | |||
| */ | |||
| @Service | |||
| public class TAgentContractionServiceImpl implements ITAgentContractionService | |||
| { | |||
| @Autowired | |||
| private TAgentContractionMapper tAgentContractionMapper; | |||
| /** | |||
| * 查询合同任务 | |||
| * | |||
| * @param id 合同任务主键 | |||
| * @return 合同任务 | |||
| */ | |||
| @Override | |||
| public TAgentContraction selectTAgentContractionById(Long id) | |||
| { | |||
| return tAgentContractionMapper.selectTAgentContractionById(id); | |||
| } | |||
| /** | |||
| * 查询合同任务列表 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 合同任务 | |||
| */ | |||
| @Override | |||
| public List<TAgentContraction> selectTAgentContractionList(TAgentContraction tAgentContraction) | |||
| { | |||
| return tAgentContractionMapper.selectTAgentContractionList(tAgentContraction); | |||
| } | |||
| /** | |||
| * 新增合同任务 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 结果 | |||
| */ | |||
| @Override | |||
| public int insertTAgentContraction(TAgentContraction tAgentContraction) | |||
| { | |||
| tAgentContraction.setCreateTime(DateUtils.getNowDate()); | |||
| return tAgentContractionMapper.insertTAgentContraction(tAgentContraction); | |||
| } | |||
| /** | |||
| * 批量新增合同任务 | |||
| * | |||
| * @param list 合同任务 | |||
| * @return 结果 | |||
| */ | |||
| @Override | |||
| @Transactional | |||
| public int insertTAgentContractionBatch(List<TAgentContraction> list){ | |||
| List<List<TAgentContraction>> splists = ListUtils.partition(list, 50); | |||
| splists.forEach(splist->{ | |||
| tAgentContractionMapper.insertTAgentContractionBatch(splist); | |||
| }); | |||
| return 1; | |||
| } | |||
| /** | |||
| * 修改合同任务 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 结果 | |||
| */ | |||
| @Override | |||
| public int updateTAgentContraction(TAgentContraction tAgentContraction) | |||
| { | |||
| tAgentContraction.setUpdateTime(DateUtils.getNowDate()); | |||
| return tAgentContractionMapper.updateTAgentContraction(tAgentContraction); | |||
| } | |||
| /** | |||
| * 批量修改 合同任务 | |||
| * | |||
| * @param list 合同任务 | |||
| * @return 结果 | |||
| */ | |||
| @Override | |||
| @Transactional | |||
| public int updateTAgentContractionBatch(List<TAgentContraction> list) { | |||
| List<List<TAgentContraction>> splists = ListUtils.partition(list, 50); | |||
| splists.forEach(splist->{ | |||
| tAgentContractionMapper.updateTAgentContractionBatch(splist); | |||
| }); | |||
| return 1; | |||
| } | |||
| /** | |||
| * 批量删除合同任务 | |||
| * | |||
| * @param ids 需要删除的合同任务主键 | |||
| * @return 结果 | |||
| */ | |||
| @Override | |||
| public int deleteTAgentContractionByIds(Long[] ids) | |||
| { | |||
| return tAgentContractionMapper.deleteTAgentContractionByIds(ids); | |||
| } | |||
| /** | |||
| * 删除合同任务信息 | |||
| * | |||
| * @param id 合同任务主键 | |||
| * @return 结果 | |||
| */ | |||
| @Override | |||
| public int deleteTAgentContractionById(Long id) | |||
| { | |||
| return tAgentContractionMapper.deleteTAgentContractionById(id); | |||
| } | |||
| // Harm | |||
| /** | |||
| * 单条条件查询合同任务 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 合同任务条目 | |||
| */ | |||
| @Override | |||
| public TAgentContraction selectTAgentContraction(TAgentContraction tAgentContraction) { | |||
| return tAgentContractionMapper.selectTAgentContraction(tAgentContraction); | |||
| } | |||
| /** | |||
| * 条件查询合同任务数量 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 合同任务数量 | |||
| */ | |||
| @Override | |||
| public Long selectTAgentContractionCount(TAgentContraction tAgentContraction) { | |||
| return tAgentContractionMapper.selectTAgentContractionCount(tAgentContraction); | |||
| } | |||
| /** | |||
| * 条件查询合同任务是否存在 | |||
| * | |||
| * @param tAgentContraction 合同任务 | |||
| * @return 合同任务是否存在 | |||
| */ | |||
| @Override | |||
| public boolean selectTAgentContractionExists(TAgentContraction tAgentContraction) { | |||
| return tAgentContractionMapper.selectTAgentContractionExists(tAgentContraction) > 0; | |||
| } | |||
| } | |||
| @@ -0,0 +1,274 @@ | |||
| <?xml version="1.0" encoding="UTF-8" ?> | |||
| <!DOCTYPE mapper | |||
| PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
| "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.ruoyi.agentcenter.mapper.TAgentContractionMapper"> | |||
| <resultMap type="TAgentContraction" id="TAgentContractionResult"> | |||
| <result property="id" column="id" /> | |||
| <result property="taskId" column="task_id" /> | |||
| <result property="orgCode" column="org_code" /> | |||
| <result property="outId" column="out_id" /> | |||
| <result property="bookId" column="book_id" /> | |||
| <result property="deptId" column="dept_id" /> | |||
| <result property="name" column="name" /> | |||
| <result property="buildingTime" column="building_time" /> | |||
| <result property="remark" column="remark" /> | |||
| <result property="orderAt" column="order_at" /> | |||
| <result property="orderYear" column="order_year" /> | |||
| <result property="orderMonth" column="order_month" /> | |||
| <result property="agentStatus" column="agent_status" /> | |||
| <result property="orderStatus" column="order_status" /> | |||
| <result property="createBy" column="create_by" /> | |||
| <result property="createTime" column="create_time" /> | |||
| <result property="updateBy" column="update_by" /> | |||
| <result property="updateTime" column="update_time" /> | |||
| </resultMap> | |||
| <sql id="selectTAgentContractionVo"> | |||
| select id, task_id, org_code, out_id, book_id, dept_id, name, building_time, remark, order_at, order_year, order_month, agent_status, order_status, create_by, create_time, update_by, update_time from t_agent_contraction | |||
| </sql> | |||
| <!--条件查询--> | |||
| <select id="selectTAgentContractionList" parameterType="TAgentContraction" resultMap="TAgentContractionResult"> | |||
| <include refid="selectTAgentContractionVo"/> | |||
| <where> | |||
| <if test="taskId != null "> and task_id = #{taskId}</if> | |||
| <if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if> | |||
| <if test="outId != null "> and out_id = #{outId}</if> | |||
| <if test="bookId != null "> and book_id = #{bookId}</if> | |||
| <if test="deptId != null "> and dept_id = #{deptId}</if> | |||
| <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> | |||
| <if test="buildingTime != null and buildingTime != ''"> and building_time = #{buildingTime}</if> | |||
| <if test="orderAt != null "> and order_at = #{orderAt}</if> | |||
| <if test="orderYear != null and orderYear != ''"> and order_year = #{orderYear}</if> | |||
| <if test="orderMonth != null and orderMonth != ''"> and order_month = #{orderMonth}</if> | |||
| <if test="agentStatus != null and agentStatus != ''"> and agent_status = #{agentStatus}</if> | |||
| <if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if> | |||
| </where> | |||
| </select> | |||
| <!--主键查询--> | |||
| <select id="selectTAgentContractionById" parameterType="Long" resultMap="TAgentContractionResult"> | |||
| <include refid="selectTAgentContractionVo"/> | |||
| where id = #{id} | |||
| </select> | |||
| <!--新增--> | |||
| <insert id="insertTAgentContraction" parameterType="TAgentContraction" useGeneratedKeys="true" keyProperty="id"> | |||
| insert into t_agent_contraction | |||
| <trim prefix="(" suffix=")" suffixOverrides=","> | |||
| <if test="taskId != null">task_id,</if> | |||
| <if test="orgCode != null and orgCode != ''">org_code,</if> | |||
| <if test="outId != null">out_id,</if> | |||
| <if test="bookId != null">book_id,</if> | |||
| <if test="deptId != null">dept_id,</if> | |||
| <if test="name != null and name != ''">name,</if> | |||
| <if test="buildingTime != null and buildingTime != ''">building_time,</if> | |||
| <if test="remark != null">remark,</if> | |||
| <if test="orderAt != null">order_at,</if> | |||
| <if test="orderYear != null and orderYear != ''">order_year,</if> | |||
| <if test="orderMonth != null and orderMonth != ''">order_month,</if> | |||
| <if test="agentStatus != null and agentStatus != ''">agent_status,</if> | |||
| <if test="orderStatus != null and orderStatus != ''">order_status,</if> | |||
| <if test="createBy != null">create_by,</if> | |||
| <if test="createTime != null">create_time,</if> | |||
| <if test="updateBy != null">update_by,</if> | |||
| <if test="updateTime != null">update_time,</if> | |||
| </trim> | |||
| <trim prefix="values (" suffix=")" suffixOverrides=","> | |||
| <if test="taskId != null">#{taskId},</if> | |||
| <if test="orgCode != null and orgCode != ''">#{orgCode},</if> | |||
| <if test="outId != null">#{outId},</if> | |||
| <if test="bookId != null">#{bookId},</if> | |||
| <if test="deptId != null">#{deptId},</if> | |||
| <if test="name != null and name != ''">#{name},</if> | |||
| <if test="buildingTime != null and buildingTime != ''">#{buildingTime},</if> | |||
| <if test="remark != null">#{remark},</if> | |||
| <if test="orderAt != null">#{orderAt},</if> | |||
| <if test="orderYear != null and orderYear != ''">#{orderYear},</if> | |||
| <if test="orderMonth != null and orderMonth != ''">#{orderMonth},</if> | |||
| <if test="agentStatus != null and agentStatus != ''">#{agentStatus},</if> | |||
| <if test="orderStatus != null and orderStatus != ''">#{orderStatus},</if> | |||
| <if test="createBy != null">#{createBy},</if> | |||
| <if test="createTime != null">#{createTime},</if> | |||
| <if test="updateBy != null">#{updateBy},</if> | |||
| <if test="updateTime != null">#{updateTime},</if> | |||
| </trim> | |||
| </insert> | |||
| <!--批量新增--> | |||
| <insert id="insertTAgentContractionBatch" parameterType="list" useGeneratedKeys="true" keyProperty="id"> | |||
| insert into t_agent_contraction | |||
| <trim prefix="(" suffix=")" suffixOverrides=","> | |||
| task_id, | |||
| org_code, | |||
| out_id, | |||
| book_id, | |||
| dept_id, | |||
| name, | |||
| building_time, | |||
| remark, | |||
| order_at, | |||
| order_year, | |||
| order_month, | |||
| agent_status, | |||
| order_status, | |||
| create_by, | |||
| create_time, | |||
| update_by, | |||
| update_time, | |||
| </trim> | |||
| values | |||
| <foreach item="item" collection="list" separator="," > | |||
| <trim prefix="(" suffix=")" suffixOverrides=","> | |||
| #{item.taskId}, | |||
| #{item.orgCode}, | |||
| #{item.outId}, | |||
| #{item.bookId}, | |||
| #{item.deptId}, | |||
| #{item.name}, | |||
| #{item.buildingTime}, | |||
| #{item.remark}, | |||
| #{item.orderAt}, | |||
| #{item.orderYear}, | |||
| #{item.orderMonth}, | |||
| #{item.agentStatus}, | |||
| #{item.orderStatus}, | |||
| #{item.createBy}, | |||
| #{item.createTime}, | |||
| #{item.updateBy}, | |||
| #{item.updateTime}, | |||
| </trim> | |||
| </foreach> | |||
| </insert> | |||
| <!--更新--> | |||
| <update id="updateTAgentContraction" parameterType="TAgentContraction"> | |||
| update t_agent_contraction | |||
| <trim prefix="SET" suffixOverrides=","> | |||
| <if test="taskId != null">task_id = #{taskId},</if> | |||
| <if test="orgCode != null and orgCode != ''">org_code = #{orgCode},</if> | |||
| <if test="outId != null">out_id = #{outId},</if> | |||
| <if test="bookId != null">book_id = #{bookId},</if> | |||
| <if test="deptId != null">dept_id = #{deptId},</if> | |||
| <if test="name != null and name != ''">name = #{name},</if> | |||
| <if test="buildingTime != null and buildingTime != ''">building_time = #{buildingTime},</if> | |||
| <if test="remark != null">remark = #{remark},</if> | |||
| <if test="orderAt != null">order_at = #{orderAt},</if> | |||
| <if test="orderYear != null and orderYear != ''">order_year = #{orderYear},</if> | |||
| <if test="orderMonth != null and orderMonth != ''">order_month = #{orderMonth},</if> | |||
| <if test="agentStatus != null and agentStatus != ''">agent_status = #{agentStatus},</if> | |||
| <if test="orderStatus != null and orderStatus != ''">order_status = #{orderStatus},</if> | |||
| <if test="createBy != null">create_by = #{createBy},</if> | |||
| <if test="createTime != null">create_time = #{createTime},</if> | |||
| <if test="updateBy != null">update_by = #{updateBy},</if> | |||
| <if test="updateTime != null">update_time = #{updateTime},</if> | |||
| <if test="params != null and params.__UPDATE != null"><foreach collection="params.__UPDATE" item="val" index="col">`${col}` = #{val},</foreach></if> | |||
| </trim> | |||
| where id = #{id} | |||
| </update> | |||
| <!--批量更新--> | |||
| <update id="updateTAgentContractionBatch" parameterType="list" > | |||
| <foreach collection="list" item="item" index="index" open="" close="" separator=";"> | |||
| update t_agent_contraction | |||
| <set> | |||
| <if test="item.taskId != null">task_id = #{item.taskId},</if> | |||
| <if test="item.orgCode != null and item.orgCode != ''">org_code = #{item.orgCode},</if> | |||
| <if test="item.outId != null">out_id = #{item.outId},</if> | |||
| <if test="item.bookId != null">book_id = #{item.bookId},</if> | |||
| <if test="item.deptId != null">dept_id = #{item.deptId},</if> | |||
| <if test="item.name != null and item.name != ''">name = #{item.name},</if> | |||
| <if test="item.buildingTime != null and item.buildingTime != ''">building_time = #{item.buildingTime},</if> | |||
| <if test="item.remark != null">remark = #{item.remark},</if> | |||
| <if test="item.orderAt != null">order_at = #{item.orderAt},</if> | |||
| <if test="item.orderYear != null and item.orderYear != ''">order_year = #{item.orderYear},</if> | |||
| <if test="item.orderMonth != null and item.orderMonth != ''">order_month = #{item.orderMonth},</if> | |||
| <if test="item.agentStatus != null and item.agentStatus != ''">agent_status = #{item.agentStatus},</if> | |||
| <if test="item.orderStatus != null and item.orderStatus != ''">order_status = #{item.orderStatus},</if> | |||
| <if test="item.createBy != null">create_by = #{item.createBy},</if> | |||
| <if test="item.createTime != null">create_time = #{item.createTime},</if> | |||
| <if test="item.updateBy != null">update_by = #{item.updateBy},</if> | |||
| <if test="item.updateTime != null">update_time = #{item.updateTime},</if> | |||
| <if test="item.params != null and item.params.__UPDATE != null"><foreach collection="item.params.__UPDATE" item="val" index="col">`${col}` = #{val},</foreach></if> | |||
| </set> | |||
| where id = #{item.id} | |||
| </foreach> | |||
| </update> | |||
| <!--主键删除--> | |||
| <delete id="deleteTAgentContractionById" parameterType="Long"> | |||
| delete from t_agent_contraction where id = #{id} | |||
| </delete> | |||
| <!--主键批量删除--> | |||
| <delete id="deleteTAgentContractionByIds" parameterType="String"> | |||
| delete from t_agent_contraction where id in | |||
| <foreach item="id" collection="array" open="(" separator="," close=")"> | |||
| #{id} | |||
| </foreach> | |||
| </delete> | |||
| <!-- Harm --> | |||
| <!--单条条件查询--> | |||
| <select id="selectTAgentContraction" parameterType="TAgentContraction" resultMap="TAgentContractionResult"> | |||
| <include refid="selectTAgentContractionVo"/> | |||
| <where> | |||
| <if test="taskId != null "> and task_id = #{taskId}</if> | |||
| <if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if> | |||
| <if test="outId != null "> and out_id = #{outId}</if> | |||
| <if test="bookId != null "> and book_id = #{bookId}</if> | |||
| <if test="deptId != null "> and dept_id = #{deptId}</if> | |||
| <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> | |||
| <if test="buildingTime != null and buildingTime != ''"> and building_time = #{buildingTime}</if> | |||
| <if test="orderAt != null "> and order_at = #{orderAt}</if> | |||
| <if test="orderYear != null and orderYear != ''"> and order_year = #{orderYear}</if> | |||
| <if test="orderMonth != null and orderMonth != ''"> and order_month = #{orderMonth}</if> | |||
| <if test="agentStatus != null and agentStatus != ''"> and agent_status = #{agentStatus}</if> | |||
| <if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if> | |||
| </where> | |||
| limit 1 | |||
| </select> | |||
| <!--条件查询数量--> | |||
| <select id="selectTAgentContractionCount" parameterType="TAgentContraction" resultType="Long"> | |||
| select count(*) from t_agent_contraction | |||
| <where> | |||
| <if test="taskId != null "> and task_id = #{taskId}</if> | |||
| <if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if> | |||
| <if test="outId != null "> and out_id = #{outId}</if> | |||
| <if test="bookId != null "> and book_id = #{bookId}</if> | |||
| <if test="deptId != null "> and dept_id = #{deptId}</if> | |||
| <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> | |||
| <if test="buildingTime != null and buildingTime != ''"> and building_time = #{buildingTime}</if> | |||
| <if test="orderAt != null "> and order_at = #{orderAt}</if> | |||
| <if test="orderYear != null and orderYear != ''"> and order_year = #{orderYear}</if> | |||
| <if test="orderMonth != null and orderMonth != ''"> and order_month = #{orderMonth}</if> | |||
| <if test="agentStatus != null and agentStatus != ''"> and agent_status = #{agentStatus}</if> | |||
| <if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if> | |||
| </where> | |||
| </select> | |||
| <!--条件查询是否存在--> | |||
| <select id="selectTAgentContractionExists" parameterType="TAgentContraction" resultType="int"> | |||
| select exists ( | |||
| select 1 from t_agent_contraction | |||
| <where> | |||
| <if test="taskId != null "> and task_id = #{taskId}</if> | |||
| <if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if> | |||
| <if test="outId != null "> and out_id = #{outId}</if> | |||
| <if test="bookId != null "> and book_id = #{bookId}</if> | |||
| <if test="deptId != null "> and dept_id = #{deptId}</if> | |||
| <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> | |||
| <if test="buildingTime != null and buildingTime != ''"> and building_time = #{buildingTime}</if> | |||
| <if test="orderAt != null "> and order_at = #{orderAt}</if> | |||
| <if test="orderYear != null and orderYear != ''"> and order_year = #{orderYear}</if> | |||
| <if test="orderMonth != null and orderMonth != ''"> and order_month = #{orderMonth}</if> | |||
| <if test="agentStatus != null and agentStatus != ''"> and agent_status = #{agentStatus}</if> | |||
| <if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if> | |||
| </where> | |||
| limit 1 | |||
| ) | |||
| </select> | |||
| </mapper> | |||
| @@ -19,7 +19,7 @@ public final class EventBusEngine | |||
| private static final List<Object> _listenerList = new ArrayList<>(); | |||
| @Autowired | |||
| public void setAsyncEventBus(@Qualifier("asyncEventBus" ) EventBus eventBus) | |||
| public void setEventBus(@Qualifier( "syncEventBus" ) EventBus eventBus) | |||
| { | |||
| EventBusEngine._eventBus = eventBus; | |||
| logger.info("EventBusEngine::initialization -> " + eventBus); | |||