调整接口
This commit is contained in:
@@ -32,8 +32,8 @@ public class EncryptDemo {
|
|||||||
" \"installedAddress\": \"世茂大道\",\n" +
|
" \"installedAddress\": \"世茂大道\",\n" +
|
||||||
" \"number\": \"17301750842\"\n" +
|
" \"number\": \"17301750842\"\n" +
|
||||||
"}";
|
"}";
|
||||||
|
String c = "\"serialNumber\": \"5fc6023a2b7749a18c3663f27812c7cd\"";
|
||||||
System.out.println(sm2.encryptBase64(b, KeyType.PublicKey));
|
System.out.println(sm2.encryptBase64(c, KeyType.PublicKey));
|
||||||
// System.out.println(encryptStr3);
|
// System.out.println(encryptStr3);
|
||||||
// 使用SM2解密字符串
|
// 使用SM2解密字符串
|
||||||
// String data = sm2.decryptStr("BI7jtmBaoB+O0E/5qbBZd35h5M/BGhLcCB0kOM5ONebPJNC7+mS404aeYpqQEmW5caqLYX9y6eV87tOKwWC3bs+ns83SHA8k1yMMTZrHKooPAH28ylgrgv/jZZbw7Xtsfxm3+XjWUQDmacHrYujwlhCiAHRxAEIot/3fvSkVB49gHjaDj7ER0NQCKUwVt5xLXgJlCHyYsWmY+ZWj6LmzBzIdND1IFQIEx3iKDuXAgZ05ojQb+y27YlI1TLKn36eTOlhifdnOG89UN1UWkMZuZ8m5qnaMyR7bT+7LazIyBvgAGMkgGpCNwVBXT4t5y+/nRvHwYkURGGO7DLgybL5/KtZ74yemZ52tqgU8pm4HWNWncdZ7veeu55gwUe8ttt3C8UtTwtSYlrRpfoWTSwE8rBtvl//MZWkNXqePCnO1QIQYhKiX5GopqjlxFLlr0CirW0/fhA==", KeyType.PrivateKey);
|
// String data = sm2.decryptStr("BI7jtmBaoB+O0E/5qbBZd35h5M/BGhLcCB0kOM5ONebPJNC7+mS404aeYpqQEmW5caqLYX9y6eV87tOKwWC3bs+ns83SHA8k1yMMTZrHKooPAH28ylgrgv/jZZbw7Xtsfxm3+XjWUQDmacHrYujwlhCiAHRxAEIot/3fvSkVB49gHjaDj7ER0NQCKUwVt5xLXgJlCHyYsWmY+ZWj6LmzBzIdND1IFQIEx3iKDuXAgZ05ojQb+y27YlI1TLKn36eTOlhifdnOG89UN1UWkMZuZ8m5qnaMyR7bT+7LazIyBvgAGMkgGpCNwVBXT4t5y+/nRvHwYkURGGO7DLgybL5/KtZ74yemZ52tqgU8pm4HWNWncdZ7veeu55gwUe8ttt3C8UtTwtSYlrRpfoWTSwE8rBtvl//MZWkNXqePCnO1QIQYhKiX5GopqjlxFLlr0CirW0/fhA==", KeyType.PrivateKey);
|
||||||
|
|||||||
@@ -253,24 +253,173 @@ public class APIControllerV2 extends BaseController {
|
|||||||
paramMap.set("name", agentOrderBo.getName());
|
paramMap.set("name", agentOrderBo.getName());
|
||||||
paramMap.set("idCard", agentOrderBo.getIdCard());
|
paramMap.set("idCard", agentOrderBo.getIdCard());
|
||||||
paramMap.set("contactMobile", agentOrderBo.getContactMobile());
|
paramMap.set("contactMobile", agentOrderBo.getContactMobile());
|
||||||
// if (ObjectUtils.isNotNull(agentAccountVo.getVerifyUrl())) {
|
if (ObjectUtils.isNotNull(agentAccountVo.getVerifyUrl())) {
|
||||||
// try {
|
try {
|
||||||
// String verifyResult = HttpUtil.post(agentAccountVo.getVerifyUrl(), sm2.encryptBase64(paramMap.toString(), KeyType.PublicKey));
|
String verifyResult = HttpUtil.post(agentAccountVo.getVerifyUrl(), sm2.encryptBase64(paramMap.toString(), KeyType.PublicKey));
|
||||||
// JSONObject verifyData = JSONUtil.parseObj(verifyResult);
|
JSONObject verifyData = JSONUtil.parseObj(verifyResult);
|
||||||
// if (verifyData.getInt("code") != 200) {
|
if (verifyData.getInt("code") != 200) {
|
||||||
// log.error("验证不通过");
|
log.error("验证不通过");
|
||||||
// saveLog(request, agentAccountVo.getPersonnelId(), 0, "验证不通过", null);
|
saveLog(request, agentAccountVo.getPersonnelId(), 0, "验证不通过", null);
|
||||||
// return R.fail(ERROR_CODE_VERIFY, "验证错误");
|
return R.fail(ERROR_CODE_VERIFY, "验证错误");
|
||||||
// }
|
}
|
||||||
// } catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// e.printStackTrace();
|
e.printStackTrace();
|
||||||
// log.error("验证请求错误");
|
log.error("验证请求错误");
|
||||||
// saveLog(request, agentAccountVo.getPersonnelId(), 0, "验证请求错误", null);
|
saveLog(request, agentAccountVo.getPersonnelId(), 0, "验证请求错误", null);
|
||||||
// return R.fail(ERROR_CODE_VERIFY, "验证错误");
|
return R.fail(ERROR_CODE_VERIFY, "验证错误");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
//
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
agentOrderService.insertByBo(agentOrderBo);
|
||||||
|
return R.ok("操作成功", agentOrderBo.getSerialNumber());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("confirmOrderBaseInfoOffline")
|
||||||
|
public R<String> confirmOrderBaseInfoOffline(HttpServletRequest request, @RequestBody String body) {
|
||||||
|
if (!checkAccount(request)) {
|
||||||
|
return R.fail(ERROR_CODE_LOGIN, request.getAttribute("msg").toString());
|
||||||
|
}
|
||||||
|
AgentAccountVo agentAccountVo = (AgentAccountVo) request.getAttribute("agentAccount");
|
||||||
|
try {
|
||||||
|
SM2 sm2 = (SM2) request.getAttribute("sm2");
|
||||||
|
body = sm2.decryptStr(body, KeyType.PrivateKey);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("数据解密错误");
|
||||||
|
saveLog(request, agentAccountVo.getPersonnelId(), 0, "数据解密错误", null);
|
||||||
|
return R.fail(ERROR_CODE_ENCRYPT, "数据解密错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject requestBody = JSONUtil.parseObj(body);
|
||||||
|
System.out.println("requestBody = " + requestBody);
|
||||||
|
AgentOrderBo agentOrderBo = requestBody.toBean(AgentOrderBo.class);
|
||||||
|
// 填充固定数据
|
||||||
|
agentOrderBo.setAgentName(agentAccountVo.getAgentName());
|
||||||
|
agentOrderBo.setAgentId(agentAccountVo.getAgentId());
|
||||||
|
agentOrderBo.setStoreId("13");
|
||||||
|
agentOrderBo.setSerialNumber(UUID.randomUUID().toString().replace("-", ""));
|
||||||
|
agentOrderBo.setStatus("0");
|
||||||
|
agentOrderBo.setPersonnelId(agentAccountVo.getPersonnelId());
|
||||||
|
agentOrderBo.setCreateTime(new Date());
|
||||||
|
AgentAccountGoodVo agentAccountGoodVo;
|
||||||
|
SM2 sm2 = (SM2) request.getAttribute("sm2");
|
||||||
|
{
|
||||||
|
// 校验数据
|
||||||
|
// 校验gid
|
||||||
|
String saleId = requestBody.getStr("saleId");
|
||||||
|
if (ObjectUtils.isNull(saleId)) {
|
||||||
|
log.error("saleId为空");
|
||||||
|
saveLog(request, agentAccountVo.getPersonnelId(), 0, "saleId为空", null);
|
||||||
|
return R.fail(ERROR_CODE_PARAMS, "参数错误");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
agentAccountGoodVo = agentAccountGoodService.getByGoodAndAccount(saleId, agentAccountVo.getId());
|
||||||
|
agentOrderBo.setAgentAccountId(agentAccountGoodVo.getId());
|
||||||
|
agentOrderBo.setSaleId(agentAccountGoodVo.getSaleId());
|
||||||
|
GoodVo goodVo = goodService.queryById(agentAccountGoodVo.getGoodId());
|
||||||
|
agentOrderBo.setTitle(goodVo.getName());
|
||||||
|
agentOrderBo.setContent(goodVo.getContent());
|
||||||
|
|
||||||
|
if (ObjectUtils.isNull(agentAccountGoodVo)) {
|
||||||
|
log.error("saleId无效");
|
||||||
|
saveLog(request, agentAccountVo.getPersonnelId(), 0, "saleId无效", null);
|
||||||
|
return R.fail(ERROR_CODE_PARAMS, "参数错误");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("saleId格式错误");
|
||||||
|
saveLog(request, agentAccountVo.getPersonnelId(), 0, "saleId格式错误", null);
|
||||||
|
return R.fail(ERROR_CODE_PARAMS, "参数错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验用户信息,姓名、身份证、手机号
|
||||||
|
if (ObjectUtils.isNull(agentOrderBo.getName())) {
|
||||||
|
log.error("姓名为空");
|
||||||
|
saveLog(request, agentAccountVo.getPersonnelId(), 0, "姓名为空", null);
|
||||||
|
return R.fail(ERROR_CODE_PARAMS, "参数错误");
|
||||||
|
}
|
||||||
|
if (ObjectUtils.isNull(agentOrderBo.getIdCard())) {
|
||||||
|
log.error("身份证号为空");
|
||||||
|
saveLog(request, agentAccountVo.getPersonnelId(), 0, "身份证号为空", null);
|
||||||
|
return R.fail(ERROR_CODE_PARAMS, "参数错误");
|
||||||
|
}
|
||||||
|
// String regex = "^\\d{17}[Xx]|\\d{15}$";
|
||||||
|
// Pattern pattern = Pattern.compile(regex);
|
||||||
|
// Matcher matcher = pattern.matcher(agentOrderBo.getIdCard());
|
||||||
|
// if (!matcher.matches()) {
|
||||||
|
// log.error("身份证号格式错误");
|
||||||
|
// saveLog(request, agentAccountVo.getPersonnelId(), 0, "身份证号格式错误", null);
|
||||||
|
// return R.fail(ERROR_CODE_PARAMS, "参数错误");
|
||||||
// }
|
// }
|
||||||
|
if (ObjectUtils.isNull(agentOrderBo.getContactMobile())) {
|
||||||
|
log.error("手机号为空");
|
||||||
|
saveLog(request, agentAccountVo.getPersonnelId(), 0, "手机号为空", null);
|
||||||
|
return R.fail(ERROR_CODE_PARAMS, "参数错误");
|
||||||
|
}
|
||||||
|
// regex = "^1[3-9]\\d{9}$";
|
||||||
|
// pattern = Pattern.compile(regex);
|
||||||
|
// matcher = pattern.matcher(agentOrderBo.getContactMobile());
|
||||||
|
// if (!matcher.matches()) {
|
||||||
|
// log.error("手机号格式错误");
|
||||||
|
// saveLog(request, agentAccountVo.getPersonnelId(), 0, "手机号格式错误", null);
|
||||||
|
// return R.fail(ERROR_CODE_PARAMS, "参数错误");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 校验地址信息
|
||||||
|
// if (ObjectUtils.isNull(agentOrderBo.getProvince())) {
|
||||||
|
// log.error("省为空");
|
||||||
|
// saveLog(request, agentAccountVo.getPersonnelId(), 0, "省为空", null);
|
||||||
|
// return R.fail(ERROR_CODE_PARAMS, "参数错误");
|
||||||
|
// }
|
||||||
|
agentOrderBo.setProvince("上海市");
|
||||||
|
// if (ObjectUtils.isNull(agentOrderBo.getCity())) {
|
||||||
|
// log.error("市为空");
|
||||||
|
// saveLog(request, agentAccountVo.getPersonnelId(), 0, "市为空", null);
|
||||||
|
// return R.fail(ERROR_CODE_PARAMS, "参数错误");
|
||||||
|
// }
|
||||||
|
agentOrderBo.setCity("上海市");
|
||||||
|
// if (ObjectUtils.isNull(agentOrderBo.getCounty())) {
|
||||||
|
// log.error("区为空");
|
||||||
|
// saveLog(request, agentAccountVo.getPersonnelId(), 0, "区为空", null);
|
||||||
|
// return R.fail(ERROR_CODE_PARAMS, "参数错误");
|
||||||
|
// }
|
||||||
|
agentOrderBo.setCity("黄浦区");
|
||||||
|
// if (ObjectUtils.isNull(agentOrderBo.getInstalledAddress())) {
|
||||||
|
// log.error("地址为空");
|
||||||
|
// saveLog(request, agentAccountVo.getPersonnelId(), 0, "地址为空", null);
|
||||||
|
// return R.fail(ERROR_CODE_PARAMS, "参数错误");
|
||||||
|
// }
|
||||||
|
// if (ObjectUtils.isNull(agentOrderBo.getInstallAddress())) {
|
||||||
|
// agentOrderBo.setInstallAddress(agentOrderBo.getInstalledAddress());
|
||||||
|
// }
|
||||||
|
agentOrderBo.setInstallAddress("南京西路1号");
|
||||||
|
agentOrderBo.setInstalledAddress("南京西路1号");
|
||||||
|
agentOrderBo.setIsExpress(0);
|
||||||
|
// todo 根据代理商提供的验证url验证用户
|
||||||
|
JSONObject paramMap = new JSONObject();
|
||||||
|
paramMap.set("name", agentOrderBo.getName());
|
||||||
|
paramMap.set("idCard", agentOrderBo.getIdCard());
|
||||||
|
paramMap.set("contactMobile", agentOrderBo.getContactMobile());
|
||||||
|
if (ObjectUtils.isNotNull(agentAccountVo.getVerifyUrl())) {
|
||||||
|
try {
|
||||||
|
String verifyResult = HttpUtil.post(agentAccountVo.getVerifyUrl(), sm2.encryptBase64(paramMap.toString(), KeyType.PublicKey));
|
||||||
|
JSONObject verifyData = JSONUtil.parseObj(verifyResult);
|
||||||
|
if (verifyData.getInt("code") != 200) {
|
||||||
|
log.error("验证不通过");
|
||||||
|
saveLog(request, agentAccountVo.getPersonnelId(), 0, "验证不通过", null);
|
||||||
|
return R.fail(ERROR_CODE_VERIFY, "验证错误");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("验证请求错误");
|
||||||
|
saveLog(request, agentAccountVo.getPersonnelId(), 0, "验证请求错误", null);
|
||||||
|
return R.fail(ERROR_CODE_VERIFY, "验证错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存数据
|
// 保存数据
|
||||||
@@ -306,6 +455,7 @@ public class APIControllerV2 extends BaseController {
|
|||||||
agentOrderVo.getIdCard(), requestBody.getStr("type"), agentOrderVo.getUploadMsgId(), requestBody.getStr("img"));
|
agentOrderVo.getIdCard(), requestBody.getStr("type"), agentOrderVo.getUploadMsgId(), requestBody.getStr("img"));
|
||||||
if (response.isSuccess()) {
|
if (response.isSuccess()) {
|
||||||
AgentOrderBo agentOrderBo = new AgentOrderBo();
|
AgentOrderBo agentOrderBo = new AgentOrderBo();
|
||||||
|
agentOrderBo.setApiVersion("V2.0.0");
|
||||||
agentOrderBo.setId(agentOrderVo.getId());
|
agentOrderBo.setId(agentOrderVo.getId());
|
||||||
agentOrderBo.setUploadMsgId(response.getData());
|
agentOrderBo.setUploadMsgId(response.getData());
|
||||||
if (requestBody.getStr("type").equals("idCardFront")) {
|
if (requestBody.getStr("type").equals("idCardFront")) {
|
||||||
|
|||||||
@@ -197,21 +197,13 @@ public class CTServiceImpl implements CTService {
|
|||||||
body.put("name", name);
|
body.put("name", name);
|
||||||
body.put("idCard", idCard);
|
body.put("idCard", idCard);
|
||||||
body.put("contactMobile", contactMobile);
|
body.put("contactMobile", contactMobile);
|
||||||
if (ObjectUtil.isNotNull(installedAddress)) {
|
body.put("installedAddress", installedAddress);
|
||||||
body.put("installedAddress", installedAddress);
|
|
||||||
}
|
|
||||||
body.put("saleId", saleId);
|
body.put("saleId", saleId);
|
||||||
body.put("storeId", storeId);
|
body.put("storeId", storeId);
|
||||||
body.put("personnelId", personnelId);
|
body.put("personnelId", personnelId);
|
||||||
if (ObjectUtil.isNotNull(province)) {
|
body.put("province", province);
|
||||||
body.put("province", province);
|
body.put("city", city);
|
||||||
}
|
body.put("county", county);
|
||||||
if (ObjectUtil.isNotNull(city)) {
|
|
||||||
body.put("city", city);
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotNull(county)) {
|
|
||||||
body.put("county", county);
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNull(installedAddress) || ObjectUtil.isNull(province) || ObjectUtil.isNull(city) || ObjectUtil.isNull(county)) {
|
if (ObjectUtil.isNull(installedAddress) || ObjectUtil.isNull(province) || ObjectUtil.isNull(city) || ObjectUtil.isNull(county)) {
|
||||||
body.put("deliveryMethod", "2");
|
body.put("deliveryMethod", "2");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user