hutool发送post请求一直报错(bad request);
请求参数:
@RequestBody AddCustomerVO vo
{
"customerFullName":"噢噢科技有限公司",
"netReceiptsCapital":21,
"taxBankNo":"9874345678345",
"establishmentDate":"2021-02-22",
"settlementVO":{
"settlementForm":"bank_account",
"bankBranchName":"士大夫",
"bankNo":"9874345678345",
"bankName":"附属点",
"bankAccountProofPicture":"",
"bankProvince":"陕西省",
"bankAddress":"士大夫",
"bankIdName":"王海",
"bankCity":"商洛市",
"bankDistrict":"柞水县"
},
"source":"SO002",
"customerEnName":"HTAI",
"employeeCount":12,
"socialCreditCode":"9874345665555",
"companyEmail":"1234@qq.com",
"registeredCapital":123,
"legalPerson":"双方的",
"companyFax":"15645334565",
"annualTurnover":12,
"taxAddress":"士大夫撒旦",
"companyZip":"124332",
"enterpriseName":"魂骨科技",
"taxType":"TAX001",
"taxBankName":"士大夫",
"address":"发生发射点",
"companyTel":"15645334565",
"profile":"士大夫好好说说",
"taxCode":"9874345678345",
"taxTel":"15645334565",
"companyAddress":"方式",
"category":"C001",
"taxCompanyName":"噢噢科技有限公司"
}
后端逻辑写法:
String s = JSON.toJSONString(vo);
// JSONObject jsonObject = JSONObject.parseObject(s);
Map<String, Object> objectMap = BeanUtil.beanToMap(vo);
// Long establishmentDate = (Long)objectMap.get("establishmentDate");
Date establishmentDate = (Date) objectMap.get("establishmentDate");
String format = DateUtil.format(DateUtil.date(), "yyyy-MM-dd");
objectMap.put("establishmentDate",format);
HttpRequest httpRequest = HttpRequest.post("http://localhost:9998/company/customer/addEnterpriseCustomer").contentType("application/json").header("X-Request-UserID","1");
String body = httpRequest.form(objectMap).execute().body();
System.out.println(body);
经过postman调试可以请求成功并且没有任何报错,但是用hutool的httpclient就是bad request信息,有大神知道为什么吗?