update 工作组发布整体变更

This commit is contained in:
lijiarao
2023-02-16 15:15:52 +08:00
parent 60fb2d3afd
commit cc3ee86737
11 changed files with 148 additions and 48 deletions
@@ -110,28 +110,29 @@ public class SendMessageServiceImpl implements SendMessageService {
throw new JeroBootException("邮件发送,邮箱地址不能为空!");
}
try {
String email = loginUser.getEmail();
String emailPassword = loginUser.getEmailPassword();
//如果发件人没有邮箱或邮箱授权码则使用admin账户的邮箱授权码
if (StringUtils.isBlank(email) || StringUtils.isBlank(emailPassword)) {
loginUser = sysBaseAPI.getUserByName(env.getProperty("message.systemEmailUser"));
email = loginUser.getEmail();
emailPassword = loginUser.getEmailPassword();
}
email = PasswordUtil.decrypt(email);
emailPassword = PasswordUtil.decrypt(emailPassword);
EmailSendMsgHandle emailHandle = new EmailSendMsgHandle(email,emailPassword);
// 发送带附件邮箱
if(!CollectionUtils.isEmpty(sendMessageDTO.getListFile())){
emailHandle.SendMsgAndFile(sendMessageDTO.getEmail(), title, content,sendMessageDTO.getListFile());
}else{
//如果有通知内容就替换
if (StringUtils.isNotBlank(sendMessageDTO.getMeetingNotice())){
emailHandle.SendMsg(sendMessageDTO.getEmail(), title, sendMessageDTO.getMeetingNotice());
}else {
emailHandle.SendMsg(sendMessageDTO.getEmail(), title, content);
}
}
throw new JeroBootException("邮件发送失败,发件人的邮箱或邮箱授权码错误!");
//String email = loginUser.getEmail();
//String emailPassword = loginUser.getEmailPassword();
////如果发件人没有邮箱或邮箱授权码则使用admin账户的邮箱授权码
//if (StringUtils.isBlank(email) || StringUtils.isBlank(emailPassword)) {
// loginUser = sysBaseAPI.getUserByName(env.getProperty("message.systemEmailUser"));
// email = loginUser.getEmail();
// emailPassword = loginUser.getEmailPassword();
//}
//email = PasswordUtil.decrypt(email);
//emailPassword = PasswordUtil.decrypt(emailPassword);
//EmailSendMsgHandle emailHandle = new EmailSendMsgHandle(email,emailPassword);
//// 发送带附件邮箱
//if(!CollectionUtils.isEmpty(sendMessageDTO.getListFile())){
// emailHandle.SendMsgAndFile(sendMessageDTO.getEmail(), title, content,sendMessageDTO.getListFile());
//}else{
// //如果有通知内容就替换
// if (StringUtils.isNotBlank(sendMessageDTO.getMeetingNotice())){
// emailHandle.SendMsg(sendMessageDTO.getEmail(), title, sendMessageDTO.getMeetingNotice());
// }else {
// emailHandle.SendMsg(sendMessageDTO.getEmail(), title, content);
// }
//}
}catch (Exception e){
log.error("发送邮件异常",e);
if (e.getMessage() !=null){
@@ -249,8 +249,8 @@ public class WorkGroupMeetingController extends JeroController<PayMeeting, IPayM
@ApiOperation(value = "发布提醒", notes = "发布提醒")
@PostMapping(value = "/publishReminder")
public Result<?> publishReminder(@RequestBody PublishReminderVO publishReminderVO) {
payMeetingService.publishReminder(publishReminderVO, CompanyMessageEnums.MSG1,"C_OPEN_TYPE1");
return Result.OK();
List<String> strings = payMeetingService.publishReminder(publishReminderVO, CompanyMessageEnums.MSG1, "C_OPEN_TYPE1");
return Result.OK("发布成功",strings);
}
}
@@ -62,8 +62,9 @@ public interface IPayMeetingService extends IService<PayMeeting> {
* 发布提醒
* @author lijiarao
* @date 2021/9/27
* @return
*/
void publishReminder(PublishReminderVO publishReminderVO, CompanyMessageEnums companyMessageEnums, String busType);
List<String> publishReminder(PublishReminderVO publishReminderVO, CompanyMessageEnums companyMessageEnums, String busType);
IPage<PayMeeting> pageListContract(Page<PayMeeting> page, PayMeeting payMeeting, HttpServletRequest request, LoginUser sysUser);
@@ -622,7 +622,7 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
@Override
@Transactional
public void publishReminder(PublishReminderVO publishReminderVO,CompanyMessageEnums companyMessageEnums,String busType) {
public List<String> publishReminder(PublishReminderVO publishReminderVO, CompanyMessageEnums companyMessageEnums, String busType) {
List<String> meetingIds = publishReminderVO.getMeetingIds();
List<String> subitemIds = publishReminderVO.getSubitemIds();
Integer projectType = publishReminderVO.getProjectType();
@@ -635,25 +635,23 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
LambdaQueryWrapper<PayContactsManagement> wrapper = new LambdaQueryWrapper<>();
List<String> contactsIdList = new ArrayList<>();
String workingGroupId = null;
//工作组项目查询公司
//工作组项目直接是人
if (Objects.equals(projectType, 1)) {
List<PayWorkingGroupSubItem> payWorkingGroupSubItems = payWorkingGroupSubItemService.listByIds(subitemIds);
//把单位会员中所有的联系人取出
for (PayWorkingGroupSubItem payWorkingGroupSubItem : payWorkingGroupSubItems) {
workingGroupId = payWorkingGroupSubItem.getWorkingGroupId();
String groupSubItemId = payWorkingGroupSubItem.getId();
LambdaQueryWrapper<PayWorkingGroupSubItemContacts> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(PayWorkingGroupSubItemContacts::getWorkingGroupSubId, groupSubItemId);
List<PayWorkingGroupSubItemContacts> groupSubItemContactsList = workingGroupSubItemContactsService.list(wrapper1);
for (PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts : groupSubItemContactsList) {
String contactsId = payWorkingGroupSubItemContacts.getContactsId();
contactsIdList.add(contactsId);
meetingRemindRecordList.add(
new PayMeetingRemindRecord()
.setSubitemId(groupSubItemId)
.setContactId(contactsId)
);
}
workingGroupId = publishReminderVO.getWorkingGroupId();
LambdaQueryWrapper<PayWorkingGroupSubItemContacts> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(PayWorkingGroupSubItemContacts::getWorkingGroupId, workingGroupId);
wrapper1.in(PayWorkingGroupSubItemContacts::getContactsId,subitemIds);
List<PayWorkingGroupSubItemContacts> groupSubItemContactsList = workingGroupSubItemContactsService.list(wrapper1);
for (PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts : groupSubItemContactsList) {
String groupSubItemId = payWorkingGroupSubItemContacts.getWorkingGroupSubId();
String contactsId = payWorkingGroupSubItemContacts.getContactsId();
contactsIdList.add(contactsId);
meetingRemindRecordList.add(
new PayMeetingRemindRecord()
.setSubitemId(groupSubItemId)
.setContactId(contactsId)
);
}
// 分标委项目查询人
} else if (Objects.equals(projectType, 2)) {
@@ -689,6 +687,9 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
//标记会议为已提醒
List<PayMeeting> payMeetings = listByIds(meetingIds);
List<String> listMsg = new ArrayList<>();
int successAll = 0;
int failedAll = 0;
for (PayMeeting payMeeting : payMeetings) {
String meetingId = payMeeting.getId();
meetingIdList.add(meetingId);
@@ -703,7 +704,11 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
fromUser = userById.getUsername();
}
//发送消息
for (PayContactsManagement payContactsManagement : list) {
int success = list.size();
int failed = 0;
for (PayMeetingRemindRecord meetingRemindRecord : meetingRemindRecordList) {
String contactId = meetingRemindRecord.getContactId();
PayContactsManagement payContactsManagement = payContactsManagementService.getById(contactId);
if (Objects.isNull(fromUser)) {
String directorId = payMeeting.getDirectorId();
LoginUser director = sysBaseAPI.getUserById(directorId);
@@ -733,11 +738,27 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", meetingId);
sendMessageDTO.setBusId(jsonObject.toJSONString());
sendMessageService.SendMessageService(sendMessageDTO);
try {
sendMessageService.SendMessageService(sendMessageDTO);
PayMeetingRemindRecord meetingRemindRecord1 = new PayMeetingRemindRecord();
meetingRemindRecord1.setSubitemId(meetingRemindRecord.getSubitemId());
meetingRemindRecord1.setContactId(meetingRemindRecord.getContactId());
meetingRemindRecord1.setMeetingId(meetingId);
payMeetingRemindRecordService.save(meetingRemindRecord1);
}catch (Exception e){
String name = payContactsManagement.getName();
if(e.getMessage().contains("邮件发送") && !listMsg.contains(name + "邮件发送失败")){
success--;
failed++;
listMsg.add(name + "邮件发送失败");
}
}
}
successAll += success;
failedAll += failed;
}
payMeetingRemindRecordService.addList(meetingIdList, meetingRemindRecordList);
listMsg.add(0,"成功"+successAll+"条数据,失败"+failedAll+"条数据");
return listMsg;
}
@Override
@@ -3,6 +3,7 @@ package com.jero.meeting.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Size;
import java.util.List;
/**
@@ -11,6 +12,9 @@ import java.util.List;
*/
@Data
public class PublishReminderVO {
/**工作组id*/
@ApiModelProperty(value = "工作组id")
private java.lang.String workingGroupId;
@ApiModelProperty(value = "会议id")
private List<String> meetingIds;
@ApiModelProperty(value = "成员id列表")
@@ -20,6 +20,7 @@ import com.jero.common.util.PasswordUtil;
import com.jero.common.util.ValidUtil;
import com.jero.common.util.oConvertUtils;
import com.jero.common.vo.ProjectDetailVO;
import com.jero.company.entity.PayContactsManagement;
import com.jero.contract.entity.PayIncomeContract;
import com.jero.contract.entity.PayIncomeContractAssociated;
import com.jero.contract.service.IPayIncomeContractAssociatedService;
@@ -153,6 +154,47 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
return Result.OK(pageList);
}
/**
* 分页列表查询
*
* @param payWorkingGroupSubItem 工作组成员
* @param pageNo 页数
* @param pageSize 条数
* @param paymentDate 日期
* @return
*/
@RequiresPermissions("workingGroupMember:search")
@ApiOperation(value = "工作组成员-发布提醒列表查询")
@GetMapping(value = "/publishReminderList")
public Result<?> publishReminderList(PayWorkingGroupSubItem payWorkingGroupSubItem,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "paymentDate", required = false) String paymentDate) {
if (!StringUtils.isBlank(payWorkingGroupSubItem.getChargeCompanyTemporaryName()) && payWorkingGroupSubItem.getChargeCompanyTemporaryName().length() > 50) {
return Result.error("成员单位长度不能大于50个字符");
}
if (StringUtils.isBlank(payWorkingGroupSubItem.getWorkingGroupId())) {
return Result.error("工作组id不能为空!");
}
if(!StringUtils.isBlank(payWorkingGroupSubItem.getChargeCompanyTemporaryName())){
payWorkingGroupSubItem.setChargeCompanyTemporaryName(oConvertUtils.replaceAllPercent(payWorkingGroupSubItem.getChargeCompanyTemporaryName()));
}
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId());
if(Objects.isNull(payWorkingGroup)){
return Result.error("工作组不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!rolePermissionService.getRolePermission("workingGroupMember:search")
&& !Objects.equals(payWorkingGroup.getPrincipalIdA(),sysUser.getId())
&& !Objects.equals(payWorkingGroup.getPrincipalIdB(),sysUser.getId())){
return Result.error("数据权限不足!");
}
Page<PayWorkingGroupSubItem> page = new Page<>(pageNo, pageSize);
IPage<PayWorkingGroupSubItem> pageList = payWorkingGroupSubItemService.publishReminderList(page, payWorkingGroupSubItem);
return Result.OK(pageList);
}
/**
* 企业端-工作组项目-分页列表查询
* 工作组的企业联系人1,2,3、邮寄联系人、打包的企业联系人、打包联系人、关联合同的签订单位联系人
@@ -2,6 +2,7 @@ package com.jero.project.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.company.entity.PayContactsManagement;
import com.jero.project.entity.PayWorkGroupSubletStatistics;
import com.jero.project.entity.PayWorkingGroupSubItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -57,4 +58,5 @@ public interface PayWorkingGroupSubItemMapper extends BaseMapper<PayWorkingGroup
AllMoney queryPageList233(@Param("payWorkingGroupSubletSearch") PayWorkingGroupSubletSearch payWorkingGroupSubletSearch, @Param("id") String id);
IPage<PayWorkingGroupSubItem> publishReminderList(Page<PayWorkingGroupSubItem> page, @Param("payWorkingGroupSubItem") PayWorkingGroupSubItem payWorkingGroupSubItem);
}
@@ -313,4 +313,25 @@
group by pwgs.id order by pwgs.create_time desc
</select>
<select id="publishReminderList" resultType="com.jero.project.entity.PayWorkingGroupSubItem">
select pcm.id contactsIdOne,pcm.name contactsTemporaryNameOne,pcm.company_name chargeCompanyTemporaryName
,if(pmrr.id,'是','否') remind
from pay_contacts_management pcm
left join pay_working_group_subitem_contacts pwgsc on pcm.id = pwgsc.contacts_id
left join (SELECT * from pay_meeting_remind_record where meeting_id = #{param2.meetingId}) pmrr on pmrr.subitem_id = pwgsc.working_group_sub_id
<where>
pwgsc.working_group_id = #{payWorkingGroupSubItem.workingGroupId}
<if test="payWorkingGroupSubItem.chargeCompanyTemporaryName != null and payWorkingGroupSubItem.chargeCompanyTemporaryName != ''">
and pcm.company_name like concat('%',#{payWorkingGroupSubItem.chargeCompanyTemporaryName},'%')
</if>
<if test="payWorkingGroupSubItem.remind == 1">
and pmrr.id is not null
</if>
<if test="payWorkingGroupSubItem.remind == 0">
and pmrr.id is null
</if>
</where>
</select>
</mapper>
@@ -3,6 +3,7 @@ package com.jero.project.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.company.entity.PayContactsManagement;
import com.jero.project.entity.PayWorkGroupSubletStatistics;
import com.jero.project.entity.PayWorkingGroupSubItem;
import com.jero.project.entity.PayWorkingGroupSubletSearch;
@@ -10,7 +11,6 @@ import com.jero.project.vo.SetChargeInput;
import com.jero.statistics.entity.AllMoney;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/**
@@ -117,4 +117,5 @@ public interface IPayWorkingGroupSubItemService extends IService<PayWorkingGroup
AllMoney queryPageList233(PayWorkingGroupSubletSearch payWorkingGroupSubletSearch, String id);
IPage<PayWorkingGroupSubItem> publishReminderList(Page<PayWorkingGroupSubItem> page, PayWorkingGroupSubItem payWorkingGroupSubItem);
}
@@ -442,6 +442,7 @@ public class PayWorkingGroupDistributionRecordServiceImpl extends ServiceImpl<Pa
}
}
});
listMsg.add(0,"成功");
return listMsg;
}
@@ -1003,6 +1003,12 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
return this.baseMapper.queryPageList233(payWorkingGroupSubletSearch,id);
}
@Override
public IPage<PayWorkingGroupSubItem> publishReminderList(Page<PayWorkingGroupSubItem> page, PayWorkingGroupSubItem payWorkingGroupSubItem) {
IPage<PayWorkingGroupSubItem> payWorkingGroupSubItemIPage = payWorkingGroupSubItemMapper.publishReminderList(page, payWorkingGroupSubItem);
return payWorkingGroupSubItemIPage;
}
/**
* @Description 删除项目打包关联,临时企业、联系信息
* @Author lqt