|
@@ -2,7 +2,13 @@ package com.mokamrp.privates.service.impl;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
|
|
|
+import com.mokamrp.privates.constant.HttpStatus;
|
|
|
|
|
+import com.mokamrp.privates.help.AjaxResult;
|
|
|
|
|
+import com.mokamrp.privates.mapper.RoomTagMapper;
|
|
|
|
|
+import com.mokamrp.privates.mapper.TagMapper;
|
|
|
import com.mokamrp.privates.mapper.WorkContactRoomMapper;
|
|
import com.mokamrp.privates.mapper.WorkContactRoomMapper;
|
|
|
|
|
+import com.mokamrp.privates.mapper.pojo.RoomTag;
|
|
|
|
|
+import com.mokamrp.privates.mapper.pojo.Tag;
|
|
|
import com.mokamrp.privates.mapper.pojo.WorkContactRoom;
|
|
import com.mokamrp.privates.mapper.pojo.WorkContactRoom;
|
|
|
import com.mokamrp.privates.mapper.pojo.WorkRoom;
|
|
import com.mokamrp.privates.mapper.pojo.WorkRoom;
|
|
|
import com.mokamrp.privates.mapper.WorkRoomMapper;
|
|
import com.mokamrp.privates.mapper.WorkRoomMapper;
|
|
@@ -37,6 +43,13 @@ public class WorkRoomServiceImpl extends ServiceImpl<WorkRoomMapper, WorkRoom> i
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private WorkContactRoomMapper contanctMapperObj;
|
|
private WorkContactRoomMapper contanctMapperObj;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private TagMapper tagMapperObj;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private RoomTagMapper roomTagMapperObj;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public Map<String, Object> getPageList(Integer pagesize, Integer page,
|
|
public Map<String, Object> getPageList(Integer pagesize, Integer page,
|
|
|
String name, Integer corp_id,
|
|
String name, Integer corp_id,
|
|
@@ -87,17 +100,11 @@ public class WorkRoomServiceImpl extends ServiceImpl<WorkRoomMapper, WorkRoom> i
|
|
|
|
|
|
|
|
List<WorkRoomVo> list = mapperObj.getVoList(pageObj,obj);
|
|
List<WorkRoomVo> list = mapperObj.getVoList(pageObj,obj);
|
|
|
Integer total = mapperObj.getVoListTotal(obj);
|
|
Integer total = mapperObj.getVoListTotal(obj);
|
|
|
- System.out.println("数据总数");
|
|
|
|
|
- System.out.println(total);
|
|
|
|
|
|
|
|
|
|
if(list.size() > 0 ) {
|
|
if(list.size() > 0 ) {
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
List<Integer> ids = list.stream().map(WorkRoomVo -> WorkRoomVo.getId()).collect(Collectors.toList());
|
|
List<Integer> ids = list.stream().map(WorkRoomVo -> WorkRoomVo.getId()).collect(Collectors.toList());
|
|
|
HashMap<Integer ,HashMap<String,Integer >> dataById = getDataById(ids);
|
|
HashMap<Integer ,HashMap<String,Integer >> dataById = getDataById(ids);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- System.out.println(dataById);
|
|
|
|
|
if(dataById.size() > 0){
|
|
if(dataById.size() > 0){
|
|
|
list=list.stream().map(WorkRwoomVo -> {
|
|
list=list.stream().map(WorkRwoomVo -> {
|
|
|
WorkRoomVo detail = new WorkRoomVo();
|
|
WorkRoomVo detail = new WorkRoomVo();
|
|
@@ -124,6 +131,98 @@ public class WorkRoomServiceImpl extends ServiceImpl<WorkRoomMapper, WorkRoom> i
|
|
|
return resMap;
|
|
return resMap;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Object bangTagIds(Integer[] ids,Integer[] tagIds){
|
|
|
|
|
+
|
|
|
|
|
+ //1-先查room是否存在
|
|
|
|
|
+ Object res = checkOption(ids,tagIds);
|
|
|
|
|
+ if(res != null){
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //3-绑定插入但是要检测已经存在的
|
|
|
|
|
+ //roomTagMapperObj.
|
|
|
|
|
+
|
|
|
|
|
+ EntityWrapper<RoomTag> obj = new EntityWrapper<RoomTag>();
|
|
|
|
|
+ obj.in("id",ids);
|
|
|
|
|
+ RoomTag roomTagObj;
|
|
|
|
|
+
|
|
|
|
|
+ Date nowDate =new Date();
|
|
|
|
|
+ for(Integer id : ids){
|
|
|
|
|
+ for(Integer tagId : tagIds){
|
|
|
|
|
+ //检测是否已经存在
|
|
|
|
|
+ obj = new EntityWrapper<RoomTag>();
|
|
|
|
|
+ obj.eq("room_id",id);
|
|
|
|
|
+ obj.eq("tag_id",tagId);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if(roomTagMapperObj.selectCount(obj)<=0){//插入
|
|
|
|
|
+ roomTagObj = new RoomTag();
|
|
|
|
|
+ roomTagObj.setRoomId(id);
|
|
|
|
|
+ roomTagObj.setTagId(tagId);
|
|
|
|
|
+ roomTagObj.setCreateAt(nowDate);
|
|
|
|
|
+ roomTagObj.setUpdateAt(nowDate);
|
|
|
|
|
+ roomTagMapperObj.insert(roomTagObj);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Object leftTagIds(Integer[] ids,Integer[] tagIds){
|
|
|
|
|
+
|
|
|
|
|
+ //1-先查room是否存在
|
|
|
|
|
+ Object res = checkOption(ids,tagIds);
|
|
|
|
|
+ if(res != null){
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //3-绑定插入但是要检测已经存在的
|
|
|
|
|
+ //roomTagMapperObj.
|
|
|
|
|
+ EntityWrapper<RoomTag> obj = new EntityWrapper<RoomTag>();
|
|
|
|
|
+ obj.in("id",ids);
|
|
|
|
|
+ RoomTag roomTagObj;
|
|
|
|
|
+
|
|
|
|
|
+ Date nowDate =new Date();
|
|
|
|
|
+ for(Integer id : ids){
|
|
|
|
|
+ for(Integer tagId : tagIds){
|
|
|
|
|
+ //检测是否已经存在
|
|
|
|
|
+ obj = new EntityWrapper<RoomTag>();
|
|
|
|
|
+ obj.eq("room_id",id);
|
|
|
|
|
+ obj.eq("tag_id",tagId);
|
|
|
|
|
+ if(roomTagMapperObj.selectCount(obj)>=0){//插入
|
|
|
|
|
+ roomTagMapperObj.delete(obj);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private Object checkOption(Integer[] ids,Integer[] tagIds){
|
|
|
|
|
+ //1-先查room是否存在
|
|
|
|
|
+ EntityWrapper<WorkRoom> obj = new EntityWrapper<WorkRoom>();
|
|
|
|
|
+ obj.in("id",ids);
|
|
|
|
|
+
|
|
|
|
|
+ Integer total = mapperObj.selectCount(obj);
|
|
|
|
|
+ if(total != ids.length){
|
|
|
|
|
+ return AjaxResult.error(HttpStatus.ERROR,"room不全存在");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //2-tag是否都存在
|
|
|
|
|
+ EntityWrapper<Tag> tagWrapper = new EntityWrapper<Tag>();
|
|
|
|
|
+ tagWrapper.in("id",tagIds);
|
|
|
|
|
+ Integer tagTotal = tagMapperObj.selectCount(tagWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ if(tagTotal != tagIds.length){
|
|
|
|
|
+ return AjaxResult.error(HttpStatus.ERROR,"tag不全存在");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private HashMap<Integer ,HashMap<String,Integer >> getDataById(List<Integer> ids){
|
|
private HashMap<Integer ,HashMap<String,Integer >> getDataById(List<Integer> ids){
|
|
|
|
|
|
|
|
String todayStartDate = (new SimpleDateFormat("yyyy-MM-dd 00:00:00")).format(new Date());
|
|
String todayStartDate = (new SimpleDateFormat("yyyy-MM-dd 00:00:00")).format(new Date());
|
|
@@ -164,9 +263,6 @@ public class WorkRoomServiceImpl extends ServiceImpl<WorkRoomMapper, WorkRoom> i
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
HashMap<String, Integer> tempSetLeft = new HashMap<String, Integer>();
|
|
HashMap<String, Integer> tempSetLeft = new HashMap<String, Integer>();
|
|
|
- System.out.println("查看类型");
|
|
|
|
|
- System.out.println(todayLefts);
|
|
|
|
|
- System.out.println(todayAdds);
|
|
|
|
|
for (WorkContactRoomGroupDataVo o : todayLefts) {
|
|
for (WorkContactRoomGroupDataVo o : todayLefts) {
|
|
|
if(dataById.get(o.getRoom_id())==null){//不存在
|
|
if(dataById.get(o.getRoom_id())==null){//不存在
|
|
|
temp.put("total",0);
|
|
temp.put("total",0);
|