From 426c1543aad19b757796efc5270d418a4b48354d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=90=A6=E6=B6=9B?= <18222067976@163.com> Date: Fri, 17 Sep 2021 13:34:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=BB=84=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PayWorkingGroupController.java | 36 +---------- .../service/IPayWorkingGroupService.java | 10 +++ .../impl/PayWorkingGroupServiceImpl.java | 63 ++++++++++++++++++- .../handle/impl/EmailSendMsgHandle.java | 26 +++++++- 4 files changed, 99 insertions(+), 36 deletions(-) diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupController.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupController.java index fcbffa04..621d192e 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupController.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupController.java @@ -55,8 +55,6 @@ public class PayWorkingGroupController extends JeroController { */ void copy(PayWorkingGroup payWorkingGroup); + /** + * @Description 获取负责人A名称,负责人B名称 + * @Author lqt + * @Date 2021/8/31 + * @Param payWorkingGroup + * @Return + * @Exception + */ + void setPayWorkingGroup(PayWorkingGroup payWorkingGroup); + } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupServiceImpl.java index c2c3fab2..1a49c12a 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupServiceImpl.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupServiceImpl.java @@ -7,15 +7,19 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.jero.common.exception.JeroBootException; import com.jero.contract.entity.PayIncomeContractAssociated; import com.jero.contract.service.IPayIncomeContractAssociatedService; +import com.jero.modules.system.entity.SysUser; +import com.jero.modules.system.service.ISysUserService; import com.jero.project.entity.PayWorkingGroupSearch; import com.jero.project.entity.PayWorkingGroupStatistics; import com.jero.project.entity.PayWorkingGroupSubItem; +import com.jero.project.service.IPayWorkingGroupDataFileService; import com.jero.project.service.IPayWorkingGroupSubItemService; import com.jero.project.vo.PayWorkingGroupVO; import com.jero.project.service.IPayWorkingGroupService; import com.jero.project.entity.PayWorkingGroup; import com.jero.project.mapper.PayWorkingGroupMapper; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -24,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; @@ -43,6 +48,9 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl queryPageList(Page page, PayWorkingGroup payWorkingGroup) { return payWorkingGroupMapper.queryPageList(page,payWorkingGroup); @@ -100,8 +108,61 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl query = new LambdaQueryWrapper<>(); + query.eq(PayWorkingGroupSubItem::getWorkingGroupId,payWorkingGroup.getId()); + List listPayWorkingGroupSubItem = payWorkingGroupSubItemService.list(query); + if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItem)){ + listPayWorkingGroupSubItem.forEach(p->{ + p.setId(null); + p.setCreateBy(null); + p.setCreateTime(null); + p.setUpdateBy(null); + p.setUpdateTime(null); + p.setWorkingGroupId(payWorkingGroupOld.getId()); + }); + payWorkingGroupSubItemService.saveBatch(listPayWorkingGroupSubItem); + } + } + /** + * @Description 获取负责人A名称,负责人B名称 + * @Author lqt + * @Date 2021/8/31 + * @Param payWorkingGroup + * @Return + * @Exception + */ + @Override + public void setPayWorkingGroup(PayWorkingGroup payWorkingGroup){ + // 负责人A名称 + SysUser principalIdA = sysUserService.getById(payWorkingGroup.getPrincipalIdA()); + if (Objects.isNull(principalIdA)) { + throw new JeroBootException("负责人A不存在!"); + } + payWorkingGroup.setPrincipalNameA(principalIdA.getRealname()); + // 负责人B名称 + if(!StringUtils.isBlank(payWorkingGroup.getPrincipalIdB())){ + SysUser principalIdB = sysUserService.getById(payWorkingGroup.getPrincipalIdB()); + if(Objects.isNull(principalIdB)){ + throw new JeroBootException("负责人B不存在!"); + } + payWorkingGroup.setPrincipalNameB(principalIdB.getRealname()); + } } /** diff --git a/jero-boot-module-system/src/main/java/com/jero/modules/message/handle/impl/EmailSendMsgHandle.java b/jero-boot-module-system/src/main/java/com/jero/modules/message/handle/impl/EmailSendMsgHandle.java index f7d9bc34..02ea586c 100644 --- a/jero-boot-module-system/src/main/java/com/jero/modules/message/handle/impl/EmailSendMsgHandle.java +++ b/jero-boot-module-system/src/main/java/com/jero/modules/message/handle/impl/EmailSendMsgHandle.java @@ -101,8 +101,19 @@ public class EmailSendMsgHandle implements ISendMsgHandle { helper.setText(es_content, true); for(String file :fileList) { if(!StringUtils.isBlank(file)) { - FileSystemResource filePath = new FileSystemResource(new File(file)); - helper.addAttachment(file, filePath); + File newFile = new File(file); + FileSystemResource filePath = new FileSystemResource(newFile); + String fileName = newFile.getName(); + if(fileName.lastIndexOf(".") == -1 || fileName.lastIndexOf(".") == 0){ + return; + } + if(fileName.contains("_")){ + int a = fileName.lastIndexOf("_"); + fileName = fileName.substring(0,a) + fileName.substring(fileName.lastIndexOf(".")); + }else{ + fileName = fileName.substring(fileName.lastIndexOf(".")); + } + helper.addAttachment(fileName, filePath); } } mailSender.send(message); @@ -112,4 +123,15 @@ public class EmailSendMsgHandle implements ISendMsgHandle { e.printStackTrace(); } } + + public static void main(String[] args) { + String str ="/a/b/c_daswqe.xml"; + List l = Arrays.asList(str.split("/")); + String f = l.get(l.size()-1); + System.out.println(f); + int a = f.lastIndexOf("_"); + String f1 = f.substring(0,a); + + System.out.println(f1); + } }