40609aef 张雷

Merge remote-tracking branch 'origin/master' into master

2 个父辈 d3a110da 59bdbce4
正在显示 30 个修改的文件 包含 960 行增加6 行删除
package com.skua.common.util.word;
import org.jeecgframework.poi.excel.entity.vo.PoiBaseConstants;
import org.jeecgframework.poi.word.entity.WordImageEntity;
import org.jeecgframework.poi.word.entity.params.ExcelListEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
/**
* EASYPOI 的公共基础类
*/
public class EasyPoiUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(EasyPoiUtil.class);
private EasyPoiUtil() {
}
/**
* 返回流和图片类型
*
* @Author JueYue
* @date 2013-11-20
* @param entity
* @return (byte[]) isAndType[0],(Integer)isAndType[1]
* @throws Exception
*/
public static Object[] getIsAndType(WordImageEntity entity) throws Exception {
Object[] result = new Object[2];
String type;
if (entity.getType().equals(WordImageEntity.URL)) {
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
BufferedImage bufferImg;
/*String path = Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath() + entity.getUrl();
path = path.replace("WEB-INF/classes/", "");
path = path.replace("file:/", "");*/
String path = entity.getUrl();
System.out.println("图片地址="+path);
bufferImg = ImageIO.read(new File(path));
ImageIO.write(bufferImg, entity.getUrl().substring(entity.getUrl().indexOf(".") + 1, entity.getUrl().length()), byteArrayOut);
result[0] = byteArrayOut.toByteArray();
type = entity.getUrl().split("/.")[entity.getUrl().split("/.").length - 1];
} else {
result[0] = entity.getData();
type = getFileExtendName(entity.getData());
}
result[1] = getImageType(type);
return result;
}
/**
* 解析数据
*
* @Author JueYue
* @date 2013-11-16
* @return
*/
public static Object getRealValue(String currentText, Map<String, Object> map) {
String params = "";
try{
while (currentText.indexOf("{{") != -1) {
params = currentText.substring(currentText.indexOf("{{") + 2, currentText.indexOf("}}"));
Object obj = getParamsValue(params.trim(), map);
if(obj != null ){
// 判断图片或者是集合
if (obj instanceof WordImageEntity || obj instanceof List || obj instanceof ExcelListEntity) {
return obj;
} else {
currentText = currentText.replace("{{" + params + "}}", obj.toString());
}
}
}
}catch (Exception e){
e.printStackTrace();
}
return currentText;
}
/**
* 获取参数值
*
* @param params
* @param object
* @return
*/
@SuppressWarnings("rawtypes")
public static Object getParamsValue(String params, Object object) throws Exception {
if (params.indexOf(".") != -1) {
String[] paramsArr = params.split("\\.");
return getValueDoWhile(object, paramsArr, 0);
}
if (object instanceof Map) {
return ((Map) object).get(params);
}
// return getMethod(params, object.getClass()).invoke(object, new Object[] {});
Object result = null;
Method method = getMethod(params, object.getClass());
if(method != null){
result = method.invoke(object, new Object[] {});
}
return result;
}
/**
* 通过遍历过去对象值
*
* @param object
* @param paramsArr
* @param index
* @return
* @throws Exception
*/
@SuppressWarnings("rawtypes")
public static Object getValueDoWhile(Object object, String[] paramsArr, int index) throws Exception {
if (object == null) {
return "";
}
if (object instanceof WordImageEntity) {
return object;
}
if (object instanceof Map) {
object = ((Map) object).get(paramsArr[index]);
} else {
//object = getMethod(paramsArr[index], object.getClass()).invoke(object, new Object[] {});
Method method = getMethod(paramsArr[index], object.getClass());
if(method != null){
object = method.invoke(object, new Object[] {});
}else{
object = "";
}
}
return (index == paramsArr.length - 1) ? (object == null ? "" : object) : getValueDoWhile(object, paramsArr, ++index);
}
/**
* 获取GET方法
*
* @param name
* @param pojoClass
* @return
* @throws Exception
*/
public static Method getMethod(String name, Class<?> pojoClass) {
StringBuffer getMethodName = new StringBuffer(PoiBaseConstants.GET);
getMethodName.append(name.substring(0, 1).toUpperCase());
getMethodName.append(name.substring(1));
Method method = null;
try {
method = pojoClass.getMethod(getMethodName.toString(), new Class[] {});
} catch (Exception e) {
try {
method = pojoClass.getMethod(getMethodName.toString().replace(PoiBaseConstants.GET, PoiBaseConstants.IS), new Class[] {});
} catch (NoSuchMethodException e1) {
e1.printStackTrace();
}
}
return method;
}
/**
* @param photoByte
* @return
*/
public static String getFileExtendName(byte[] photoByte) {
String strFileExtendName = "JPG";
if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56) && ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) {
strFileExtendName = "GIF";
} else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70)) {
strFileExtendName = "JPG";
} else if ((photoByte[0] == 66) && (photoByte[1] == 77)) {
strFileExtendName = "BMP";
} else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71)) {
strFileExtendName = "PNG";
}
return strFileExtendName;
}
private static Integer getImageType(String type) {
if (!type.equalsIgnoreCase("JPG") && !type.equalsIgnoreCase("JPEG")) {
if (type.equalsIgnoreCase("GIF")) {
return 8;
} else if (type.equalsIgnoreCase("BMP")) {
return 8;
} else {
return type.equalsIgnoreCase("PNG") ? 6 : 5;
}
} else {
return 5;
}
}
}
package com.skua.modules.ajh.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.*;
import java.net.URLEncoder;
import java.util.*;
import java.net.URLDecoder;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.query.QueryGenerator;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.ajh.entity.AjhMeeting;
import com.skua.modules.ajh.entity.AjhMeetingAttend;
import com.skua.modules.ajh.entity.AjhMeetingMinutes;
import com.skua.modules.ajh.entity.AjhMeetingSend;
import com.skua.modules.ajh.service.IAjhMeetingAttendService;
import com.skua.modules.ajh.service.IAjhMeetingMinutesService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.ajh.service.IAjhMeetingSendService;
import com.skua.modules.ajh.service.IAjhMeetingService;
import com.skua.modules.ajh.util.Base64Utils;
import com.skua.modules.ajh.util.WordUtil;
import com.skua.modules.ajh.vo.ExportAjhMeetingMinutesVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.bytedeco.javacv.FrameFilter;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecgframework.poi.word.WordExportUtil;
import org.jeecgframework.poi.word.entity.MyXWPFDocument;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -46,8 +58,19 @@ import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/ajh/meetingMinutes")
public class AjhMeetingMinutesController {
@Autowired
private IAjhMeetingMinutesService ajhMeetingMinutesService;//会议纪要
@Autowired
private IAjhMeetingService meetingService;// 会议记录
@Autowired
private IAjhMeetingSendService meetingSendService;//会议通知
@Autowired
private IAjhMeetingMinutesService ajhMeetingMinutesService;
private IAjhMeetingAttendService meetingAttendService;//会议签到记录
/**
* <pre>
......@@ -292,5 +315,74 @@ public class AjhMeetingMinutesController {
}
return Result.ok("文件导入失败!");
}
/***
* 下载会议纪要
* @param id
* @param response
*/
@AutoLog(value = "会议纪要管理-通过会议纪要id下载会议纪要")
@ApiOperation(value="会议纪要管理-通过id下载会议纪要", notes="会议纪要管理-通过id下载会议纪要")
@GetMapping("/exportWordData")
public void exportWordData(@RequestParam(name="id",required=true) String id,HttpServletResponse response ) {
String templatePath = null;//导出模板文件名称
String exportName = "****---会议纪要.docx";//导出文件名称
Map<String ,Object> paramMap = new HashMap<String,Object>();
AjhMeetingMinutes ajhMeetingMinutes = ajhMeetingMinutesService.getDataById(id);
ExportAjhMeetingMinutesVO exprotVo = new ExportAjhMeetingMinutesVO();
// 标题:meetTitile 机构名称:orgDepart 纪要图片 , 住持人 ;纪要内容 ; 会议地点
exprotVo.convert( exprotVo , ajhMeetingMinutes);
// 会议记录
AjhMeetingSend meetingSend = meetingSendService.getById( ajhMeetingMinutes.getMeetsId() );
//会议通知
AjhMeeting meeting = meetingService.getById( meetingSend.getMeetId() );
//签到集合
List<AjhMeetingAttend> meetingAttendList = meetingAttendService.getByMeetsId( ajhMeetingMinutes.getMeetsId() );
if(meetingAttendList == null || meetingAttendList.isEmpty()){
meetingAttendList = new ArrayList<AjhMeetingAttend>();
}
paramMap.put("dataList",meetingAttendList);
//导出word
exportWordData( templatePath , exportName , paramMap ,response);
}
private void exportWordData(String templatePath , String exportName , Map<String ,Object> paramMap, HttpServletResponse response ){
InputStream is = null;
//具体业务处理方法
try {
//获取word文档解析对象
is = new FileInputStream(templatePath);
//加载模板文件
MyXWPFDocument document = new MyXWPFDocument(is);
//解析07版的Word并且进行赋值
WordExportUtil.exportWord07(document, paramMap);
// .doc格式文档,设置响应内容类型为 Word 文档
response.setContentType("application/msword");
//String exportName = "***--会议纪要.docx";
// .docx格式文档,设置响应内容类型为 Word 文档
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
// .docx格式文档,设置响应头,指示浏览器将响应内容作为文件下载
response.setHeader("Content-Disposition", "attachment;filename=".concat(String.valueOf(URLEncoder.encode(exportName , "UTF-8"))));
// 将文档写入响应的输出流
document.write(response.getOutputStream());
// 刷新和关闭输出流
response.getOutputStream().flush();
response.getOutputStream().close();
}
catch (Exception e) {
e.printStackTrace();
}finally {
try{
if(is != null ) is.close();//关闭输入流
}catch (Exception e1){
e1.printStackTrace();
}
}
}
}
......
......@@ -92,4 +92,8 @@ public class AjhMeetingAttend {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@TableField(exist = false)
@ApiModelProperty(value = "序号")
private Integer index;
}
......
......@@ -3,6 +3,7 @@ package com.skua.modules.ajh.service;
import com.skua.modules.ajh.entity.AjhMeetingAttend;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.ajh.entity.AjhMeetingSend;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -13,4 +14,11 @@ public interface IAjhMeetingAttendService extends IService<AjhMeetingAttend> {
List<AjhMeetingAttend> init(AjhMeetingSend ajhMeetingSend);
/***
* 根据会议纪要获取签到记录
* @param meetsId
* @return
*/
public List<AjhMeetingAttend> getByMeetsId(@Param("meetsId")String meetsId);
}
......
package com.skua.modules.ajh.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.skua.modules.ajh.entity.AjhMeetingAttend;
import com.skua.modules.ajh.entity.AjhMeetingSend;
import com.skua.modules.ajh.mapper.AjhMeetingAttendMapper;
import com.skua.modules.ajh.service.IAjhMeetingAttendService;
import com.skua.modules.system.entity.SysUser;
import com.skua.modules.system.entity.SysUserDepart;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -48,4 +50,13 @@ public class AjhMeetingAttendServiceImpl extends ServiceImpl<AjhMeetingAttendMap
}
return list;
}
@Override
public List<AjhMeetingAttend> getByMeetsId(String meetsId) {
LambdaQueryWrapper<AjhMeetingAttend> queryAttend = new LambdaQueryWrapper<AjhMeetingAttend>();
queryAttend.eq(AjhMeetingAttend::getMeetsId, meetsId);
queryAttend.orderByDesc(AjhMeetingAttend::getCreateTime);//添加排序
List<AjhMeetingAttend> dataList = this.list(queryAttend);
return dataList;
}
}
......
package com.skua.modules.ajh.vo;
import com.skua.modules.ajh.entity.AjhMeetingAttend;
import com.skua.modules.ajh.entity.AjhMeetingMinutes;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.util.List;
/**
* 会议纪要管理
*/
@Data
@ApiModel(value="ajh_meeting_minutes对象", description="导出:会议纪要管理模板对象")
public class ExportAjhMeetingMinutesVO {
/**组织单位*/
@Excel(name = "组织单位", width = 15)
@ApiModelProperty(value = "组织单位")
private String orgDepart;
/**标题*/
@Excel(name = "标题", width = 15)
@ApiModelProperty(value = "标题")
private String meetTitile;
/**内容*/
@Excel(name = "会议内容", width = 15)
@ApiModelProperty(value = "会议内容")
private String meetingContent;
/**内容*/
@Excel(name = "会议纪要内容", width = 15)
@ApiModelProperty(value = "会议纪要内容")
private String minutesContent;
/**地点*/
@Excel(name = "会议地点", width = 15)
@ApiModelProperty(value = "会议地点")
private String meetingPlace;
/**主持人*/
@Excel(name = "主持人", width = 15)
@ApiModelProperty(value = "主持人")
private String compere;
/**时间*/
@Excel(name = "时间", width = 15)
@ApiModelProperty(value = "时间")
private String annTime;
/**图片*/
@Excel(name = "会议纪要图片", width = 15)
@ApiModelProperty(value = "会议纪要图片")
private String meetingImg;
/**发布时间*/
@Excel(name = "发布时间", width = 15)
@ApiModelProperty(value = "发布时间")
private String sendDate;
@ApiModelProperty(value = "签到记录集合")
private List<AjhMeetingAttend> meetingAttendList ;//签到记录
//将会议纪要转换为 会议导出模板对象
public void convert(ExportAjhMeetingMinutesVO exprotVo ,AjhMeetingMinutes ajhMeetingMinutes){
// ExportAjhMeetingMinutesVO exprotVo = new ExportAjhMeetingMinutesVO();
//exprotVo.setAnnTime();
exprotVo.setCompere(ajhMeetingMinutes.getCompere());//主持人
//会议纪要内容
String meetingMinutesContent = ajhMeetingMinutes.getDetail();
if(meetingMinutesContent != null ){
String content = meetingMinutesContent.toString().replaceAll("\\<.*?>", "");
meetingMinutesContent = content;
}else{
meetingMinutesContent ="";
}
exprotVo.setMinutesContent(meetingMinutesContent); //会议纪要内容
exprotVo.setOrgDepart(ajhMeetingMinutes.getOrgDepart());//集团名称
exprotVo.setSendDate(ajhMeetingMinutes.getSendDate());//发送时间
exprotVo.setMeetTitile(ajhMeetingMinutes.getTitle());//会议标题
exprotVo.setMeetingPlace( ajhMeetingMinutes.getPlace()); //会议地址
exprotVo.setMeetingPlace( ajhMeetingMinutes.getImage() );//会议图片;需要补全路径
}
}
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.core.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -68,14 +69,17 @@ public class EpibolyCompany {
/**合作状态(1:首次,2:重复,9:停止合作)*/
@Excel(name = "合作状态(1:首次,2:重复,9:停止合作)", width = 15)
@ApiModelProperty(value = "合作状态(1:首次,2:重复,9:停止合作)")
@Dict(dicCode = "cooperate_status")
private String cooperateStatus;
/**是否购置保险*/
@Excel(name = "是否购置保险", width = 15)
@ApiModelProperty(value = "是否购置保险")
@Dict(dicCode = "yn")
private String buyInsure;
/**员工人数*/
@Excel(name = "员工人数", width = 15)
@ApiModelProperty(value = "员工人数")
@TableField(exist = false)
private Integer staffNum;
/**经纬度*/
@Excel(name = "经纬度", width = 15)
......
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.core.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -41,6 +42,7 @@ public class EpibolyOuterStaff {
/**关联外协单位ID*/
@Excel(name = "外协类型", width = 15)
@ApiModelProperty(value = "外协类型:1 单位合作;2 个人合作")
@Dict(dicCode = "cooperate_type")
private String cooperateType;
......@@ -51,6 +53,7 @@ public class EpibolyOuterStaff {
/**性别(0-默认未知,1-男,2-女)*/
@Excel(name = "性别(0-默认未知,1-男,2-女)", width = 15)
@ApiModelProperty(value = "性别(0-默认未知,1-男,2-女)")
@Dict(dicCode = "sex")
private Integer sex;
/**电子邮件*/
@Excel(name = "电子邮件", width = 15)
......
package com.skua.modules.safe.mapper;
import java.util.List;
import com.skua.modules.safe.entity.EpibolyCertificate;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 外协相关证件
*/
public interface EpibolyCertificateMapper extends BaseMapper<EpibolyCertificate> {
/***
* 根据外协单位编号获取外协相关证件的的集合
* @param companyId
* @return
*/
public List<EpibolyCertificate> queryByCompanyId(@Param("companyId") String companyId);
/***
* 根据外协单位编号,删除相关记录
* @param companyId
*/
public void deleteByCompanyId(@Param("companyId") String companyId);
}
package com.skua.modules.safe.mapper;
import com.skua.modules.safe.vo.EpibolyCompanyVO;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.safe.entity.EpibolyCompany;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 外协单位表
*/
public interface EpibolyCompanyMapper extends BaseMapper<EpibolyCompany> {
/***
* 根据id 查询外协单位关联所有的数据
* @param id
* @return
*/
public EpibolyCompanyVO queryById( @Param("id") String id);
}
package com.skua.modules.safe.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.safe.entity.EpibolyContract;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 外协合同表
*/
public interface EpibolyContractMapper extends BaseMapper<EpibolyContract> {
/***
* 根据外协单位编号获取外协合同的的集合
* @param companyId
* @return
*/
public List<EpibolyContract> queryByCompanyId(@Param("companyId") String companyId);
/***
* 根据外协单位编号,删除相关记录
* @param companyId
*/
public void deleteByCompanyId(@Param("companyId") String companyId);
}
package com.skua.modules.safe.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.safe.entity.EpibolyOuterStaff;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 外协员工表
*/
public interface EpibolyOuterStaffMapper extends BaseMapper<EpibolyOuterStaff> {
/***
* 根据外协单位编号获取外协员工的的集合
* @param companyId
* @return
*/
public List<EpibolyOuterStaff> queryByCompanyId(@Param("companyId") String companyId);
/***
* 设置外协的单位的员工人数
* @param companyId
*/
public void updateCompanyStaffNum(@Param("companyId") String companyId);
/**
* 根据外协单位编号,删除相关记录
* @param companyId
*/
public void deleteByCompanyId(@Param("companyId")String companyId);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.safe.mapper.EpibolyCertificateMapper">
<!-- 根据外协单位编号获取外协员工的的集合 -->
<select id="queryByCompanyId" resultType="com.skua.modules.safe.entity.EpibolyCertificate">
select t.* from where epiboly_certificate t where t.company_id =#{companyId}
</select>
<!-- 根据外协单位编号,删除相关记录-->
<delete id="deleteByCompanyId" >
delete from epiboly_certificate where company_id =#{companyId}
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.safe.mapper.EpibolyCompanyMapper">
<select id="queryById" resultType="com.skua.modules.safe.vo.EpibolyCompanyVO">
select * from epiboly_company where id = #{id}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.safe.mapper.EpibolyContractMapper">
<!-- 根据外协单位编号获取外协员工的的集合 -->
<select id="queryByCompanyId" resultType="com.skua.modules.safe.entity.EpibolyContract">
select t.* from where epiboly_contract t where t.company_id =#{companyId}
</select>
<!-- 根据外协单位编号,删除相关记录-->
<delete id="deleteByCompanyId" >
delete from epiboly_contract where company_id =#{companyId}
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.safe.mapper.EpibolyOuterStaffMapper">
<!-- 根据外协单位编号获取外协员工的的集合 -->
<select id="queryByCompanyId" resultType="com.skua.modules.safe.entity.EpibolyOuterStaff">
select t.* from where epiboly_outer_staff t where t.company_id =#{companyId}
</select>
<!-- 修改外协单位人员数量-->
<update id="updateCompanyStaffNum" >
update epiboly_company c set c.staff_num = (select count(1) from epiboly_outer_staff eos where eos.company_id = #{companyId} ) where c.id = #{companyId}
</update>
<!-- 根据外协单位编号,删除相关记录-->
<delete id="deleteByCompanyId" >
delete from epiboly_outer_staff where company_id =#{companyId}
</delete>
</mapper>
\ No newline at end of file
package com.skua.modules.safe.service;
import com.skua.modules.safe.entity.EpibolyCertificate;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 外协相关证件
*/
public interface IEpibolyCertificateService extends IService<EpibolyCertificate> {
}
package com.skua.modules.safe.service;
import com.skua.modules.safe.entity.EpibolyCompany;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.safe.vo.EpibolyCompanyVO;
import java.util.List;
/**
* 外协单位表
*/
public interface IEpibolyCompanyService extends IService<EpibolyCompany> {
/***
* 获取外协单位对象、外协相关证件集合、外协合同集合、外协人员集合
* @param companyId 外协单位编号
* @return
*/
public EpibolyCompanyVO queryByCompanyId(String companyId);
/***
* 根据部门编号获取,部门下的所有外协单位集合
* @param departId
* @return
*/
public List<EpibolyCompany> queryListByDepartId(String departId);
/***
* 根据id删除:外协单位、合同、证书、人员等信息
* @param id
*/
public void delById(String id);
}
package com.skua.modules.safe.service;
import com.skua.modules.safe.entity.EpibolyContract;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 外协合同表
*/
public interface IEpibolyContractService extends IService<EpibolyContract> {
}
package com.skua.modules.safe.service;
import com.skua.modules.safe.entity.EpibolyOuterStaff;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 外协员工表
*/
public interface IEpibolyOuterStaffService extends IService<EpibolyOuterStaff> {
/***
* 新增外协人员表
* @param epibolyOuterStaff
*/
public void saveEpibolyOuterStaff(EpibolyOuterStaff epibolyOuterStaff);
/***
* 删除外协人员
* @param id
*/
public void delById(String id);
/***
* 批量删除,同步外协单位的人数
* @param idList
*/
public void deleteBatch(List<String> idList);
}
package com.skua.modules.safe.service.impl;
import com.skua.modules.safe.entity.EpibolyCertificate;
import com.skua.modules.safe.mapper.EpibolyCertificateMapper;
import com.skua.modules.safe.service.IEpibolyCertificateService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 外协相关证件
*/
@Service
public class EpibolyCertificateServiceImpl extends ServiceImpl<EpibolyCertificateMapper, EpibolyCertificate> implements IEpibolyCertificateService {
}
package com.skua.modules.safe.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.skua.modules.safe.entity.EpibolyCertificate;
import com.skua.modules.safe.entity.EpibolyCompany;
import com.skua.modules.safe.entity.EpibolyContract;
import com.skua.modules.safe.entity.EpibolyOuterStaff;
import com.skua.modules.safe.mapper.EpibolyCertificateMapper;
import com.skua.modules.safe.mapper.EpibolyCompanyMapper;
import com.skua.modules.safe.mapper.EpibolyContractMapper;
import com.skua.modules.safe.mapper.EpibolyOuterStaffMapper;
import com.skua.modules.safe.service.IEpibolyCompanyService;
import com.skua.modules.safe.vo.EpibolyCompanyVO;
import com.skua.modules.system.entity.SysAnnouncementSend;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* 外协单位表
*/
@Service
public class EpibolyCompanyServiceImpl extends ServiceImpl<EpibolyCompanyMapper, EpibolyCompany> implements IEpibolyCompanyService {
@Resource
private EpibolyCompanyMapper companyMapper; //外协单位
@Resource
private EpibolyCertificateMapper certificateMapper; //外协相关证件
@Resource
private EpibolyContractMapper contractMapper;//外协合同
@Resource
private EpibolyOuterStaffMapper outerStaffMapper;//外协人员
/***
* 获取外协单位对象、外协相关证件集合、外协合同集合、外协人员集合
* @param companyId 外协单位编号
* @return
*/
public EpibolyCompanyVO queryByCompanyId(String companyId){
EpibolyCompanyVO epibolyCompanyVO = companyMapper.queryById(companyId);
//外协相关证件
List<EpibolyCertificate> certificateList = certificateMapper.queryByCompanyId(companyId);
//外协合同
List<EpibolyContract> contractList = contractMapper.queryByCompanyId(companyId);
//外协人员
List<EpibolyOuterStaff> outerStaffList = outerStaffMapper.queryByCompanyId(companyId);
if(epibolyCompanyVO != null ){
epibolyCompanyVO.setEpibolyCertificateList( certificateList );
epibolyCompanyVO.setEpibolyContractList( contractList );
epibolyCompanyVO.setEpibolyOuterStaffList( outerStaffList );
}
return epibolyCompanyVO;
}
/***
* 根据部门编号获取,部门下的所有外协单位集合
* @param departId
* @return
*/
public List<EpibolyCompany> queryListByDepartId(String departId){
LambdaQueryWrapper<EpibolyCompany> queryWrapper = new LambdaQueryWrapper<EpibolyCompany>();
queryWrapper.eq(EpibolyCompany::getDepartId, departId);
List<EpibolyCompany> epibolyCompanyList = companyMapper.selectList(queryWrapper);
return epibolyCompanyList;
}
/***
* 根据id删除:外协单位、合同、证书、人员等信息
* @param companyId
*/
@Transactional
public void delById(String companyId){
certificateMapper.deleteByCompanyId(companyId);
contractMapper.deleteByCompanyId(companyId);
outerStaffMapper.deleteByCompanyId(companyId);
companyMapper.deleteById(companyId );
}
}
package com.skua.modules.safe.service.impl;
import com.skua.modules.safe.entity.EpibolyContract;
import com.skua.modules.safe.mapper.EpibolyContractMapper;
import com.skua.modules.safe.service.IEpibolyContractService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 外协合同表
*/
@Service
public class EpibolyContractServiceImpl extends ServiceImpl<EpibolyContractMapper, EpibolyContract> implements IEpibolyContractService {
}
package com.skua.modules.safe.service.impl;
import com.skua.modules.safe.entity.EpibolyOuterStaff;
import com.skua.modules.safe.mapper.EpibolyOuterStaffMapper;
import com.skua.modules.safe.service.IEpibolyOuterStaffService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 外协员工表
*/
@Service
public class EpibolyOuterStaffServiceImpl extends ServiceImpl<EpibolyOuterStaffMapper, EpibolyOuterStaff> implements IEpibolyOuterStaffService {
@Override
@Transactional
public void saveEpibolyOuterStaff(EpibolyOuterStaff epibolyOuterStaff) {
this.baseMapper.insert(epibolyOuterStaff);
/***
* 修改外协单位的员工人数
*/
if(epibolyOuterStaff.getCompanyId() != null ){
this.baseMapper.updateCompanyStaffNum( epibolyOuterStaff.getCompanyId() );
}
}
/***
* 删除外协人员,同步外协人员数量
* @param id
*/
public void delById(String id){
EpibolyOuterStaff epibolyOuterStaff = this.baseMapper.selectById(id);
this.baseMapper.deleteById(id);//根据编号删除人员记录
if(epibolyOuterStaff != null && epibolyOuterStaff.getCompanyId() != null ){
this.baseMapper.updateCompanyStaffNum( epibolyOuterStaff.getCompanyId() );
}
}
/***
* 批量删除,同步外协单位的人数
* @param idList
*/
public void deleteBatch(List<String> idList){
EpibolyOuterStaff epibolyOuterStaff = null;
if(idList != null && !idList.isEmpty()){
epibolyOuterStaff = this.baseMapper.selectById(idList.get(0));
}
//批量删除外协员工
this.baseMapper.deleteBatchIds(idList);
//同步外协单位人员数量
if(epibolyOuterStaff != null && epibolyOuterStaff.getCompanyId() != null ){
this.baseMapper.updateCompanyStaffNum( epibolyOuterStaff.getCompanyId() );
}
}
}
package com.skua.modules.safe.vo;
import com.skua.modules.safe.entity.EpibolyCertificate;
import com.skua.modules.safe.entity.EpibolyContract;
import com.skua.modules.safe.entity.EpibolyOuterStaff;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.util.List;
/**
* 外协单位表
*/
@Data
@ApiModel(value="epiboly_company数据传输对象", description="外协单位表")
public class EpibolyCompanyVO {
/**主键*/
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**关联部门编号*/
@Excel(name = "关联部门编号", width = 15)
@ApiModelProperty(value = "关联部门编号")
private java.lang.String departId;
/**公司名称*/
@Excel(name = "公司名称", width = 15)
@ApiModelProperty(value = "公司名称")
private java.lang.String companyName;
/**法定代表人*/
@Excel(name = "法定代表人", width = 15)
@ApiModelProperty(value = "法定代表人")
private java.lang.String legalPerson;
/**法人电话*/
@Excel(name = "法人电话", width = 15)
@ApiModelProperty(value = "法人电话")
private java.lang.String egalPhone;
/**公司地址*/
@Excel(name = "公司地址", width = 15)
@ApiModelProperty(value = "公司地址")
private java.lang.String companyAddress;
/**注册日期*/
@Excel(name = "注册日期", width = 15)
@ApiModelProperty(value = "注册日期")
private java.lang.String registerDate;
/**签订时间*/
@Excel(name = "签订时间", width = 15)
@ApiModelProperty(value = "签订时间")
private java.lang.String docuDate;
/**合同到期时间*/
@Excel(name = "合同到期时间", width = 15)
@ApiModelProperty(value = "合同到期时间")
private java.lang.String expireDate;
/**经营范围*/
@Excel(name = "经营范围", width = 15)
@ApiModelProperty(value = "经营范围")
private java.lang.String businessScope;
/**合作状态(1:首次,2:重复,9:停止合作)*/
@Excel(name = "合作状态(1:首次,2:重复,9:停止合作)", width = 15)
@ApiModelProperty(value = "合作状态(1:首次,2:重复,9:停止合作)")
private java.lang.String cooperateStatus;
/**是否购置保险*/
@Excel(name = "是否购置保险", width = 15)
@ApiModelProperty(value = "是否购置保险")
private java.lang.String buyInsure;
/**员工人数*/
@Excel(name = "员工人数", width = 15)
@ApiModelProperty(value = "员工人数")
private java.lang.Integer staffNum;
/**经纬度*/
@Excel(name = "经纬度", width = 15)
@ApiModelProperty(value = "经纬度")
private java.lang.String latitudeLongitude;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private java.lang.String remark;
/**创建部门*/
@Excel(name = "创建部门", width = 15)
@ApiModelProperty(value = "创建部门")
private java.lang.String createDept;
/**创建人*/
@Excel(name = "创建人", width = 15)
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@Excel(name = "更新人", width = 15)
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@Excel(name = "更新日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**删除状态(0,正常,1已删除)*/
@Excel(name = "删除状态(0,正常,1已删除)", width = 15)
@ApiModelProperty(value = "删除状态(0,正常,1已删除)")
private java.lang.String delFlag;
/** 删除状态(0,正常,1已删除)*/
@ApiModelProperty(value = "外协相关证件集合")
private List<EpibolyCertificate> epibolyCertificateList ;//外协相关证件
/**删除状态(0,正常,1已删除)*/
@ApiModelProperty(value = "外协合同表")
private List<EpibolyContract> epibolyContractList ;//外协合同表
/**删除状态(0,正常,1已删除)*/
@ApiModelProperty(value = "外协员工表")
private List<EpibolyOuterStaff> epibolyOuterStaffList ;//外协员工表
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!