From af7cb720ab8d7e20599f0272dbefd864590cf8ed Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.com> Date: Mon, 6 Dec 2021 15:04:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=96=AB=E6=83=85=E9=98=B2=E6=8E=A7--=E7=96=AB?= =?UTF-8?q?=E8=8B=97=E6=8E=A5=E7=A7=8D=E7=99=BB=E8=AE=B0=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=EF=BC=8C=E6=8E=A5=E7=A7=8D=E7=99=BB=E8=AE=B0=E6=97=B6=E5=8F=AF?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epdc/vaccine/constant/ImageConstant.java | 15 +++ .../dto/result/VaccinationInfoResultDTO.java | 9 +- .../impl/EpidemicUserInfoServiceImpl.java | 8 +- .../esua/epdc/vaccine/vim/dao/VimImgDao.java | 55 ++++++++ .../vaccine/vim/dto/EpidemicImagesDTO.java | 16 +++ .../vaccine/vim/dto/VaccinationInfoDTO.java | 8 +- .../epdc/vaccine/vim/entity/VimImgEntity.java | 53 ++++++++ .../vaccine/vim/service/VimImgService.java | 118 +++++++++++++++++ .../impl/VaccinationInfoServiceImpl.java | 8 +- .../vim/service/impl/VimImgServiceImpl.java | 123 ++++++++++++++++++ .../main/resources/mapper/vim/VimImgDao.xml | 18 +++ 11 files changed, 426 insertions(+), 5 deletions(-) create mode 100644 epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/constant/ImageConstant.java create mode 100644 epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/dao/VimImgDao.java create mode 100644 epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/dto/EpidemicImagesDTO.java create mode 100644 epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/entity/VimImgEntity.java create mode 100644 epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/service/VimImgService.java create mode 100644 epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/service/impl/VimImgServiceImpl.java create mode 100644 epdc-cloud-vim-yushan/src/main/resources/mapper/vim/VimImgDao.xml diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/constant/ImageConstant.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/constant/ImageConstant.java new file mode 100644 index 0000000..c4dc621 --- /dev/null +++ b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/constant/ImageConstant.java @@ -0,0 +1,15 @@ +package com.elink.esua.epdc.vaccine.constant; + +/** + * 图片常量 + * @Author zy + * @Date 2019/9/8 17:07 + */ +public interface ImageConstant { + + /** + * 图片类型-疫苗接种证明材料 + */ + public final static String TYPE_IMAGE_VIM_EPIDEMIC_IMG = "vim_epidemic_img"; + +} diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/dto/result/VaccinationInfoResultDTO.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/dto/result/VaccinationInfoResultDTO.java index 58ed829..1dfa0f6 100644 --- a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/dto/result/VaccinationInfoResultDTO.java +++ b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/dto/result/VaccinationInfoResultDTO.java @@ -2,10 +2,12 @@ package com.elink.esua.epdc.vaccine.epidemic.dto.result; // import io.swagger.annotations.ApiModel; // import io.swagger.annotations.ApiModelProperty; +import com.elink.esua.epdc.vaccine.vim.dto.EpidemicImagesDTO; import lombok.Data; import java.io.Serializable; import java.util.Date; +import java.util.List; /** @@ -109,5 +111,8 @@ public class VaccinationInfoResultDTO implements Serializable { // @ApiModelProperty(value = "创建人姓名") private String creatorName; - -} \ No newline at end of file + /** + * 图片列表 + **/ + private List images; +} diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicUserInfoServiceImpl.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicUserInfoServiceImpl.java index a6da915..f900aa1 100644 --- a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicUserInfoServiceImpl.java +++ b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicUserInfoServiceImpl.java @@ -23,6 +23,7 @@ import com.elink.esua.epdc.dto.SysSimpleDictDTO; import com.elink.esua.epdc.dto.house.SysPopulationSimpleDictDTO; import com.elink.esua.epdc.dto.house.form.SysPopulationSimpleDictFormDTO; import com.elink.esua.epdc.dto.house.result.EpdcPopulationErrorResultDTO; +import com.elink.esua.epdc.vaccine.constant.ImageConstant; import com.elink.esua.epdc.vaccine.epidemic.dao.EpidemicUserInfoDao; import com.elink.esua.epdc.vaccine.epidemic.dao.EpidemicUserInoutRecordDao; import com.elink.esua.epdc.vaccine.epidemic.dao.SelectAreaDao; @@ -42,10 +43,12 @@ import com.elink.esua.epdc.vaccine.feign.VimAdminFeignClient; import com.elink.esua.epdc.vaccine.house.entity.PopulationInformationEntity; import com.elink.esua.epdc.vaccine.house.excel.BaseResidentInformationUpdateExcel; import com.elink.esua.epdc.vaccine.vim.dao.VaccinationInfoDao; +import com.elink.esua.epdc.vaccine.vim.dao.VimImgDao; import com.elink.esua.epdc.vaccine.vim.dto.VaccinationInfoDTO; import com.elink.esua.epdc.vaccine.vim.entity.VaccinationInfoEntity; import com.elink.esua.epdc.vaccine.vim.service.VaccinationInfoService; import com.elink.esua.epdc.vaccine.vim.service.VaccinationUserRoleService; +import com.elink.esua.epdc.vaccine.vim.service.VimImgService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Workbook; @@ -94,7 +97,8 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl getWrapper(Map params) { @@ -586,6 +590,8 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.vaccine.vim.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.vaccine.vim.dto.EpidemicImagesDTO; +import com.elink.esua.epdc.vaccine.vim.entity.VimImgEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * customer 库共用图片表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-09-14 + */ +@Mapper +public interface VimImgDao extends BaseDao { + + /** + * 删除 + * + * @param referenceId + * @return void + * @Author zhangyong + * @Date 17:51 2021-09-14 + **/ + void deleteByReferenceId(@Param("referenceId") String referenceId); + + /** + * 根据 referenceId,查询图片路径 + * @param referenceId + * @return java.util.List + * @Author zhangyong + * @Date 14:07 2021-12-06 + **/ + List selectListImgUrlsByIds(@Param("referenceId") String referenceId, @Param("imgType") String imgType); +} diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/dto/EpidemicImagesDTO.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/dto/EpidemicImagesDTO.java new file mode 100644 index 0000000..6000da1 --- /dev/null +++ b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/dto/EpidemicImagesDTO.java @@ -0,0 +1,16 @@ +package com.elink.esua.epdc.vaccine.vim.dto; + +import lombok.Data; + +/** + * 图片详情 + * @auther: zhangyong + * @date: 2021-12-06 14:25 + */ +@Data +public class EpidemicImagesDTO { + + private String name; + + private String url; +} diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/dto/VaccinationInfoDTO.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/dto/VaccinationInfoDTO.java index cefd991..4905c49 100644 --- a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/dto/VaccinationInfoDTO.java +++ b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/dto/VaccinationInfoDTO.java @@ -8,6 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; +import java.util.List; /** @@ -109,4 +110,9 @@ public class VaccinationInfoDTO implements Serializable { private String creatorName; private String allDeptNames; -} \ No newline at end of file + + /** + * 图片列表 + **/ + private List images; +} diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/entity/VimImgEntity.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/entity/VimImgEntity.java new file mode 100644 index 0000000..7135983 --- /dev/null +++ b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/entity/VimImgEntity.java @@ -0,0 +1,53 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.vaccine.vim.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * customer 库共用图片表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-09-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_custom_img") +public class VimImgEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 引用ID + */ + private String referenceId; + + /** + * 图片地址 + */ + private String imgUrl; + + /** + * 图片类型 + */ + private String imgType; + +} diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/service/VimImgService.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/service/VimImgService.java new file mode 100644 index 0000000..2b0f199 --- /dev/null +++ b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/service/VimImgService.java @@ -0,0 +1,118 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.vaccine.vim.service; + + + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.suggestion.CustomImgDTO; +import com.elink.esua.epdc.vaccine.vim.dto.EpidemicImagesDTO; +import com.elink.esua.epdc.vaccine.vim.entity.VimImgEntity; + +import java.util.List; +import java.util.Map; + +/** + * customer 库共用图片表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-09-14 + */ +public interface VimImgService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-09-14 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-09-14 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CustomImgDTO + * @author generator + * @date 2021-09-14 + */ + CustomImgDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-09-14 + */ + void save(CustomImgDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-09-14 + */ + void update(CustomImgDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-09-14 + */ + void delete(String[] ids); + + /** + * 删除 + * + * @param referenceId + * @return void + * @Author zhangyong + * @Date 17:51 2021-09-14 + **/ + void deleteByReferenceId(String referenceId); + + /** + * 保存图片 + * + * @Params: [images, eventId, imgType] + * @Return: boolean + * @Author: zy + * @Date: 2019/9/8 17:12 + */ + boolean saveImages(List images, String referenceId, String imgType); +} diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/service/impl/VaccinationInfoServiceImpl.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/service/impl/VaccinationInfoServiceImpl.java index 5543954..71ef91d 100644 --- a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/service/impl/VaccinationInfoServiceImpl.java +++ b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/service/impl/VaccinationInfoServiceImpl.java @@ -14,6 +14,7 @@ import com.elink.esua.epdc.commons.tools.security.user.UserDetail; import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.vaccine.common.base.BaseVimCurdServiceImpl; +import com.elink.esua.epdc.vaccine.constant.ImageConstant; import com.elink.esua.epdc.vaccine.epidemic.constant.StrConstant; import com.elink.esua.epdc.vaccine.epidemic.dao.EpidemicUserInfoDao; import com.elink.esua.epdc.vaccine.epidemic.dao.EpidemicUserInoutRecordDao; @@ -82,7 +83,8 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl getWrapper(Map params) { @@ -161,7 +163,9 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.vaccine.vim.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.dto.suggestion.CustomImgDTO; +import com.elink.esua.epdc.vaccine.vim.dao.VimImgDao; +import com.elink.esua.epdc.vaccine.vim.dto.EpidemicImagesDTO; +import com.elink.esua.epdc.vaccine.vim.entity.VimImgEntity; +import com.elink.esua.epdc.vaccine.vim.service.VimImgService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * customer 库共用图片表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-09-14 + */ +@Service +public class VimImgServiceImpl extends BaseServiceImpl implements VimImgService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CustomImgDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CustomImgDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public CustomImgDTO get(String id) { + VimImgEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CustomImgDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CustomImgDTO dto) { + VimImgEntity entity = ConvertUtils.sourceToTarget(dto, VimImgEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CustomImgDTO dto) { + VimImgEntity entity = ConvertUtils.sourceToTarget(dto, VimImgEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public void deleteByReferenceId(String referenceId) { + baseDao.deleteByReferenceId(referenceId); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean saveImages(List images, String referenceId, String imgType) { + if (null == images || images.isEmpty()) { + return true; + } + List imgEntities = new ArrayList<>(images.size()); + VimImgEntity entity = null; + for (int i = 0; i < images.size(); i++) { + entity = new VimImgEntity(); + entity.setReferenceId(referenceId); + entity.setImgUrl(images.get(i).getUrl()); + entity.setImgType(imgType); + imgEntities.add(entity); + } + return insertBatch(imgEntities); + } +} diff --git a/epdc-cloud-vim-yushan/src/main/resources/mapper/vim/VimImgDao.xml b/epdc-cloud-vim-yushan/src/main/resources/mapper/vim/VimImgDao.xml new file mode 100644 index 0000000..175874c --- /dev/null +++ b/epdc-cloud-vim-yushan/src/main/resources/mapper/vim/VimImgDao.xml @@ -0,0 +1,18 @@ + + + + + + + update epdc_custom_img set DEL_FLAG = '1' where REFERENCE_ID = #{referenceId} + + + +