forked from luyan/epmet-cloud-lingshan
17 changed files with 255 additions and 1 deletions
@ -0,0 +1,19 @@ |
|||
package com.epmet.service; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2022/3/15 10:09 |
|||
*/ |
|||
public interface HistoryDataService { |
|||
/** |
|||
* 网格员立项来源改为work_event |
|||
* |
|||
* @Param customerId |
|||
* @Return |
|||
* @Author zhaoqifeng |
|||
* @Date 2022/3/15 10:13 |
|||
*/ |
|||
void projectAddGridId(String customerId); |
|||
|
|||
} |
@ -0,0 +1,75 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.constant.RoleKeyConstants; |
|||
import com.epmet.dto.org.CustomerStaffGridDTO; |
|||
import com.epmet.dto.user.result.StaffRoleInfoDTO; |
|||
import com.epmet.service.HistoryDataService; |
|||
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; |
|||
import com.epmet.service.evaluationindex.screen.ScreenProjectDataService; |
|||
import com.epmet.service.org.CustomerGridService; |
|||
import com.epmet.service.project.ProjectService; |
|||
import com.epmet.service.user.UserService; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.function.Function; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2022/3/15 10:12 |
|||
*/ |
|||
@Service |
|||
public class HistoryDataServiceImpl implements HistoryDataService { |
|||
@Resource |
|||
CustomerGridService customerGridService; |
|||
@Resource |
|||
private UserService userService; |
|||
@Resource |
|||
private ProjectService projectService; |
|||
@Resource |
|||
private FactOriginProjectMainDailyService factOriginProjectMainDailyService; |
|||
@Resource |
|||
private ScreenProjectDataService screenProjectDataService; |
|||
|
|||
/** |
|||
* 网格员立项来源改为work_event |
|||
* |
|||
* @param customerId |
|||
* @Param customerId |
|||
* @Return |
|||
* @Author zhaoqifeng |
|||
* @Date 2022/3/15 10:13 |
|||
*/ |
|||
@Override |
|||
public void projectAddGridId(String customerId) { |
|||
List<CustomerStaffGridDTO> staffGridList = customerGridService.getCustomerStaffGridList(customerId); |
|||
List<StaffRoleInfoDTO> staffInfoList = userService.getStaffByRoleKey(customerId, RoleKeyConstants.ROLE_KEY_GRID_MEMBER); |
|||
if (CollectionUtils.isEmpty(staffGridList) || CollectionUtils.isEmpty(staffInfoList)) { |
|||
return; |
|||
} |
|||
Map<String, StaffRoleInfoDTO> staffMap = staffInfoList.stream().collect(Collectors.toMap(StaffRoleInfoDTO :: getStaffId, |
|||
Function.identity())); |
|||
List<CustomerStaffGridDTO> list = staffGridList.stream().filter(p -> null != staffMap.get(p.getStaffId())).map(item -> { |
|||
StaffRoleInfoDTO staffInfo = staffMap.get(item.getStaffId()); |
|||
CustomerStaffGridDTO dto = ConvertUtils.sourceToTarget(item, CustomerStaffGridDTO.class); |
|||
dto.setStaffId(staffInfo.getStaffId()); |
|||
return dto; |
|||
}).collect(Collectors.toList()); |
|||
|
|||
list.forEach(part -> { |
|||
//更新project表
|
|||
projectService.updateHistoryData(part); |
|||
//更新fact_origin_project_main_daily
|
|||
factOriginProjectMainDailyService.updateHistoryData(part); |
|||
//更新screen_project_data
|
|||
screenProjectDataService.updateHistoryData(part); |
|||
}); |
|||
|
|||
} |
|||
} |
Loading…
Reference in new issue