Commit e0a1536ed15c7de99dcc7c47041b66fbdc8f5a79

Authored by chenhang4442024
1 parent 9a1e5de5

1.生产指示书添加图片

2.中期/尾期验货报告,尾期验货日期发送给所有质检员
3.产品意见发送全部信息
src/main/java/com/order/erp/common/utils/EasyPdfUtils.java
... ... @@ -17,6 +17,7 @@ import org.springframework.beans.BeanUtils;
17 17 import org.springframework.beans.factory.annotation.Value;
18 18 import org.springframework.stereotype.Service;
19 19 import wiki.xsx.core.pdf.component.image.XEasyPdfImage;
  20 +import wiki.xsx.core.pdf.component.image.XEasyPdfImageType;
20 21 import wiki.xsx.core.pdf.component.table.XEasyPdfCell;
21 22 import wiki.xsx.core.pdf.component.table.XEasyPdfRow;
22 23 import wiki.xsx.core.pdf.component.table.XEasyPdfTable;
... ... @@ -24,13 +25,16 @@ import wiki.xsx.core.pdf.doc.*;
24 25 import wiki.xsx.core.pdf.handler.XEasyPdfHandler;
25 26  
26 27 import javax.annotation.Resource;
  28 +import java.awt.*;
27 29 import java.io.File;
  30 +import java.io.IOException;
28 31 import java.io.InputStream;
29 32 import java.io.OutputStream;
30 33 import java.math.BigDecimal;
31 34 import java.math.RoundingMode;
32 35 import java.net.URL;
33 36 import java.util.*;
  37 +import java.util.List;
34 38 import java.util.function.Function;
35 39 import java.util.stream.Collectors;
36 40 //待拷贝start。
... ... @@ -171,61 +175,67 @@ public class EasyPdfUtils {
171 175 }*/
172 176  
173 177 //第二版 线上版。
174   - try {
175   - // 每页最大行数
176   - int rowsPerPage = 10;
177   - int totalRows = pdfVOList.size();
178   - int totalPages = (int) Math.ceil((double) totalRows / rowsPerPage);
179   -
180   - // 固定页面大小 (1700F 宽, 1000F 高)
181   - XEasyPdfPageRectangle pageSize = XEasyPdfPageRectangle.create(1700F, 1000F);
182   -
183   - // 计算总计
184   - Integer totalOrderCount = 0;
185   - BigDecimal totalPrice = new BigDecimal(Constant.ZERO);
186   -
187   - for (OrderProducePdfVO producePdfVO : pdfVOList) {
188   - totalOrderCount += Objects.nonNull(producePdfVO.getOrderCount()) ? producePdfVO.getOrderCount() : Constant.ZERO;
189   - totalPrice = totalPrice.add(new BigDecimal(Objects.nonNull(producePdfVO.getProductionDepartmentTotalPrice()) ? producePdfVO.getProductionDepartmentTotalPrice() : Constant.ZERO).setScale(2, RoundingMode.HALF_UP));
  178 + try{
  179 +//设置页面大小(1700F宽,1000F高)
  180 + XEasyPdfPageRectangle pageSize=XEasyPdfPageRectangle.create(1700F,1000F);
  181 +
  182 +//计算订单的总数和总价
  183 + Integer totalOrderCount=0;
  184 + BigDecimal totalPrice=new BigDecimal(Constant.ZERO);
  185 +
  186 +//计算所有订单的总量和总价
  187 + for(OrderProducePdfVO producePdfVO:pdfVOList){
  188 + totalOrderCount+=Objects.nonNull(producePdfVO.getOrderCount())?producePdfVO.getOrderCount():Constant.ZERO;
  189 + totalPrice=totalPrice.add(new BigDecimal(Objects.nonNull(producePdfVO.getProductionDepartmentTotalPrice())?producePdfVO.getProductionDepartmentTotalPrice():Constant.ZERO).setScale(2,RoundingMode.HALF_UP));
190 190 }
191 191  
192   - int currentIndex = 1; // 初始化当前编号
193   -
194   - for (int page = 0; page < totalPages; page++) {
195   - // 计算当前页的数据
196   - int startRow = page * rowsPerPage;
197   - int endRow = Math.min(startRow + rowsPerPage, totalRows);
198   - List<OrderProducePdfVO> pageData = pdfVOList.subList(startRow, endRow);
199   - boolean isLastPage = (page == totalPages - 1);
200   - // 创建表格并填充数据
201   - XEasyPdfTable table = createTable(pageData, companyName, currentIndex, isLastPage, totalOrderCount, totalPrice);
202   - currentIndex += pageData.size(); // 更新编号
203   -
204   - // 创建页面
205   - XEasyPdfPage pdfPage = XEasyPdfHandler.Page.build(pageSize, table);
206   - document.addPage(pdfPage);
  192 + int currentIndex=1;//初始化当前记录的编号
  193 + int totalRows=pdfVOList.size();//获取总行数
  194 + int currentPageRows=0;//当前页面行数计数器
  195 + List<OrderProducePdfVO>currentPageData=new ArrayList<>();//当前页的数据
  196 + boolean isLastPage=false;//标记是否为最后一页
  197 +
  198 + for(int i=0;i<totalRows;i++){
  199 + OrderProducePdfVO producePdfVO=pdfVOList.get(i);
  200 + currentPageData.add(producePdfVO);//将当前订单数据加入当前页面的数据列表
  201 + currentPageRows++;//当前页面行数+1
  202 +
  203 +//动态计算当前页面是否满了(基于内容长度和当前页面行数)
  204 + if(isPageFull(producePdfVO,currentPageRows)||i==totalRows-1){
  205 + isLastPage=(i==totalRows-1);//如果是最后一条记录,则标记为最后一页
  206 +
  207 +//创建表格并填充数据
  208 + XEasyPdfTable table=createTable(currentPageData,companyName,currentIndex,isLastPage,totalOrderCount,totalPrice);
  209 + currentIndex+=currentPageData.size();//更新编号
  210 +
  211 +//创建并添加页面
  212 + XEasyPdfPage pdfPage=XEasyPdfHandler.Page.build(pageSize,table);
  213 + document.addPage(pdfPage);
  214 +
  215 +//清空当前页数据,准备下一页
  216 + currentPageData.clear();
  217 + currentPageRows=0;
  218 + }
207 219 }
208 220  
209   - // 添加页脚
  221 +//添加页脚以显示页码
210 222 document.setGlobalFooter(XEasyPdfHandler.Footer.build(
211 223 XEasyPdfHandler.Text.build(
212   - XEasyPdfHandler.Page.getCurrentPagePlaceholder() +
213   - "/" +
214   - XEasyPdfHandler.Page.getTotalPagePlaceholder())
  224 + XEasyPdfHandler.Page.getCurrentPagePlaceholder()+"/"+XEasyPdfHandler.Page.getTotalPagePlaceholder())
215 225 .setFontSize(10F)
216 226 .setHorizontalStyle(XEasyPdfPositionStyle.CENTER)
217 227 .setDefaultFontStyle(XEasyPdfDefaultFontStyle.LIGHT)
218 228 ));
219 229  
220   - // 开启总页码占位符替换
  230 +//开启总页码占位符替换
221 231 document.enableReplaceTotalPagePlaceholder();
222 232  
  233 +//返回生成的PDF文档
223 234 return document;
224   - } catch (Exception e) {
  235 + }catch(Exception e){
225 236 e.printStackTrace();
226 237 return null;
227 238 }
228   -
229 239 }
230 240  
231 241 /**
... ... @@ -247,6 +257,20 @@ public class EasyPdfUtils {
247 257 return cell;
248 258 }
249 259  
  260 + private XEasyPdfCell createImageCell(InputStream imageStream, float width,float height) {
  261 + XEasyPdfImage image = XEasyPdfHandler.Image.build(imageStream, XEasyPdfImageType.PNG).
  262 + setHeight(250F).setWidth(250F).
  263 + setMarginTop(0F).setMarginLeft(0F).
  264 + setVerticalStyle(XEasyPdfPositionStyle.CENTER).setHorizontalStyle(XEasyPdfPositionStyle.CENTER);
  265 +
  266 + XEasyPdfCell cell = XEasyPdfHandler.Table.Row.Cell.build(width, height).
  267 + addContent(image).
  268 + setVerticalStyle(XEasyPdfPositionStyle.CENTER).
  269 + setHorizontalStyle(XEasyPdfPositionStyle.CENTER).
  270 + enableCenterStyle().enableComponentSelfStyle();
  271 + return cell;
  272 + }
  273 +
250 274 /**
251 275 * @param text
252 276 * @param width
... ... @@ -399,12 +423,32 @@ public class EasyPdfUtils {
399 423 }
400 424  
401 425 List<XEasyPdfCell> signList = new ArrayList<>(2);
  426 + ClassLoader classLoader = getClass().getClassLoader();
  427 + InputStream imageStream = null;
402 428 if ("青岛吉庆天成饰品有限公司".equals(companyName)) {
403 429 signList.add(createCell("吉庆天成签字+日期:", 640F, 80F, 20F, XEasyPdfDefaultFontStyle.BOLD, XEasyPdfPositionStyle.CENTER, XEasyPdfPositionStyle.LEFT));
  430 + imageStream = classLoader.getResourceAsStream("images/jqtc.png");
404 431 } else {
405 432 signList.add(createCell("翱特逸格签字+日期:", 640F, 80F, 20F, XEasyPdfDefaultFontStyle.BOLD, XEasyPdfPositionStyle.CENTER, XEasyPdfPositionStyle.LEFT));
  433 + imageStream = classLoader.getResourceAsStream("images/alterego.png");
  434 + }
  435 + if (imageStream != null) {
  436 + XEasyPdfCell imageCell = createImageCell(imageStream, 150F,150F);
  437 + // 设置图片超出边框的效果
  438 + imageCell.setMarginLeft(-380F)
  439 + .setMarginTop(0F)
  440 + .disableBorder();
  441 + signList.add(imageCell);
  442 + try {
  443 + imageStream.close();
  444 + } catch (IOException e) {
  445 + System.out.println("关闭图片流时发生错误:" + e.getMessage());
  446 + }
  447 + }else {
  448 + log.info("图片资源未找到或不存在");
406 449 }
407   - signList.add(createCell("外加工签字+日期:", 1020F, 80F, 20F, XEasyPdfDefaultFontStyle.BOLD, XEasyPdfPositionStyle.CENTER, XEasyPdfPositionStyle.LEFT));
  450 +
  451 + signList.add(createCell("外加工签字+日期:", 1020F, 80F, 20F, XEasyPdfDefaultFontStyle.BOLD, XEasyPdfPositionStyle.CENTER, XEasyPdfPositionStyle.LEFT).setMarginLeft(230F));
408 452 rowList.add(XEasyPdfHandler.Table.Row.build(signList));
409 453  
410 454 table.addRow(rowList);
... ... @@ -412,6 +456,15 @@ public class EasyPdfUtils {
412 456 return table;
413 457 }
414 458  
  459 +//新代码9:22
  460 +//根据当前行数和"产品意见"的长度动态判断页面是否已经满了
  461 +
  462 + private boolean isPageFull(OrderProducePdfVO producePdfVO,int currentPageRows){
  463 + int maxRowsPerPage=9;//假设初始每页最多可以放10行数据
  464 + int extraRowsForComment=(int)Math.ceil((double)producePdfVO.getProductionComment().length()/25);//假设每50个字符占一行
  465 +//如果当前行数+根据"产品意见"计算出的额外行数超过每页最大行数,返回true表示页面已满
  466 + return(currentPageRows+extraRowsForComment)>=maxRowsPerPage;
  467 + }
415 468  
416 469 }
417 470 //待拷贝end。
418 471 \ No newline at end of file
... ...
src/main/java/com/order/erp/job/OrderOverTimeEventJob.java
... ... @@ -8,13 +8,18 @@ import com.order.erp.common.constant.Constant;
8 8 import com.order.erp.common.utils.*;
9 9 import com.order.erp.domain.EmailTemplateEnum;
10 10 import com.order.erp.domain.OrderEventEnum;
  11 +import com.order.erp.domain.RoleEnum;
11 12 import com.order.erp.domain.dto.BaseDO;
  13 +import com.order.erp.domain.dto.admin.AdminRoleDO;
12 14 import com.order.erp.domain.dto.admin.AdminUserDO;
  15 +import com.order.erp.domain.dto.admin.AdminUserRoleDO;
13 16 import com.order.erp.domain.dto.order.OrderBaseInfoDO;
14 17 import com.order.erp.domain.dto.order.OrderInspectionStageDO;
15 18 import com.order.erp.domain.dto.order.OrderTrackStageDO;
16 19 import com.order.erp.domain.dto.order.ReceiveEmailMappingDO;
17 20 import com.order.erp.domain.vo.order.*;
  21 +import com.order.erp.service.admin.AdminRoleService;
  22 +import com.order.erp.service.admin.AdminUserRoleService;
18 23 import com.order.erp.service.admin.AdminUserService;
19 24 import com.order.erp.service.order.*;
20 25 import lombok.extern.slf4j.Slf4j;
... ... @@ -64,6 +69,8 @@ public class OrderOverTimeEventJob {
64 69  
65 70 @Resource
66 71 private AdminUserService adminUserService;
  72 + @Resource
  73 + private AdminUserRoleService adminUserRoleService;
67 74  
68 75 /**
69 76 * 凌晨1点执行,一天一次
... ... @@ -123,7 +130,7 @@ public class OrderOverTimeEventJob {
123 130 return null;
124 131 }).filter(Objects::nonNull)
125 132 .collect(Collectors.toList());
126   - //如果为尾期验货事件的话,需要从订单中的生产科角色中得到邮箱。而不是从邮件配置中得到邮箱。
  133 + //如果为尾期验货事件的话,需要从订单中的生产科角色中得到邮箱。而不是从邮件配置中得到邮箱。并且还需要发送给所有的质检员。
127 134 if (OrderEventEnum.END_CHECK_DATE_EVENT.equals(eventEnum)) {
128 135 for (OrderEventJobVO orderEventJob : eventJobVOS) {
129 136 if (!redisUtils.hasKey(EmailTemplateEnum.byTemplate(
... ... @@ -137,6 +144,19 @@ public class OrderOverTimeEventJob {
137 144 AdminUserDO productionDepartmentUser = adminUserService.getOne(new LambdaQueryWrapper<AdminUserDO>()
138 145 .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
139 146 .eq(AdminUserDO::getUserName, productionDepartment));
  147 + //得到所有的质检员。由于删除了角色,但是用户角色表中的信息没有删除,所以不能直接通过用户角色表拿角色,然后发邮件,需校验。
  148 + List<AdminUserRoleDO> UserRoleList = adminUserRoleService.list(new LambdaQueryWrapper<AdminUserRoleDO>()
  149 + .eq(AdminUserRoleDO::getRoleId, RoleEnum.INSPECT_USER.getId()));
  150 + Set<Long> userIdList = UserRoleList.stream().map(AdminUserRoleDO::getUserId).collect(Collectors.toSet());
  151 + List<AdminUserDO> produceList = adminUserService.list(new LambdaQueryWrapper<AdminUserDO>()
  152 + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
  153 + .in(AdminUserDO::getId, userIdList)
  154 + .eq(AdminUserDO::getStatus,Constant.ENABLE_TEN));
  155 + List<String> produceEmailList = produceList.stream().map(AdminUserDO::getEmail).filter(Objects::nonNull)
  156 + .flatMap(email -> Arrays.asList(email.split("[,,]+")).stream())
  157 + .map(String::trim)
  158 + .filter(s -> !s.isEmpty())
  159 + .collect(Collectors.toList());
140 160 log.info("------------------------------------------------------------------------------------");
141 161 //得到订单的尾期验货日期的邮件配置中的邮箱。
142 162 LambdaQueryWrapper<ReceiveEmailMappingDO> receiveEmailMappingDOLambdaQueryWrapper = new LambdaQueryWrapper<>();
... ... @@ -167,6 +187,9 @@ public class OrderOverTimeEventJob {
167 187 .filter(Objects::nonNull)
168 188 .collect(Collectors.toList());
169 189 List<String> combineEmail = new ArrayList<>(emails);
  190 + if(CollectionUtils.isNotEmpty(produceEmailList)){
  191 + combineEmail.addAll(produceEmailList);
  192 + }
170 193 combineEmail.addAll(productionEmail);
171 194 emailSendUtils.sendEmail(EmailTemplateEnum.byTemplate(eventEnum.getTemplateId()),
172 195 combineEmail, orderEventJob);
... ...
src/main/java/com/order/erp/service/admin/impl/AdminUserServiceImpl.java
... ... @@ -203,6 +203,7 @@ public class AdminUserServiceImpl extends ServiceImpl&lt;AdminUserMapper, AdminUser
203 203 throw new BusinessException("用户名已存在");
204 204 }
205 205 if (StringUtils.isNotBlank(adminUserVO.getNickName())) {
  206 + //后续如果根据名称找用户,使用userName比较,不要使用NickName比较。
206 207 adminUserDo.setUserName(adminUserVO.getNickName());
207 208 }
208 209 adminUserDo.setGender("男");
... ...
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
... ... @@ -27,12 +27,14 @@ import com.order.erp.domain.*;
27 27 import com.order.erp.domain.dto.BaseDO;
28 28 import com.order.erp.domain.dto.SystemSettingDO;
29 29 import com.order.erp.domain.dto.admin.AdminUserDO;
  30 +import com.order.erp.domain.dto.admin.AdminUserRoleDO;
30 31 import com.order.erp.domain.dto.order.*;
31 32 import com.order.erp.domain.vo.ProducePdfVO;
32 33 import com.order.erp.domain.vo.order.*;
33 34 import com.order.erp.job.OrderOverTimeEventJob;
34 35 import com.order.erp.mapper.order.OrderBaseInfoMapper;
35 36 import com.order.erp.service.SystemSettingService;
  37 +import com.order.erp.service.admin.AdminUserRoleService;
36 38 import com.order.erp.service.admin.AdminUserService;
37 39 import com.order.erp.service.order.*;
38 40 import freemarker.template.TemplateException;
... ... @@ -135,6 +137,8 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl&lt;OrderBaseInfoMapper, O
135 137  
136 138 @Resource
137 139 private ReceiveEmailMappingService receiveEmailMappingService;
  140 + @Resource
  141 + private AdminUserRoleService adminUserRoleService;
138 142  
139 143  
140 144 /**
... ... @@ -904,7 +908,7 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl&lt;OrderBaseInfoMapper, O
904 908 if (CollectionUtils.isEmpty(trackStageDOS)) {
905 909 return;
906 910 }
907   - Map<Long, OrderTrackStageDO> trackStageDOMap = trackStageDOS.stream().collect(Collectors.toMap(OrderTrackStageDO::getOrderId, Function.identity()));
  911 + Map<Long, OrderTrackStageDO> trackStageDOMap = trackStageDOS.stream().collect(Collectors.toMap(OrderTrackStageDO::getOrderId, Function.identity(),(existing, replacement) -> existing));
908 912 orderInfoResultVOList.forEach(result -> {
909 913 if (trackStageDOMap.containsKey(result.getId())) {
910 914 OrderTrackStageDO trackStageDO = trackStageDOMap.get(result.getId());
... ... @@ -2203,6 +2207,14 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl&lt;OrderBaseInfoMapper, O
2203 2207 if (CollectionUtils.isEmpty(orderProfitAnalysisList) || producePdfVO.getIds().size() != orderProfitAnalysisList.size()) {
2204 2208 return ServerResult.fail("利润分析未填写,无法进行生成!");
2205 2209 }
  2210 + List<OrderFieldLockApplyDO> orderFieldLockApplyDOS = orderFieldLockApplyService.list(new LambdaQueryWrapper<OrderFieldLockApplyDO>()
  2211 + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
  2212 + .in(OrderFieldLockApplyDO::getOrderId, producePdfVO.getIds())
  2213 + .eq(OrderFieldLockApplyDO::getType, ApplyTypeEnum.ORDER_PROFIT_APPLY.getType())
  2214 + .eq(OrderFieldLockApplyDO::getStatus,ApplyStatusEnum.WAIT_AUDIT.getStatus()));
  2215 + if(CollectionUtils.isNotEmpty(orderFieldLockApplyDOS)){
  2216 + return ServerResult.fail("订单中包含利润未审批的订单,无法生成!");
  2217 + }
2206 2218 ProducePdfVO producePdf = pdfUtils.createProducePdf(pdfUtils.build(producePdfVO.getIds()), "生产指示书.pdf", producePdfVO.getCompanyName());
2207 2219 return ServerResult.success(producePdf);
2208 2220 }
... ... @@ -2319,7 +2331,7 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl&lt;OrderBaseInfoMapper, O
2319 2331 if(CollectionUtils.isNotEmpty(producePdfVO.getPersonList())){
2320 2332 List<AdminUserDO> personUser = adminUserService.list(new LambdaQueryWrapper<AdminUserDO>()
2321 2333 .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
2322   - .in(AdminUserDO::getNickName, producePdfVO.getPersonList()));
  2334 + .in(AdminUserDO::getUserName, producePdfVO.getPersonList()));
2323 2335 if(CollectionUtils.isNotEmpty(personUser)){
2324 2336 List<String> personList = personUser.stream().map(AdminUserDO::getEmail).filter(Objects::nonNull)
2325 2337 .flatMap(email -> Arrays.asList(email.split("[,,]+")).stream())
... ... @@ -2386,6 +2398,19 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl&lt;OrderBaseInfoMapper, O
2386 2398 .last("limit 1");
2387 2399 }
2388 2400 ReceiveEmailMappingDO receiveEmailMappingDO = receiveEmailMappingService.getOne( receiveEmailMappingDOLambdaQueryWrapper);
  2401 + //得到所有的质检员。由于删除了角色,但是用户角色表中的信息没有删除,所以不能直接通过用户角色表拿角色,然后发邮件,需校验。
  2402 + List<AdminUserRoleDO> UserRoleList = adminUserRoleService.list(new LambdaQueryWrapper<AdminUserRoleDO>()
  2403 + .eq(AdminUserRoleDO::getRoleId, RoleEnum.INSPECT_USER.getId()));
  2404 + Set<Long> userIdList = UserRoleList.stream().map(AdminUserRoleDO::getUserId).collect(Collectors.toSet());
  2405 + List<AdminUserDO> produceList = adminUserService.list(new LambdaQueryWrapper<AdminUserDO>()
  2406 + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
  2407 + .in(AdminUserDO::getId, userIdList)
  2408 + .eq(AdminUserDO::getStatus,Constant.ENABLE_TEN));
  2409 + List<String> produceEmailList = produceList.stream().map(AdminUserDO::getEmail).filter(Objects::nonNull)
  2410 + .flatMap(email -> Arrays.asList(email.split("[,,]+")).stream())
  2411 + .map(String::trim)
  2412 + .filter(s -> !s.isEmpty())
  2413 + .collect(Collectors.toList());
2389 2414  
2390 2415 List<String> emailList = new ArrayList<>();
2391 2416 if (Objects.nonNull(receiveEmailMappingDO)) {
... ... @@ -2401,6 +2426,9 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl&lt;OrderBaseInfoMapper, O
2401 2426 if (CollectionUtils.isNotEmpty(emails) && CollectionUtils.isNotEmpty(emailList)) {
2402 2427 List<String> emailLists = emailList.stream().flatMap(email -> Arrays.stream(email.split("[,,]+"))).collect(Collectors.toList());
2403 2428 List<String> combineEmail = new ArrayList<>(emails);
  2429 + if(CollectionUtils.isNotEmpty(produceEmailList)){
  2430 + combineEmail.addAll(produceEmailList);
  2431 + }
2404 2432 combineEmail.addAll(emailLists);
2405 2433  
2406 2434 //尾期验货报告。
... ... @@ -2424,6 +2452,19 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl&lt;OrderBaseInfoMapper, O
2424 2452 .last("limit 1");
2425 2453 }
2426 2454 ReceiveEmailMappingDO receiveEmailMappingDO = receiveEmailMappingService.getOne( receiveEmailMappingDOLambdaQueryWrapper);
  2455 + //得到所有的质检员。由于删除了角色,但是用户角色表中的信息没有删除,所以不能直接通过用户角色表拿角色,然后发邮件,需校验。
  2456 + List<AdminUserRoleDO> UserRoleList = adminUserRoleService.list(new LambdaQueryWrapper<AdminUserRoleDO>()
  2457 + .eq(AdminUserRoleDO::getRoleId, RoleEnum.INSPECT_USER.getId()));
  2458 + Set<Long> userIdList = UserRoleList.stream().map(AdminUserRoleDO::getUserId).collect(Collectors.toSet());
  2459 + List<AdminUserDO> produceList = adminUserService.list(new LambdaQueryWrapper<AdminUserDO>()
  2460 + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
  2461 + .in(AdminUserDO::getId, userIdList)
  2462 + .eq(AdminUserDO::getStatus,Constant.ENABLE_TEN));
  2463 + List<String> produceEmailList = produceList.stream().map(AdminUserDO::getEmail).filter(Objects::nonNull)
  2464 + .flatMap(email -> Arrays.asList(email.split("[,,]+")).stream())
  2465 + .map(String::trim)
  2466 + .filter(s -> !s.isEmpty())
  2467 + .collect(Collectors.toList());
2427 2468 List<String> emailList = new ArrayList<>();
2428 2469 if (Objects.nonNull(receiveEmailMappingDO)) {
2429 2470 List<ReceiveEmailConfigItemVO> receiveEmailConfigItemVOList = JSON.parseObject(
... ... @@ -2438,6 +2479,9 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl&lt;OrderBaseInfoMapper, O
2438 2479 if (CollectionUtils.isNotEmpty(emails) && CollectionUtils.isNotEmpty(emailList)) {
2439 2480 List<String> emailLists = emailList.stream().flatMap(email -> Arrays.stream(email.split("[,,]+"))).collect(Collectors.toList());
2440 2481 List<String> combineEmail = new ArrayList<>(emails);
  2482 + if(CollectionUtils.isNotEmpty(produceEmailList)){
  2483 + combineEmail.addAll(produceEmailList);
  2484 + }
2441 2485 combineEmail.addAll(emailLists);
2442 2486 //中期验货报告。
2443 2487 emailSendUtils.sendEmail(EmailTemplateEnum.MID_CHECK_REPORT_TEMPLATE, combineEmail, orderEventJobVO);
... ... @@ -2469,10 +2513,11 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl&lt;OrderBaseInfoMapper, O
2469 2513 orderEventJobVO.getBaseInfo().setPoColor(orderBaseInfoDo.getPoColor());
2470 2514 orderEventJobVO.getBaseInfo().setSmallPicUrl(orderBaseInfoDo.getSmallPicUrl());
2471 2515 orderEventJobVO.getBaseInfo().setOrderCount(orderBaseInfoDo.getOrderCount());
2472   - String[] split = productionComment.split("\n");
2473   - String[] split1 = split[split.length - 1].split("[::]+");
2474   - String lastProductionComment = split1[split1.length - 1];
2475   - orderEventJobVO.getBaseInfo().setProductionComment(lastProductionComment);
  2516 +// String[] split = productionComment.split("\n");
  2517 +// String[] split1 = split[split.length - 1].split("[::]+");
  2518 + //这里需要设置不单单只发送最后一条消息。应该是所有的消息。
  2519 +// String lastProductionComment = split1[split1.length - 1];
  2520 + orderEventJobVO.getBaseInfo().setProductionComment(productionComment);
2476 2521 orderEventJobVO.getBaseInfo().setProductionDepartmentConsignTime(orderBaseInfoDo.getProductionDepartmentConsignTime().substring(0, 10));
2477 2522 //目前是选择的是跟单员邮箱和业务员邮箱。
2478 2523 emailSendUtils.sendEmail(EmailTemplateEnum.PRODUCE_IDEA, emailList, orderEventJobVO);
... ...
src/main/resources/images/alterego.png 0 → 100644

441 KB

src/main/resources/images/jqtc.png 0 → 100644

410 KB

src/main/resources/templates/mail.ftl
... ... @@ -43,7 +43,7 @@
43 43 <td> 客户SYSTEM</td>
44 44 <td> PO COLOR</td>
45 45 <td> 订单图片</td>
46   - <td> 生产要求</td>
  46 + <td> 产品意见</td>
47 47 <td> 数量 </td>
48 48 <td> 生产科拖货时间</td>
49 49 <td> 包装类型</td>
... ... @@ -58,7 +58,7 @@
58 58 <td> 客户SYSTEM</td>
59 59 <td> PO COLOR</td>
60 60 <td> 订单图片</td>
61   - <td> 生产要求</td>
  61 + <td> 产品意见</td>
62 62 <td> 数量 </td>
63 63 <td> 生产科拖货时间</td>
64 64 <td> 包装类型</td>
... ... @@ -80,7 +80,7 @@
80 80 <td> 客户SYSTEM</td>
81 81 <td> PO COLOR</td>
82 82 <td> 订单图片</td>
83   - <td> 生产要求</td>
  83 + <td> 产品意见</td>
84 84 <td> 数量</td>
85 85 <td> 生产科拖货时间</td>
86 86 <#elseif title=="产品意见信息" >
... ... @@ -91,7 +91,7 @@
91 91 <td> 客户SYSTEM</td>
92 92 <td> PO COLOR</td>
93 93 <td> 订单图片</td>
94   - <td> 生产要求</td>
  94 + <td> 产品意见</td>
95 95 <td> 数量</td>
96 96 <td> 生产科拖货时间</td>
97 97 <#else>
... ... @@ -103,7 +103,7 @@
103 103 <td> 客户SYSTEM</td>
104 104 <td> PO COLOR</td>
105 105 <td> 订单图片</td>
106   - <td> 生产要求</td>
  106 + <td> 产品意见</td>
107 107 <td> 数量</td>
108 108 <td> 生产科拖货时间</td>
109 109 <td> 订单上的HOD时间</td>
... ...