|
@@ -4,17 +4,17 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.common.util.JwtUtil;
|
|
|
import com.fdkankan.manage_jp.common.Result;
|
|
|
+import com.fdkankan.manage_jp.common.ResultCode;
|
|
|
import com.fdkankan.manage_jp.entity.*;
|
|
|
+import com.fdkankan.manage_jp.exception.BusinessException;
|
|
|
import com.fdkankan.manage_jp.httpClient.service.LaserService;
|
|
|
import com.fdkankan.manage_jp.mapper.ISceneProMapper;
|
|
|
import com.fdkankan.manage_jp.service.*;
|
|
|
import com.fdkankan.manage_jp.vo.request.SceneParam;
|
|
|
import com.fdkankan.manage_jp.vo.response.SceneVo;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
@@ -101,9 +101,15 @@ public class LaserController extends BaseController{
|
|
|
ISceneProMapper sceneProMapper;
|
|
|
|
|
|
@GetMapping("/getNumListByUserName")
|
|
|
- public Result getNumListByUserName(@RequestParam(required = false)String userName){
|
|
|
+ public Result getNumListByUserName(@RequestParam(required = false)String userName, @RequestHeader String token){
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("list",new ArrayList<>());
|
|
|
+ if(StringUtils.isBlank(userName) && StringUtils.isBlank(token)) {
|
|
|
+ throw new BusinessException(ResultCode.PARAM_ERROR);
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(token)){
|
|
|
+ userName = JwtUtil.getUsername(token);
|
|
|
+ }
|
|
|
User user = userService.getByUserName(userName);
|
|
|
if(user == null){
|
|
|
return Result.success(jsonObject);
|
|
@@ -113,16 +119,26 @@ public class LaserController extends BaseController{
|
|
|
sceneParam.setPageNum(1);
|
|
|
sceneParam.setPageSize(99999);
|
|
|
sceneParam.setType(2);
|
|
|
- if(!roleIds.contains(5L)){
|
|
|
+ List<String> numList = new ArrayList<>();
|
|
|
+ if(!roleIds.contains(5L)){ //平台管理员
|
|
|
sceneParam.setCompanyId(user.getCompanyId());
|
|
|
sceneParam.setUserId(user.getId());
|
|
|
+ sceneParam.setNeStatus(-2);
|
|
|
+ if(!roleIds.contains(6L)){
|
|
|
+ sceneParam.setIsDel(false);
|
|
|
+ sceneParam.setIsMain(false);
|
|
|
+ sceneParam.setIsMigrate(false);
|
|
|
+ }
|
|
|
+ numList = tmContractorNumService.getNumListByCompanyId(user.getCompanyId());
|
|
|
+ sceneParam.setCooperateSceneCodes(numList);
|
|
|
}
|
|
|
-// if(!roleIds.contains(6L) && !roleIds.contains(5L)){
|
|
|
-// sceneParam.setUserId(user.getId());
|
|
|
-// }
|
|
|
+
|
|
|
Page<SceneVo> page = sceneProMapper.pageList(new Page<>(sceneParam.getPageNum(),sceneParam.getPageSize()),sceneParam);
|
|
|
- List<String> numList = page.getRecords().stream().map(SceneVo::getNum).collect(Collectors.toList());
|
|
|
- jsonObject.put("list",numList);
|
|
|
+ sceneParam.setType(5);
|
|
|
+ Page<SceneVo> page2 = sceneProMapper.pageList(new Page<>(sceneParam.getPageNum(),sceneParam.getPageSize()),sceneParam);
|
|
|
+ List<String> numList2 = page.getRecords().stream().map(SceneVo::getNum).collect(Collectors.toList());
|
|
|
+ List<String> numList3 = page2.getRecords().stream().map(SceneVo::getNum).collect(Collectors.toList());
|
|
|
+ jsonObject.put("list",numList2.addAll(numList3));
|
|
|
return Result.success(jsonObject);
|
|
|
}
|
|
|
|