Commit 3f683aac authored by yangtianyou's avatar yangtianyou

Merge remote-tracking branch 'origin/master'

parents 4043fe7e fa13d4bd
......@@ -43,6 +43,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -117,104 +118,32 @@ public class ChinaMobileRestApiController extends BaseController {
//用户登录是否被锁定 一小时 redisKey 前缀
private static final String SHIRO_IS_LOCK = "shiro_is_lock_";
// /**
// * 管理员ajax登录请求 后端用户登录
// *
// * @param username
// * @param password
// * @return
// */
// @RequestMapping(value = "/user/webLogin", method = RequestMethod.POST)
// public ResponseEntity<JSONObject> login(@RequestParam(value = "username") String username,
// @RequestParam(value = "password") String password,
// @RequestParam(value = "boxNo") String boxNo) {
// JSONObject resultMap = new JSONObject(true);
// Employee employee;
// if (StringUtils.isNoneBlank(username)) {
// //访问一次,计数一次
// ValueOperations<String, String> opsForValue = stringRedisTemplate.opsForValue();
// if ("LOCK".equals(opsForValue.get(SHIRO_IS_LOCK + username))) {
// resultMap.put("status", 400);
// resultMap.put("message", "由于密码输入错误次数大于5次,12小时内帐号已禁止登录!请您联系相关管理人员,联系电话:13924551212,邮箱:325346534@zh.com。");
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(resultMap);
// }
// employee = employeeService.selectByUsername(username);
// if (employee == null) {
// resultMap.put("status", 500);
// resultMap.put("message", "用户名或密码不正确!");
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(resultMap);
// }
// try {
// byte[] salt = employee.getPasswordSalt();
// if (!new String(SHA256PasswordEncryptionService.createPasswordHash(password, salt)).equals(new String(employee.getPasswordHash()))) {
// opsForValue.increment(SHIRO_LOGIN_COUNT + username, 1);
// //计数大于5时,设置用户被锁定一小时
// String s = opsForValue.get(SHIRO_LOGIN_COUNT + username);
// if (StringUtils.isNotBlank(s)) {
// if (Integer.parseInt(s) >= 5) {
// opsForValue.set(SHIRO_IS_LOCK + username, "LOCK");
// stringRedisTemplate.expire(SHIRO_IS_LOCK + username, 12, TimeUnit.HOURS);
// }
// }
// throw new IncorrectCredentialsException("用户名或密码不正确!");
// }
// String token = JwtTokenUtil.sign(username, employee.getId());
// // 将token信息存入Redis
// stringRedisTemplate.opsForValue().set(SHIRO_JWT_TOKEN + token, employee.getId(), 240, TimeUnit.MINUTES);
//
// JSONObject jsonObject = new JSONObject(true);
// jsonObject.put("token", token);
// jsonObject.put("userId", employee.getId());
// jsonObject.put("userName", employee.getUsername());
// jsonObject.put("expire", TimeUtils.format(LocalDateTime.now().plusMinutes(240), TimeUtils.FORMAT_ONE));
// jsonObject.put("orgCode", "");
// jsonObject.put("orgName", "");
//
// resultMap.put("resultCode", 200);
// resultMap.put("message", "成功");
// resultMap.put("data", jsonObject);
// return ResponseEntity.status(HttpStatus.OK).body(resultMap);
// } catch (Exception e) {
// resultMap.put("status", 500);
// resultMap.put("message", e.getMessage());
// }
// }
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(resultMap);
// }
//
// @ApiOperation(value = "获取单个成员信息")
// @GetMapping(value = "/user/getUserInfo")
// public ResponseEntity<JSONObject> getById(String userId, @RequestHeader("token") String token) {
// try {
// Employee employee = employeeService.selectByEmpId(userId);
//
// if (null == employee) {
// return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
// }
//
// JSONObject jsonObject = new JSONObject(true);
// jsonObject.put("token", token);
// jsonObject.put("userId", employee.getId());
// jsonObject.put("userName", employee.getUsername());
// long expire = stringRedisTemplate.getExpire(SHIRO_JWT_TOKEN + token) == null ? 0L : stringRedisTemplate.getExpire(SHIRO_JWT_TOKEN + token);
// jsonObject.put("expire", TimeUtils.format(LocalDateTime.now().plusMinutes(expire), TimeUtils.FORMAT_ONE));
//// BankBranchInfo bankBranch = this.employeeService.getById(Id);
//// if (bankBranch != null) {
//// employee.setBankBranchName(bankBranch.getName());
//// }
// jsonObject.put("orgCode", "");
// jsonObject.put("orgName", "");
//
// JSONObject resultMap = new JSONObject(true);
// resultMap.put("resultCode", 200);
// resultMap.put("message", "成功");
// resultMap.put("data", jsonObject);
// return ResponseEntity.ok(resultMap);
// } catch (Exception e) {
// logger.error("查询成员信息错误!", e);
// }
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
// }
/**
* 机顶盒激活状态查询
*
* @param
* @return
*/
@ApiOperation(value = "机顶盒激活状态查询", notes = "机顶盒激活状态查询")
@GetMapping("/equitment/activity")
@RequiresPermissions("/equitment/activity/")
public Map<String, Object> getActivity(@RequestParam(required = true) String mac) {
List<TBoxOperation> list = new ArrayList<>();
try {
UpdateWrapper<TBoxOperation> wrapper = new UpdateWrapper<>();
wrapper.eq("mac", mac);
list = boxOperationService.list(wrapper);
HashMap<Object, Object> map = new HashMap<>();
map.put("activityStatus", false);
if (list != null && list.get(0) != null && 2 == list.get(0).getStatus()) {
map.put("activityStatus", true);
}
return getResult(map);
} catch (Exception e) {
e.printStackTrace();
}
return getFailResult();
}
/**
......@@ -638,10 +567,10 @@ public class ChinaMobileRestApiController extends BaseController {
current = currentList.get(0);
}
Map map = new HashMap();
map.put("isLatest",versionNo.equals(current.getAppVersion()));
map.put("versionNo",current.getAppVersion());
map.put("versionUrl",current.getApkUrl());
map.put("updateLog",current.getUpdateLog());
map.put("isLatest", versionNo.equals(current.getAppVersion()));
map.put("versionNo", current.getAppVersion());
map.put("versionUrl", current.getApkUrl());
map.put("updateLog", current.getUpdateLog());
map.put("updateTime", current.getUpdateTime());
return getResult(map);
}
......@@ -670,8 +599,8 @@ public class ChinaMobileRestApiController extends BaseController {
}
Map map = new HashMap();
map.put("dirImgUrl",currentDir != null? currentDir.getAppDirPic() : "未设置目录图片");
map.put("runImgUrl",currentRun != null ? currentRun.getAppRunPic() : "未设置运行图片");
map.put("dirImgUrl", currentDir != null ? currentDir.getAppDirPic() : "未设置目录图片");
map.put("runImgUrl", currentRun != null ? currentRun.getAppRunPic() : "未设置运行图片");
return getResult(map);
}
}
......@@ -218,6 +218,8 @@ public class TBoxOperationController extends BaseController {
return getFailResult();
}
public String getAreaId(String areaId){
if ("00".equals(areaId.substring(4))) {
areaId = areaId.substring(0, 4);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment