Sfoglia il codice sorgente

质检相册功能

cr 4 settimane fa
parent
commit
a52bb7a0f8

+ 38 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/AlbumDTO.java

@@ -0,0 +1,38 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.dto;
+
+import org.springblade.manager.entity.Album;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2025-07-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class AlbumDTO extends Album {
+	private static final long serialVersionUID = 1L;
+
+	private List<String> margePdfUrls;
+
+}

+ 77 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/Album.java

@@ -0,0 +1,77 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.time.LocalDate;
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2025-07-15
+ */
+@Data
+@TableName("m_album")
+@EqualsAndHashCode(callSuper = true)
+public class Album extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 项目ID
+	*/
+		private Long projectId;
+	/**
+	* 合同段ID
+	*/
+		private Long contractId;
+	/**
+	* 分类ID (m_image_classification_config)
+	*/
+		private Long classifyId;
+	/**
+	* 相册文件题名
+	*/
+		private String imagesName;
+	/**
+	* 主要拍摄人
+	*/
+		private String photographer;
+	/**
+	* 分组号
+	*/
+		private String groupNumber;
+	/**
+	* 开始日期
+	*/
+		private String startDate;
+	/**
+	* 结束日期
+	*/
+		private String endDate;
+	/**
+	* 相册PDF
+	*/
+		private String imagesPdf;
+
+
+}

+ 36 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/AlbumVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.vo;
+
+import org.springblade.manager.entity.Album;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2025-07-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class AlbumVO extends Album {
+	private static final long serialVersionUID = 1L;
+
+	private String classifyName;
+
+}

+ 158 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/AlbumController.java

@@ -0,0 +1,158 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.controller;
+
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.manager.dto.AlbumDTO;
+import org.springblade.manager.utils.FileUtils;
+import org.springblade.resource.feign.NewIOSSClient;
+import org.springblade.system.cache.ParamCache;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestParam;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.manager.entity.Album;
+import org.springblade.manager.vo.AlbumVO;
+import org.springblade.manager.wrapper.AlbumWrapper;
+import org.springblade.manager.service.IAlbumService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2025-07-15
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/album")
+@Api(value = "", tags = "接口")
+public class AlbumController extends BladeController {
+
+	private final IAlbumService albumService;
+
+	private final NewIOSSClient newIOSSClient;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入album")
+	public R<AlbumVO> detail(Album album) {
+		Album detail = albumService.getOne(Condition.getQueryWrapper(album));
+		return R.data(AlbumWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 分页 
+	 */
+	@PostMapping("/page")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入album")
+	public R<IPage<AlbumVO>> page(Long projectId,Long contractId,Query query) {
+		IPage<AlbumVO> pages = albumService.selectPage(projectId,contractId,Condition.getPage(query));
+		return R.data(pages);
+	}
+
+
+//	/**
+//	 * 自定义分页
+//	 */
+//	@GetMapping("/page")
+//	@ApiOperationSupport(order = 3)
+//	@ApiOperation(value = "分页", notes = "传入album")
+//	public R<IPage<AlbumVO>> page(AlbumVO album, Query query) {
+//		IPage<AlbumVO> pages = albumService.selectAlbumPage(Condition.getPage(query), album);
+//		return R.data(pages);
+//	}
+
+	/**
+	 * 新增 
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入album")
+	public R save(@Valid @RequestBody AlbumDTO albumDTO) {
+		String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+		String mergeName = SnowFlakeUtil.getId() + ".pdf", mergeUrl = file_path + "/print//" + mergeName;
+		FileUtils.mergePdfPublicMethods(albumDTO.getMargePdfUrls(), mergeUrl);
+		BladeFile bladeFile = this.newIOSSClient.uploadFile(mergeName, mergeUrl);
+		Album album=new Album();
+		BeanUtil.copy(albumDTO,album);
+		if (bladeFile != null && ObjectUtils.isNotEmpty(bladeFile.getLink())) {
+			album.setImagesPdf(bladeFile.getLink());
+		}
+		return R.status(albumService.save(album));
+	}
+
+	/**
+	 * 修改 
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入album")
+	public R update(@Valid @RequestBody Album album) {
+		return R.status(albumService.updateById(album));
+	}
+
+//	/**
+//	 * 新增或修改
+//	 */
+//	@PostMapping("/submit")
+//	@ApiOperationSupport(order = 6)
+//	@ApiOperation(value = "新增或修改", notes = "传入album")
+//	public R submit(@Valid @RequestBody Album album) {
+//		return R.status(albumService.saveOrUpdate(album));
+//	}
+
+	
+//	/**
+//	 * 删除
+//	 */
+//	@PostMapping("/remove")
+//	@ApiOperationSupport(order = 7)
+//	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+//	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+//		return R.status(albumService.deleteLogic(Func.toLongList(ids)));
+//	}
+
+
+
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam Long id) {
+		return R.status(albumService.removeById(id));
+	}
+
+	
+}

+ 43 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/AlbumMapper.java

@@ -0,0 +1,43 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.mapper;
+
+import org.springblade.manager.entity.Album;
+import org.springblade.manager.vo.AlbumVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2025-07-15
+ */
+public interface AlbumMapper extends BaseMapper<Album> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param album
+	 * @return
+	 */
+	List<AlbumVO> selectAlbumPage(IPage page, AlbumVO album);
+
+    List<AlbumVO> selectPage1(Long projectId, Long contractId, IPage<AlbumVO> page);
+}

+ 35 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/AlbumMapper.xml

@@ -0,0 +1,35 @@
+<?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="org.springblade.manager.mapper.AlbumMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="albumResultMap" type="org.springblade.manager.entity.Album">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="project_id" property="projectId"/>
+        <result column="contract_id" property="contractId"/>
+        <result column="classify_id" property="classifyId"/>
+        <result column="images_name" property="imagesName"/>
+        <result column="photographer" property="photographer"/>
+        <result column="group_number" property="groupNumber"/>
+        <result column="start_date" property="startDate"/>
+        <result column="end_date" property="endDate"/>
+        <result column="images_pdf" property="imagesPdf"/>
+    </resultMap>
+
+
+    <select id="selectAlbumPage" resultMap="albumResultMap">
+        select * from m_album where is_deleted = 0
+    </select>
+    <select id="selectPage1" resultType="org.springblade.manager.vo.AlbumVO">
+        select a.*,m.classf_name as classifyName from m_album a left join m_image_classification_config m on a.classify_id=m.id
+        where a.project_id=#{projectId} and a.contract_id=#{contractId} and a.is_deleted = 0
+        limit #{page.offset},#{page.size}
+    </select>
+</mapper>

+ 43 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IAlbumService.java

@@ -0,0 +1,43 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.service;
+
+import org.springblade.manager.entity.Album;
+import org.springblade.manager.vo.AlbumVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2025-07-15
+ */
+public interface IAlbumService extends BaseService<Album> {
+
+//	/**
+//	 * 自定义分页
+//	 *
+//	 * @param page
+//	 * @param album
+//	 * @return
+//	 */
+//	IPage<AlbumVO> selectAlbumPage(IPage<AlbumVO> page, AlbumVO album);
+
+
+	IPage<AlbumVO> selectPage(Long projectId, Long contractId, IPage<AlbumVO> page);
+}

+ 47 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/AlbumServiceImpl.java

@@ -0,0 +1,47 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.service.impl;
+
+import org.springblade.manager.entity.Album;
+import org.springblade.manager.vo.AlbumVO;
+import org.springblade.manager.mapper.AlbumMapper;
+import org.springblade.manager.service.IAlbumService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2025-07-15
+ */
+@Service
+public class AlbumServiceImpl extends BaseServiceImpl<AlbumMapper, Album> implements IAlbumService {
+
+//	@Override
+//	public IPage<AlbumVO> selectAlbumPage(IPage<AlbumVO> page, AlbumVO album) {
+//		return page.setRecords(baseMapper.selectAlbumPage(page, album));
+//	}
+
+	@Override
+	public IPage<AlbumVO> selectPage(Long projectId, Long contractId, IPage<AlbumVO> page) {
+		return page.setRecords(baseMapper.selectPage1(projectId,contractId,page));
+	}
+
+
+}

+ 49 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/wrapper/AlbumWrapper.java

@@ -0,0 +1,49 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.manager.entity.Album;
+import org.springblade.manager.vo.AlbumVO;
+import java.util.Objects;
+
+/**
+ * 包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2025-07-15
+ */
+public class AlbumWrapper extends BaseEntityWrapper<Album, AlbumVO>  {
+
+	public static AlbumWrapper build() {
+		return new AlbumWrapper();
+ 	}
+
+	@Override
+	public AlbumVO entityVO(Album album) {
+		AlbumVO albumVO = Objects.requireNonNull(BeanUtil.copy(album, AlbumVO.class));
+
+		//User createUser = UserCache.getUser(album.getCreateUser());
+		//User updateUser = UserCache.getUser(album.getUpdateUser());
+		//albumVO.setCreateUserName(createUser.getName());
+		//albumVO.setUpdateUserName(updateUser.getName());
+
+		return albumVO;
+	}
+
+}