oss上传,手动结束订单待完善,数据权限优化调整
This commit is contained in:
@ -85,6 +85,8 @@
|
|||||||
<version>1.6.2</version>
|
<version>1.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public class AfterServiceStarted implements ApplicationRunner {
|
|||||||
// || ip.equals(CodeConstants.IP_28) || ip.equals(CodeConstants.IP_29)
|
// || ip.equals(CodeConstants.IP_28) || ip.equals(CodeConstants.IP_29)
|
||||||
// || ip.equals(CodeConstants.IP_30) ) {
|
// || ip.equals(CodeConstants.IP_30) ) {
|
||||||
// logger.info("--------------是否启动导入文件---------------:{}", ip);
|
// logger.info("--------------是否启动导入文件---------------:{}", ip);
|
||||||
queueUploadTask.queueUploadFile();
|
// queueUploadTask.queueUploadFile();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,10 @@ public class ZcBaseUserController extends BaseController
|
|||||||
public TableDataInfo list(ZcBaseUser zcBaseUser)
|
public TableDataInfo list(ZcBaseUser zcBaseUser)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
|
// 运营者账号,只能查询所属商户数据
|
||||||
|
if(UserConstants.USER_TYPE_02.equals(getSysUser().getUserType())){
|
||||||
|
zcBaseUser.setOperatorId(getSysUser().getGroupId());
|
||||||
|
}
|
||||||
List<ZcBaseUser> list = zcBaseUserService.selectZcBaseUserList(zcBaseUser);
|
List<ZcBaseUser> list = zcBaseUserService.selectZcBaseUserList(zcBaseUser);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
|||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import org.springframework.data.annotation.Transient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租车用户信息对象 zc_base_user
|
* 租车用户信息对象 zc_base_user
|
||||||
@ -54,6 +55,11 @@ public class ZcBaseUser extends BaseEntity
|
|||||||
/** 删除标志(0代表存在 2代表删除) */
|
/** 删除标志(0代表存在 2代表删除) */
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private Long operatorId;
|
||||||
|
@Transient
|
||||||
|
private Long storeId;
|
||||||
|
|
||||||
/** 用户与门店信息信息 */
|
/** 用户与门店信息信息 */
|
||||||
private List<ZcBaseUserStore> zcBaseUserStoreList;
|
private List<ZcBaseUserStore> zcBaseUserStoreList;
|
||||||
|
|
||||||
@ -166,6 +172,22 @@ public class ZcBaseUser extends BaseEntity
|
|||||||
this.zcBaseUserStoreList = zcBaseUserStoreList;
|
this.zcBaseUserStoreList = zcBaseUserStoreList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getOperatorId() {
|
||||||
|
return operatorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperatorId(Long operatorId) {
|
||||||
|
this.operatorId = operatorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getStoreId() {
|
||||||
|
return storeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStoreId(Long storeId) {
|
||||||
|
this.storeId = storeId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.ruoyi.baseUser.mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.baseUser.domain.ZcBaseUser;
|
import com.ruoyi.baseUser.domain.ZcBaseUser;
|
||||||
import com.ruoyi.baseUser.domain.ZcBaseUserStore;
|
import com.ruoyi.baseUser.domain.ZcBaseUserStore;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租车用户信息Mapper接口
|
* 租车用户信息Mapper接口
|
||||||
@ -28,7 +29,7 @@ public interface ZcBaseUserMapper
|
|||||||
*/
|
*/
|
||||||
public List<ZcBaseUser> selectZcBaseUserList(ZcBaseUser zcBaseUser);
|
public List<ZcBaseUser> selectZcBaseUserList(ZcBaseUser zcBaseUser);
|
||||||
|
|
||||||
public List<ZcBaseUser> selectZcBaseUserByStoreId(Long storeId);
|
public List<ZcBaseUser> selectZcBaseUserByStoreId(@Param("storeId") Long storeId, @Param("operatorId") Long operatorId);
|
||||||
|
|
||||||
public ZcBaseUser selectZcBaseUserByPhone(String phone);
|
public ZcBaseUser selectZcBaseUserByPhone(String phone);
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public interface IZcBaseUserService
|
|||||||
public List<ZcBaseUser> selectZcBaseUserList(ZcBaseUser zcBaseUser);
|
public List<ZcBaseUser> selectZcBaseUserList(ZcBaseUser zcBaseUser);
|
||||||
|
|
||||||
|
|
||||||
public List<ZcBaseUser> selectZcBaseUserByStoreId(Long storeId);
|
public List<ZcBaseUser> selectZcBaseUserByStoreId(Long storeId, Long operatorId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增租车用户信息
|
* 新增租车用户信息
|
||||||
|
|||||||
@ -53,8 +53,8 @@ public class ZcBaseUserServiceImpl implements IZcBaseUserService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ZcBaseUser> selectZcBaseUserByStoreId(Long storeId){
|
public List<ZcBaseUser> selectZcBaseUserByStoreId(Long storeId, Long operatorId){
|
||||||
return zcBaseUserMapper.selectZcBaseUserByStoreId(storeId);
|
return zcBaseUserMapper.selectZcBaseUserByStoreId(storeId,operatorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -68,6 +68,7 @@ public class CompanyController extends BaseController
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(Company company)
|
public TableDataInfo list(Company company)
|
||||||
{
|
{
|
||||||
|
getUserId();
|
||||||
startPage();
|
startPage();
|
||||||
// 运营者账号,只能查询所属商户数据
|
// 运营者账号,只能查询所属商户数据
|
||||||
if(UserConstants.USER_TYPE_02 .equals(getSysUser().getUserType())){
|
if(UserConstants.USER_TYPE_02 .equals(getSysUser().getUserType())){
|
||||||
@ -124,32 +125,6 @@ public class CompanyController extends BaseController
|
|||||||
}
|
}
|
||||||
company.setCreateBy(getLoginName());
|
company.setCreateBy(getLoginName());
|
||||||
int flag = companyService.insertCompany(company);
|
int flag = companyService.insertCompany(company);
|
||||||
if(flag > 0) {
|
|
||||||
// 创建运营商成功,添加运营商账号
|
|
||||||
SysUser user = new SysUser();
|
|
||||||
user.setSalt("");
|
|
||||||
String password = UserConstants.DEFAULT_PASSWORD;
|
|
||||||
user.setLoginName(company.getPhone());
|
|
||||||
user.setUserName(company.getCompanyName());
|
|
||||||
user.setUserType(UserConstants.USER_TYPE_02);
|
|
||||||
user.setPhonenumber(company.getPhone());
|
|
||||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), password, user.getSalt()));
|
|
||||||
//所属区域转换省市县乡村组字段
|
|
||||||
Zoning zoning = areaHnService.getAreaSuperior(company.getCitys());
|
|
||||||
user.setCityCode(zoning.getCityCode());
|
|
||||||
user.setCityName(zoning.getCityName());
|
|
||||||
user.setDistrictCode(zoning.getDistrictCode());
|
|
||||||
user.setDistrictName(zoning.getDistrictName());
|
|
||||||
user.setTownCode(zoning.getTownCode());
|
|
||||||
user.setTownName(zoning.getTownName());
|
|
||||||
user.setCreateBy(getLoginName());
|
|
||||||
user.setCreateTime(DateUtils.getNowDate());
|
|
||||||
user.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
user.setStatus("0");
|
|
||||||
user.setCreateById(getUserId());
|
|
||||||
user.setGroupId(company.getId());
|
|
||||||
userService.insertUser(user);
|
|
||||||
}
|
|
||||||
return toAjax(flag);
|
return toAjax(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -157,7 +157,7 @@ public class CompanyStoreController extends BaseController
|
|||||||
CompanyStore companyStore = companyStoreService.selectCompanyStoreById(id);
|
CompanyStore companyStore = companyStoreService.selectCompanyStoreById(id);
|
||||||
mmap.put("companyStore", companyStore);
|
mmap.put("companyStore", companyStore);
|
||||||
|
|
||||||
List<ZcBaseUser> zcBaseUserList = zcBaseUserService.selectZcBaseUserByStoreId(id);
|
List<ZcBaseUser> zcBaseUserList = zcBaseUserService.selectZcBaseUserByStoreId(id,null);
|
||||||
mmap.put("zcBaseUserList", zcBaseUserList);
|
mmap.put("zcBaseUserList", zcBaseUserList);
|
||||||
return prefix + "/addStoreUser";
|
return prefix + "/addStoreUser";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,10 +5,15 @@ import java.util.List;
|
|||||||
import com.ruoyi.common.constant.CompanyConstants;
|
import com.ruoyi.common.constant.CompanyConstants;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.exception.RRException;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
import com.ruoyi.operation.domain.CompanyStore;
|
import com.ruoyi.operation.domain.CompanyStore;
|
||||||
import com.ruoyi.operation.service.ICompanyStoreService;
|
import com.ruoyi.operation.service.ICompanyStoreService;
|
||||||
|
import com.ruoyi.system.domain.Zoning;
|
||||||
|
import com.ruoyi.system.service.ISysAreaHnService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -32,6 +37,12 @@ public class CompanyServiceImpl implements ICompanyService
|
|||||||
private ISysUserService userService;
|
private ISysUserService userService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ICompanyStoreService companyStoreService;
|
private ICompanyStoreService companyStoreService;
|
||||||
|
@Autowired
|
||||||
|
private SysPasswordService passwordService;
|
||||||
|
@Autowired
|
||||||
|
private ISysAreaHnService areaHnService;
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService sysUserService;
|
||||||
/**
|
/**
|
||||||
* 查询运营商
|
* 查询运营商
|
||||||
*
|
*
|
||||||
@ -88,7 +99,38 @@ public class CompanyServiceImpl implements ICompanyService
|
|||||||
{
|
{
|
||||||
company.setCreateTime(DateUtils.getNowDate());
|
company.setCreateTime(DateUtils.getNowDate());
|
||||||
company.setUpdateTime(DateUtils.getNowDate());
|
company.setUpdateTime(DateUtils.getNowDate());
|
||||||
return companyMapper.insertCompany(company);
|
int flag = companyMapper.insertCompany(company);
|
||||||
|
|
||||||
|
if(flag > 0) {
|
||||||
|
// 创建运营商成功,添加运营商账号
|
||||||
|
SysUser user = new SysUser();
|
||||||
|
user.setSalt("");
|
||||||
|
String password = UserConstants.DEFAULT_PASSWORD;
|
||||||
|
user.setLoginName(company.getPhone());
|
||||||
|
user.setUserName(company.getCompanyName());
|
||||||
|
user.setUserType(UserConstants.USER_TYPE_02);
|
||||||
|
user.setPhonenumber(company.getPhone());
|
||||||
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), password, user.getSalt()));
|
||||||
|
//所属区域转换省市县乡村组字段
|
||||||
|
Zoning zoning = areaHnService.getAreaSuperior(company.getCitys());
|
||||||
|
user.setCityCode(zoning.getCityCode());
|
||||||
|
user.setCityName(zoning.getCityName());
|
||||||
|
user.setDistrictCode(zoning.getDistrictCode());
|
||||||
|
user.setDistrictName(zoning.getDistrictName());
|
||||||
|
user.setTownCode(zoning.getTownCode());
|
||||||
|
user.setTownName(zoning.getTownName());
|
||||||
|
user.setCreateBy(ShiroUtils.getSysUser().getLoginName());
|
||||||
|
user.setCreateTime(DateUtils.getNowDate());
|
||||||
|
user.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
user.setStatus("0");
|
||||||
|
user.setCreateById(ShiroUtils.getSysUser().getUserId());
|
||||||
|
user.setGroupId(company.getId());
|
||||||
|
// 新增运营商用户绑定运营商角色
|
||||||
|
Long[] roleIds = {100L};
|
||||||
|
user.setRoleIds(roleIds);
|
||||||
|
userService.insertUser(user);
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
package com.ruoyi.orders.controller;
|
package com.ruoyi.orders.controller;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.operation.domain.Company;
|
import com.ruoyi.operation.domain.Company;
|
||||||
import com.ruoyi.operation.service.ICompanyService;
|
import com.ruoyi.operation.service.ICompanyService;
|
||||||
|
import com.ruoyi.orders.util.OrderStatusEnum;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@ -140,4 +143,20 @@ public class ZcOrderMainController extends BaseController
|
|||||||
{
|
{
|
||||||
return toAjax(zcOrderMainService.deleteZcOrderMainByOrderIds(ids));
|
return toAjax(zcOrderMainService.deleteZcOrderMainByOrderIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("orders:order:close")
|
||||||
|
@Log(title = "结束订单", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/manualEndOrder")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult manualEndOrder(Long orderId)
|
||||||
|
{
|
||||||
|
ZcOrderMain zcOrderMain =new ZcOrderMain();
|
||||||
|
zcOrderMain.setOrderId(orderId);
|
||||||
|
zcOrderMain.setOrderStatus(OrderStatusEnum.MANUAL_END.getCode());
|
||||||
|
zcOrderMain.setUpdateBy(getLoginName());
|
||||||
|
zcOrderMain.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
|
||||||
|
return toAjax(zcOrderMainService.updateManualEndOrder(zcOrderMain));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,4 +58,7 @@ public interface IZcOrderMainService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteZcOrderMainByOrderId(Long orderId);
|
public int deleteZcOrderMainByOrderId(Long orderId);
|
||||||
|
|
||||||
|
public int updateManualEndOrder(ZcOrderMain zcOrderMain);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,6 +109,12 @@ public class ZcOrderMainServiceImpl implements IZcOrderMainService
|
|||||||
return zcOrderMainMapper.deleteZcOrderMainByOrderId(orderId);
|
return zcOrderMainMapper.deleteZcOrderMainByOrderId(orderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateManualEndOrder(ZcOrderMain zcOrderMain) {
|
||||||
|
//订单手动结束逻辑待完善
|
||||||
|
return zcOrderMainMapper.updateZcOrderMain(zcOrderMain);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增租车子订单信息
|
* 新增租车子订单信息
|
||||||
*
|
*
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
package com.ruoyi.orders.util;
|
||||||
|
|
||||||
|
public enum OrderStatusEnum {
|
||||||
|
WAIT_PAY("WAIT_PAY", "待支付"),
|
||||||
|
WAIT_PICK("WAIT_PICK", "待取车"),
|
||||||
|
RENT_ING("RENT_ING", "租赁中"),
|
||||||
|
WAIT_RETURN("WAIT_RETURN", "待还车"),
|
||||||
|
RENT_OVERDUE("RENT_OVERDUE", "逾期"),
|
||||||
|
AUTO_END("AUTO_END", "自动结束"),
|
||||||
|
MANUAL_END("MANUAL_END", "手动结束");
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final String info;
|
||||||
|
|
||||||
|
OrderStatusEnum(String code, String info) {
|
||||||
|
this.code = code;
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInfo() {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -15,6 +15,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.ruoyi.common.exception.RRException;
|
import com.ruoyi.common.exception.RRException;
|
||||||
import com.ruoyi.common.utils.ShiroUtils;
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||||
|
import com.ruoyi.common.utils.oss.OssService;
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.system.domain.CommonAttachment;
|
import com.ruoyi.system.domain.CommonAttachment;
|
||||||
import com.ruoyi.system.domain.SysAreaHn;
|
import com.ruoyi.system.domain.SysAreaHn;
|
||||||
@ -58,6 +59,10 @@ public class CommonController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISysAreaHnService sysAreaHnService;
|
private ISysAreaHnService sysAreaHnService;
|
||||||
|
|
||||||
|
// 在类中添加 OSS 服务注入
|
||||||
|
@Autowired
|
||||||
|
private OssService ossService;
|
||||||
|
|
||||||
private static final String FILE_DELIMETER = ",";
|
private static final String FILE_DELIMETER = ",";
|
||||||
|
|
||||||
@GetMapping("/area")
|
@GetMapping("/area")
|
||||||
@ -278,17 +283,33 @@ public class CommonController
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
/** oss --------------- */
|
||||||
|
// // 检查文件是否为空
|
||||||
|
// if (file.isEmpty()) {
|
||||||
|
// return AjaxResult.error("上传文件不能为空");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 检查文件类型(可选)
|
||||||
|
// String contentType = file.getContentType();
|
||||||
|
// if (contentType == null || !contentType.startsWith("image/")) {
|
||||||
|
// return AjaxResult.error("只允许上传图片文件");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 上传到 OSS
|
||||||
|
// String url = ossService.uploadImage(file);
|
||||||
|
// // 返回文件访问 URL
|
||||||
|
// String[] str = url.split("/");
|
||||||
|
// String fileName = str[str.length - 1];
|
||||||
|
|
||||||
|
/** 原文件上传 --------------- */
|
||||||
// 上传文件路径
|
// 上传文件路径
|
||||||
String filePath = RuoYiConfig.getUploadPath();
|
String filePath = RuoYiConfig.getUploadPath();
|
||||||
// 上传并返回新文件名称
|
// 上传并返回新文件名称
|
||||||
String fileName = FileUploadUtils.upload(filePath, fileType, file);
|
String fileName = FileUploadUtils.upload(filePath, fileType, file);
|
||||||
|
|
||||||
String uuid = UUID.randomUUID().toString();
|
|
||||||
|
|
||||||
// String url = serverConfig.getUrl() + "/common/newDownload?uuid=" + uuid;
|
|
||||||
|
|
||||||
String url = serverConfig.getUrl() + fileName;
|
String url = serverConfig.getUrl() + fileName;
|
||||||
|
/** -------------------------- */
|
||||||
|
String uuid = UUID.randomUUID().toString();
|
||||||
CommonAttachment insert = new CommonAttachment();
|
CommonAttachment insert = new CommonAttachment();
|
||||||
insert.setUuid(uuid);
|
insert.setUuid(uuid);
|
||||||
insert.setDataId(dataId);
|
insert.setDataId(dataId);
|
||||||
@ -308,6 +329,7 @@ public class CommonController
|
|||||||
ajax.put("url", url);
|
ajax.put("url", url);
|
||||||
ajax.put("uuid", uuid);
|
ajax.put("uuid", uuid);
|
||||||
return ajax;
|
return ajax;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -391,4 +413,35 @@ public class CommonController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OSS 图片上传请求
|
||||||
|
*/
|
||||||
|
@PostMapping("/ossUpload")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult ossUpload(@RequestParam("file") MultipartFile file) {
|
||||||
|
try {
|
||||||
|
// 检查文件是否为空
|
||||||
|
if (file.isEmpty()) {
|
||||||
|
return AjaxResult.error("上传文件不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查文件类型(可选)
|
||||||
|
String contentType = file.getContentType();
|
||||||
|
if (contentType == null || !contentType.startsWith("image/")) {
|
||||||
|
return AjaxResult.error("只允许上传图片文件");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上传到 OSS
|
||||||
|
String url = ossService.uploadImage(file);
|
||||||
|
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("url", url);
|
||||||
|
ajax.put("fileName", file.getOriginalFilename());
|
||||||
|
ajax.put("fileSize", file.getSize());
|
||||||
|
return ajax;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error("上传失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,6 +75,10 @@ public class SysUserController extends BaseController
|
|||||||
public TableDataInfo list(SysUser user)
|
public TableDataInfo list(SysUser user)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
|
// 运营者账号,只能查询所属商户数据
|
||||||
|
if(UserConstants.USER_TYPE_02.equals(getSysUser().getUserType())){
|
||||||
|
user.setGroupId(getSysUser().getGroupId());
|
||||||
|
}
|
||||||
List<SysUser> list = userService.selectUserList(user);
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,3 +82,4 @@ renren:
|
|||||||
# token有效时长,7天,单位秒
|
# token有效时长,7天,单位秒
|
||||||
expire: 604800
|
expire: 604800
|
||||||
header: token
|
header: token
|
||||||
|
|
||||||
|
|||||||
@ -148,3 +148,12 @@ csrf:
|
|||||||
swagger:
|
swagger:
|
||||||
# 是否开启swagger
|
# 是否开启swagger
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
|
# 阿里云 OSS 配置
|
||||||
|
aliyun:
|
||||||
|
oss:
|
||||||
|
endpoint: oss-cn-shanghai.aliyuncs.com
|
||||||
|
accessKeyId: LTAI5tFZygsWsFqAqUbBmCrB
|
||||||
|
accessKeySecret: n417ym6PZyq5Gc4NHHps3EwzNiClDJ
|
||||||
|
bucketName: sczx-car-rental # 需要你提供具体的 bucket 名称
|
||||||
|
domain: car-rental.sczxnet.com
|
||||||
|
|||||||
@ -42,19 +42,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select id, user_name, avatar_url, password, phone_number, role_id, is_store, nick_name, wechat_openid, alipay_userid, del_flag, create_time, update_time from zc_base_user
|
select id, user_name, avatar_url, password, phone_number, role_id, is_store, nick_name, wechat_openid, alipay_userid, del_flag, create_time, update_time from zc_base_user
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectZcBaseUserList" parameterType="ZcBaseUser" resultMap="ZcBaseUserResult">
|
<select id="selectZcBaseUserList" parameterType="ZcBaseUser" resultMap="ZcBaseUserZcBaseUserStoreResult">
|
||||||
<include refid="selectZcBaseUserVo"/>
|
|
||||||
|
select a.id, a.user_name, a.avatar_url, a.password, a.phone_number, a.role_id, a.is_store, a.nick_name, a.wechat_openid, a.alipay_userid, a.del_flag, a.create_time, a.update_time,
|
||||||
|
b.id as sub_id, b.user_id as sub_user_id, b.operator_id as sub_operator_id, b.store_id as sub_store_id, b.create_time as sub_create_time
|
||||||
|
from zc_base_user a
|
||||||
|
left join zc_base_user_store b on b.user_id = a.id
|
||||||
<where>
|
<where>
|
||||||
del_flag = '0'
|
a.del_flag = '0'
|
||||||
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
<if test="userName != null and userName != ''"> and a.user_name like concat('%', #{userName}, '%')</if>
|
||||||
<if test="avatarUrl != null and avatarUrl != ''"> and avatar_url = #{avatarUrl}</if>
|
<if test="avatarUrl != null and avatarUrl != ''"> and a.avatar_url = #{avatarUrl}</if>
|
||||||
<if test="password != null and password != ''"> and password = #{password}</if>
|
<if test="password != null and password != ''"> and a.password = #{password}</if>
|
||||||
<if test="phoneNumber != null and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>
|
<if test="phoneNumber != null and phoneNumber != ''"> and a.phone_number = #{phoneNumber}</if>
|
||||||
<if test="roleId != null "> and role_id = #{roleId}</if>
|
<if test="roleId != null "> and a.role_id = #{roleId}</if>
|
||||||
<if test="isStore != null "> and is_store = #{isStore}</if>
|
<if test="isStore != null "> and a.is_store = #{isStore}</if>
|
||||||
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
|
<if test="nickName != null and nickName != ''"> and a.nick_name like concat('%', #{nickName}, '%')</if>
|
||||||
<if test="wechatOpenid != null and wechatOpenid != ''"> and wechat_openid = #{wechatOpenid}</if>
|
<if test="wechatOpenid != null and wechatOpenid != ''"> and a.wechat_openid = #{wechatOpenid}</if>
|
||||||
<if test="alipayUserid != null and alipayUserid != ''"> and alipay_userid = #{alipayUserid}</if>
|
<if test="alipayUserid != null and alipayUserid != ''"> and a.alipay_userid = #{alipayUserid}</if>
|
||||||
|
<if test="storeId != null "> and b.store_id = #{storeId}</if>
|
||||||
|
<if test="operatorId != null "> and b.operator_id = #{operatorId}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -63,7 +69,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
b.id as sub_id, b.user_id as sub_user_id, b.operator_id as sub_operator_id, b.store_id as sub_store_id, b.create_time as sub_create_time
|
b.id as sub_id, b.user_id as sub_user_id, b.operator_id as sub_operator_id, b.store_id as sub_store_id, b.create_time as sub_create_time
|
||||||
from zc_base_user a
|
from zc_base_user a
|
||||||
left join zc_base_user_store b on b.user_id = a.id
|
left join zc_base_user_store b on b.user_id = a.id
|
||||||
where a.del_flag = '0' and b.store_id = #{storeId}
|
where a.del_flag = '0'
|
||||||
|
<if test="storeId != null "> and b.store_id = #{storeId}</if>
|
||||||
|
<if test="operatorId != null "> and b.operator_id = #{operatorId}</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectZcBaseUserById" parameterType="Long" resultMap="ZcBaseUserZcBaseUserStoreResult">
|
<select id="selectZcBaseUserById" parameterType="Long" resultMap="ZcBaseUserZcBaseUserStoreResult">
|
||||||
|
|||||||
@ -104,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="storeName != null and storeName!= '' "> and s.name = #{storeName}</if>
|
<if test="storeName != null and storeName!= '' "> and s.name = #{storeName}</if>
|
||||||
<if test="licensePlate != null and licensePlate!= '' "> and zc.license_plate = #{licensePlate}</if>
|
<if test="licensePlate != null and licensePlate!= '' "> and zc.license_plate = #{licensePlate}</if>
|
||||||
</where>
|
</where>
|
||||||
|
order by a.update_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectZcOrderMainByOrderId" parameterType="Long" resultMap="ZcOrderMainZcOrderSubResult">
|
<select id="selectZcOrderMainByOrderId" parameterType="Long" resultMap="ZcOrderMainZcOrderSubResult">
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-order-edit" th:object="${zcOrderMain}">
|
<form class="form-horizontal m" id="form-order-edit" th:object="${zcOrderMain}">
|
||||||
<h4 class="form-header h4">租车订单信息</h4>
|
<h4 class="form-header h4">租车订单信息</h4>
|
||||||
<input name="orderId" th:field="*{orderId}" type="hidden">
|
<input id="orderId" name="orderId" th:field="*{orderId}" type="hidden">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label is-required">订单编号:</label>
|
<label class="col-sm-2 control-label is-required">订单编号:</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
@ -129,6 +129,8 @@
|
|||||||
<div class="col-sm-12 select-table table-striped">
|
<div class="col-sm-12 select-table table-striped">
|
||||||
<table id="bootstrap-table"></table>
|
<table id="bootstrap-table"></table>
|
||||||
</div>
|
</div>
|
||||||
|
<br/>
|
||||||
|
<button type="button" th:if="not (*{orderStatus} == 'AUTO_END' or *{orderStatus} == 'MANUAL_END')" class="btn btn-white btn-sm" onclick="manualEndOrder()">手动结束订单</i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -256,24 +258,23 @@
|
|||||||
$.table.init(options);
|
$.table.init(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
function addRow() {
|
function manualEndOrder(){
|
||||||
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
var orderId = $("#orderId").val();
|
||||||
var row = {
|
$.modal.confirm("确认手动结束该订单", function() {
|
||||||
index: $.table.serialNumber(count),
|
$.operate.post(prefix + "/manualEndOrder", { "orderId": orderId}, function(result) {
|
||||||
suborderNo: "",
|
if (result.code == web_status.SUCCESS) {
|
||||||
suborderType: "",
|
$.modal.msgSuccess("操作成功");
|
||||||
amount: "",
|
// 关闭当前弹窗
|
||||||
paymentMethod: "",
|
$.modal.close();
|
||||||
vinBatteryNo: "",
|
var parent = activeWindow();
|
||||||
createdAt: "",
|
parent.$.table.refresh();
|
||||||
paymentId: "",
|
|
||||||
paidAt: "",
|
} else {
|
||||||
remark: "",
|
$.modal.msgError(result.msg);
|
||||||
delFlag: "",
|
}
|
||||||
createTime: "",
|
});
|
||||||
updateTime: "",
|
|
||||||
}
|
})
|
||||||
sub.addRow(row);
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -93,6 +93,7 @@
|
|||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
var editFlag = [[${@permission.hasPermi('orders:order:edit')}]];
|
var editFlag = [[${@permission.hasPermi('orders:order:edit')}]];
|
||||||
var removeFlag = [[${@permission.hasPermi('orders:order:remove')}]];
|
var removeFlag = [[${@permission.hasPermi('orders:order:remove')}]];
|
||||||
|
var closeFlag = [[${@permission.hasPermi('orders:order:close')}]];
|
||||||
var orderStatusDatas = [[${@dict.getType('key_order_status')}]];
|
var orderStatusDatas = [[${@dict.getType('key_order_status')}]];
|
||||||
var rentalTypeDatas = [[${@dict.getType('key_order_rental_type')}]];
|
var rentalTypeDatas = [[${@dict.getType('key_order_rental_type')}]];
|
||||||
var depositFreeDatas = [[${@dict.getType('key_rent_deposit_free')}]];
|
var depositFreeDatas = [[${@dict.getType('key_rent_deposit_free')}]];
|
||||||
@ -244,21 +245,12 @@
|
|||||||
field: 'startRentTime',
|
field: 'startRentTime',
|
||||||
title: '开始计费时间',
|
title: '开始计费时间',
|
||||||
width: '160px'
|
width: '160px'
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
align: 'center',
|
|
||||||
width: '100px',
|
|
||||||
formatter: function(value, row, index) {
|
|
||||||
var actions = [];
|
|
||||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.orderId + '\',1300,800)"><i class="fa fa-edit"></i>查看</a> ');
|
|
||||||
//actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderId + '\')"><i class="fa fa-remove"></i>删除</a>');
|
|
||||||
return actions.join('');
|
|
||||||
}
|
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
$.table.init(options);
|
$.table.init(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@ -126,6 +126,12 @@
|
|||||||
<artifactId>commons-fileupload</artifactId>
|
<artifactId>commons-fileupload</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun.oss</groupId>
|
||||||
|
<artifactId>aliyun-sdk-oss</artifactId>
|
||||||
|
<version>3.10.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- excel工具 -->
|
<!-- excel工具 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
|
|||||||
@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
package com.ruoyi.common.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "aliyun.oss")
|
||||||
|
public class OssConfig {
|
||||||
|
private String endpoint;
|
||||||
|
private String accessKeyId;
|
||||||
|
private String accessKeySecret;
|
||||||
|
private String bucketName;
|
||||||
|
private String domain;
|
||||||
|
|
||||||
|
// Getters and Setters
|
||||||
|
public String getEndpoint() {
|
||||||
|
return endpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndpoint(String endpoint) {
|
||||||
|
this.endpoint = endpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccessKeyId() {
|
||||||
|
return accessKeyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccessKeyId(String accessKeyId) {
|
||||||
|
this.accessKeyId = accessKeyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccessKeySecret() {
|
||||||
|
return accessKeySecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccessKeySecret(String accessKeySecret) {
|
||||||
|
this.accessKeySecret = accessKeySecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBucketName() {
|
||||||
|
return bucketName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBucketName(String bucketName) {
|
||||||
|
this.bucketName = bucketName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDomain() {
|
||||||
|
return domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDomain(String domain) {
|
||||||
|
this.domain = domain;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,76 @@
|
|||||||
|
|
||||||
|
package com.ruoyi.common.utils.oss;
|
||||||
|
|
||||||
|
import com.aliyun.oss.OSS;
|
||||||
|
import com.aliyun.oss.OSSClientBuilder;
|
||||||
|
import com.aliyun.oss.model.PutObjectRequest;
|
||||||
|
import com.ruoyi.common.config.OssConfig;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class OssService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OssConfig ossConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件到 OSS
|
||||||
|
* @param file 文件
|
||||||
|
* @param folder 文件夹路径,例如 "images/"
|
||||||
|
* @return 文件访问 URL
|
||||||
|
*/
|
||||||
|
public String uploadFile(MultipartFile file, String folder) throws IOException {
|
||||||
|
// 创建 OSSClient 实例
|
||||||
|
OSS ossClient = new OSSClientBuilder().build(ossConfig.getEndpoint(), ossConfig.getAccessKeyId(), ossConfig.getAccessKeySecret());
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 获取原始文件名
|
||||||
|
String originalFilename = file.getOriginalFilename();
|
||||||
|
// 生成唯一文件名
|
||||||
|
String fileName = UUID.randomUUID().toString().replaceAll("-", "") +
|
||||||
|
(originalFilename != null ? originalFilename.substring(originalFilename.lastIndexOf(".")) : "");
|
||||||
|
|
||||||
|
// 完整路径
|
||||||
|
String objectName = folder + fileName;
|
||||||
|
|
||||||
|
// 获取文件输入流
|
||||||
|
InputStream inputStream = file.getInputStream();
|
||||||
|
|
||||||
|
// 创建 PutObjectRequest 对象
|
||||||
|
PutObjectRequest putObjectRequest = new PutObjectRequest(ossConfig.getBucketName(), objectName, inputStream);
|
||||||
|
|
||||||
|
// 上传文件
|
||||||
|
ossClient.putObject(putObjectRequest);
|
||||||
|
|
||||||
|
// 返回文件访问 URL
|
||||||
|
return "https://" + ossConfig.getDomain() + "/" + objectName;
|
||||||
|
} catch (com.aliyun.oss.OSSException e) {
|
||||||
|
if ("AccessDenied".equals(e.getErrorCode())) {
|
||||||
|
throw new IOException("OSS权限不足,请联系管理员配置权限。错误代码: " + e.getErrorCode(), e);
|
||||||
|
}
|
||||||
|
throw new IOException("OSS上传失败: " + e.getMessage(), e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new IOException("OSS上传失败: " + e.getMessage(), e);
|
||||||
|
} finally {
|
||||||
|
// 关闭 OSSClient
|
||||||
|
if (ossClient != null) {
|
||||||
|
ossClient.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传图片文件到 OSS
|
||||||
|
* @param file 图片文件
|
||||||
|
* @return 图片访问 URL
|
||||||
|
*/
|
||||||
|
public String uploadImage(MultipartFile file) throws IOException {
|
||||||
|
return uploadFile(file, "images/");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user