JuziMain.java 1.5 KB

1234567891011121314151617181920212223242526272829303132
  1. import com.alibaba.fastjson.JSONObject;
  2. import com.alibaba.fastjson.serializer.SerializerFeature;
  3. import com.jzfq.rms.credit.bean.CreditInfoRequest;
  4. import com.jzfq.rms.credit.bean.CreditInfoResponse;
  5. import com.jzfq.rms.credit.enums.ErrorEnum;
  6. import com.jzfq.rms.credit.utils.RuleUtils;
  7. import java.io.IOException;
  8. import java.nio.file.Files;
  9. import java.nio.file.Path;
  10. import java.nio.file.Paths;
  11. public class JuziMain {
  12. public static void main(String[] args) throws Exception {
  13. String path = "C:\\file\\安辉152627198009185819.txt";
  14. CreditInfoResponse creditInfoResponse = CreditInfoResponse.builder().orderNo(args[1]).build();
  15. // CreditInfoResponse creditInfoResponse = CreditInfoResponse.builder().orderNo("123").build();
  16. try {
  17. Path path1 = Paths.get(args[0]);
  18. String str = new String(Files.readAllBytes(path1));
  19. CreditInfoRequest creditInfoRequest = JSONObject.parseObject(str, CreditInfoRequest.class);
  20. creditInfoResponse = RuleUtils.handleCreditData(args[1], creditInfoRequest);
  21. } catch (Exception e) {
  22. e.printStackTrace();
  23. creditInfoResponse.setApproveResult(null);
  24. creditInfoResponse.setErrCode(ErrorEnum.ERROR.getCode());
  25. creditInfoResponse.setErrMsg(e.getMessage());
  26. }
  27. System.out.println(JSONObject.toJSONString(creditInfoResponse, SerializerFeature.WriteNonStringValueAsString));
  28. }
  29. }