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.
		
		
		
		
			
				
					
					
						
							149 lines
						
					
					
						
							5.3 KiB
						
					
					
				
			
		
		
	
	
							149 lines
						
					
					
						
							5.3 KiB
						
					
					
				| package com.ynxbd.common.action;
 | |
| 
 | |
| import com.ynxbd.common.action.base.BaseAction;
 | |
| import com.ynxbd.common.bean.enums.MerchantEnum;
 | |
| import com.ynxbd.common.helper.common.DateHelper;
 | |
| import com.ynxbd.common.result.Result;
 | |
| import com.ynxbd.common.result.ResultEnum;
 | |
| import com.ynxbd.common.result.ServiceException;
 | |
| import com.ynxbd.common.service.OutCollectService;
 | |
| import lombok.extern.slf4j.Slf4j;
 | |
| import org.apache.struts2.convention.annotation.Action;
 | |
| import org.apache.struts2.convention.annotation.Namespace;
 | |
| 
 | |
| import java.math.BigDecimal;
 | |
| import java.util.Date;
 | |
| 
 | |
| 
 | |
| /**
 | |
|  * @Author wsq
 | |
|  * @Date 2021/3/17 10:57
 | |
|  * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
 | |
|  */
 | |
| 
 | |
| @Slf4j
 | |
| @Namespace("/test02")
 | |
| public class TestAction extends BaseAction {
 | |
| 
 | |
| 
 | |
| //    @Action("a")
 | |
| //    public String a() {
 | |
| //        String sql = "select * from a limit 0, 100";
 | |
| //        List<A> data = DataBase.select(sql, A.class);
 | |
| //        for (A a : data) {
 | |
| //            System.out.println(data);
 | |
| //        }
 | |
| //        return Result.success(data);
 | |
| //        StringBuilder sb = new StringBuilder();
 | |
| //        sb.append("http://10.20.10.60:8123/MessagePlatform/DaoYiXun?");
 | |
| //        sb.append("templateId=");
 | |
| //        sb.append("6hpr5eY-nnCIkFu2ZeuvFjd0YG1ZwlHOo_ikRSXJUg4");
 | |
| //        //
 | |
| //        sb.append("&patientName=");
 | |
| //        sb.append("患者");
 | |
| //        //
 | |
| //        sb.append("&content=");
 | |
| //        sb.append("内容");
 | |
| //        //
 | |
| //        sb.append("&openId=");
 | |
| //        sb.append("32EBE22EF6C9437575AB7A043E456D25704583EFA5E6BE1B5CB899A6F3B7075A");
 | |
| //        //
 | |
| //        sb.append("&deptName=");
 | |
| //        sb.append("科室");
 | |
| //        //
 | |
| //        sb.append("&deptCode=");
 | |
| //        sb.append("1234");
 | |
| //        ResponseEntity<String> responseEntity = new RestTemplate().getForEntity("http://10.20.10.60:8123/MessagePlatform/DaoYiXun?templateId=6hpr5eY-nnCIkFu2ZeuvFjd0YG1ZwlHOo_ikRSXJUg4&patientName=王绍全&content=挂号时间&openId=32EBE22EF6C9437575AB7A043E456D25704583EFA5E6BE1B5CB899A6F3B7075A&deptName=方便门诊&deptCode=5201", String.class);
 | |
| //
 | |
| //        String body = responseEntity.getBody();
 | |
| //        System.out.println(body);
 | |
| //        System.out.println(responseEntity);
 | |
| //        return Result.error();
 | |
| //    }
 | |
| 
 | |
| 
 | |
|     @Action("ocPay")
 | |
|     public Result ocPay(String outTradeNo) throws ServiceException {
 | |
|         new OutCollectService().ocPayNotify(MerchantEnum.WX, "123", new BigDecimal("0.01"), outTradeNo, "123", "123");
 | |
|         return Result.success();
 | |
|     }
 | |
| 
 | |
| 
 | |
| //    @Action("lock")
 | |
| //    public String lock() {
 | |
| //        return Result.success(update());
 | |
| //    }
 | |
| //    public synchronized Integer update(){
 | |
| //        int update = DataBase.update("update pay set remark = ? where outTradeNo= ?, updateTime=now()", ps -> {
 | |
| //            ps.setString(1, CodeHelper.getRandomCode(8));
 | |
| //            ps.setString(2, "00015d3064434d8c8c4a016b84602f89");
 | |
| //        });
 | |
| //        return null;
 | |
| //    }
 | |
| 
 | |
| 
 | |
| //    @Action("api")
 | |
| //    public Result api(String callNo, String patientId, String refundDesc, String payOrdId) {
 | |
| //        String verify = request.getHeader("verify");
 | |
| //        Map<String, Object> map = new HashMap<>();
 | |
| //
 | |
| //        map.put("callNo", callNo);
 | |
| //        map.put("patientId", patientId);
 | |
| //        map.put("refundDesc", refundDesc);
 | |
| //        map.put("payOrdId", payOrdId);
 | |
| //        map.put("verify", verify);
 | |
| //
 | |
| //        map.put("transNo", "transNo123");
 | |
| //        map.put("payWay", 4);
 | |
| //        map.put("bankTransNo", "bankTransNo123");
 | |
| //        map.put("payMoney", new BigDecimal("0.01"));
 | |
| //
 | |
| //        if (patientId != null && payOrdId != null) {
 | |
| //            String piMd5 = patientId + payOrdId + "xbd";
 | |
| //            map.put("wx_verify", DigestUtils.md5Hex(piMd5).toUpperCase());
 | |
| //        }
 | |
| //        return Result.success(map);
 | |
| //    }
 | |
| 
 | |
| //    @Action(value = "api2")
 | |
| //    public Result api2(String id) {
 | |
| //        String post = HttpClientHelper.post("http://127.0.0.1:8081/wx/test02/api.do?a=123", null, null);
 | |
| //        return Result.success(post);
 | |
| //    }
 | |
| 
 | |
| 
 | |
|     @Action("test")
 | |
|     public Result test(String billDate) {
 | |
|         if (!DateHelper.isValidDate(billDate, DateHelper.DateEnum.yyyy_MM_dd)) {
 | |
|             return Result.error(ResultEnum.PARAM_DATE_ERROR);
 | |
|         }
 | |
| 
 | |
|         System.out.println(DateHelper.getMoveDate(new Date(), -1));
 | |
|         if (billDate.equals(DateHelper.getMoveDate(new Date(), -1))) {
 | |
|             if (!DateHelper.isCurTimeOver("03:00:00")) {
 | |
|                 return Result.error("查询前一天的数据,需要在今天9点15之后");
 | |
|             }
 | |
|         }
 | |
|         return Result.success();
 | |
|     }
 | |
| 
 | |
| //
 | |
| //    @Action("refundReg")
 | |
| //    public Result refundReg() {
 | |
| //
 | |
| //        List<Order> orders = new RegisterDao().selectRefundList("2022-09-22", "2022-09-29");
 | |
| //        log.info("退费笔数{}", orders.size());
 | |
| //        if (orders.size() > 60) {
 | |
| //            return Result.error("退费数量过多");
 | |
| //        }
 | |
| //        String payCode = "wx";
 | |
| //        for (Order item : orders) {
 | |
| //            String openid = item.getOpenid();
 | |
| //            if (openid != null && openid.length() == 16) {
 | |
| //                payCode = "ali";
 | |
| //            }
 | |
| //            new RegService().cancelRegReserve(payCode, item.getPatientId(), item.getTradeNo(), item.getHisTransNo());
 | |
| //       }
 | |
| //        return Result.success();
 | |
| //    }
 | |
| } |