Commit ab2b4c5e by liushuangwu

departMentName

1 parent a608dec0
......@@ -8,6 +8,7 @@ import com.pipihelper.project.feishu.dto.FeiShuConfig;
import com.pipihelper.project.feishu.dto.FeiShuEventDTO;
import com.pipihelper.project.feishu.dto.FeiShuMsgCardEventDTO;
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.msg.FeiShuMsgDTO;
import com.pipihelper.project.feishu.entity.Employee;
......@@ -33,7 +34,9 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -196,6 +199,17 @@ public class FeiShuEventController {
maxEmploeeId = employees.stream().map(Employee::getId).max(Comparator.comparing(x -> x)).orElse(0);
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();
employeeList.forEach(it -> {
Pain pain = new Pain();
......@@ -204,6 +218,7 @@ public class FeiShuEventController {
pain.setFloor(it.getFloor());
pain.setIndex(i.getAndIncrement());
pain.setName(it.getName());
pain.setDepartMentName(departmentMap.getOrDefault(it.getDepartmentId(), new FeiShuDepartmentDTO()).getName());
painService.create(pain);
});
/* massageService.sendMassageMsgCardToPiPiChat(userList);*/
......
......@@ -26,4 +26,6 @@ public interface PainDao {
List<Pain> findListAsc(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 {
public List<Pain> findBackIndex(Integer index,int limit) {
return painDao.findBackIndex(index,limit);
}
public void deleteAllByFloor(int floor) {
painDao.deleteAllByFloor(floor);
}
}
......@@ -12,7 +12,7 @@
<result column="message_id" property="messageId"/>
<result column="name" property="name"/>
<result column="depart_ment_name" property="departMentName"/>
<result column="index" property="index"/>
<result column="index" property="index"/>
</resultMap>
<!-- <resultMap id="BuffConfigResultBOMap" type="com.pipihelper.project.feishu.entity.Deployee"
......@@ -64,6 +64,10 @@
</where>
</select>
<delete id="deleteAllByFloor">
delete from t_pain where floor = #{floor}
</delete>
<select id="findByIndex" parameterType="java.lang.String" resultMap="PainResultMap">
select
<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!