德中需求验收发送多人邮件
This commit is contained in:
@ -22,4 +22,6 @@ public interface ZtProductMapper extends BaseMapper<ZtProduct> {
|
|||||||
|
|
||||||
List<ZtProductDTO> productPageList(@Param("qo") ZtProjectQo qo);
|
List<ZtProductDTO> productPageList(@Param("qo") ZtProjectQo qo);
|
||||||
|
|
||||||
|
List<ZtProduct> productListByProgramName(@Param("programName") String programName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,4 +54,7 @@ public interface IZtProductService extends IService<ZtProduct> {
|
|||||||
void productTeamUpdate(ZtProjectQo qo);
|
void productTeamUpdate(ZtProjectQo qo);
|
||||||
|
|
||||||
List<String> productTeamByPid(ZtProjectQo qo);
|
List<String> productTeamByPid(ZtProjectQo qo);
|
||||||
|
|
||||||
|
List<ZtProduct> productListByProgramName(String programName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -658,6 +658,11 @@ public class ZtProductServiceImpl extends ServiceImpl<ZtProductMapper, ZtProduct
|
|||||||
return productTeamList.stream().map(o -> o.getAccount()).collect(Collectors.toList());
|
return productTeamList.stream().map(o -> o.getAccount()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ZtProduct> productListByProgramName(String programName) {
|
||||||
|
return this.baseMapper.productListByProgramName(programName);
|
||||||
|
}
|
||||||
|
|
||||||
private Map<Integer, List<ZtProductDTO>> getChildrenMap(List<ZtProjectDTO> result) {
|
private Map<Integer, List<ZtProductDTO>> getChildrenMap(List<ZtProjectDTO> result) {
|
||||||
|
|
||||||
List<ZtProduct> ztProjects = this.baseMapper.selectList(
|
List<ZtProduct> ztProjects = this.baseMapper.selectList(
|
||||||
|
@ -2,6 +2,7 @@ package com.sa.zentao.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
@ -22,6 +23,7 @@ import com.sa.zentao.utils.SendEmail;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@ -69,6 +71,9 @@ public class ZtReleaseServiceImpl extends ServiceImpl<ZtReleaseMapper, ZtRelease
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IZtExecutionprojectService executionprojectService;
|
private IZtExecutionprojectService executionprojectService;
|
||||||
|
|
||||||
|
@Value("${xfx.release}")
|
||||||
|
private String [] xfxRelease;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void addRelease(ZtReleaseDTO dto) {
|
public void addRelease(ZtReleaseDTO dto) {
|
||||||
@ -436,11 +441,32 @@ public class ZtReleaseServiceImpl extends ServiceImpl<ZtReleaseMapper, ZtRelease
|
|||||||
b.append( "</tbody>");
|
b.append( "</tbody>");
|
||||||
b.append( "</table>");
|
b.append( "</table>");
|
||||||
if(!CollectionUtils.isEmpty(mailTo)){
|
if(!CollectionUtils.isEmpty(mailTo)){
|
||||||
|
|
||||||
SendEmail.sendMessage("需求发布提醒:",mailTo.stream().collect(Collectors.toList()),
|
SendEmail.sendMessage("需求发布提醒:",mailTo.stream().collect(Collectors.toList()),
|
||||||
null,
|
getFxcfCopyToMail(ztStories),
|
||||||
b.toString());
|
b.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 飞侠车服 抄送指定人
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<String> getFxcfCopyToMail(List<ZtStory> ztStories) {
|
||||||
|
List<ZtProduct> ztProducts = this.productService.productListByProgramName("飞侠车服");
|
||||||
|
//飞侠车服产品
|
||||||
|
if(!CollectionUtils.isEmpty(ztProducts)&&xfxRelease!=null&&xfxRelease.length>0){
|
||||||
|
List<Integer> xfProductIds = ztProducts.stream().map(o -> o.getId()).collect(Collectors.toList());
|
||||||
|
for (ZtStory story : ztStories) {
|
||||||
|
if(xfProductIds.contains(story.getProduct())){
|
||||||
|
return Arrays.asList(xfxRelease);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
//催促验收
|
//催促验收
|
||||||
private void urgeYsMail(List<ZtStory> ztStories,ZtRelease release) {
|
private void urgeYsMail(List<ZtStory> ztStories,ZtRelease release) {
|
||||||
Map<String, ZtUser> userMap = this.userService.userMapByIds(null);
|
Map<String, ZtUser> userMap = this.userService.userMapByIds(null);
|
||||||
@ -488,7 +514,7 @@ public class ZtReleaseServiceImpl extends ServiceImpl<ZtReleaseMapper, ZtRelease
|
|||||||
b.append( "</table>");
|
b.append( "</table>");
|
||||||
if(!CollectionUtils.isEmpty(mailTo)){
|
if(!CollectionUtils.isEmpty(mailTo)){
|
||||||
SendEmail.sendMessage("需求验收提醒:",mailTo.stream().collect(Collectors.toList()),
|
SendEmail.sendMessage("需求验收提醒:",mailTo.stream().collect(Collectors.toList()),
|
||||||
null,
|
getFxcfCopyToMail(ztStories),
|
||||||
b.toString());
|
b.toString());
|
||||||
}
|
}
|
||||||
for (ZtStory s:ztStories) {
|
for (ZtStory s:ztStories) {
|
||||||
@ -1045,5 +1071,4 @@ public class ZtReleaseServiceImpl extends ServiceImpl<ZtReleaseMapper, ZtRelease
|
|||||||
return Arrays.asList();
|
return Arrays.asList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import java.io.InputStream;
|
|||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class SendEmail {
|
public class SendEmail {
|
||||||
@ -129,14 +130,10 @@ public class SendEmail {
|
|||||||
// 设置发件人和收件人地址
|
// 设置发件人和收件人地址
|
||||||
message.setFrom(new InternetAddress(username));
|
message.setFrom(new InternetAddress(username));
|
||||||
|
|
||||||
for (String str:mails) {
|
// for (String str:mails) {
|
||||||
message.addRecipient(Message.RecipientType.TO, new InternetAddress(str));
|
message.addRecipients(Message.RecipientType.TO, mails.stream().collect(Collectors.joining(",")));
|
||||||
}
|
|
||||||
if(!CollectionUtils.isEmpty(copyTo)){
|
if(!CollectionUtils.isEmpty(copyTo)){
|
||||||
for (String str:copyTo ) {
|
message.setRecipients(Message.RecipientType.CC, copyTo.stream().collect(Collectors.joining(",")));
|
||||||
message.setRecipients(Message.RecipientType.CC, InternetAddress
|
|
||||||
.parse(str));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.isEmpty(title)){
|
if(StringUtils.isEmpty(title)){
|
||||||
@ -160,7 +157,7 @@ public class SendEmail {
|
|||||||
// 发送邮件
|
// 发送邮件
|
||||||
Transport.send(message);
|
Transport.send(message);
|
||||||
|
|
||||||
System.out.println("邮件发送成功!");
|
log.info("邮件发送成功!");
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
log.error("{} {}",e, JSON.toJSONString(mails));
|
log.error("{} {}",e, JSON.toJSONString(mails));
|
||||||
throw new BusinessException("邮件发送失败 ");
|
throw new BusinessException("邮件发送失败 ");
|
||||||
|
@ -55,3 +55,7 @@ vx:
|
|||||||
salaryCorpsecretApp: BsgdcmLV5L1jbO7uro9QqdgGQaGItVb_tvfaasAq_3w
|
salaryCorpsecretApp: BsgdcmLV5L1jbO7uro9QqdgGQaGItVb_tvfaasAq_3w
|
||||||
salaryCorpsecretAppUrl: https://qyapi.weixin.qq.com/cgi-bin/message/send
|
salaryCorpsecretAppUrl: https://qyapi.weixin.qq.com/cgi-bin/message/send
|
||||||
dkcorpsecret: 1MWQxoL8QtypfdnKJqdo3pGdZDAmdhqTF_MaWm3rVjs
|
dkcorpsecret: 1MWQxoL8QtypfdnKJqdo3pGdZDAmdhqTF_MaWm3rVjs
|
||||||
|
|
||||||
|
# 小飞侠发版通知和催促邮件增加抄送人
|
||||||
|
xfx:
|
||||||
|
release: gongwenyi@flying-man.cn,juntao.lin@sino-assistance.com,lizhicheng@sino-assistance.com,wangtingting@sino-assistance.com,liang.xie@sino-assistance.com,zhangyamei@sino-assistance.com
|
||||||
|
@ -63,7 +63,9 @@ vx:
|
|||||||
salaryCorpsecretAppUrl: https://qyapi.weixin.qq.com/cgi-bin/message/send
|
salaryCorpsecretAppUrl: https://qyapi.weixin.qq.com/cgi-bin/message/send
|
||||||
dkcorpsecret: biYcz9e1gIJSsAaTgCZXbcO8Vh9YT11JtaFeZPaPmtU #书籍
|
dkcorpsecret: biYcz9e1gIJSsAaTgCZXbcO8Vh9YT11JtaFeZPaPmtU #书籍
|
||||||
|
|
||||||
|
# 小飞侠发版通知和催促邮件增加抄送人
|
||||||
|
xfx:
|
||||||
|
release: sunqingfang@sino-assistance.com,4468058@qq.com
|
||||||
|
|
||||||
#vx:
|
#vx:
|
||||||
# agentld: 1000059
|
# agentld: 1000059
|
||||||
|
@ -71,4 +71,11 @@
|
|||||||
order by id desc
|
order by id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="productListByProgramName" resultType="com.sa.zentao.entity.ZtProduct">
|
||||||
|
select p.* from zt_product p WHERE program in (
|
||||||
|
SELECT id from zt_project pj WHERE pj.`name` = #{programName} and pj.deleted ='0'
|
||||||
|
) and deleted = '0'
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Reference in New Issue
Block a user