Commit 273d3891e1ec58bd8bb6f6830d0edb151ef68eec
1 parent
2c6eded7f5
Exists in
master
支付相关接口
Showing 5 changed files with 45 additions and 33 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/aop/ResubmitDataAspect.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/OrderController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/lock/ResubmitLock.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsOrderServiceImpl.java
talkonlineweb/src/main/java/com/lyms/talkonlineweb/aop/ResubmitDataAspect.java
View file @
273d389
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | import com.lyms.talkonlineweb.result.BaseResponse; |
| 9 | 9 | import com.lyms.talkonlineweb.util.JsonUtil; |
| 10 | 10 | import com.lyms.talkonlineweb.util.StringUtil; |
| 11 | -import lombok.extern.slf4j.Slf4j; | |
| 11 | +import lombok.extern.log4j.Log4j2; | |
| 12 | 12 | import org.aspectj.lang.ProceedingJoinPoint; |
| 13 | 13 | import org.aspectj.lang.annotation.Around; |
| 14 | 14 | import org.aspectj.lang.annotation.Aspect; |
| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | * @author lqy |
| 23 | 23 | * 重复提交处理 |
| 24 | 24 | */ |
| 25 | -@Slf4j | |
| 25 | +@Log4j2 | |
| 26 | 26 | @Aspect |
| 27 | 27 | @Component |
| 28 | 28 | public class ResubmitDataAspect { |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/OrderController.java
View file @
273d389
| ... | ... | @@ -41,18 +41,22 @@ |
| 41 | 41 | @Log4j2 |
| 42 | 42 | public class OrderController { |
| 43 | 43 | |
| 44 | + /** | |
| 45 | + * 问诊卡信息 | |
| 46 | + */ | |
| 44 | 47 | @Autowired |
| 45 | - private LymsGoodsService lymsGoodsService;//问诊卡信息 | |
| 48 | + private LymsGoodsService lymsGoodsService; | |
| 46 | 49 | |
| 50 | + /** | |
| 51 | + * 患者 | |
| 52 | + */ | |
| 47 | 53 | @Autowired |
| 48 | - private LymsPatientService lymsPatientService;//患者 | |
| 54 | + private LymsPatientService lymsPatientService; | |
| 49 | 55 | |
| 56 | + /** | |
| 57 | + * 订单 | |
| 58 | + */ | |
| 50 | 59 | @Autowired |
| 51 | - private LymsTcardService lymsTcardService;//问诊卡信息 | |
| 52 | - | |
| 53 | - @Autowired | |
| 54 | - private LymsLogsService lymsLogsService;//日志记录 | |
| 55 | - @Autowired | |
| 56 | 60 | private LymsOrderService lymsOrderService; |
| 57 | 61 | |
| 58 | 62 | /** |
| ... | ... | @@ -134,8 +138,7 @@ |
| 134 | 138 | baseResponse.setObject(data); |
| 135 | 139 | return baseResponse; |
| 136 | 140 | } |
| 137 | - }catch (Exception e) | |
| 138 | - { | |
| 141 | + }catch (Exception e){ | |
| 139 | 142 | log.error("create order error.",e); |
| 140 | 143 | } |
| 141 | 144 | baseResponse.setErrorcode(1); |
| ... | ... | @@ -146,7 +149,7 @@ |
| 146 | 149 | /** |
| 147 | 150 | * 创建微信订单 |
| 148 | 151 | */ |
| 149 | - private Map<String,String> createWxOrder(LymsOrder lymsOrder) | |
| 152 | + private Map<String,String> createWxOrder(LymsOrder lymsOrder) throws Exception | |
| 150 | 153 | { |
| 151 | 154 | try { |
| 152 | 155 | String xml = buildRequestXml(lymsOrder); |
| 153 | 156 | |
| ... | ... | @@ -159,8 +162,8 @@ |
| 159 | 162 | return parseWxResult(result); |
| 160 | 163 | } catch (Exception e) { |
| 161 | 164 | log.error("createWxOrder error.",e); |
| 165 | + throw e; | |
| 162 | 166 | } |
| 163 | - return null; | |
| 164 | 167 | } |
| 165 | 168 | |
| 166 | 169 | |
| ... | ... | @@ -220,7 +223,7 @@ |
| 220 | 223 | //交易类型 |
| 221 | 224 | paramMap.put("trade_type", "JSAPI"); |
| 222 | 225 | //用户标识 |
| 223 | - paramMap.put("openid", "o4hf60FZzQ4PE-SXYk-jNaouGG-0"); | |
| 226 | + paramMap.put("openid", lymsOrder.getOpenid()); | |
| 224 | 227 | //商品描述 |
| 225 | 228 | paramMap.put("body", "问诊支付"); |
| 226 | 229 | |
| 227 | 230 | |
| ... | ... | @@ -253,13 +256,15 @@ |
| 253 | 256 | String payOrderId = paramMap.get("transaction_id"); |
| 254 | 257 | //商户订单号 |
| 255 | 258 | String mchOrderNo = paramMap.get("out_trade_no"); |
| 256 | - lymsOrderService.handleOrder(payOrderId,mchOrderNo); | |
| 257 | - result.put("return_code","<![CDATA[SUCCESS]]>"); | |
| 258 | - result.put("return_msg","<![CDATA[OK]]>"); | |
| 259 | + boolean flag = lymsOrderService.handleOrder(payOrderId,mchOrderNo); | |
| 260 | + if (flag) | |
| 261 | + { | |
| 262 | + result.put("return_code","<![CDATA[SUCCESS]]>"); | |
| 263 | + result.put("return_msg","<![CDATA[OK]]>"); | |
| 264 | + } | |
| 259 | 265 | } |
| 260 | 266 | outResult(response, XmlUtil.mapToXml(result)); |
| 261 | - }catch (Exception e) | |
| 262 | - { | |
| 267 | + }catch (Exception e){ | |
| 263 | 268 | log.error("pay notify error.",e); |
| 264 | 269 | try |
| 265 | 270 | { |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java
View file @
273d389
| ... | ... | @@ -441,13 +441,15 @@ |
| 441 | 441 | if (CollectionUtils.isNotEmpty(lymsTkrecords)) { |
| 442 | 442 | for (LymsTkrecord record : lymsTkrecords) { |
| 443 | 443 | LymsPcase pcase = lymsPcaseService.getById(record.getPcid()); |
| 444 | + LymsHospital hospital = lymsHospitalService.getById(pcase.getHid()); | |
| 445 | + LymsDoctor doctor = lymsDoctorService.getById(pcase.getDtid()); | |
| 444 | 446 | |
| 445 | 447 | Map data = new HashMap(20); |
| 446 | 448 | data.put("hospitalName", pcase.getHname()); |
| 447 | - data.put("hospitalLevel", ""); | |
| 449 | + data.put("hospitalLevel", hospital.getHlevel()); | |
| 448 | 450 | data.put("doctorName", pcase.getDtname()); |
| 449 | 451 | data.put("departName", pcase.getDname()); |
| 450 | - data.put("doctorLevel", ""); | |
| 452 | + data.put("doctorLevel", doctor.getLvl()); | |
| 451 | 453 | data.put("patientName", patients.getPname()); |
| 452 | 454 | |
| 453 | 455 | StringBuilder sb = new StringBuilder(); |
| ... | ... | @@ -464,8 +466,6 @@ |
| 464 | 466 | data.put("iname", sb.toString()); |
| 465 | 467 | data.put("createTime", DateUtil.getDateTime(record.getCreatedtime(), DateUtil.YYYY_MM_DD)); |
| 466 | 468 | data.put("stat", record.getStat()); |
| 467 | - | |
| 468 | - | |
| 469 | 469 | list.add(data); |
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | |
| ... | ... | @@ -493,13 +493,13 @@ |
| 493 | 493 | if (CollectionUtils.isNotEmpty(lymsAttentions)) { |
| 494 | 494 | for (LymsAttention attention : lymsAttentions) { |
| 495 | 495 | LymsDoctor doctor = lymsDoctorService.getById(attention.getDid()); |
| 496 | - | |
| 496 | + LymsHospital hospital = lymsHospitalService.getById(doctor.getHid()); | |
| 497 | 497 | Map data = new HashMap(20); |
| 498 | 498 | data.put("doctorName", doctor.getDname()); |
| 499 | 499 | data.put("departName", doctor.getDdname()); |
| 500 | - data.put("doctorLevel", ""); | |
| 500 | + data.put("doctorLevel", doctor.getLvl()); | |
| 501 | 501 | data.put("hospitalName", doctor.getHname()); |
| 502 | - data.put("hospitalLevel", ""); | |
| 502 | + data.put("hospitalLevel", hospital.getHlevel()); | |
| 503 | 503 | data.put("doctorDesc", doctor.getIntro()); |
| 504 | 504 | list.add(data); |
| 505 | 505 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/lock/ResubmitLock.java
View file @
273d389
| 1 | 1 | package com.lyms.talkonlineweb.lock; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.talkonlineweb.util.MD5Util; |
| 4 | -import lombok.extern.slf4j.Slf4j; | |
| 4 | +import lombok.extern.log4j.Log4j2; | |
| 5 | 5 | |
| 6 | 6 | import java.util.Objects; |
| 7 | 7 | import java.util.concurrent.ConcurrentHashMap; |
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | import java.util.concurrent.ThreadPoolExecutor; |
| 10 | 10 | import java.util.concurrent.TimeUnit; |
| 11 | 11 | |
| 12 | -@Slf4j | |
| 12 | +@Log4j2 | |
| 13 | 13 | public class ResubmitLock { |
| 14 | 14 | private static final ConcurrentHashMap<String, Object> LOCK_CACHE = new ConcurrentHashMap<>(200); |
| 15 | 15 | private static final ScheduledThreadPoolExecutor EXECUTOR = new ScheduledThreadPoolExecutor(5, new ThreadPoolExecutor.DiscardPolicy()); |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsOrderServiceImpl.java
View file @
273d389
| ... | ... | @@ -22,6 +22,7 @@ |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * |
| 25 | + * @author Administrator | |
| 25 | 26 | */ |
| 26 | 27 | @Service |
| 27 | 28 | public class LymsOrderServiceImpl extends ServiceImpl<LymsOrderMapper, LymsOrder> |
| 28 | 29 | |
| 29 | 30 | |
| ... | ... | @@ -43,23 +44,29 @@ |
| 43 | 44 | wrapper.eq(LymsOrder::getPayorderid, payOrderId); |
| 44 | 45 | LymsOrder lymsOrders = getOne(wrapper); |
| 45 | 46 | if (lymsOrders != null) { |
| 46 | - | |
| 47 | 47 | LymsPatient patient = lymsPatientMapper.selectById(lymsOrders.getPid()); |
| 48 | 48 | if (patient == null) |
| 49 | 49 | { |
| 50 | 50 | return false; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - //TODO | |
| 54 | -// LymsTcard tcard = new LymsTcard(); | |
| 55 | -// lymsTcardMapper.insert(); | |
| 56 | - | |
| 53 | + Date createTime = new Date(); | |
| 54 | + for (int i = 0; i < lymsOrders.getCnt(); i++) | |
| 55 | + { | |
| 56 | + LymsTcard tcard = new LymsTcard(); | |
| 57 | + tcard.setPid(lymsOrders.getPid()); | |
| 58 | + tcard.setFid(1); | |
| 59 | + tcard.setPrice(lymsOrders.getPrice()); | |
| 60 | + tcard.setCreatedtime(createTime); | |
| 61 | + lymsTcardMapper.insert(tcard); | |
| 62 | + } | |
| 57 | 63 | //更新患者的卡的数量 |
| 58 | 64 | lymsPatientMapper.updatePatientCcnt(lymsOrders.getCnt(),patient.getId()); |
| 59 | 65 | |
| 60 | 66 | lymsOrders.setStatus(PayStatus.SUCCESS.getCode()); |
| 61 | 67 | lymsOrders.setUpdatedtime(new Date()); |
| 62 | 68 | updateById(lymsOrders); |
| 69 | + return true; | |
| 63 | 70 | } |
| 64 | 71 | |
| 65 | 72 | return false; |