已重命名8个文件
已删除3个文件
已添加5个文件
已修改3个文件
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.order.common; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fzzy.order.common.data.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | /** |
| | | * ä¸åæä»¤æ¥æ¶å
¥å£ --- ç®å䏿µ·ä½¿ç¨ |
| | | * |
| | | * @author czt |
| | | * @date 2023/8/17 |
| | | */ |
| | | @Slf4j |
| | | @Controller |
| | | @RequestMapping("service/api") |
| | | public class OrderCommonController { |
| | | |
| | | @Autowired |
| | | private OrderCommonManager orderManager; |
| | | /** |
| | | * ç»å½å
¥å£ |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | @ResponseBody |
| | | @RequestMapping("/order") |
| | | public OrderCommonResp order(@RequestBody OrderCommonReq<JSONObject> req){ |
| | | |
| | | log.info("æ¥æ¶çæä»¤ä¿¡æ¯={}", req); |
| | | //夿忰 |
| | | if(null == req){ |
| | | return new OrderCommonResp(OrderCommonResult.ORDER_CODE_500.getCode(), OrderCommonResult.ORDER_CODE_500.getResult()); |
| | | } |
| | | |
| | | //å¿è·³æä»¤ï¼ç´æ¥è¿å |
| | | if(OrderCommonConstant.ORDER_TYPE_0.equals(req.getType())){ |
| | | OrderCommonResp resp = new OrderCommonResp(OrderCommonResult.ORDER_CODE_200.getCode(), OrderCommonResult.ORDER_CODE_200.getResult()); |
| | | log.info("å¿è·³æä»¤è¿åä¿¡æ¯={}", resp); |
| | | return resp; |
| | | } |
| | | |
| | | try { |
| | | |
| | | //弿¥æ§è¡ |
| | | orderManager.execute(req); |
| | | |
| | | return new OrderCommonResp(OrderCommonResult.ORDER_CODE_200.getCode(), OrderCommonResult.ORDER_CODE_200.getResult()); |
| | | |
| | | } catch (Exception e) { |
| | | |
| | | return new OrderCommonResp(OrderCommonResult.ORDER_CODE_500.getCode(), OrderCommonResult.ORDER_CODE_500.getResult()); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
ÎļþÃû´Ó src/main/java/com/fzzy/order/OrderManager.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.order; |
| | | package com.fzzy.order.common; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fzzy.api.entity.ApiConfs; |
| | | import com.fzzy.api.view.pr.ApiConfsPR; |
| | | import com.fzzy.order.data.OrderData; |
| | | import com.fzzy.order.data.OrderReq; |
| | | import com.fzzy.order.common.data.OrderCommonData; |
| | | import com.fzzy.order.common.data.OrderCommonReq; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | * @date 2023/8/17 |
| | | */ |
| | | @Slf4j |
| | | @Component(OrderManager.BEAN_ID) |
| | | public class OrderManager implements ApplicationContextAware { |
| | | @Component(OrderCommonManager.BEAN_ID) |
| | | public class OrderCommonManager implements ApplicationContextAware { |
| | | public static final String BEAN_ID = "order.orderManager"; |
| | | |
| | | private static Map<String, OrderApiService> serviceMap; |
| | | private static Map<String, OrderCommonService> serviceMap; |
| | | |
| | | @Autowired |
| | | private ApiConfsPR apiConfsPR; |
| | | |
| | | @Override |
| | | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| | | Map<String, OrderApiService> map = applicationContext.getBeansOfType(OrderApiService.class); |
| | | Map<String, OrderCommonService> map = applicationContext.getBeansOfType(OrderCommonService.class); |
| | | serviceMap = new HashMap<>(); |
| | | for (String key : map.keySet()) { |
| | | serviceMap.put(map.get(key).getProtocol(), map.get(key)); |
| | |
| | | * @param req |
| | | */ |
| | | @Async |
| | | public void execute(OrderReq<JSONObject> req){ |
| | | public void execute(OrderCommonReq<JSONObject> req){ |
| | | |
| | | try{ |
| | | //è·åé
ç½®ä¿¡æ¯ |
| | |
| | | if(null == apiConfList || apiConfList.isEmpty()){ |
| | | return; |
| | | } |
| | | OrderData data = JSONObject.parseObject(req.getData().toString(), OrderData.class); |
| | | OrderCommonData data = JSONObject.parseObject(req.getData().toString(), OrderCommonData.class); |
| | | data.setOrderid(req.getOrderid()); |
| | | //æ ¹æ®é
ç½®ä¿¡æ¯æ§è¡ |
| | | OrderApiService service; |
| | | OrderCommonService service; |
| | | for (ApiConfs conf : apiConfList) { |
| | | |
| | | service = serviceMap.get(conf.getPushProtocol()); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.order.common; |
| | | |
| | | import com.fzzy.api.entity.ApiConfs; |
| | | import com.fzzy.order.common.data.OrderCommonData; |
| | | |
| | | import java.text.ParseException; |
| | | |
| | | /** |
| | | * æ ¹æ®å议解ææä»¤ |
| | | * |
| | | * @author czt |
| | | */ |
| | | public interface OrderCommonService { |
| | | |
| | | /** |
| | | * è·ååè®®ç¼ç |
| | | * |
| | | * @return |
| | | */ |
| | | public String getProtocol(); |
| | | |
| | | /** |
| | | * è§£ææä»¤ |
| | | * @param req |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | |
| | | public void execute(OrderCommonData req, String orderType, ApiConfs apiConfs, String orderid) throws ParseException; |
| | | } |
ÎļþÃû´Ó src/main/java/com/fzzy/order/data/OrderConstant.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.order.data; |
| | | package com.fzzy.order.common.data; |
| | | |
| | | /** |
| | | * æä»¤-常éç±» |
| | | * @author czt |
| | | * @date 2023/8/17 |
| | | */ |
| | | public class OrderConstant { |
| | | public class OrderCommonConstant { |
| | | |
| | | /** |
| | | * æä»¤ç±»å |
ÎļþÃû´Ó src/main/java/com/fzzy/order/data/OrderData.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.order.data; |
| | | package com.fzzy.order.common.data; |
| | | |
| | | import lombok.Data; |
| | | import java.io.Serializable; |
| | |
| | | * @date 2023/08/17 |
| | | */ |
| | | @Data |
| | | public class OrderData implements Serializable { |
| | | public class OrderCommonData implements Serializable { |
| | | |
| | | /** |
| | | * æ¥å£å
容ï¼å¤ä¸ªä¸é´ç¨è±æéå·éå¼ |
ÎļþÃû´Ó src/main/java/com/fzzy/order/data/OrderReq.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.order.data; |
| | | package com.fzzy.order.common.data; |
| | | |
| | | import lombok.Data; |
| | | import java.io.Serializable; |
| | |
| | | * @date 2023/08/17 |
| | | */ |
| | | @Data |
| | | public class OrderReq<T> implements Serializable { |
| | | public class OrderCommonReq<T> implements Serializable { |
| | | |
| | | /** |
| | | * æä»¤id |
ÎļþÃû´Ó src/main/java/com/fzzy/order/data/OrderResp.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.order.data; |
| | | package com.fzzy.order.common.data; |
| | | |
| | | import lombok.Data; |
| | | |
| | |
| | | * @date 2023/08/17 |
| | | */ |
| | | @Data |
| | | public class OrderResp<T> implements Serializable { |
| | | public class OrderCommonResp<T> implements Serializable { |
| | | /** |
| | | * |
| | | */ |
| | |
| | | private String result; |
| | | |
| | | |
| | | public OrderResp() { |
| | | public OrderCommonResp() { |
| | | } |
| | | |
| | | public OrderResp(String code, String result) { |
| | | public OrderCommonResp(String code, String result) { |
| | | this.code = code; |
| | | this.result = result; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.fzzy.order.common.data; |
| | | |
| | | /** |
| | | * æä»¤åé¦ç |
| | | */ |
| | | public enum OrderCommonResult { |
| | | |
| | | ORDER_CODE_200("200", "æä»¤è§£ææå"), |
| | | ORDER_CODE_500("500", "æä»¤è§£æå¤±è´¥"); |
| | | |
| | | private String code; |
| | | private String result; |
| | | |
| | | OrderCommonResult(String code, String msg) { |
| | | this.code = code; |
| | | this.result = msg; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getResult() { |
| | | return result; |
| | | } |
| | | |
| | | public static String getMsg(String code) { |
| | | if(null == code) return null; |
| | | |
| | | if(OrderCommonResult.ORDER_CODE_200.getCode().equals(code)) return OrderCommonResult.ORDER_CODE_200.getResult(); |
| | | if(OrderCommonResult.ORDER_CODE_500.getCode().equals(code)) return OrderCommonResult.ORDER_CODE_500.getResult(); |
| | | return code; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /** |
| | | * @Description å
Œ
±æä»¤å
ï¼æä»¤è·¯å¾èªå®ä¹ã䏿µ·ä½¿ç¨ï¼å¹¿ä¸æµè¯ä½¿ç¨ï¼ |
| | | * @Author CZT |
| | | * @Date 2024/4/23 9:45 |
| | | */ |
| | | package com.fzzy.order.common; |
ÎļþÃû´Ó src/main/java/com/fzzy/push/gd2022/GD2022OrderApiServiceImpl.java ÐÞ¸Ä |
| | |
| | | import com.fzzy.api.data.ApiParam; |
| | | import com.fzzy.api.data.PushProtocol; |
| | | import com.fzzy.api.entity.ApiConfs; |
| | | import com.fzzy.order.OrderApiService; |
| | | import com.fzzy.order.data.OrderConstant; |
| | | import com.fzzy.order.data.OrderData; |
| | | import com.fzzy.order.common.OrderCommonService; |
| | | import com.fzzy.order.common.data.OrderCommonConstant; |
| | | import com.fzzy.order.common.data.OrderCommonData; |
| | | import com.fzzy.push.impl.ComPushService11; |
| | | import com.fzzy.push.impl.ComPushService12; |
| | | import com.fzzy.push.impl.ComPushService13; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class GD2022OrderApiServiceImpl implements OrderApiService { |
| | | public class GD2022OrderServiceImpl implements OrderCommonService { |
| | | |
| | | @Autowired |
| | | private GD2022ApiRemoteService2022 apiRemoteService; |
| | |
| | | |
| | | |
| | | @Override |
| | | public void execute(OrderData req, String orderType, ApiConfs conf, String orderid) throws ParseException { |
| | | public void execute(OrderCommonData req, String orderType, ApiConfs conf, String orderid) throws ParseException { |
| | | |
| | | // è¥æä»¤ç±»åä¸ä¸º1ï¼åè¿å |
| | | if(!OrderConstant.ORDER_TYPE_1.equals(orderType)){ |
| | | if(!OrderCommonConstant.ORDER_TYPE_1.equals(orderType)){ |
| | | log.error("æä»¤ç±»åä¸ä¸º1ï¼ä¸è¿è¡æ°æ®ä¸æ¥={}", req); |
| | | return; |
| | | } |
| | |
| | | import com.fzzy.api.service.ApiTriggerService; |
| | | import com.fzzy.api.utils.*; |
| | | import com.fzzy.api.view.repository.*; |
| | | import com.fzzy.order.data.OrderData; |
| | | import com.fzzy.order.common.data.OrderCommonData; |
| | | import com.fzzy.push.nx2023.dto.*; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | //æä»¤id |
| | | String key = RedisConst.buildKey(RedisConst.KYE_ORDER, conf.getKqdm()); |
| | | String orderId = reqData.getId(); |
| | | OrderData orderData = (OrderData) redisUtil.get(key); |
| | | if (null != orderData && StringUtils.isNotEmpty(orderData.getOrderid())) { |
| | | orderId = orderData.getOrderid(); |
| | | OrderCommonData orderCommonData = (OrderCommonData) redisUtil.get(key); |
| | | if (null != orderCommonData && StringUtils.isNotEmpty(orderCommonData.getOrderid())) { |
| | | orderId = orderCommonData.getOrderid(); |
| | | } |
| | | reqData.setOrderid(orderId); |
| | | |
ÎļþÃû´Ó src/main/java/com/fzzy/push/nx2023/NX2023OrderApiServiceImpl.java ÐÞ¸Ä |
| | |
| | | import com.fzzy.api.entity.ApiConfs; |
| | | import com.fzzy.api.utils.RedisConst; |
| | | import com.fzzy.api.utils.RedisUtil; |
| | | import com.fzzy.order.OrderApiService; |
| | | import com.fzzy.order.data.OrderConstant; |
| | | import com.fzzy.order.data.OrderData; |
| | | import com.fzzy.order.common.OrderCommonService; |
| | | import com.fzzy.order.common.data.OrderCommonConstant; |
| | | import com.fzzy.order.common.data.OrderCommonData; |
| | | import com.fzzy.push.impl.ComPushService11; |
| | | import com.fzzy.push.impl.ComPushService12; |
| | | import com.fzzy.push.impl.ComPushService13; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class NX2023OrderApiServiceImpl implements OrderApiService { |
| | | public class NX2023OrderServiceImpl implements OrderCommonService { |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | |
| | | |
| | | |
| | | @Override |
| | | public void execute(OrderData req, String orderType, ApiConfs conf, String orderid) throws ParseException { |
| | | public void execute(OrderCommonData req, String orderType, ApiConfs conf, String orderid) throws ParseException { |
| | | |
| | | // è¥æä»¤ç±»åä¸ä¸º1ï¼åè¿å |
| | | if(!OrderConstant.ORDER_TYPE_1.equals(orderType)){ |
| | | if(!OrderCommonConstant.ORDER_TYPE_1.equals(orderType)){ |
| | | log.error("æä»¤ç±»åä¸ä¸º1ï¼ä¸è¿è¡æ°æ®ä¸æ¥={}", req); |
| | | return; |
| | | } |
| | |
| | | import com.fzzy.api.service.ApiTriggerService; |
| | | import com.fzzy.api.utils.*; |
| | | import com.fzzy.api.view.repository.*; |
| | | import com.fzzy.order.data.OrderData; |
| | | import com.fzzy.order.common.data.OrderCommonData; |
| | | import com.fzzy.push.sh2023.dto.*; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | //è·åæä»¤id |
| | | String key = RedisConst.buildKey(RedisConst.KYE_ORDER, conf.getKqdm()); |
| | | OrderData orderData = (OrderData) redisUtil.get(key); |
| | | if (null == orderData || StringUtils.isEmpty(orderData.getOrderid())) { |
| | | OrderCommonData orderCommonData = (OrderCommonData) redisUtil.get(key); |
| | | if (null == orderCommonData || StringUtils.isEmpty(orderCommonData.getOrderid())) { |
| | | log.error("æä»¤id失æ=" + jsonData); |
| | | ResponseDto responseDto = new ResponseDto(99, "æä»¤id失æ"); |
| | | apiLog.setStatus(99); |
| | |
| | | //è·å身份IDï¼å³è¡æ¿åºåç |
| | | reqData.setUid(conf.getUserName()); |
| | | //æä»¤id |
| | | reqData.setOrderid(orderData.getOrderid()); |
| | | reqData.setOrderid(orderCommonData.getOrderid()); |
| | | |
| | | //身份ç¾åï¼ä½¿ç¨èªæRSAç§é¥è¿è¡å å¯(å°åºè¡æ¿åºå代ç _å½å¤©æ¥æ) |
| | | reqData.setAccess_token(ShRSAUtils.sign(reqData.getUid() + "_" + DateFormatUtils.format(new Date(), "yyyy-MM-dd"), conf.getPassword())); |
ÎļþÃû´Ó src/main/java/com/fzzy/push/sh2023/SH2023OrderApiServiceImpl.java ÐÞ¸Ä |
| | |
| | | import com.fzzy.api.entity.ApiConfs; |
| | | import com.fzzy.api.utils.RedisConst; |
| | | import com.fzzy.api.utils.RedisUtil; |
| | | import com.fzzy.order.OrderApiService; |
| | | import com.fzzy.order.data.OrderConstant; |
| | | import com.fzzy.order.data.OrderData; |
| | | import com.fzzy.order.common.OrderCommonService; |
| | | import com.fzzy.order.common.data.OrderCommonConstant; |
| | | import com.fzzy.order.common.data.OrderCommonData; |
| | | import com.fzzy.push.impl.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class SH2023OrderApiServiceImpl implements OrderApiService { |
| | | public class SH2023OrderServiceImpl implements OrderCommonService { |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | |
| | | |
| | | |
| | | @Override |
| | | public void execute(OrderData req, String orderType, ApiConfs conf, String orderid) throws ParseException { |
| | | public void execute(OrderCommonData req, String orderType, ApiConfs conf, String orderid) throws ParseException { |
| | | |
| | | // è¥æä»¤ç±»åä¸ä¸º1ï¼åè¿å |
| | | if(!OrderConstant.ORDER_TYPE_1.equals(orderType)){ |
| | | if(!OrderCommonConstant.ORDER_TYPE_1.equals(orderType)){ |
| | | log.error("æä»¤ç±»åä¸ä¸º1ï¼ä¸è¿è¡æ°æ®ä¸æ¥={}", req); |
| | | return; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | /** |
| | | * @Description é西ç平尿¥å£æå¡ |
| | | * @Author CZT |
| | | * @Date 2024/4/22 19:45 |
| | | */ |
| | | package com.fzzy.push.sx2023; |
| | |
| | | |
| | | import com.fzzy.api.data.PushProtocol; |
| | | import com.fzzy.api.entity.ApiConfs; |
| | | import com.fzzy.order.OrderApiService; |
| | | import com.fzzy.order.data.OrderData; |
| | | import com.fzzy.order.common.OrderCommonService; |
| | | import com.fzzy.order.common.data.OrderCommonData; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | * @date 2023/08/17 |
| | | */ |
| | | @Service |
| | | public class WhjlOrderApiServiceImpl implements OrderApiService { |
| | | public class WhjlOrderApiServiceImpl implements OrderCommonService { |
| | | |
| | | @Override |
| | | public String getProtocol() { |
| | |
| | | |
| | | |
| | | @Override |
| | | public void execute(OrderData req, String orderType, ApiConfs apiConfs, String orderid) { |
| | | public void execute(OrderCommonData req, String orderType, ApiConfs apiConfs, String orderid) { |
| | | |
| | | //TODO å¾
å®ç° |
| | | |