2022-09-30 09:41:48 +08:00
|
|
|
|
package com.rzyc.service;
|
|
|
|
|
|
|
2022-10-09 17:33:16 +08:00
|
|
|
|
import cn.jiguang.common.TimeUnit;
|
2022-09-30 09:41:48 +08:00
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
2022-10-10 15:57:14 +08:00
|
|
|
|
import com.common.utils.*;
|
2022-10-12 17:32:06 +08:00
|
|
|
|
import com.common.utils.encryption.MD5;
|
2022-10-09 17:33:16 +08:00
|
|
|
|
import com.common.utils.model.Code;
|
|
|
|
|
|
import com.common.utils.model.Message;
|
2022-09-30 09:41:48 +08:00
|
|
|
|
import com.common.utils.model.SingleResult;
|
|
|
|
|
|
import com.rzyc.bean.emergency.PlanList;
|
2022-10-17 17:40:17 +08:00
|
|
|
|
import com.rzyc.config.RedisUtil;
|
2022-09-30 09:41:48 +08:00
|
|
|
|
import com.rzyc.controller.BaseController;
|
2022-10-18 17:32:45 +08:00
|
|
|
|
import com.rzyc.enums.RedisKeys;
|
2022-10-09 17:33:16 +08:00
|
|
|
|
import com.rzyc.mapper.EntPostTaskMapper;
|
2022-10-18 17:32:45 +08:00
|
|
|
|
import com.rzyc.model.*;
|
2022-10-11 17:35:01 +08:00
|
|
|
|
import com.rzyc.model.dto.*;
|
2022-09-30 09:41:48 +08:00
|
|
|
|
import com.rzyc.model.ent.EntPost;
|
|
|
|
|
|
import com.rzyc.model.ent.EntUser;
|
|
|
|
|
|
import com.rzyc.model.ent.SysEnterprise;
|
|
|
|
|
|
|
2022-10-10 15:57:14 +08:00
|
|
|
|
import org.springframework.beans.BeanUtils;
|
2022-10-17 17:40:17 +08:00
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2022-09-30 09:41:48 +08:00
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
2022-10-09 17:33:16 +08:00
|
|
|
|
import java.util.*;
|
2022-10-12 17:32:06 +08:00
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
|
import java.util.regex.Pattern;
|
2022-09-30 09:41:48 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 企业端pc业务 Service
|
|
|
|
|
|
* @author Xuwanxin
|
|
|
|
|
|
* @date 2022/9/29
|
|
|
|
|
|
* */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
|
public class PcBusinessService extends BaseController {
|
|
|
|
|
|
|
2022-10-17 17:40:17 +08:00
|
|
|
|
RedisUtil redisUtil;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
public PcBusinessService(RedisUtil redisUtil) {
|
|
|
|
|
|
this.redisUtil = redisUtil;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public SingleResult entUserTree(String enterpriseId, String postId){
|
2022-09-30 09:41:48 +08:00
|
|
|
|
SingleResult singleResult = new SingleResult();
|
2022-10-17 17:40:17 +08:00
|
|
|
|
//读缓存,get时候如果多级用:进行分隔
|
|
|
|
|
|
if (null != enterpriseId && postId == null){
|
2022-10-18 17:32:45 +08:00
|
|
|
|
List<EntPost> posts = (List<EntPost>) redisUtil.get(redisUtil.appendSymbol(RedisKeys.POST.getKey(),enterpriseId));
|
2022-10-17 17:40:17 +08:00
|
|
|
|
if (null != posts && posts.size() > 0 ){
|
|
|
|
|
|
singleResult.setData(posts);
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
}else if (null != enterpriseId && postId != enterpriseId){
|
2022-10-18 17:32:45 +08:00
|
|
|
|
List<EntPost>posts = (List<EntPost>) redisUtil.get(redisUtil.appendSymbol(RedisKeys.POST.getKey(),enterpriseId,postId));
|
2022-10-17 17:40:17 +08:00
|
|
|
|
if (null != posts && posts.size() > 0 ){
|
|
|
|
|
|
singleResult.setData(posts);
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-30 09:41:48 +08:00
|
|
|
|
SysEnterprise sysEnterprise = sysEnterpriseMapper.selectByPrimaryKey(enterpriseId);
|
|
|
|
|
|
List<EntPost> list = entPostMapper.selectEntUserTree(enterpriseId,postId);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* sql里进行了order by,如果传入postId就是查询非全部的数结构,需要加入一个公司,所以把第一个最大权限设置为company,这样公司才会在树的最上面
|
|
|
|
|
|
* 相反不穿postId就是查询全部,默认会有company打头就不用再修改list的0对象
|
|
|
|
|
|
*/
|
|
|
|
|
|
if (null != postId){
|
|
|
|
|
|
list.get(0).setParentId("company");
|
|
|
|
|
|
}
|
|
|
|
|
|
//加入公司为第一个树结构
|
|
|
|
|
|
EntPost entPost = new EntPost();
|
|
|
|
|
|
entPost.setName(sysEnterprise.getEntname());
|
|
|
|
|
|
entPost.setPostId("company");
|
|
|
|
|
|
list.add(entPost);
|
|
|
|
|
|
|
|
|
|
|
|
JSONArray jsonArray = handleEntUserTree(list);
|
|
|
|
|
|
List<EntPost>posts = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntPost.class);
|
|
|
|
|
|
singleResult.setData(posts);
|
2022-10-17 17:40:17 +08:00
|
|
|
|
//存入redis缓存
|
2022-10-18 17:32:45 +08:00
|
|
|
|
try {
|
|
|
|
|
|
if (null != enterpriseId && postId == null){
|
|
|
|
|
|
redisUtil.set(redisUtil.appendSymbol(RedisKeys.POST.getKey(),enterpriseId),posts,0);
|
|
|
|
|
|
}else if (null != enterpriseId && postId != enterpriseId){
|
|
|
|
|
|
redisUtil.set(redisUtil.appendSymbol(RedisKeys.POST.getKey(),postId,enterpriseId),posts,0);
|
|
|
|
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
e.printStackTrace();
|
2022-10-17 17:40:17 +08:00
|
|
|
|
}
|
2022-09-30 09:41:48 +08:00
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 处理企业用户数结构list
|
|
|
|
|
|
*/
|
|
|
|
|
|
private JSONArray handleEntUserTree(List<EntPost> list){
|
|
|
|
|
|
List<Map<String,Object>> data = new ArrayList<>();
|
|
|
|
|
|
for(EntPost entPost : list){
|
|
|
|
|
|
if(StringUtils.isBlank(entPost.getParentId())){
|
|
|
|
|
|
entPost.setParentId("");
|
|
|
|
|
|
}
|
|
|
|
|
|
Map<String,Object> entPostMap = new HashMap<String,Object>();
|
|
|
|
|
|
entPostMap.put("postId",entPost.getPostId());
|
|
|
|
|
|
entPostMap.put("name",entPost.getName());
|
|
|
|
|
|
entPostMap.put("parentId",entPost.getParentId());
|
|
|
|
|
|
entPostMap.put("subordinates",entPost.getSubordinates());
|
|
|
|
|
|
data.add(entPostMap);
|
|
|
|
|
|
}
|
|
|
|
|
|
com.alibaba.fastjson.JSONArray result = TypeConversion.listToTree(com.alibaba.fastjson.JSONArray.parseArray(JSON.toJSONString(data)),"postId","parentId","children");
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-11 17:35:01 +08:00
|
|
|
|
public SingleResult entUserPostList(EntUserPostListDto entUserPostListDto){
|
2022-10-08 17:33:31 +08:00
|
|
|
|
SingleResult singleResult = new SingleResult();
|
2022-10-11 17:35:01 +08:00
|
|
|
|
entUserPostListDto.setPage(entUserPostListDto.getPageSize() * (entUserPostListDto.getPage() - 1));
|
|
|
|
|
|
List<EntPostList>list = entPostListMapper.selectEntPostList(entUserPostListDto.getEnterpriseId(),entUserPostListDto.getEntUserId(),
|
|
|
|
|
|
entUserPostListDto.getPostId(),entUserPostListDto.getPage(),entUserPostListDto.getPageSize());
|
2022-10-08 17:33:31 +08:00
|
|
|
|
singleResult.setData(list);
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-11 17:35:01 +08:00
|
|
|
|
public SingleResult entUserPostTask(EntUserPostTaskDto entUserPostTaskDto){
|
2022-10-08 17:33:31 +08:00
|
|
|
|
SingleResult singleResult = new SingleResult();
|
2022-10-11 17:35:01 +08:00
|
|
|
|
entUserPostTaskDto.setPage(entUserPostTaskDto.getPageSize() * (entUserPostTaskDto.getPage() - 1));
|
2022-10-08 17:33:31 +08:00
|
|
|
|
//EntPostTask
|
2022-10-11 17:35:01 +08:00
|
|
|
|
List<EntPostTask>list = entPostTaskMapper.selectEntUserPostTask(entUserPostTaskDto.getEnterpriseId(),entUserPostTaskDto.getEntUserId(),entUserPostTaskDto.getPostId()
|
|
|
|
|
|
,entUserPostTaskDto.getListId(),entUserPostTaskDto.getContent(),entUserPostTaskDto.getTaskState(),
|
|
|
|
|
|
entUserPostTaskDto.getPage(),entUserPostTaskDto.getPageSize());
|
2022-10-09 17:33:16 +08:00
|
|
|
|
singleResult.setData(list);
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-11 17:35:01 +08:00
|
|
|
|
public SingleResult entUserPostDuty(EntUserPostDutyDto entUserPostDutyDto){
|
2022-10-09 17:33:16 +08:00
|
|
|
|
SingleResult singleResult = new SingleResult();
|
2022-10-11 17:35:01 +08:00
|
|
|
|
entUserPostDutyDto.setPage( entUserPostDutyDto.getPageSize() * (entUserPostDutyDto.getPage() - 1));
|
2022-10-09 17:33:16 +08:00
|
|
|
|
//EntPostDuty
|
2022-10-11 17:35:01 +08:00
|
|
|
|
List<EntPostDuty>list = entPostDutyMapper.selectEntUserPostDuty(entUserPostDutyDto.getEnterpriseId(),entUserPostDutyDto.getPostId(),entUserPostDutyDto.getPage(),entUserPostDutyDto.getPageSize());
|
2022-10-09 17:33:16 +08:00
|
|
|
|
singleResult.setData(list);
|
2022-10-08 17:33:31 +08:00
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-10 15:57:14 +08:00
|
|
|
|
public SingleResult entUserCredential(String enterpriseId, String entUserId,Integer page,Integer pageSize){
|
2022-10-09 17:33:16 +08:00
|
|
|
|
SingleResult singleResult = new SingleResult();
|
2022-10-10 15:57:14 +08:00
|
|
|
|
page = pageSize * (page - 1);
|
|
|
|
|
|
List<EntUserCredential>list = entUserCredentialMapper.selectEntUserCredential(enterpriseId,entUserId,page,pageSize);
|
|
|
|
|
|
singleResult.setData(list);
|
2022-10-09 17:33:16 +08:00
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-12 17:32:06 +08:00
|
|
|
|
public SingleResult entUserCredentialUpdate(List<EntUserCredentialUpdateDto> entUserCredentialUpdateDto) throws Exception {
|
2022-10-09 17:33:16 +08:00
|
|
|
|
SingleResult singleResult = new SingleResult();
|
|
|
|
|
|
Integer result = 0;
|
2022-10-12 17:32:06 +08:00
|
|
|
|
for (EntUserCredentialUpdateDto e:entUserCredentialUpdateDto) {
|
|
|
|
|
|
EntUserCredential entUserCredential = new EntUserCredential();
|
|
|
|
|
|
BeanUtils.copyProperties(e,entUserCredential);
|
|
|
|
|
|
if (StringUtils.isNotBlank(entUserCredential.getCredentialId())) {
|
|
|
|
|
|
entUserCredential.setModifyBy(getUserId());
|
|
|
|
|
|
entUserCredential.setModifyTime(new Date());
|
|
|
|
|
|
result += entUserCredentialMapper.updateEntUserCredential(entUserCredential);
|
|
|
|
|
|
}else {
|
|
|
|
|
|
entUserCredential.setCredentialId(RandomNumber.getUUid());
|
|
|
|
|
|
entUserCredential.setCreateBy(getUserId());
|
|
|
|
|
|
entUserCredential.setCreateTime(new Date());
|
|
|
|
|
|
result += entUserCredentialMapper.insertEntUserCredential(entUserCredential);
|
|
|
|
|
|
}
|
2022-10-09 17:33:16 +08:00
|
|
|
|
}
|
2022-10-12 17:32:06 +08:00
|
|
|
|
if (result != entUserCredentialUpdateDto.size()){
|
|
|
|
|
|
singleResult.setCode(Code.ERROR.getCode());
|
|
|
|
|
|
singleResult.setMessage(Message.ERROR);
|
2022-10-09 17:33:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public SingleResult entUserCredentialDelete(String credentialId){
|
|
|
|
|
|
SingleResult singleResult = new SingleResult();
|
|
|
|
|
|
int result = entUserCredentialMapper.entUserCredentialDelete(credentialId);
|
|
|
|
|
|
if (result==1){
|
|
|
|
|
|
singleResult.setCode(Code.SUCCESS.getCode());
|
|
|
|
|
|
singleResult.setMessage(Message.SUCCESS);
|
|
|
|
|
|
}
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-10 15:57:14 +08:00
|
|
|
|
public SingleResult entUserList(String keyContent,Integer page,Integer pageSize){
|
|
|
|
|
|
SingleResult singleResult = new SingleResult();
|
|
|
|
|
|
page = pageSize * (page - 1);
|
|
|
|
|
|
List<EntUser>users = entUserMapper.selectEntUserList(keyContent,page,pageSize);
|
|
|
|
|
|
//计算履职百分比,后期这里使用redis来读取履职进度
|
|
|
|
|
|
for (EntUser e:users) {
|
|
|
|
|
|
Integer total = e.getFinishTask() + e.getOngoingTask() + e.getOverTimeTask();
|
|
|
|
|
|
double percent = Arith.div(total,e.getFinishTask()) * 100;
|
|
|
|
|
|
e.setEntUserTaskPercent(percent);
|
|
|
|
|
|
}
|
|
|
|
|
|
singleResult.setData(users);
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-12 17:32:06 +08:00
|
|
|
|
public SingleResult addOrUpdateEntUser(AddOrUpdateEntUserDto addOrUpdateEntUserDto) throws Exception {
|
2022-10-11 17:35:01 +08:00
|
|
|
|
SingleResult singleResult = new SingleResult();
|
2022-10-12 17:32:06 +08:00
|
|
|
|
//正则验证手机号
|
|
|
|
|
|
String regex = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$";
|
|
|
|
|
|
Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
|
|
|
|
|
|
Matcher m = p.matcher(addOrUpdateEntUserDto.getMobile());
|
|
|
|
|
|
if (!m.matches()){
|
|
|
|
|
|
singleResult.setCode(Code.ERROR.getCode());
|
|
|
|
|
|
singleResult.setMessage(Message.MOBILE_IS_ILLEGAL);
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
//验证数据重复
|
2022-10-11 17:35:01 +08:00
|
|
|
|
EntUser entUser = new EntUser();
|
|
|
|
|
|
BeanUtils.copyProperties(addOrUpdateEntUserDto,entUser);
|
|
|
|
|
|
EntPost entPost = entPostMapper.selectById(addOrUpdateEntUserDto.getPostId());
|
|
|
|
|
|
entUser.setPostPath(entPost.getPostPath());
|
|
|
|
|
|
entUser.setPostPathName(entPost.getPostId());
|
2022-10-12 17:32:06 +08:00
|
|
|
|
//密码为用户名加手机号
|
|
|
|
|
|
entUser.setPasswd(MD5.md5(entUser.getName() + entUser.getMobile()));
|
2022-10-11 17:35:01 +08:00
|
|
|
|
int result = 0 ;
|
|
|
|
|
|
if (StringUtils.isNotBlank(entUser.getEntUserId())){
|
|
|
|
|
|
result = entUserMapper.updateEntUser(entUser);
|
|
|
|
|
|
}else {
|
|
|
|
|
|
result = entUserMapper.insert(entUser);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (result != 1){
|
|
|
|
|
|
singleResult.setCode(Code.ERROR.getCode());
|
|
|
|
|
|
singleResult.setMessage(Message.ERROR);
|
|
|
|
|
|
}
|
2022-10-12 17:32:06 +08:00
|
|
|
|
//插入证件图
|
|
|
|
|
|
singleResult = this.entUserCredentialUpdate(addOrUpdateEntUserDto.getEntUserCredentialUpdateDtos());
|
2022-10-11 17:35:01 +08:00
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-12 17:32:06 +08:00
|
|
|
|
public SingleResult validEntUserMobile(String mobile, String entUserId){
|
|
|
|
|
|
SingleResult singleResult = new SingleResult();
|
|
|
|
|
|
//正则验证手机号
|
|
|
|
|
|
String regex = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$";
|
|
|
|
|
|
Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
|
|
|
|
|
|
Matcher m = p.matcher(mobile);
|
|
|
|
|
|
if (!m.matches()){
|
|
|
|
|
|
singleResult.setCode(Code.ERROR.getCode());
|
|
|
|
|
|
singleResult.setMessage(Message.MOBILE_IS_ILLEGAL);
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
EntUser entUser = entUserMapper.validMobile(mobile);
|
|
|
|
|
|
if (entUser != null && !entUserId.equals(entUser.getEntUserId()) ){
|
|
|
|
|
|
singleResult.setCode(Code.ERROR.getCode());
|
|
|
|
|
|
singleResult.setMessage(Message.REGISTERED);
|
|
|
|
|
|
}
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public SingleResult validEntUserName(String name, String entUserId){
|
|
|
|
|
|
SingleResult singleResult = new SingleResult();
|
|
|
|
|
|
EntUser entUser = entUserMapper.validName(name);
|
|
|
|
|
|
if (entUser != null && !entUserId.equals(entUser.getEntUserId())){
|
|
|
|
|
|
singleResult.setCode(Code.ERROR.getCode());
|
|
|
|
|
|
singleResult.setMessage(Message.HAS_USERNAME);
|
|
|
|
|
|
}
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-18 11:36:52 +08:00
|
|
|
|
public SingleResult entEquipmentTypeList(String enterpriseId){
|
|
|
|
|
|
SingleResult singleResult = new SingleResult();
|
2022-10-18 17:32:45 +08:00
|
|
|
|
List<EntDeviceType> redisEntDeviceTypes =(List<EntDeviceType>) redisUtil.get(redisUtil.appendSymbol(RedisKeys.DEVICE.getKey(),enterpriseId));
|
|
|
|
|
|
if (null != redisEntDeviceTypes && redisEntDeviceTypes.size()>0){
|
|
|
|
|
|
singleResult.setData(redisEntDeviceTypes);
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
List<EntDeviceType> entDeviceTypes = entDeviceTypeMapper.selectEntEquipmentTypeList(enterpriseId);
|
|
|
|
|
|
//树结构处理
|
|
|
|
|
|
JSONArray jsonArray = handleEntEquipment(entDeviceTypes);
|
|
|
|
|
|
List<EntPost>posts = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntPost.class);
|
|
|
|
|
|
singleResult.setData(posts);
|
|
|
|
|
|
//存redis
|
|
|
|
|
|
boolean insertRedisResult = redisUtil.set(redisUtil.appendSymbol(RedisKeys.DEVICE.getKey(),enterpriseId),posts,0);
|
2022-10-18 11:36:52 +08:00
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-18 17:32:45 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 处理企业用户数结构list
|
|
|
|
|
|
*/
|
|
|
|
|
|
private JSONArray handleEntEquipment(List<EntDeviceType> list){
|
|
|
|
|
|
List<Map<String,Object>> data = new ArrayList<>();
|
|
|
|
|
|
for(EntDeviceType entDeviceType : list){
|
|
|
|
|
|
if(StringUtils.isBlank(entDeviceType.getParentId())){
|
|
|
|
|
|
entDeviceType.setParentId("");
|
|
|
|
|
|
}
|
|
|
|
|
|
Map<String,Object> entPostMap = new HashMap<String,Object>();
|
|
|
|
|
|
entPostMap.put("typeId",entDeviceType.getTypeId());
|
|
|
|
|
|
entPostMap.put("name",entDeviceType.getName());
|
|
|
|
|
|
entPostMap.put("parentId",entDeviceType.getParentId());
|
|
|
|
|
|
entPostMap.put("logo",entDeviceType.getLogo());
|
|
|
|
|
|
data.add(entPostMap);
|
|
|
|
|
|
}
|
|
|
|
|
|
com.alibaba.fastjson.JSONArray result = TypeConversion.listToTree(com.alibaba.fastjson.JSONArray.parseArray(JSON.toJSONString(data)),"typeId","parentId","children");
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-12 17:32:06 +08:00
|
|
|
|
|
2022-10-18 17:32:45 +08:00
|
|
|
|
public SingleResult entEquipmentList(String enterpriseId, String typeId){
|
|
|
|
|
|
SingleResult singleResult = new SingleResult();
|
|
|
|
|
|
List<EntDevice> devices = entDeviceMapper.selectEntEquipmentList(enterpriseId,typeId);
|
|
|
|
|
|
singleResult.setData(devices);
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
2022-10-12 17:32:06 +08:00
|
|
|
|
|
2022-10-18 17:32:45 +08:00
|
|
|
|
public SingleResult entEquipmentStatistic(String enterpriseId, String deviceId){
|
|
|
|
|
|
SingleResult singleResult = new SingleResult();
|
|
|
|
|
|
entDeviceMapper.entEquipmentStatistic(enterpriseId,deviceId);
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
2022-10-10 15:57:14 +08:00
|
|
|
|
|
2022-10-19 17:37:21 +08:00
|
|
|
|
public SingleResult addOrUpdateEntPost(AddOrUpdateEntPostDto addOrUpdateEntPostDto) throws Exception {
|
|
|
|
|
|
SingleResult singleResult = new SingleResult();
|
|
|
|
|
|
EntPost entPost = new EntPost();
|
|
|
|
|
|
BeanUtils.copyProperties(addOrUpdateEntPostDto,entPost);
|
|
|
|
|
|
Integer result = 0;
|
|
|
|
|
|
if (null != addOrUpdateEntPostDto && null != addOrUpdateEntPostDto.getPostId()){
|
|
|
|
|
|
entPost.setModifyBy(getUserId());
|
|
|
|
|
|
entPost.setModifyTime(new Date());
|
|
|
|
|
|
result = entPostMapper.updateEntPost(entPost);
|
|
|
|
|
|
}else {
|
|
|
|
|
|
entPost.setCreateBy(getUserId());
|
|
|
|
|
|
entPost.setCreateTime(new Date());
|
|
|
|
|
|
result = entPostMapper.insertEntPost(entPost);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (result != 1 ){
|
|
|
|
|
|
singleResult.setCode(Code.ERROR.getCode());
|
|
|
|
|
|
singleResult.setMessage(Message.ERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public SingleResult addOrUpdateEntEquipment(AddOrUpdateEntEquipmentDto addOrUpdateEntEquipmentDto) throws Exception {
|
|
|
|
|
|
SingleResult singleResult = new SingleResult();
|
|
|
|
|
|
EntDeviceType entDeviceType = new EntDeviceType();
|
|
|
|
|
|
BeanUtils.copyProperties(addOrUpdateEntEquipmentDto,entDeviceType);
|
|
|
|
|
|
Integer result = 0;
|
|
|
|
|
|
if (null != addOrUpdateEntEquipmentDto && null != addOrUpdateEntEquipmentDto.getTypeId()){
|
|
|
|
|
|
result = entDeviceTypeMapper.updateEntEquipment(entDeviceType);
|
|
|
|
|
|
}else {
|
|
|
|
|
|
result = entDeviceTypeMapper.addEntEquipment(entDeviceType);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (result != 1 ){
|
|
|
|
|
|
singleResult.setCode(Code.ERROR.getCode());
|
|
|
|
|
|
singleResult.setMessage(Message.ERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
return singleResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-09 17:33:16 +08:00
|
|
|
|
|
2022-09-30 09:41:48 +08:00
|
|
|
|
|
|
|
|
|
|
}
|