|
|
|
|
package com.glxp.api.controller.sup;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.controller.BaseController;
|
|
|
|
|
import com.glxp.api.entity.basic.ProductInfoEntity;
|
|
|
|
|
import com.glxp.api.entity.sup.UserCompanyEntity;
|
|
|
|
|
import com.glxp.api.entity.sup.UserCompanyOnlineEntity;
|
|
|
|
|
import com.glxp.api.req.auth.FilterUserComapanyRequest;
|
|
|
|
|
import com.glxp.api.req.basic.ProductInfoFilterRequest;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.res.auth.registComPerResponse;
|
|
|
|
|
import com.glxp.api.res.sup.UserCompanyOnlineResponse;
|
|
|
|
|
import com.glxp.api.res.sup.UserCompanyResponse;
|
|
|
|
|
import com.glxp.api.service.sup.UserCompanyOnlineService;
|
|
|
|
|
import com.glxp.api.service.sup.UserCompanyService;
|
|
|
|
|
import com.glxp.api.util.DateUtil;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 客户端企业信息
|
|
|
|
|
*/
|
|
|
|
|
@Api(tags = "客户端企业信息接口")
|
|
|
|
|
@ApiIgnore
|
|
|
|
|
@RestController
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class UserComanyController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
UserCompanyService userCompanyService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 关键字搜索
|
|
|
|
|
@ApiOperation(value = "查询用户企业信息(关键字搜索)",response = UserCompanyEntity.class)
|
|
|
|
|
@AuthRuleAnnotation("udi/auth/user/comapny/search")
|
|
|
|
|
@GetMapping("udi/auth/user/comapny/search")
|
|
|
|
|
public BaseResponse search(FilterUserComapanyRequest filterUserComapanyRequest) {
|
|
|
|
|
//获取部门id
|
|
|
|
|
if (filterUserComapanyRequest.getSearchKey() == null) {
|
|
|
|
|
filterUserComapanyRequest.setSearchKey("");
|
|
|
|
|
}
|
|
|
|
|
List<UserCompanyEntity> userCompanyEntities = userCompanyService.list(new QueryWrapper<UserCompanyEntity>().like("companyName", filterUserComapanyRequest.getSearchKey()).eq("checkStatus", 1));
|
|
|
|
|
|
|
|
|
|
PageInfo<UserCompanyEntity> pageInfo;
|
|
|
|
|
pageInfo = new PageInfo<>(userCompanyEntities);
|
|
|
|
|
PageSimpleResponse<UserCompanyEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(userCompanyEntities);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "查询用户企业信息",response = UserCompanyEntity.class)
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("udi/auth/user/comapny/filterCompanyName")
|
|
|
|
|
public BaseResponse filterCompanyName(FilterUserComapanyRequest filterUserComapanyRequest) {
|
|
|
|
|
|
|
|
|
|
List<UserCompanyEntity> userCompanyEntities = userCompanyService.filterCompanyName(filterUserComapanyRequest);
|
|
|
|
|
PageInfo<UserCompanyEntity> pageInfo = new PageInfo<>(userCompanyEntities);
|
|
|
|
|
PageSimpleResponse<UserCompanyEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(userCompanyEntities);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
UserCompanyOnlineService userCompanyOnlineService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询企业账号列表,包含客户端在线状态
|
|
|
|
|
*
|
|
|
|
|
* @param filterUserComapanyRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation(value = "查询企业账号列表,包含客户端在线状态",response = UserCompanyResponse.class)
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("udi/auth/user/comapny/status/filter")
|
|
|
|
|
public BaseResponse filterCompanyStaus(FilterUserComapanyRequest filterUserComapanyRequest) {
|
|
|
|
|
|
|
|
|
|
List<UserCompanyEntity> userCompanyEntities = userCompanyService.filterCompanyName(filterUserComapanyRequest);
|
|
|
|
|
List<UserCompanyResponse> userCompanyResponses = new ArrayList<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(userCompanyEntities)) {
|
|
|
|
|
for (UserCompanyEntity userCompanyEntity : userCompanyEntities) {
|
|
|
|
|
UserCompanyResponse userCompanyResponse = new UserCompanyResponse();
|
|
|
|
|
BeanUtil.copyProperties(userCompanyEntity, userCompanyResponse);
|
|
|
|
|
userCompanyResponse.setRemark(null);
|
|
|
|
|
UserCompanyOnlineResponse userCompanyOnlineResponse = userCompanyOnlineService.findOnLineByConfig(userCompanyEntity.getId());
|
|
|
|
|
if (userCompanyOnlineResponse == null) {
|
|
|
|
|
userCompanyResponse.setOnLineStatus(3);
|
|
|
|
|
} else {
|
|
|
|
|
if (userCompanyOnlineResponse.getUpdateTime() == null) {
|
|
|
|
|
userCompanyResponse.setOnLineStatus(3);
|
|
|
|
|
} else if (DateUtil.isExpire(userCompanyOnlineResponse.getUpdateTime(), userCompanyOnlineResponse.getHeartRate())) {
|
|
|
|
|
userCompanyResponse.setOnLineStatus(2);
|
|
|
|
|
} else {
|
|
|
|
|
userCompanyResponse.setOnLineStatus(1);
|
|
|
|
|
}
|
|
|
|
|
userCompanyResponse.setUpdateTime(userCompanyOnlineResponse.getUpdateTime());
|
|
|
|
|
userCompanyResponse.setHeartRate(userCompanyOnlineResponse.getHeartRate());
|
|
|
|
|
userCompanyResponse.setLastIp(userCompanyOnlineResponse.getLastIp());
|
|
|
|
|
userCompanyResponse.setRemark(userCompanyOnlineResponse.getRemark());
|
|
|
|
|
userCompanyResponse.setUserId(userCompanyOnlineResponse.getUserId());
|
|
|
|
|
}
|
|
|
|
|
userCompanyResponses.add(userCompanyResponse);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
PageInfo<UserCompanyResponse> pageInfo = new PageInfo<>(userCompanyResponses);
|
|
|
|
|
PageSimpleResponse<UserCompanyResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(userCompanyResponses);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|