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
@@ -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;
}
}