Compare commits

..

3 Commits

Author SHA1 Message Date
liang.chao 1eee9bfe05 更新时间字段更新 2024-12-10 15:58:10 +08:00
liang.chao 7fb5fc3d53 Merge remote-tracking branch 'origin/master' 2024-12-10 13:39:29 +08:00
liang.chao 3a0016321e 安全证书 2024-12-10 13:39:23 +08:00
10 changed files with 89 additions and 25 deletions

View File

@ -71,7 +71,7 @@ public class MaDevQcController extends BaseController {
@ApiOperation(value = "删除装备质检")
@PostMapping("/deleteById")
public AjaxResult deleteById(@RequestBody MaDevQc maDevQc) {
if (maDevQc == null || maDevQc.getId() == null) {
if (maDevQc == null || maDevQc.getMaId() == null) {
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
}
Integer i = maDevQcService.deleteById(maDevQc);

View File

@ -4,24 +4,25 @@ import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.device.domain.SafeBookInfo;
import com.bonus.material.device.service.SafeBookService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @Authorliang.chao
* @Date2024/12/4 - 16:24
*/
@RestController
@RequestMapping("/safeBook")
@Api(value = "安全证书",tags = "安全证书管理")
public class SafeBookController extends BaseController {
@Resource
private SafeBookService safeBookService;
@ApiOperation(value = "查询安全证书")
@ApiOperation(value = "安全证书列表")
@GetMapping("/getSafeBookByMaId")
public AjaxResult getSafeBookByMaId(SafeBookInfo safeBookInfo) {
startPage();
@ -39,6 +40,16 @@ public class SafeBookController extends BaseController {
return AjaxResult.error("新增失败");
}
}
@ApiOperation(value = "修改安全证书")
@PostMapping("/editSafeBook")
public AjaxResult editSafeBook(@RequestBody SafeBookInfo safeBookInfo) {
Integer i = safeBookService.editSafeBook(safeBookInfo);
if (i > 0) {
return AjaxResult.success("修改成功");
} else {
return AjaxResult.error("修改失败");
}
}
@ApiOperation(value = "删除安全证书")

View File

@ -40,4 +40,16 @@ public class SafeBookInfo {
@ApiModelProperty(value = "安全证书附件")
private List<BmFileInfo> fileInfoList;
@ApiModelProperty(value = "装备名称")
private String deviceName;
@ApiModelProperty(value = "装备编码")
private String deviceCode;
@ApiModelProperty(value = "文件地址")
private String url;
@ApiModelProperty(value = "上传人")
private String nickName;
}

View File

@ -33,7 +33,7 @@ public interface MaDevQcMapper {
* @param id
* @return
*/
int deleteDevQcById(Integer id);
int deleteDevQcById(Integer maId);
/**
* 查询月任务数

View File

@ -18,4 +18,6 @@ public interface SafeBookMapper {
String selectTaskNumByMonth(@Param("date") Date nowDate);
Integer delSafeBook(SafeBookInfo safeBookInfo);
Integer updateTime(Integer maId);
}

View File

@ -15,4 +15,6 @@ public interface SafeBookService {
Integer addSafeBook(SafeBookInfo safeBookInfo);
Integer delSafeBook(SafeBookInfo safeBookInfo);
Integer editSafeBook(SafeBookInfo safeBookInfo);
}

View File

@ -112,9 +112,9 @@ public class MaDevQcServiceImpl implements MaDevQcService {
*/
@Override
public Integer deleteById(MaDevQc maDevQc) {
int i = maDevQcMapper.deleteDevQcById(maDevQc.getId());
int i = maDevQcMapper.deleteDevQcById(maDevQc.getMaId());
if (i > 0) {
bmFileInfoMapper.deleteBmFileInfoByMaId(maDevQc.getId(),4);
bmFileInfoMapper.deleteBmFileInfoByMaId(maDevQc.getMaId(),4);
}
return i;
}

View File

@ -12,6 +12,7 @@ import com.bonus.material.device.service.SafeBookService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import javax.annotation.Resource;
@ -33,6 +34,7 @@ public class SafeBookServiceImpl implements SafeBookService {
@Resource
private DevInfoMapper devInfoMapper;
@Override
public List<SafeBookInfo> getSafeBookByMaId(SafeBookInfo safeBookInfo) {
return safeBookMapper.getSafeBookByMaId(safeBookInfo);
@ -47,7 +49,7 @@ public class SafeBookServiceImpl implements SafeBookService {
if (i > 0) {
if (CollectionUtils.isNotEmpty(safeBookInfo.getFileInfoList())) {
for (BmFileInfo bmFileInfo : safeBookInfo.getFileInfoList()) {
bmFileInfo.setModelId(safeBookInfo.getId().longValue());
bmFileInfo.setModelId(Long.valueOf(safeBookInfo.getMaId()));
bmFileInfo.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
// 安全证书附件
bmFileInfo.setFileType(5L);
@ -68,6 +70,25 @@ public class SafeBookServiceImpl implements SafeBookService {
return i;
}
@Override
public Integer editSafeBook(SafeBookInfo safeBookInfo) {
safeBookMapper.updateTime(safeBookInfo.getMaId());
Integer i = bmFileInfoMapper.deleteBmFileInfoByMaId(safeBookInfo.getMaId(), 5);
if (i > 0) {
if (CollectionUtils.isNotEmpty(safeBookInfo.getFileInfoList())) {
for (BmFileInfo bmFileInfo : safeBookInfo.getFileInfoList()) {
bmFileInfo.setModelId(Long.valueOf(safeBookInfo.getMaId()));
bmFileInfo.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
// 安全证书附件
bmFileInfo.setFileType(5L);
bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
}
}
}
return i;
}
private String getString() {
//根据前台传过来的数据生成需求编号
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
@ -84,7 +105,7 @@ public class SafeBookServiceImpl implements SafeBookService {
} else {
taskNum = "0001";
}
return format + "-" + taskNum;
return "AQZS" + format + "-" + taskNum;
}
}

View File

@ -6,7 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.bonus.material.device.mapper.MaDevQcMapper">
<delete id="deleteDevQcById">
delete from ma_dev_qc where id = #{id}
delete from ma_dev_qc where ma_id = #{maId}
</delete>
<insert id="insertDevQc" useGeneratedKeys="true" keyProperty="id">
@ -49,7 +49,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
m1.qc_user AS qcUser,
m1.qc_time AS qcTime,
su.nick_name AS createBy,
m1.create_time AS createTime
m1.create_time AS updateTime,
aa.create_time AS createTime
FROM
ma_dev_qc m1
LEFT JOIN ma_dev_info m2 ON m1.ma_id = m2.ma_id
@ -57,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN sys_user su ON su.user_id = m1.create_by
INNER JOIN ( SELECT count(*) as num, ma_id, MAX( qc_time ) AS max_qc_time FROM ma_dev_qc GROUP BY ma_id ) latest_qc ON m1.ma_id = latest_qc.ma_id
AND m1.qc_time = latest_qc.max_qc_time
INNER JOIN ( SELECT ma_id, min( create_time ) AS create_time FROM ma_dev_qc GROUP BY ma_id ) aa ON m1.ma_id = aa.ma_id
<where>
<if test="deviceCode != null and deviceCode != ''">
and m2.code like concat('%',#{deviceCode},'%')
@ -64,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qcUser != null and qcUser != ''">
and m1.qc_user like concat('%',#{qcUser},'%')
</if>
<if test="minNum != null and maxNum != ''">
<if test="minNum != null and maxNum != null">
and latest_qc.num BETWEEN #{minNum} AND #{maxNum}
</if>
<if test="qcCode != null and qcCode != ''">
@ -74,11 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and DATE_FORMAT(m1.qc_time,'%Y-%m-%d') between #{qcStartTime} and #{qcEndTime}
</if>
<if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''">
and DATE_FORMAT(m1.update_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
and DATE_FORMAT(m1.create_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
</if>
</where>
ORDER BY
m1.qc_time DESC
</select>
<select id="selectQcList" resultType="com.bonus.material.device.domain.MaDevQc">
SELECT

View File

@ -7,24 +7,40 @@
insert into safe_book(code,ma_id,upload_person,create_time)
values(#{code},#{maId},#{uploadPerson},now())
</insert>
<update id="updateTime">
update safe_book set update_time = now() where ma_id = #{maId}
</update>
<delete id="delSafeBook">
delete from safe_book where id = #{id}
delete from safe_book where ma_id = #{maId}
</delete>
<select id="getSafeBookByMaId" resultType="com.bonus.material.device.domain.SafeBookInfo">
select id,code,ma_id,url,upload_person,create_time,update_time from safe_book where ma_id = #{maId}
SELECT
sb.*,
su.nick_name,
mdi.device_name,
mdi.CODE AS deviceCode,
bfi.url
FROM
safe_book sb
LEFT JOIN ma_dev_info mdi ON sb.ma_id = mdi.ma_id
LEFT JOIN bm_file_info bfi ON bfi.model_id = sb.ma_id
LEFT JOIN sys_user su on sb.upload_person = su.user_id
WHERE
bfi.task_type = 17
AND bfi.file_type = 5
<if test="code != null and code != ''">
and code like concat('%',#{code},'%')
and mdi.code like concat('%',#{code},'%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
AND sb.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>
order by create_time desc
</select>
<select id="selectTaskNumByMonth" resultType="java.lang.String">
SELECT SUBSTRING(lease_code, - 4) as code
SELECT SUBSTRING(code, - 4) as code
FROM safe_book
WHERE DATE_FORMAT(create_time, '%y%m') = DATE_FORMAT(#{date}, '%y%m')
ORDER BY create_time DESC LIMIT 1