小程序端接口
This commit is contained in:
parent
333fbe21d5
commit
b065c25b24
@ -1,29 +1,22 @@
|
||||
package com.ruoyi.abuwx.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.abuwx.service.IAbucoderWxuserService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.abuwx.domain.AbucoderWxuser;
|
||||
import com.ruoyi.abuwx.service.IAbucoderWxuserService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.domain.entity.AbucoderWxuser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信用户Controller
|
||||
*
|
||||
*
|
||||
* @author 阿卜Coder QQ932696181
|
||||
* @date 2024-04-07
|
||||
*/
|
||||
@ -37,7 +30,6 @@ public class AbucoderWxuserController extends BaseController
|
||||
/**
|
||||
* 查询微信用户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:wxuser:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AbucoderWxuser abucoderWxuser)
|
||||
{
|
||||
@ -49,7 +41,6 @@ public class AbucoderWxuserController extends BaseController
|
||||
/**
|
||||
* 导出微信用户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:wxuser:export')")
|
||||
@Log(title = "微信用户", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AbucoderWxuser abucoderWxuser)
|
||||
@ -62,7 +53,6 @@ public class AbucoderWxuserController extends BaseController
|
||||
/**
|
||||
* 获取微信用户详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:wxuser:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
@ -72,7 +62,6 @@ public class AbucoderWxuserController extends BaseController
|
||||
/**
|
||||
* 新增微信用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:wxuser:add')")
|
||||
@Log(title = "微信用户", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AbucoderWxuser abucoderWxuser)
|
||||
@ -83,7 +72,6 @@ public class AbucoderWxuserController extends BaseController
|
||||
/**
|
||||
* 修改微信用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:wxuser:edit')")
|
||||
@Log(title = "微信用户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AbucoderWxuser abucoderWxuser)
|
||||
@ -94,7 +82,6 @@ public class AbucoderWxuserController extends BaseController
|
||||
/**
|
||||
* 删除微信用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:wxuser:remove')")
|
||||
@Log(title = "微信用户", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
|
@ -9,7 +9,6 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -31,7 +30,6 @@ public class WbMaintenanceInformationController extends BaseController
|
||||
/**
|
||||
* 查询维保记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:information:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WbMaintenanceInformation wbMaintenanceInformation)
|
||||
{
|
||||
@ -43,7 +41,6 @@ public class WbMaintenanceInformationController extends BaseController
|
||||
/**
|
||||
* 导出维保记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:information:export')")
|
||||
@Log(title = "维保记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, WbMaintenanceInformation wbMaintenanceInformation)
|
||||
@ -56,7 +53,6 @@ public class WbMaintenanceInformationController extends BaseController
|
||||
/**
|
||||
* 获取维保记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:information:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
@ -66,7 +62,6 @@ public class WbMaintenanceInformationController extends BaseController
|
||||
/**
|
||||
* 新增维保记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:information:add')")
|
||||
@Log(title = "维保记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WbMaintenanceInformation wbMaintenanceInformation)
|
||||
@ -77,7 +72,6 @@ public class WbMaintenanceInformationController extends BaseController
|
||||
/**
|
||||
* 修改维保记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:information:edit')")
|
||||
@Log(title = "维保记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WbMaintenanceInformation wbMaintenanceInformation)
|
||||
@ -88,7 +82,6 @@ public class WbMaintenanceInformationController extends BaseController
|
||||
/**
|
||||
* 删除维保记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:information:remove')")
|
||||
@Log(title = "维保记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
|
@ -9,7 +9,6 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -31,7 +30,6 @@ public class WbProjectController extends BaseController
|
||||
/**
|
||||
* 查询项目管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:project:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WbProject wbProject)
|
||||
{
|
||||
@ -43,7 +41,6 @@ public class WbProjectController extends BaseController
|
||||
/**
|
||||
* 导出项目管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:project:export')")
|
||||
@Log(title = "项目管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, WbProject wbProject)
|
||||
@ -56,7 +53,6 @@ public class WbProjectController extends BaseController
|
||||
/**
|
||||
* 获取项目管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:project:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
@ -66,7 +62,6 @@ public class WbProjectController extends BaseController
|
||||
/**
|
||||
* 新增项目管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:project:add')")
|
||||
@Log(title = "项目管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WbProject wbProject)
|
||||
@ -77,7 +72,6 @@ public class WbProjectController extends BaseController
|
||||
/**
|
||||
* 修改项目管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:project:edit')")
|
||||
@Log(title = "项目管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WbProject wbProject)
|
||||
@ -88,7 +82,6 @@ public class WbProjectController extends BaseController
|
||||
/**
|
||||
* 删除项目管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('abuwx:project:remove')")
|
||||
@Log(title = "项目管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.ruoyi.abuwx.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
@ -7,10 +8,11 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 维保记录对象 wb_maintenance_information
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-09
|
||||
*/
|
||||
@Data
|
||||
public class WbMaintenanceInformation extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -26,6 +28,10 @@ public class WbMaintenanceInformation extends BaseEntity
|
||||
@Excel(name = "项目名称")
|
||||
private String projectName;
|
||||
|
||||
/** 维保类型 */
|
||||
@Excel(name = "维保类型")
|
||||
private String maintenanceType;
|
||||
|
||||
/** 图片 */
|
||||
@Excel(name = "图片")
|
||||
private String imageUrl;
|
||||
@ -34,48 +40,48 @@ public class WbMaintenanceInformation extends BaseEntity
|
||||
@Excel(name = "附件")
|
||||
private String fileUrl;
|
||||
|
||||
public void setId(Long id)
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setProjectId(Long projectId)
|
||||
public void setProjectId(Long projectId)
|
||||
{
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public Long getProjectId()
|
||||
public Long getProjectId()
|
||||
{
|
||||
return projectId;
|
||||
}
|
||||
public void setProjectName(String projectName)
|
||||
public void setProjectName(String projectName)
|
||||
{
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public String getProjectName()
|
||||
public String getProjectName()
|
||||
{
|
||||
return projectName;
|
||||
}
|
||||
public void setImageUrl(String imageUrl)
|
||||
public void setImageUrl(String imageUrl)
|
||||
{
|
||||
this.imageUrl = imageUrl;
|
||||
}
|
||||
|
||||
public String getImageUrl()
|
||||
public String getImageUrl()
|
||||
{
|
||||
return imageUrl;
|
||||
}
|
||||
public void setFileUrl(String fileUrl)
|
||||
public void setFileUrl(String fileUrl)
|
||||
{
|
||||
this.fileUrl = fileUrl;
|
||||
}
|
||||
|
||||
public String getFileUrl()
|
||||
public String getFileUrl()
|
||||
{
|
||||
return fileUrl;
|
||||
}
|
||||
@ -86,6 +92,7 @@ public class WbMaintenanceInformation extends BaseEntity
|
||||
.append("id", getId())
|
||||
.append("projectId", getProjectId())
|
||||
.append("projectName", getProjectName())
|
||||
.append("maintenanceType", getMaintenanceType())
|
||||
.append("imageUrl", getImageUrl())
|
||||
.append("fileUrl", getFileUrl())
|
||||
.append("createBy", getCreateBy())
|
||||
|
@ -65,6 +65,11 @@ public class WbProject extends BaseEntity
|
||||
.append("id", getId())
|
||||
.append("projectName", getProjectName())
|
||||
.append("projectOverview", getProjectOverview())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.ruoyi.abuwx.mapper;
|
||||
|
||||
import com.ruoyi.abuwx.domain.AbucoderWxuser;
|
||||
import com.ruoyi.common.core.domain.entity.AbucoderWxuser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.ruoyi.abuwx.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.abuwx.domain.WbMaintenanceInformation;
|
||||
|
||||
import java.util.List;
|
||||
@ -10,7 +11,7 @@ import java.util.List;
|
||||
* @author ruoyi
|
||||
* @date 2024-04-09
|
||||
*/
|
||||
public interface WbMaintenanceInformationMapper
|
||||
public interface WbMaintenanceInformationMapper extends BaseMapper<WbMaintenanceInformation>
|
||||
{
|
||||
/**
|
||||
* 查询维保记录
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.ruoyi.abuwx.service;
|
||||
|
||||
import com.ruoyi.abuwx.domain.AbucoderWxuser;
|
||||
import com.ruoyi.common.core.domain.entity.AbucoderWxuser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.ruoyi.abuwx.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.abuwx.domain.WbMaintenanceInformation;
|
||||
|
||||
import java.util.List;
|
||||
@ -10,7 +11,7 @@ import java.util.List;
|
||||
* @author ruoyi
|
||||
* @date 2024-04-09
|
||||
*/
|
||||
public interface IWbMaintenanceInformationService
|
||||
public interface IWbMaintenanceInformationService extends IService<WbMaintenanceInformation>
|
||||
{
|
||||
/**
|
||||
* 查询维保记录
|
||||
@ -59,4 +60,12 @@ public interface IWbMaintenanceInformationService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWbMaintenanceInformationById(Long id);
|
||||
|
||||
/**
|
||||
* 根据项目id查询维保记录列表
|
||||
*
|
||||
* @param projectId 项目id
|
||||
* @return 维保记录集合
|
||||
*/
|
||||
public List<WbMaintenanceInformation> selectWbMaintenanceInformationListByProjectId(Long projectId);
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
package com.ruoyi.abuwx.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.abuwx.mapper.AbucoderWxuserMapper;
|
||||
import com.ruoyi.abuwx.service.IAbucoderWxuserService;
|
||||
import com.ruoyi.common.core.domain.entity.AbucoderWxuser;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.abuwx.mapper.AbucoderWxuserMapper;
|
||||
import com.ruoyi.abuwx.domain.AbucoderWxuser;
|
||||
import com.ruoyi.abuwx.service.IAbucoderWxuserService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信用户Service业务层处理
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.ruoyi.abuwx.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.abuwx.domain.WbMaintenanceInformation;
|
||||
import com.ruoyi.abuwx.mapper.WbMaintenanceInformationMapper;
|
||||
import com.ruoyi.abuwx.service.IWbMaintenanceInformationService;
|
||||
@ -8,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 维保记录Service业务层处理
|
||||
@ -16,11 +18,15 @@ import java.util.List;
|
||||
* @date 2024-04-09
|
||||
*/
|
||||
@Service
|
||||
public class WbMaintenanceInformationServiceImpl implements IWbMaintenanceInformationService
|
||||
public class WbMaintenanceInformationServiceImpl extends ServiceImpl<WbMaintenanceInformationMapper, WbMaintenanceInformation>
|
||||
implements IWbMaintenanceInformationService
|
||||
{
|
||||
@Autowired
|
||||
private WbMaintenanceInformationMapper wbMaintenanceInformationMapper;
|
||||
|
||||
@Autowired
|
||||
private IWbMaintenanceInformationService iWbMaintenanceInformationService;
|
||||
|
||||
/**
|
||||
* 查询维保记录
|
||||
*
|
||||
@ -94,4 +100,18 @@ public class WbMaintenanceInformationServiceImpl implements IWbMaintenanceInform
|
||||
{
|
||||
return wbMaintenanceInformationMapper.deleteWbMaintenanceInformationById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据项目id查询维保记录列表
|
||||
*
|
||||
* @param projectId 项目id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<WbMaintenanceInformation> selectWbMaintenanceInformationListByProjectId(Long projectId) {
|
||||
List<WbMaintenanceInformation> list = iWbMaintenanceInformationService.list();
|
||||
List<WbMaintenanceInformation> collect = list.stream().filter(data -> data.getProjectId() != null
|
||||
&& data.getProjectId().equals(projectId)).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.ruoyi.abuwx.service.impl;
|
||||
import com.ruoyi.abuwx.domain.WbProject;
|
||||
import com.ruoyi.abuwx.mapper.WbProjectMapper;
|
||||
import com.ruoyi.abuwx.service.IWbProjectService;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -53,6 +54,7 @@ public class WbProjectServiceImpl implements IWbProjectService
|
||||
@Override
|
||||
public int insertWbProject(WbProject wbProject)
|
||||
{
|
||||
wbProject.setCreateTime(DateUtils.getNowDate());
|
||||
return wbProjectMapper.insertWbProject(wbProject);
|
||||
}
|
||||
|
||||
@ -65,6 +67,7 @@ public class WbProjectServiceImpl implements IWbProjectService
|
||||
@Override
|
||||
public int updateWbProject(WbProject wbProject)
|
||||
{
|
||||
wbProject.setUpdateTime(DateUtils.getNowDate());
|
||||
return wbProjectMapper.updateWbProject(wbProject);
|
||||
}
|
||||
|
||||
|
@ -3,24 +3,42 @@ package com.ruoyi.abuwxapi;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.abuwx.domain.AbucoderWxuser;
|
||||
import com.ruoyi.abuwx.domain.WbMaintenanceInformation;
|
||||
import com.ruoyi.abuwx.domain.WbProject;
|
||||
import com.ruoyi.abuwx.service.IAbucoderWxappConfigService;
|
||||
import com.ruoyi.abuwx.service.IAbucoderWxuserService;
|
||||
import com.ruoyi.abuwx.service.IWbMaintenanceInformationService;
|
||||
import com.ruoyi.abuwx.service.IWbProjectService;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.AbucoderWxuser;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.framework.config.ServerConfig;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/wxapi/")
|
||||
public class WxLoginController {
|
||||
public class WxLoginController extends BaseController {
|
||||
|
||||
/**
|
||||
* 测试接口
|
||||
@ -28,7 +46,7 @@ public class WxLoginController {
|
||||
*/
|
||||
@GetMapping("test")
|
||||
public AjaxResult test(){
|
||||
return AjaxResult.success("小程序api调试成功!~");
|
||||
return success("小程序api调试成功!~");
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@ -40,15 +58,29 @@ public class WxLoginController {
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private IWbMaintenanceInformationService wbMaintenanceInformationService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
@Autowired
|
||||
private IWbProjectService iWbProjectService;
|
||||
/**
|
||||
* 你自己的微信小程序APPID
|
||||
*/
|
||||
|
||||
private final static String AppID = "wxeda4365eac6838c5";
|
||||
private final static String AppID = "wxd193ba95e7ce382b";
|
||||
/**
|
||||
* 你自己的微信APP密钥
|
||||
*/
|
||||
private final static String AppSecret = "5005219596b2fa77ad930d06101102b1";
|
||||
private final static String AppSecret = "7ba02f4a9abb58dc2862f8a2762e8b85";
|
||||
|
||||
/**
|
||||
* 登录时获取的 code(微信官方提供的临时凭证)
|
||||
@ -73,22 +105,21 @@ public class WxLoginController {
|
||||
JSONObject jsonObject = JSON.parseObject(res);
|
||||
String openid = (String) jsonObject.get("openid");
|
||||
if (StrUtil.isEmpty(openid)) {
|
||||
return AjaxResult.error("未获取到openid");
|
||||
return error("未获取到openid");
|
||||
}
|
||||
/**先通过openid来查询是否存在*/
|
||||
AbucoderWxuser abucoderWxuser = iAbucoderWxuserService.selectAbucoderWxuserOpenID(openid);
|
||||
if (abucoderWxuser == null){
|
||||
/**如果不存在就插入到我们的数据库里*/
|
||||
AbucoderWxuser wxuser = new AbucoderWxuser();
|
||||
wxuser.setOpenid(openid);
|
||||
wxuser.setCreateTime(DateUtils.getNowDate());
|
||||
iAbucoderWxuserService.insertAbucoderWxuser(wxuser);
|
||||
abucoderWxuser = new AbucoderWxuser();
|
||||
abucoderWxuser.setOpenid(openid);
|
||||
abucoderWxuser.setCreateTime(DateUtils.getNowDate());
|
||||
iAbucoderWxuserService.insertAbucoderWxuser(abucoderWxuser);
|
||||
/**返回结果集到前段*/
|
||||
return AjaxResult.success(wxuser);
|
||||
}else {
|
||||
/**返回结果集到前段*/
|
||||
return AjaxResult.success(abucoderWxuser);
|
||||
|
||||
}
|
||||
return success(abucoderWxuser).put("token", getToken(abucoderWxuser));
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/upload")
|
||||
@ -103,7 +134,7 @@ public class WxLoginController {
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
AjaxResult ajax = success();
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
@ -112,7 +143,7 @@ public class WxLoginController {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,6 +167,102 @@ public class WxLoginController {
|
||||
abucoderWxuser.setUpdateTime(DateUtils.getNowDate());
|
||||
iAbucoderWxuserService.updateAbucoderWxuser(abucoderWxuser);
|
||||
//返回前段需要的数据
|
||||
return AjaxResult.success(abucoderWxuser);
|
||||
return success(abucoderWxuser);
|
||||
}
|
||||
|
||||
private String getToken(AbucoderWxuser wxuser){
|
||||
LoginUser loginUser = new LoginUser();
|
||||
loginUser.setWxuser(wxuser);
|
||||
return tokenService.createToken(loginUser);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* 根据项目id获取维保记录列表
|
||||
*/
|
||||
@RequestMapping("/informationList")
|
||||
public AjaxResult getInformationList(@RequestParam Long projectId)
|
||||
{
|
||||
return success(wbMaintenanceInformationService.selectWbMaintenanceInformationListByProjectId(projectId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取维保记录详细信息
|
||||
*/
|
||||
@RequestMapping(value = "/infoId")
|
||||
public AjaxResult getInformation(@RequestParam Long id)
|
||||
{
|
||||
return success(wbMaintenanceInformationService.selectWbMaintenanceInformationById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定维保用户
|
||||
*/
|
||||
@PostMapping("/bindWbuser")
|
||||
public AjaxResult bindWbuser(@RequestBody SysUser sysUser){
|
||||
String username = sysUser.getUserName();
|
||||
String password = sysUser.getPassword();
|
||||
String openid = sysUser.getOpenid();
|
||||
//校验传递的用户名、密码、openid都不为空
|
||||
if(StringUtils.isEmpty(username) || StringUtils.isEmpty(password) || StringUtils.isEmpty(openid)){
|
||||
return error();
|
||||
}
|
||||
//根据传递的用户名获取用户信息
|
||||
SysUser user = iSysUserService.selectUserByUserName(username);
|
||||
if(user == null){
|
||||
return error("账号或密码错误!");
|
||||
}
|
||||
if(!StringUtils.isEmpty(user.getOpenid())){
|
||||
return error("账号已绑定!");
|
||||
}
|
||||
//校验密码是否正确
|
||||
boolean b = SecurityUtils.matchesPassword(user.getPassword(), password);
|
||||
if (!SecurityUtils.matchesPassword(user.getPassword(), password)) {
|
||||
user.setOpenid(openid);
|
||||
userMapper.updateUser(user);
|
||||
}
|
||||
return success(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增维保记录
|
||||
*/
|
||||
@PostMapping("/addWbMaintenanceInformation")
|
||||
public AjaxResult addWbMaintenanceInformation(@RequestBody WbMaintenanceInformation wbMaintenanceInformation)
|
||||
{
|
||||
return success(wbMaintenanceInformationService.insertWbMaintenanceInformation(wbMaintenanceInformation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据openid查询当前微信用户角色
|
||||
*/
|
||||
@RequestMapping("/selectWXuserRole")
|
||||
public AjaxResult selectWXuserRole(@RequestParam String openid){
|
||||
//获取当前用户信息
|
||||
SysUser user = iSysUserService.selectUserByopenid(openid);
|
||||
if(user == null){
|
||||
//return success("roleIds",0);
|
||||
List<Object> data = new ArrayList<>();
|
||||
data.add(0);
|
||||
return new AjaxResult(HttpStatus.SUCCESS,"roleIds",data);
|
||||
}
|
||||
SysUser newUser = iSysUserService.selectUserById(user.getUserId());
|
||||
// List<SysRole> roles = user.getRoles();
|
||||
// List<Long> collect = roles.stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
||||
// return success("roleIds",collect);
|
||||
//return success("roleIds", newUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||
return new AjaxResult(HttpStatus.SUCCESS,"roleIds", newUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序分页查询查询项目管理列表
|
||||
*/
|
||||
@GetMapping("/projectList")
|
||||
public TableDataInfo list(WbProject wbProject)
|
||||
{
|
||||
startPage();
|
||||
List<WbProject> list = iWbProjectService.selectWbProjectList(wbProject);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,12 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.abuwx.mapper.WbMaintenanceInformationMapper">
|
||||
|
||||
|
||||
<resultMap type="WbMaintenanceInformation" id="WbMaintenanceInformationResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="projectName" column="project_name" />
|
||||
<result property="maintenanceType" column="maintenance_type" />
|
||||
<result property="imageUrl" column="image_url" />
|
||||
<result property="fileUrl" column="file_url" />
|
||||
<result property="createBy" column="create_by" />
|
||||
@ -18,29 +19,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWbMaintenanceInformationVo">
|
||||
select id, project_id, project_name, image_url, file_url, create_by, create_time, update_by, update_time, remark from wb_maintenance_information
|
||||
select id, project_id, project_name, maintenance_type, image_url, file_url, create_by, create_time, update_by, update_time, remark from wb_maintenance_information
|
||||
</sql>
|
||||
|
||||
<select id="selectWbMaintenanceInformationList" parameterType="WbMaintenanceInformation" resultMap="WbMaintenanceInformationResult">
|
||||
<include refid="selectWbMaintenanceInformationVo"/>
|
||||
<where>
|
||||
<where>
|
||||
<if test="projectId != null "> and project_id = #{projectId}</if>
|
||||
<if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
|
||||
<if test="maintenanceType != null and maintenanceType != ''"> and maintenance_type = #{maintenanceType}</if>
|
||||
<if test="imageUrl != null and imageUrl != ''"> and image_url = #{imageUrl}</if>
|
||||
<if test="fileUrl != null and fileUrl != ''"> and file_url = #{fileUrl}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectWbMaintenanceInformationById" parameterType="Long" resultMap="WbMaintenanceInformationResult">
|
||||
<include refid="selectWbMaintenanceInformationVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertWbMaintenanceInformation" parameterType="WbMaintenanceInformation" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into wb_maintenance_information
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="projectId != null">project_id,</if>
|
||||
<if test="projectName != null">project_name,</if>
|
||||
<if test="maintenanceType != null">maintenance_type,</if>
|
||||
<if test="imageUrl != null">image_url,</if>
|
||||
<if test="fileUrl != null">file_url,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
@ -52,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="projectName != null">#{projectName},</if>
|
||||
<if test="maintenanceType != null">#{maintenanceType},</if>
|
||||
<if test="imageUrl != null">#{imageUrl},</if>
|
||||
<if test="fileUrl != null">#{fileUrl},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
@ -67,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="projectName != null">project_name = #{projectName},</if>
|
||||
<if test="maintenanceType != null">maintenance_type = #{maintenanceType},</if>
|
||||
<if test="imageUrl != null">image_url = #{imageUrl},</if>
|
||||
<if test="fileUrl != null">file_url = #{fileUrl},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
@ -83,9 +88,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteWbMaintenanceInformationByIds" parameterType="String">
|
||||
delete from wb_maintenance_information where id in
|
||||
delete from wb_maintenance_information where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
@ -9,10 +9,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="projectName" column="project_name" />
|
||||
<result property="projectOverview" column="project_overview" />
|
||||
<result property="fileUrl" column="file_url" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWbProjectVo">
|
||||
select id, project_name, project_overview, file_url from wb_project
|
||||
select id, project_name, project_overview, file_url, create_by, create_time, update_by, update_time, remark from wb_project
|
||||
</sql>
|
||||
|
||||
<select id="selectWbProjectList" parameterType="WbProject" resultMap="WbProjectResult">
|
||||
@ -35,11 +40,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="projectName != null">project_name,</if>
|
||||
<if test="projectOverview != null">project_overview,</if>
|
||||
<if test="fileUrl != null">file_url,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="projectName != null">#{projectName},</if>
|
||||
<if test="projectOverview != null">#{projectOverview},</if>
|
||||
<if test="fileUrl != null">#{fileUrl},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -49,6 +64,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="projectName != null">project_name = #{projectName},</if>
|
||||
<if test="projectOverview != null">project_overview = #{projectOverview},</if>
|
||||
<if test="fileUrl != null">file_url = #{fileUrl},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.ruoyi.abuwx.domain;
|
||||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
@ -7,7 +7,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 微信用户对象 abucoder_wxuser
|
||||
*
|
||||
*
|
||||
* @author 阿卜Coder QQ932696181
|
||||
* @date 2024-04-07
|
||||
*/
|
||||
@ -34,48 +34,48 @@ public class AbucoderWxuser extends BaseEntity
|
||||
@Excel(name = "性别")
|
||||
private Integer gender;
|
||||
|
||||
public void setId(Long id)
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setNickname(String nickname)
|
||||
public void setNickname(String nickname)
|
||||
{
|
||||
this.nickname = nickname;
|
||||
}
|
||||
|
||||
public String getNickname()
|
||||
public String getNickname()
|
||||
{
|
||||
return nickname;
|
||||
}
|
||||
public void setAvatar(String avatar)
|
||||
public void setAvatar(String avatar)
|
||||
{
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getAvatar()
|
||||
public String getAvatar()
|
||||
{
|
||||
return avatar;
|
||||
}
|
||||
public void setOpenid(String openid)
|
||||
public void setOpenid(String openid)
|
||||
{
|
||||
this.openid = openid;
|
||||
}
|
||||
|
||||
public String getOpenid()
|
||||
public String getOpenid()
|
||||
{
|
||||
return openid;
|
||||
}
|
||||
public void setGender(Integer gender)
|
||||
public void setGender(Integer gender)
|
||||
{
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public Integer getGender()
|
||||
public Integer getGender()
|
||||
{
|
||||
return gender;
|
||||
}
|
@ -1,15 +1,17 @@
|
||||
package com.ruoyi.common.core.domain.model;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.ruoyi.common.core.domain.entity.AbucoderWxuser;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 登录用户身份权限
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class LoginUser implements UserDetails
|
||||
@ -71,6 +73,11 @@ public class LoginUser implements UserDetails
|
||||
*/
|
||||
private SysUser user;
|
||||
|
||||
/**
|
||||
* 微信登录信息
|
||||
*/
|
||||
private AbucoderWxuser wxuser;
|
||||
|
||||
public LoginUser()
|
||||
{
|
||||
}
|
||||
@ -129,6 +136,9 @@ public class LoginUser implements UserDetails
|
||||
@Override
|
||||
public String getUsername()
|
||||
{
|
||||
if(wxuser!=null){
|
||||
return wxuser.getOpenid();
|
||||
}
|
||||
return user.getUserName();
|
||||
}
|
||||
|
||||
@ -144,7 +154,7 @@ public class LoginUser implements UserDetails
|
||||
|
||||
/**
|
||||
* 指定用户是否解锁,锁定的用户无法进行身份验证
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
@ -156,7 +166,7 @@ public class LoginUser implements UserDetails
|
||||
|
||||
/**
|
||||
* 指示是否已过期的用户的凭据(密码),过期的凭据防止认证
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
@ -168,7 +178,7 @@ public class LoginUser implements UserDetails
|
||||
|
||||
/**
|
||||
* 是否可用 ,禁用的用户不能身份验证
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
@ -258,6 +268,14 @@ public class LoginUser implements UserDetails
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public AbucoderWxuser getWxuser() {
|
||||
return wxuser;
|
||||
}
|
||||
|
||||
public void setWxuser(AbucoderWxuser wxuser) {
|
||||
this.wxuser = wxuser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends GrantedAuthority> getAuthorities()
|
||||
{
|
||||
|
@ -1,14 +1,5 @@
|
||||
package com.ruoyi.framework.web.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
@ -22,6 +13,16 @@ import eu.bitwalker.useragentutils.UserAgent;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* token验证处理
|
||||
|
@ -1,19 +1,26 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户表 数据层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface SysUserMapper
|
||||
{
|
||||
/**
|
||||
*查询用户列表
|
||||
* @return
|
||||
*/
|
||||
public List<SysUser> selectList();
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
*
|
||||
* @param sysUser 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@ -21,7 +28,7 @@ public interface SysUserMapper
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已配用户角色列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@ -29,7 +36,7 @@ public interface SysUserMapper
|
||||
|
||||
/**
|
||||
* 根据条件分页查询未分配用户角色列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@ -37,7 +44,7 @@ public interface SysUserMapper
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@ -45,7 +52,7 @@ public interface SysUserMapper
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@ -53,7 +60,7 @@ public interface SysUserMapper
|
||||
|
||||
/**
|
||||
* 新增用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -61,7 +68,7 @@ public interface SysUserMapper
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -69,7 +76,7 @@ public interface SysUserMapper
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
* @return 结果
|
||||
@ -78,7 +85,7 @@ public interface SysUserMapper
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
@ -87,7 +94,7 @@ public interface SysUserMapper
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
@ -95,7 +102,7 @@ public interface SysUserMapper
|
||||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
*
|
||||
* @param userIds 需要删除的用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
@ -103,7 +110,7 @@ public interface SysUserMapper
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param userName 用户名称
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -1,18 +1,19 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户 业务层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysUserService
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@ -20,7 +21,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已分配用户角色列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@ -28,7 +29,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 根据条件分页查询未分配用户角色列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@ -36,7 +37,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@ -44,7 +45,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@ -52,7 +53,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 根据用户ID查询用户所属角色组
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 结果
|
||||
*/
|
||||
@ -60,7 +61,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 根据用户ID查询用户所属岗位组
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 结果
|
||||
*/
|
||||
@ -68,7 +69,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -92,21 +93,21 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 校验用户是否允许操作
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
*/
|
||||
public void checkUserAllowed(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验用户是否有数据权限
|
||||
*
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
public void checkUserDataScope(Long userId);
|
||||
|
||||
/**
|
||||
* 新增用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -114,7 +115,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -122,7 +123,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -130,7 +131,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 用户授权角色
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param roleIds 角色组
|
||||
*/
|
||||
@ -138,7 +139,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 修改用户状态
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -146,7 +147,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 修改用户基本信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -154,7 +155,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
* @return 结果
|
||||
@ -163,7 +164,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -171,7 +172,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
@ -180,7 +181,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
@ -188,7 +189,7 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
*
|
||||
* @param userIds 需要删除的用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
@ -196,11 +197,23 @@ public interface ISysUserService
|
||||
|
||||
/**
|
||||
* 导入用户数据
|
||||
*
|
||||
*
|
||||
* @param userList 用户数据列表
|
||||
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
||||
* @param operName 操作用户
|
||||
* @return 结果
|
||||
*/
|
||||
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
||||
|
||||
/**
|
||||
* 根据openid获取用户信息
|
||||
* @return
|
||||
*/
|
||||
public SysUser selectUserByopenid(String openid);
|
||||
|
||||
/**
|
||||
* 获取用户信息列表
|
||||
* @return
|
||||
*/
|
||||
public List<SysUser> selectList();
|
||||
}
|
||||
|
@ -1,15 +1,5 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.validation.Validator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
@ -22,17 +12,24 @@ import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import com.ruoyi.system.domain.SysUserPost;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
import com.ruoyi.system.mapper.SysPostMapper;
|
||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.mapper.SysUserPostMapper;
|
||||
import com.ruoyi.system.mapper.SysUserRoleMapper;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.validation.Validator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户 业务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
@ -61,9 +58,12 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
@Autowired
|
||||
protected Validator validator;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@ -76,7 +76,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已分配用户角色列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@ -89,7 +89,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 根据条件分页查询未分配用户角色列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@ -102,7 +102,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@ -114,7 +114,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@ -126,7 +126,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 查询用户所属角色组
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 结果
|
||||
*/
|
||||
@ -143,7 +143,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 查询用户所属岗位组
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 结果
|
||||
*/
|
||||
@ -160,7 +160,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -214,7 +214,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 校验用户是否允许操作
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
*/
|
||||
@Override
|
||||
@ -228,7 +228,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 校验用户是否有数据权限
|
||||
*
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
@Override
|
||||
@ -248,7 +248,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 新增保存用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -267,7 +267,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -279,7 +279,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 修改保存用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -301,7 +301,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 用户授权角色
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param roleIds 角色组
|
||||
*/
|
||||
@ -315,7 +315,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 修改用户状态
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -327,7 +327,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 修改用户基本信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -339,7 +339,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
* @return 结果
|
||||
@ -352,7 +352,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -364,7 +364,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
@ -377,7 +377,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 新增用户角色信息
|
||||
*
|
||||
*
|
||||
* @param user 用户对象
|
||||
*/
|
||||
public void insertUserRole(SysUser user)
|
||||
@ -387,7 +387,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 新增用户岗位信息
|
||||
*
|
||||
*
|
||||
* @param user 用户对象
|
||||
*/
|
||||
public void insertUserPost(SysUser user)
|
||||
@ -410,7 +410,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 新增用户角色信息
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param roleIds 角色组
|
||||
*/
|
||||
@ -433,7 +433,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
@ -450,7 +450,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
*
|
||||
* @param userIds 需要删除的用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
@ -472,7 +472,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 导入用户数据
|
||||
*
|
||||
*
|
||||
* @param userList 用户数据列表
|
||||
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
||||
* @param operName 操作用户
|
||||
@ -541,4 +541,31 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据openid获取用户信息
|
||||
* @param openid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SysUser selectUserByopenid(String openid) {
|
||||
List<SysUser> userList = iSysUserService.selectList();
|
||||
List<SysUser> collect = userList.stream().filter(data -> data.getOpenid() != null && data.getOpenid().equals(openid)).collect(Collectors.toList());
|
||||
if(collect.size() > 0){
|
||||
SysUser user = collect.get(0);
|
||||
return user;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> selectList() {
|
||||
List<SysUser> userList = userMapper.selectList();
|
||||
return userList;
|
||||
}
|
||||
}
|
||||
|
@ -143,6 +143,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectList" resultType="com.ruoyi.common.core.domain.entity.SysUser">
|
||||
select * from sys_user
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
|
Loading…
x
Reference in New Issue
Block a user