Merge remote-tracking branch 'origin/master'

This commit is contained in:
磷叶 2025-04-01 21:30:57 +08:00
commit 3d43715051
24 changed files with 949 additions and 114 deletions

View File

@ -0,0 +1,39 @@
package com.ruoyi.bst.ad.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 广告对象 bst_ad
*
* @author ruoyi
* @date 2025-04-01
*/
@Data
public class Ad extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long adId;
@Excel(name = "广告类型 1活动推广")
@ApiModelProperty("广告类型 1活动推广")
private String type;
@Excel(name = "广告图片")
@ApiModelProperty("广告图片")
private String picture;
@Excel(name = "跳转链接")
@ApiModelProperty("跳转链接")
private String url;
@Excel(name = "跳转类型1外链跳转2站内跳转")
@ApiModelProperty("跳转类型1外链跳转2站内跳转")
private String urlType;
}

View File

@ -0,0 +1,8 @@
package com.ruoyi.bst.ad.domain;
import lombok.Data;
@Data
public class AdQuery extends Ad{
}

View File

@ -0,0 +1,7 @@
package com.ruoyi.bst.ad.domain;
import lombok.Data;
@Data
public class AdVO extends Ad{
}

View File

@ -0,0 +1,76 @@
package com.ruoyi.bst.ad.mapper;
import java.util.List;
import com.ruoyi.bst.ad.domain.Ad;
import com.ruoyi.bst.ad.domain.AdVO;
import com.ruoyi.bst.ad.domain.AdQuery;
import org.apache.ibatis.annotations.Param;
/**
* 广告Mapper接口
*
* @author ruoyi
* @date 2025-04-01
*/
public interface AdMapper
{
/**
* 查询广告
*
* @param adId 广告主键
* @return 广告
*/
AdVO selectAdByAdId(Long adId);
/**
* 查询广告列表
*
* @param query 广告
* @return 广告集合
*/
List<AdVO> selectAdList(@Param("query")AdQuery query);
/**
* 新增广告
*
* @param ad 广告
* @return 结果
*/
int insertAd(Ad ad);
/**
* 批量新增广告
*/
int batchInsert(@Param("list") List<? extends Ad> list);
/**
* 批量修改广告
*/
int batchUpdate(@Param("list") List<? extends Ad> list);
/**
* 修改广告
*
* @param ad 广告
* @return 结果
*/
public int updateAd(@Param("data") Ad ad);
/**
* 删除广告
*
* @param adId 广告主键
* @return 结果
*/
int deleteAdByAdId(Long adId);
/**
* 批量删除广告
*
* @param adIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteAdByAdIds(Long[] adIds);
AdVO selectOne(AdQuery query);
}

View File

@ -0,0 +1,277 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.bst.ad.mapper.AdMapper">
<resultMap type="AdVO" id="AdResult" autoMapping="true">
<result property="adId" column="ad_id" />
<result property="type" column="type" />
<result property="picture" column="picture" />
<result property="url" column="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" />
<result property="deleted" column="deleted" />
<result property="urlType" column="url_type" />
</resultMap>
<sql id="selectAdVo">
select
ad_id,
type,
picture,
url,
create_by,
create_time,
update_by,
update_time,
remark,
deleted,
url_type
from bst_ad
</sql>
<sql id="searchCondition">
<if test="query.adId != null and query.adId != ''"> and ad_id = #{query.adId}</if>
<if test="query.type != null and query.type != ''"> and type = #{query.type}</if>
<if test="query.picture != null and query.picture != ''"> and picture = #{query.picture}</if>
<if test="query.url != null and query.url != ''"> and url = #{query.url}</if>
<if test="query.deleted != null "> and deleted = #{query.deleted}</if>
<if test="query.urlType != null and query.urlType != ''"> and url_type = #{query.urlType}</if>
${query.params.dataScope}
</sql>
<select id="selectAdList" parameterType="AdQuery" resultMap="AdResult">
<include refid="selectAdVo"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<select id="selectAdByAdId" parameterType="Long" resultMap="AdResult">
<include refid="selectAdVo"/>
where ad_id = #{adId}
</select>
<select id="selectOne" resultType="com.ruoyi.bst.ad.domain.AdVO">
<include refid="selectAdVo"/>
<where>
<include refid="searchCondition"/>
</where>
limit 1
</select>
<insert id="insertAd" parameterType="Ad" useGeneratedKeys="true" keyProperty="adId">
insert into bst_ad
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="type != null">type,</if>
<if test="picture != null">picture,</if>
<if test="url != null">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>
<if test="deleted != null">deleted,</if>
<if test="urlType != null and urlType != ''">url_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null">#{type},</if>
<if test="picture != null">#{picture},</if>
<if test="url != null">#{url},</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>
<if test="deleted != null">#{deleted},</if>
<if test="urlType != null and urlType != ''">#{urlType},</if>
</trim>
</insert>
<insert id="batchInsert" parameterType="Ad" useGeneratedKeys="true" keyProperty="adId">
insert into bst_ad
<trim prefix="(" suffix=")" suffixOverrides=",">
type,
picture,
url,
create_by,
create_time,
update_by,
update_time,
remark,
deleted,
url_type,
</trim>
values
<foreach collection="list" item="i" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="i.type != null ">#{i.type},</if>
<if test="i.type == null ">default,</if>
<if test="i.picture != null ">#{i.picture},</if>
<if test="i.picture == null ">default,</if>
<if test="i.url != null ">#{i.url},</if>
<if test="i.url == null ">default,</if>
<if test="i.createBy != null ">#{i.createBy},</if>
<if test="i.createBy == null ">default,</if>
<if test="i.createTime != null ">#{i.createTime},</if>
<if test="i.createTime == null ">default,</if>
<if test="i.updateBy != null ">#{i.updateBy},</if>
<if test="i.updateBy == null ">default,</if>
<if test="i.updateTime != null ">#{i.updateTime},</if>
<if test="i.updateTime == null ">default,</if>
<if test="i.remark != null ">#{i.remark},</if>
<if test="i.remark == null ">default,</if>
<if test="i.deleted != null ">#{i.deleted},</if>
<if test="i.deleted == null ">default,</if>
<if test="i.urlType != null and i.urlType != ''">#{i.urlType},</if>
<if test="i.urlType == null or i.urlType == ''">default,</if>
</trim>
</foreach>
</insert>
<update id="batchUpdate">
update bst_ad
<trim prefix="SET" suffixOverrides=",">
<foreach open="type = CASE ad_id" collection="list" item="item" close="END,">
<choose>
<when test="item.type != null ">
WHEN #{item.ad_id} THEN #{item.type}
</when>
<otherwise>
WHEN #{item.ad_id} THEN `type`
</otherwise>
</choose>
</foreach>
<foreach open="picture = CASE ad_id" collection="list" item="item" close="END,">
<choose>
<when test="item.picture != null ">
WHEN #{item.ad_id} THEN #{item.picture}
</when>
<otherwise>
WHEN #{item.ad_id} THEN `picture`
</otherwise>
</choose>
</foreach>
<foreach open="url = CASE ad_id" collection="list" item="item" close="END,">
<choose>
<when test="item.url != null ">
WHEN #{item.ad_id} THEN #{item.url}
</when>
<otherwise>
WHEN #{item.ad_id} THEN `url`
</otherwise>
</choose>
</foreach>
<foreach open="create_by = CASE ad_id" collection="list" item="item" close="END,">
<choose>
<when test="item.createBy != null ">
WHEN #{item.ad_id} THEN #{item.createBy}
</when>
<otherwise>
WHEN #{item.ad_id} THEN `create_by`
</otherwise>
</choose>
</foreach>
<foreach open="create_time = CASE ad_id" collection="list" item="item" close="END,">
<choose>
<when test="item.createTime != null ">
WHEN #{item.ad_id} THEN #{item.createTime}
</when>
<otherwise>
WHEN #{item.ad_id} THEN `create_time`
</otherwise>
</choose>
</foreach>
<foreach open="update_by = CASE ad_id" collection="list" item="item" close="END,">
<choose>
<when test="item.updateBy != null ">
WHEN #{item.ad_id} THEN #{item.updateBy}
</when>
<otherwise>
WHEN #{item.ad_id} THEN `update_by`
</otherwise>
</choose>
</foreach>
<foreach open="update_time = CASE ad_id" collection="list" item="item" close="END,">
<choose>
<when test="item.updateTime != null ">
WHEN #{item.ad_id} THEN #{item.updateTime}
</when>
<otherwise>
WHEN #{item.ad_id} THEN `update_time`
</otherwise>
</choose>
</foreach>
<foreach open="remark = CASE ad_id" collection="list" item="item" close="END,">
<choose>
<when test="item.remark != null ">
WHEN #{item.ad_id} THEN #{item.remark}
</when>
<otherwise>
WHEN #{item.ad_id} THEN `remark`
</otherwise>
</choose>
</foreach>
<foreach open="deleted = CASE ad_id" collection="list" item="item" close="END,">
<choose>
<when test="item.deleted != null ">
WHEN #{item.ad_id} THEN #{item.deleted}
</when>
<otherwise>
WHEN #{item.ad_id} THEN `deleted`
</otherwise>
</choose>
</foreach>
<foreach open="url_type = CASE ad_id" collection="list" item="item" close="END,">
<choose>
<when test="item.urlType != null and item.urlType != ''">
WHEN #{item.ad_id} THEN #{item.urlType}
</when>
<otherwise>
WHEN #{item.ad_id} THEN `url_type`
</otherwise>
</choose>
</foreach>
</trim>
where ad_id in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item.adId}
</foreach>
</update>
<update id="updateAd" parameterType="Ad">
update bst_ad
<trim prefix="SET" suffixOverrides=",">
<include refid="updateColumns"/>
</trim>
where ad_id = #{data.adId}
</update>
<sql id="updateColumns">
<if test="data.type != null">type = #{data.type},</if>
<if test="data.picture != null">picture = #{data.picture},</if>
<if test="data.url != null">url = #{data.url},</if>
<if test="data.createBy != null">create_by = #{data.createBy},</if>
<if test="data.createTime != null">create_time = #{data.createTime},</if>
<if test="data.updateBy != null">update_by = #{data.updateBy},</if>
<if test="data.updateTime != null">update_time = #{data.updateTime},</if>
<if test="data.remark != null">remark = #{data.remark},</if>
<if test="data.deleted != null">deleted = #{data.deleted},</if>
<if test="data.urlType != null and data.urlType != ''">url_type = #{data.urlType},</if>
</sql>
<delete id="deleteAdByAdId" parameterType="Long">
delete from bst_ad where ad_id = #{adId}
</delete>
<delete id="deleteAdByAdIds" parameterType="String">
delete from bst_ad where ad_id in
<foreach item="adId" collection="array" open="(" separator="," close=")">
#{adId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,65 @@
package com.ruoyi.bst.ad.service;
import java.util.List;
import com.ruoyi.bst.ad.domain.Ad;
import com.ruoyi.bst.ad.domain.AdVO;
import com.ruoyi.bst.ad.domain.AdQuery;
/**
* 广告Service接口
*
* @author ruoyi
* @date 2025-04-01
*/
public interface AdService
{
/**
* 查询广告
*
* @param adId 广告主键
* @return 广告
*/
public AdVO selectAdByAdId(Long adId);
/**
* 查询广告列表
*
* @param ad 广告
* @return 广告集合
*/
public List<AdVO> selectAdList(AdQuery ad);
/**
* 新增广告
*
* @param ad 广告
* @return 结果
*/
public int insertAd(Ad ad);
/**
* 修改广告
*
* @param ad 广告
* @return 结果
*/
public int updateAd(Ad ad);
/**
* 批量删除广告
*
* @param adIds 需要删除的广告主键集合
* @return 结果
*/
public int deleteAdByAdIds(Long[] adIds);
/**
* 删除广告信息
*
* @param adId 广告主键
* @return 结果
*/
public int deleteAdByAdId(Long adId);
AdVO selectOne(AdQuery adQuery);
}

View File

@ -0,0 +1,103 @@
package com.ruoyi.bst.ad.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bst.ad.mapper.AdMapper;
import com.ruoyi.bst.ad.domain.Ad;
import com.ruoyi.bst.ad.domain.AdVO;
import com.ruoyi.bst.ad.domain.AdQuery;
import com.ruoyi.bst.ad.service.AdService;
/**
* 广告Service业务层处理
*
* @author ruoyi
* @date 2025-04-01
*/
@Service
public class AdServiceImpl implements AdService
{
@Autowired
private AdMapper adMapper;
/**
* 查询广告
*
* @param adId 广告主键
* @return 广告
*/
@Override
public AdVO selectAdByAdId(Long adId)
{
return adMapper.selectAdByAdId(adId);
}
/**
* 查询广告列表
*
* @param ad 广告
* @return 广告
*/
@Override
public List<AdVO> selectAdList(AdQuery ad)
{
return adMapper.selectAdList(ad);
}
/**
* 新增广告
*
* @param ad 广告
* @return 结果
*/
@Override
public int insertAd(Ad ad)
{
ad.setCreateTime(DateUtils.getNowDate());
return adMapper.insertAd(ad);
}
/**
* 修改广告
*
* @param ad 广告
* @return 结果
*/
@Override
public int updateAd(Ad ad)
{
ad.setUpdateTime(DateUtils.getNowDate());
return adMapper.updateAd(ad);
}
/**
* 批量删除广告
*
* @param adIds 需要删除的广告主键
* @return 结果
*/
@Override
public int deleteAdByAdIds(Long[] adIds)
{
return adMapper.deleteAdByAdIds(adIds);
}
/**
* 删除广告信息
*
* @param adId 广告主键
* @return 结果
*/
@Override
public int deleteAdByAdId(Long adId)
{
return adMapper.deleteAdByAdId(adId);
}
@Override
public AdVO selectOne(AdQuery query) {
return adMapper.selectOne(query);
}
}

View File

@ -73,6 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="faultDetail != null">fault_detail,</if>
<if test="appealStatus != null and appealStatus != ''">appeal_status,</if>
<if test="createTime != null">create_time,</if>
<if test="orderEndTime != null">order_end_time,</if>
<if test="userId != null">user_id,</if>
<if test="vehicleNum != null">vehicle_num</if>
</trim>
@ -85,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="faultDetail != null">#{faultDetail},</if>
<if test="appealStatus != null and appealStatus != ''">#{appealStatus},</if>
<if test="createTime != null">#{createTime},</if>
<if test="orderEndTime != null">#{orderEndTime},</if>
<if test="userId != null">#{userId},</if>
<if test="vehicleNum != null">#{vehicleNum}</if>
</trim>

View File

@ -0,0 +1,9 @@
package com.ruoyi.bst.fault.service;
import com.ruoyi.bst.fault.domain.Fault;
import com.ruoyi.bst.fault.domain.FaultVO;
public interface FaultConverter {
Fault toPo(FaultVO fault);
}

View File

@ -0,0 +1,65 @@
package com.ruoyi.bst.fault.service.impl;
import com.ruoyi.bst.device.domain.DeviceVO;
import com.ruoyi.bst.device.service.DeviceService;
import com.ruoyi.bst.fault.domain.Fault;
import com.ruoyi.bst.fault.domain.FaultVO;
import com.ruoyi.bst.fault.domain.enums.FaultStatus;
import com.ruoyi.bst.fault.service.FaultConverter;
import com.ruoyi.bst.fault.service.FaultService;
import com.ruoyi.bst.order.domain.OrderVO;
import com.ruoyi.bst.order.service.OrderService;
import com.ruoyi.common.core.domain.vo.UserVO;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.system.user.service.UserService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AbnormalConverterImpl implements FaultConverter {
@Autowired
private FaultService faultService;
@Autowired
private DeviceService deviceService;
@Autowired
private OrderService orderService;
@Autowired
private UserService userService;
@Override
public Fault toPo(FaultVO fault) {
DeviceVO device = deviceService.selectDeviceBySn(fault.getVehicleCode());
ServiceUtil.assertion(device == null, "设备不存在");
Fault po = new Fault();
po.setFaultSite(fault.getFaultSite());
po.setVehicleCode(fault.getVehicleCode());
po.setPicture(fault.getPicture());
po.setFaultDetail(fault.getFaultDetail());
po.setCreateBy(fault.getCreateBy());
po.setAppealStatus(FaultStatus.PENGDING.getCode());
po.setCreateTime(DateUtils.getNowDate());
po.setUserName(fault.getCreateBy());
po.setUserId(fault.getUserId());
if (device.getOrderId() != null && fault.getOrderId().equals(device.getOrderId())) {
po.setOrderId(device.getOrderId());
OrderVO order = orderService.selectOrderById(device.getOrderId());
if (order.getEndTime() != null) {
po.setOrderEndTime(DateUtils.toDate(order.getEndTime()));
}
}
String vehicleNum = device.getVehicleNum();
if (vehicleNum != null) {
po.setVehicleNum(vehicleNum);
}
return po;
}
}

View File

@ -1,7 +1,10 @@
package com.ruoyi.system.notice.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.xss.Xss;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -13,6 +16,7 @@ import javax.validation.constraints.Size;
*
* @author ruoyi
*/
@Data
public class Notice extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -21,6 +25,9 @@ public class Notice extends BaseEntity
private Long noticeId;
/** 公告标题 */
@Xss(message = "公告标题不能包含脚本字符")
@NotBlank(message = "公告标题不能为空")
@Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
private String noticeTitle;
/** 公告类型1通知 2公告 */
@ -32,72 +39,19 @@ public class Notice extends BaseEntity
/** 公告状态0正常 1关闭 */
private String status;
public Long getNoticeId()
{
return noticeId;
}
@Excel(name = "接收方式", readConverterExp = "1=全体用户,2=指定用户")
@ApiModelProperty("接收方式")
private String receiveType;
public void setNoticeId(Long noticeId)
{
this.noticeId = noticeId;
}
@Excel(name = "跳转URL")
@ApiModelProperty("跳转URL")
private String url;
public void setNoticeTitle(String noticeTitle)
{
this.noticeTitle = noticeTitle;
}
@Excel(name = "URL类型", readConverterExp = "1=公告详情,2=小程序内部URL,3=外部URL")
@ApiModelProperty("URL类型")
private String urlType;
@Xss(message = "公告标题不能包含脚本字符")
@NotBlank(message = "公告标题不能为空")
@Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
public String getNoticeTitle()
{
return noticeTitle;
}
public void setNoticeType(String noticeType)
{
this.noticeType = noticeType;
}
public String getNoticeType()
{
return noticeType;
}
public void setNoticeContent(String noticeContent)
{
this.noticeContent = noticeContent;
}
public String getNoticeContent()
{
return noticeContent;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("noticeId", getNoticeId())
.append("noticeTitle", getNoticeTitle())
.append("noticeType", getNoticeType())
.append("noticeContent", getNoticeContent())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
@Excel(name = "发送方式", readConverterExp = "1=小程序内部展示,2=短信,3=公众号")
@ApiModelProperty("发送方式")
private String sendType;
}

View File

@ -0,0 +1,7 @@
package com.ruoyi.system.notice.domain;
import lombok.Data;
@Data
public class NoticeQuery extends Notice{
}

View File

@ -0,0 +1,7 @@
package com.ruoyi.system.notice.domain;
import lombok.Data;
@Data
public class NoticeVO extends Notice{
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.system.notice.domain.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum NoticeStatus {
ENABLED("0", "启用"),
DISABLED("1", "禁用");
private final String status;
private final String msg;
}

View File

@ -0,0 +1,17 @@
package com.ruoyi.system.notice.domain.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum NoticeType {
USER("1", "用户公告"),
STORE("2", "商户公告");
private final String type;
private final String msg;
}

View File

@ -1,6 +1,8 @@
package com.ruoyi.system.notice.mapper;
import com.ruoyi.system.notice.domain.Notice;
import com.ruoyi.system.notice.domain.NoticeQuery;
import com.ruoyi.system.notice.domain.NoticeVO;
import java.util.List;
@ -25,7 +27,7 @@ public interface NoticeMapper
* @param notice 公告信息
* @return 公告集合
*/
public List<Notice> selectNoticeList(Notice notice);
public List<NoticeVO> selectNoticeList(NoticeQuery notice);
/**
* 新增公告

View File

@ -1,6 +1,8 @@
package com.ruoyi.system.notice.service;
import com.ruoyi.system.notice.domain.Notice;
import com.ruoyi.system.notice.domain.NoticeQuery;
import com.ruoyi.system.notice.domain.NoticeVO;
import java.util.List;
@ -25,7 +27,7 @@ public interface NoticeService
* @param notice 公告信息
* @return 公告集合
*/
public List<Notice> selectNoticeList(Notice notice);
public List<NoticeVO> selectNoticeList(NoticeQuery notice);
/**
* 新增公告
@ -58,4 +60,6 @@ public interface NoticeService
* @return 结果
*/
public int deleteNoticeByIds(Long[] noticeIds);
Notice selectOne(NoticeQuery query);
}

View File

@ -1,6 +1,10 @@
package com.ruoyi.system.notice.service.impl;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.system.notice.domain.Notice;
import com.ruoyi.system.notice.domain.NoticeQuery;
import com.ruoyi.system.notice.domain.NoticeVO;
import com.ruoyi.system.notice.mapper.NoticeMapper;
import com.ruoyi.system.notice.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
@ -38,8 +42,7 @@ public class NoticeServiceImpl implements NoticeService
* @return 公告集合
*/
@Override
public List<Notice> selectNoticeList(Notice notice)
{
public List<NoticeVO> selectNoticeList(NoticeQuery notice) {
return noticeMapper.selectNoticeList(notice);
}
@ -90,4 +93,11 @@ public class NoticeServiceImpl implements NoticeService
{
return noticeMapper.deleteNoticeByIds(noticeIds);
}
@Override
public Notice selectOne(NoticeQuery query) {
PageHelper.startPage(1, 1);
List<NoticeVO> notice = this.selectNoticeList(query);
return CollectionUtils.firstElement(notice);
}
}

View File

@ -0,0 +1,28 @@
package com.ruoyi.web.app;
import com.ruoyi.bst.ad.domain.AdQuery;
import com.ruoyi.bst.ad.service.AdService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/app/ad")
public class AppAdController extends BaseController {
@Autowired
private AdService adService;
@ApiOperation("获取广告")
@GetMapping
public TableDataInfo getAd() {
startPage();
return getDataTable(adService.selectAdList(new AdQuery()));
}
}

View File

@ -7,6 +7,7 @@ import com.ruoyi.bst.fault.domain.FaultQuery;
import com.ruoyi.bst.fault.domain.FaultVO;
import com.ruoyi.bst.fault.domain.enums.FaultHandleStatus;
import com.ruoyi.bst.fault.domain.enums.FaultStatus;
import com.ruoyi.bst.fault.service.FaultConverter;
import com.ruoyi.bst.fault.service.FaultService;
import com.ruoyi.bst.order.domain.OrderVO;
import com.ruoyi.bst.order.service.OrderService;
@ -40,56 +41,20 @@ public class AppFaultController extends BaseController {
@Autowired
private OrderService orderService;
@Autowired
private FaultConverter faultConverter;
/**
* 新增
* 新增故障申报
* @param fault
* @return
*/
@ApiOperation("故障申报")
@PostMapping
public AjaxResult add(@RequestBody FaultVO fault) {
DeviceVO device = deviceService.selectDeviceBySn(fault.getVehicleCode());
if (device ==null) {
return error("当前车辆不存在");
}
if (device.getOrderId() != null) {
OrderVO order = orderService.selectOrderById(device.getOrderId());
if (order.getEndTime() != null) {
fault.setOrderEndTime(DateUtils.toDate(order.getEndTime()));
}
fault.setOrderId(device.getOrderId());
}
String vehicleNum = device.getVehicleNum();
if (vehicleNum != null) {
fault.setVehicleNum(vehicleNum);
}
faultService.insertFault(fault);
return success();
}
/**
* 处理或者驳回申报信息
* @param fault
* @return
*/
@ApiOperation("处理申报信息")
@PutMapping
public AjaxResult update(@RequestBody Fault fault) {
FaultVO faultVO = faultService.selectFaultById(fault.getId());
if (faultVO.getAppealStatus().equals(FaultStatus.PENGDING.getCode()) && fault.getHandle().equals(FaultHandleStatus.REJECTED.getCode())) {
faultVO.setAppealStatus(FaultStatus.REJECTED.getCode());
}else
if (faultVO.getAppealStatus().equals(FaultStatus.PENGDING.getCode()) && fault.getHandle().equals(FaultHandleStatus.DO.getCode())) {
faultVO.setAppealStatus(FaultStatus.REPAIRING.getCode());
}else
if (faultVO.getAppealStatus().equals(FaultStatus.REPAIRING.getCode()) && fault.getHandle().equals(FaultHandleStatus.DO.getCode())) {
faultVO.setAppealStatus(FaultStatus.COMPLETED.getCode());
}
faultService.updateFault(faultVO);
return success();
fault.setUserId(getUserId());
fault.setCreateBy(getUsername());
return success(faultService.insertFault(faultConverter.toPo(fault)));
}
/**

View File

@ -0,0 +1,42 @@
package com.ruoyi.web.app;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.notice.domain.NoticeQuery;
import com.ruoyi.system.notice.domain.enums.NoticeStatus;
import com.ruoyi.system.notice.service.NoticeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/app/notice")
public class AppNoticeController extends BaseController {
@Autowired
private NoticeService noticeService;
@ApiOperation("获取最新的公告")
@GetMapping("/new")
@Anonymous
public AjaxResult getNewNotice(NoticeQuery query) {
PageHelper.orderBy("create_time desc");
query.setStatus(NoticeStatus.ENABLED.getStatus());
return success(noticeService.selectOne(query));
}
@ApiOperation("获取公告详情")
@GetMapping("/{noticeId}")
@Anonymous
public AjaxResult getNotice(@PathVariable Long noticeId) {
return success(noticeService.selectNoticeById(noticeId));
}
}

View File

@ -0,0 +1,101 @@
package com.ruoyi.web.bst;
import com.ruoyi.bst.ad.domain.Ad;
import com.ruoyi.bst.ad.domain.AdQuery;
import com.ruoyi.bst.ad.domain.AdVO;
import com.ruoyi.bst.ad.service.AdService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
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;
import java.util.List;
/**
* 广告Controller
*
* @author ruoyi
* @date 2025-04-01
*/
@RestController
@RequestMapping("/bst/ad")
public class AdController extends BaseController
{
@Autowired
private AdService adService;
/**
* 查询广告列表
*/
@PreAuthorize("@ss.hasPermi('bst:ad:list')")
@GetMapping("/list")
public TableDataInfo list(AdQuery query)
{
startPage();
startOrderBy();
List<AdVO> list = adService.selectAdList(query);
return getDataTable(list);
}
/**
* 导出广告列表
*/
@PreAuthorize("@ss.hasPermi('bst:ad:export')")
@Log(title = "广告", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AdQuery query)
{
List<AdVO> list = adService.selectAdList(query);
ExcelUtil<AdVO> util = new ExcelUtil<AdVO>(AdVO.class);
util.exportExcel(response, list, "广告数据");
}
/**
* 获取广告详细信息
*/
@PreAuthorize("@ss.hasPermi('bst:ad:query')")
@GetMapping(value = "/{adId}")
public AjaxResult getInfo(@PathVariable("adId") Long adId)
{
return success(adService.selectAdByAdId(adId));
}
/**
* 新增广告
*/
@PreAuthorize("@ss.hasPermi('bst:ad:add')")
@Log(title = "广告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Ad ad)
{
return toAjax(adService.insertAd(ad));
}
/**
* 修改广告
*/
@PreAuthorize("@ss.hasPermi('bst:ad:edit')")
@Log(title = "广告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Ad ad)
{
return toAjax(adService.updateAd(ad));
}
/**
* 删除广告
*/
@PreAuthorize("@ss.hasPermi('bst:ad:remove')")
@Log(title = "广告", businessType = BusinessType.DELETE)
@DeleteMapping("/{adIds}")
public AjaxResult remove(@PathVariable Long[] adIds)
{
return toAjax(adService.deleteAdByAdIds(adIds));
}
}

View File

@ -3,6 +3,8 @@ package com.ruoyi.web.bst;
import com.ruoyi.bst.fault.domain.Fault;
import com.ruoyi.bst.fault.domain.FaultQuery;
import com.ruoyi.bst.fault.domain.FaultVO;
import com.ruoyi.bst.fault.domain.enums.FaultHandleStatus;
import com.ruoyi.bst.fault.domain.enums.FaultStatus;
import com.ruoyi.bst.fault.service.FaultService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
@ -10,6 +12,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@ -98,4 +101,31 @@ public class FaultController extends BaseController
{
return toAjax(faultService.deleteFaultByIds(ids));
}
/**
* 处理或者驳回申报信息
* @param fault
* @return
*/
@PreAuthorize("@ss.hasPermi('bst:fault:edit')")
@Log(title = "故障", businessType = BusinessType.UPDATE)
@ApiOperation("处理申报信息")
@PutMapping("/handle")
public AjaxResult update(@RequestBody Fault fault) {
FaultVO faultVO = faultService.selectFaultById(fault.getId());
if (faultVO.getAppealStatus().equals(FaultStatus.PENGDING.getCode()) && fault.getHandle().equals(FaultHandleStatus.REJECTED.getCode())) {
faultVO.setAppealStatus(FaultStatus.REJECTED.getCode());
}else
if (faultVO.getAppealStatus().equals(FaultStatus.PENGDING.getCode()) && fault.getHandle().equals(FaultHandleStatus.DO.getCode())) {
faultVO.setAppealStatus(FaultStatus.REPAIRING.getCode());
}else
if (faultVO.getAppealStatus().equals(FaultStatus.REPAIRING.getCode()) && fault.getHandle().equals(FaultHandleStatus.DO.getCode())) {
faultVO.setAppealStatus(FaultStatus.COMPLETED.getCode());
}
faultService.updateFault(faultVO);
return success();
}
}

View File

@ -6,6 +6,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.notice.domain.Notice;
import com.ruoyi.system.notice.domain.NoticeQuery;
import com.ruoyi.system.notice.domain.NoticeVO;
import com.ruoyi.system.notice.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@ -31,10 +33,10 @@ public class SysNoticeController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:notice:list')")
@GetMapping("/list")
public TableDataInfo list(Notice notice)
public TableDataInfo list(NoticeQuery notice)
{
startPage();
List<Notice> list = noticeService.selectNoticeList(notice);
List<NoticeVO> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
}