Browse Source

后台志愿活动管理

master
Jackwang 4 years ago
parent
commit
39d94d6824
  1. 10
      epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/activity/entity/ActInfoEntity.java
  2. 8
      epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActInfoServiceImpl.java
  3. 25
      epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/controller/VactInfoController.java
  4. 12
      epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VactInfoDao.java
  5. 12
      epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/entity/VactInfoEntity.java
  6. 142
      epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/excel/VactInfoExcel.java
  7. 22
      epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/VactInfoService.java
  8. 34
      epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/impl/VactInfoServiceImpl.java
  9. 10
      epdc-cloud-heart/src/main/resources/mapper/activity/ActInfoDao.xml
  10. 33
      epdc-cloud-heart/src/main/resources/mapper/volunteer/VactInfoDao.xml

10
epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/activity/entity/ActInfoEntity.java

@ -207,4 +207,14 @@ public class ActInfoEntity extends BaseEpdcEntity {
*/ */
private String volunteerFlag; private String volunteerFlag;
/**
* 活动类型0社区活动 1志愿活动
*/
private String actType;
/**
* 志愿活动id
*/
private String vactId;
} }

8
epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActInfoServiceImpl.java

@ -55,6 +55,7 @@ import com.elink.esua.epdc.modules.activity.service.ActInfoService;
import com.elink.esua.epdc.modules.async.NewsTask; import com.elink.esua.epdc.modules.async.NewsTask;
import com.elink.esua.epdc.modules.feign.JobFeignClient; import com.elink.esua.epdc.modules.feign.JobFeignClient;
import com.elink.esua.epdc.modules.feign.UserInfoFeignClient; import com.elink.esua.epdc.modules.feign.UserInfoFeignClient;
import com.elink.esua.epdc.modules.volunteer.service.VactInfoService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -84,6 +85,8 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
private UserInfoFeignClient userInfoFeignClient; private UserInfoFeignClient userInfoFeignClient;
@Autowired @Autowired
private NewsTask newsTask; private NewsTask newsTask;
@Autowired
private VactInfoService vactInfoService;
@Override @Override
public PageData<ActInfoDTO> page(Map<String, Object> params) { public PageData<ActInfoDTO> page(Map<String, Object> params) {
@ -138,6 +141,10 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
// 保存到banner // 保存到banner
this.saveActInfoToBanner(entity.getId(), dto); this.saveActInfoToBanner(entity.getId(), dto);
} }
//修改志愿活动的状态
if(StringUtils.isNotBlank(dto.getVactId())){
vactInfoService.updateVactState(dto.getVactId());
}
// 创建定时任务(活动开始后将未审核的报名人员自动置为审核通过或不通过) // 创建定时任务(活动开始后将未审核的报名人员自动置为审核通过或不通过)
return this.saveActToScheduleJob(entity.getId(), dto.getActStartTime()); return this.saveActToScheduleJob(entity.getId(), dto.getActStartTime());
} }
@ -145,6 +152,7 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
return new Result().error(); return new Result().error();
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(ActInfoDTO dto) { public void update(ActInfoDTO dto) {

25
epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/controller/VactInfoController.java

@ -25,9 +25,11 @@ import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.modules.volunteer.dao.VactInfoDao;
import com.elink.esua.epdc.modules.volunteer.excel.VactInfoExcel; import com.elink.esua.epdc.modules.volunteer.excel.VactInfoExcel;
import com.elink.esua.epdc.modules.volunteer.service.VactInfoService; import com.elink.esua.epdc.modules.volunteer.service.VactInfoService;
import com.elink.esua.epdc.volunteer.VactInfoDTO; import com.elink.esua.epdc.volunteer.VactInfoDTO;
import com.elink.esua.epdc.volunteer.VactPageInfoDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -49,10 +51,13 @@ public class VactInfoController {
@Autowired @Autowired
private VactInfoService vactInfoService; private VactInfoService vactInfoService;
@Autowired
private VactInfoDao vactInfoDao;
@GetMapping("page") @GetMapping("page")
public Result<PageData<VactInfoDTO>> page(@RequestParam Map<String, Object> params){ public Result<PageData<VactPageInfoDTO>> page(@RequestParam Map<String, Object> params){
PageData<VactInfoDTO> page = vactInfoService.page(params); PageData<VactPageInfoDTO> page = vactInfoService.page(params);
return new Result<PageData<VactInfoDTO>>().ok(page); return new Result<PageData<VactPageInfoDTO>>().ok(page);
} }
@GetMapping("{id}") @GetMapping("{id}")
@ -87,8 +92,20 @@ public class VactInfoController {
@GetMapping("export") @GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<VactInfoDTO> list = vactInfoService.list(params); List<VactPageInfoDTO> list = vactInfoDao.getPageList(params);
ExcelUtils.exportExcelToTarget(response, null, list, VactInfoExcel.class); ExcelUtils.exportExcelToTarget(response, null, list, VactInfoExcel.class);
} }
/**
* @describe: 审核
* @author wangtong
* @date 2021/9/2 13:53
* @params [dto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
*/
@PostMapping("handleApply")
public Result handleApply(@RequestBody VactInfoDTO dto){
return vactInfoService.handleApply(dto);
}
} }

12
epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VactInfoDao.java

@ -19,8 +19,12 @@ package com.elink.esua.epdc.modules.volunteer.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.modules.volunteer.entity.VactInfoEntity; import com.elink.esua.epdc.modules.volunteer.entity.VactInfoEntity;
import com.elink.esua.epdc.volunteer.VactPageInfoDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/** /**
* 志愿活动表 * 志愿活动表
* *
@ -30,4 +34,12 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface VactInfoDao extends BaseDao<VactInfoEntity> { public interface VactInfoDao extends BaseDao<VactInfoEntity> {
/**
* @describe: 后台管理-列表
* @author wangtong
* @date 2021/9/1 19:06
* @params [params]
* @return java.util.List<com.elink.esua.epdc.volunteer.VactPageInfoDTO>
*/
List<VactPageInfoDTO> getPageList(Map<String, Object> params);
} }

12
epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/entity/VactInfoEntity.java

@ -18,11 +18,11 @@
package com.elink.esua.epdc.modules.volunteer.entity; package com.elink.esua.epdc.modules.volunteer.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
@ -63,6 +63,16 @@ public class VactInfoEntity extends BaseEpdcEntity {
*/ */
private String actAddress; private String actAddress;
/**
* 活动位置经度
*/
private BigDecimal actLongitude;
/**
* 活动位置纬度
*/
private BigDecimal actLatitude;
/** /**
* 报名要求 * 报名要求
*/ */

142
epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/excel/VactInfoExcel.java

@ -20,8 +20,6 @@ package com.elink.esua.epdc.modules.volunteer.excel;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data; import lombok.Data;
import java.util.Date;
/** /**
* 志愿活动表 * 志愿活动表
* *
@ -31,89 +29,95 @@ import java.util.Date;
@Data @Data
public class VactInfoExcel { public class VactInfoExcel {
@Excel(name = "主键") // @Excel(name = "主键")
private String id; // private String id;
@Excel(name = "所属组织")
private String orgNames;
@Excel(name = "标题") @Excel(name = "标题")
private String title; private String title;
@Excel(name = "活动头图") @Excel(name = "活动起止日期")
private String headPic; private String startEndTime;
@Excel(name = "活动开始时间") // @Excel(name = "活动头图")
private Date actStartTime; // private String headPic;
@Excel(name = "活动结束时间") // @Excel(name = "活动开始时间")
private Date actEndTime; // private Date actStartTime;
//
// @Excel(name = "活动结束时间")
// private Date actEndTime;
@Excel(name = "活动地点") @Excel(name = "活动地点")
private String actAddress; private String actAddress;
@Excel(name = "报名要求") // @Excel(name = "报名要求")
private String requirement; // private String requirement;
@Excel(name = "活动内容")
private String actContent;
@Excel(name = "是否只允许志愿者参加 0否 1是") // @Excel(name = "活动内容")
private String volunteerFlag; // private String actContent;
@Excel(name = "联系人") // @Excel(name = "是否只允许志愿者参加 0否 1是")
private String contacts; // private String volunteerFlag;
@Excel(name = "联系电话") // @Excel(name = "联系人")
private String tel; // private String contacts;
//
// @Excel(name = "联系电话")
// private String tel;
@Excel(name = "审核状态:0-审核中,5-未通过,10-待发布,15已发布") @Excel(name = "审核状态",
replace = { "审核中_0", "未通过_5", "待发布_10", "已发布_15"} )
private String state; private String state;
@Excel(name = "审核理由") // @Excel(name = "审核理由")
private String reason; // private String reason;
@Excel(name = "用户ID") // @Excel(name = "用户ID")
private String userId; // private String userId;
//
@Excel(name = "头像地址") // @Excel(name = "头像地址")
private String faceImg; // private String faceImg;
//
@Excel(name = "党员标识:0否1是") // @Excel(name = "党员标识:0否1是")
private String partyFlag; // private String partyFlag;
//
@Excel(name = "部门ID") // @Excel(name = "部门ID")
private String deptId; // private String deptId;
//
@Excel(name = "部门名称") // @Excel(name = "部门名称")
private String deptName; // private String deptName;
//
@Excel(name = "所有部门ID") // @Excel(name = "所有部门ID")
private String allDeptIds; // private String allDeptIds;
//
@Excel(name = "所有部门名称") // @Excel(name = "所有部门名称")
private String allDeptNames; // private String allDeptNames;
//
@Excel(name = "父所有部门") // @Excel(name = "父所有部门")
private String parentDeptIds; // private String parentDeptIds;
//
@Excel(name = "父所有部门") // @Excel(name = "父所有部门")
private String parentDeptNames; // private String parentDeptNames;
//
@Excel(name = "删除标识 0-否,1-是") // @Excel(name = "删除标识 0-否,1-是")
private String delFlag; // private String delFlag;
//
@Excel(name = "乐观锁") // @Excel(name = "乐观锁")
private Integer revision; // private Integer revision;
//
@Excel(name = "创建人") // @Excel(name = "创建人")
private String createdBy; // private String createdBy;
@Excel(name = "创建时间") @Excel(name = "提交时间")
private Date createdTime; private String createdTime;
@Excel(name = "更新人") // @Excel(name = "更新人")
private String updatedBy; // private String updatedBy;
//
@Excel(name = "更新时间") // @Excel(name = "更新时间")
private Date updatedTime; // private Date updatedTime;
} }

22
epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/VactInfoService.java

@ -20,8 +20,10 @@ package com.elink.esua.epdc.modules.volunteer.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService; import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData; import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.modules.volunteer.entity.VactInfoEntity; import com.elink.esua.epdc.modules.volunteer.entity.VactInfoEntity;
import com.elink.esua.epdc.volunteer.VactInfoDTO; import com.elink.esua.epdc.volunteer.VactInfoDTO;
import com.elink.esua.epdc.volunteer.VactPageInfoDTO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -42,7 +44,7 @@ public interface VactInfoService extends BaseService<VactInfoEntity> {
* @author generator * @author generator
* @date 2021-09-01 * @date 2021-09-01
*/ */
PageData<VactInfoDTO> page(Map<String, Object> params); PageData<VactPageInfoDTO> page(Map<String, Object> params);
/** /**
* 默认查询 * 默认查询
@ -93,4 +95,22 @@ public interface VactInfoService extends BaseService<VactInfoEntity> {
* @date 2021-09-01 * @date 2021-09-01
*/ */
void delete(String[] ids); void delete(String[] ids);
/**
* @describe: 审核
* @author wangtong
* @date 2021/9/2 13:53
* @params [dto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
*/
Result handleApply(VactInfoDTO dto);
/**
* @describe: 设置志愿活动状态为已发布
* @author wangtong
* @date 2021/9/2 17:09
* @params [vactId]
* @return void
*/
void updateVactState(String vactId);
} }

34
epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/impl/VactInfoServiceImpl.java

@ -23,11 +23,13 @@ import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.page.PageData; import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.modules.volunteer.dao.VactInfoDao; import com.elink.esua.epdc.modules.volunteer.dao.VactInfoDao;
import com.elink.esua.epdc.modules.volunteer.entity.VactInfoEntity; import com.elink.esua.epdc.modules.volunteer.entity.VactInfoEntity;
import com.elink.esua.epdc.modules.volunteer.redis.VactInfoRedis; import com.elink.esua.epdc.modules.volunteer.redis.VactInfoRedis;
import com.elink.esua.epdc.modules.volunteer.service.VactInfoService; import com.elink.esua.epdc.modules.volunteer.service.VactInfoService;
import com.elink.esua.epdc.volunteer.VactInfoDTO; import com.elink.esua.epdc.volunteer.VactInfoDTO;
import com.elink.esua.epdc.volunteer.VactPageInfoDTO;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -50,12 +52,15 @@ public class VactInfoServiceImpl extends BaseServiceImpl<VactInfoDao, VactInfoEn
private VactInfoRedis vactInfoRedis; private VactInfoRedis vactInfoRedis;
@Override @Override
public PageData<VactInfoDTO> page(Map<String, Object> params) { public PageData<VactPageInfoDTO> page(Map<String, Object> params) {
IPage<VactInfoEntity> page = baseDao.selectPage( // IPage<VactInfoEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false), // getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params) // getWrapper(params)
); // );
return getPageData(page, VactInfoDTO.class); // return getPageData(page, VactInfoDTO.class);
IPage<VactPageInfoDTO> page = getPage(params);
List<VactPageInfoDTO> list = baseDao.getPageList(params);
return new PageData<>(list, page.getTotal());
} }
@Override @Override
@ -101,4 +106,21 @@ public class VactInfoServiceImpl extends BaseServiceImpl<VactInfoDao, VactInfoEn
baseDao.deleteBatchIds(Arrays.asList(ids)); baseDao.deleteBatchIds(Arrays.asList(ids));
} }
@Override
public Result handleApply(VactInfoDTO dto) {
VactInfoEntity entity = baseDao.selectById(dto.getId());
entity.setState(dto.getState());
entity.setReason(dto.getReason());
updateById(entity);
return new Result().ok("审核成功");
}
@Override
public void updateVactState(String vactId) {
VactInfoEntity entity = baseDao.selectById(vactId);
entity.setState("15");
entity.setReason("");
updateById(entity);
}
} }

10
epdc-cloud-heart/src/main/resources/mapper/activity/ActInfoDao.xml

@ -77,6 +77,7 @@
<result property="punishmentPoints" column="PUNISHMENT_POINTS"/> <result property="punishmentPoints" column="PUNISHMENT_POINTS"/>
<result property="reward" column="REWARD"/> <result property="reward" column="REWARD"/>
<result property="actUserDefaultState" column="ACT_USER_DEFAULT_STATE"/> <result property="actUserDefaultState" column="ACT_USER_DEFAULT_STATE"/>
<result property="actType" column="ACT_TYPE"/>
</resultMap> </resultMap>
<select id="getActInfoPageFromPC" resultMap="actResultMap"> <select id="getActInfoPageFromPC" resultMap="actResultMap">
SELECT SELECT
@ -113,7 +114,8 @@
actInfo.DEPT_ID, actInfo.DEPT_ID,
actInfo.PUNISHMENT_POINTS, actInfo.PUNISHMENT_POINTS,
actInfo.REWARD, actInfo.REWARD,
actInfo.ACT_USER_DEFAULT_STATE actInfo.ACT_USER_DEFAULT_STATE,
if(actInfo.ACT_TYPE='1','志愿活动','社区活动') as ACT_TYPE
FROM FROM
epdc_act_info actInfo epdc_act_info actInfo
WHERE WHERE
@ -127,6 +129,12 @@
<if test="actStatus != null and actStatus != ''"> <if test="actStatus != null and actStatus != ''">
AND actInfo.ACT_STATUS = #{actStatus} AND actInfo.ACT_STATUS = #{actStatus}
</if> </if>
<if test="actType != null and actType != '' and actType=='1'.toString()">
AND actInfo.ACT_TYPE = '1'
</if>
<if test="actType != null and actType != '' and actType=='0'.toString()">
AND (actInfo.ACT_TYPE = '0' or actInfo.ACT_TYPE is null or actInfo.ACT_TYPE = '')
</if>
ORDER BY ORDER BY
actInfo.CREATED_TIME DESC actInfo.CREATED_TIME DESC
</select> </select>

33
epdc-cloud-heart/src/main/resources/mapper/volunteer/VactInfoDao.xml

@ -33,6 +33,39 @@
<result property="updatedBy" column="UPDATED_BY"/> <result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<select id="getPageList" resultType="com.elink.esua.epdc.volunteer.VactPageInfoDTO">
SELECT v.id,
v.title,
v.state,
CASE v.STATE
WHEN '0' THEN '未审核'
WHEN '5' THEN '未通过'
WHEN '10' THEN '待发布'
WHEN '15' THEN '已发布'
else '' end as stateName,
CONCAT(DATE_FORMAT(v.ACT_START_TIME,'%Y.%m.%d'),' - ',DATE_FORMAT(v.ACT_END_TIME,'%Y.%m.%d')) as startEndTime,
REPLACE(GROUP_CONCAT(o.volunteer_org_name ORDER BY o.create_date DESC),',','、')as orgNames,
v.ACT_ADDRESS,
v.CREATED_TIME
FROM `epdc_vact_info` v
left join epdc_vact_org_relation r on r.VACT_ID=v.id and r.DEL_FLAG='0'
left join epdc_volunteer_org o on o.id=r.VOLUNTEER_ORG_ID
where v.DEL_FLAG='0'
<if test="title != null and title != ''">
and v.TITLE like '%${title}%'
</if>
<if test="volunteerOrgId != null and volunteerOrgId != ''">
and o.id=#{volunteerOrgId}
</if>
<if test="vactStartTime != null and vactStartTime != ''">
AND DATE_FORMAT( v.CREATED_TIME, '%Y-%m-%d' ) &gt;= #{vactStartTime}
</if>
<if test="vactEndTime != null and vactEndTime != ''">
AND DATE_FORMAT( v.CREATED_TIME, '%Y-%m-%d' ) &lt;= #{vactEndTime}
</if>
group by v.id
order by v.CREATED_TIME desc
</select>
</mapper> </mapper>
Loading…
Cancel
Save