无关风月
3 小时以前 5e2d78f61bf7d1513d5d5c8cd55442133a6e898e
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java
@@ -27,6 +27,7 @@
import com.ruoyi.system.query.KnowledgeListQuery;
import com.ruoyi.system.query.TaskListQuery;
import com.ruoyi.system.service.*;
import com.ruoyi.system.utils.TemplateMessageSendUtil;
import com.ruoyi.system.utils.wx.body.resp.Code2SessionRespBody;
import com.ruoyi.system.utils.wx.body.resq.Code2SessionResqBody;
import com.ruoyi.system.utils.wx.model.WeixinProperties;
@@ -121,10 +122,12 @@
    private RedisService redisService;
    @Resource
    private MsgUtils msgUtils;
    @Resource
    private TemplateMessageSendUtil templateMessageSendUtil;
    @ApiOperation(value = "通过code获得openid,获取用户信息",tags = {"微信小程序登录"})
    @GetMapping("/openIdByJsCode")
    public R<String> openIdByJsCode(@RequestParam String code) {
        Long userId = tokenService.getLoginUser().getUserId();
        Long userId = tokenService.getLoginUserApplet().getUserId();
        SysUser sysUser = sysUserService.selectUserById(userId);
        if(Objects.isNull(sysUser)){
            return R.fail("未查询到当前登录用户信息");
@@ -412,6 +415,36 @@
        }
        return R.ok(taskDetailVO);
    }
    @ApiOperation(value = "督察任务-详情任务")
    @GetMapping(value = "/detaiInspectorl")
    public R<InspectorDetailVO> detaiInspectorl(@RequestParam String id) {
        InspectorDetailVO taskDetailVO = new InspectorDetailVO();
        TInspector inspector = inspectorService.getById(id);
        TLocation location = locationService.getById(inspector.getLocationId());
        TLocationType locationType = locationTypeService.getById(location.getLocationType());
        taskDetailVO.setLocationAddress(location.getLocationAddress());
        taskDetailVO.setLocationAddressEnd(location.getLocationAddressEnd());
        taskDetailVO.setLocationIcon(locationType.getLocationIcon());
        taskDetailVO.setLocationName(locationType.getLocationName());
        taskDetailVO.setLocationTypeName(locationType.getLocationName());
        taskDetailVO.setLocationLonEnd(location.getLocationLonEnd());
        taskDetailVO.setLocationLatEnd(location.getLocationLatEnd());
        taskDetailVO.setLocationLon(location.getLocationLon());
        taskDetailVO.setLocationLat(location.getLocationLat());
        taskDetailVO.setLocationName(location.getLocationName());
        taskDetailVO.setId(inspector.getId());
        taskDetailVO.setClearStatus(inspector.getClearStatus());
        taskDetailVO.setUnqualified(inspector.getUnqualified());
        taskDetailVO.setRemark(inspector.getAuditRemark());
        taskDetailVO.setPicture(inspector.getPicture());
        taskDetailVO.setAudioUrl(inspector.getAudioUrl());
        taskDetailVO.setStatus(inspector.getStatus());
        taskDetailVO.setAuditPerson(inspector.getAuditPerson());
        taskDetailVO.setAuditTime(inspector.getAuditTime());
        taskDetailVO.setAuditStatus(inspector.getAuditStatus());
        taskDetailVO.setAuditRemark(inspector.getAuditRemark());
        return R.ok(taskDetailVO);
    }
    @ApiOperation(value = "详情任务-操作记录-详情")
    @GetMapping(value = "/detailRecord")
@@ -504,6 +537,12 @@
        );
        return R.ok(list);
    }
    @ApiOperation(value = "点位列表")
    @PostMapping(value = "/locationList")
    public R<List<TLocation>> locationList() {
        List<TLocation> locations = locationService.list();
        return R.ok(locations);
    }
    @ApiOperation(value = "上传督察任务")
    @PostMapping(value = "/addInspector")
@@ -521,6 +560,19 @@
        }
        inspectorService.save(dto);
        return R.ok();
//        TLocation location = locationService.getById(dto.getLocationId());
//        SysUser sysUser = sysUserService.selectUserById(Long.valueOf(location.getLocationLeader()));
//        dto.setCommitPerson(tokenService.getLoginUserApplet().getUserId() + "");
//
//        if (dto.getClearStatus() == 1) {
//            dto.setStatus(4);
//        } else {
//            dto.setStatus(1);
//
//        }
//        inspectorService.save(dto);
//        return R.ok();
    }
    @ApiOperation(value = "上传意见反馈")
@@ -759,6 +811,17 @@
                                       }
                                       break;
                                   case 3:
                                       if (StringUtils.hasLength(sysUser.getOpenId())){
                                           Date date1 = new Date();
                                           SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                                           SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                                           String format1 = simpleDateFormat1.format(date1);
                                           String startTime = simpleDateFormat2.format(leaveDTO.getStartTime());
                                           String endTime = simpleDateFormat2.format(leaveDTO.getStartTime());
                                           templateMessageSendUtil.wxTemplatePendApprovalRequest(sysUser.getOpenId(),
                                                   user.getNickName(),format1,"员工请假",
                                                   startTime,endTime);
                                       }
                                       break;
                               }
@@ -916,6 +979,13 @@
                    }
                    break;
                case 3:
                    if (StringUtils.hasLength(sysUser.getOpenId())){
                        Date date = new Date();
                        SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        String startTime1 = simpleDateFormat2.format(date);
                        templateMessageSendUtil.wxTemplateMakeCopyRequest(sysUser1.getOpenId(),
                                sysUser1.getNickName(),startTime1,"请假审批");
                    }
                    break;
            }
        }