Search in sources :

Example 1 with Staff

use of com.topcom.cms.yuqing.domain.Staff in project topcom-cloud by 545314690.

the class OrganizationalStructureController method handleOne.

private OrganizationalStructure handleOne(OrganizationalStructure OS) {
    List<OrganizationalStructure> organizationList = OS.getChildren();
    if (organizationList != null && organizationList.size() > 0) {
        for (int i = 0; i < organizationList.size(); i++) {
            organizationList.set(i, handleOne(organizationList.get(i)));
        }
    } else {
        if (OS.isLeaf()) {
            Long id = OS.getId();
            List<Staff> byOrganizationalStructureId = staffManager.findByOrganizationalStructureId(id);
            List<OrganizationalStructure> childList = new ArrayList<>();
            for (Staff s : byOrganizationalStructureId) {
                childList.add(new OrganizationalStructure(s.getPosition() + ":" + s.getName(), s.getId()));
            }
            OS.setChildren(childList);
        }
    }
    return OS;
}
Also used : Staff(com.topcom.cms.yuqing.domain.Staff) ArrayList(java.util.ArrayList) OrganizationalStructure(com.topcom.cms.yuqing.domain.OrganizationalStructure)

Example 2 with Staff

use of com.topcom.cms.yuqing.domain.Staff in project topcom-cloud by 545314690.

the class StaffSentimentController method getStaffSentimentByOTSId.

/**
 * 根据部门ID获取领导舆情列表
 * 缓存规则  根据部门id查询时,先查询redis有没有此id的数据,若有则查询mongo,
 * 若没有则查询es并存储到mongo中并在redis中做标记。redis缓存时间决定mongo中数据的有效期。
 * @return
 */
@RequestMapping(value = "/getStaffSentimentByOTSId/", method = RequestMethod.POST, produces = "application/json")
@ResponseBody
public Page<StaffSentiment> getStaffSentimentByOTSId(@RequestBody StaffSentimentRequest request) {
    Object o = redisTemplateUtils.getValue(request.toString());
    List<Long> staffIdList = new ArrayList<>();
    List<Staff> staffList = staffManager.findByOrganizationalStructureId(request.getOrganizationalStructureId());
    if (staffList == null || staffList.size() < 1) {
        return null;
    }
    for (int i = 0; i < staffList.size(); i++) {
        staffIdList.add(staffList.get(i).getId());
    }
    List<StaffSentiment> staffSentimentList = new ArrayList<>();
    if (o == null) {
        for (int i = 0; i < staffIdList.size(); i++) {
            Staff staff = staffManager.findById(staffIdList.get(i));
            staffSentimentList.add(searchOneStaff(staff, request));
        }
        redisTemplateUtils.saveValue(request.toString(), true, saveTime);
        staffSentimentManager.save(staffSentimentList);
    }
    return this.staffSentimentManager.findByIdIn(request.getPage().pageable(), staffIdList);
}
Also used : StaffSentiment(com.topcom.cms.yuqing.domain.StaffSentiment) Staff(com.topcom.cms.yuqing.domain.Staff) ArrayList(java.util.ArrayList) JSONObject(net.sf.json.JSONObject)

Aggregations

Staff (com.topcom.cms.yuqing.domain.Staff)2 ArrayList (java.util.ArrayList)2 OrganizationalStructure (com.topcom.cms.yuqing.domain.OrganizationalStructure)1 StaffSentiment (com.topcom.cms.yuqing.domain.StaffSentiment)1 JSONObject (net.sf.json.JSONObject)1