Commit ab2b4c5e by liushuangwu

departMentName

1 parent a608dec0
...@@ -8,6 +8,7 @@ import com.pipihelper.project.feishu.dto.FeiShuConfig; ...@@ -8,6 +8,7 @@ import com.pipihelper.project.feishu.dto.FeiShuConfig;
import com.pipihelper.project.feishu.dto.FeiShuEventDTO; import com.pipihelper.project.feishu.dto.FeiShuEventDTO;
import com.pipihelper.project.feishu.dto.FeiShuMsgCardEventDTO; import com.pipihelper.project.feishu.dto.FeiShuMsgCardEventDTO;
import com.pipihelper.project.feishu.dto.chat.FeiShuChatDTO; import com.pipihelper.project.feishu.dto.chat.FeiShuChatDTO;
import com.pipihelper.project.feishu.dto.department.FeiShuDepartmentDTO;
import com.pipihelper.project.feishu.dto.employee.FeiShuEmployeeDTO; import com.pipihelper.project.feishu.dto.employee.FeiShuEmployeeDTO;
import com.pipihelper.project.feishu.dto.msg.FeiShuMsgDTO; import com.pipihelper.project.feishu.dto.msg.FeiShuMsgDTO;
import com.pipihelper.project.feishu.entity.Employee; import com.pipihelper.project.feishu.entity.Employee;
...@@ -33,7 +34,9 @@ import java.io.InputStream; ...@@ -33,7 +34,9 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -196,6 +199,17 @@ public class FeiShuEventController { ...@@ -196,6 +199,17 @@ public class FeiShuEventController {
maxEmploeeId = employees.stream().map(Employee::getId).max(Comparator.comparing(x -> x)).orElse(0); maxEmploeeId = employees.stream().map(Employee::getId).max(Comparator.comparing(x -> x)).orElse(0);
employeeList.addAll(employees); employeeList.addAll(employees);
} }
System.out.println(maxEmploeeId);
Map<String, FeiShuDepartmentDTO> departmentMap = new HashMap<>();
List<String> departmentIdList = employeeList.stream().map(Employee::getDepartmentId).distinct().collect(Collectors.toList());
departmentIdList.forEach(it -> {
FeiShuDepartmentDTO department = feiShuApiService.getDepartment(it);
departmentMap.put(it, department);
});
painService.deleteAllByFloor(14);
AtomicInteger i = new AtomicInteger(); AtomicInteger i = new AtomicInteger();
employeeList.forEach(it -> { employeeList.forEach(it -> {
Pain pain = new Pain(); Pain pain = new Pain();
...@@ -204,6 +218,7 @@ public class FeiShuEventController { ...@@ -204,6 +218,7 @@ public class FeiShuEventController {
pain.setFloor(it.getFloor()); pain.setFloor(it.getFloor());
pain.setIndex(i.getAndIncrement()); pain.setIndex(i.getAndIncrement());
pain.setName(it.getName()); pain.setName(it.getName());
pain.setDepartMentName(departmentMap.getOrDefault(it.getDepartmentId(), new FeiShuDepartmentDTO()).getName());
painService.create(pain); painService.create(pain);
}); });
/* massageService.sendMassageMsgCardToPiPiChat(userList);*/ /* massageService.sendMassageMsgCardToPiPiChat(userList);*/
......
...@@ -26,4 +26,6 @@ public interface PainDao { ...@@ -26,4 +26,6 @@ public interface PainDao {
List<Pain> findListAsc(int limit); List<Pain> findListAsc(int limit);
List<Pain> findBackIndex(@Param(value = "index") Integer index, @Param(value = "limit") int limit); List<Pain> findBackIndex(@Param(value = "index") Integer index, @Param(value = "limit") int limit);
void deleteAllByFloor(int floor);
} }
...@@ -52,4 +52,8 @@ public class PainService { ...@@ -52,4 +52,8 @@ public class PainService {
public List<Pain> findBackIndex(Integer index,int limit) { public List<Pain> findBackIndex(Integer index,int limit) {
return painDao.findBackIndex(index,limit); return painDao.findBackIndex(index,limit);
} }
public void deleteAllByFloor(int floor) {
painDao.deleteAllByFloor(floor);
}
} }
...@@ -64,6 +64,10 @@ ...@@ -64,6 +64,10 @@
</where> </where>
</select> </select>
<delete id="deleteAllByFloor">
delete from t_pain where floor = #{floor}
</delete>
<select id="findByIndex" parameterType="java.lang.String" resultMap="PainResultMap"> <select id="findByIndex" parameterType="java.lang.String" resultMap="PainResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!