[修改] 报告名称不能重复
This commit is contained in:
+23
-1
@@ -1,6 +1,7 @@
|
|||||||
package com.adc.da.report.controller;
|
package com.adc.da.report.controller;
|
||||||
|
|
||||||
import com.adc.da.report.annotation.ReportLog;
|
import com.adc.da.report.annotation.ReportLog;
|
||||||
|
import com.adc.da.report.dao.mysql.ReportDao;
|
||||||
import com.adc.da.report.eo.FileEntity;
|
import com.adc.da.report.eo.FileEntity;
|
||||||
import com.adc.da.report.eo.ReportEntity;
|
import com.adc.da.report.eo.ReportEntity;
|
||||||
import com.adc.da.report.service.IFileService;
|
import com.adc.da.report.service.IFileService;
|
||||||
@@ -70,6 +71,8 @@ public class ReportManageConroller {
|
|||||||
@Value("${uploadType}")
|
@Value("${uploadType}")
|
||||||
private String uploadType;
|
private String uploadType;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReportDao reportDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增或编辑报告
|
* 新增或编辑报告
|
||||||
@@ -80,10 +83,17 @@ public class ReportManageConroller {
|
|||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ReportLog(description = "新增或编辑")
|
@ReportLog(description = "新增或编辑")
|
||||||
public ResponseMessage add(@RequestBody ReportVo vo) throws IOException {
|
public ResponseMessage add(@RequestBody ReportVo vo) throws IOException {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
ReportEntity entity = new ReportEntity();
|
ReportEntity entity = new ReportEntity();
|
||||||
BeanUtils.copyProperties(vo, entity);
|
BeanUtils.copyProperties(vo, entity);
|
||||||
|
/**
|
||||||
|
* 名称不能重复
|
||||||
|
*/
|
||||||
|
long count = reportDao.selectByidAndName(entity);
|
||||||
|
if (count>0){
|
||||||
|
return Result.error("报告名称已存在");
|
||||||
|
}
|
||||||
String name = reportService.insert(entity, vo.getLabelList());
|
String name = reportService.insert(entity, vo.getLabelList());
|
||||||
Map<String, Object> map = new HashMap<>();
|
|
||||||
map.put("reportName", name);
|
map.put("reportName", name);
|
||||||
return Result.success(map);
|
return Result.success(map);
|
||||||
}
|
}
|
||||||
@@ -356,4 +366,16 @@ public class ReportManageConroller {
|
|||||||
return Result.success(reportVoIPage);
|
return Result.success(reportVoIPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断报告是否在流程中
|
||||||
|
* @return
|
||||||
|
* @throws ParseException
|
||||||
|
*/
|
||||||
|
@ApiOperation("判断报告是否在流程中")
|
||||||
|
@PostMapping("/isAct")
|
||||||
|
public ResponseMessage isAct(@RequestBody ReportQueryVo vo) throws Exception {
|
||||||
|
List<String> act = reportService.isAct(vo);
|
||||||
|
return Result.success(act);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,4 +55,8 @@ public interface ReportDao extends BaseMapper<ReportEntity> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IPage<ReportVo> reportManagerPage(IPage<ReportEntity> page, @Param("Vo") ReportQueryVo vo, @Param("idSet") Set<String> idSet);
|
IPage<ReportVo> reportManagerPage(IPage<ReportEntity> page, @Param("Vo") ReportQueryVo vo, @Param("idSet") Set<String> idSet);
|
||||||
|
|
||||||
|
List<String> isAct(@Param("Vo") ReportQueryVo vo);
|
||||||
|
|
||||||
|
long selectByidAndName(@Param("Vo")ReportEntity entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,4 +47,6 @@ public interface IReportService {
|
|||||||
IPage<ReportVo> page(ReportQueryVo vo);
|
IPage<ReportVo> page(ReportQueryVo vo);
|
||||||
|
|
||||||
IPage<ReportVo> reportManagerPage(ReportQueryVo vo);
|
IPage<ReportVo> reportManagerPage(ReportQueryVo vo);
|
||||||
|
|
||||||
|
List<String> isAct(ReportQueryVo vo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,9 +29,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
@@ -456,6 +453,27 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> isAct(ReportQueryVo vo) {
|
||||||
|
boolean flag = false;
|
||||||
|
//判断是不是管理员
|
||||||
|
boolean admin = false;
|
||||||
|
List<RoleEO> roleEOList = roleEODao.selectByuserId(UserUtils.getUserId());
|
||||||
|
for (RoleEO roleEO : roleEOList) {
|
||||||
|
if ("管理员".equals(roleEO.getName())){
|
||||||
|
admin= !admin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (admin) {
|
||||||
|
vo.setUsid(null);
|
||||||
|
} else {
|
||||||
|
vo.setUsid(UserUtils.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> act = baseMapper.isAct(vo);
|
||||||
|
return act;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建htmlstring
|
* 创建htmlstring
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public class ReportQueryVo {
|
|||||||
private String usid;
|
private String usid;
|
||||||
|
|
||||||
private List<String> ids;
|
private List<String> ids;
|
||||||
|
|
||||||
//
|
//
|
||||||
// private List<String> noIds;
|
// private List<String> noIds;
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
<if test="pageVO.usid !='' and pageVO.usid != null">
|
<if test="pageVO.usid !='' and pageVO.usid != null">
|
||||||
AND eo.id NOT IN ( SELECT ru.reportId FROM tr_report_user ru WHERE ru.userId = #{pageVO.usid} )
|
AND eo.id NOT IN ( SELECT ru.reportId FROM tr_report_user ru WHERE ru.userId = #{pageVO.usid} )
|
||||||
AND eo.id NOT IN ( SELECT tt.report_id FROM power_apply tt WHERE tt.user_id = #{pageVO.usid} )
|
AND eo.id NOT IN ( SELECT tt.report_id FROM power_apply tt WHERE tt.user_id = #{pageVO.usid} )
|
||||||
AND eo.id NOT IN (SELECT tt.report_id FROM power_apply_act tt WHERE tt.user_id = #{pageVO.usid} and
|
AND eo.id NOT IN (SELECT tt.report_id FROM power_apply_act tt LEFT JOIN bus_process_name pro on tt.prc_id = pro.PRC_ID WHERE tt.user_id = #{pageVO.usid} and
|
||||||
del_flag != 1 and pro.SUBMIT_STATUS = 1)
|
del_flag != 1 and pro.SUBMIT_STATUS = 1)
|
||||||
</if>
|
</if>
|
||||||
<if test="pageVO.name !='' and pageVO.name != null">
|
<if test="pageVO.name !='' and pageVO.name != null">
|
||||||
@@ -180,5 +180,29 @@
|
|||||||
|
|
||||||
ORDER BY updateDate desc
|
ORDER BY updateDate desc
|
||||||
</select>
|
</select>
|
||||||
|
<select id="isAct" resultType="java.lang.String">
|
||||||
|
SELECT rep.name FROM power_apply_act tt
|
||||||
|
LEFT JOIN bus_process_name pro on tt.prc_id = pro.PRC_ID
|
||||||
|
LEFT JOIN tt_report_manage rep on tt.report_id = rep.id
|
||||||
|
WHERE tt.user_id = #{Vo.usid} and tt.del_flag != 1 and
|
||||||
|
pro.SUBMIT_STATUS = 1
|
||||||
|
and tt.report_id in
|
||||||
|
<foreach collection="Vo.ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY rep.id;
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByidAndName" resultType="java.lang.Long">
|
||||||
|
select count(1) from tt_report_manage rep
|
||||||
|
<where>
|
||||||
|
rep.Name = #{Vo.name}
|
||||||
|
and rep.del_flag = 0
|
||||||
|
<if test="Vo.id != null and Vo.id != ''">
|
||||||
|
and rep.id = #{Vo.id}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user