Kaynağa Gözat

建行POS机流水下载

lighter 3 ay önce
ebeveyn
işleme
1a74d505c9

+ 18 - 0
pom.xml

@@ -249,6 +249,24 @@
             </systemPath>
         </dependency>
 
+        <dependency>
+            <groupId>com.ccbmispos</groupId>
+            <artifactId>ccbwlpt-sign</artifactId>
+            <version>1.0.0</version>
+            <scope>system</scope>
+            <systemPath>${pom.basedir}/src/main/resources/ccbmispos/ccbwlpt-sign/ccbwlpt-sign-1.0.0.jar
+            </systemPath>
+        </dependency>
+
+        <dependency>
+            <groupId>com.ccbmispos</groupId>
+            <artifactId>wlpt-soft-sign</artifactId>
+            <version>1.0.0</version>
+            <scope>system</scope>
+            <systemPath>${pom.basedir}/src/main/resources/ccbmispos/wlpt-soft-sign/wlpt-soft-sign-1.0.0.jar
+            </systemPath>
+        </dependency>
+
     </dependencies>
 
     <dependencyManagement>

+ 0 - 3
src/main/java/thyyxxk/webserver/WebServerApplication.java

@@ -9,7 +9,6 @@ import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 import org.springframework.core.env.Environment;
-import thyyxxk.webserver.utils.ZipUtil;
 
 import java.net.InetAddress;
 
@@ -27,8 +26,6 @@ public class WebServerApplication {
     public static void main(String[] args) {
         ConfigurableApplicationContext application = SpringApplication.run(WebServerApplication.class, args);
         String OS = System.getProperty("os.name");
-        boolean isWindow = OS.startsWith("Windows");
-        ZipUtil.setDirectory(isWindow ? "D:\\" : "/home/web-server/temp/");
         try {
             log.info("Done-CY");
             Environment env = application.getEnvironment();

+ 212 - 139
src/main/java/thyyxxk/webserver/api/ccbmispos/CcbMisPosApi.java

@@ -1,139 +1,212 @@
-//package thyyxxk.webserver.api.ccbmispos;
-//
-//import com.ccb.wlpt.RequestProcess;
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.web.bind.annotation.GetMapping;
-//import org.springframework.web.bind.annotation.RequestMapping;
-//import org.springframework.web.bind.annotation.RestController;
-//import thyyxxk.webserver.config.auth.PassToken;
-//import thyyxxk.webserver.config.envionment.CcbMisConfig;
-//import thyyxxk.webserver.config.exception.BizException;
-//import thyyxxk.webserver.config.exception.ExceptionEnum;
-//import thyyxxk.webserver.entity.ResultVo;
-//import thyyxxk.webserver.utils.ResultVoUtil;
-//
-//import java.util.Objects;
-//
-//@Slf4j
-//@RestController
-//@RequestMapping("/api/ccbmispos")
-//public class CcbMisPosApi {
-//    private volatile boolean initialized = false;
-//    private final CcbMisConfig cfg;
-//
-//    @Autowired
-//    public CcbMisPosApi(CcbMisConfig cfg) {
-//        this.cfg = cfg;
-//    }
-//
-//    @PassToken
-//    @GetMapping("/initFileCert")
-//    public String initFileCert() {
-//        log.info("initFileCert:{}", cfg);
-//        String initResult = RequestProcess.initFileCert(cfg.getMchId(), cfg.getUserid(),
-//                cfg.getCertFile(), cfg.getCertPassword(), cfg.getConfigFile());
-//        if (Objects.equals(initResult, "")) {
-//            initResult = "INIT SUCCESS";
-//            initialized = true;
-//        } else {
-//            initialized = false;
-//            initResult = "INIT FAILED:" + initResult;
-//        }
-//        log.info("initResult:{}", initResult);
-//        return initResult;
-//    }
-//
-//    @PassToken
-//    @GetMapping("/removeFileCert")
-//    public String removeFileCert() {
-//        RequestProcess.removeFileCert(cfg.getMchId(), cfg.getUserid());
-//        return "OK";
-//    }
-//
-//    @PassToken
-//    @GetMapping("/downloadTradeList")
-//    public ResultVo<String> downloadTradeList() {
-//        if (!initialized) {
-//            String initResult = initFileCert();
-//            if (!Objects.equals(initResult, "INIT SUCCESS")) {
-//                throw new BizException(ExceptionEnum.LOGICAL_ERROR, "初始化证书失败:" + initResult);
-//            }
-//        }
-//        String xml = "<?xml version=\"1.0\" encoding=\"GB2312\" standalone=\"yes\" ?>  \n" +
-//                "<TX>   \n" +
-//                "  <REQUEST_SN>" + System.currentTimeMillis() + "000</REQUEST_SN>  \n" +
-//                "  <CUST_ID>"+cfg.getMchId() +"</CUST_ID>  \n" +
-//                "  <USER_ID>"+cfg.getUserid()+"</USER_ID>  \n" +
-//                "  <PASSWORD>"+cfg.getUserPassword()+"</PASSWORD>  \n" +
-//                "  <TX_CODE>5W1005</TX_CODE>  \n" +
-//                "  <LANGUAGE>CN</LANGUAGE>  \n" +
-//                "  <TX_INFO>  \n" +
-//                "    <DATE>20250715</DATE>  \n" +
-//                "    <KIND>1</KIND>  \n" +
-//                "    <FILETYPE>1</FILETYPE>  \n" +
-//                "    <TYPE>0</TYPE>  \n" +
-//                "    <NORDERBY>1</NORDERBY>  \n" +
-//                "    <POS_CODE></POS_CODE>  \n" +
-//                "    <ORDER></ORDER>  \n" +
-//                "    <STATUS>1</STATUS>  \n" +
-//                "    <BILL_FLAG>1</BILL_FLAG>  \n" +
-//                "    <Mrch_No></Mrch_No>  \n" +
-//                "    <GROUP_FLAG>0</GROUP_FLAG>  \n" +
-//                "    <TXN_TPCD>1</TXN_TPCD>  \n" +
-//                "  </TX_INFO>\n" +
-//                "</TX> \n";
-//        log.info("入参:\r\n{}", xml);
-//        String result =  RequestProcess.sendRequest(cfg.getServiceUrl(), xml);
-//        log.info("出参:\r\n{}", result);
-//
-//        String code = analyzeCodeValue(result);
-//
-//        if (code.equals("000000")) {
-//            String fileName = result.split("<FILE_NAME>")[1]
-//                    .split("</FILE_NAME>")[0];
-//            log.info("fileName: {}", fileName);
-//            return downloadFile(fileName);
-//        }
-//        String errMsg = result.split("<RETURN_MSG>")[1]
-//                .split("</RETURN_MSG>")[0];
-//        throw new BizException(ExceptionEnum.LOGICAL_ERROR,  errMsg);
-//    }
-//
-//    private ResultVo<String> downloadFile(String fileName) {
-//        String xml = "<?xml version=\"1.0\" encoding=\"GB2312\" standalone=\"yes\" ?> \n" +
-//                "<TX> \n" +
-//                "  <REQUEST_SN>" + System.currentTimeMillis() + "000</REQUEST_SN>  \n" +
-//                "  <CUST_ID>"+cfg.getMchId() +"</CUST_ID>  \n" +
-//                "  <USER_ID>"+cfg.getUserid()+"</USER_ID>  \n" +
-//                "  <PASSWORD>"+cfg.getUserPassword()+"</PASSWORD>  \n" +
-//                "  <TX_CODE>6W0111</TX_CODE> \n" +
-//                "  <LANGUAGE>CN</LANGUAGE> \n" +
-//                "  <TX_INFO> \n" +
-//                "    <SOURCE>" + fileName + "</SOURCE>  \n" +
-//                "    <FILEPATH>merchant/shls</FILEPATH>  \n" +
-//                "    <LOCAL_REMOTE>0</LOCAL_REMOTE>  \n" +
-//                "  </TX_INFO> \n" +
-//                "</TX> \n";
-//        log.info("入参:\r\n{}", xml);
-//
-//        String result = RequestProcess.downloadFile(cfg.getServiceUrl(), xml, "D:\\work\\ccbmis");
-//
-////        String result =  RequestProcess.sendRequest(cfg.getServiceUrl(), xml);
-//        log.info("出参:\r\n{}", result);
-//        String code = analyzeCodeValue(result);
-//        if (code.equals("000000")) {
-//            return ResultVoUtil.success("下载文件成功");
-//        }
-//        String errMsg = result.split("<RETURN_MSG>")[1]
-//                .split("</RETURN_MSG>")[0];
-//        throw new BizException(ExceptionEnum.LOGICAL_ERROR,  errMsg);
-//    }
-//
-//    private String analyzeCodeValue(String resultXml) {
-//        if (resultXml.contains("<RETURN_CODE>") && resultXml.contains("</RETURN_CODE>")) {
-//            return resultXml.split("<RETURN_CODE>")[1].split("</RETURN_CODE>")[0];
-//        }
-//        throw new BizException(ExceptionEnum.NULL_POINTER, "返回值异常,没有 <RETURN_CODE> 节点。");
-//    }
-//}
+package thyyxxk.webserver.api.ccbmispos;
+
+import com.ccb.wlpt.RequestProcess;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.webserver.config.auth.PassToken;
+import thyyxxk.webserver.config.envionment.CcbMisConfig;
+import thyyxxk.webserver.config.exception.BizException;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.dao.his.api.CcbMisposDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.utils.*;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.Queue;
+
+@Slf4j
+@RestController
+@RequestMapping("/api/ccbmispos")
+public class CcbMisPosApi {
+    private volatile boolean initialized = false;
+    private final CcbMisConfig cfg;
+    private final CcbMisposDao dao;
+
+    @Autowired
+    public CcbMisPosApi(CcbMisConfig cfg, CcbMisposDao dao) {
+        this.cfg = cfg;
+        this.dao = dao;
+    }
+
+    @PassToken
+    @GetMapping("/initFileCert")
+    public String initFileCert() {
+        log.info("initFileCert:{}", cfg);
+        String initResult = RequestProcess.initFileCert(cfg.getMchId(), cfg.getUserid(),
+                cfg.getCertFile(), cfg.getCertPassword(), cfg.getConfigFile());
+        if (Objects.equals(initResult, "")) {
+            initResult = "INIT SUCCESS";
+            initialized = true;
+        } else {
+            initialized = false;
+            initResult = "INIT FAILED:" + initResult;
+        }
+        log.info("initResult:{}", initResult);
+        return initResult;
+    }
+
+    @PassToken
+    @GetMapping("/removeFileCert")
+    public String removeFileCert() {
+        RequestProcess.removeFileCert(cfg.getMchId(), cfg.getUserid());
+        return "OK";
+    }
+
+    @PassToken
+    @GetMapping("/downloadTradeList")
+    public ResultVo<String> downloadTradeList(@RequestParam("date") String date) throws IOException {
+        // date 应是 yyyyMMdd 格式:20250903
+        if (date.contains("-")) {
+            date = date.replaceAll("-", "");
+        }
+        if (!initialized) {
+            String initResult = initFileCert();
+            if (!Objects.equals(initResult, "INIT SUCCESS")) {
+                throw new BizException(ExceptionEnum.LOGICAL_ERROR, "初始化证书失败:" + initResult);
+            }
+        }
+        String xml = "<?xml version=\"1.0\" encoding=\"GB2312\" standalone=\"yes\" ?>  \n" +
+                "<TX>   \n" +
+                "  <REQUEST_SN>" + System.currentTimeMillis() + "000</REQUEST_SN>  \n" +
+                "  <CUST_ID>"+cfg.getMchId() +"</CUST_ID>  \n" +
+                "  <USER_ID>"+cfg.getUserid()+"</USER_ID>  \n" +
+                "  <PASSWORD>"+cfg.getUserPassword()+"</PASSWORD>  \n" +
+                "  <TX_CODE>5W1005</TX_CODE>  \n" +
+                "  <LANGUAGE>CN</LANGUAGE>  \n" +
+                "  <TX_INFO>  \n" +
+                "    <DATE>" + date + "</DATE>  \n" +
+                "    <KIND>1</KIND>  \n" +
+                "    <FILETYPE>1</FILETYPE>  \n" +
+                "    <TYPE>0</TYPE>  \n" +
+                "    <NORDERBY>1</NORDERBY>  \n" +
+                "    <POS_CODE></POS_CODE>  \n" +
+                "    <ORDER></ORDER>  \n" +
+                "    <STATUS>1</STATUS>  \n" +
+                "    <BILL_FLAG>1</BILL_FLAG>  \n" +
+                "    <Mrch_No></Mrch_No>  \n" +
+                "    <GROUP_FLAG>0</GROUP_FLAG>  \n" +
+                "    <TXN_TPCD>1</TXN_TPCD>  \n" +
+                "  </TX_INFO>\n" +
+                "</TX> \n";
+        log.info("入参:\r\n{}", xml);
+        String result =  RequestProcess.sendRequest(cfg.getServiceUrl(), xml);
+        log.info("出参:\r\n{}", result);
+
+        String code = analyzeCodeValue(result);
+
+        if (code.equals("000000")) {
+            String fileName = result.split("<FILE_NAME>")[1]
+                    .split("</FILE_NAME>")[0];
+            log.info("fileName: {}", fileName);
+            return downloadFile(fileName);
+        }
+        String errMsg = result.split("<RETURN_MSG>")[1]
+                .split("</RETURN_MSG>")[0];
+        throw new BizException(ExceptionEnum.LOGICAL_ERROR,  errMsg);
+    }
+
+    private ResultVo<String> downloadFile(String fileName) throws IOException {
+        String xml = "<?xml version=\"1.0\" encoding=\"GB2312\" standalone=\"yes\" ?> \n" +
+                "<TX> \n" +
+                "  <REQUEST_SN>" + System.currentTimeMillis() + "000</REQUEST_SN>  \n" +
+                "  <CUST_ID>"+cfg.getMchId() +"</CUST_ID>  \n" +
+                "  <USER_ID>"+cfg.getUserid()+"</USER_ID>  \n" +
+                "  <PASSWORD>"+cfg.getUserPassword()+"</PASSWORD>  \n" +
+                "  <TX_CODE>6W0111</TX_CODE> \n" +
+                "  <LANGUAGE>CN</LANGUAGE> \n" +
+                "  <TX_INFO> \n" +
+                "    <SOURCE>" + fileName + "</SOURCE>  \n" +
+                "    <FILEPATH>merchant/shls</FILEPATH>  \n" +
+                "    <LOCAL_REMOTE>0</LOCAL_REMOTE>  \n" +
+                "  </TX_INFO> \n" +
+                "</TX> \n";
+        log.info("入参:\r\n{}", xml);
+
+        String result = RequestProcess.downloadFile(cfg.getServiceUrl(), xml, cfg.getFileDir());
+
+        log.info("出参:\r\n{}", result);
+        String code = analyzeCodeValue(result);
+        if (code.equals("000000")) {
+            unzipFile(fileName);
+            return ResultVoUtil.success("下载文件成功");
+        }
+        String errMsg = result.split("<RETURN_MSG>")[1]
+                .split("</RETURN_MSG>")[0];
+        throw new BizException(ExceptionEnum.LOGICAL_ERROR,  errMsg);
+    }
+
+    private void unzipFile(String zipFileName) throws IOException {
+        String txtPath = ZipUtil.unZip(zipFileName, cfg.getFileDir(), ".det.");
+        Queue<String> queue = SiUtil.readTxtFile(txtPath);
+        List<CcbMisposPaymentRecord> recordList = new ArrayList<>();
+        if (!queue.isEmpty()) {
+            queue.poll();
+        }
+        if (!queue.isEmpty()) {
+            String textLine = queue.poll();
+            CcbMisposPaymentRecord record = makeRecordFromText(textLine);
+            recordList.add(record);
+            String date = textLine.split("\\|")[4];
+            String begin = date + " 00:00:00";
+            String end = date + " 23:59:59";
+            dao.deleteDuplicateData(begin, end);
+        }
+        while (!queue.isEmpty()) {
+            String textLine = queue.poll();
+            CcbMisposPaymentRecord record = makeRecordFromText(textLine);
+            recordList.add(record);
+            if (recordList.size() == 30) {
+                dao.insert(recordList);
+                recordList.clear();
+            }
+        }
+        if (!recordList.isEmpty()) {
+            dao.insert(recordList);
+        }
+        ZipUtil.deleteFile(txtPath);
+        ZipUtil.deleteFile(cfg.getFileDir() + zipFileName);
+    }
+
+    private String analyzeCodeValue(String resultXml) {
+        if (resultXml.contains("<RETURN_CODE>") && resultXml.contains("</RETURN_CODE>")) {
+            return resultXml.split("<RETURN_CODE>")[1].split("</RETURN_CODE>")[0];
+        }
+        throw new BizException(ExceptionEnum.NULL_POINTER, "返回值异常,没有 <RETURN_CODE> 节点。");
+    }
+
+    private CcbMisposPaymentRecord makeRecordFromText(String txt) {
+        String[] arr = txt.split("\\|");
+        CcbMisposPaymentRecord record = new CcbMisposPaymentRecord();
+        record.setId(SnowFlakeId.instance().nextId());
+        record.setTerminalNo(arr[0]);
+        record.setCardBelong(arr[1]);
+        record.setCardType(arr[2]);
+        record.setCardSerialNo(arr[3]);
+        String timeStr = arr[4] + " " + arr[5];
+        record.setTradeTime(DateUtil.parse(timeStr));
+        record.setTradeType(arr[6]);
+        record.setGrantNo(arr[7]);
+        record.setTradeAmount(arr[8]);
+        record.setBankHandlingFee(arr[9]);
+        record.setReceivedAmount(arr[10]);
+        record.setTraceNo(arr[11]);
+        record.setBatchNo(arr[12]);
+        record.setPosTradeSort(arr[13]);
+        record.setSettleAccount(arr[14]);
+        record.setTradeNo(arr[15]);
+        record.setPosNo(arr[16]);
+        record.setSystemReferNo(arr[17]);
+        record.setPaymentVoucher(arr[18]);
+        record.setRemark1(arr[19]);
+        record.setRemark2(arr[20]);
+        record.setOrderAmount(arr[21]);
+        return record;
+    }
+}

+ 126 - 0
src/main/java/thyyxxk/webserver/api/ccbmispos/CcbMisposPaymentRecord.java

@@ -0,0 +1,126 @@
+package thyyxxk.webserver.api.ccbmispos;
+
+import java.io.Serializable;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import java.util.Date;
+
+@Data
+public class CcbMisposPaymentRecord  implements Serializable {
+
+	private static final long serialVersionUID =  7672683984332871674L;
+
+	/**
+	 * 主键
+	 */
+	@TableId(type = IdType.INPUT)
+	private String id;
+
+	/**
+	 * 终端号
+	 */
+	private String terminalNo;
+
+	/**
+	 * 发卡行
+	 */
+	private String cardBelong;
+
+	/**
+	 * 卡种
+	 */
+	private String cardType;
+
+	/**
+	 * 卡号-序列号
+	 */
+	private String cardSerialNo;
+
+	/**
+	 * 交易时间
+	 */
+	private Date tradeTime;
+
+	/**
+	 * 交易类型
+	 */
+	private String tradeType;
+
+	/**
+	 * 授权号
+	 */
+	private String grantNo;
+
+	/**
+	 * 交易金额
+	 */
+	private String tradeAmount;
+
+	/**
+	 * 银行手续费
+	 */
+	private String bankHandlingFee;
+
+	/**
+	 * 划账金额
+	 */
+	private String receivedAmount;
+
+	/**
+	 * 凭证号
+	 */
+	private String traceNo;
+
+	/**
+	 * 批次号
+	 */
+	private String batchNo;
+
+	/**
+	 * POS交易序号
+	 */
+	private String posTradeSort;
+
+	/**
+	 * 结算账号
+	 */
+	private String settleAccount;
+
+	/**
+	 * 订单号
+	 */
+	private String tradeNo;
+
+	/**
+	 * POS编号
+	 */
+	private String posNo;
+
+	/**
+	 * 系统参考号
+	 */
+	private String systemReferNo;
+
+	/**
+	 * 付款凭证号
+	 */
+	private String paymentVoucher;
+
+	/**
+	 * 备注1
+	 */
+	private String remark1;
+
+	/**
+	 * 备注2
+	 */
+	private String remark2;
+
+	/**
+	 * 订单金额
+	 */
+	private String orderAmount;
+
+}

+ 1 - 0
src/main/java/thyyxxk/webserver/config/envionment/CcbMisConfig.java

@@ -17,4 +17,5 @@ public class CcbMisConfig {
     private String certFile;
     private String certPassword;
     private String serviceUrl;
+    private String fileDir;
 }

+ 1 - 0
src/main/java/thyyxxk/webserver/config/envionment/MedinsurConfig.java

@@ -15,6 +15,7 @@ public class MedinsurConfig {
     private String apiName;
     private String accessKey;
     private String secretKey;
+    private String downloadDir;
     private String ipAddress;
     private String macAddress;
     private String hospId;

+ 14 - 0
src/main/java/thyyxxk/webserver/dao/his/api/CcbMisposDao.java

@@ -0,0 +1,14 @@
+package thyyxxk.webserver.dao.his.api;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Mapper;
+import thyyxxk.webserver.api.ccbmispos.CcbMisposPaymentRecord;
+
+@Mapper
+public interface CcbMisposDao extends BaseMapper<CcbMisposPaymentRecord> {
+
+    @Delete("delete from ccb_mispos_payment_record " +
+            "where trade_time>=#{start} and trade_time<=#{end}")
+    void deleteDuplicateData(String start, String end);
+}

+ 1 - 1
src/main/java/thyyxxk/webserver/dao/his/dictionary/BedDeptDictDao.java

@@ -38,7 +38,7 @@ public interface BedDeptDictDao {
 
     @Select("  select b.ward_code as wardCode,   " +
             "         b.bed_status as bedStatus, " +
-            "         case when b.bed_status = '2' then '占用' else '空闲' end as bedStatusName, " +
+            "         case when b.bed_status='2' then '占用' else '空闲' end as bedStatusName, " +
             "         b.bed_no as bedNo,   " +
             "         b.room_no as roomNo,   " +
             "         b.dept_code as deptCode,   " +

+ 2 - 2
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiDownloadService.java

@@ -1082,12 +1082,12 @@ public class SiDownloadService {
         fsDownloadIn.put("filename", filename);
         fsDownloadIn.put("fixmedins_code", cfg.getHospId());
         input.getJSONObject("input").put("fsDownloadIn", fsDownloadIn);
-        String targetPath = ZipUtil.DIRECTORY + filename;
+        String targetPath = cfg.getDownloadDir() + filename;
         ForestResponse<byte[]> rsp = execSrvc.download(exec.getSiHeaderMap(SiFunction.DOWNLOAD_FILE), input);
         try {
             Files.write(Paths.get(targetPath), Objects.requireNonNull(rsp.getByteArray(),
                     "未获取到下载文件"));
-            String unZip = ZipUtil.unZip(targetPath);
+            String unZip = ZipUtil.unZip(filename, cfg.getDownloadDir());
             log.info("解压缩成功:{}", unZip);
             ZipUtil.deleteFile(targetPath);
             return unZip;

+ 28 - 12
src/main/java/thyyxxk/webserver/utils/PasswordGenerator.java

@@ -7,18 +7,6 @@ import java.util.Random;
 public class PasswordGenerator {
     public static final String[] SOURCE =  {"abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "0123456789", "!@#$%^&*()_+,.<>/?{}[]"};
 
-    public static void main(String[] args) throws Exception {
-        List<Integer> usedSourceIndexes = new ArrayList<>();
-        int passwordLength = 16;
-        String password;
-        for (int i = 0; i < passwordLength; i++) {
-            do {
-                password = generatePassword(usedSourceIndexes, passwordLength);
-            } while (usedSourceIndexes.size() < SOURCE.length);
-            System.out.println(password);
-        }
-    }
-
     public static String generatePassword(List<Integer> usedSourceIndexes, int passwordLength) {
         usedSourceIndexes.clear();
         StringBuilder passwordBuilder = new StringBuilder();
@@ -32,4 +20,32 @@ public class PasswordGenerator {
         }
         return passwordBuilder.toString();
     }
+
+
+
+
+
+    public static void main(String[] args) throws Exception {
+//        for (ChargeStatus type : ChargeStatus.values()) {
+//            System.out.println(
+//                    SnowFlakeId.instance().nextId() + "," +
+//                            "charge_status," +
+//                            type.getCode() + "," +
+//                            type.getName() + "," +
+//                            PingYinUtils.pyShouZiMuDaXie(type.getName()) + "," +
+//                            PingYinUtils.getWBCode(type.getName())
+//            );
+//        }
+
+        List<Integer> usedSourceIndexes = new ArrayList<>();
+        int passwordLength = 16;
+        String password;
+        for (int i = 0; i < passwordLength; i++) {
+            do {
+                password = generatePassword(usedSourceIndexes, passwordLength);
+            } while (usedSourceIndexes.size() < SOURCE.length);
+            System.out.println(password);
+        }
+    }
+
 }

+ 12 - 8
src/main/java/thyyxxk/webserver/utils/ZipUtil.java

@@ -16,11 +16,6 @@ import java.util.zip.ZipOutputStream;
  */
 @Slf4j
 public class ZipUtil {
-    public static String DIRECTORY;
-
-    public static void setDirectory(String directory) {
-        DIRECTORY = directory;
-    }
 
     /**
      * zip压缩
@@ -47,20 +42,29 @@ public class ZipUtil {
         return filename + ".zip";
     }
 
+    public static String unZip(String filename, String dir) throws IOException {
+        return unZip(filename, dir, null);
+    }
+
     /**
      * zip解压
      */
-    public static String unZip(String filename) throws IOException {
+    public static String unZip(String filename, String dir, String wanted) throws IOException {
         String unZipPath = "";
         //读取压缩文件
-        ZipInputStream in = new ZipInputStream(Files.newInputStream(Paths.get(filename)));
+        String filePath = dir + filename;
+        ZipInputStream in = new ZipInputStream(Files.newInputStream(Paths.get(filePath)));
         //zip文件实体类
         ZipEntry entry;
         //遍历压缩文件内部 文件数量
         while((entry = in.getNextEntry()) != null){
             if(!entry.isDirectory()){
                 //文件输出流
-                unZipPath = DIRECTORY + entry.getName();
+                String name = entry.getName();
+                if (null != wanted && !name.contains(wanted)) {
+                    continue;
+                }
+                unZipPath = dir + name;
                 FileOutputStream out = new FileOutputStream(unZipPath);
                 BufferedOutputStream bos = new BufferedOutputStream(out);
                 int len;

+ 2 - 0
src/main/resources/application-dev.yml

@@ -221,6 +221,7 @@ thyy:
     api-version: 1.0.0
     access-key: 04eMGRg7beAO6vqwrZiLacV8Uy3jNn7QGDUcBO
     secret-key: SK3Oip3a2R3NLz2xm58Mpmi69oFu96KrdKNRKglN
+    download-dir: D:\\
     ip-address: 218.104.151.243
     mac-address: FE-FC-FE-35-35-DE
     hosp-id: H43010500370
@@ -237,3 +238,4 @@ thyy:
     cert-file: D:\work\ccbmis\MC1819980.pfx
     cert-password: 123456
     service-url: https://merchant.ccb.com
+    file-dir: D:\\work\\ccbmis\\

+ 5 - 3
src/main/resources/application-prod.yml

@@ -200,6 +200,7 @@ thyy:
     api-version: 1.0.0
     access-key: 04eMGRg7beAO6vqwrZiLacV8Uy3jNn7QGDUcBO
     secret-key: SK3Oip3a2R3NLz2xm58Mpmi69oFu96KrdKNRKglN
+    download-dir: /home/web-server/temp/
     ip-address: 218.104.151.243
     mac-address: FE-FC-FE-35-35-DE
     hosp-id: H43010500370
@@ -212,7 +213,8 @@ thyy:
     mchId: 105430180621029
     userid: 002
     user-password: thyy@2018
-    configFile: D:\work\ccbmis\config.xml
-    certFile: D:\work\ccbmis\MC1819980.pfx
+    configFile: /home/ccbmispos/config/config.xml
+    certFile: /home/ccbmispos/cert/MC1819980.pfx
     certPassword: 123456
-    service-url: https://merchant.ccb.com
+    service-url: https://merchant.ccb.com
+    file-dir: /home/web-server/temp/

BIN
src/main/resources/ccbmispos/ccbwlpt-sign/ccbwlpt-sign-1.0.0.jar


BIN
src/main/resources/ccbmispos/wlpt-soft-sign/wlpt-soft-sign-1.0.0.jar