订单承租人个出租方数据隔离

This commit is contained in:
liang.chao 2024-12-01 19:17:11 +08:00
parent bd97f4a286
commit 7f3b989b56
7 changed files with 41 additions and 11 deletions

View File

@ -25,7 +25,6 @@ public class DevInfoVo extends DevInfo {
@ApiModelProperty(value = "下单用户id")
private Long orderUser;
/* 装备组别 parent */
@ApiModelProperty(value = "装备组别")
private String groupName;

View File

@ -156,5 +156,7 @@ public interface DevInfoMapper {
List<LeaseVo> getLeaseList(Long maId);
String selectTaskNumByMonth(@Param("date") Date nowDate);
Integer upMaStatus(DevInfoVo devInfoVo);
}

View File

@ -184,11 +184,20 @@ public class DevInfoServiceImpl implements DevInfoService {
List<DevNameVo> voList = new ArrayList<>();
List<DevInfoVo> hotList = devInfoMapper.selectDevInfoHotList(devInfo);
if (CollectionUtil.isEmpty(hotList)) {
return AjaxResult.success(Collections.emptyMap());
}
extractedFile(hotList);
for (DevInfoVo devInfoVo : hotList) {
if (devInfoVo.getDeviceCount() <= 0){
// 下架
devInfoVo.setMaStatus(1);
devInfoMapper.upMaStatus(devInfoVo);
}
}
List<DevInfoVo> collect = hotList.stream().filter(t -> t.getMaStatus() != 1).collect(Collectors.toList());
// 按照一级设备类型进行分组
Map<String, List<DevInfoVo>> groupedByFirstName = hotList.stream()
Map<String, List<DevInfoVo>> groupedByFirstName = collect.stream()
.filter(info -> info.getFirstName() != null)
.collect(Collectors.groupingBy(DevInfoVo::getFirstName));
// 遍历 Map 中的每个条目将数据转化成 DevNameVo 对象

View File

@ -50,8 +50,11 @@ public class OrderInfoDto {
@ApiModelProperty(value = "下单地址")
private String address;
@ApiModelProperty(value = "下单用户id")
private Long orderUser;
@ApiModelProperty(value = "买方承租方用户id")
private String buyerId;
@ApiModelProperty(value = "卖方出租方用户id")
private String sellerId;
@ApiModelProperty(value = "创建人")
private Long creater;
@ -94,4 +97,7 @@ public class OrderInfoDto {
private String ids;
@ApiModelProperty(value = "0:出租方 1:承租方")
private String flag;
}

View File

@ -57,7 +57,7 @@ public class OrderServiceImpl implements OrderService {
String code = "D" + System.currentTimeMillis();
orderInfoDto.setCode(code);
Long userid = SecurityUtils.getLoginUser().getUserid();
orderInfoDto.setOrderUser(userid);
orderInfoDto.setBuyerId(userid.toString());
orderInfoDto.setCreater(userid);
Integer i = orderMapper.insertOrderInfo(orderInfoDto);
if (i > 0) {
@ -71,7 +71,12 @@ public class OrderServiceImpl implements OrderService {
@Override
public List<OrderInfoDto> getOrderDetails(OrderInfoDto orderInfoDto) throws Exception {
orderInfoDto.setOrderUser(SecurityUtils.getLoginUser().getUserid());
if (orderInfoDto.getFlag() != null && "0".equals(orderInfoDto.getFlag())){
orderInfoDto.setSellerId(SecurityUtils.getLoginUser().getUserid().toString());
}else {
orderInfoDto.setBuyerId(SecurityUtils.getLoginUser().getUserid().toString());
}
List<OrderInfoDto> orderInfoDtos = orderMapper.getOrderDetails(orderInfoDto);
for (OrderInfoDto dto : orderInfoDtos) {
List<OrderDetailDto> list = new ArrayList();

View File

@ -171,6 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.ma_id as maId,
d.code as code,
d.device_name as deviceName,
d.device_count as deviceCount,
d.device_weight as deviceWeight,
d.type_id as typeId,
mt4.type_name as typeName,
@ -453,6 +454,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</choose>
</if>
</update>
<update id="upMaStatus">
update ma_dev_info set ma_status = #{maStatus} where ma_id = #{maId} and is_active = 1
</update>
<select id="getSysDic" resultType="com.bonus.common.biz.domain.SysDic">
select

View File

@ -5,9 +5,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.bonus.material.order.mapper.OrderMapper">
<insert id="insertOrderInfo" parameterType="com.bonus.material.order.domain.OrderInfoDto" useGeneratedKeys="true" keyProperty="orderId">
insert into ma_order_info (code, order_time, cost, order_user, address, creater, create_time)
insert into ma_order_info (code, order_time, cost, buyer_id, seller_id, address, creater, create_time)
values
(#{code}, now(), #{cost}, #{orderUser}, #{address}, #{creater}, now())
(#{code}, now(), #{cost}, #{buyerId}, #{sellerId}, #{address}, #{creater}, now())
</insert>
<insert id="insertOrderDetail">
INSERT INTO `ma_order_details` (
@ -79,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_dev_info mdi ON hh.ma_id = mdi.ma_id
LEFT JOIN bm_company_info c ON mdi.own_co = c.company_id
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
LEFT JOIN sys_user su ON su.user_id = moi.order_user
LEFT JOIN sys_user su ON su.user_id = moi.buyer_id
LEFT JOIN (
SELECT
sd.dept_id AS deptId,
@ -91,7 +91,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) dept ON dept.deptId = su.dept_id
WHERE
mt.del_flag = '0'
and order_user = #{orderUser}
<if test="buyerId != null and buyerId != ''">
AND moi.buyer_id = #{buyerId}
</if>
<if test="sellerId != null and sellerId != ''">
AND moi.seller_id = #{sellerId}
</if>
<if test="deviceName != null and deviceName != ''">
AND mdi.device_name like concat('%',#{deviceName},'%')
</if>
@ -164,7 +169,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_dev_info mdi ON hh.ma_id = mdi.ma_id
LEFT JOIN bm_company_info c ON mdi.own_co = c.company_id
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
LEFT JOIN sys_user su ON su.user_id = moi.order_user
LEFT JOIN sys_user su ON su.user_id = moi.buyer_id
LEFT JOIN (
SELECT
sd.dept_id AS deptId,