|
@@ -10,8 +10,7 @@ import com.steerinfo.framework.utils.collection.ListUtils;
|
|
|
import com.steerinfo.baseinfo.meterbasecussupcar.model.MeterBaseCusSupCar;
|
|
import com.steerinfo.baseinfo.meterbasecussupcar.model.MeterBaseCusSupCar;
|
|
|
import com.steerinfo.baseinfo.meterbasecussupcar.service.IMeterBaseCusSupCarService;
|
|
import com.steerinfo.baseinfo.meterbasecussupcar.service.IMeterBaseCusSupCarService;
|
|
|
import com.steerinfo.meterwork.except.MarkerMetException;
|
|
import com.steerinfo.meterwork.except.MarkerMetException;
|
|
|
-import com.steerinfo.util.PublicMethod;
|
|
|
|
|
-import com.steerinfo.util.StringUtils;
|
|
|
|
|
|
|
+import com.steerinfo.util.*;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -219,10 +218,67 @@ public class MeterBaseCusSupCarController extends BaseRESTfulController {
|
|
|
@Transactional
|
|
@Transactional
|
|
|
@PostMapping(value = "/appregister")
|
|
@PostMapping(value = "/appregister")
|
|
|
public RESTfulResult appregister(@RequestBody HashMap params) {
|
|
public RESTfulResult appregister(@RequestBody HashMap params) {
|
|
|
|
|
+ /***
|
|
|
|
|
+ * 注意:做完以后记得把SSO地址抽出去
|
|
|
|
|
+ */
|
|
|
try {
|
|
try {
|
|
|
String msg = "";
|
|
String msg = "";
|
|
|
|
|
|
|
|
- // 注册sso
|
|
|
|
|
|
|
+ // *将司机注册sso账户*
|
|
|
|
|
+ // 使用默认账号登录sso
|
|
|
|
|
+ // 默认账户密码加密
|
|
|
|
|
+ String shaPass = SHAUtil.shaEncode("appuser@123456");
|
|
|
|
|
+ // 获取sso token
|
|
|
|
|
+ // https://jgwzjl.jiugang.com/icore.icp.web/pass/auth/login post请求, 参数类型content-type: application/x-www-form-urlencoded
|
|
|
|
|
+ // loginName=admin&password=fb94871a1c3c7c38330a3a434a0ee28f0deea30b&app_code=web
|
|
|
|
|
+ Map<String, String> loginMap = new HashMap<>();
|
|
|
|
|
+ loginMap.put("loginName", "appuser");
|
|
|
|
|
+ loginMap.put("password", shaPass);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ String ssomsg1 = HttpsRequest.sendPost("https://jgwzjl.jiugang.com/icore.icp.web/pass/auth/login", loginMap);
|
|
|
|
|
+ // ssomsg1转JSONObject
|
|
|
|
|
+ JSONObject jsonObject1 = JSONObject.parseObject(ssomsg1);
|
|
|
|
|
+ //如果成功,读取accessToken
|
|
|
|
|
+ String accessToken = "";
|
|
|
|
|
+ if(jsonObject1.get("code").toString().equals("0")){
|
|
|
|
|
+ String tempData = jsonObject1.get("data").toString();
|
|
|
|
|
+ JSONObject tempObject = JSONObject.parseObject(tempData);
|
|
|
|
|
+ accessToken = tempObject.get("accessToken").toString();
|
|
|
|
|
+
|
|
|
|
|
+ // 新增车辆SSO账号
|
|
|
|
|
+ Map<String, String> userMap = new HashMap<>();
|
|
|
|
|
+ userMap.put("userCode", params.get("cusSupCarNo").toString());
|
|
|
|
|
+ userMap.put("userName", params.get("cusSupCarNo").toString());
|
|
|
|
|
+ userMap.put("orgCode", "123456789");
|
|
|
|
|
+ userMap.put("orgName", "测试机构");
|
|
|
|
|
+ userMap.put("groupData", "506514577756917769");
|
|
|
|
|
+ userMap.put("companyData", "713710108567277568");
|
|
|
|
|
+ userMap.put("groupId", "506514577756917769");
|
|
|
|
|
+ userMap.put("companyId", "713710108567277568");
|
|
|
|
|
+ userMap.put("orgId", "925357747573231616");
|
|
|
|
|
+ userMap.put("loginStatus", "1");
|
|
|
|
|
+ String ssomsg2 = HttpsRequest.sendPost("https://jgwzjl.jiugang.com/icore.icp.web/pass/v1/sysusers/", userMap, accessToken);
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject jsonObject2 = JSONObject.parseObject(ssomsg2);
|
|
|
|
|
+
|
|
|
|
|
+ if(jsonObject2.get("code").toString().equals("0")) {
|
|
|
|
|
+ String tempData2 = jsonObject2.get("data").toString();
|
|
|
|
|
+ JSONObject tempObject2 = JSONObject.parseObject(tempData2);
|
|
|
|
|
+
|
|
|
|
|
+ // 修改用户密码,参数生成
|
|
|
|
|
+ Map<String, String> pwdMap = new HashMap<>();
|
|
|
|
|
+ pwdMap.put("userid", tempObject2.get("userId").toString());
|
|
|
|
|
+ pwdMap.put("prepassword", "123456");
|
|
|
|
|
+ pwdMap.put("newpassword", params.get("password").toString());
|
|
|
|
|
+ pwdMap.put("againNewpassword", params.get("password").toString());
|
|
|
|
|
+
|
|
|
|
|
+ // 修改用户密码
|
|
|
|
|
+ String ssomsg3 = HttpsRequest.sendPost("https://jgwzjl.jiugang.com/icore.icp.web/pass/v1/sysusers/updpsw", pwdMap, accessToken);
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject jsonObject3 = JSONObject.parseObject(ssomsg3);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 拆分司机list,新增客商车辆表
|
|
// 拆分司机list,新增客商车辆表
|
|
|
List<MeterBaseCusSupCar> driverList = JSONObject.parseArray(params.get("driverList").toString(), MeterBaseCusSupCar.class);
|
|
List<MeterBaseCusSupCar> driverList = JSONObject.parseArray(params.get("driverList").toString(), MeterBaseCusSupCar.class);
|
|
@@ -248,9 +304,9 @@ public class MeterBaseCusSupCarController extends BaseRESTfulController {
|
|
|
car.setCreateTime(new Date());
|
|
car.setCreateTime(new Date());
|
|
|
|
|
|
|
|
msg = meterBaseCusSupCarService.checkandadd(car);
|
|
msg = meterBaseCusSupCarService.checkandadd(car);
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(msg)){
|
|
if(StringUtils.isNotEmpty(msg)){
|
|
|
break;
|
|
break;
|
|
@@ -275,7 +331,7 @@ public class MeterBaseCusSupCarController extends BaseRESTfulController {
|
|
|
public RESTfulResult applogin(@RequestBody HashMap params) {
|
|
public RESTfulResult applogin(@RequestBody HashMap params) {
|
|
|
|
|
|
|
|
String msg = "";
|
|
String msg = "";
|
|
|
- String token = "";
|
|
|
|
|
|
|
+ Object ssodata = "";
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
if(params.get("cusSupCarNo") == null || StringUtils.isEmpty(params.get("cusSupCarNo").toString())) {
|
|
if(params.get("cusSupCarNo") == null || StringUtils.isEmpty(params.get("cusSupCarNo").toString())) {
|
|
@@ -292,9 +348,27 @@ public class MeterBaseCusSupCarController extends BaseRESTfulController {
|
|
|
List<MeterBaseCusSupCar> list = meterBaseCusSupCarService.query(params);
|
|
List<MeterBaseCusSupCar> list = meterBaseCusSupCarService.query(params);
|
|
|
if(list.size() >= 1){
|
|
if(list.size() >= 1){
|
|
|
// sso登录
|
|
// sso登录
|
|
|
- System.out.println(list.size());
|
|
|
|
|
- // 返回sso token
|
|
|
|
|
- token = "test token xxxxxxxxx";
|
|
|
|
|
|
|
+ // 密码加密
|
|
|
|
|
+ String shaPass = SHAUtil.shaEncode(params.get("password").toString());
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, String> loginMap = new HashMap<>();
|
|
|
|
|
+ loginMap.put("loginName", params.get("cusSupCarNo").toString());
|
|
|
|
|
+ loginMap.put("password", shaPass);
|
|
|
|
|
+
|
|
|
|
|
+ String ssomsg1 = HttpsRequest.sendPost("https://jgwzjl.jiugang.com/icore.icp.web/pass/auth/login", loginMap);
|
|
|
|
|
+ // ssomsg1转JSONObject
|
|
|
|
|
+ JSONObject jsonObject1 = JSONObject.parseObject(ssomsg1);
|
|
|
|
|
+ //如果成功,读取accessToken
|
|
|
|
|
+ String accessToken = "";
|
|
|
|
|
+ if(jsonObject1.get("code").toString().equals("0")) {
|
|
|
|
|
+ // 返回sso返回的data
|
|
|
|
|
+ ssodata = jsonObject1.get("data");
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ msg = jsonObject1.get("message").toString();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
msg = "没有此车号或手机号";
|
|
msg = "没有此车号或手机号";
|
|
@@ -310,6 +384,92 @@ public class MeterBaseCusSupCarController extends BaseRESTfulController {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return failed(null, "操作异常,请确认!");
|
|
return failed(null, "操作异常,请确认!");
|
|
|
}
|
|
}
|
|
|
- return success(token);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ return success(ssodata);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "app修改密码", notes = "app修改密码")
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ @PostMapping(value = "/appchangepwd")
|
|
|
|
|
+ public RESTfulResult appchangepwd(@RequestBody HashMap params) {
|
|
|
|
|
+
|
|
|
|
|
+ String msg = "";
|
|
|
|
|
+ Object ssodata = "";
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ if(params.get("cusSupCarNo") == null || StringUtils.isEmpty(params.get("cusSupCarNo").toString())) {
|
|
|
|
|
+ msg = "车号不能为空!!";
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(params.get("telNum") == null || StringUtils.isEmpty(params.get("telNum").toString())) {
|
|
|
|
|
+ msg = "手机号不能为空!!";
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ // 状态(0:服役;1:停役;2:删除)
|
|
|
|
|
+ params.put("validFlag", "0");
|
|
|
|
|
+
|
|
|
|
|
+ // 判断车号,司机手机号是否存在
|
|
|
|
|
+ List<MeterBaseCusSupCar> list = meterBaseCusSupCarService.query(params);
|
|
|
|
|
+ if(list.size() >= 1){
|
|
|
|
|
+ // sso登录
|
|
|
|
|
+ // 密码加密
|
|
|
|
|
+ String shaPass = SHAUtil.shaEncode(params.get("oldpassword").toString());
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, String> loginMap = new HashMap<>();
|
|
|
|
|
+ loginMap.put("loginName", params.get("cusSupCarNo").toString());
|
|
|
|
|
+ loginMap.put("password", shaPass);
|
|
|
|
|
+
|
|
|
|
|
+ String ssomsg1 = HttpsRequest.sendPost("https://jgwzjl.jiugang.com/icore.icp.web/pass/auth/login", loginMap);
|
|
|
|
|
+ // ssomsg1转JSONObject
|
|
|
|
|
+ JSONObject jsonObject1 = JSONObject.parseObject(ssomsg1);
|
|
|
|
|
+ //如果成功,读取accessToken
|
|
|
|
|
+ String accessToken = "";
|
|
|
|
|
+ if(jsonObject1.get("code").toString().equals("0")) {
|
|
|
|
|
+ String tempData1 = jsonObject1.get("data").toString();
|
|
|
|
|
+ JSONObject tempObject1 = JSONObject.parseObject(tempData1);
|
|
|
|
|
+ accessToken = tempObject1.get("accessToken").toString();
|
|
|
|
|
+
|
|
|
|
|
+ // 读取用户信息
|
|
|
|
|
+ JSONObject tempObject2 = JSONObject.parseObject(tempObject1.get("user").toString());
|
|
|
|
|
+ // 修改用户密码,参数生成
|
|
|
|
|
+ Map<String, String> pwdMap = new HashMap<>();
|
|
|
|
|
+ pwdMap.put("userid", tempObject2.get("userId").toString());
|
|
|
|
|
+ pwdMap.put("prepassword", params.get("oldpassword").toString());
|
|
|
|
|
+ pwdMap.put("newpassword", params.get("newpassword").toString());
|
|
|
|
|
+ pwdMap.put("againNewpassword", params.get("newpassword").toString());
|
|
|
|
|
+
|
|
|
|
|
+ // 修改用户密码
|
|
|
|
|
+ String ssomsg3 = HttpsRequest.sendPost("https://jgwzjl.jiugang.com/icore.icp.web/pass/v1/sysusers/updpsw", pwdMap, accessToken);
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject jsonObject3 = JSONObject.parseObject(ssomsg3);
|
|
|
|
|
+
|
|
|
|
|
+ if(jsonObject3.get("code").toString().equals("0")) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ msg = jsonObject3.get("message").toString();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ msg = jsonObject1.get("message").toString();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ msg = "没有此车号或手机号";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isNotEmpty(msg)) {
|
|
|
|
|
+ return failed(null, msg);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
|
|
+ return failed(null, "操作异常,请确认!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return success();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|