Procházet zdrojové kódy

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into rehabilitation_dev

wangjun před 3 roky
rodič
revize
b183d68684

+ 5 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java

@ -208,7 +208,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    public JSONObject queryOneById(String id) throws JsonProcessingException {
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(id)){
            result.put("msg","org not exist for id:"+id);
            result.put("msg","该机构不存在 id:"+id);
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
@ -236,7 +236,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
            String mobile = orgAdminJson.getString("mobile");
            String adminName = orgAdminJson.getString("orgAdmin");
            if(StringUtils.isEmpty(mobile)){
                return "paramter for admin is null";
                return "联系电话不能为空!";
            }
            baseOrgDO.setOrgAdmin(adminName);
            baseOrgDO.setAdminMobile(mobile);
@ -268,7 +268,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
        }else{
            BaseOrgDO oldBaseOrgDO = baseOrgDao.findOne(baseOrgDO.getId());
            if(null == oldBaseOrgDO){
                return "no exist this org";
                return "机构不存在";
            }
            if(!baseOrgDO.getCode().equalsIgnoreCase(oldBaseOrgDO.getCode()) || !baseOrgDO.getName().equalsIgnoreCase(oldBaseOrgDO.getName())){
                orgTreeService.updateOrgTreeNode(oldBaseOrgDO,baseOrgDO,OrgTree.Level.org.getLevelValue());
@ -309,13 +309,13 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    public String enableOrDisableOrg(String id,String del){
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(id) || StringUtils.isEmpty(del)){
            result.put("msg","parameter id or del is null");
            result.put("msg","参数id or del 为空");
            result.put("response",ConstantUtils.FAIL);
            return result.toJSONString();
        }
        BaseOrgDO baseOrgDO = baseOrgDao.findOne(id);
        if( null == baseOrgDO ){
            result.put("msg","org not exist for id:" + id);
            result.put("msg","该机构不存在 id:" + id);
            result.put("response",ConstantUtils.FAIL);
            return result.toJSONString();
        }

+ 23 - 9
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PayEndpoint.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.exception.BusinessException;
import com.yihu.jw.care.service.doorCoach.PatientDoorCoachOrderService;
import com.yihu.jw.care.service.pay.PayService;
import com.yihu.jw.care.util.WxpayUtil;
import com.yihu.jw.care.util.XMLUtil;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
@ -22,6 +23,7 @@ import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@ -43,6 +45,8 @@ public class PayEndpoint extends EnvelopRestEndpoint {
    private Logger log = LoggerFactory.getLogger(PatientDoorCoachOrderService.class);
    @Value("${wechat.apiKey}")
    public String apiKey;
    @Autowired
    private PayService payService;
    @Autowired
@ -228,9 +232,9 @@ public class PayEndpoint extends EnvelopRestEndpoint {
//            orderDO.setResponseParam(paramsJson);
            // 判断total_amount是否确实为该订单的实际金额(即商户订单创建时的金额),
            String totalFee = params.get("total_fee");
            BigDecimal payTotalFee = new BigDecimal(totalFee).setScale(2).divide(new BigDecimal(100), BigDecimal.ROUND_HALF_EVEN);
            BigDecimal payTotalFee = new BigDecimal(totalFee);
            log.info("【微信支付】支付金额:{}", payTotalFee);
            if (new BigDecimal(orderDO.getPayPrice()).compareTo(payTotalFee) != 0) {
            if (new BigDecimal(orderDO.getPayPrice()*100).compareTo(payTotalFee) != 0) {
                //通知资金与实际资金不对称,可能是攻击行为!
                orderDO.setRematk("通知资金与实际资金不对称,可能是攻击行为!");
                businessOrderDao.save(orderDO);
@ -251,6 +255,7 @@ public class PayEndpoint extends EnvelopRestEndpoint {
        }
    }
    /**
     * 微信支付退款回调
     *
@ -270,25 +275,34 @@ public class PayEndpoint extends EnvelopRestEndpoint {
            // 支付校验
            String returnCode = params.get("return_code");
            if (!"SUCCESS".equalsIgnoreCase(returnCode)) {
                log.info("【微信支付退款】订单失败");
                log.info("【微信支付退款1】订单失败");
                return XMLUtil.setXML("FAIL", "退款失败");
            }
            String req_info = params.get("req_info");
            //解密
            String desReqInfo = WxpayUtil.getRefundDecrypt(req_info,apiKey);
            Map<String, String> desParams = XMLUtil.doXMLParse(desReqInfo);
            if(!"SUCCESS".equals(desParams.get("refund_status"))){
                log.info("【微信支付退款2】订单失败");
                return XMLUtil.setXML("FAIL", "退款失败");
            }
            // 商户需要验证该通知数据中的out_trade_no是否为商户系统中创建的订单号
            String outTradeNo = params.get("out_trade_no");
            String outTradeNo = desParams.get("out_trade_no");
            String payWaterId = outTradeNo.split("_")[0];
            payService.addHttpLog("2",payWaterId,paramsJson,null);
            payService.addHttpLog("2",payWaterId,desReqInfo,null);
            BusinessOrderRefundDO orderDO = orderRefundDao.selectByOrderNo(payWaterId);
            if (orderDO == null) {
                log.error("退款订单不存在");
                return XMLUtil.setXML("SUCCESS", "OK");
            }
            orderDO.setOutRefundNo(params.get("refund_id"));
            orderDO.setOutRefundNo(desParams.get("refund_id"));
//            orderDO.setResponseParam(paramsJson);
            // 判断total_amount是否确实为该订单的实际金额(即商户订单创建时的金额),
            String totalFee = params.get("refund_fee");
            BigDecimal payTotalFee = new BigDecimal(totalFee).setScale(2).divide(new BigDecimal(100), BigDecimal.ROUND_HALF_EVEN);
            String totalFee = desParams.get("refund_fee");
            BigDecimal payTotalFee = new BigDecimal(totalFee);
            log.info("【微信支付退款】支付金额:{}", payTotalFee);
            if (new BigDecimal(orderDO.getRefundPrice()).compareTo(payTotalFee) != 0) {
            if (new BigDecimal(orderDO.getRefundPrice()*100).compareTo(payTotalFee) != 0) {
                //通知资金与实际资金不对称,可能是攻击行为!
                log.info("通知资金与实际资金不对称,可能是攻击行为!");
                return XMLUtil.setXML("SUCCESS", "OK");

+ 17 - 10
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/pay/PayService.java

@ -44,9 +44,10 @@ import org.springframework.util.Assert;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
import static jxl.biff.FormatRecord.logger;
/**
 * Created with IntelliJ IDEA.
@ -397,12 +398,12 @@ public class PayService {
        orderRefundDO.setPatientName(patientDO.getName());
        orderRefundDO.setRefundDesc(description);
        orderRefundDO = orderRefundDao.save(orderRefundDO);
        Integer orderPrice = orderRefundDO.getOrderPrice().intValue();
        Integer refundPrice1 = orderRefundDO.getRefundPrice().intValue();
        Integer orderPrice = new BigDecimal(orderRefundDO.getOrderPrice()*100).intValue();
        Integer refundPrice1 = new BigDecimal(orderRefundDO.getRefundPrice()*100).intValue();
        Map<String,Object> map = businessOrderService.refund(wechatId,orderRefundDO.getOrderNo(),orderRefundDO.getOutRefundNo(),orderPrice.toString(),refundPrice1.toString(),orderRefundDO.getRefundDesc());
        logger.info("map"+map);
        log.info("map"+map);
        addHttpLog("1",businessOrderDO.getOrderNo(),null,map.toString());
        if (map.get("return_code").toString().equalsIgnoreCase("SUCCESS")){
        if (!map.get("return_code").toString().equalsIgnoreCase("SUCCESS")){
            //退款申请提交成功
            throw new Exception(map.get("return_msg").toString());
        }
@ -469,13 +470,15 @@ public class PayService {
     */
    @Transactional(rollbackFor = Exception.class)
    public void refundNotify(BusinessOrderRefundDO orderDO) {
        log.error("【支付通知】请求,payWater:{}", orderDO);
        log.error("【退款通知】请求,getOrderNo:{}", orderDO.getOrderNo());
        String type = "";
        //防止重复支付
        if (orderDO.getStatus()!=1) {
            log.error("【退款通知】请求,getStatus:{}", orderDO.getStatus());
            return;
        }
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderDO.getOrderNo());
        type = businessOrderDO.getOrderCategory();
        switch (type){
            case "1":
                //desc = "招生报名";
@ -494,8 +497,12 @@ public class PayService {
            default:
                break;
        }
        orderDO.setStatus(2);
        orderDO.setRefundTime(new Date());
        businessOrderDO.setStatus(4);
        orderRefundDao.save(orderDO);
        businessOrderDao.save(businessOrderDO);
        log.info("【退款通知】成功,type:{}", type);
    }
@ -534,7 +541,7 @@ public class PayService {
        reqMap.put("mch_id", mchId);
        reqMap.put("nonce_str", noceStr);
        // 此路径是微信服务器调用支付结果通知路径
        reqMap.put("notify_url", serverUrl+"pay/open/wxPayNotify");
        reqMap.put("notify_url", "https://zhyzh.hzxc.gov.cn/cloudCare/pay/open/wxPayNotify");
        reqMap.put("out_trade_no", businessOrderDO.getOrderNo());
        reqMap.put("spbill_create_ip", IpUtil.getOneIpAddress(request));
        reqMap.put("product_id", businessOrderDO.getOrderNo());
@ -614,7 +621,7 @@ public class PayService {
        reqMap.put("mch_id", mchId);
        reqMap.put("nonce_str", noceStr);
        // 此路径是微信服务器调用支付结果通知路径
        reqMap.put("notify_url", serverUrl+"pay/open/wxPayNotify");
        reqMap.put("notify_url", "https://zhyzh.hzxc.gov.cn/cloudCare/pay/open/wxPayNotify");
        reqMap.put("out_trade_no", businessOrderDO.getOrderNo());
        reqMap.put("spbill_create_ip", IpUtil.getOneIpAddress(request));
        reqMap.put("product_id", businessOrderDO.getOrderNo());

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 102 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/WxpayUtil.java


+ 1 - 1
svr/svr-cloud-job/src/main/resources/application.yml

@ -170,7 +170,7 @@ spring:
    user: admin
    password: admin
  redis:
    host: 172.26.0.13 # Redis server host.
    host: 10.18.43.40 # Redis server host.
    port: 6379  # Redis server port.
    password: Kb6wKDQP1W4
fastDFS: