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. 14
      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;
/**
* 活动类型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.feign.JobFeignClient;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -84,6 +85,8 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
private UserInfoFeignClient userInfoFeignClient;
@Autowired
private NewsTask newsTask;
@Autowired
private VactInfoService vactInfoService;
@Override
public PageData<ActInfoDTO> page(Map<String, Object> params) {
@ -138,6 +141,10 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
// 保存到banner
this.saveActInfoToBanner(entity.getId(), dto);
}
//修改志愿活动的状态
if(StringUtils.isNotBlank(dto.getVactId())){
vactInfoService.updateVactState(dto.getVactId());
}
// 创建定时任务(活动开始后将未审核的报名人员自动置为审核通过或不通过)
return this.saveActToScheduleJob(entity.getId(), dto.getActStartTime());
}
@ -145,6 +152,7 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
return new Result().error();
}
@Override
@Transactional(rollbackFor = Exception.class)
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.DefaultGroup;
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.service.VactInfoService;
import com.elink.esua.epdc.volunteer.VactInfoDTO;
import com.elink.esua.epdc.volunteer.VactPageInfoDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -49,10 +51,13 @@ public class VactInfoController {
@Autowired
private VactInfoService vactInfoService;
@Autowired
private VactInfoDao vactInfoDao;
@GetMapping("page")
public Result<PageData<VactInfoDTO>> page(@RequestParam Map<String, Object> params){
PageData<VactInfoDTO> page = vactInfoService.page(params);
return new Result<PageData<VactInfoDTO>>().ok(page);
public Result<PageData<VactPageInfoDTO>> page(@RequestParam Map<String, Object> params){
PageData<VactPageInfoDTO> page = vactInfoService.page(params);
return new Result<PageData<VactPageInfoDTO>>().ok(page);
}
@GetMapping("{id}")
@ -87,8 +92,20 @@ public class VactInfoController {
@GetMapping("export")
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);
}
/**
* @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);
}
}

14
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.modules.volunteer.entity.VactInfoEntity;
import com.elink.esua.epdc.volunteer.VactPageInfoDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 志愿活动表
*
@ -29,5 +33,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
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;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -63,6 +63,16 @@ public class VactInfoEntity extends BaseEpdcEntity {
*/
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 lombok.Data;
import java.util.Date;
/**
* 志愿活动表
*
@ -31,89 +29,95 @@ import java.util.Date;
@Data
public class VactInfoExcel {
@Excel(name = "主键")
private String id;
// @Excel(name = "主键")
// private String id;
@Excel(name = "所属组织")
private String orgNames;
@Excel(name = "标题")
private String title;
@Excel(name = "活动头图")
private String headPic;
@Excel(name = "活动起止日期")
private String startEndTime;
@Excel(name = "活动开始时间")
private Date actStartTime;
// @Excel(name = "活动头图")
// private String headPic;
@Excel(name = "活动结束时间")
private Date actEndTime;
// @Excel(name = "活动开始时间")
// private Date actStartTime;
//
// @Excel(name = "活动结束时间")
// private Date actEndTime;
@Excel(name = "活动地点")
private String actAddress;
@Excel(name = "报名要求")
private String requirement;
@Excel(name = "活动内容")
private String actContent;
// @Excel(name = "报名要求")
// private String requirement;
@Excel(name = "是否只允许志愿者参加 0否 1是")
private String volunteerFlag;
// @Excel(name = "活动内容")
// private String actContent;
@Excel(name = "联系人")
private String contacts;
// @Excel(name = "是否只允许志愿者参加 0否 1是")
// private String volunteerFlag;
@Excel(name = "联系电话")
private String tel;
// @Excel(name = "联系人")
// private String contacts;
//
// @Excel(name = "联系电话")
// private String tel;
@Excel(name = "审核状态:0-审核中,5-未通过,10-待发布,15已发布")
@Excel(name = "审核状态",
replace = { "审核中_0", "未通过_5", "待发布_10", "已发布_15"} )
private String state;
@Excel(name = "审核理由")
private String reason;
@Excel(name = "用户ID")
private String userId;
@Excel(name = "头像地址")
private String faceImg;
@Excel(name = "党员标识:0否1是")
private String partyFlag;
@Excel(name = "部门ID")
private String deptId;
@Excel(name = "部门名称")
private String deptName;
@Excel(name = "所有部门ID")
private String allDeptIds;
@Excel(name = "所有部门名称")
private String allDeptNames;
@Excel(name = "父所有部门")
private String parentDeptIds;
@Excel(name = "父所有部门")
private String parentDeptNames;
@Excel(name = "删除标识 0-否,1-是")
private String delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
// @Excel(name = "审核理由")
// private String reason;
// @Excel(name = "用户ID")
// private String userId;
//
// @Excel(name = "头像地址")
// private String faceImg;
//
// @Excel(name = "党员标识:0否1是")
// private String partyFlag;
//
// @Excel(name = "部门ID")
// private String deptId;
//
// @Excel(name = "部门名称")
// private String deptName;
//
// @Excel(name = "所有部门ID")
// private String allDeptIds;
//
// @Excel(name = "所有部门名称")
// private String allDeptNames;
//
// @Excel(name = "父所有部门")
// private String parentDeptIds;
//
// @Excel(name = "父所有部门")
// private String parentDeptNames;
//
// @Excel(name = "删除标识 0-否,1-是")
// private String delFlag;
//
// @Excel(name = "乐观锁")
// private Integer revision;
//
// @Excel(name = "创建人")
// private String createdBy;
@Excel(name = "提交时间")
private String createdTime;
// @Excel(name = "更新人")
// private String updatedBy;
//
// @Excel(name = "更新时间")
// 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.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.volunteer.VactInfoDTO;
import com.elink.esua.epdc.volunteer.VactPageInfoDTO;
import java.util.List;
import java.util.Map;
@ -42,7 +44,7 @@ public interface VactInfoService extends BaseService<VactInfoEntity> {
* @author generator
* @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
*/
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.page.PageData;
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.entity.VactInfoEntity;
import com.elink.esua.epdc.modules.volunteer.redis.VactInfoRedis;
import com.elink.esua.epdc.modules.volunteer.service.VactInfoService;
import com.elink.esua.epdc.volunteer.VactInfoDTO;
import com.elink.esua.epdc.volunteer.VactPageInfoDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -50,12 +52,15 @@ public class VactInfoServiceImpl extends BaseServiceImpl<VactInfoDao, VactInfoEn
private VactInfoRedis vactInfoRedis;
@Override
public PageData<VactInfoDTO> page(Map<String, Object> params) {
IPage<VactInfoEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, VactInfoDTO.class);
public PageData<VactPageInfoDTO> page(Map<String, Object> params) {
// IPage<VactInfoEntity> page = baseDao.selectPage(
// getPage(params, FieldConstant.CREATED_TIME, false),
// getWrapper(params)
// );
// return getPageData(page, VactInfoDTO.class);
IPage<VactPageInfoDTO> page = getPage(params);
List<VactPageInfoDTO> list = baseDao.getPageList(params);
return new PageData<>(list, page.getTotal());
}
@Override
@ -101,4 +106,21 @@ public class VactInfoServiceImpl extends BaseServiceImpl<VactInfoDao, VactInfoEn
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="reward" column="REWARD"/>
<result property="actUserDefaultState" column="ACT_USER_DEFAULT_STATE"/>
<result property="actType" column="ACT_TYPE"/>
</resultMap>
<select id="getActInfoPageFromPC" resultMap="actResultMap">
SELECT
@ -113,7 +114,8 @@
actInfo.DEPT_ID,
actInfo.PUNISHMENT_POINTS,
actInfo.REWARD,
actInfo.ACT_USER_DEFAULT_STATE
actInfo.ACT_USER_DEFAULT_STATE,
if(actInfo.ACT_TYPE='1','志愿活动','社区活动') as ACT_TYPE
FROM
epdc_act_info actInfo
WHERE
@ -127,6 +129,12 @@
<if test="actStatus != null and actStatus != ''">
AND actInfo.ACT_STATUS = #{actStatus}
</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
actInfo.CREATED_TIME DESC
</select>

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

@ -33,6 +33,39 @@
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</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>
Loading…
Cancel
Save