Browse Source

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

liubing 3 years ago
parent
commit
d3905123b6

+ 24 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/IpUtil.java

@ -55,6 +55,30 @@ public class IpUtil {
    }
    }
    /**
     * 获取真实ip地址
     *
     * @param request
     * @return java.lang.String
     */
    public static String getOneIpAddress(HttpServletRequest request) {
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }
        if (ip.contains(",")) {
            return ip.split(",")[0];
        } else {
            return ip;
        }
    }
    /**
    /**
     * 获取客户端请求中的真实的ip地址
     * 获取客户端请求中的真实的ip地址
     *  获取客户端的IP地址的方法是:request.getRemoteAddr(),这种方法在大部分情况下都是有效的。
     *  获取客户端的IP地址的方法是:request.getRemoteAddr(),这种方法在大部分情况下都是有效的。

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

@ -168,8 +168,11 @@ public class PayEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "id", value = "订单id")
            @ApiParam(name = "id", value = "订单id")
            @RequestParam(value = "id", required = true) Integer id) {
            @RequestParam(value = "id", required = true) Integer id) {
        try{
        try{
            payService.applyRefund(id, description, enclosure);
            return success("发起退款成功");
            String res = payService.applyRefund(id, description, enclosure);
            if(StringUtil.isBlank(res)){
                return success("申请退款成功");
            }
            return Envelop.getError(res,-1);
        }catch (Exception e){
        }catch (Exception e){
            return failedObjEnvelopException2(e);
            return failedObjEnvelopException2(e);
        }
        }
@ -178,7 +181,7 @@ public class PayEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = "wxNativePay")
    @PostMapping(value = "wxNativePay")
    @ApiOperation(value = "微信native支付")
    @ApiOperation(value = "微信native支付")
    public ObjEnvelop wxNativePay(
    public ObjEnvelop wxNativePay(
            @ApiParam(name = "relationId", value = "业务id,如生活照料id 上面辅导id")
            @ApiParam(name = "relationId", value = "业务id,如生活照料id 上门辅导id")
            @RequestParam(value = "relationId", required = false) String relationId,
            @RequestParam(value = "relationId", required = false) String relationId,
            @ApiParam(name = "orderId", value = "订单id")
            @ApiParam(name = "orderId", value = "订单id")
            @RequestParam(value = "orderId", required = false) Integer orderId,HttpServletRequest request) {
            @RequestParam(value = "orderId", required = false) Integer orderId,HttpServletRequest request) {

+ 3 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java

@ -194,7 +194,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        result.put("orderId",orderDO.getId());
        result.put("orderId",orderDO.getId());
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, orderDO);
        result.put(ResponseContant.resultMsg, orderDO);
        orderDO.setTotalFee(new BigDecimal(0));
        //新增工单与服务项费用关联关系
        //新增工单与服务项费用关联关系
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO,null)) {return result;}
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO,null)) {return result;}
@ -294,6 +294,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        orderDO.setDispatcherResponseTime(new Date());
        orderDO.setDispatcherResponseTime(new Date());
        this.save(orderDO);
        this.save(orderDO);
        result.put("orderId",orderDO.getId());
        result.put("orderId",orderDO.getId());
        orderDO.setTotalFee(new BigDecimal(0));
        //新增工单与服务项费用关联关系
        //新增工单与服务项费用关联关系
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO,doctorCode)) {return result;}
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO,doctorCode)) {return result;}
@ -1125,6 +1126,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        if(null == totalFee){
        if(null == totalFee){
            totalFee = new BigDecimal(0);
            totalFee = new BigDecimal(0);
        }
        }
        //新增服务项
        //新增服务项
        int addNum = 0;
        int addNum = 0;
        //服务项费用
        //服务项费用

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java

@ -466,7 +466,7 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
    @Transactional(rollbackFor = Exception.class)
    @Transactional(rollbackFor = Exception.class)
    public JSONObject create(String jsonData,String proxyPatient) {
    public JSONObject create(String jsonData,String proxyPatient) {
        logger.info("申请生活照料jsonData参数:" + jsonData);
        logger.info("申请生活照料jsonData参数:" + jsonData);
        proxyPatient = "808080eb78d3ce030178edeb4346002b";
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        JSONObject jsonObjectParam;
        JSONObject jsonObjectParam;
        LifeCareOrderDO orderDO = null;
        LifeCareOrderDO orderDO = null;
@ -527,7 +527,7 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        orderDO.setStatus(0);//待付款状态
        orderDO.setStatus(0);//待付款状态
        this.save(orderDO);
        this.save(orderDO);
        result.put("orderId",orderDO.getId());
        result.put("orderId",orderDO.getId());
        orderDO.setTotalFee(new BigDecimal(0));
        //新增工单与服务项费用关联关系
        //新增工单与服务项费用关联关系
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO,null)) {return result;}
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO,null)) {return result;}

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

@ -200,7 +200,7 @@ public class PayService {
        resJson.put("payTime", DateUtil.dateToStrLong(businessOrderDO.getPayTime()));
        resJson.put("payTime", DateUtil.dateToStrLong(businessOrderDO.getPayTime()));
        resJson.put("createTime",DateUtil.dateToStrLong(businessOrderDO.getCreateTime()));
        resJson.put("createTime",DateUtil.dateToStrLong(businessOrderDO.getCreateTime()));
        resJson.put("updateTime",DateUtil.dateToStrLong(businessOrderDO.getUpdateTime()));
        resJson.put("updateTime",DateUtil.dateToStrLong(businessOrderDO.getUpdateTime()));
        long time = (businessOrderDO.getCreateTime().getTime() - System.currentTimeMillis())/1000;
        long time = (businessOrderDO.getCreateTime().getTime() - System.currentTimeMillis())/1000+60*30;
        if(time<0&&status==0){
        if(time<0&&status==0){
            cancleOrder(id);
            cancleOrder(id);
            status = 2;
            status = 2;
@ -516,8 +516,8 @@ public class PayService {
        if (businessOrderDO.getStatus()!=0) {
        if (businessOrderDO.getStatus()!=0) {
            return ObjEnvelop.getError("待支付订单才能支付",-1);
            return ObjEnvelop.getError("待支付订单才能支付",-1);
        }
        }
        long time = (businessOrderDO.getCreateTime().getTime() - System.currentTimeMillis())/1000;
        if(time<=0){
        long time = (System.currentTimeMillis() - businessOrderDO.getCreateTime().getTime())/1000;
        if(time>=60*30){
            cancleOrder(businessOrderDO.getId());
            cancleOrder(businessOrderDO.getId());
            return ObjEnvelop.getError("支付超时,订单已关闭",-1);
            return ObjEnvelop.getError("支付超时,订单已关闭",-1);
        }
        }
@ -535,10 +535,13 @@ public class PayService {
        // 此路径是微信服务器调用支付结果通知路径
        // 此路径是微信服务器调用支付结果通知路径
        reqMap.put("notify_url", serverUrl+"pay/open/wxPayNotify");
        reqMap.put("notify_url", serverUrl+"pay/open/wxPayNotify");
        reqMap.put("out_trade_no", businessOrderDO.getOrderNo());
        reqMap.put("out_trade_no", businessOrderDO.getOrderNo());
        reqMap.put("spbill_create_ip", IpUtil.getIpAddr(request));
        reqMap.put("spbill_create_ip", IpUtil.getOneIpAddress(request));
        reqMap.put("product_id", businessOrderDO.getOrderNo());
        reqMap.put("product_id", businessOrderDO.getOrderNo());
        // 订单总金额,单位为分
        // 订单总金额,单位为分
        Double payAmountIntValue = businessOrderDO.getPayPrice() * 100;
        Double payAmountIntValue = businessOrderDO.getPayPrice() * 100;
        if(payAmountIntValue.intValue()<=0){
            return ObjEnvelop.getError("支付金额必须大于0",-1);
        }
        reqMap.put("total_fee", String.valueOf(payAmountIntValue.intValue()));
        reqMap.put("total_fee", String.valueOf(payAmountIntValue.intValue()));
        reqMap.put("trade_type", "NATIVE");
        reqMap.put("trade_type", "NATIVE");
        // 创建第一次签名
        // 创建第一次签名
@ -591,8 +594,8 @@ public class PayService {
        if (businessOrderDO.getStatus()!=0) {
        if (businessOrderDO.getStatus()!=0) {
            return ObjEnvelop.getError("待支付订单才能支付",-1);
            return ObjEnvelop.getError("待支付订单才能支付",-1);
        }
        }
        long time = (businessOrderDO.getCreateTime().getTime() - System.currentTimeMillis())/1000;
        if(time<=0){
        long time = (System.currentTimeMillis() - businessOrderDO.getCreateTime().getTime())/1000;
        if(time>=60*30){
            cancleOrder(businessOrderDO.getId());
            cancleOrder(businessOrderDO.getId());
            return ObjEnvelop.getError("支付超时,订单已关闭",-1);
            return ObjEnvelop.getError("支付超时,订单已关闭",-1);
        }
        }
@ -612,10 +615,13 @@ public class PayService {
        // 此路径是微信服务器调用支付结果通知路径
        // 此路径是微信服务器调用支付结果通知路径
        reqMap.put("notify_url", serverUrl+"pay/open/wxPayNotify");
        reqMap.put("notify_url", serverUrl+"pay/open/wxPayNotify");
        reqMap.put("out_trade_no", businessOrderDO.getOrderNo());
        reqMap.put("out_trade_no", businessOrderDO.getOrderNo());
        reqMap.put("spbill_create_ip", IpUtil.getIpAddr(request));
        reqMap.put("spbill_create_ip", IpUtil.getOneIpAddress(request));
        reqMap.put("product_id", businessOrderDO.getOrderNo());
        reqMap.put("product_id", businessOrderDO.getOrderNo());
        // 订单总金额,单位为分
        // 订单总金额,单位为分
        Double payAmountIntValue = businessOrderDO.getPayPrice() * 100;
        Double payAmountIntValue = businessOrderDO.getPayPrice() * 100;
        if(payAmountIntValue.intValue()<=0){
            return ObjEnvelop.getError("支付金额必须大于0",-1);
        }
        reqMap.put("total_fee", String.valueOf(payAmountIntValue.intValue()));
        reqMap.put("total_fee", String.valueOf(payAmountIntValue.intValue()));
        reqMap.put("trade_type", "JSAPI");
        reqMap.put("trade_type", "JSAPI");
        reqMap.put("openid", patientDO.getOpenid());
        reqMap.put("openid", patientDO.getOpenid());