You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.8 KiB
51 lines
1.8 KiB
2 years ago
|
package com.ynxbd.common.service;
|
||
|
|
||
|
import com.ynxbd.common.bean.pay.Recipe;
|
||
|
import com.ynxbd.common.dao.peis.PeisDao;
|
||
|
import com.ynxbd.common.result.Result;
|
||
|
import lombok.extern.slf4j.Slf4j;
|
||
|
|
||
|
import java.math.BigDecimal;
|
||
|
|
||
|
/**
|
||
|
* @author 李进才
|
||
|
* @ClassName PeisService
|
||
|
* @Description TODO
|
||
|
* @date 2023/11/16 15:53:00
|
||
|
*/
|
||
|
|
||
|
@Slf4j
|
||
|
public class PeisService {
|
||
|
|
||
|
public Boolean Reserve(String openid, String patientId, String treatNum, String outTradeNo, String totalFee,String recipeId){
|
||
|
Recipe recipe = new Recipe();
|
||
|
recipe.setOpenid(openid);
|
||
|
recipe.setPatientId(patientId);
|
||
|
recipe.setTreatNum(treatNum);
|
||
|
recipe.setOutTradeNo(outTradeNo);
|
||
|
recipe.setRecipeId(recipeId);
|
||
|
recipe.setTotalFee(new BigDecimal(totalFee));
|
||
|
recipe.setPayMoney(new BigDecimal(totalFee));
|
||
|
recipe.setPeisStatus(-1);
|
||
|
recipe.setPayStatus(-1);
|
||
|
if(new PeisDao().isRepeat(recipe.getRecipeId())){
|
||
|
log.info("[体检预约]该处方号已经缴费,recipeId-{}",recipe.getRecipeId());
|
||
|
return false;
|
||
|
}
|
||
|
return new PeisDao().insert(recipe);
|
||
|
}
|
||
|
public void payNotify(String outTradeNo, String bankTransNo){
|
||
|
PeisDao peisDao = new PeisDao();
|
||
|
Recipe recipe = peisDao.selectByOutTradeNo(outTradeNo);
|
||
|
String recipeId = recipe.getRecipeId();
|
||
|
Integer payStates = recipe.getPayStatus();
|
||
|
if (payStates == 0) {
|
||
|
log.error("[体检预约]订单已支付 outTradeNo={}, bankTransNo={}, recipeId={}", outTradeNo, bankTransNo, recipeId);
|
||
|
return;
|
||
|
}
|
||
|
if (!peisDao.updatePayStateOk(outTradeNo, bankTransNo)) {
|
||
|
log.info("[体检预约]修改支付状态失败 outTradeNo={}, bankTransNo={}", outTradeNo, bankTransNo);
|
||
|
}
|
||
|
}
|
||
|
}
|