装备共享大厅联调

This commit is contained in:
mashuai 2024-11-26 10:25:17 +08:00
parent 8002f8143f
commit 7484683d3a
9 changed files with 51 additions and 28 deletions

View File

@ -32,12 +32,7 @@ public class BookCarController extends BaseController {
@ApiOperation(value = "添加预约车") @ApiOperation(value = "添加预约车")
@PostMapping("/addBookCar") @PostMapping("/addBookCar")
public AjaxResult addBookCar(@RequestBody BookCarInfoDto bookCarInfoDto) { public AjaxResult addBookCar(@RequestBody BookCarInfoDto bookCarInfoDto) {
Integer i = bookCarService.addBookCar(bookCarInfoDto); return bookCarService.addBookCar(bookCarInfoDto);
if (i > 0) {
return AjaxResult.success("添加成功");
} else {
return AjaxResult.error("添加失败");
}
} }
/** /**

View File

@ -6,7 +6,6 @@ import com.bonus.material.device.domain.vo.DevInfoVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -23,6 +22,18 @@ public interface BookCarMapper {
*/ */
Integer addBookCarDetail(BookCarInfoDto bookCarInfoDto); Integer addBookCarDetail(BookCarInfoDto bookCarInfoDto);
/**
* 查询预约车详情
* @param devInfo
* @return
*/
List<DevInfoVo> getBookCarDetails(BookCarInfoDto devInfo); List<DevInfoVo> getBookCarDetails(BookCarInfoDto devInfo);
/**
* 查询设备详情
* @param maId
* @param userId
* @return
*/
DevInfoVo selectDevInfoByMaId(@Param("maId") String maId, @Param("userId") Long userId);
} }

View File

@ -17,7 +17,7 @@ public interface BookCarService {
* @param bookCarInfoDto * @param bookCarInfoDto
* @return * @return
*/ */
Integer addBookCar(BookCarInfoDto bookCarInfoDto); AjaxResult addBookCar(BookCarInfoDto bookCarInfoDto);
/** /**
* 获取预约车详情 * 获取预约车详情

View File

@ -39,11 +39,20 @@ public class BookCarServiceImpl implements BookCarService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Integer addBookCar(BookCarInfoDto bookCarInfoDto) { public AjaxResult addBookCar(BookCarInfoDto bookCarInfoDto) {
Long userid = SecurityUtils.getLoginUser().getUserid(); Long userId = SecurityUtils.getLoginUser().getUserid();
bookCarInfoDto.setCreater(userid.toString()); bookCarInfoDto.setCreater(userId.toString());
bookCarInfoDto.setOrderUser(userid); bookCarInfoDto.setOrderUser(userId);
return bookCarMapper.addBookCarDetail(bookCarInfoDto); //先根据设备id查询设备信息
DevInfoVo devInfoVo = bookCarMapper.selectDevInfoByMaId(bookCarInfoDto.getMaId(), userId);
if (devInfoVo != null) {
return AjaxResult.error("该设备已添加到预约车,请勿重复添加");
}
Integer result = bookCarMapper.addBookCarDetail(bookCarInfoDto);
if (result > 0) {
return AjaxResult.success("添加成功");
}
return AjaxResult.error("添加失败");
} }
@Override @Override

View File

@ -48,8 +48,8 @@ public class DevInfoController extends BaseController {
@PostMapping("/list") @PostMapping("/list")
public AjaxResult list(@RequestBody DevInfoVo devInfo) { public AjaxResult list(@RequestBody DevInfoVo devInfo) {
List<DevInfoVo> list = devInfoService.selectDevInfoList(devInfo); List<DevInfoVo> list = devInfoService.selectDevInfoList(devInfo);
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); Integer pageIndex = Convert.toInt(devInfo.getPageNum(), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); Integer pageSize = Convert.toInt(devInfo.getPageSize(), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
} }

View File

@ -100,6 +100,10 @@ public class DevInfoServiceImpl implements DevInfoService {
return devInfoVo; return devInfoVo;
} }
/**
* 更新设备搜索量
* @param maId
*/
private void updateHotSearch(Long maId) { private void updateHotSearch(Long maId) {
int count = devInfoMapper.getHotSearchCountByMaId(maId); int count = devInfoMapper.getHotSearchCountByMaId(maId);
if (count == 0) { if (count == 0) {

View File

@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.code as code, d.code as code,
d.device_name as deviceName, d.device_name as deviceName,
d.device_weight as deviceWeight, d.device_weight as deviceWeight,
d.device_count as deviceCount,
d.type_id as typeId, d.type_id as typeId,
d.ma_status as maStatus, d.ma_status as maStatus,
d.brand as brand, d.brand as brand,
@ -38,4 +39,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where d.is_active = '1' and bcd.order_status = '0' where d.is_active = '1' and bcd.order_status = '0'
</select> </select>
<select id="selectDevInfoByMaId" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
SELECT ma_id as maId,
order_user as orderUser
from book_car_detail
where ma_id = #{maId} and order_user = #{userId}
</select>
</mapper> </mapper>

View File

@ -117,12 +117,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="areaId != null and areaId != ''"> and d.area_id = #{areaId}</if> <if test="areaId != null and areaId != ''"> and d.area_id = #{areaId}</if>
<if test="brand != null and brand != ''"> and d.brand = #{brand}</if> <if test="brand != null and brand != ''"> and d.brand = #{brand}</if>
<if test="modelName != null and modelName != ''"> and d.model_name like concat('%', #{modelName}, '%')</if> <if test="modelName != null and modelName != ''"> and d.model_name like concat('%', #{modelName}, '%')</if>
<if test="ageMin != null and ageMin != '' and ageMax != null and ageMax != ''"> <if test="ageMin != null and ageMax != null">
and DATEDIFF(DATE_FORMAT(now(), '%Y-%m-%d'), d.production_date) &gt;= #{ageMin} * 365 and TIMESTAMPDIFF(YEAR, d.production_date, NOW()) &gt;= #{ageMin}
and DATEDIFF(DATE_FORMAT(now(), '%Y-%m-%d'), d.production_date) &lt;= #{ageMax} * 365 and TIMESTAMPDIFF(YEAR, d.production_date, NOW()) &lt;= #{ageMax}
</if> </if>
<if test="ageMin == null and ageMin == '' and ageMax != null and ageMax != ''"> <if test="ageMin == null and ageMax != null">
and DATEDIFF(DATE_FORMAT(now(), '%Y-%m-%d'), d.production_date) &gt; #{ageMax} * 365 and TIMESTAMPDIFF(YEAR, d.production_date, NOW()) &gt;= #{ageMax}
</if> </if>
<if test="workingHoursMin != null and workingHoursMin != '' and workingHoursMax != null and workingHoursMax != ''"> <if test="workingHoursMin != null and workingHoursMin != '' and workingHoursMax != null and workingHoursMax != ''">
and d.working_hours &gt;= #{workingHoursMin} and d.working_hours &lt;= #{workingHoursMax} and d.working_hours &gt;= #{workingHoursMin} and d.working_hours &lt;= #{workingHoursMax}
@ -145,11 +145,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
or locate(#{keyWord},mt2.type_name) > 0 or locate(#{keyWord},mt2.type_name) > 0
or locate(#{keyWord},mt3.type_name) > 0 or locate(#{keyWord},mt3.type_name) > 0
or locate(#{keyWord},c.company_name) > 0 or locate(#{keyWord},c.company_name) > 0
or locate(#{keyWord},d.ma_id) > 0 or locate(#{keyWord},d.device_name) > 0
or locate(#{keyWord},d.model_name) > 0
or locate(#{keyWord},d.specification) > 0
or locate(#{keyWord},d.serial_number) > 0
or locate(#{keyWord},d.description) > 0
) )
</if> </if>
and d.is_active='1' and d.is_active='1'
@ -163,10 +159,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
,d.day_lease_price DESC ,d.day_lease_price DESC
</if> </if>
<if test="updateTimeOrderBy != null and updateTimeOrderBy == 'ASC'"> <if test="updateTimeOrderBy != null and updateTimeOrderBy == 'ASC'">
,d.update_time ,d.create_time
</if> </if>
<if test="updateTimeOrderBy != null and updateTimeOrderBy == 'DESC'"> <if test="updateTimeOrderBy != null and updateTimeOrderBy == 'DESC'">
,d.update_time DESC ,d.create_time DESC
</if> </if>
</select> </select>

View File

@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getMaTypeInfoList" resultType="com.bonus.common.biz.domain.TreeNode"> <select id="getMaTypeInfoList" resultType="com.bonus.common.biz.domain.TreeNode">
select type_id as id, parent_id as parentId, type_name as name, `level` as level, manage_type as manageType, select type_id as id, parent_id as parentId, type_name as name, `level` as level, manage_type as manageType,
unit_name as unitName, del_flag as delFlag unit_name as unitName
from ma_type from ma_type
where del_flag = '0' where del_flag = '0'
</select> </select>