|
|
@ -1,6 +1,7 @@ |
|
|
package net.lab1024.sa.admin.module.letter.service; |
|
|
package net.lab1024.sa.admin.module.letter.service; |
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
import net.lab1024.sa.admin.module.business.oa.notice.domain.entity.NoticeEntity; |
|
|
import net.lab1024.sa.admin.module.business.oa.notice.domain.entity.NoticeEntity; |
|
|
import net.lab1024.sa.admin.module.business.oa.notice.service.NoticeService; |
|
|
import net.lab1024.sa.admin.module.business.oa.notice.service.NoticeService; |
|
|
@ -10,8 +11,15 @@ import net.lab1024.sa.admin.module.letter.domain.form.LetterAddForm; |
|
|
import net.lab1024.sa.admin.module.letter.domain.form.LetterQueryForm; |
|
|
import net.lab1024.sa.admin.module.letter.domain.form.LetterQueryForm; |
|
|
import net.lab1024.sa.admin.module.letter.domain.form.LetterQueryFormNoPage; |
|
|
import net.lab1024.sa.admin.module.letter.domain.form.LetterQueryFormNoPage; |
|
|
import net.lab1024.sa.admin.module.letter.domain.vo.LetterVO; |
|
|
import net.lab1024.sa.admin.module.letter.domain.vo.LetterVO; |
|
|
|
|
|
import net.lab1024.sa.admin.module.system.department.domain.entity.DepartmentEntity; |
|
|
|
|
|
import net.lab1024.sa.admin.module.system.department.service.DepartmentService; |
|
|
|
|
|
import net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity; |
|
|
import net.lab1024.sa.admin.module.system.employee.service.EmployeeService; |
|
|
import net.lab1024.sa.admin.module.system.employee.service.EmployeeService; |
|
|
|
|
|
import net.lab1024.sa.admin.module.system.role.domain.vo.RoleVO; |
|
|
|
|
|
import net.lab1024.sa.admin.module.system.role.service.RoleEmployeeService; |
|
|
|
|
|
import net.lab1024.sa.admin.module.system.role.service.RoleService; |
|
|
import net.lab1024.sa.admin.util.AdminRequestUtil; |
|
|
import net.lab1024.sa.admin.util.AdminRequestUtil; |
|
|
|
|
|
import net.lab1024.sa.base.common.enumeration.UserTypeEnum; |
|
|
import net.lab1024.sa.base.common.util.SmartBeanUtil; |
|
|
import net.lab1024.sa.base.common.util.SmartBeanUtil; |
|
|
import net.lab1024.sa.base.common.util.SmartPageUtil; |
|
|
import net.lab1024.sa.base.common.util.SmartPageUtil; |
|
|
import net.lab1024.sa.base.common.domain.PageResult; |
|
|
import net.lab1024.sa.base.common.domain.PageResult; |
|
|
@ -40,6 +48,10 @@ public class LetterService { |
|
|
private EmployeeService employeeService; |
|
|
private EmployeeService employeeService; |
|
|
@Resource |
|
|
@Resource |
|
|
private NoticeService noticeService; |
|
|
private NoticeService noticeService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private DepartmentService departmentService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private RoleEmployeeService roleEmployeeService; |
|
|
/** |
|
|
/** |
|
|
* 分页查询 |
|
|
* 分页查询 |
|
|
*/ |
|
|
*/ |
|
|
@ -76,7 +88,17 @@ public class LetterService { |
|
|
Long userId = AdminRequestUtil.getRequestUser().getUserId(); |
|
|
Long userId = AdminRequestUtil.getRequestUser().getUserId(); |
|
|
LetterEntity letterEntity = new LetterEntity(); |
|
|
LetterEntity letterEntity = new LetterEntity(); |
|
|
letterEntity.setUserId(userId); |
|
|
letterEntity.setUserId(userId); |
|
|
NoticeEntity one = noticeService.getOne(); |
|
|
List<NoticeEntity> list = noticeService.getOne(); |
|
|
|
|
|
//查询用户角色
|
|
|
|
|
|
RoleVO roleVO = roleEmployeeService.getRoleIdList(userId).get(0); |
|
|
|
|
|
NoticeEntity one = new NoticeEntity(); |
|
|
|
|
|
if (UserTypeEnum.USER.getDesc().equals(roleVO.getRoleCode())){ |
|
|
|
|
|
one = list.stream().filter(a -> a.getDocumentNumber().equals("001")).collect(Collectors.toList()).get(0); |
|
|
|
|
|
}else { |
|
|
|
|
|
one = list.stream().filter(a -> a.getDocumentNumber().equals("002")).collect(Collectors.toList()).get(0); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (one != null) { |
|
|
if (one != null) { |
|
|
letterEntity.setNoticeId(one.getNoticeId()); |
|
|
letterEntity.setNoticeId(one.getNoticeId()); |
|
|
} |
|
|
} |
|
|
@ -86,4 +108,60 @@ public class LetterService { |
|
|
} |
|
|
} |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public NoticeEntity detail(Long letterId) { |
|
|
|
|
|
LetterEntity letterEntity = letterDao.selectById(letterId); |
|
|
|
|
|
//签约人的信息
|
|
|
|
|
|
Long userId = letterEntity.getUserId(); |
|
|
|
|
|
EmployeeEntity employeeEntity = employeeService.getById(userId); |
|
|
|
|
|
//签约人的部门信息
|
|
|
|
|
|
DepartmentEntity departmentEntity = departmentService.queryByFirmId(employeeEntity.getDepartmentId()); |
|
|
|
|
|
//承诺书内容
|
|
|
|
|
|
NoticeEntity noticeEntity = noticeService.queryById(letterEntity.getNoticeId()); |
|
|
|
|
|
|
|
|
|
|
|
//查询用户角色
|
|
|
|
|
|
RoleVO roleVO = roleEmployeeService.getRoleIdList(userId).get(0); |
|
|
|
|
|
//如果是user
|
|
|
|
|
|
if (UserTypeEnum.USER.getDesc().equals(roleVO.getRoleCode())){ |
|
|
|
|
|
//替换 内容 - 律师个人承诺书
|
|
|
|
|
|
String contentHtml = noticeEntity.getContentHtml(); |
|
|
|
|
|
String contentText = noticeEntity.getContentText(); |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前年份
|
|
|
|
|
|
String year = String.valueOf(letterEntity.getCreateTime().getYear()); |
|
|
|
|
|
|
|
|
|
|
|
contentHtml = contentHtml.replace("我自愿", employeeEntity.getActualName()+"自愿"); |
|
|
|
|
|
contentHtml = contentHtml.replace("申报年度", "申报"+year + "年度"); |
|
|
|
|
|
contentText = contentText.replace("我自愿", employeeEntity.getActualName()+"自愿"); |
|
|
|
|
|
contentText = contentText.replace("申报年度", "申报"+year + "年度"); |
|
|
|
|
|
// 替换模板中的占位符 - 律师个人承诺书
|
|
|
|
|
|
contentHtml = contentHtml.replace("承诺人(签字): 日期: ", "承诺人(签字):" + employeeEntity.getActualName() + " 日期:" + letterEntity.getCreateTime().toLocalDate().toString()); |
|
|
|
|
|
contentText = contentText.replace("承诺人(签字): 日期: ", "承诺人(签字):" + employeeEntity.getActualName() + " 日期:" + letterEntity.getCreateTime().toLocalDate().toString()); |
|
|
|
|
|
|
|
|
|
|
|
noticeEntity.setContentHtml(contentHtml); |
|
|
|
|
|
noticeEntity.setContentText(contentText); |
|
|
|
|
|
}else { |
|
|
|
|
|
//替换 内容 - 律师事务所承诺书
|
|
|
|
|
|
String contentHtml = noticeEntity.getContentHtml(); |
|
|
|
|
|
String contentText = noticeEntity.getContentText(); |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前年份
|
|
|
|
|
|
String year = String.valueOf(letterEntity.getCreateTime().getYear()); |
|
|
|
|
|
|
|
|
|
|
|
// 替换模板中的占位符 - 律师事务所承诺书
|
|
|
|
|
|
contentHtml = contentHtml.replace("律师事务所", departmentEntity.getDepartmentName() + "律师事务所"); |
|
|
|
|
|
contentHtml = contentHtml.replace("年度", year + "年度"); |
|
|
|
|
|
contentHtml = contentHtml.replace("主任(签字):", "主任(签字):" + employeeEntity.getActualName()); |
|
|
|
|
|
contentHtml = contentHtml.replace("日期", " 日期:" + letterEntity.getCreateTime().toLocalDate().toString()); |
|
|
|
|
|
|
|
|
|
|
|
contentText = contentText.replace("律师事务所", departmentEntity.getDepartmentName() + "律师事务所"); |
|
|
|
|
|
contentText = contentText.replace("年度", year + "年度"); |
|
|
|
|
|
contentText = contentText.replace("主任(签字):", "主任(签字):" + employeeEntity.getActualName()); |
|
|
|
|
|
contentText = contentText.replace("日期", " 日期:" + letterEntity.getCreateTime().toLocalDate()); |
|
|
|
|
|
|
|
|
|
|
|
noticeEntity.setContentHtml(contentHtml); |
|
|
|
|
|
noticeEntity.setContentText(contentText); |
|
|
|
|
|
} |
|
|
|
|
|
return noticeEntity; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|