|
|
@@ -281,14 +281,17 @@ public class MeterBaseCarController extends BaseRESTfulController {
|
|
|
@PostMapping(value = "/applogin")
|
|
|
public RESTfulResult applogin(@RequestBody HashMap params) {
|
|
|
|
|
|
- String msg = "";
|
|
|
+ RESTfulResult rm = failed();
|
|
|
Object ssodata = "";
|
|
|
|
|
|
+ HashMap<String, Object> info = new HashMap();
|
|
|
try {
|
|
|
if (params.get("carNo") == null || com.steerinfo.util.StringUtils.isEmpty(params.get("carNo").toString())) {
|
|
|
- msg = "车号不能为空!!";
|
|
|
+ rm.setMessage("车号不能为空!!");
|
|
|
+ return rm;
|
|
|
} else if (params.get("telNum") == null || com.steerinfo.util.StringUtils.isEmpty(params.get("telNum").toString())) {
|
|
|
- msg = "手机号不能为空!!";
|
|
|
+ rm.setMessage("手机号不能为空!!");
|
|
|
+ return rm;
|
|
|
} else {
|
|
|
// 状态(0:服役;1:停役;2:删除)
|
|
|
params.put("validFlag", "0");
|
|
|
@@ -297,32 +300,38 @@ public class MeterBaseCarController extends BaseRESTfulController {
|
|
|
List<MeterBaseCusSupCar> list = meterBaseDriverService.query(params);
|
|
|
if (list.size() >= 1) {
|
|
|
// sso登录
|
|
|
-
|
|
|
SSOUtil ssoUtil = new SSOUtil();
|
|
|
HashMap map = ssoUtil.ssoLogin(params, "");
|
|
|
|
|
|
if (map.get("code").toString().equals("0")) {
|
|
|
ssodata = map.get("data").toString();
|
|
|
+ info.put("ssoData", ssodata);
|
|
|
+ HashMap<String, Object> carInfoMap = new HashMap<>();
|
|
|
+ carInfoMap.put("carNo", params.get("carNo"));
|
|
|
+ List<MeterBaseCar> carInfo = meterBaseCarMapper.selectByParameters(carInfoMap);
|
|
|
+ if(carInfo.size() >= 1){
|
|
|
+ info.put("carInfo", carInfo);
|
|
|
+ rm.setData(info);
|
|
|
+ rm.setMessage("操作成功");
|
|
|
+ rm = success();
|
|
|
+ return rm;
|
|
|
+ }else{
|
|
|
+ rm.setMessage("车辆配置信息表没有此车号");
|
|
|
+ return rm;
|
|
|
+ }
|
|
|
} else {
|
|
|
- msg = map.get("msg").toString();
|
|
|
+ rm.setMessage(map.get("msg").toString());
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
- msg = "没有此车号或手机号";
|
|
|
+ rm.setMessage("没有此车号或手机号");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (com.steerinfo.util.StringUtils.isNotEmpty(msg)) {
|
|
|
- return failed(null, msg);
|
|
|
- }
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return failed(null, "操作异常,请确认!");
|
|
|
}
|
|
|
-
|
|
|
- return success(ssodata);
|
|
|
+ return rm;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "app非司机登录", notes = "app非司机登录")
|
|
|
@@ -376,8 +385,8 @@ public class MeterBaseCarController extends BaseRESTfulController {
|
|
|
RESTfulResult rm = failed();
|
|
|
String carNo = params.get("carNo").toString();
|
|
|
String telNum = params.get("telNum").toString();
|
|
|
- String passWord = params.get("passWord").toString();
|
|
|
- String passCode = params.get("passCode").toString();
|
|
|
+ String passWord = params.get("newpassword").toString();
|
|
|
+ String passCode = params.get("code").toString();
|
|
|
try {
|
|
|
if (carNo == null || com.steerinfo.util.StringUtils.isEmpty(carNo)) {
|
|
|
rm.setMessage("车号不能为空!!");
|
|
|
@@ -399,7 +408,8 @@ public class MeterBaseCarController extends BaseRESTfulController {
|
|
|
//当前时间是否在过期时间之内
|
|
|
Date date = new Date();
|
|
|
//验证码是否过期
|
|
|
- if(date.compareTo(modelTemp.getExpirationTime()) > 0){
|
|
|
+ int flag = date.compareTo(modelTemp.getExpirationTime());
|
|
|
+ if(flag > 0 || modelTemp.getValueFlag().equals("0")){
|
|
|
rm.setMessage("验证码已过期,请重新发送验证码!!");
|
|
|
modelTemp.setValueFlag("0");
|
|
|
appVerificationCodeMapper.updateByPrimaryKey(modelTemp);
|
|
|
@@ -436,6 +446,83 @@ public class MeterBaseCarController extends BaseRESTfulController {
|
|
|
return success();
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "通过手机发送验证码重置密码", notes = "app重置密码")
|
|
|
+ @Transactional
|
|
|
+ @PostMapping(value = "/appreSetPwdByCode")
|
|
|
+ public RESTfulResult appreSetPwdByCode(@RequestBody HashMap params) {
|
|
|
+ RESTfulResult rm = failed();
|
|
|
+
|
|
|
+ rm.setMessage("");
|
|
|
+ String carNo = params.get("carNo").toString();
|
|
|
+ String telNum = params.get("telNum").toString();
|
|
|
+ String passWord = params.get("password").toString();
|
|
|
+ String passCode = params.get("code").toString();
|
|
|
+ try {
|
|
|
+ if (carNo == null || com.steerinfo.util.StringUtils.isEmpty(carNo)) {
|
|
|
+ rm.setMessage("车号不能为空!!");
|
|
|
+ return rm;
|
|
|
+ } else if (telNum == null || com.steerinfo.util.StringUtils.isEmpty(telNum)) {
|
|
|
+ rm.setMessage("手机号不能为空!!");
|
|
|
+ return rm;
|
|
|
+ } else if (passWord == null || com.steerinfo.util.StringUtils.isEmpty(passWord)) {
|
|
|
+ rm.setMessage("新密码不能为空!!");
|
|
|
+ return rm;
|
|
|
+ } else if(passCode == null || com.steerinfo.util.StringUtils.isEmpty(passCode)) {
|
|
|
+ rm.setMessage("验证码不能为空!!");
|
|
|
+ return rm;
|
|
|
+ } else {
|
|
|
+ //通过手机获取验证码列表
|
|
|
+ AppVerificationCode modelTemp = appVerificationCodeMapper.selectByPhone(telNum);
|
|
|
+ if(modelTemp!=null){
|
|
|
+ //当前时间是否在过期时间之内
|
|
|
+ Date date = new Date();
|
|
|
+ //验证码是否过期
|
|
|
+ int flag = date.compareTo(modelTemp.getExpirationTime());
|
|
|
+ if(flag > 0 || modelTemp.getValueFlag().equals("0")){
|
|
|
+ rm.setMessage("验证码已过期,请重新发送验证码!!");
|
|
|
+ modelTemp.setValueFlag("0");
|
|
|
+ appVerificationCodeMapper.updateByPrimaryKey(modelTemp);
|
|
|
+ return rm;
|
|
|
+ }
|
|
|
+ //验证码没过期且相等
|
|
|
+ if(modelTemp.getCode().equals(passCode) && modelTemp.getValueFlag().equals("1")){
|
|
|
+ modelTemp.setValueFlag("0");
|
|
|
+ appVerificationCodeMapper.updateByPrimaryKey(modelTemp);
|
|
|
+ // 判断车号,司机手机号是否存在
|
|
|
+ List<MeterBaseDriver> list = meterBaseDriverService.query(params);
|
|
|
+ if (list.size() >= 1) {
|
|
|
+ // 获取车辆SSO ID
|
|
|
+ HashMap queryMap = new HashMap();
|
|
|
+ queryMap.put("carNo", params.get("carNo").toString());
|
|
|
+
|
|
|
+ MeterBaseCar car = meterBaseCarService.getByParams(queryMap);
|
|
|
+
|
|
|
+ // 通过车辆SSO ID重置密码
|
|
|
+ if (car != null) {
|
|
|
+ // SSO重置密码
|
|
|
+ SSOUtil ssoUtil = new SSOUtil();
|
|
|
+ rm.setMessage(ssoUtil.ssoResetPwd(car.getSsoId(), params.get("password").toString(), ""));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ rm.setMessage("没有此车号或手机号");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (com.steerinfo.util.StringUtils.isNotEmpty(rm.getMessage())) {
|
|
|
+ return failed(null, rm.getMessage());
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ rm.setMessage("验证码有误!!");
|
|
|
+ return rm;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return failed(null, "操作异常,请确认!");
|
|
|
+ }
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "app重置密码", notes = "app重置密码")
|
|
|
@Transactional
|
|
|
@PostMapping(value = "/appresetpwd")
|
|
|
@@ -485,7 +572,6 @@ public class MeterBaseCarController extends BaseRESTfulController {
|
|
|
return success();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@ApiOperation(value = "web重置密码", notes = "web重置密码")
|
|
|
@Transactional
|
|
|
@PostMapping(value = "/webresetpwd")
|