| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.BaseModel; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | |
| | | 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; |
| | | import com.ruoyi.system.utils.wx.pojo.AppletUserDecodeData; |
| | | import com.ruoyi.system.utils.wx.pojo.AppletUserEncrypteData; |
| | | import com.ruoyi.system.utils.wx.tools.WxAppletTools; |
| | | import com.ruoyi.system.utils.wx.tools.WxUtils; |
| | | import com.ruoyi.system.vo.system.*; |
| | | import com.ruoyi.web.controller.tool.EmailUtils; |
| | | import com.ruoyi.web.controller.tool.MsgUtils; |
| | | import com.sun.jna.platform.win32.LMAccess; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | |
| | | * @author xiaochen |
| | | * @since 2025-05-28 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "个人中心") |
| | | @RestController |
| | | @RequestMapping("/t-user") |
| | |
| | | private TProblemEscalationService problemEscalationService; |
| | | @Resource |
| | | private TNoticeService noticeService; |
| | | @Autowired |
| | | private RestTemplate wxRestTemplate; |
| | | @Autowired |
| | | private WeixinProperties weixinProperties; |
| | | @Resource |
| | | 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.getLoginUserApplet().getUserId(); |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | if(Objects.isNull(sysUser)){ |
| | | return R.fail("未查询到当前登录用户信息"); |
| | | } |
| | | if(StringUtils.hasLength(sysUser.getOpenId())){ |
| | | return R.ok(); |
| | | } |
| | | log.info("<<<<<<<<换取openid开始<<<<<<<<:{}", code); |
| | | WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, weixinProperties, redisService); |
| | | Code2SessionRespBody body = appletTools.getOpenIdByJscode2session(new Code2SessionResqBody().build(code)); |
| | | String openid = body.getOpenid(); |
| | | sysUser.setOpenId(openid); |
| | | sysUserService.updateUser(sysUser); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "消息通知列表") |
| | | @PostMapping(value = "/noticeList") |
| | |
| | | } |
| | | 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") |
| | |
| | | ); |
| | | 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") |
| | |
| | | } |
| | | 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 = "上传意见反馈") |
| | |
| | | } |
| | | 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; |
| | | } |
| | | |
| | |
| | | } |
| | | 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; |
| | | } |
| | | } |