救援APP

This commit is contained in:
xiao-fajia 2024-08-22 15:42:58 +08:00
parent 98d25ce157
commit 3d4f5c71ee
16 changed files with 1257 additions and 355 deletions

View File

@ -10,4 +10,5 @@ public interface CommonErrorCodeConstants extends ErrorCodeConstants {
ErrorCode STAFF_CHANGE_CREATE_REPEAT = new ErrorCode(2_002_000_001, "该员工工作已交接");
ErrorCode STAFF_NOT_CHANGE = new ErrorCode(2_002_000_003, "该员工还有工作未交接,不可删除");
ErrorCode LOGIN_ACCOUNT_EXIST = new ErrorCode(2_002_000_004, "登录账号已存在");
ErrorCode LOGIN_ACCOUNT_NOT_EXIST = new ErrorCode(2_002_000_005, "登录账号不存在");
}

View File

@ -21,6 +21,11 @@
<artifactId>dl-module-company</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-system-biz</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>8</maven.compiler.source>

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.appBase.controller;
package cn.iocoder.yudao.module.appBase.controller.admin;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.rescue.core.controller.BaseController;
import cn.iocoder.yudao.module.rescue.core.page.TableDataInfo;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
@ -117,7 +118,7 @@ public class SysAnnouncementController extends BaseController
public CommonResult getOwnNoRead()
{
//当前登录用户
LoginUser loginUser = getLoginUser();
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
SysAnnouncement sysAnnouncement =new SysAnnouncement();
sysAnnouncement.setToUserId(loginUser.getId());
LambdaQueryWrapper<SysAnnouncement> queryWrapper =new LambdaQueryWrapper<>();
@ -132,7 +133,8 @@ public class SysAnnouncementController extends BaseController
public CommonResult setAllRead()
{
//当前登录用户
LoginUser loginUser = getLoginUser();
// LoginUser loginUser = getLoginUser();
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
SysAnnouncement sysAnnouncement =new SysAnnouncement();
sysAnnouncement.setToUserId(loginUser.getId());
LambdaUpdateWrapper<SysAnnouncement> queryWrapper =new LambdaUpdateWrapper<>();

View File

@ -7,8 +7,8 @@ import cn.hutool.http.HttpRequest;
import cn.iocoder.yudao.module.appBase.domain.SysAnnouncement;
import cn.iocoder.yudao.module.appBase.mapper.SysAnnouncementMapper;
import cn.iocoder.yudao.module.appBase.service.ISysAnnouncementService;
import cn.iocoder.yudao.module.rescue.controller.app.AnnouncementSocket;
import cn.iocoder.yudao.module.rescue.controller.app.UserAnnouncementSocket;
import cn.iocoder.yudao.module.rescue.app.controller.admin.AnnouncementSocket;
import cn.iocoder.yudao.module.rescue.app.controller.admin.UserAnnouncementSocket;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.rescue.controller.app;
package cn.iocoder.yudao.module.rescue.app.controller.admin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -0,0 +1,253 @@
package cn.iocoder.yudao.module.rescue.app.controller.admin;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.rescue.core.controller.BaseController;
import cn.iocoder.yudao.module.rescue.domain.RescueInfo;
import cn.iocoder.yudao.module.rescue.service.IRescueInfoService;
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* 请填写功能名称Controller
*
* @author ruoyi
* @date 2023-07-14
*/
@RestController
@RequestMapping("/app/rescueInfo")
public class RescueInfoController extends BaseController {
@Resource
private AdminUserApi userService;
@Resource
private RoleApi roleApi;
@Resource
private PermissionApi permissionApi;
@Resource
private IRescueInfoService rescueInfoService;
// @Autowired
// private ISysUserService userService;
//
//
//
/**
* 获取救援订单
*/
@GetMapping("/getRescueList")
public CommonResult getRescueList(RescueInfo rescueInfo,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
Page<RescueInfo> page = new Page<>(pageNum, pageSize);
//获取当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
AdminUserRespDTO user = userService.getUser(loginUser.getId());
List<Long> roleIds = permissionApi.getRoleIdsByUserId(user.getId());
List<RoleReqDTO> roleList = roleApi.getRoleList();
List<RoleReqDTO> roles = roleList.stream().filter(item -> roleIds.contains(item.getId())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(roles)) {
for (RoleReqDTO role : roles) {
//如果是调度中心
if (role.getCode().equals("admin") || role.getCode().equals("ddzx") || role.getCode().equals("qt") || role.getCode().equals("kj") || role.getCode().equals("cn")) {
IPage<RescueInfo> rescueInfos = rescueInfoService.selectRescueInfoListByAdmin(rescueInfo, page);
return success(rescueInfos);
}
}
}
IPage<RescueInfo> rescueInfos = rescueInfoService.selectRescueInfoList(rescueInfo, page);
return success(rescueInfos);
}
// @GetMapping("/getRescueStatistics")
// public AjaxResult getRescueStatistics(RescueInfo rescueInfo)
// {
//
// //获取当前登录用户
// LoginUser loginUser = SecurityUtils.getLoginUser();
// SysUser user = userService.selectUserById(loginUser.getUserId());
// List<SysRole> roles = user.getRoles();
// if (CollectionUtil.isNotEmpty(roles)){
// for (SysRole role : roles) {
// //如果是调度中心
// if (role.getRoleKey().equals("admin")||role.getRoleKey().equals("ddzx")||role.getRoleKey().equals("qt")||role.getRoleKey().equals("kj")||role.getRoleKey().equals("cn")){
// Map<String,Object> res = rescueInfoService.getRescueStatisticsByAdmin(rescueInfo);
// return success(res);
// }
// }
// }
//
// Map<String,Object> res = rescueInfoService.getRescueStatistics(rescueInfo);
// return success(res);
// }
// /**
// * 获取救援订单
// */
// @GetMapping("/rescueInfoDetail")
// public AjaxResult rescueInfoDetail(Long rescueId)
// {
// return success(rescueInfoService.rescueInfoDetail(rescueId));
// }
//
// /**
// * 新增道路救援发起
// */
// @Log(title = "【道路救援发起】", businessType = BusinessType.INSERT)
// @PostMapping("/add")
// public AjaxResult add(@RequestBody @Valid RescueInfo rescueInfo)
// {
// rescueInfoService.insertRescueInfo(rescueInfo);
// return success();
// }
//
// /**
// * 新增道路救援发起
// */
// @Log(title = "【道路救援编辑】", businessType = BusinessType.UPDATE)
// @PostMapping("/edit")
// public AjaxResult edit(@RequestBody @Valid RescueInfo rescueInfo)
// {
// rescueInfoService.updateRescueInfo(rescueInfo);
// return success();
// }
// /**
// * 取消道路救援
// */
// @Log(title = "取消【道路救援】", businessType = BusinessType.CLEAN)
// @PostMapping("/cancel")
// public AjaxResult cancel(Long id)
// {
// RescueInfo rescueInfo =new RescueInfo();
// rescueInfo.setId(id);
// rescueInfo.setRescueStatus("0");
// return toAjax(rescueInfoService.updateRescueInfo(rescueInfo));
// }
//
// /**
// * 删除道路救援
// */
// @Log(title = "删除道路救援", businessType = BusinessType.DELETE)
// @PostMapping("/delRescueInfo")
// public AjaxResult delRescueInfo(Long id)
// {
// rescueInfoService.deleteRescueInfoById(id);
// return success();
// }
//
// /**
// * 查询请填写功能名称列表
// */
// @GetMapping("/driverList")
// public TableDataInfo driverList(DriverInfoDto driverInfoDto)
// {
// startPage();
// List<DriverInfo2Dto> list = rescueInfoService.driverListApp(driverInfoDto);
// return getDataTable(list);
// }
// /**
// * 查询请填写功能名称列表
// */
// @GetMapping("/driverInMap")
// public AjaxResult driverInMap(DriverInfoDto driverInfoDto)
// {
// List<DriverInfo2Dto> driverList = rescueInfoService.driverInMap(driverInfoDto);
// return success(driverList);
// }
// /**
// * 查询请填写功能名称列表
// */
// @GetMapping("/driverInMap2")
// public AjaxResult driverInMap2()
// {
// return success(rescueInfoService.driverInMap2());
// }
// /**
// * 获取扣车订单
// */
// @GetMapping("/getKcList")
// public TableDataInfo getKcList(RescueInfo rescueInfo)
// {
//
// startPage();
// List<RescueInfo> rescueInfos = rescueInfoService.getKcList(rescueInfo);
// return getDataTable(rescueInfos);
// }
//
// /**
// * 获取扣车订单
// */
// @PostMapping("/openKc")
// public AjaxResult openKc(Long rescueId) throws Exception {
// //获取当前登录用户
// LoginUser loginUser = SecurityUtils.getLoginUser();
// SysUser user = userService.selectUserById(loginUser.getUserId());
// List<SysRole> roles = user.getRoles();
// if (CollectionUtil.isNotEmpty(roles)){
// for (SysRole role : roles) {
// //如果是交警大队
// if (role.getRoleKey().equals("jjdd")){
// rescueInfoService.openKc(rescueId);
// }
// }
// }
//
// return success();
// }
//
// /**
// * 进行还车
// */
// @PostMapping("/hcOpen")
// public AjaxResult hcOpen(Long rescueId)
// {
// //获取当前登录用户
// LoginUser loginUser = SecurityUtils.getLoginUser();
// SysUser user = userService.selectUserById(loginUser.getUserId());
// RescueInfo rescueInfo = rescueInfoService.getById(rescueId);
// rescueInfo.setHcTime(new Date());
// rescueInfo.setHcUserId(user.getUserId());
// rescueInfo.setHcUserName(user.getRealName());
// rescueInfo.setHcUserPhone(user.getPhonenumber());
// rescueInfo.setRescueStatus("8");
// rescueInfoService.updateById(rescueInfo);
// return success();
// }
//
// /**
// * 获取扣车订单
// */
// @GetMapping("/getHcList")
// public TableDataInfo getHcList(RescueInfo rescueInfo)
// {
//
// startPage();
// List<RescueInfo> rescueInfos = rescueInfoService.getHcList(rescueInfo);
// return getDataTable(rescueInfos);
// }
// /**
// * 获取扣车订单
// */
// @GetMapping("/statisticsInfo")
// public AjaxResult statisticsInfo(String type)
// {
// return success( rescueInfoService.statisticsInfo(type));
// }
}

View File

@ -0,0 +1,618 @@
package cn.iocoder.yudao.module.rescue.app.controller.admin;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.CommonErrorCodeConstants;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.rescue.domain.LoginBody;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
import cn.iocoder.yudao.module.system.service.permission.MenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 登录验证
*
* @author ruoyi
*/
@RestController
@Slf4j
@RequestMapping("/rescue")
public class SysLoginController {
@Resource
private AdminAuthService loginService;
@Resource
private MenuService menuService;
//
// @Autowired
// private SysPermissionService permissionService;
@Resource
private AdminUserApi userService;
@Resource
private PermissionApi permissionApi;
@Resource
private RoleApi roleApi;
@Resource
private DictDataApi dataApi;
// @Resource
// @Autowired
// private RedisCache redisCache;
//
// @Autowired
// private RestTemplate restTemplate;
//
// @Resource
// private WechatPayConfig wxConfig;
// @Autowired
// private IUserBalanceService balanceService;
// @Autowired
// private IShopMallPartnersService partnersService;
// @Autowired
// private IPartnerWorkerService jcWorkerService;
// @Autowired
// private IShopConfigService configService;
// @Autowired
// private IDriverInfoService driverInfoService;
// @Autowired
// private IDriveSchoolInfoService driveSchoolInfoService;
//
/**
* 登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@PostMapping("/login")
public CommonResult login(@RequestBody LoginBody loginBody) {
return null;
// ajax = success();
// // 生成令牌
// String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
// loginBody.getUuid());
// ajax.put(Constants.TOKEN, token);
// return ajax;
}
@GetMapping("/dict/data/type/{type}")
public CommonResult getDictDataByType(@PathVariable("type") String type){
return success(dataApi.getDictDataList(type));
}
/**
* 登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@PostMapping("/loginApp")
public CommonResult loginApp(@RequestBody LoginBody loginBody) throws Exception {
String userName = loginBody.getUsername();
AdminUserRespDTO user = userService.getUserByUsername(userName);
if (ObjectUtil.isEmpty(user)) {
return error(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST);
}
// 获取登录用户的角色信息
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(user.getId());
if (ObjectUtil.isEmpty(roleIdsByUserId) || roleIdsByUserId.size() == 0) {
return error(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST);
}
List<RoleReqDTO> roleList = roleApi.getRoleList();
List<String> roleNames = roleList.stream().filter(item -> roleIdsByUserId.contains(item.getId())).map(item -> item.getName()).collect(Collectors.toList());
Boolean flag = (loginBody.getType().equals("0") && roleNames.contains("救援业务管理员")) || (loginBody.getType().equals("1") && roleNames.contains("交警"));
// 角色认证登录
if (!flag) {
return error(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST);
}
AuthLoginReqVO authLoginReqVO = new AuthLoginReqVO();
authLoginReqVO.setUsername(loginBody.getUsername());
authLoginReqVO.setPassword(loginBody.getPassword());
return success(loginService.login(authLoginReqVO));
}
// /**
// * 司机登录方法
// *
// * @param loginBody 司机登录方法
// * @return 结果
// */
// @PostMapping("/driverLogin")
// public AjaxResult driverLogin(@RequestBody LoginBody loginBody) throws Exception {
// AjaxResult ajax = success();
// // 生成令牌
// String token = loginService.driverLogin(loginBody);
// ajax.put(Constants.TOKEN, token);
// return ajax;
// }
// /**
// * 登录获取验证码
// *
// * @return 结果
// */
// @PostMapping("/loginSmsCode")
// public AjaxResult loginSmsCode(String phone) {
// return loginService.loginSmsCode(phone);
// }
// /**
// * 登录方法
// *
// * @param loginBody 登录信息
// * @return 结果
// */
// @PostMapping("/loginJx")
// public AjaxResult loginJx(@RequestBody LoginBody loginBody) throws Exception {
// AjaxResult ajax = success();
// // 生成令牌
// String token = loginService.loginJx(loginBody);
// ajax.put(Constants.TOKEN, token);
// return ajax;
// }
// @PostMapping("/loginSmsCodeJx")
// public AjaxResult loginSmsCodeJx(String phone) {
// return loginService.loginSmsCodeJx(phone);
// }
// /**
// * 忘记密码获取验证码
// *
// * @return 结果
// */
// @PostMapping("/pwdSmsCode")
// public AjaxResult pwdSmsCode(String phone) {
// return loginService.pwdSmsCode(phone);
// }
// /**
// * 更新密码
// *
// * @return 结果
// */
// @PostMapping("/updatePwd")
// public AjaxResult updatePwd(String phone, String msgCode,String password) {
// if (!redisCache.hasKey(phone+"-pwdCode")||!redisCache.getCacheObject(phone+"-pwdCode").equals(msgCode)){
// return error("验证码错误");
// }
// SysUser sysUser = userService.selectUserByPhone(phone);
// if (userService.resetUserPwd(sysUser.getUserName(), SecurityUtils.encryptPassword(password)) > 0)
// {
// // 更新缓存用户密码
// sysUser.setPassword(SecurityUtils.encryptPassword(password));
// userService.updateUser(sysUser);
// return success();
// }
// return error("修改密码异常,请联系管理员");
// }
//
//
//
/**
* 获取用户信息
*
* @return 用户信息
*/
@GetMapping("/getInfo")
public CommonResult getInfo() {
HashMap<String, Object> map = new HashMap<>();
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
map.put("user", loginUser);
// 角色集合
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(loginUser.getId());
List<RoleReqDTO> roleList = roleApi.getRoleList();
List<String> roleNames = roleList.stream().filter(item -> roleIdsByUserId.contains(item.getId())).map(item -> item.getName()).collect(Collectors.toList());
map.put("roles", roleNames);
// 权限集合
List<MenuDO> menuList = menuService.getMenuList();
// Set<String> permissions = permissionService.getMenuPermission(user);
// ajax.put("permissions", permissions);
return success(map);
}
//
//
// @Resource
// private DriveSchoolCoachMapper driveSchoolCoachMapper;
//
// @Resource
// private SysUserMapper sysUserMapper;
//
// /**
// * 获取
// *
// * @return 用户信息
// */
// @GetMapping("getJxInfo")
// public AjaxResult getJxInfo()
// {
// SysUser user = SecurityUtils.getLoginUser().getUser();
// // 角色集合
// Set<String> roles = permissionService.getRolePermission(user);
// //获取驾校的
//
// Long userId = SecurityUtils.getUserId();
// SysUser sysUser = sysUserMapper.selectUserById(userId);
// String phonenumber = sysUser.getPhonenumber();
// DriveSchoolCoach driveSchoolCoach = driveSchoolCoachMapper.selectByPhonenumber(phonenumber);
//
// if (ObjectUtils.isNotEmpty(driveSchoolCoach)){
// user.setAvatar(driveSchoolCoach.getImage());
// }
// DriveSchoolInfo driveSchoolInfo = driveSchoolInfoService.getSchoolInfoByDeptId();
//
// AjaxResult ajax = success();
// ajax.put("user", user);
// ajax.put("roles", roles);
// ajax.put("schoolInfo", driveSchoolInfo);
// return ajax;
// }
// /**
// * 获取App用户信息
// *
// * @return 用户信息
// */
// @GetMapping("/getAppInfo")
// public AjaxResult getAppInfo()
// {
// SysUser user = SecurityUtils.getLoginUser().getUser();
// SysUser sysUser = userService.selectUserById(user.getUserId());
// // 角色集合
// Set<String> roles = permissionService.getRolePermission(user);
// UserBalance userBalance = balanceService.selectShopUserBalanceByUserId(user.getUserId());
// if (ObjectUtil.isNotEmpty(userBalance)) {
// sysUser.setBalance(userBalance.getBalance());
// } else {
// //新增用户积分表信息
// userBalance=new UserBalance();
// userBalance.setUserId(user.getUserId());
// userBalance.setAllBalance(0L);
// userBalance.setBalance(0L);
// userBalance.setFrozenBalance(0L);
// balanceService.insertShopUserBalance(userBalance);
// sysUser.setBalance(0L);
// }
// AjaxResult ajax = success();
// ajax.put("user", sysUser);
// ajax.put("role", roles);
// ShopConfig shopConfig = configService.selectShopConfigById(1L);
// if (StringUtils.isEmpty(shopConfig.getOpenRz())||shopConfig.getOpenRz().equals("0")){
// ajax.put("openRz", "0");
// }else {
// ajax.put("openRz", "1");
// }
// return ajax;
// }
//
// /**
// * 获取App用户信息
// *
// * @return 用户信息
// */
// @GetMapping("/getJcgfInfo")
// public AjaxResult getJcgfInfo() throws Exception {
// SysUser user = SecurityUtils.getLoginUser().getUser();
// SysUser sysUser = userService.selectUserById(user.getUserId());
// // 角色集合
// Set<String> roles = permissionService.getRolePermission(user);
// AjaxResult ajax = success();
// ajax.put("user", sysUser);
// ajax.put("role", roles);
// if (CollectionUtil.isNotEmpty(roles)){
// AtomicBoolean flag = new AtomicBoolean(false);
// roles.forEach(it->{
// if (it.equals("jcgf")){
// flag.set(true);
// }
// });
// if (!flag.get()){
// throw new Exception("身份有误");
// }
// }else {
// throw new Exception("身份有误");
// }
//
// return ajax;
// }
// //获取交警的信息
// @GetMapping("/getJjInfo")
// public AjaxResult getJjInfo() throws Exception {
// SysUser user = SecurityUtils.getLoginUser().getUser();
// SysUser sysUser = userService.selectUserById(user.getUserId());
// // 角色集合
// Set<String> roles = permissionService.getRolePermission(user);
// AjaxResult ajax = success();
// ajax.put("user", sysUser);
// ajax.put("role", roles);
// if (CollectionUtil.isNotEmpty(roles)){
// AtomicBoolean flag = new AtomicBoolean(false);
// roles.forEach(it->{
// if (it.equals("jjdd")){
// flag.set(true);
// }
// });
// if (!flag.get()){
// throw new Exception("身份有误");
// }
// }else {
// throw new Exception("身份有误");
// }
//
// return ajax;
// }
// /**
// * 获取App用户信息
// *
// * @return 用户信息
// */
// @GetMapping("/getJcPartnerInfo")
// public AjaxResult getJcPartnerInfo()
// {
// LambdaQueryWrapper<ShopMallPartners> queryWrapper =new LambdaQueryWrapper<>();
// SysUser user = SecurityUtils.getLoginUser().getUser();
// queryWrapper.eq(ShopMallPartners::getUserId,user.getUserId()).eq(ShopMallPartners::getType,"jc").eq(ShopMallPartners::getIsBanned,"0");
// ShopMallPartners partner = partnersService.getOne(queryWrapper);
// if (ObjectUtil.isEmpty(partner)){
// return error("信息有误");
// }
// SysUser sysUser = userService.selectUserById(user.getUserId());
// AjaxResult ajax = success();
// ajax.put("user", sysUser);
// return ajax;
// }
//
// /**
// * 获取救援司机用户信息
// *
// * @return 用户信息
// */
// @GetMapping("/getRescueDriverInfo")
// public AjaxResult getRescueDriverInfo()
// {
// LambdaQueryWrapper<DriverInfo> queryWrapper =new LambdaQueryWrapper<>();
// SysUser user = SecurityUtils.getLoginUser().getUser();
// queryWrapper.eq(DriverInfo::getUserId, user.getUserId());
// DriverInfo driverInfo = driverInfoService.getOne(queryWrapper);
// if (ObjectUtil.isEmpty(driverInfo)){
// return error("信息有误");
// }
// SysUser sysUser = userService.selectUserById(user.getUserId());
// AjaxResult ajax = success();
// ajax.put("user", sysUser);
// ajax.put("driverInfo", driverInfo);
// return ajax;
// }
//
//
// /**
// * 获取检测工用户信息
// *
// * @return 用户信息
// */
// @GetMapping("/getJcWorkerInfo")
// public AjaxResult getJcWorkerInfo()
// {
// AjaxResult ajax = success();
// LambdaQueryWrapper<PartnerWorker> queryWrapper =new LambdaQueryWrapper<>();
// SysUser user = SecurityUtils.getLoginUser().getUser();
// queryWrapper.eq(PartnerWorker::getUserId,user.getUserId());
// PartnerWorker worker = jcWorkerService.getOne(queryWrapper);
// if (ObjectUtil.isNotEmpty(worker)){
// LambdaQueryWrapper<ShopMallPartners> queryWrapper1 =new LambdaQueryWrapper<>();
// queryWrapper1.eq(ShopMallPartners::getPartnerId,worker.getPartnerId()).eq(ShopMallPartners::getType,"jc").eq(ShopMallPartners::getIsBanned,"0");
// ShopMallPartners partner = partnersService.getOne(queryWrapper1);
// if (ObjectUtil.isEmpty(partner)){
// return error("信息有误");
// }
// ajax.put("partnerInfo", partner);
// }else {
// return error("信息有误");
// }
// SysUser sysUser = userService.selectUserById(user.getUserId());
//
// ajax.put("user", sysUser);
//
// return ajax;
// }
// /**
// * 获取路由信息
// *
// * @return 路由信息
// */
// @GetMapping("getRouters")
// public AjaxResult getRouters()
// {
// Long userId = SecurityUtils.getUserId();
// List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
// return AjaxResult.success(menuService.buildMenus(menus));
// }
// @ApiOperation("微信登录")
//
// @ApiImplicitParams({
// @ApiImplicitParam(name = "WxLoginBody",dataType = "WxLoginBody", value = "jscode", required = true, paramType = "body")
// })
// @PostMapping("/wxLogin")
// public AjaxResult wxLogin(@RequestBody WxLoginBody wxLoginBody) {
// String code = wxLoginBody.getCode();
// //秘钥
// String encryptedIv = wxLoginBody.getEncryptedIv();
// //加密数据
// String encryptedData = wxLoginBody.getEncryptedData();
//
//
// //想微信服务器发送请求获取用户信息
// String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + wxConfig.getAppId() + "&secret=" + wxConfig.getAppSecret() + "&js_code=" + code + "&grant_type=authorization_code";
// System.out.println(url);
// String res = restTemplate.getForObject(url, String.class);
// JSONObject jsonObject = JSONObject.parseObject(res);
//
// //获取session_key和openid
// String sessionKey = jsonObject.getString("session_key");
// String openId = jsonObject.getString("openid");
//
// System.out.println(sessionKey);
// System.out.println(openId);
// //解密
// String decryptResult = "";
// try {
// //如果没有绑定微信开放平台解析结果是没有unionid的
// decryptResult = decrypt(sessionKey, encryptedIv, encryptedData);
// } catch (Exception e) {
// e.printStackTrace();
// return AjaxResult.error("微信登录失败!");
// }
//
// if (StringUtils.hasText(decryptResult)) {
// //如果解析成功,获取token
// String token = loginService.wxLogin(decryptResult,openId,wxLoginBody.getInviteId());
// AjaxResult ajax = AjaxResult.success();
// ajax.put(Constants.TOKEN, token);
// return ajax;
// } else {
// return AjaxResult.error("微信登录失败!");
// }
// }
//
// @PostMapping("/wxLoginJc")
// public AjaxResult wxLoginJc(@RequestBody WxLoginBody wxLoginBody) {
// String code = wxLoginBody.getCode();
// //秘钥
// String encryptedIv = wxLoginBody.getEncryptedIv();
// //加密数据
// String encryptedData = wxLoginBody.getEncryptedData();
//
// //想微信服务器发送请求获取用户信息
// String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + wxConfig.getAppId() + "&secret=" + wxConfig.getAppSecret() + "&js_code=" + code + "&grant_type=authorization_code";
// System.out.println(url);
// String res = restTemplate.getForObject(url, String.class);
// JSONObject jsonObject = JSONObject.parseObject(res);
//
// //获取session_key和openid
// String sessionKey = jsonObject.getString("session_key");
// String openId = jsonObject.getString("openid");
//
// System.out.println(sessionKey);
// System.out.println(openId);
// //解密
// String decryptResult = "";
// try {
// //如果没有绑定微信开放平台解析结果是没有unionid的
// decryptResult = decrypt(sessionKey, encryptedIv, encryptedData);
// } catch (Exception e) {
// e.printStackTrace();
// return AjaxResult.error("微信登录失败!");
// }
//
// if (StringUtils.hasText(decryptResult)) {
// //如果解析成功,获取token
// String token = loginService.wxLoginJc(decryptResult,openId,wxLoginBody.getInviteId());
// AjaxResult ajax = AjaxResult.success();
// ajax.put(Constants.TOKEN, token);
// return ajax;
// } else {
// return AjaxResult.error("微信登录失败!");
// }
// }
//
// @PostMapping("/wxLoginRescue")
// public AjaxResult wxLoginRescue(@RequestBody WxLoginBody wxLoginBody) {
// String code = wxLoginBody.getCode();
// //秘钥
// String encryptedIv = wxLoginBody.getEncryptedIv();
// //加密数据
// String encryptedData = wxLoginBody.getEncryptedData();
//
//
// //想微信服务器发送请求获取用户信息
// String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + wxConfig.getAppId() + "&secret=" + wxConfig.getAppSecret() + "&js_code=" + code + "&grant_type=authorization_code";
// System.out.println(url);
// String res = restTemplate.getForObject(url, String.class);
// JSONObject jsonObject = JSONObject.parseObject(res);
//
// //获取session_key和openid
// String sessionKey = jsonObject.getString("session_key");
// String openId = jsonObject.getString("openid");
//
// System.out.println(sessionKey);
// System.out.println(openId);
// //解密
// String decryptResult = "";
// try {
// //如果没有绑定微信开放平台解析结果是没有unionid的
// decryptResult = decrypt(sessionKey, encryptedIv, encryptedData);
// } catch (Exception e) {
// e.printStackTrace();
// return AjaxResult.error("微信登录失败!");
// }
//
// if (StringUtils.hasText(decryptResult)) {
// //如果解析成功,获取token
// String token = loginService.wxLoginRescue(decryptResult,openId,wxLoginBody.getInviteId());
// AjaxResult ajax = AjaxResult.success();
// ajax.put(Constants.TOKEN, token);
// return ajax;
// } else {
// return AjaxResult.error("微信登录失败!");
// }
// }
//
// /**
// * AES解密
// */
// private String decrypt(String sessionKey,String encryptedIv,String encryptedData) throws Exception{
// // 转化为字节数组
// byte[] key = Base64.decode(sessionKey);
// byte[] iv = Base64.decode(encryptedIv);
// byte[] encData = Base64.decode(encryptedData);
// // 如果密钥不足16位那么就补足
// int base =16;
// if (key.length % base !=0) {
// int groups = key.length / base +(key.length % base != 0 ? 1 : 0);
// byte[] temp = new byte[groups * base];
// Arrays.fill(temp,(byte) 0);
// System.arraycopy(key,0,temp,0,key.length);
// key = temp;
// }
// // 如果初始向量不足16位也补足
// if (iv.length % base !=0) {
// int groups = iv.length / base +(iv.length % base != 0 ? 1 : 0);
// byte[] temp = new byte[groups * base];
// Arrays.fill(temp,(byte) 0);
// System.arraycopy(iv,0,temp,0,iv.length);
// iv = temp;
// }
//
// AlgorithmParameterSpec ivSpec = new IvParameterSpec(iv);
// String resultStr = null;
//
// try {
// Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
// SecretKeySpec keySpec = new SecretKeySpec(key,"AES");
// cipher.init(Cipher.DECRYPT_MODE,keySpec,ivSpec);
// resultStr = new String(cipher.doFinal(encData),"UTF-8");
// } catch (Exception e){
//// logger.info("解析错误");
// e.printStackTrace();
// }
//
// // 解析加密后的字符串
// return resultStr;
// }
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.rescue.controller.app;
package cn.iocoder.yudao.module.rescue.app.controller.admin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.rescue.domain;
import lombok.Data;
/**
* 用户登录对象
*
* @author ruoyi
*/
@Data
public class LoginBody
{
/**
* 用户名
*/
private String username;
/**
* 用户密码
*/
private String password;
/**
* 验证码
*/
private String code;
/**
* 唯一标识
*/
private String uuid;
//0账号密码登录1手机号登录 2:管理 3教练
private String type;
private String types;
private String phone;
private String realName;
}

View File

@ -32,7 +32,7 @@ public interface RescueInfoMapper extends BaseMapper<RescueInfo>
* @param rescueInfo 请填写功能名称
* @return 请填写功能名称集合
*/
public List<RescueInfo> selectRescueInfoList(RescueInfo rescueInfo);
IPage<RescueInfo> selectRescueInfoList(@Param("map") RescueInfo rescueInfo, Page<RescueInfo> page);
IPage<RescueInfo> selectRescueListSystem2(@Param("map") RescueInfo rescueInfo, Page<RescueInfo> page);
JSONObject listData(RescueInfo rescueInfo);
@ -42,7 +42,7 @@ public interface RescueInfoMapper extends BaseMapper<RescueInfo>
* @param rescueInfo 请填写功能名称
* @return 请填写功能名称集合
*/
public List<RescueInfo> selectRescueInfoListApp(RescueInfo rescueInfo);
IPage<RescueInfo> selectRescueInfoListApp(@Param("map") RescueInfo rescueInfo, Page<RescueInfo> page);
List<RescueInfo> getKcList(RescueInfo rescueInfo);

View File

@ -38,13 +38,13 @@ public interface IRescueInfoService extends IService<RescueInfo>
* @param rescueInfo 请填写功能名称
* @return 请填写功能名称集合
*/
public List<RescueInfo> selectRescueInfoList(RescueInfo rescueInfo);
IPage<RescueInfo> selectRescueInfoList(RescueInfo rescueInfo, Page<RescueInfo> page);
List<RescueInfo> getKcList(RescueInfo rescueInfo);
List<RescueInfo> getHcList(RescueInfo rescueInfo);
void openKc(Long rescueId) throws Exception;
public List<RescueInfo> selectRescueInfoListByAdmin(RescueInfo rescueInfo);
IPage<RescueInfo> selectRescueInfoListByAdmin(RescueInfo rescueInfo, Page<RescueInfo> page);
JSONObject rescueInfoDetail(Long rescueId);
List<RescueInfo> selectRescueListSystem(RescueInfo rescueInfo);
IPage<RescueInfo> selectRescueListSystem2(RescueInfo rescueInfo, Page<RescueInfo> page);

View File

@ -20,11 +20,6 @@
<result property="carInsuranceTime" column="car_insurance_time"/>
<result property="carCheckTime" column="car_check_time"/>
<result property="possessorId" column="possessor_id"/>
<result property="deptId" column="dept_id"/>
<result property="creator" column="creator"/>
<result property="createTime" column="create_time"/>
<result property="updater" column="updater"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectRescueCarInfoVo">
@ -98,7 +93,6 @@
<if test="carInsuranceTime != null">car_insurance_time,</if>
<if test="carCheckTime != null">car_check_time,</if>
<if test="possessorId != null">possessor_id,</if>
<if test="deptId != null">dept_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="rescueCarType != null">#{rescueCarType},</if>
@ -115,7 +109,6 @@
<if test="carInsuranceTime != null">#{carInsuranceTime},</if>
<if test="carCheckTime != null">#{carCheckTime},</if>
<if test="possessorId != null">#{possessorId},</if>
<if test="deptId != null">#{deptId},</if>
</trim>
</insert>
@ -136,7 +129,6 @@
<if test="carInsuranceTime != null">car_insurance_time = #{carInsuranceTime},</if>
<if test="carCheckTime != null">car_check_time = #{carCheckTime},</if>
<if test="possessorId != null">possessor_id = #{possessorId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
</trim>
where id = #{id}
</update>
@ -165,14 +157,10 @@
SELECT *
FROM `rescue_car_info`
where car_insurance_time <![CDATA[<]]> #{warnTime}
and dept_id = #{deptId}
</select>
<select id="warnListNj" resultType="cn.iocoder.yudao.module.rescue.domain.RescueCarInfo">
SELECT *
FROM `rescue_car_info`
where car_check_time <![CDATA[<]]> #{warnTime}
and dept_id = #{deptId}
</select>
</mapper>

View File

@ -13,42 +13,41 @@
left join rescue_order_info roi on roi.rescue_info_id = ri.id
<where>
1=1
<if test="rescueStatus != null ">
<if test="map.rescueStatus != null ">
<choose>
<when test="rescueStatus == '1'.toString()">
<when test="map.rescueStatus == '1'.toString()">
<!-- 救援中 -->
and (ri.rescue_status = '1' or ri.rescue_status = '2' or ri.rescue_status = '3')
</when>
<when test="rescueStatus == '2'.toString()">
<when test="map.rescueStatus == '2'.toString()">
<!--待支付 -->
and roi.order_status ='1'
</when>
<when test="rescueStatus == '3'.toString()">
<when test="map.rescueStatus == '3'.toString()">
<!-- 待取车 -->
and ri.rescue_status ='6'
</when>
<when test="rescueStatus == '4'.toString()">
<when test="map.rescueStatus == '4'.toString()">
<!-- 评价 -->
and roi.order_status ='2'
</when>
<when test="rescueStatus == '5'.toString()">
<when test="map.rescueStatus == '5'.toString()">
<!-- 评价 -->
and roi.order_status ='3'
</when>
<when test="rescueStatus == '8'.toString()">
<when test="map.rescueStatus == '8'.toString()">
<!-- 已还车 -->
and ri.rescue_status ='8'
</when>
<when test="rescueStatus == '9'.toString()">
<when test="map.rescueStatus == '9'.toString()">
<!-- 扣车中未解扣 -->
and (ri.rescue_type ='5' and ri.rescue_status <![CDATA[<]]> '6')
</when>
</choose>
</if>
<if test="licenseNum != null ">
and ri.license_num like concat('%',#{licenseNum},'%')
<if test="map.licenseNum != null ">
and ri.license_num like concat('%',#{map.licenseNum},'%')
</if>
${params.dataScope}
</where>
order by ri.create_time desc
</select>
@ -119,6 +118,7 @@
${params.dataScope}
</where>
</select>
<select id="selectRescueInfoListApp" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"
resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
SELECT
@ -127,37 +127,37 @@
rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id
<where>
(ri.user_id = #{userId} or connection_phone =#{connectionPhone})
<if test="rescueStatus != null ">
(ri.user_id = #{map.userId} or connection_phone =#{map.connectionPhone})
<if test="map.rescueStatus != null ">
<choose>
<when test="rescueStatus == '1'.toString()">
<when test="map.rescueStatus == '1'.toString()">
<!-- 救援中 -->
and (ri.rescue_status = '1' or ri.rescue_status = '2' or ri.rescue_status = '3')
</when>
<when test="rescueStatus == '2'.toString()">
<when test="map.rescueStatus == '2'.toString()">
<!--待支付 -->
and roi.order_status ='1'
</when>
<when test="rescueStatus == '3'.toString()">
<when test="map.rescueStatus == '3'.toString()">
<!-- 待取车 -->
and ri.rescue_status ='6'
</when>
<when test="rescueStatus == '4'.toString()">
<when test="map.rescueStatus == '4'.toString()">
<!-- 评价 -->
and roi.order_status ='2'
</when>
<when test="rescueStatus == '5'.toString()">
<when test="map.rescueStatus == '5'.toString()">
<!-- 评价 -->
and roi.order_status ='3'
</when>
<when test="rescueStatus == '8'.toString()">
<when test="map.rescueStatus == '8'.toString()">
<!-- 已还车 -->
and ri.rescue_status ='8'
</when>
</choose>
</if>
<if test="licenseNum != null ">
and ri.license_num like concat('%',#{licenseNum},'%')
<if test="map.licenseNum != null ">
and ri.license_num like concat('%',#{map.licenseNum},'%')
</if>
</where>
order by ri.create_time desc

View File

@ -129,6 +129,7 @@ public class YudaoWebSecurityConfigurerAdapter {
.authorizeRequests()
// 1.1 静态资源可匿名访问
.antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll()
.antMatchers(HttpMethod.POST, "/admin-api/rescue/login", "/admin-api/rescue/loginApp").anonymous()
// 1.2 设置 @PermitAll 无需认证
.antMatchers(HttpMethod.GET, permitAllUrls.get(HttpMethod.GET).toArray(new String[0])).permitAll()
.antMatchers(HttpMethod.POST, permitAllUrls.get(HttpMethod.POST).toArray(new String[0])).permitAll()

View File

@ -257,6 +257,8 @@ yudao:
- /admin-api/pay/notify/** # 支付回调通知,不携带租户编号
- /jmreport/* # 积木报表,无法携带租户编号
- /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,无法携带租户编号
# - /admin-api/rescue/login
- /admin-api/rescue/loginApp
ignore-tables:
- system_tenant
- system_tenant_package