申报完善
This commit is contained in:
parent
d92a9fb6d0
commit
5b56c1f1ce
|
@ -1,4 +1,4 @@
|
||||||
package com.ruoyi.bst.article.domain;
|
package com.ruoyi.bst.article.domain;
|
||||||
|
|
||||||
public class ArticleQuery {
|
public class ArticleQuery extends Article{
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,12 @@ package com.ruoyi.bst.article.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.bst.area.service.AreaService;
|
||||||
import com.ruoyi.bst.article.service.ArticleService;
|
import com.ruoyi.bst.article.service.ArticleService;
|
||||||
|
import com.ruoyi.bst.articleCategory.service.ArticleCategoryService;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.bst.article.mapper.ArticleMapper;
|
import com.ruoyi.bst.article.mapper.ArticleMapper;
|
||||||
|
@ -24,6 +28,11 @@ public class ArticleServiceImpl implements ArticleService
|
||||||
@Autowired
|
@Autowired
|
||||||
private ArticleMapper articleMapper;
|
private ArticleMapper articleMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ArticleCategoryService articleCategoryService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AreaService areaService;
|
||||||
/**
|
/**
|
||||||
* 查询文章
|
* 查询文章
|
||||||
*
|
*
|
||||||
|
@ -57,6 +66,16 @@ public class ArticleServiceImpl implements ArticleService
|
||||||
@Override
|
@Override
|
||||||
public int insertArticle(Article article)
|
public int insertArticle(Article article)
|
||||||
{
|
{
|
||||||
|
//分类必须存在
|
||||||
|
if(articleCategoryService.selectArticleCategoryById(article.getCategoryId()) ==null){
|
||||||
|
throw new ServiceException("当前分类不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
//所属区域必须存在
|
||||||
|
if (areaService.selectAreaById(article.getAreaId()) == null){
|
||||||
|
throw new ServiceException("所属区域不存在");
|
||||||
|
}
|
||||||
|
|
||||||
article.setCreateTime(DateUtils.getNowDate());
|
article.setCreateTime(DateUtils.getNowDate());
|
||||||
return articleMapper.insertArticle(article);
|
return articleMapper.insertArticle(article);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class ArticleCategory extends TreeEntity
|
||||||
|
|
||||||
@Excel(name = "状态:0-禁用 1-启用")
|
@Excel(name = "状态:0-禁用 1-启用")
|
||||||
@ApiModelProperty("状态:0-禁用 1-启用")
|
@ApiModelProperty("状态:0-禁用 1-启用")
|
||||||
private Integer categoryStatus;
|
private String categoryStatus;
|
||||||
|
|
||||||
@Excel(name = "父分类ID")
|
@Excel(name = "父分类ID")
|
||||||
@ApiModelProperty("父分类ID")
|
@ApiModelProperty("父分类ID")
|
||||||
|
|
|
@ -117,6 +117,7 @@ public class ArticleCategoryServiceImpl implements ArticleCategoryService
|
||||||
List<Long> allIdsToDelete = new ArrayList<>();
|
List<Long> allIdsToDelete = new ArrayList<>();
|
||||||
allIdsToDelete.addAll(cids);
|
allIdsToDelete.addAll(cids);
|
||||||
allIdsToDelete.addAll(Arrays.asList(ids));
|
allIdsToDelete.addAll(Arrays.asList(ids));
|
||||||
|
|
||||||
if (!allIdsToDelete.isEmpty()){
|
if (!allIdsToDelete.isEmpty()){
|
||||||
return articleCategoryMapper.deleteArticleCategoryByIds(ids);
|
return articleCategoryMapper.deleteArticleCategoryByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class Fault extends BaseEntity
|
||||||
|
|
||||||
@Excel(name = "车辆编号")
|
@Excel(name = "车辆编号")
|
||||||
@ApiModelProperty("车辆编号")
|
@ApiModelProperty("车辆编号")
|
||||||
private Long vehicleCode;
|
private String vehicleCode;
|
||||||
|
|
||||||
@Excel(name = "图片")
|
@Excel(name = "图片")
|
||||||
@ApiModelProperty("图片")
|
@ApiModelProperty("图片")
|
||||||
|
@ -48,4 +48,8 @@ public class Fault extends BaseEntity
|
||||||
@ApiModelProperty("状态")
|
@ApiModelProperty("状态")
|
||||||
private String appealStatus;
|
private String appealStatus;
|
||||||
|
|
||||||
|
@Excel(name = "用户id")
|
||||||
|
@ApiModelProperty("用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.bst.fault.domain;
|
package com.ruoyi.bst.fault.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,17 @@
|
||||||
package com.ruoyi.bst.fault.domain;
|
package com.ruoyi.bst.fault.domain;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class FaultVO extends Fault{
|
public class FaultVO extends Fault{
|
||||||
|
|
||||||
|
@ApiModelProperty("订单时间")
|
||||||
|
private LocalDateTime orderEndTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("故障原因")
|
||||||
|
private String faultSite;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,4 +71,6 @@ public interface FaultMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteFaultByIds(Long[] ids);
|
public int deleteFaultByIds(Long[] ids);
|
||||||
|
|
||||||
|
FaultVO selectFaultByUserId(Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bf.fault_site,
|
bf.fault_site,
|
||||||
bf.fault_detail,
|
bf.fault_detail,
|
||||||
bf.appeal_status,
|
bf.appeal_status,
|
||||||
bf.create_time
|
bf.create_time,
|
||||||
|
bf.order_end_time,
|
||||||
|
bf.user_id
|
||||||
from bst_fault bf
|
from bst_fault bf
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
@ -25,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="query.vehicleCode != null "> and bf.vehicle_code = #{query.vehicleCode}</if>
|
<if test="query.vehicleCode != null "> and bf.vehicle_code = #{query.vehicleCode}</if>
|
||||||
<if test="query.picture != null and query.picture != ''"> and bf.picture = #{query.picture}</if>
|
<if test="query.picture != null and query.picture != ''"> and bf.picture = #{query.picture}</if>
|
||||||
<if test="query.orderId != null and query.orderId != ''"> and bf.order_id = #{query.orderId}</if>
|
<if test="query.orderId != null and query.orderId != ''"> and bf.order_id = #{query.orderId}</if>
|
||||||
|
<if test="query.userId != null and query.userId != ''"> and bf.user_id = #{query.userId}</if>
|
||||||
<if test="query.faultSiteList != null and query.faultSiteList != ''">
|
<if test="query.faultSiteList != null and query.faultSiteList != ''">
|
||||||
AND
|
AND
|
||||||
<foreach collection="query.faultSiteList" item="item" open="(" separator=" AND " close=")">
|
<foreach collection="query.faultSiteList" item="item" open="(" separator=" AND " close=")">
|
||||||
|
@ -47,6 +50,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<include refid="selectFaultVo"/>
|
<include refid="selectFaultVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectFaultByUserId" resultType="com.ruoyi.bst.fault.domain.FaultVO">
|
||||||
|
select
|
||||||
|
order_end_time,
|
||||||
|
vehicle_code,
|
||||||
|
fault_site,
|
||||||
|
create_time
|
||||||
|
from bst_fault where user_id = #{userId}
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertFault" parameterType="Fault" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertFault" parameterType="Fault" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into bst_fault
|
insert into bst_fault
|
||||||
|
@ -59,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="faultDetail != null">fault_detail,</if>
|
<if test="faultDetail != null">fault_detail,</if>
|
||||||
<if test="appealStatus != null and appealStatus != ''">appeal_status,</if>
|
<if test="appealStatus != null and appealStatus != ''">appeal_status,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="userName != null and userName != ''">#{userName},</if>
|
<if test="userName != null and userName != ''">#{userName},</if>
|
||||||
|
@ -69,6 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="faultDetail != null">#{faultDetail},</if>
|
<if test="faultDetail != null">#{faultDetail},</if>
|
||||||
<if test="appealStatus != null and appealStatus != ''">#{appealStatus},</if>
|
<if test="appealStatus != null and appealStatus != ''">#{appealStatus},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
|
@ -60,4 +60,6 @@ public interface FaultService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteFaultById(Long id);
|
public int deleteFaultById(Long id);
|
||||||
|
|
||||||
|
FaultVO selectFaultByUserId(Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.bst.fault.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.bst.fault.mapper.FaultMapper;
|
import com.ruoyi.bst.fault.mapper.FaultMapper;
|
||||||
|
@ -31,6 +32,7 @@ public class FaultServiceImpl implements FaultService
|
||||||
@Override
|
@Override
|
||||||
public FaultVO selectFaultById(Long id)
|
public FaultVO selectFaultById(Long id)
|
||||||
{
|
{
|
||||||
|
|
||||||
return faultMapper.selectFaultById(id);
|
return faultMapper.selectFaultById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +58,7 @@ public class FaultServiceImpl implements FaultService
|
||||||
public int insertFault(Fault fault)
|
public int insertFault(Fault fault)
|
||||||
{
|
{
|
||||||
fault.setCreateTime(DateUtils.getNowDate());
|
fault.setCreateTime(DateUtils.getNowDate());
|
||||||
|
fault.setUserId(SecurityUtils.getLoginUser().getUserId());
|
||||||
return faultMapper.insertFault(fault);
|
return faultMapper.insertFault(fault);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,4 +97,9 @@ public class FaultServiceImpl implements FaultService
|
||||||
{
|
{
|
||||||
return faultMapper.deleteFaultById(id);
|
return faultMapper.deleteFaultById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FaultVO selectFaultByUserId(Long id) {
|
||||||
|
return faultMapper.selectFaultByUserId(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.ruoyi.web.app;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.bst.areaSub.domain.AreaSubQuery;
|
||||||
|
import com.ruoyi.bst.areaSub.domain.enums.AreaSubStatus;
|
||||||
|
import com.ruoyi.bst.article.domain.ArticleQuery;
|
||||||
|
import com.ruoyi.bst.article.service.ArticleService;
|
||||||
|
import com.ruoyi.bst.articleCategory.domain.ArticleCategoryQuery;
|
||||||
|
import com.ruoyi.bst.articleCategory.domain.enums.ArticleCategoryStatus;
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
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/article")
|
||||||
|
public class AppArticleController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ArticleService articleService;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("查看文章信息")
|
||||||
|
@GetMapping("/detail")
|
||||||
|
@Anonymous
|
||||||
|
public AjaxResult getCategoryList(ArticleQuery query) {
|
||||||
|
if(query.getId() == null){
|
||||||
|
return error("文章id不能为空");
|
||||||
|
}
|
||||||
|
return AjaxResult.success(articleService.selectArticleList(query));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,30 +1,30 @@
|
||||||
package com.ruoyi.web.app;
|
package com.ruoyi.web.app;
|
||||||
|
|
||||||
import com.ruoyi.bst.areaSub.domain.AreaSubQuery;
|
|
||||||
import com.ruoyi.bst.areaSub.domain.enums.AreaSubStatus;
|
|
||||||
import com.ruoyi.bst.articleCategory.domain.ArticleCategoryQuery;
|
import com.ruoyi.bst.articleCategory.domain.ArticleCategoryQuery;
|
||||||
|
import com.ruoyi.bst.articleCategory.domain.enums.ArticleCategoryStatus;
|
||||||
|
import com.ruoyi.bst.articleCategory.service.ArticleCategoryService;
|
||||||
import com.ruoyi.common.annotation.Anonymous;
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import io.swagger.annotations.ApiOperation;
|
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.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import static com.ruoyi.common.core.domain.AjaxResult.error;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/app/articleCategory")
|
@RequestMapping("/app/articleCategory")
|
||||||
public class AppAtricleCategoryController extends BaseController {
|
public class AppAtricleCategoryController extends BaseController {
|
||||||
|
|
||||||
@ApiOperation("获取分类列表")
|
@Autowired
|
||||||
|
private ArticleCategoryService articleCategoryService;
|
||||||
|
|
||||||
|
@ApiOperation("展示分类信息")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Anonymous
|
@Anonymous
|
||||||
public AjaxResult getAreaSubList(ArticleCategoryQuery query) {
|
public AjaxResult getCategoryList(ArticleCategoryQuery query) {
|
||||||
if (query.getAreaId() == null) {
|
query.setCategoryStatus(ArticleCategoryStatus.ENABLED.getCode());
|
||||||
return error("areaId不能为空");
|
return success(articleCategoryService.selectArticleCategoryList(query));
|
||||||
}
|
|
||||||
query.setStatus(AreaSubStatus.ENABLED.getCode());
|
|
||||||
return success(areaSubService.selectAreaSubList(query));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,24 @@
|
||||||
package com.ruoyi.web.app;
|
package com.ruoyi.web.app;
|
||||||
|
|
||||||
|
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.FaultQuery;
|
||||||
import com.ruoyi.bst.fault.domain.FaultVO;
|
import com.ruoyi.bst.fault.domain.FaultVO;
|
||||||
import com.ruoyi.bst.fault.service.FaultService;
|
import com.ruoyi.bst.fault.service.FaultService;
|
||||||
|
import com.ruoyi.bst.order.service.OrderService;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import java.time.LocalDateTime;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户查询自己提交的故障信息
|
* 故障申报前台
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/app/fault")
|
@RequestMapping("/app/fault")
|
||||||
|
@ -21,14 +27,46 @@ public class AppFaultController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaultService faultService;
|
private FaultService faultService;
|
||||||
|
|
||||||
@GetMapping("/{id}")
|
@Autowired
|
||||||
public AjaxResult get(@PathVariable Long id) {
|
private DeviceService deviceService;
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserId();
|
|
||||||
// 当用户查询的故障信息是自己的或当前用户是超级管理员时
|
@Autowired
|
||||||
if (userId.equals(id)|| userId == 1){
|
private OrderService orderService;
|
||||||
FaultVO faultVO = faultService.selectFaultById(id);
|
|
||||||
return success(faultVO);
|
/**
|
||||||
}
|
* 新增
|
||||||
return error("您的查询不合法!");
|
* @param fault
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody Fault fault) {
|
||||||
|
faultService.insertFault(fault);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public AjaxResult get(FaultQuery query) {
|
||||||
|
query.setUserId(getUserId());
|
||||||
|
List<FaultVO> list = faultService.selectFaultList(query);
|
||||||
|
List<FaultVO> validList = new ArrayList<>();
|
||||||
|
|
||||||
|
list.forEach(faultVO -> {
|
||||||
|
DeviceVO deviceVO = deviceService.selectDeviceBySn(faultVO.getVehicleCode());
|
||||||
|
if (deviceVO == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Long orderId = deviceVO.getOrderId();
|
||||||
|
if (orderId == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LocalDateTime orderEndTime = orderService.selectOrderById(orderId).getEndTime();
|
||||||
|
if (orderEndTime == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
faultVO.setOrderEndTime(orderEndTime);
|
||||||
|
validList.add(faultVO);
|
||||||
|
});
|
||||||
|
return success(validList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user