|
|
|
@ -10,14 +10,22 @@ import com.elink.esua.epdc.commons.tools.security.user.SecurityUser; |
|
|
|
import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.constant.WorkAppMenuConstant; |
|
|
|
import com.elink.esua.epdc.dto.SysUserDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.form.*; |
|
|
|
import com.elink.esua.epdc.dto.epdc.result.*; |
|
|
|
import com.elink.esua.epdc.common.token.dto.TokenDto; |
|
|
|
import com.elink.esua.epdc.dto.form.EpdcWorkAppUserMaTokenFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.form.WorkAppMenuStatisticsFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.issue.form.IssueStateStatisticsFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.issue.result.IssueStateStatisticsResultDTO; |
|
|
|
import com.elink.esua.epdc.dto.item.form.ItemStatisticsFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.item.result.ItemStatisticsResultDTO; |
|
|
|
import com.elink.esua.epdc.dto.result.WorkAppMenuStatisticsResultDTO; |
|
|
|
import com.elink.esua.epdc.feign.AdminFeignClient; |
|
|
|
import com.elink.esua.epdc.feign.ResourceFeignClient; |
|
|
|
import com.elink.esua.epdc.feign.UserFeignClient; |
|
|
|
import com.elink.esua.epdc.service.WorkIssueService; |
|
|
|
import com.elink.esua.epdc.service.WorkItemService; |
|
|
|
import com.elink.esua.epdc.service.WorkUserService; |
|
|
|
import com.elink.esua.epdc.utils.WxMaServiceUtils; |
|
|
|
import me.chanjar.weixin.common.error.WxErrorException; |
|
|
|
@ -25,6 +33,7 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
@ -47,6 +56,12 @@ public class WorkUserServiceImpl implements WorkUserService { |
|
|
|
@Autowired |
|
|
|
private WxMaServiceUtils wxMaServiceUtils; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WorkIssueService workIssueService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WorkItemService workItemService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<WorkUserAuthorizationDTO> getMaToken(EpdcWorkAppUserMaTokenFormDTO formDto) { |
|
|
|
// 获取openId
|
|
|
|
@ -202,4 +217,78 @@ public class WorkUserServiceImpl implements WorkUserService { |
|
|
|
public Result removeGrid(EpdcAppRemoveGridFormDTO formDto) { |
|
|
|
return userFeignClient.removeGrid(formDto); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<List<WorkAppMenuStatisticsResultDTO>> indexStatistics(WorkAppMenuStatisticsFormDTO formDto) { |
|
|
|
if (null == SecurityUser.getUser()) { |
|
|
|
return new Result<List<WorkAppMenuStatisticsResultDTO>>().error("获取当前登录用户信息失败"); |
|
|
|
} |
|
|
|
// 获取当前用户菜单信息
|
|
|
|
Result<List<EpdcAppIndexPanelResultDTO>> adminResult = adminFeignClient.indexPanel(SecurityUser.getUser().getMobile()); |
|
|
|
if (!adminResult.success()) { |
|
|
|
return new Result<List<WorkAppMenuStatisticsResultDTO>>().error(adminResult.getMsg()); |
|
|
|
} |
|
|
|
// 议题管理菜单消息数量统计
|
|
|
|
IssueStateStatisticsFormDTO issueFormDto = new IssueStateStatisticsFormDTO(); |
|
|
|
issueFormDto.setDeptId(formDto.getDeptId()); |
|
|
|
Result<IssueStateStatisticsResultDTO> issueResult = workIssueService.stateStatistics(issueFormDto); |
|
|
|
// 项目管理菜单消息数量统计
|
|
|
|
ItemStatisticsFormDTO itemFormDto = new ItemStatisticsFormDTO(); |
|
|
|
itemFormDto.setDeptId(formDto.getDeptId()); |
|
|
|
Result<ItemStatisticsResultDTO> itemResult = workItemService.getItemStatistics(itemFormDto); |
|
|
|
// 用户管理菜单消息数量统计
|
|
|
|
EpdcUnauthorizedAmountFromDTO unauthorizedFromDto = new EpdcUnauthorizedAmountFromDTO(); |
|
|
|
unauthorizedFromDto.setGridId(formDto.getDeptId()); |
|
|
|
Result<Integer> unauthorizedResult = this.getUnauthorizedAmount(unauthorizedFromDto); |
|
|
|
|
|
|
|
// 组装返回数据
|
|
|
|
List<WorkAppMenuStatisticsResultDTO> resultDtoList = new ArrayList<>(); |
|
|
|
for (EpdcAppIndexPanelResultDTO indexPanelDto: |
|
|
|
adminResult.getData()) { |
|
|
|
for (EpdcAppChildNavResultDTO childDto: |
|
|
|
indexPanelDto.getChildNav()) { |
|
|
|
WorkAppMenuStatisticsResultDTO resultDto = null; |
|
|
|
switch (childDto.getNavCode()) { |
|
|
|
case WorkAppMenuConstant.WORK_APP_MENU_CODE_ISSUE_WAITING_RESPOND: |
|
|
|
resultDto = this.packageMenuData(childDto.getNavCode(), issueResult.getData().getPendingResponseNum()); |
|
|
|
break; |
|
|
|
case WorkAppMenuConstant.WORK_APP_MENU_CODE_ISSUE_WAITING_HANDLE: |
|
|
|
resultDto = this.packageMenuData(childDto.getNavCode(), issueResult.getData().getPendingHandleNum()); |
|
|
|
break; |
|
|
|
case WorkAppMenuConstant.WORK_APP_MENU_CODE_ITEM_WAITING_HANDLE: |
|
|
|
resultDto = this.packageMenuData(childDto.getNavCode(), itemResult.getData().getPendingHandleNum()); |
|
|
|
break; |
|
|
|
case WorkAppMenuConstant.WORK_APP_MENU_CODE_USER_RESIDENTS_TO_BE_CERTIFIED: |
|
|
|
resultDto = this.packageMenuData(childDto.getNavCode(), unauthorizedResult.getData()); |
|
|
|
break; |
|
|
|
case WorkAppMenuConstant.WORK_APP_MENU_CODE_NOTICE: |
|
|
|
resultDto = this.packageMenuData(childDto.getNavCode(), itemResult.getData().getNoticeNum()); |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
if (null != resultDto) { |
|
|
|
resultDtoList.add(resultDto); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return new Result<List<WorkAppMenuStatisticsResultDTO>>().ok(resultDtoList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* 组装菜单数据 |
|
|
|
* |
|
|
|
* @params [menuCode, menuNum] |
|
|
|
* @return com.elink.esua.epdc.dto.result.WorkAppMenuStatisticsResultDTO |
|
|
|
* @author liuchuang |
|
|
|
* @since 2019/11/29 9:58 |
|
|
|
*/ |
|
|
|
private WorkAppMenuStatisticsResultDTO packageMenuData(String menuCode, Integer menuNum) { |
|
|
|
WorkAppMenuStatisticsResultDTO resultDto = new WorkAppMenuStatisticsResultDTO(); |
|
|
|
resultDto.setMenuCode(menuCode); |
|
|
|
resultDto.setMenuNum(menuNum); |
|
|
|
return resultDto; |
|
|
|
} |
|
|
|
} |
|
|
|
|