Переглянути джерело

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

 Conflicts:
	svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PayEndpoint.java
	svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/pay/PayService.java
liubing 3 роки тому
батько
коміт
1c6b70da27

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderRefundDO.java

@ -27,7 +27,7 @@ public class BusinessOrderRefundDO extends IntegerIdentityEntity {
    private String appId;//公众号id
    private String mchId;//商户号
    private String refundDesc;//退款原因
    private Integer status;//状态1待退款2已退款
    private Integer status;//状态1待退款2已退款 3同意退款
    private Date refundTime;//退款时间
    private String enclosure;//附件
    private Date createTime;

+ 12 - 0
gateway/ag-basic/src/main/resources/application.yml

@ -240,3 +240,15 @@ spring:
    host: 10.18.43.40 # Redis server host.
    port: 6379  # Redis server port.
    password: Kb6wKDQP1W4
---
spring:
  profiles: wjwProd
  datasource:
     url: jdbc:mysql://127.0.0.1:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
     username: wlyy
     password: 0XxS3W*!cRj
  redis:
     host: 127.0.0.1 # Redis server host.
     port: 6380  # Redis server port.
     password: Kb6wKDQP1W4

+ 9 - 1
gateway/ag-basic/src/main/resources/bootstrap.yml

@ -128,4 +128,12 @@ spring:
  cloud:
    config:
      uri: ${wlyy-spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy-spring.config.label:master}
      label: ${wlyy-spring.config.label:master}
---
spring:
  profiles: wjwProd
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://192.168.120.71:1221}
      label: ${wlyy.spring.config.label:master}

+ 27 - 0
server/svr-authentication/src/main/resources/application.yml

@ -405,3 +405,30 @@ testPattern:
wechat:
  id: hz_yyyzh_wx  # base库中,wx_wechat 的id字段
---
spring:
  profiles: wjwProd
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: wlyy
    password: 0XxS3W*!cRj
  redis:
    host: 127.0.0.1 # Redis server host.
    port: 6380 # Redis server port.
    password: Kb6wKDQP1W4
iHealth:
  user-info-uri: http://www.xmtyw.cn/wlyy/iHealth/userInfo
zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://127.0.0.1:22122
wlyy:
  url: http://www.xmtyw.cn/wlyy/
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: wjw

+ 8 - 0
server/svr-authentication/src/main/resources/bootstrap.yml

@ -127,6 +127,14 @@ spring:
---
spring:
  profiles: hzprod
  cloud:
    config:
      uri: ${wlyy-spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy-spring.config.label:jwdev}
---
spring:
  profiles: wjwProd
  cloud:
    config:
      uri: ${wlyy-spring.config.uri:http://127.0.0.1:1221}

+ 14 - 0
server/svr-configuration/src/main/resources/bootstrap.yml

@ -193,4 +193,18 @@ spring:
          basedir: /usr/local/wlyy2.0-config
          username: jkzl
          password: jkzl
        default-label: ${wlyy.spring.config.git.label:master}
---
spring:
  profiles: wjwProd
##git配置
  cloud:
    config:
      failFast: true #启动快速失败 即链接不到配置服务就启动失败
      server:
        git:
          uri: ${wlyy.spring.config.git.uri:http://127.0.0.1:3000/jkzl/ehr.config.git}
          basedir: /usr/local/wlyy2.0-config
        default-label: ${wlyy.spring.config.git.label:master}

+ 47 - 1
svr/svr-base/src/main/resources/application.yml

@ -641,4 +641,50 @@ testPattern:
  sign: 0
  remote_inner_url: 1
im:
  im_list_get: http://10.18.43.41:3000/
  im_list_get: http://10.18.43.41:3000/
---
spring:
  profiles: wjwProd
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: wlyy
    password: 0XxS3W*!cRj
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 192.0.33.26:9200 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://10.9.1.247:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://10.9.1.247:9103
    user: jkzl
    password: jkzlehr
  redis:
    host: 127.0.0.1 # Redis server host.
    port: 6380 # Redis server port.
    password: Kb6wKDQP1W4
fastDFS:
  fastdfs_file_url: http://127.0.0.1:8888/
demo:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
wlyy:
  url: http://ehr.yihu.com/wlyy/
wechat:
  id: hz_yyyzh_wx
  url: https://zhyzh.hzxc.gov.cn/
  flag: false
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://10.9.1.247:3000/

+ 9 - 1
svr/svr-base/src/main/resources/bootstrap.yml

@ -109,4 +109,12 @@ spring:
  cloud:
    config:
      uri: ${wlyy-spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy-spring.config.label:master}
      label: ${wlyy-spring.config.label:master}
---
spring:
  profiles: wjwProd
  cloud:
    config:
      uri: ${wlyy-spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy-spring.config.label:jwdev}

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

@ -7,7 +7,9 @@ import com.yihu.jw.care.service.doorCoach.PatientDoorCoachOrderService;
import com.yihu.jw.care.service.pay.PayService;
import com.yihu.jw.care.util.XMLUtil;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -45,6 +47,8 @@ public class PayEndpoint extends EnvelopRestEndpoint {
    private PayService payService;
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Autowired
    private BusinessOrderRefundDao orderRefundDao;
    @GetMapping("topStatusBarNum")
    @ApiOperation(value = "顶部状态栏订单分类tab")
@ -89,21 +93,6 @@ public class PayEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "applyRefund")
    @ApiOperation(value = "申请退款")
    public Envelop applyRefund(
            @ApiParam(name = "id", value = "订单id")
            @RequestParam(value = "id", required = true) Integer id) {
        try{
            String res = payService.cancleOrder(id);
            if(StringUtil.isBlank(res)){
                return success("取消成功");
            }
            return Envelop.getError(res,-1);
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @PostMapping(value = "cancleOrder")
    @ApiOperation(value = "取消订单")
@ -163,21 +152,23 @@ public class PayEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "orderId", value = "订单id")
            @RequestParam(value = "orderId", required = false) Integer orderId,HttpServletRequest request) {
        try{
            return  payService.wxWapPay(relationId, orderId, request);
            return payService.wxWapPay(relationId, orderId, request);
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping(value = "wxRefund")
    @ApiOperation(value = "微信发起退款")
    public Envelop wxRefund(
            @ApiParam(name = "desc", value = "退款说明")
            @RequestParam(value = "desc", required = true) String desc,
            @ApiParam(name = "orderNo", value = "订单id")
            @RequestParam(value = "orderNo", required = true) String orderNo) {
    @PostMapping(value = "applyRefund")
    @ApiOperation(value = "申请退款")
    public Envelop applyRefund(
            @ApiParam(name = "description", value = "退款说明")
            @RequestParam(value = "description", required = true) String description,
            @ApiParam(name = "enclosure", value = "退款附件")
            @RequestParam(value = "enclosure", required = false) String enclosure,
            @ApiParam(name = "id", value = "订单id")
            @RequestParam(value = "id", required = true) Integer id) {
        try{
              payService.orderRefund(orderNo, desc);
            payService.applyRefund(id, description, enclosure);
            return success("发起退款成功");
        }catch (Exception e){
            return failedObjEnvelopException2(e);
@ -283,27 +274,26 @@ public class PayEndpoint extends EnvelopRestEndpoint {
            String outTradeNo = params.get("out_trade_no");
            String payWaterId = outTradeNo.split("_")[0];
            payService.addHttpLog("2",payWaterId,paramsJson,null);
            BusinessOrderDO orderDO = businessOrderDao.selectByOrderNo(payWaterId);
            BusinessOrderRefundDO orderDO = orderRefundDao.selectByOrderNo(payWaterId);
            if (orderDO == null) {
                log.error("支付流水不存在");
                log.error("退款订单不存在");
                return XMLUtil.setXML("SUCCESS", "OK");
            }
            String wxSeqNo = params.get("transaction_id");
            orderDO.setTraceNo(wxSeqNo);
            orderDO.setOutRefundNo(params.get("refund_id"));
//            orderDO.setResponseParam(paramsJson);
            // 判断total_amount是否确实为该订单的实际金额(即商户订单创建时的金额),
            String totalFee = params.get("total_fee");
            String totalFee = params.get("refund_fee");
            BigDecimal payTotalFee = new BigDecimal(totalFee).setScale(2).divide(new BigDecimal(100), BigDecimal.ROUND_HALF_EVEN);
            log.info("【微信支付退款】支付金额:{}", payTotalFee);
            if (new BigDecimal(orderDO.getPayPrice()).compareTo(payTotalFee) != 0) {
            if (new BigDecimal(orderDO.getRefundPrice()).compareTo(payTotalFee) != 0) {
                //通知资金与实际资金不对称,可能是攻击行为!
                orderDO.setRematk("通知资金与实际资金不对称,可能是攻击行为!");
                businessOrderDao.save(orderDO);
                log.info("通知资金与实际资金不对称,可能是攻击行为!");
                return XMLUtil.setXML("SUCCESS", "OK");
            }
            // 多线程执行操作
            /*********** 业务处理 start ************/
            payService.refundNotify(orderDO);
            payService.wxRefundNotify(orderDO);
            /*********** 业务处理 end ************/
            return XMLUtil.setXML("SUCCESS", "OK");

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

@ -193,14 +193,21 @@ public class PayService {
        resJson.put("id",id);
        BusinessOrderDO businessOrderDO = businessOrderDao.findOne(id);
        String type = businessOrderDO.getOrderCategory();
        Integer status = businessOrderDO.getStatus();
        resJson.put("orderCategory",type);
        resJson.put("orderNo",businessOrderDO.getOrderNo());
        resJson.put("payPrice",businessOrderDO.getPayPrice());
        resJson.put("payTime", DateUtil.dateToStrLong(businessOrderDO.getPayTime()));
        resJson.put("createTime",DateUtil.dateToStrLong(businessOrderDO.getCreateTime()));
        resJson.put("status",businessOrderDO.getStatus());
        resJson.put("updateTime",DateUtil.dateToStrLong(businessOrderDO.getUpdateTime()));
        long time = (businessOrderDO.getCreateTime().getTime() - System.currentTimeMillis())/1000;
        if(time<0&&status==0){
            cancleOrder(id);
            status = 2;
        }
        resJson.put("status",status);
        resJson.put("time",time);
        //项目
        if("3".equals(type)){
            List<BaseDoorCoachFeeDetailDO> feeDetailDOList = doorCoachFeeDetailDao.findByOrderId(businessOrderDO.getRelationCode());
            resJson.put("fees",feeDetailDOList);
@ -208,12 +215,60 @@ public class PayService {
            List<LifeCareFeeDetailDO> feeDetailDOList = lifeCareFeeDetailDao.findByOrderId(businessOrderDO.getRelationCode());
            resJson.put("fees",feeDetailDOList);
        }
        //退款信息
        if(status>2){
            BusinessOrderRefundDO refundDO = orderRefundDao.selectByOrderNo(businessOrderDO.getOrderNo());
            resJson.put("refundDO",refundDO);
        }
        return resJson;
    }
    public void applyRefund(Integer id,String content,String imgs){
    /**
     * 申请退款
     * @param id
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public String applyRefund(Integer id,String description,String enclosure){
        BusinessOrderDO businessOrderDO = businessOrderDao.findOne(id);
        String type = businessOrderDO.getOrderCategory();
        String orderId = businessOrderDO.getRelationCode();
        if(businessOrderDO.getStatus()!=1){
            return "订单为已支付状态时,才可申请退款";
        }
        if("3".equals(type)){
            BaseDoorCoachOrderDO orderDO = baseDoorCoachOrderDao.findOne(orderId);
            if(!"6".equals(orderDO.getStatus())){
                return "工单为已完成状态时,才可申请退款";
            }
        }else if("4".equals(type)){
            LifeCareOrderDO orderDO = lifeCareOrderDao.findOne(orderId);
            if(!"2".equals(orderDO.getStatus())){
                return "工单为已完成状态时,才可申请退款";
            }
        }
        BusinessOrderRefundDO orderRefundDO = orderRefundDao.selectByOrderNo(businessOrderDO.getOrderNo());
        if (orderRefundDO!=null){
            return "请勿重复申请退款";
        }
        orderRefundDO = new BusinessOrderRefundDO();
        orderRefundDO.setCreateTime(new Date());
        orderRefundDO.setUpdateTime(new Date());
        orderRefundDO.setStatus(1);
        orderRefundDO.setOrderNo(businessOrderDO.getOrderNo());
        orderRefundDO.setOrderPrice(businessOrderDO.getPayPrice());
        orderRefundDO.setRefundPrice(businessOrderDO.getPayPrice());
        orderRefundDO.setOutRefundNo("CARE"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
        orderRefundDO.setPatient(businessOrderDO.getPatient());
        orderRefundDO.setPatientName(businessOrderDO.getPatientName());
        orderRefundDO.setRefundDesc(description);
        orderRefundDO.setEnclosure(enclosure);
        orderRefundDao.save(orderRefundDO);
        businessOrderDO.setStatus(3);
        businessOrderDao.save(businessOrderDO);
        return null;
    }
    /**
@ -239,6 +294,7 @@ public class PayService {
                    lifeCareOrderDao.save(orderDO);
                }
            }
            businessOrderDO.setStatus(2);
            businessOrderDO.setUpdateTime(new Date());
            businessOrderDao.save(businessOrderDO);
        }else{
@ -407,10 +463,14 @@ public class PayService {
        businessOrderDao.save(orderDO);
    }
    /**
     * 退款成功处理
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public void wxRefundNotify(BusinessOrderDO orderDO) {
    public void refundNotify(BusinessOrderRefundDO orderDO) {
        log.error("【支付通知】请求,payWater:{}", orderDO);
        String type = orderDO.getOrderCategory();
        String type = "";
        //防止重复支付
        if (orderDO.getStatus()!=0) {
            return;
@ -424,20 +484,20 @@ public class PayService {
                break;
            case "3":
                //desc = "上门辅导";
                doorCoachOrderService.refundOrderAfter(orderDO.getRelationCode());
               // doorCoachOrderService.payOrderAfter(orderDO.getRelationCode());
                break;
            case "4":
                //desc = "生活照料服务";
                lifeCareOrderService.refundOrderAfter(orderDO.getRelationCode());
               // lifeCareOrderService.payOrderAfter(orderDO.getRelationCode());
                break;
            default:
                break;
        }
        orderDO.setStatus(4);
        businessOrderDao.save(orderDO);
    }
    /**
     * 微信navite统一下单接口
     *
@ -456,6 +516,11 @@ public class PayService {
        if (businessOrderDO.getStatus()!=0) {
            return ObjEnvelop.getError("待支付订单才能支付",-1);
        }
        long time = (businessOrderDO.getCreateTime().getTime() - System.currentTimeMillis())/1000;
        if(time<=0){
            cancleOrder(businessOrderDO.getId());
            return ObjEnvelop.getError("支付超时,订单已关闭",-1);
        }
        businessOrderDO.setOrderNo(getOrderNo());
        String noceStr = WxpayUtil.getNonceStr();
        // 组装统一下单信息
@ -526,6 +591,11 @@ public class PayService {
        if (businessOrderDO.getStatus()!=0) {
            return ObjEnvelop.getError("待支付订单才能支付",-1);
        }
        long time = (businessOrderDO.getCreateTime().getTime() - System.currentTimeMillis())/1000;
        if(time<=0){
            cancleOrder(businessOrderDO.getId());
            return ObjEnvelop.getError("支付超时,订单已关闭",-1);
        }
        BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient());
        businessOrderDO.setOrderNo(getOrderNo());