无关风月
9 小时以前 5e2d78f61bf7d1513d5d5c8cd55442133a6e898e
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppealController.java
@@ -13,6 +13,7 @@
import com.ruoyi.system.model.*;
import com.ruoyi.system.query.InsepectorListQuery;
import com.ruoyi.system.service.*;
import com.ruoyi.system.utils.TemplateMessageSendUtil;
import com.ruoyi.system.vo.system.AppealDetailVO;
import com.ruoyi.system.vo.system.AppealListVO;
import com.ruoyi.web.controller.tool.EmailUtils;
@@ -26,8 +27,11 @@
import javax.annotation.Resource;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@@ -90,11 +94,15 @@
            if (listIds.isEmpty()){
                listIds.add("0");
            }
            query.setPatrolInspectorIds(sysUsers.stream().filter(e->listIds.contains(e.getDeptId())).map(SysUser::getUserId)
                    .collect(Collectors.toList()));
            if (listIds.contains("0")){
                query.setPatrolInspectorIds(Collections.singletonList(0L));
            }else{
                query.setPatrolInspectorIds(sysUsers.stream().filter(e->listIds.contains(e.getDeptId())).map(SysUser::getUserId)
                        .collect(Collectors.toList()));
            }
            if (StringUtils.hasLength(query.getPhonenumber())){
                List<Long> patrolInspectorIds = sysUsers.stream().filter(sysUser ->
                        sysUser.getPhonenumber().equals(query.getPhonenumber())
                        sysUser.getPhonenumber().contains(query.getPhonenumber())
                                && listIds.contains(sysUser.getDeptId())
                ).map(SysUser::getUserId).collect(Collectors.toList());
                if (patrolInspectorIds.isEmpty()){
@@ -105,7 +113,7 @@
        }
        if (StringUtils.hasLength(query.getPhonenumber())){
            List<Long> patrolInspectorIds = sysUsers.stream().filter(sysUser ->
                    sysUser.getPhonenumber().equals(query.getPhonenumber())
                    sysUser.getPhonenumber().contains(query.getPhonenumber())
            ).map(SysUser::getUserId).collect(Collectors.toList());
            if (!CollectionUtils.isEmpty(query.getPatrolInspectorIds())){
                // 取交集
@@ -180,7 +188,8 @@
        TLocationType byId2 = locationTypeService.getById(byId1.getLocationType());
        appealDetailVO.setLocationAddress(byId1.getLocationAddress());
        appealDetailVO.setLocationIcon(byId2.getLocationIcon());
        appealDetailVO.setLocationName(byId2.getLocationName());
        appealDetailVO.setLocationName(byId1.getLocationName());
        appealDetailVO.setLocationTypeName(byId2.getLocationName());
        appealDetailVO.setTaskId(byId.getId());
        if (appeal.getAuditPerson()!=null){
            SysUser sysUser = sysUserService.selectUserById(Long.valueOf(appeal.getAuditPerson()));
@@ -197,6 +206,8 @@
    @Resource
    private MsgUtils msgUtils;
    @Resource
    private TemplateMessageSendUtil templateMessageSendUtil;
    @Resource
    private TNoticeSetService noticeSetService;
    @Resource
    private TDictDataService dictDataService;
@@ -206,7 +217,7 @@
    public R<Boolean> audit(@RequestBody @Valid TAppealAuditDTO dto) throws Exception {
        List<SysUser> sysUsers = sysUserService.selectAllList();
        TAppeal appeal = appealService.getById(dto.getId());
        SysUser sysUser = sysUsers.stream().filter(e -> e.getUserId().equals(Long.valueOf(dto.getAppealPerson())))
        SysUser sysUser = sysUsers.stream().filter(e -> e.getUserId().equals(Long.valueOf(appeal.getAppealPerson())))
                .findFirst().orElse(null);
        dto.setStatus(dto.getStatus());
        dto.setAuditPerson(tokenService.getLoginUser().getUserId()+"");
@@ -259,6 +270,14 @@
                        }
                        break;
                    case 3:
                        if (StringUtils.hasLength(sysUser.getOpenId())){
                            Date date = new Date();
                            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                            String format = simpleDateFormat.format(date);
                            templateMessageSendUtil.wxTemplateAppealResultRequest(sysUser.getOpenId(),
                                    location.getLocationName(),"通过",format,dto.getAuditRemark());
                        }
                        break;
                }
            }
@@ -283,6 +302,14 @@
                        }
                        break;
                    case 3:
                        if (StringUtils.hasLength(sysUser.getOpenId())){
                            Date date = new Date();
                            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                            String format = simpleDateFormat.format(date);
                            templateMessageSendUtil.wxTemplateAppealResultRequest(sysUser.getOpenId(),
                                    location.getLocationName(),"驳回",format,dto.getAuditRemark());
                        }
                        break;
                }
            }