import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.serializer.SerializerFeature; import com.jzfq.rms.credit.bean.CreditInfoRequest; import com.jzfq.rms.credit.bean.CreditInfoResponse; import com.jzfq.rms.credit.enums.ErrorEnum; import com.jzfq.rms.credit.utils.RuleUtils; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class JuziMain { public static void main(String[] args) throws Exception { String path = "C:\\file\\安辉152627198009185819.txt"; CreditInfoResponse creditInfoResponse = CreditInfoResponse.builder().orderNo(args[1]).build(); // CreditInfoResponse creditInfoResponse = CreditInfoResponse.builder().orderNo("123").build(); try { Path path1 = Paths.get(args[0]); String str = new String(Files.readAllBytes(path1)); CreditInfoRequest creditInfoRequest = JSONObject.parseObject(str, CreditInfoRequest.class); creditInfoResponse = RuleUtils.handleCreditData(args[1], creditInfoRequest); } catch (Exception e) { e.printStackTrace(); creditInfoResponse.setApproveResult(null); creditInfoResponse.setErrCode(ErrorEnum.ERROR.getCode()); creditInfoResponse.setErrMsg(e.getMessage()); } System.out.println(JSONObject.toJSONString(creditInfoResponse, SerializerFeature.WriteNonStringValueAsString)); } }