Browse Source

Merge branch 'dev' of wangzhinan/wlyy2.0 into dev

huangwenjie 6 years ago
parent
commit
2c77aa973e

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/bank/HealthBankMapping.java

@ -73,5 +73,6 @@ public class HealthBankMapping {
        public static final String selectByPatientAndDate = "/selectByPatientAndDate";
        public static final String selectTaskAndPatients = "/selectTaskAndPatients";
        public static final String shareIntegrate = "/shareIntegrate";
        public static final String payIntegrate = "/payIntegrate";
    }
}

+ 32 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/CreditsDetailController.java

@ -346,5 +346,37 @@ public class CreditsDetailController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 商城积分支付
     *
     * @param patient 居民code
     * @param total 订单总积分
     * @param hospital 社区code
     * @param hospitalName 社区名称
     * @param orders 订单集合[{orders:,integrate}]
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.payIntegrate)
    @ApiOperation(value = "商城积分支付")
    public MixEnvelop<CreditsDetailDO, CreditsDetailDO> payIntegrate(@ApiParam(name = "patient",value = "居民code")
                                                                       @RequestParam(value = "patient",required = false)String patient,
                                                                     @ApiParam(name = "total",value = "需要支付的总积分")
                                                                     @RequestParam(value = "total",required = false)Double total,
                                                                     @ApiParam(name = "hospital",value = "社区code")
                                                                     @RequestParam(value = "hospital",required = false)String hospital,
                                                                     @ApiParam(name = "hospitalName",value = "社区名称")
                                                                     @RequestParam(value = "hospitalName",required = false)String hospitalName,
                                                                     @ApiParam(name = "orders",value = "订单集合")
                                                                     @RequestParam(value = "orders",required = false)String orders){
        try {
            JSONArray array = JSONArray.parseArray(orders);
            return service.payIntegrate(patient,total,hospital,hospitalName,array);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 48 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java

@ -1342,4 +1342,52 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
        }
    }
    /**
     * 商城积分支付
     * @param patient
     * @param total
     * @param hospital
     * @param hospitalName
     * @param array
     * @return
     * @throws Exception
     */
    public MixEnvelop<CreditsDetailDO,CreditsDetailDO> payIntegrate(String patient,Double total,String hospital,String hospitalName,JSONArray array) throws Exception {
        MixEnvelop<CreditsDetailDO,CreditsDetailDO> envelop = new MixEnvelop<>();
        AccountDO accountDO = accountDao.selectByPatientId(patient);
        Integer total1 = total.intValue();
        if (accountDO == null){
            envelop.setMessage("银行账户不存在!");
            throw new Exception("银行账户不存在!");
        }else {
            if (total1>accountDO.getTotal()){
                envelop.setMessage("积分余额不足!");
                throw new Exception("积分余额不足!");
            }else{
                for (int i=0;i<array.size();i++){
                    JSONObject object = array.getJSONObject(i);
                    CreditsDetailDO creditsDetailDO = new CreditsDetailDO();
                    creditsDetailDO.setPatientId(patient);
                    creditsDetailDO.setAccountId(accountDO.getId());
                    creditsDetailDO.setHospital(hospital);
                    creditsDetailDO.setTradeType("SHOPPING_PAY");
                    creditsDetailDO.setTradeDirection(-1);
                    creditsDetailDO.setTransactionId(object.getString("orderId"));
                    creditsDetailDO.setIntegrate(object.getDouble("integrate").intValue());
                    creditsDetailDO.setCreateTime(new Date());
                    creditsDetailDO.setUpdateTime(new Date());
                    creditsDetailDO.setSaasId("dev");
                    creditsDetailDO.setId(getCode());
                    creditsDetailDO.setCoupon(0);
                    creditsDetailDO.setStatus(1);
                    credittsLogDetailDao.save(creditsDetailDO);
                }
                accountDO.setTotal(accountDO.getTotal()-total1);
                accountDao.save(accountDO);
            }
        }
        return envelop;
    }
}

+ 5 - 5
svr/svr-wlyy-health-bank/src/main/resources/application.yml

@ -52,9 +52,9 @@ fast-dfs:
spring:
  profiles: jwdev
  datasource:
    url: jdbc:mysql://172.26.0.104:3306/wlyy_health_bank?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg@jkzl2019
    url: jdbc:mysql://172.26.0.114:3306/wlyy_health_bank?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: root
    password: jkzlehr
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
@ -62,7 +62,7 @@ spring:
  data:
    elasticsearch: #ElasticsearchProperties
      cluster-name: jkzl #默认即为elasticsearch  集群名
      cluster-nodes: 172.26.0.115:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
      cluster-nodes: 172.26.0.112:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
      local: false #是否本地连接
      properties: # Additional properties used to configure the client.
        enable: true
@ -95,7 +95,7 @@ spring:
  data:
    elasticsearch: #ElasticsearchProperties
      cluster-name: jkzl #默认即为elasticsearch  集群名
      cluster-nodes: 172.26.0.115:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
      cluster-nodes: 172.26.0.112:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
      local: false #是否本地连接
      properties: # Additional properties used to configure the client.
        enable: true