Commit 856952d1 authored by wdy's avatar wdy

新增车企文件

parent acc1f43f
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
......@@ -78,4 +79,15 @@ public class ReviewDetailsResult implements Serializable {
@ApiModelProperty("最后修改时间")
private Date lastModifyTime;
@ApiModelProperty("文件目录")
private String catalogue;
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("关联到车企留档文件")
private Long reviewEnterpriseArchiveId;
@TableField(exist = false)
@ApiModelProperty("文件名称")
private String fileName;
}
......@@ -27,46 +27,62 @@ public class ReviewEnterpriseArchive implements Serializable {
/**
* 企业名称
*/
@ApiModelProperty("企业名称")
private String enterpriseName;
/**
* 文件名称
*/
@ApiModelProperty("文件名称")
private String fileName;
/**
* 文件版本
*/
@ApiModelProperty("文件版本")
private String version;
/**
* 发布日期
*/
@ApiModelProperty("发布日期")
private Date publishDate;
/**
* 文件状态
*/
@ApiModelProperty("文件状态")
private String status;
/**
* 文件识别号
*/
@ApiModelProperty("文件识别号")
private String identifyNumber;
/**
* 存储位置
*/
@ApiModelProperty("存储位置")
private String storage;
/**
* 图片地址
*/
@ApiModelProperty("图片地址")
private String photo;
/**
* 关联到任务id
*/
@ApiModelProperty("关联到任务id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long taskId;
@ApiModelProperty("创建人")
private String createBy;
@ApiModelProperty("创建时间")
private Date createTime;
}
\ No newline at end of file
......@@ -20,6 +20,8 @@ public interface ReviewEnterpriseArchiveMapper extends BaseMapper<ReviewEnterpri
List<ReviewEnterpriseArchive> findByTaskId(@Param("taskId") Long taskId);
List<ReviewEnterpriseArchiveViewItemVO> findViewItemVOByTaskId(@Param("taskId") Long taskId);
Long findFileName(@Param("taskId") Long taskId,@Param("fileName") String fileName);
}
......
......@@ -15,4 +15,5 @@ public interface ReviewEnterpriseArchiveService extends IService<ReviewEnterpris
List<ReviewEnterpriseArchiveViewVO> view(Long taskId);
void addEnterpriseArchive(ReviewEnterpriseArchive reviewEnterpriseArchive);
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.ReviewEnterpriseArchive;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewItemVO;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO;
import com.ruoyi.service.ReviewEnterpriseArchiveService;
import com.ruoyi.mapper.ReviewEnterpriseArchiveMapper;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -24,6 +31,12 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
@Autowired
private ReviewEnterpriseArchiveMapper reviewEnterpriseArchiveMapper;
@Autowired
private ISysUserService sysUserService;
@Autowired
private ReviewEnterpriseArchiveService reviewEnterpriseArchiveService;
@Override
public List<ReviewEnterpriseArchiveViewVO> view(Long taskId) {
......@@ -34,6 +47,26 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
return buildReviewEnterpriseArchiveViewVO(archives, viewItems);
}
@Override
public void addEnterpriseArchive(ReviewEnterpriseArchive reviewEnterpriseArchive) {
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = sysUserService.selectUserById(loginUser.getUserId());
reviewEnterpriseArchive.setCreateBy(user.getNickName());
reviewEnterpriseArchive.setCreateTime(new Date());
Long sum = reviewEnterpriseArchiveMapper.findFileName(reviewEnterpriseArchive.getTaskId(),reviewEnterpriseArchive.getFileName());
if (sum >0 ) {
throw new ServiceException("新增文件名称重复,请检查", HttpStatus.ERROR);
} else {
reviewEnterpriseArchiveService.save(reviewEnterpriseArchive);
}
}
private List<ReviewEnterpriseArchiveViewVO> buildReviewEnterpriseArchiveViewVO(List<ReviewEnterpriseArchive> archives, List<ReviewEnterpriseArchiveViewItemVO> viewItems) {
List<ReviewEnterpriseArchiveViewVO> viewList = new ArrayList();
......
package com.ruoyi.web;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.ReviewEnterpriseArchive;
import com.ruoyi.service.ReviewEnterpriseArchiveService;
import com.ruoyi.web.request.TaskCreateRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "车企文件")
@RestController
@RequestMapping("/review/enterprise/archive")
public class ReviewEnterpriseArchiveController extends BaseController {
@Autowired
private ReviewEnterpriseArchiveService reviewEnterpriseArchiveService;
@ApiOperation("新增车企文件")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "车企文件", businessType = BusinessType.INSERT)
@RequestMapping(method = RequestMethod.POST, value = "/add")
public R<String> addEnterpriseArchive(@Validated @RequestBody ReviewEnterpriseArchive reviewEnterpriseArchive) {
reviewEnterpriseArchiveService.addEnterpriseArchive(reviewEnterpriseArchive);
return R.ok();
}
}
......@@ -14,6 +14,9 @@
<result property="userId" column="user_id" jdbcType="BIGINT"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="lastModifyTime" column="last_modify_time" jdbcType="TIMESTAMP"/>
<result property="catalogue" column="catalogue" jdbcType="VARCHAR"/>
<result property="reviewEnterpriseArchiveId" column="review_enterprise_archive_id" jdbcType="BIGINT"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -22,11 +25,11 @@
task_id from t_review_details_result
</sql>
<select id="findByTaskId" resultType="com.ruoyi.domain.ReviewDetailsResult">
SELECT id, passed, comment, images_url, review_details_id, task_id, user_id, user_name, last_modify_time FROM t_review_details_result WHERE task_id = #{taskId}
SELECT id, passed, comment, images_url, review_details_id, task_id, user_id, user_name, last_modify_time, catalogue, review_enterprise_archive_id FROM t_review_details_result WHERE task_id = #{taskId}
</select>
<select id="findByTaskIdAndDetailsId" resultType="com.ruoyi.domain.ReviewDetailsResult">
SELECT id, passed, comment, images_url, review_details_id, task_id, user_id, user_name, last_modify_time
SELECT id, passed, comment, images_url, review_details_id, task_id, user_id, user_name, last_modify_time, catalogue, review_enterprise_archive_id
FROM t_review_details_result
WHERE task_id = #{taskId} and review_details_id = #{reviewDetailsId}
</select>
......
......@@ -6,7 +6,7 @@
<resultMap id="BaseResultMap" type="com.ruoyi.domain.ReviewEnterpriseArchive">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="enterpriseName" column="enterprice_name" jdbcType="VARCHAR"/>
<result property="enterpriseName" column="enterprise_name" jdbcType="VARCHAR"/>
<result property="fileName" column="file_name" jdbcType="VARCHAR"/>
<result property="version" column="version" jdbcType="VARCHAR"/>
<result property="publishDate" column="publish_date" jdbcType="DATE"/>
......@@ -15,10 +15,12 @@
<result property="storage" column="storage" jdbcType="VARCHAR"/>
<result property="photo" column="photo" jdbcType="VARCHAR"/>
<result property="taskId" column="task_id" jdbcType="BIGINT"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<select id="findByTaskId" resultType="com.ruoyi.domain.ReviewEnterpriseArchive">
SELECT id, enterprise_name, file_name, version, publish_date, status, identify_number, storage, photo, task_id FROM t_review_enterprise_archive WHERE task_id = #{taskId}
SELECT id, enterprise_name, file_name, version, publish_date, status, identify_number, storage, photo, task_id, create_by, create_time FROM t_review_enterprise_archive WHERE task_id = #{taskId}
</select>
<select id="findViewItemVOByTaskId" resultType="com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewItemVO">
SELECT
......@@ -34,4 +36,8 @@
LEFT JOIN t_review_enterprise_archive archive ON result.review_enterprise_archive_id = archive.id
WHERE result.task_id = #{taskId};
</select>
<select id="findFileName" resultType="java.lang.Long">
select COUNT(*) sum from t_review_enterprise_archive
where task_id = #{taskId} and file_name = #{fileName}
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment