add 增加标协会议时,同步到会员系统

This commit is contained in:
lijiarao
2021-09-06 20:24:32 +08:00
parent 2ef4b82c02
commit 3944009ba5
39 changed files with 2715 additions and 10 deletions
@@ -299,4 +299,9 @@ public interface ISysBaseAPI extends CommonAPI {
*/
List<SysDepartTreeModel> listSonDepartsByDepId(String departId);
/**
* 根据文件id获取文件名称
*/
String findFileNameByFileId(String fileId);
}
@@ -140,4 +140,31 @@ public class Result<T> implements Serializable {
@JsonIgnore
private String onlTable;
public static final String OPERATING_SUCCESS = "操作成功!";
public static final String SELECT_SUCCESS = "查询成功!";
public static final String ADD_SUCCESS = "新增成功!";
public static final String EDIT_SUCCESS = "编辑成功!";
public static final String DELETE_SUCCESS = "删除成功!";
public static final String UPLOAD_SUCCESS = "上传成功!";
public static final String EXPORT_SUCCESS = "导出成功!";
public static final String IMPORT_SUCCESS = "导入成功!";
public static final String DOWNLOAD_SUCCESS = "下载成功!";
public static final String SYSTEM_IS_BUSY = "系统繁忙!";
public static final String OPERATING_ERROR = "操作失败!";
public static final String NULL_ID = "请核实主键是否存在!";
public static final String NULL_NAME = "请核实名称是否存在!";
public static final String NULL_DATA = "请核实数据是否存在!";
}
@@ -0,0 +1,164 @@
package com.jero.common.util;
import com.jero.common.util.superSearch.ConstantUtils;
import lombok.extern.slf4j.Slf4j;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 断言工具类
*
* @author 张星星
* @date 2021-01-09
*/
@Slf4j
public class Assert {
private Assert() {
}
/**
* 正数11位,小数2位,长度14位 11111111111.22
*
* @param s 待检查金额
*/
public static boolean checkMoney(String s) {
Pattern pattern = Pattern.compile(ConstantUtils.MONEY);
Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
return false;
}
return true;
}
/**
* 15位、18位、20位数字和大写英文字母
*
* @param s 待检查税号
*/
public static boolean checkTax(String s) {
Pattern pattern = Pattern.compile(ConstantUtils.TAX);
Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
return false;
}
return true;
}
/**
* @param s 待检查邮编
*/
public static boolean checkPostCode(String s) {
Pattern pattern = Pattern.compile(ConstantUtils.POSTCODE);
Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
return false;
}
return true;
}
/**
* 检查邮箱
*
* @param s 待检查邮箱
*/
public static boolean isEmail(String s) {
Pattern pattern = Pattern.compile(ConstantUtils.EMAIL_REGEX);
Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
return false;
}
return true;
}
/**
* 口令长度至少8位,并包括数字、小写字母、大写字母和特殊符号4类中至少3类
*
* @param s 密码
*/
public static boolean checkPassword(String s) {
Pattern pattern = Pattern.compile(ConstantUtils.PASSWORD);
Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
return false;
}
return true;
}
/**
* 检查网址
*
* @param s 待检查网址
*/
public static boolean iswebsit(String s) {
Pattern pattern = Pattern.compile(ConstantUtils.WEBSITE);
Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
return false;
}
return true;
}
/**
* 检查字符串是手机号
*
* @param s 待检查手机号
*/
public static boolean isTel(String s) {
Pattern pattern = Pattern.compile(ConstantUtils.TEL_PHONE);
Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
return false;
}
return true;
}
/**
* 例:022-12354678
*
* @param s 座机
*/
public static boolean checkZUOJI(String s) {
Pattern pattern = Pattern.compile(ConstantUtils.ZUOJI);
Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
return false;
}
return true;
}
/**
* 该方法有问题_暂时先不要使用
* @param strParameter 字符串
* @param limitLength 限制长度
* @return
*/
// public static boolean valiDataStrByLength(String strParameter, int limitLength) {
// int temp_int = 0;
// byte[] b = strParameter.getBytes();
// for (int i = 0; i < b.length; i++) {
// if (b[i] >= 0) {
// temp_int = temp_int + 1;
// } else {
// temp_int = temp_int + 2;
// i++;
// }
// }
// if (temp_int > limitLength) {
// return false;
// } else {
// return true;
// }
// }
}
@@ -0,0 +1,60 @@
package com.jero.common.util;
import com.jero.common.system.base.entity.JeroEntity;
import java.util.Date;
/**
* @Author: WangHK
* @ClassNameBaseUtil
* @Company: 天津柒柒普惠服务外包有限公司
* @Date: 2019-12-21 11:17
* @Description:
*/
public class BaseUtil {
/**
* 新增封装
* @param object 任意继承JeroEntity的对象
* @param userId token解析得到的id
*/
public static void create(Object object, String userId){
//要被封装的对象
JeroEntity jeroEntity = (JeroEntity) object;
//封装创建人
jeroEntity.setCreateBy(userId);
//封装创建时间
jeroEntity.setCreateTime(new Date());
//封装修改人
jeroEntity.setUpdateBy(userId);
//封装修改时间
jeroEntity.setUpdateTime(new Date());
}
/**
* 修改封装
* @param db 查询数据库得到的对象
* @param object 任意继承JeroEntity的对象
* @param userId token解析得到的id
*/
public static void update(Object db,Object object, String userId){
JeroEntity baseDb = (JeroEntity) db;//查询数据库得到的对象
JeroEntity jeroEntity = (JeroEntity) object;//要被封装的对象
jeroEntity.setCreateBy(baseDb.getCreateBy());//封装创建人
jeroEntity.setCreateTime(baseDb.getCreateTime());//封装创建时间
jeroEntity.setUpdateBy(userId);//封装修改人
jeroEntity.setUpdateTime(new Date());//封装修改时间
}
/**
* 删除封装
* @param object 任意继承JeroEntity的对象
* @param userId token解析得到的id
*/
public static void delete(Object object, String userId) {
JeroEntity jeroEntity = (JeroEntity) object;//要被封装的对象
jeroEntity.setUpdateBy(userId);//封装修改人
jeroEntity.setUpdateTime(new Date());//封装修改时间
}
}
@@ -0,0 +1,28 @@
package com.jero.common.util;
import org.apache.commons.lang3.StringUtils;
/**
* 去除文件名结尾时间戳工具类
*
* @author liJiaRao
* @date 2021-06-17 10:32
*/
public class FileNameSeparateUtil {
/**
* 除文件名结尾时间戳
*
* @param fileName 带时间戳的文件名
* @return 文件名
*/
public static String removeTimeStamp(String fileName) {
String str = fileName;
if (StringUtils.isNotBlank(fileName) && fileName.contains("_")) {
int lastIndexOf = fileName.lastIndexOf("_");
if (lastIndexOf != -1) {
str = fileName.substring(0, fileName.lastIndexOf("_")) + fileName.substring(fileName.lastIndexOf("."));
}
}
return str;
}
}
@@ -1,7 +1,9 @@
package com.jero.common.util;
import com.jero.common.exception.JeroBootException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import com.jero.common.api.CommonAPI;
import com.jero.common.constant.CommonConstant;
@@ -124,5 +126,15 @@ public class TokenUtils {
}
return true;
}
/**
* 通过token获取User
*/
public static LoginUser getUserByToken() {
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//判断Entity是否存在
if (user == null) {
throw new JeroBootException("登录超时,请重新登录!");
}
return user;
}
}
@@ -0,0 +1,20 @@
package com.jero.common.util;
import org.apache.commons.lang.StringUtils;
/**
* 特殊符号替换
*/
public class charReplaceUtil {
public static String charReplace(String character) {
if (StringUtils.isNotBlank(character)){
character=character.replace("*", "\\*")
.replace("%", "\\%")
.replaceAll("_", "\\\\_");
}
return character;
}
}
@@ -0,0 +1,43 @@
package com.jero.common.util.superSearch;
/**
* 常量
*
* @author 张星星
* @date 2021-01-09
*/
public class ConstantUtils {
private ConstantUtils() {
}
//检查金额
public static final String EMAIL_REGEX = "^[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w]" +
"(?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?$";
//金额
public static final String MONEY = "^[1-9](\\d{1,10})?(\\.\\d{1,2})$|^0\\.([1-9](\\d{0,1})|\\d[1-9])$|^[1-9]\\d{0,10}$|^0$";
//税号
public static final String TAX = "^[A-Z0-9]{15}$|^[A-Z0-9]{18}$|^[A-Z0-9]{20}$";
//邮编
public static final String POSTCODE = "^[0-9]\\d{5}$";
//密码 口令长度至少8位,并包括数字、小写字母、大写字母和特殊符号4类中至少3类
public static final String PASSWORD = "^(?=.*[a-zA-Z])(?=.*\\d)(?=.*[~!@#$%^&*()_+`\\-={}:\";'<>?,./]).{8,30}$";
//网址
public static final String WEBSITE = "^((https|http|ftp|rtsp|mms)?:\\/\\/)[^\\s]+";
// public static final String WEBSITE = "^([hH][tT]{2}[pP]:/*|[hH][tT]{2}[pP][sS]:/*|[fF][tT][pP]:/*)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\\\\/])+(\\\\?{0,1}(([A-Za-z0-9-~]+\\\\={0,1})([A-Za-z0-9-~]*)\\\\&{0,1})*)$";
//检查字符串是手机号
public static final String TEL_PHONE = "^[1][3,4,5,6,7,8,9][0-9]{9}$";
// public static final String TEL_PHONE = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9])|(16[6]))\\d{8}$";
//座机号
public static final String ZUOJI = "^0\\d{2,3}-?\\d{7,8}$";
// public static final String ZUOJI = "^\\d{3}-\\d{7,8}|\\d{4}-\\d{7,8}$";
}
@@ -18,6 +18,7 @@ import com.jero.meeting.valid.group.WorkingGroupMeeting;
import com.jero.meeting.vo.PayMeetingVO;
import com.jero.project.entity.PayWorkingGroup;
import com.jero.project.service.IPayWorkingGroupService;
import com.jero.standards.xuanguan.stablecrosstraining.service.IStableCrossTrainingService;
import org.apache.shiro.util.CollectionUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils;
@@ -47,6 +48,8 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
private IPayMeetingHotelContactsService meetingHotelContactsService;
@Resource
private IPayWorkingGroupService payWorkingGroupService;
@Resource
private IStableCrossTrainingService stableCrossTrainingService;
/**
* 新增会议
*/
@@ -64,6 +67,9 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
);
meetingHotelContactsService.saveBatch(hotelContactsList);
}
if (payMeeting.getMeetingType().equals(Integer.parseInt(MeetingCommon.STANDARD_MEETING))) {
stableCrossTrainingService.push(payMeeting,hotelContactsList);
}
}
/**
@@ -86,6 +92,7 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
);
meetingHotelContactsService.saveBatch(hotelContactsList);
}
}
@NotNull
@@ -0,0 +1,36 @@
package com.jero.standards.jiudian.hotelManagement.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.base.controller.JeroController;
import com.jero.standards.jiudian.hotelManagement.entity.HotelManagement;
import com.jero.standards.jiudian.hotelManagement.service.IHotelManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @Description: 酒店信息管理
* @Author: jeecg-boot
* @Date: 2021-05-10
* @Version: V1.0
*/
@Api(tags = "酒店信息管理")
@RestController
@RequestMapping("/hotelManagement/hotelManagement")
@Slf4j
public class HotelManagementController extends JeroController<HotelManagement, IHotelManagementService> {
}
@@ -0,0 +1,118 @@
package com.jero.standards.jiudian.hotelManagement.entity;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jero.common.system.base.entity.JeroEntity;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.validator.constraints.Length;
import com.jero.standards.jiudian.hotelcontact.entity.HotelContact;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 酒店信息管理
* @Author: jeecg-boot
* @Date: 2021-05-10
* @Version: V1.0
*/
@Data
@TableName("web_hotel_management")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="web_hotel_management对象", description="酒店信息管理")
public class HotelManagement extends JeroEntity {
private static final long serialVersionUID = 1L;
@Excel(name = "会议主题", width = 15)
@ApiModelProperty(value = "会议主题")
@TableField("conference_theme")
private String conferenceTheme;
@Excel(name = "召开时间", width = 20)
@ApiModelProperty(value = "召开时间")
@TableField("hold_time")
private String holdTime;
@Excel(name = "召开地点", width = 15)
@ApiModelProperty(value = "召开地点名称")
@TableField("place_name")
private String placeName;
@ApiModelProperty(value = "召开地点码")
@TableField("place")
private String place;
@Excel(name = "酒店名称", width = 15)
@ApiModelProperty(value = "酒店名称")
@TableField("hotel_name")
private String hotelName;
@Excel(name = "酒店地址", width = 15)
@ApiModelProperty(value = "地址")
@TableField("address")
private String address;
@Excel(name = "联系人", width = 15)
@ApiModelProperty(value = "联系人")
// @TableField("contact_person")
@TableField(exist = false)
private String contactPerson;
@Excel(name = "联系电话", width = 15)
@ApiModelProperty(value = "联系电话")
// @TableField("telephone_number")
@TableField(exist = false)
private String telephoneNumber;
// @Excel(name = "召开开始时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "召开开始时间")
@TableField("convoke_start_time")
private Date convokeStartTime;
// @Excel(name = "召开结束时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "召开结束时间")
@TableField("convoke_end_time")
private Date convokeEndTime;
@ApiModelProperty("宣贯培训外键")
@Length(max = 50)
@TableField("training_id")
private String trainingId;
@ApiModelProperty("1.宣贯, 2.年会")
@Length(max = 50)
@TableField("meeting_type")
private Integer meetingType;
@Excel(name = "管理员", width = 15)
@ApiModelProperty(value = "管理员")
@TableField(exist = false)
private String administrator;
@ApiModelProperty("培训类型名称")
@TableField(exist = false)
private String meetingTypeName;
@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")
@TableField(exist = false)
private Date updateTimes;
@ApiModelProperty(value = "酒店联系人集合")
@TableField(exist = false)
private List<HotelContact> hotelList;
}
@@ -0,0 +1,33 @@
package com.jero.standards.jiudian.hotelManagement.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import com.jero.standards.jiudian.hotelManagement.entity.HotelManagement;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* @Description: 酒店信息管理
* @Author: jeecg-boot
* @Date: 2021-05-10
* @Version: V1.0
*/
@Repository
public interface HotelManagementMapper extends BaseMapper<HotelManagement> {
/**
* 分页列表查询
*/
Page<HotelManagement> queryPageList(@Param("page") Page<HotelManagement> page,
@Param("hotelManagement") HotelManagement hotelManagement,
@Param("column") String column,
@Param("order") String order) throws Exception;
/**
* 根据会议id查询酒店
*/
HotelManagement getHotelInfoByMeetingId(@Param("id") String id);
}
@@ -0,0 +1,69 @@
<?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.jero.standards.jiudian.hotelManagement.mapper.HotelManagementMapper">
<sql id="Base_Column">
${alias}.id AS id ,
${alias}.conference_theme AS conferenceTheme ,<!--会议主题"-->
${alias}.place AS place ,<!--召开地点-->
${alias}.place_name AS placeName ,<!--召开地点名称-->
${alias}.hold_time AS holdTime ,<!--召开时间-->
${alias}.convoke_start_time AS convokeStartTime ,<!--召开开始时间-->
${alias}.convoke_end_time AS convokeEndTime ,<!--召开结束时间-->
${alias}.hotel_name AS hotelName ,<!--酒店名称-->
${alias}.address AS address ,<!--地址-->
${alias}.contact_person AS contactPerson ,<!--联系人-->
${alias}.telephone_number AS telephoneNumber ,<!--联系电话-->
${alias}.training_id AS trainingId ,<!--宣贯培训外键-->
${alias}.meeting_type AS meetingType ,<!--1.宣贯, 2.年会-->
${alias}.create_by AS createBy ,
${alias}.create_time AS createTime ,
${alias}.update_by AS updateBy ,
${alias}.update_time AS updateTime,
${alias}.update_time AS updateTimes
</sql>
<!-- 分页列表查询-->
<select id="queryPageList" resultType="com.jero.standards.jiudian.hotelManagement.entity.HotelManagement">
SELECT
<include refid="Base_Column">
<property name="alias" value="a"/>
</include>,
CASE a.meeting_type WHEN 1 THEN '宣贯' WHEN 2 THEN '年会' ELSE '' END AS meetingTypeName,<!--1.宣贯, 2.年会-->
b.realname as administrator
FROM
web_hotel_management a
LEFT JOIN sys_user b ON a.update_by = b.id
<where>
1 = 1
<!-- 召开地点 -->
<if test="hotelManagement.place !=null and hotelManagement.place != ''">
AND a.place = #{hotelManagement.place}
</if>
<!-- 会议名称 -->
<if test="hotelManagement.conferenceTheme !=null and hotelManagement.conferenceTheme != ''">
AND a.conference_theme LIKE CONCAT('%',#{hotelManagement.conferenceTheme},'%')
</if>
</where>
<choose>
<when test="column !=null and column != '' and order !=null and order != ''">
ORDER BY a.${column} ${order}
</when>
<otherwise>
ORDER BY a.create_time DESC
</otherwise>
</choose>
</select>
<!-- 根据会议id查询酒店-->
<select id="getHotelInfoByMeetingId" resultType="com.jero.standards.jiudian.hotelManagement.entity.HotelManagement">
select
<include refid="Base_Column">
<property name="alias" value="a"/>
</include>
from web_hotel_management a
where a.training_id = #{id}
</select>
</mapper>
@@ -0,0 +1,38 @@
package com.jero.standards.jiudian.hotelManagement.service;
import com.jero.standards.jiudian.hotelManagement.entity.HotelManagement;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @Description: 酒店信息管理
* @Author: jeecg-boot
* @Date: 2021-05-10
* @Version: V1.0
*/
public interface IHotelManagementService extends IService<HotelManagement> {
/**
* 添加
*/
Boolean add(HotelManagement hotelManagement);
/**
* 编辑
*/
Boolean edit(HotelManagement hotelManagement) throws Exception;
/**
* 根据会议id查询酒店
*/
HotelManagement getHotelInfoByMeetingId(String id);
/**
* 导出酒店信息Excel
*/
ModelAndView export(List<?> exportList, Class<?> exportClass, String title, HttpServletResponse response);
}
@@ -0,0 +1,182 @@
package com.jero.standards.jiudian.hotelManagement.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.util.BaseUtil;
import com.jero.common.util.TokenUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.vo.LoginUser;
import com.jero.standards.jiudian.hotelManagement.entity.HotelManagement;
import com.jero.standards.jiudian.hotelManagement.mapper.HotelManagementMapper;
import com.jero.standards.jiudian.hotelManagement.service.IHotelManagementService;
import com.jero.standards.jiudian.hotelcontact.service.IHotelContactService;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.List;
/**
* @Description: 酒店信息管理
* @Author: jeecg-boot
* @Date: 2021-05-10
* @Version: V1.0
*/
@Service
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
@DS(value = "multi-datasource1")
public class HotelManagementServiceImpl extends ServiceImpl<HotelManagementMapper, HotelManagement> implements IHotelManagementService {
@Autowired
private ISysBaseAPI sysBaseAPI;
@Autowired
private IHotelManagementService hotelManagementService;
@Autowired
private HotelManagementMapper hotelManagementMapper;
@Autowired
private IHotelContactService hotelContactService;
/**
* 添加
*/
@Override
public Boolean add(HotelManagement hotelManagement) {
if (hotelManagement == null) {
throw new JeroBootException(Result.NULL_DATA);
}
Boolean resFlag = Boolean.TRUE;
this.ifEntityIsEmpty(hotelManagement);
try {
//获取召开时间
this.isZhi(hotelManagement);
LoginUser user = TokenUtils.getUserByToken();
//创建时间/创建人/修改时间/修改人
BaseUtil.create(hotelManagement, user.getId());
}catch (Exception e){
throw new JeroBootException(e);
}
resFlag = hotelManagementService.save(hotelManagement);
if (!resFlag) {
throw new JeroBootException(Result.OPERATING_ERROR);
}
return hotelContactService.edit(hotelManagement);
}
/**
* 编辑
*/
@Override
public Boolean edit(HotelManagement hotelManagement) throws Exception {
//判断主键是否存在
if (StringUtils.isBlank(hotelManagement.getId())) {
throw new JeroBootException(Result.NULL_ID);
}
//判断Entity是否存在
if (hotelManagement == null) {
throw new JeroBootException(Result.NULL_DATA);
}
HotelManagement hotelManagementDB = hotelManagementService.getById(hotelManagement.getId());
//获取召开时间
this.isZhi(hotelManagement);
Boolean resFlag = Boolean.TRUE;
LambdaUpdateWrapper<HotelManagement> updateWrapper = new LambdaUpdateWrapper();
updateWrapper.eq(HotelManagement::getId, hotelManagement.getId())
.set(StringUtils.isNotBlank(hotelManagement.getConferenceTheme()), HotelManagement::getConferenceTheme, hotelManagement.getConferenceTheme())
.set(StringUtils.isNotBlank(hotelManagement.getHoldTime()), HotelManagement::getHoldTime, hotelManagement.getHoldTime())
.set(StringUtils.isNotBlank(hotelManagement.getPlace()), HotelManagement::getPlace, hotelManagement.getPlace())
.set(StringUtils.isNotBlank(hotelManagement.getPlaceName()), HotelManagement::getPlaceName, hotelManagement.getPlaceName())
.set(StringUtils.isNotBlank(hotelManagement.getHotelName()), HotelManagement::getHotelName, hotelManagement.getHotelName())
.set(StringUtils.isNotBlank(hotelManagement.getAddress()), HotelManagement::getAddress, hotelManagement.getAddress())
// .set(StringUtils.isNotBlank(hotelManagement.getContactPerson()), HotelManagement::getContactPerson, hotelManagement.getContactPerson())
// .set(StringUtils.isNotBlank(hotelManagement.getTelephoneNumber()), HotelManagement::getTelephoneNumber, hotelManagement.getTelephoneNumber())
.set(null != hotelManagement.getMeetingType(), HotelManagement::getMeetingType, hotelManagement.getMeetingType())
.set(HotelManagement::getUpdateBy, hotelManagement.getUpdateBy())//修改人
.set(HotelManagement::getUpdateTime, hotelManagement.getUpdateTime());//修改时间
resFlag = hotelManagementService.update(updateWrapper);
if (!resFlag) {
throw new JeroBootException(Result.OPERATING_ERROR);
}
return hotelContactService.edit(hotelManagement);
}
public void ifEntityIsEmpty(HotelManagement hotelManagement) {
if (StringUtils.isBlank(hotelManagement.getHotelName())) {
throw new JeroBootException("请核实酒店名称是否存在!");
} else {
if (hotelManagement.getHotelName().length()>50) {
throw new JeroBootException("酒店名称输入超过限定长度!");
}
}
if (StringUtils.isBlank(hotelManagement.getAddress())) {
throw new JeroBootException("请核实酒店地址是否存在!");
} else {
if (hotelManagement.getAddress().length()>50) {
throw new JeroBootException("酒店地址输入超过限定长度!");
}
}
if (hotelManagement.getHotelList().isEmpty()) {
throw new JeroBootException("请核实酒店联系人/电话是否存在!");
}
/* if (hotelManagement.getHotelList().isEmpty()) {
throw new JeroBootException("请核实酒店联系人/电话是否存在!");
}
if (hotelManagement.getHotelList().isEmpty()) {
throw new JeroBootException("请核实酒店联系人是否存在");
}*/
}
/**
* 根据会议id查询酒店
*/
@Override
public HotelManagement getHotelInfoByMeetingId(String id) {
return hotelManagementMapper.getHotelInfoByMeetingId(id);
}
public void isZhi(HotelManagement hotelManagement) throws Exception {
if (hotelManagement.getHoldTime().contains("")) {
List<String> time = Arrays.asList(hotelManagement.getHoldTime().split(""));
if (time.size() == 2) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
hotelManagement.setConvokeStartTime(simpleDateFormat.parse(time.get(0)));
hotelManagement.setConvokeEndTime(simpleDateFormat.parse(time.get(1)));
return;
}
throw new JeroBootException("请核实召开时间格式是否正确");
}
throw new JeroBootException("召开时间没有【至】字");
}
/**
* 导出酒店信息Excel
*/
@Override
public ModelAndView export(List<?> exportList, Class<?> exportClass, String title, HttpServletResponse response) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.FILE_NAME, title);
mv.addObject(NormalExcelConstants.CLASS, exportClass);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title));
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
}
@@ -0,0 +1,30 @@
package com.jero.standards.jiudian.hotelcontact.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.base.controller.JeroController;
import com.jero.standards.jiudian.hotelManagement.entity.HotelManagement;
import com.jero.standards.jiudian.hotelcontact.entity.HotelContact;
import com.jero.standards.jiudian.hotelcontact.service.IHotelContactService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
/**
* @Description: 酒店联系人
* @Author: jeecg-boot
* @Date: 2021-06-10
* @Version: V1.0
*/
@Api(tags="酒店联系人")
@RestController
@RequestMapping("/hotelcontact/hotelContact")
@Slf4j
public class HotelContactController extends JeroController<HotelContact, IHotelContactService> {
}
@@ -0,0 +1,47 @@
package com.jero.standards.jiudian.hotelcontact.entity;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jero.common.system.base.entity.JeroEntity;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 酒店联系人
* @Author: jeecg-boot
* @Date: 2021-06-10
* @Version: V1.0
*/
@Data
@TableName("web_hotel_contact")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="web_hotel_contact对象", description="酒店联系人")
public class HotelContact extends JeroEntity {
private static final long serialVersionUID = 1L;
@Excel(name = "联系人", width = 15)
@ApiModelProperty(value = "联系人")
@TableField("contact_person")
private String contactPerson;
@Excel(name = "联系电话", width = 15)
@ApiModelProperty(value = "联系电话")
@TableField("telephone_number")
private String telephoneNumber;
@ApiModelProperty("酒店Id")
@TableField("hotel_id")
private String hotelId;
@ApiModelProperty("酒店联系人集合")
@TableField(exist = false)
private List<HotelContact> hotelContacts;
}
@@ -0,0 +1,18 @@
package com.jero.standards.jiudian.hotelcontact.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import com.jero.standards.jiudian.hotelcontact.entity.HotelContact;
import org.springframework.stereotype.Repository;
/**
* @Description: 酒店联系人
* @Author: jeecg-boot
* @Date: 2021-06-10
* @Version: V1.0
*/
@Repository
public interface HotelContactMapper extends BaseMapper<HotelContact> {
Long removeByHotelId(@Param("hotelId") String hotelId);
}
@@ -0,0 +1,8 @@
<?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.jero.standards.jiudian.hotelcontact.mapper.HotelContactMapper">
<delete id="removeByHotelId">
DELETE FROM web_hotel_contact WHERE hotel_id = #{hotelId}
</delete>
</mapper>
@@ -0,0 +1,19 @@
package com.jero.standards.jiudian.hotelcontact.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.standards.jiudian.hotelManagement.entity.HotelManagement;
import com.jero.standards.jiudian.hotelcontact.entity.HotelContact;
/**
* @Description: 酒店联系人
* @Author: jeecg-boot
* @Date: 2021-06-10
* @Version: V1.0
*/
public interface IHotelContactService extends IService<HotelContact> {
/**
* 编辑
*/
Boolean edit(HotelManagement hotelManagement);
}
@@ -0,0 +1,57 @@
package com.jero.standards.jiudian.hotelcontact.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.BaseUtil;
import com.jero.common.util.TokenUtils;
import com.jero.standards.jiudian.hotelManagement.entity.HotelManagement;
import com.jero.standards.jiudian.hotelcontact.entity.HotelContact;
import com.jero.standards.jiudian.hotelcontact.mapper.HotelContactMapper;
import com.jero.standards.jiudian.hotelcontact.service.IHotelContactService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* @Description: 酒店联系人
* @Author: jeecg-boot
* @Date: 2021-06-10
* @Version: V1.0
*/
@Service
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
@DS(value = "multi-datasource1")
public class HotelContactServiceImpl extends ServiceImpl<HotelContactMapper, HotelContact> implements IHotelContactService {
@Autowired
private IHotelContactService hotelContactService;
@Autowired
private HotelContactMapper hotelContactMapper;
/**
* 编辑
*/
@Override
public Boolean edit(HotelManagement hotelManagement) {
if (hotelManagement.getHotelList().isEmpty()) {
throw new JeroBootException("请核实酒店联系人是否存在");
}
LoginUser user = TokenUtils.getUserByToken();
hotelContactMapper.removeByHotelId(hotelManagement.getId());
List<HotelContact> list = hotelManagement.getHotelList();
List<HotelContact> resList = new ArrayList<>();
for (HotelContact entity : list) {
entity.setHotelId(hotelManagement.getId());
BaseUtil.create(entity, user.getId());
resList.add(entity);
}
return hotelContactService.saveBatch(resList);
}
}
@@ -0,0 +1,23 @@
package com.jero.standards.xuanguan.attendmeetings.controller;
import com.jero.common.system.base.controller.JeroController;
import com.jero.standards.xuanguan.attendmeetings.entity.AttendMeetings;
import com.jero.standards.xuanguan.attendmeetings.service.IAttendMeetingsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
/**
* @Description: 宣贯参会人员
* @Author: jeecg-boot
* @Date: 2021-05-13
* @Version: V1.0
*/
@Api(tags = "宣贯参会人员")
@RestController
@RequestMapping("/attendmeetings/attendMeetings")
@Slf4j
public class AttendMeetingsController extends JeroController<AttendMeetings, IAttendMeetingsService> {
}
@@ -0,0 +1,81 @@
package com.jero.standards.xuanguan.attendmeetings.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecgframework.poi.excel.annotation.ExcelIgnore;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 宣贯参会人员
* @Author: jeecg-boot
* @Date: 2021-05-13
* @Version: V1.0
*/
@Data
@TableName("web_attend_meetings")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="web_attend_meetings对象", description="宣贯参会人员")
public class AttendMeetings implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@ExcelIgnore
@TableId(type = IdType.ID_WORKER_STR)
private String id;
@ApiModelProperty(value = "姓名")
@Excel(name = "姓名", width = 15)
private String name;
@ApiModelProperty(value = "手机号")
@Excel(name = "手机号", width = 15)
private String phone;
@ApiModelProperty(value = "宣贯培训外键")
@ExcelIgnore
// @Excel(name = "宣贯培训外键", width = 15)
@TableField("training_id")
private String trainingId;
@ApiModelProperty(value = "创建人")
@ExcelIgnore
private String createBy;
@ApiModelProperty(value = "创建日期")
@ExcelIgnore
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty(value = "更新人")
@ExcelIgnore
private String updateBy;
@ApiModelProperty(value = "更新日期")
@ExcelIgnore
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
@ApiModelProperty("文件类别")
@TableField(exist = false)
private String moduleName;
@ApiModelProperty("文件名称")
@TableField(exist = false)
private String fileName;
}
@@ -0,0 +1,43 @@
package com.jero.standards.xuanguan.attendmeetings.mapper;
import java.util.List;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.standards.xuanguan.attendmeetings.entity.AttendMeetings;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* @Description: 宣贯参会人员
* @Author: jeecg-boot
* @Date: 2021-05-13
* @Version: V1.0
*/
@Repository
public interface AttendMeetingsMapper extends BaseMapper<AttendMeetings> {
/**
* 分页列表查询
*/
Page<AttendMeetings> queryPageList(@Param("page") Page<AttendMeetings> page,
@Param("attendMeetings") AttendMeetings attendMeetings,
@Param("column") String column,
@Param("order") String order) throws Exception;
/**
* 根据手机号查询参会人
*/
List<AttendMeetings> findAttendMeetingsByPhone(@Param("phone") String phone,
@Param("trainingId") String trainingId) throws Exception;
/**
* 校验-参会人员手机号
*/
List<AttendMeetings> addOrEditCheckPhone(@Param("id") String id, @Param("phone") String phone, @Param("trainingId") String trainingId);
/**
* 资源下载记录
*/
Page<AttendMeetings> dataDownloadRecord(@Param("page") Page<AttendMeetings> page, @Param("userId") String userId);
}
@@ -0,0 +1,95 @@
<?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.jero.standards.xuanguan.attendmeetings.mapper.AttendMeetingsMapper">
<sql id="Base_Column">
${alias}.id AS id ,
${alias}.name AS name ,
${alias}.phone AS phone ,
${alias}.training_id AS trainingId ,
${alias}.create_by AS createBy ,
${alias}.create_time AS createTime ,
${alias}.update_by AS updateBy ,
${alias}.update_time AS updateTime
</sql>
<!-- 分页列表查询-->
<select id="queryPageList" resultType="com.jero.standards.xuanguan.attendmeetings.entity.AttendMeetings">
SELECT
<include refid="Base_Column">
<property name="alias" value="a"/>
</include>
FROM
web_attend_meetings a
<where>
1 = 1
<!-- 宣贯会议 -->
<if test="attendMeetings.trainingId !=null and attendMeetings.trainingId != ''">
AND a.training_id = #{attendMeetings.trainingId}
</if>
<!-- 姓名 -->
<if test="attendMeetings.name !=null and attendMeetings.name != ''">
AND a.name LIKE CONCAT('%',#{attendMeetings.name},'%')
</if>
</where>
<choose>
<when test="column !=null and column != '' and order !=null and order != ''">
ORDER BY a.${column} ${order}
</when>
<otherwise>
ORDER BY a.create_time DESC
</otherwise>
</choose>
</select>
<!-- 根据手机号查询参会人-->
<select id="findAttendMeetingsByPhone" resultType="com.jero.standards.xuanguan.attendmeetings.entity.AttendMeetings">
SELECT
id
FROM
web_attend_meetings a
where 1 = 1
AND a.phone = #{phone}
AND a.training_id = #{trainingId}
</select>
<!-- 校验-参会人员手机号-->
<select id="addOrEditCheckPhone" resultType="com.jero.standards.xuanguan.attendmeetings.entity.AttendMeetings">
SELECT
id as id,
name as name
FROM
web_attend_meetings a
<where>1 = 1
<!-- 主键 -->
<if test="id !=null and id != ''">
AND a.id = #{id}
</if>
AND a.phone = #{phone}
<!-- 会议 -->
<if test="trainingId !=null and trainingId != ''">
AND a.training_id = #{trainingId}
</if>
</where>
</select>
<!-- 资源下载记录-->
<select id="dataDownloadRecord" resultType="com.jero.standards.xuanguan.attendmeetings.entity.AttendMeetings">
SELECT
t1.id AS id,
CASE t1.module_type WHEN 6 THEN '标准宣贯' WHEN 7 THEN '学习培训'
WHEN 8 THEN '技术资料' WHEN 9 THEN '期刊杂志' WHEN 10 THEN '综合资源'
ELSE '' END AS moduleName,
t3.file_name AS fileName,
t1.create_time as createTime
FROM
web_file_record t1
LEFT JOIN web_stable_cross_training t2 ON t1.module_id = t2.id
LEFT JOIN oss_file t3 ON t1.file_id = t3.id
WHERE
1 = 1 AND t1.type = 'download'
AND t1.user_id = #{userId}
ORDER BY
t1.update_time DESC
</select>
</mapper>
@@ -0,0 +1,45 @@
package com.jero.standards.xuanguan.attendmeetings.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.standards.xuanguan.attendmeetings.entity.AttendMeetings;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @Description: 宣贯参会人员
* @Author: jeecg-boot
* @Date: 2021-05-13
* @Version: V1.0
*/
public interface IAttendMeetingsService extends IService<AttendMeetings> {
/**
* 添加
*/
Boolean add(AttendMeetings attendMeetings) throws Exception;
/**
* 校验-参会人员手机号
*/
Boolean addOrEditCheckPhone(AttendMeetings attendMeetings) throws Exception;
Boolean edit(AttendMeetings attendMeetings) throws Exception;
/**
* 通过id删除
*/
Boolean delete(String id) throws Exception;
/**
* 批量删除
*/
Boolean deleteBatch(String ids) throws Exception;
/**
* 手机号是否为参会人
*/
Boolean findAttendMeetingsByPhone(String phone);
}
@@ -0,0 +1,196 @@
package com.jero.standards.xuanguan.attendmeetings.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.FileNameSeparateUtil;
import com.jero.common.util.PasswordUtil;
import com.jero.standards.xuanguan.attendmeetings.entity.AttendMeetings;
import com.jero.standards.xuanguan.attendmeetings.mapper.AttendMeetingsMapper;
import com.jero.standards.xuanguan.attendmeetings.service.IAttendMeetingsService;
import com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining;
import com.jero.standards.xuanguan.stablecrosstraining.service.IStableCrossTrainingService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.client.RestTemplate;
import java.util.*;
/**
* @Description: 宣贯参会人员
* @Author: jeecg-boot
* @Date: 2021-05-13
* @Version: V1.0
*/
@Service
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
@DS(value = "multi-datasource1")
public class AttendMeetingsServiceImpl extends ServiceImpl<AttendMeetingsMapper, AttendMeetings> implements IAttendMeetingsService {
@Autowired
private ISysBaseAPI sysBaseAPI;
@Autowired
private IAttendMeetingsService attendMeetingsService;
@Autowired
private AttendMeetingsMapper attendMeetingsMapper;
@Autowired
private IStableCrossTrainingService stableCrossTrainingService;
private static Long BIG_SIZE = 1024L * 1024L * 50L;
/**
* 新增
*/
@Override
public Boolean add(AttendMeetings attendMeetings) throws Exception {
//判断是否为管理员
// this.isAuthentication();
//判断宣贯培训参会人是否存在
if (attendMeetings == null) {
throw new JeroBootException("请核实参会人员是否存在");
}
//判断主键是否存在
if (StringUtils.isBlank(attendMeetings.getTrainingId())) {
throw new JeroBootException(Result.NULL_ID);
}
String phone = PasswordUtil.encrypt(attendMeetings.getPhone());
attendMeetings.setPhone(phone);
//判断该宣贯培训会议下_姓名_&&_电话_是否有重复参会人
// this.ifRepeat(attendMeetings);
return attendMeetingsService.save(attendMeetings);
}
@Override
public Boolean addOrEditCheckPhone(AttendMeetings attendMeetings) throws Exception {
String phone = attendMeetings.getPhone();
String trainingId = attendMeetings.getTrainingId();
//新增
if (StringUtils.isBlank(attendMeetings.getId())) {
List<AttendMeetings> attendMeetingsByPhone = attendMeetingsMapper.addOrEditCheckPhone("", phone, trainingId);
if (attendMeetingsByPhone.size() > 0) {
throw new JeroBootException("该手机号已报名,无需重复报名!");
}
//编辑
} else {
AttendMeetings attendMeetingsDB = this.getById(attendMeetings.getId());
if (!attendMeetingsDB.getPhone().equals(phone)) {
List<AttendMeetings> attendMeetingsByPhone = attendMeetingsMapper.addOrEditCheckPhone("", phone, trainingId);
if (attendMeetingsByPhone.size() > 0) {
throw new JeroBootException("该手机号已报名,无需重复报名!");
}
}
}
return Boolean.TRUE;
}
/**
* 编辑
*/
@Override
public Boolean edit(AttendMeetings attendMeetings) throws Exception {
//判断是否为管理员
// this.isAuthentication();
//判断主键是否存在
if (StringUtils.isBlank(attendMeetings.getId())) {
throw new JeroBootException(Result.NULL_ID);
}
if (StringUtils.isBlank(attendMeetings.getTrainingId())) {
throw new JeroBootException(Result.NULL_ID);
}
//判断该宣贯培训会议下_姓名_&&_电话_是否有重复参会人
// this.ifRepeat(attendMeetings);
LambdaUpdateWrapper<AttendMeetings> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(AttendMeetings::getId, attendMeetings.getId())
.set(StringUtils.isNotBlank(attendMeetings.getName()), AttendMeetings::getName, attendMeetings.getName())
.set(StringUtils.isNotBlank(attendMeetings.getPhone()), AttendMeetings::getPhone, PasswordUtil.encrypt(attendMeetings.getPhone()))
.set(AttendMeetings::getUpdateBy, attendMeetings.getUpdateBy())
.set(AttendMeetings::getUpdateTime, attendMeetings.getUpdateTime());
// .set(StringUtils.isNotBlank(attendMeetings.getTrainingId()),AttendMeetings::getTrainingId,attendMeetings.getTrainingId());
return attendMeetingsService.update(updateWrapper);
}
//判断该宣贯培训会议下_姓名_&&_电话_是否有重复参会人
public void ifRepeat(AttendMeetings attendMeetings) throws Exception {
//判断宣贯培训是否存在
StableCrossTraining stableCrossTrainingDB = stableCrossTrainingService.queryById(attendMeetings.getTrainingId());
LambdaQueryWrapper<AttendMeetings> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AttendMeetings::getTrainingId, attendMeetings.getTrainingId())
.eq(AttendMeetings::getName, attendMeetings.getName())
.eq(AttendMeetings::getPhone, PasswordUtil.encrypt(attendMeetings.getPhone()));
if (attendMeetingsService.list(queryWrapper).size() > 0) {
throw new JeroBootException("'" + attendMeetings.getName() + "'已报名【" + stableCrossTrainingDB.getName() + "】,无需重复报名!");
}
}
/**
* 通过id删除
*/
@Override
public Boolean delete(String id) throws Exception {
//判断是否为管理员
// this.isAuthentication();
//判断主键是否存在
this.getById(id);
//删除宣贯参会人员
return attendMeetingsService.removeById(id);
}
/**
* 批量删除
*/
@Override
public Boolean deleteBatch(String ids) throws Exception {
//水平越权
// this.isAuthentication();
//判断主键是否存在
if (StringUtils.isBlank(ids)) {
throw new JeroBootException(Result.NULL_ID);
}
List<String> list = Arrays.asList(ids.split(","));
if (list.size() <= 0) {
return Boolean.FALSE;
}
//批量删除宣贯参会人员
return attendMeetingsService.removeByIds(Arrays.asList(ids.split(",")));
}
//判断是否为管理员
public void isAuthentication() {
//非系统人员只能查看本人的信息
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> roles = sysBaseAPI.getRolesByUsername(user.getUsername());
if (CollectionUtils.isEmpty(roles)) {
throw new JeroBootException("此用户无此权限,请与管理员联系!");
}
if (!roles.contains("admin")) {
throw new JeroBootException("您无此权限,请与管理员联系!");
}
}
/**
* 手机号是否为参会人
*/
@Override
public Boolean findAttendMeetingsByPhone(String phone) {
LambdaQueryWrapper<AttendMeetings> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AttendMeetings::getPhone, phone);
List<AttendMeetings> list = attendMeetingsService.list(queryWrapper);
if (list.isEmpty()) {
throw new JeroBootException("该手机号不是参会人");
}
return Boolean.TRUE;
}
}
@@ -0,0 +1,36 @@
package com.jero.standards.xuanguan.stablecrosstraining.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.base.controller.JeroController;
import com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining;
import com.jero.standards.xuanguan.stablecrosstraining.service.IStableCrossTrainingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
* @Description: 宣贯培训
* @Author: jeecg-boot
* @Date: 2021-05-10
* @Version: V1.0
*/
@Slf4j
@RestController
@Api(tags = "宣贯培训")
@RequestMapping("/stablecrosstraining/stableCrossTraining")
public class StableCrossTrainingController extends JeroController<StableCrossTraining, IStableCrossTrainingService> {
}
@@ -0,0 +1,35 @@
package com.jero.standards.xuanguan.stablecrosstraining.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @作者:WangHK
* @类名:UserEntity
* @功能:TODO_用户_实体
* @日期:2021年5月20日, 0020
* @公司:天津合众未来科技有限公司
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class OSSFileVO {
private static final long serialVersionUID = 1L;
private String id;
@Excel(name = "文件名称")
private String fileName;
@Excel(name = "文件地址")
private String url;
@Excel(name = "浏览数量")
private Integer viewNumber;
@Excel(name = "下载数量")
private Integer downloadNumber;
}
@@ -0,0 +1,236 @@
package com.jero.standards.xuanguan.stablecrosstraining.entity;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jero.common.aspect.annotation.Dict;
import com.jero.common.system.base.entity.JeroEntity;
import com.jero.standards.jiudian.hotelcontact.entity.HotelContact;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.Size;
/**
* @Description: 宣贯培训
* @Author: jeecg-boot
* @Date: 2021-05-10
* @Version: V1.0
*/
@Data
@TableName("web_stable_cross_training")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="web_stable_cross_training对象", description="宣贯培训")
public class StableCrossTraining extends JeroEntity {
private static final long serialVersionUID = 1L;
// @ApiModelProperty(value = "主键")
// @TableId(type = IdType.ID_WORKER_STR)
// private String id;
@Excel(name = "会议名称", width = 15)
@ApiModelProperty(value = "会议名称_必填,校验协会动态的唯一性,重复进行提示")
private String name;
@Excel(name = "培训类型", width = 15)
@ApiModelProperty(value = "培训类型:1.标准宣贯, 2.学习培训")
@TableField("meeting_type")
@Dict(dicCode = "stable_cross_type")
private Integer meetingType;
@Excel(name = "会议状态", width = 15)
@ApiModelProperty(value = "会议状态: 1.可报名, 2.已结束")
@TableField("meeting_state")
@Dict(dicCode = "stable_cross_state")
private Integer meetingState;
@Excel(name = "年份", width = 15)
@ApiModelProperty(value = "年份")
private String year;
@Excel(name = "召开开始时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "召开开始时间")
@TableField("convoke_start_time")
private Date convokeStartTime;
@Excel(name = "召开结束时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "召开结束时间")
@TableField("convoke_end_time")
private Date convokeEndTime;
@Excel(name = "召开地点对照码", width = 15)
@ApiModelProperty(value = "召开地点对照码")
@TableField("convoke_locale")
private String convokeLocale;
@Excel(name = "召开省市地点名称", width = 15)
@ApiModelProperty(value = "召开省市地点名称")
@TableField("place_name")
private String placeName;
@Excel(name = "会议报名", width = 15)
@ApiModelProperty(value = "会议报名_必填:校验网址格式")
@TableField("meeting_apply")
private String meetingApply;
// @Excel(name = "会议文件", width = 15)
// @ExcelIgnore
@ApiModelProperty(value = "会议文件")
@TableField("meeting_files")
private String meetingFiles;
// @Excel(name = "会议通知文件", width = 15)
// @ExcelIgnore
@ApiModelProperty(value = "会议通知文件")
@TableField("meeting_notify_files")
private String meetingNotifyFiles;
@Excel(name = "会议简介", width = 15)
@ApiModelProperty(value = "会议简介")
@TableField("meeting_description")
private String meetingDescription;
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
@Size(max = 500)
private String remark;
@ApiModelProperty(value = "注册签到")
@TableField("sign_in_time")
private String signInTime;
@ApiModelProperty(value = "注册签到开始时间")
@TableField("sign_in_start")
private Date signInStart;
@ApiModelProperty(value = "注册签到结束时间")
@TableField("sign_in_end")
private Date signInEnd;
// @Excel(name = "二维码", width = 15)
// @ExcelIgnore
@ApiModelProperty(value = "二维码")
@TableField("qr_code")
private String qrCode;
// @ApiModelProperty(value = "创建人")
// @TableField("create_by")
// private String createBy;
//
// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
// @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
// @ApiModelProperty(value = "创建日期")
// @TableField("create_time")
// private Date createTime;
//
// @ApiModelProperty(value = "更新人")
// @TableField("update_by")
// private String updateBy;
//
// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
// @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
// @ApiModelProperty(value = "更新日期")
// @TableField("update_time")
// private Date updateTime;
/**
* ---------- 以下为外键关联字段 ----------
*/
// @ApiModelProperty(value = "酒店外键")
// @ExcelIgnore
// @TableField("hotel_id")
// private String hotelId;
/**
* ---------- 以上为外键关联字段 ----------
*/
/**
* ---------- 以下为非持久化字段 ----------
*/
@ApiModelProperty("用户真实姓名")
@TableField(exist = false)
private String realName;
@ApiModelProperty("培训外键")
@TableField(exist = false)
private String trainingId;
@ApiModelProperty("酒店名称")
@TableField(exist = false)
private String hotelName;
@ApiModelProperty("地址")
@TableField(exist = false)
private String address;
@ApiModelProperty("联系人")
@TableField(exist = false)
private String contactPerson;
@ApiModelProperty("电话")
// @TableField("telephone_number")
@TableField(exist = false)
private String telephoneNumber;
@ApiModelProperty("召开时间")
@TableField(exist = false)
private String convokeTime;
@ApiModelProperty("培训类型名称")
@TableField(exist = false)
private String meetingTypeName;
@ApiModelProperty("培训类型状态")
@TableField(exist = false)
private String meetingStateName;
@ApiModelProperty("查询状态: 0.初始化查询, 1.只显示有文件的会议")
@TableField(exist = false)
private String findType;
@ApiModelProperty("查询状态: 1.无文件会议, 2.无文件会议+本身会议")
@TableField(exist = false)
private String type;
@ApiModelProperty("ids")
@TableField(exist = false)
private List<String> ids;
@ApiModelProperty("fileKeyValue")
@TableField(exist = false)
private List<Map<String,String>> fileKeyValue;
@ApiModelProperty("酒店联系人集合")
@TableField(exist = false)
private List<HotelContact> hotelList;
@ApiModelProperty("排序字段")
@TableField(exist = false)
private String column;
@ApiModelProperty("排序规则")
@TableField(exist = false)
private String order;
}
@@ -0,0 +1,43 @@
package com.jero.standards.xuanguan.stablecrosstraining.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @作者:WangHK
* @类名:StableCrossTraining_Entity
* @功能:TODO_宣贯_实体
* @日期:2021年5月26日
* @公司:天津合众未来科技有限公司
*/
@Data
@ApiModel(value="web_stable_cross_training对象VO", description="宣贯培训VO")
public class StableCrossTrainingVO {
@ApiModelProperty("会议名称")
private String name;
@ApiModelProperty("召开时间")
private String convokeTime;
@ApiModelProperty("召开地点")
private String placeName;
@ApiModelProperty("会议状态")
private String meetingState;
@ApiModelProperty("类型")
private String meetingStateName;
@ApiModelProperty("年份")
private String year;
@ApiModelProperty("更新时间")
private String updateTime;
@ApiModelProperty("管理员")
private String realName;
}
@@ -0,0 +1,61 @@
package com.jero.standards.xuanguan.stablecrosstraining.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import com.jero.standards.xuanguan.stablecrosstraining.entity.OSSFileVO;
import com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @Description: 宣贯培训
* @Author: jeecg-boot
* @Date: 2021-05-10
* @Version: V1.0
*/
@Repository
public interface StableCrossTrainingMapper extends BaseMapper<StableCrossTraining> {
/**
* 分页列表查询
*/
Page<StableCrossTraining> queryPageList(@Param("page") Page<StableCrossTraining> page,
@Param("stableCrossTraining") StableCrossTraining stableCrossTraining,
@Param("column") String column,
@Param("order") String order) throws Exception;
/**
* 通过id查询
*/
StableCrossTraining getStableCrossTraining(@Param("id") String id) throws Exception;
/**
* 根据fileIds获取files
*/
List<OSSFileVO> getFilesByFileIds(@Param("fileIds") List<String> fileIds) throws Exception;
/**
* 根据开始结束时间查询全部宣贯
*/
List<StableCrossTraining> findAllProvinciaXuanGuanByYear(@Param("beginYear") String beginYear, @Param("endYear") String endYear) throws Exception;
List<StableCrossTraining> findAllProvinciaXuanGuanByNowYear(@Param("year") String year) throws Exception;
/**
* 根据省code获取该剩下会议数
*/
List<StableCrossTraining> findAllProvincialXuanGuanByPlace(@Param("place") String place, @Param("beginYear") String beginYear, @Param("endYear") String endYear);
List<StableCrossTraining> findAllProvincialXuanGuanByPlaceByNowYear(@Param("place") String place, @Param("year") String year);
/**
* 根据开始结束时间查询全部宣贯城市
*/
List<StableCrossTraining> findAllCityXuanGuanByYear(@Param("code") String code,
@Param("beginYear") String beginYear,
@Param("endYear") String endYear);
}
@@ -0,0 +1,301 @@
<?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.jero.standards.xuanguan.stablecrosstraining.mapper.StableCrossTrainingMapper">
<sql id="Base_Column">
${alias}.id AS id ,
${alias}.name AS name ,
${alias}.meeting_type AS meetingType ,
${alias}.meeting_state AS meetingState ,
${alias}.year AS year ,
${alias}.convoke_start_time AS convokeStartTime ,
${alias}.convoke_end_time AS convokeEndTime ,
${alias}.sign_in_start AS signInStart ,
${alias}.sign_in_end AS signInEnd ,
${alias}.convoke_locale AS convokeLocale ,
${alias}.meeting_apply AS meetingApply ,
${alias}.meeting_files AS meetingFiles ,
${alias}.meeting_notify_files AS meetingNotifyFiles ,
${alias}.meeting_description AS meetingDescription ,
${alias}.remark AS remark ,
${alias}.qr_code AS qrCode ,
${alias}.place_name AS placeName ,
${alias}.create_by AS createBy ,
${alias}.create_time AS createTime ,
${alias}.update_by AS updateBy ,
${alias}.update_time AS updateTime
</sql>
<!-- 分页列表查询-->
<select id="queryPageList" resultType="com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining">
SELECT
<include refid="Base_Column">
<property name="alias" value="a"/>
</include>
,
CASE a.meeting_type WHEN 1 THEN '标准宣贯' WHEN 2 THEN '学习培训' ELSE '' END AS meetingTypeName,
CASE a.meeting_state WHEN 1 THEN '已报名' WHEN 2 THEN '已结束' ELSE '' END AS meetingStateName,
CONCAT(a.convoke_start_time,' ~ ',a.convoke_end_time) AS convokeTime,
CONCAT(a.sign_in_start,' ~ ',a.sign_in_end) AS signInTime,
b.hotel_name AS hotelName,
b.address AS address,
b.contact_person AS contactPerson,
b.telephone_number AS telephoneNumber,
c.realname AS realName
FROM
web_stable_cross_training a
LEFT JOIN web_hotel_management b on a.id = b.training_id
LEFT JOIN sys_user c on a.update_by = c.id
<where>
1 = 1
<!-- 会议名称 -->
<if test="stableCrossTraining.name !=null and stableCrossTraining.name != ''">
AND a.name LIKE CONCAT('%',#{stableCrossTraining.name},'%')
</if>
<!-- 年份 -->
<if test="stableCrossTraining.year !=null and stableCrossTraining.year != ''">
AND a.year = #{stableCrossTraining.year}
</if>
<!-- 培训类型 -->
<if test="stableCrossTraining.meetingType != null">
AND a.meeting_type = #{stableCrossTraining.meetingType}
</if>
</where>
<choose>
<when test="column !=null and column != '' and order !=null and order != ''">
ORDER BY a.${column} ${order}
</when>
<otherwise>
ORDER BY a.create_time DESC
</otherwise>
</choose>
</select>
<!-- 通过id查询-->
<select id="getStableCrossTraining" resultType="com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining">
SELECT
<include refid="Base_Column">
<property name="alias" value="a"/>
</include>
,
CASE a.meeting_type WHEN 1 THEN '标准宣贯' WHEN 2 THEN '学习培训' ELSE '' END AS meetingTypeName ,
CASE a.meeting_state WHEN 1 THEN '已报名' WHEN 2 THEN '已结束' ELSE '' END AS meetingStateName ,
CONCAT(a.convoke_start_time,' ~ ',a.convoke_end_time) AS convokeTime ,
CONCAT(a.sign_in_start,' ~ ',a.sign_in_end) AS signInTime,
b.hotel_name AS hotelName ,
b.address AS address ,
b.contact_person AS contactPerson ,
b.telephone_number AS telephoneNumber ,
c.realname AS realName
FROM
web_stable_cross_training a
LEFT JOIN web_hotel_management b on a.id = b.training_id
LEFT JOIN sys_user c on a.update_by = c.id
<where>
1 = 1
<!-- 会议名称 -->
<if test="id !=null and id != ''">
AND a.id = #{id}
</if>
</where>
</select>
<!-- 根据fileIds获取files-->
<select id="getFilesByFileIds" resultType="com.jero.standards.xuanguan.stablecrosstraining.entity.OSSFileVO">
SELECT
a.id AS id ,
a.file_name AS fileName ,
a.url AS url ,
a.view_number AS viewNumber ,
a.download_number AS downloadNumber
FROM
oss_file a
<where>
1 = 1
<if test="fileIds != null">
and a.id in
<foreach collection="fileIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
</select>
<!-- 根据开始结束时间查询全部宣贯-->
<select id="findAllProvinciaXuanGuanByYear"
resultType="com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining">
SELECT
<include refid="Base_Column">
<property name="alias" value="a"/>
</include>
,
CONCAT(a.convoke_start_time,' ~ ',a.convoke_end_time) AS convokeTime,
b.hotel_name AS hotelName,
b.address AS address,
b.contact_person AS contactPerson,
b.telephone_number AS telephoneNumber,
b.meeting_type AS meetingType,
c.realname AS administrator
FROM
web_stable_cross_training a
LEFT JOIN web_hotel_management b on a.id = b.training_id
LEFT JOIN sys_user c on a.update_by = c.id
<where>
1 = 1 <!-- AND RIGHT(a.place, 4) = '0000'-->
<!-- 会议主题
<if test="meetingNews.conferenceTheme !=null and meetingNews.conferenceTheme != ''">
AND a.conference_theme LIKE CONCAT('%',#{meetingNews.conferenceTheme},'%')
</if>-->
<!--开始时间-->
<if test="beginYear != null and beginYear != ''">
AND LEFT(a.convoke_start_time, 7) &gt; #{beginYear}
</if>
<!--结束时间-->
<if test="endYear != null and endYear != ''">
AND LEFT(a.convoke_end_time, 7) &lt; #{endYear}
</if>
</where>
ORDER BY a.update_time DESC
</select>
<select id="findAllProvinciaXuanGuanByNowYear"
resultType="com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining">
SELECT
<include refid="Base_Column">
<property name="alias" value="a"/>
</include>
,
CONCAT(a.convoke_start_time,' ~ ',a.convoke_end_time) AS convokeTime,
b.hotel_name AS hotelName,
b.address AS address,
b.contact_person AS contactPerson,
b.telephone_number AS telephoneNumber,
b.meeting_type AS meetingType,
c.realname AS administrator
FROM
web_stable_cross_training a
LEFT JOIN web_hotel_management b on a.id = b.training_id
LEFT JOIN sys_user c on a.update_by = c.id
<where>
1 = 1 <!-- AND RIGHT(a.place, 4) = '0000'-->
<!-- 会议主题
<if test="meetingNews.conferenceTheme !=null and meetingNews.conferenceTheme != ''">
AND a.conference_theme LIKE CONCAT('%',#{meetingNews.conferenceTheme},'%')
</if>-->
<!--时间-->
<if test="year != null and year != ''">
AND LEFT(a.convoke_start_time, 4) = #{year}
</if>
</where>
ORDER BY a.update_time DESC
</select>
<!-- 根据省code获取该剩下会议数-->
<select id="findAllProvincialXuanGuanByPlace"
resultType="com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining">
SELECT
<include refid="Base_Column">
<property name="alias" value="a"/>
</include>
,
CONCAT(a.convoke_start_time,' ~ ',a.convoke_end_time) AS convokeTime,
b.hotel_name AS hotelName,
b.address AS address,
b.contact_person AS contactPerson,
b.telephone_number AS telephoneNumber,
b.meeting_type AS meetingType,
c.realname AS administrator
FROM
web_stable_cross_training a
LEFT JOIN web_hotel_management b on a.id = b.training_id
LEFT JOIN sys_user c on a.update_by = c.id
<where>
1 = 1
<!-- 省份地区-->
<if test="place !=null and place != ''">
AND a.convoke_locale LIKE CONCAT(#{place},'%')
</if>
<!--开始时间-->
<if test="beginYear != null and beginYear != ''">
AND LEFT(a.convoke_start_time, 7) &gt; #{beginYear}
</if>
<!--结束时间-->
<if test="endYear != null and endYear != ''">
AND LEFT(a.convoke_end_time, 7) &lt; #{endYear}
</if>
</where>
ORDER BY a.update_time DESC
</select>
<select id="findAllProvincialXuanGuanByPlaceByNowYear"
resultType="com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining">
SELECT
<include refid="Base_Column">
<property name="alias" value="a"/>
</include>
,
CONCAT(a.convoke_start_time,' ~ ',a.convoke_end_time) AS convokeTime,
b.hotel_name AS hotelName,
b.address AS address,
b.contact_person AS contactPerson,
b.telephone_number AS telephoneNumber,
b.meeting_type AS meetingType,
c.realname AS administrator
FROM
web_stable_cross_training a
LEFT JOIN web_hotel_management b on a.id = b.training_id
LEFT JOIN sys_user c on a.update_by = c.id
<where>
1 = 1
<!-- 省份地区-->
<if test="place !=null and place != ''">
AND a.convoke_locale LIKE CONCAT(#{place},'%')
</if>
<!--开始时间-->
<if test="year != null and year != ''">
AND LEFT(a.convoke_start_time, 4) = #{year}
</if>
</where>
ORDER BY a.update_time DESC
</select>
<!-- 根据开始结束时间查询全部宣贯城市-->
<select id="findAllCityXuanGuanByYear"
resultType="com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining">
SELECT
<include refid="Base_Column">
<property name="alias" value="a"/>
</include>
,
CONCAT(a.convoke_start_time,' ~ ',a.convoke_end_time) AS convokeTime,
b.hotel_name AS hotelName,
b.address AS address,
b.contact_person AS contactPerson,
b.telephone_number AS telephoneNumber,
b.meeting_type AS meetingType,
c.realname AS administrator
FROM
web_stable_cross_training a
LEFT JOIN web_hotel_management b on a.id = b.training_id
LEFT JOIN sys_user c on a.update_by = c.id
<where>
1 = 1
<!-- 省份地区-->
<if test="code !=null and code != ''">
AND a.convoke_locale = #{code}
</if>
<!--开始时间-->
<if test="beginYear != null and beginYear != ''">
AND LEFT(a.convoke_start_time, 7) &gt; #{beginYear}
</if>
<!--结束时间-->
<if test="endYear != null and endYear != ''">
AND LEFT(a.convoke_start_time, 7) &lt; #{endYear}
</if>
</where>
ORDER BY a.update_time DESC
</select>
</mapper>
@@ -0,0 +1,50 @@
package com.jero.standards.xuanguan.stablecrosstraining.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.meeting.entity.PayMeeting;
import com.jero.meeting.entity.PayMeetingHotelContacts;
import com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining;
import java.util.List;
/**
* @Description: 宣贯培训
* @Author: jeecg-boot
* @Date: 2021-05-10
* @Version: V1.0
*/
public interface IStableCrossTrainingService extends IService<StableCrossTraining> {
/**
* 添加
*/
Boolean add(StableCrossTraining stableCrossTraining);
/**
* 编辑
*/
Boolean edit(StableCrossTraining stableCrossTraining) throws Exception;
/**
* 通过id删除
*/
Boolean delete(String id) throws Exception;
/**
* 批量删除
*/
Boolean deleteBatch(String ids) throws Exception;
/**
* 通过id查询
*/
StableCrossTraining queryById(String id) throws Exception;
/**
* 宣贯培训-下拉列表
*/
List<StableCrossTraining> queryList(StableCrossTraining stableCrossTraining) throws Exception;
void push(PayMeeting payMeeting, List<PayMeetingHotelContacts> hotelContactsList);
}
@@ -0,0 +1,414 @@
package com.jero.standards.xuanguan.stablecrosstraining.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.*;
import com.jero.meeting.entity.PayMeeting;
import com.jero.meeting.entity.PayMeetingHotelContacts;
import com.jero.standards.jiudian.hotelManagement.entity.HotelManagement;
import com.jero.standards.jiudian.hotelManagement.service.IHotelManagementService;
import com.jero.standards.jiudian.hotelcontact.entity.HotelContact;
import com.jero.standards.jiudian.hotelcontact.mapper.HotelContactMapper;
import com.jero.standards.jiudian.hotelcontact.service.IHotelContactService;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.*;
import com.jero.standards.xuanguan.attendmeetings.entity.AttendMeetings;
import com.jero.standards.xuanguan.attendmeetings.service.IAttendMeetingsService;
import com.jero.standards.xuanguan.stablecrosstraining.entity.OSSFileVO;
import com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining;
import com.jero.standards.xuanguan.stablecrosstraining.mapper.StableCrossTrainingMapper;
import com.jero.standards.xuanguan.stablecrosstraining.service.IStableCrossTrainingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* @Description: 宣贯培训
* @Author: jeecg-boot
* @Date: 2021-05-10
* @Version: V1.0
*/
@Service
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
@DS(value = "multi-datasource1")
public class StableCrossTrainingServiceImpl extends ServiceImpl<StableCrossTrainingMapper, StableCrossTraining> implements IStableCrossTrainingService {
@Autowired
private ISysBaseAPI sysBaseAPI;
@Autowired
private HotelContactMapper hotelContactMapper;
@Autowired
private IHotelContactService hotelContactService;
@Autowired
private IAttendMeetingsService attendMeetingsService;
@Autowired
private IHotelManagementService hotelManagementService;
@Autowired
private StableCrossTrainingMapper stableCrossTrainingMapper;
@Autowired
private IStableCrossTrainingService stableCrossTrainingService;
@Override
public void push(PayMeeting payMeeting, List<PayMeetingHotelContacts> hotelContactsList) {
StableCrossTraining stableCrossTraining = new StableCrossTraining();
stableCrossTraining.setName(payMeeting.getMeetingName());
stableCrossTraining.setMeetingType(payMeeting.getMeetingType());
stableCrossTraining.setYear(payMeeting.getParticularYear());
Date startTime = payMeeting.getStartTime();
Date endTime = payMeeting.getEndTime();
stableCrossTraining.setConvokeTime(DateUtil.formatDateTime(startTime)+""+DateUtil.formatDateTime(endTime));
stableCrossTraining.setConvokeStartTime(startTime);
stableCrossTraining.setConvokeEndTime(endTime);
stableCrossTraining.setConvokeLocale(payMeeting.getConvokeLocale());
stableCrossTraining.setPlaceName(payMeeting.getVenue());
stableCrossTraining.setMeetingFiles(payMeeting.getMeetingFiles());
stableCrossTraining.setMeetingDescription(payMeeting.getMeetingContent());
stableCrossTraining.setRemark(payMeeting.getRemark());
Date startSignInTime = payMeeting.getStartSignInTime();
Date endSignInTime = payMeeting.getEndSignInTime();
stableCrossTraining.setSignInTime(DateUtil.formatDateTime(startSignInTime)+""+DateUtil.formatDateTime(endSignInTime));
stableCrossTraining.setSignInStart(startSignInTime);
stableCrossTraining.setSignInEnd(endSignInTime);
stableCrossTraining.setHotelName(payMeeting.getHotelName());
stableCrossTraining.setAddress(payMeeting.getHotelAddress());
stableCrossTraining.setMeetingApply("");
List<HotelContact> hotelList = new ArrayList<>();
List<PayMeetingHotelContacts> hotelContactsList1 = payMeeting.getHotelContactsList();
for (PayMeetingHotelContacts meetingHotelContacts : hotelContactsList1) {
HotelContact hotelContact = new HotelContact();
hotelContact.setContactPerson(meetingHotelContacts.getHotelContacts());
hotelContact.setTelephoneNumber(meetingHotelContacts.getHotelContactsPhone());
hotelList.add(hotelContact);
}
stableCrossTraining.setHotelList(hotelList);
add(stableCrossTraining);
}
/**
* 添加
*/
@Override
public Boolean add(StableCrossTraining stableCrossTraining) {
//配置培训状态
this.isTrainingState(stableCrossTraining);
Boolean resFlag = stableCrossTrainingService.save(stableCrossTraining);
//创建时间/创建人/修改时间/修改人
LoginUser user = TokenUtils.getUserByToken();
BaseUtil.create(stableCrossTraining, user.getId());
//添加酒店信息
HotelManagement hotelManagement = new HotelManagement();
hotelManagement.setHotelList(stableCrossTraining.getHotelList());
hotelManagement.setTrainingId(stableCrossTraining.getId())
.setConferenceTheme(stableCrossTraining.getName()).setHoldTime(stableCrossTraining.getConvokeTime())
.setPlace(stableCrossTraining.getConvokeLocale()).setPlaceName(stableCrossTraining.getPlaceName())
.setHotelName(stableCrossTraining.getHotelName()).setAddress(stableCrossTraining.getAddress())
.setMeetingType(1);
hotelManagementService.add(hotelManagement);
return resFlag;
}
//判空
public void ifEntityIsEmpty(StableCrossTraining stableCrossTraining) {
if (StringUtils.isBlank(stableCrossTraining.getName())) {
throw new JeroBootException(Result.NULL_NAME);
} else {
if (stableCrossTraining.getName().length() > 50) {
throw new JeroBootException("会议名称输入超过限定长度!");
}
}
if (StringUtils.isBlank(stableCrossTraining.getMeetingApply())) {
throw new JeroBootException("请核实会议报名是否存在!");
} else {
if (stableCrossTraining.getMeetingApply().length() > 500) {
throw new JeroBootException("会议报名输入超过限定长度!");
}
if (!Assert.iswebsit(stableCrossTraining.getMeetingApply())) {
throw new JeroBootException("报名链接请输入网址格式");
}
}
if (null == stableCrossTraining.getMeetingType()) {
throw new JeroBootException("请核实培训类型是否存在!");
}
if (StringUtils.isBlank(stableCrossTraining.getYear())) {
throw new JeroBootException("请核实年份是否存在!");
}
if (StringUtils.isBlank(stableCrossTraining.getConvokeTime())) {
throw new JeroBootException("请核实培训召开时间是否存在!");
}
if (StringUtils.isBlank(stableCrossTraining.getConvokeLocale())) {
throw new JeroBootException("请核实培训召开地点是否存在!");
}
if (StringUtils.isBlank(stableCrossTraining.getPlaceName())) {
throw new JeroBootException("请核实省市名称是否存在!");
}
if (StringUtils.isNotBlank(stableCrossTraining.getRemark())) {
if (stableCrossTraining.getRemark().length() > 500) {
throw new JeroBootException("备注输入超过限定长度!");
}
}
if (StringUtils.isBlank(stableCrossTraining.getSignInTime())) {
throw new JeroBootException("请核实注册签到是否存在!");
} else {
if (stableCrossTraining.getSignInTime().length() > 50) {
throw new JeroBootException("注册签到输入超过限定长度!");
}
}
if (StringUtils.isNotBlank(stableCrossTraining.getMeetingFiles())) {
List<String> newsReportList = Arrays.asList(stableCrossTraining.getMeetingFiles().split(","));
if (newsReportList.size() > 10) {
throw new JeroBootException("会议文件最多为10个");
}
}
if (StringUtils.isNotBlank(stableCrossTraining.getMeetingNotifyFiles())) {
List<String> newsReportList = Arrays.asList(stableCrossTraining.getMeetingNotifyFiles().split(","));
if (newsReportList.size() > 10) {
throw new JeroBootException("会议通知文件最多为10个");
}
}
}
//判断培训状态
public StableCrossTraining isTrainingState(StableCrossTraining stableCrossTraining) {
stableCrossTraining.setMeetingState(0);
Date startTime = stableCrossTraining.getConvokeStartTime();
Date endTime = stableCrossTraining.getConvokeEndTime();
Date now = new Date();
Calendar startCalendar = Calendar.getInstance();
startCalendar.setTime(startTime);
//会议开始之前两天
startCalendar.add(Calendar.DATE, -2);
Calendar endCalendar = Calendar.getInstance();
endCalendar.setTime(endTime);
// endCalendar.add(Calendar.HOUR, 1);//会议结束延后一小时
//会议结束延后一天
endCalendar.add(Calendar.DATE, 1);
//开始时间前+48_早于_当前时间_||_结束时间+24_早于_当前时间
if (endCalendar.getTime().after(now)) {
stableCrossTraining.setMeetingState(1);//可报名
stableCrossTraining.setMeetingStateName("可报名");
}
//结束时间+24_晚于_当前时间
if (endCalendar.getTime().before(now)) {
stableCrossTraining.setMeetingState(2);//已结束
stableCrossTraining.setMeetingStateName("已结束");
}
return stableCrossTraining;
}
/**
* 编辑
*/
@Override
public Boolean edit(StableCrossTraining stableCrossTraining) throws Exception {
//判断是否为管理员
// sysBaseAPI.isAuthentication();
//判断主键是否存在
if (StringUtils.isBlank(stableCrossTraining.getId())) {
throw new JeroBootException(Result.NULL_ID);
}
StableCrossTraining stableCrossTrainingDB = this.queryById(stableCrossTraining.getId());
//判空
this.ifEntityIsEmpty(stableCrossTraining);
//TODO 会议名称唯一校验
//sysBaseAPI.checkValue("1", "web_stable_cross_training", "name",
// stableCrossTraining.getName(), stableCrossTraining.getId());
//配置培训状态
this.isTrainingState(stableCrossTraining);
//修改时间/修改人
// this.update(stableCrossTraining);
//添加宣贯培训
LambdaUpdateWrapper<StableCrossTraining> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(StableCrossTraining::getId, stableCrossTraining.getId())
.set(StringUtils.isNotBlank(stableCrossTraining.getName()), StableCrossTraining::getName, stableCrossTraining.getName())//会议名称
.set(stableCrossTraining.getMeetingType() != null, StableCrossTraining::getMeetingType, stableCrossTraining.getMeetingType())//培训类型:1.标准宣贯, 2.学习培训
.set(stableCrossTraining.getMeetingState() != null, StableCrossTraining::getMeetingState, stableCrossTraining.getMeetingState())//会议状态: 1.可报名, 2.已结束
.set(StringUtils.isNotBlank(stableCrossTraining.getYear()), StableCrossTraining::getYear, stableCrossTraining.getYear())//年份
.set(stableCrossTraining.getConvokeStartTime() != null, StableCrossTraining::getConvokeStartTime, stableCrossTraining.getConvokeStartTime())//召开开始时间
.set(stableCrossTraining.getConvokeEndTime() != null, StableCrossTraining::getConvokeEndTime, stableCrossTraining.getConvokeEndTime())//召开结束时间
.set(StringUtils.isNotBlank(stableCrossTraining.getConvokeLocale()), StableCrossTraining::getConvokeLocale, stableCrossTraining.getConvokeLocale())//召开地点
.set(StringUtils.isNotBlank(stableCrossTraining.getMeetingApply()), StableCrossTraining::getMeetingApply, stableCrossTraining.getMeetingApply())//会议报名:校验网址格式
.set(StableCrossTraining::getMeetingFiles, stableCrossTraining.getMeetingFiles())//会议文件
.set(StableCrossTraining::getMeetingNotifyFiles, stableCrossTraining.getMeetingNotifyFiles())//会议通知文件
.set(StringUtils.isNotBlank(stableCrossTraining.getMeetingDescription()), StableCrossTraining::getMeetingDescription, stableCrossTraining.getMeetingDescription())//会议简介
.set(StringUtils.isNotBlank(stableCrossTraining.getRemark()), StableCrossTraining::getRemark, stableCrossTraining.getRemark())//备注
.set(StringUtils.isNotBlank(stableCrossTraining.getQrCode()), StableCrossTraining::getQrCode, stableCrossTraining.getQrCode())//二维码
.set(StringUtils.isNotBlank(stableCrossTraining.getPlaceName()), StableCrossTraining::getPlaceName, stableCrossTraining.getPlaceName())//召开省市地点名称
.set(StringUtils.isNotBlank(stableCrossTraining.getSignInTime()), StableCrossTraining::getSignInTime, stableCrossTraining.getSignInTime())//召开省市地点名称
.set(stableCrossTraining.getSignInStart() != null, StableCrossTraining::getSignInStart, stableCrossTraining.getSignInStart())//召开省市地点名称
.set(stableCrossTraining.getSignInEnd() != null, StableCrossTraining::getSignInEnd, stableCrossTraining.getSignInEnd())//召开省市地点名称
.set(StableCrossTraining::getUpdateBy, stableCrossTraining.getUpdateBy())//修改人
.set(StableCrossTraining::getUpdateTime, stableCrossTraining.getUpdateTime());//修改时间
//TODO 酒店信息
// stableCrossTraining.getId()
//添加酒店信息
LambdaQueryWrapper<HotelManagement> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(HotelManagement::getTrainingId, stableCrossTraining.getId());
List<HotelManagement> hotelManagements = hotelManagementService.list(queryWrapper);
HotelManagement hotelManagement = new HotelManagement();
hotelManagement.setHotelList(stableCrossTraining.getHotelList());
hotelManagement.setTrainingId(stableCrossTraining.getId())
.setConferenceTheme(stableCrossTraining.getName()).setHoldTime(stableCrossTraining.getConvokeTime())
.setPlace(stableCrossTraining.getConvokeLocale()).setPlaceName(stableCrossTraining.getPlaceName())
.setHotelName(stableCrossTraining.getHotelName()).setAddress(stableCrossTraining.getAddress())
// .setContactPerson(stableCrossTraining.getContactPerson()).setContactNumber(stableCrossTraining.getContactNumber())
.setMeetingType(1).setId(hotelManagements.get(0).getId());
hotelManagementService.edit(hotelManagement);
//编辑宣贯信息
return stableCrossTrainingService.update(updateWrapper);
}
/**
* 通过id删除
*/
@Override
public Boolean delete(String id) throws Exception {
//判断主键是否存在
if (StringUtils.isBlank(id)) {
throw new JeroBootException(Result.NULL_ID);
}
LambdaQueryWrapper<AttendMeetings> queryAttendMeetingsWrapper = new LambdaQueryWrapper<>();
queryAttendMeetingsWrapper.eq(AttendMeetings::getTrainingId, id);
//根据宣贯培训删除参会人员
attendMeetingsService.remove(queryAttendMeetingsWrapper);
LambdaQueryWrapper<HotelManagement> queryHotelManagementWrapper = new LambdaQueryWrapper<>();
queryHotelManagementWrapper.eq(HotelManagement::getTrainingId, id);
List<HotelManagement> hotelManagements = hotelManagementService.list(queryHotelManagementWrapper);
if (!hotelManagements.isEmpty()) {
LambdaQueryWrapper<HotelContact> queryHotelContactWrapper = new LambdaQueryWrapper<>();
queryHotelContactWrapper.eq(HotelContact::getHotelId, hotelManagements.get(0).getId());
List<HotelContact> hotelContacts = hotelContactService.list(queryHotelContactWrapper);
//根据宣贯培训删除酒店信息
if (!hotelContacts.isEmpty()) {
hotelContactMapper.removeByHotelId(hotelContacts.get(0).getHotelId());
}
}
hotelManagementService.remove(queryHotelManagementWrapper);
return stableCrossTrainingService.removeById(id);
}
/**
* 批量删除
*/
@Override
public Boolean deleteBatch(String ids) throws Exception {
//判断是否为管理员
// sysBaseAPI.isAuthentication();
//判断主键是否存在
if (StringUtils.isBlank(ids)) {
throw new JeroBootException(Result.NULL_ID);
}
List<String> list = new ArrayList<>();
if (ids.contains(",")) {
list = Arrays.asList(ids.split(","));
} else {
list.add(ids);
}
LambdaQueryWrapper<AttendMeetings> queryAttendMeetingsWrapper = new LambdaQueryWrapper<>();
queryAttendMeetingsWrapper.in(AttendMeetings::getTrainingId, list);
//根据宣贯培训删除参会人员
attendMeetingsService.remove(queryAttendMeetingsWrapper);
LambdaQueryWrapper<HotelManagement> queryHotelWrapper = new LambdaQueryWrapper<>();
queryHotelWrapper.in(HotelManagement::getTrainingId, list);
//根据宣贯培训删除酒店信息
for (String id : list) {
LambdaQueryWrapper<HotelManagement> queryHotelManagementWrapper = new LambdaQueryWrapper<>();
queryHotelManagementWrapper.eq(HotelManagement::getTrainingId, id);
List<HotelManagement> hotelManagements = hotelManagementService.list(queryHotelManagementWrapper);
if (!hotelManagements.isEmpty()) {
LambdaQueryWrapper<HotelContact> queryHotelContactWrapper = new LambdaQueryWrapper<>();
queryHotelContactWrapper.eq(HotelContact::getHotelId, hotelManagements.get(0).getId());
List<HotelContact> hotelContacts = hotelContactService.list(queryHotelContactWrapper);
//根据宣贯培训删除酒店信息
if (!hotelContacts.isEmpty()) {
hotelContactMapper.removeByHotelId(hotelContacts.get(0).getHotelId());
}
}
}
hotelManagementService.remove(queryHotelWrapper);
//批量删除宣贯
return this.stableCrossTrainingService.removeByIds(Arrays.asList(ids.split(",")));
}
/**
* 通过id查询
*/
@Override
public StableCrossTraining queryById(String id) throws Exception {
//判断主键是否存在
if (StringUtils.isBlank(id)) {
throw new JeroBootException(Result.NULL_ID);
}
StableCrossTraining entityDB = stableCrossTrainingMapper.getStableCrossTraining(id);
//判断Entity是否存在
if (entityDB == null) {
throw new JeroBootException(Result.NULL_DATA);
}
//配置培训状态
this.isTrainingState(entityDB);
LambdaQueryWrapper<HotelManagement> queryHotelManagementWrapper = new LambdaQueryWrapper<>();
queryHotelManagementWrapper.eq(HotelManagement::getTrainingId, id);
List<HotelManagement> hotelManagements = hotelManagementService.list(queryHotelManagementWrapper);
LambdaQueryWrapper<HotelContact> queryHotelContactWrapper = new LambdaQueryWrapper<>();
queryHotelContactWrapper.eq(HotelContact::getHotelId, hotelManagements.get(0).getId());
List<HotelContact> hotelContacts = hotelContactService.list(queryHotelContactWrapper);
entityDB.setHotelList(hotelContacts);
return entityDB;
}
/**
* 宣贯培训-下拉列表
*/
@Override
public List<StableCrossTraining> queryList(StableCrossTraining stableCrossTraining) throws Exception {
List<StableCrossTraining> list = stableCrossTrainingService.lambdaQuery()
.eq(null != stableCrossTraining.getMeetingType(), StableCrossTraining::getMeetingType, stableCrossTraining.getMeetingType())
.list();
List<StableCrossTraining> resList = new ArrayList<>();
List<String> ids = new ArrayList<>();
//只显示没有文件的数据
for (StableCrossTraining crossTraining : list) {
if (crossTraining.getMeetingFiles() == null || StringUtils.isBlank(crossTraining.getMeetingFiles())) {
ids.add(crossTraining.getId());
resList.add(crossTraining);
}
}
//判断_如果是资料修改的时候需要下拉到会议本身
if ("2".equals(stableCrossTraining.getType())) {
StableCrossTraining stableCrossTrainingDB = this.queryById(stableCrossTraining.getId());
if (!ids.contains(stableCrossTrainingDB.getId())) {
resList.add(stableCrossTrainingDB);
}
}
return resList;
}
}
@@ -2,7 +2,11 @@ package com.jero.modules.oss.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jero.modules.oss.entity.OSSFile;
import org.apache.ibatis.annotations.Param;
public interface OSSFileMapper extends BaseMapper<OSSFile> {
/**
* 根据文件id获取文件名称
*/
String findFileNameByFileId(@Param("fileId")String fileId);
}
@@ -0,0 +1,15 @@
<?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.jero.modules.oss.mapper.OSSFileMapper">
<!-- 根据文件id获取文件名称-->
<select id="findFileNameByFileId" resultType="java.lang.String">
SELECT
file_name
FROM
oss_file a
WHERE
a.id = #{fileId}
</select>
</mapper>
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.base.Joiner;
import com.jero.modules.oss.mapper.OSSFileMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
@@ -84,7 +85,8 @@ public class SysBaseApiImpl implements ISysBaseAPI {
private SysDepartMapper departMapper;
@Resource
private SysCategoryMapper categoryMapper;
@Resource
private OSSFileMapper ossFileMapper;
@Autowired
private ISysDataSourceService dataSourceService;
@Autowired
@@ -1023,4 +1025,9 @@ public class SysBaseApiImpl implements ISysBaseAPI {
public List<SysDepartTreeModel> listSonDepartsByDepId(String departId) {
return sysDepartService.listSonDepartsByDepId(departId);
}
@Override
public String findFileNameByFileId(String fileId) {
return ossFileMapper.findFileNameByFileId(fileId);
}
}
@@ -135,13 +135,12 @@ spring:
username: root
password: 123456
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
# 多数据源配置
#multi-datasource1:
# url: jdbc:mysql://localhost:3306/jero-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
# username: root
# password: root
# driver-class-name: com.mysql.cj.jdbc.Driver
#redis 配置
# 多数据源配置
multi-datasource1:
url: jdbc:p6spy:mysql://192.168.18.254:3306/standards_association?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&serverTimezone=Asia/Shanghai
username: root
password: 123456
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
redis:
database: 14
host: 121.36.69.172