|
|
@ -1,9 +1,13 @@ |
|
|
|
package com.hnac.hzims.safeproduct.service.impl; |
|
|
|
package com.hnac.hzims.safeproduct.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.afterturn.easypoi.entity.ImageEntity; |
|
|
|
import cn.hutool.core.date.DatePattern; |
|
|
|
import cn.hutool.core.date.DatePattern; |
|
|
|
import com.alibaba.excel.util.CollectionUtils; |
|
|
|
import com.alibaba.excel.util.CollectionUtils; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
|
|
|
import com.hnac.hzims.common.logs.utils.StringUtils; |
|
|
|
|
|
|
|
import com.hnac.hzims.common.utils.Condition; |
|
|
|
import com.hnac.hzims.safeproduct.constants.SafeProductConstant; |
|
|
|
import com.hnac.hzims.safeproduct.constants.SafeProductConstant; |
|
|
|
import com.hnac.hzims.safeproduct.entity.ConferencePlanEntity; |
|
|
|
import com.hnac.hzims.safeproduct.entity.ConferencePlanEntity; |
|
|
|
import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity; |
|
|
|
import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity; |
|
|
@ -14,11 +18,14 @@ import com.hnac.hzims.safeproduct.mapper.ConferenceRecordMapper; |
|
|
|
import com.hnac.hzims.safeproduct.service.IConferenceRecordService; |
|
|
|
import com.hnac.hzims.safeproduct.service.IConferenceRecordService; |
|
|
|
import com.hnac.hzims.safeproduct.utils.BaseUtil; |
|
|
|
import com.hnac.hzims.safeproduct.utils.BaseUtil; |
|
|
|
import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO; |
|
|
|
import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO; |
|
|
|
|
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
@ -60,14 +67,16 @@ public class ConferenceRecordServiceImpl extends ServiceImpl<ConferenceRecordMap |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 新增会议记录 |
|
|
|
* 新增会议记录 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean saveRecord(ConferenceRecordEntity conferenceRecord) { |
|
|
|
public boolean saveRecord(ConferenceRecordEntity conferenceRecord) { |
|
|
|
// 获取当月时间(yyyymm)
|
|
|
|
// 获取当月时间
|
|
|
|
String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date()); |
|
|
|
String currentNormMonth = DatePattern.NORM_MONTH_FORMAT.format(new Date()); |
|
|
|
|
|
|
|
String currentSimpleMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date()); |
|
|
|
// 查询是否存在同月编号
|
|
|
|
// 查询是否存在同月编号
|
|
|
|
String lastCode = getLastCode(currentMonth); |
|
|
|
String lastCode = getLastCode(currentNormMonth); |
|
|
|
// 若不存在,新增编号
|
|
|
|
// 若不存在,新增编号
|
|
|
|
String code = BaseUtil.getUniqueCode("HYJL", lastCode, currentMonth); |
|
|
|
String code = BaseUtil.getUniqueCode("HYJL", lastCode, currentSimpleMonth); |
|
|
|
conferenceRecord.setCode(code); |
|
|
|
conferenceRecord.setCode(code); |
|
|
|
boolean save = this.save(conferenceRecord); |
|
|
|
boolean save = this.save(conferenceRecord); |
|
|
|
// 若会议记录新增成功,修改会议计划状态为已完成
|
|
|
|
// 若会议记录新增成功,修改会议计划状态为已完成
|
|
|
@ -85,7 +94,8 @@ public class ConferenceRecordServiceImpl extends ServiceImpl<ConferenceRecordMap |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void exportConferenceRecordData(Long id, HttpServletResponse response) { |
|
|
|
public void exportConferenceRecordData(Long id, HttpServletResponse response) { |
|
|
|
ConferenceRecordDetailVO conferenceRecordDetailVO = this.getConferenceRecordDetailById(id); |
|
|
|
ConferenceRecordDetailVO conferenceRecordDetailVO = this.getConferenceRecordDetailById(id); |
|
|
|
// 会议方式字段
|
|
|
|
// 数据处理
|
|
|
|
|
|
|
|
// 会议方式
|
|
|
|
String conferenceMethod = conferenceRecordDetailVO.getConferenceMethod(); |
|
|
|
String conferenceMethod = conferenceRecordDetailVO.getConferenceMethod(); |
|
|
|
if (conferenceMethod.equals(ConferenceMethodEnum.MIXED.getValue())) { |
|
|
|
if (conferenceMethod.equals(ConferenceMethodEnum.MIXED.getValue())) { |
|
|
|
conferenceRecordDetailVO.setConferenceMethod(ConferenceMethodEnum.MIXED.getDesc()); |
|
|
|
conferenceRecordDetailVO.setConferenceMethod(ConferenceMethodEnum.MIXED.getDesc()); |
|
|
@ -94,6 +104,21 @@ public class ConferenceRecordServiceImpl extends ServiceImpl<ConferenceRecordMap |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
conferenceRecordDetailVO.setConferenceMethod(ConferenceMethodEnum.OFFLINE.getDesc()); |
|
|
|
conferenceRecordDetailVO.setConferenceMethod(ConferenceMethodEnum.OFFLINE.getDesc()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 表头年月
|
|
|
|
|
|
|
|
String code = conferenceRecordDetailVO.getCode(); |
|
|
|
|
|
|
|
conferenceRecordDetailVO.setYear(code.substring(4, 8)); |
|
|
|
|
|
|
|
conferenceRecordDetailVO.setMonth(code.substring(8, 10)); |
|
|
|
|
|
|
|
// 图片
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(conferenceRecordDetailVO.getImgPath())) { |
|
|
|
|
|
|
|
String[] imgArr = conferenceRecordDetailVO.getImgPath().split(","); |
|
|
|
|
|
|
|
List<ImageEntity> list = new ArrayList<>(); |
|
|
|
|
|
|
|
for (String img : imgArr) { |
|
|
|
|
|
|
|
ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath + |
|
|
|
|
|
|
|
BaseUtil.downloadFileByUrl(img, savePath)), 180, 150); |
|
|
|
|
|
|
|
list.add(imageEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
conferenceRecordDetailVO.setImages(list); |
|
|
|
|
|
|
|
} |
|
|
|
Map<String, Object> params = BaseUtil.obj2Map(conferenceRecordDetailVO); |
|
|
|
Map<String, Object> params = BaseUtil.obj2Map(conferenceRecordDetailVO); |
|
|
|
String templateFile = "template/会议记录表" + SafeProductConstant.DOCX_SUFFIX; |
|
|
|
String templateFile = "template/会议记录表" + SafeProductConstant.DOCX_SUFFIX; |
|
|
|
String wordPath = savePath + "/会议记录表" + SafeProductConstant.DOCX_SUFFIX; |
|
|
|
String wordPath = savePath + "/会议记录表" + SafeProductConstant.DOCX_SUFFIX; |
|
|
@ -110,13 +135,34 @@ public class ConferenceRecordServiceImpl extends ServiceImpl<ConferenceRecordMap |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* 会议记录分页 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public IPage<ConferenceRecordEntity> recordPage(Map<String, Object> param, Query query) { |
|
|
|
|
|
|
|
QueryWrapper<ConferenceRecordEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
String conferencePlanId = String.valueOf(param.get("conferencePlanId")); |
|
|
|
|
|
|
|
String startTime = String.valueOf(param.get("actualStartTime")); |
|
|
|
|
|
|
|
String endTime = String.valueOf((param.get("actualEndTime"))); |
|
|
|
|
|
|
|
if (!conferencePlanId.equals("null") && !conferencePlanId.equals("")) { |
|
|
|
|
|
|
|
queryWrapper.lambda().eq(ConferenceRecordEntity::getConferencePlanId, conferencePlanId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!startTime.equals("null") && !startTime.equals("")) { |
|
|
|
|
|
|
|
queryWrapper.lambda().ge(ConferenceRecordEntity::getActualStartTime, startTime); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!endTime.equals("null") && !endTime.equals("")) { |
|
|
|
|
|
|
|
queryWrapper.lambda().le(ConferenceRecordEntity::getActualEndTime, endTime); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
queryWrapper.lambda().orderByDesc(ConferenceRecordEntity::getCreateTime); |
|
|
|
|
|
|
|
return this.page(Condition.getPage(query), queryWrapper); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 查询是否存在同月编号 |
|
|
|
* 查询是否存在同月编号 |
|
|
|
* @param currentMonth 当月 |
|
|
|
* @param currentMonth 当月 |
|
|
|
* @return 存在则返回上一编号,否则返回null |
|
|
|
* @return 存在则返回上一编号,否则返回null |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private String getLastCode(String currentMonth) { |
|
|
|
private String getLastCode(String currentMonth) { |
|
|
|
String month = currentMonth.substring(currentMonth.length() - 2); |
|
|
|
List<ConferenceRecordEntity> list = getConferenceByMonth(currentMonth); |
|
|
|
List<ConferenceRecordEntity> list = getConferenceByMonth(month); |
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) { |
|
|
|
if (CollectionUtils.isEmpty(list)) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|