Commit d3bf0d24 authored by Shen's avatar Shen

1. 报名信息添加机构报名内容分页

2. 移动端添加报名
parent 80127ce8
...@@ -55,6 +55,20 @@ public class EnrollController { ...@@ -55,6 +55,20 @@ public class EnrollController {
return new Result<PageData<EnrollDTO>>().ok(page); return new Result<PageData<EnrollDTO>>().ok(page);
} }
@GetMapping("enrollPage")
@ApiOperation(value = "机构报名内容分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "orgId", value = "机构Id", paramType = "query", dataType="String")
})
public Result<PageData<EnrollDTO>> enrollPage(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<EnrollDTO> page = enrollService.getOrgEnroll(params);
return new Result<PageData<EnrollDTO>>().ok(page);
}
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation("信息") @ApiOperation("信息")
@RequiresPermissions("serviceOrder:enroll:info") @RequiresPermissions("serviceOrder:enroll:info")
......
package io.hmit.modules.serviceOrder.dao; package io.hmit.modules.serviceOrder.dao;
import io.hmit.common.dao.BaseDao; import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.dto.EnrollDTO;
import io.hmit.modules.serviceOrder.entity.EnrollEntity; import io.hmit.modules.serviceOrder.entity.EnrollEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 报名表 * 报名表
* *
...@@ -12,5 +15,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -12,5 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface EnrollDao extends BaseDao<EnrollEntity> { public interface EnrollDao extends BaseDao<EnrollEntity> {
List<EnrollDTO> getEnrollByOrgId(Long orgId);
} }
\ No newline at end of file
...@@ -17,4 +17,6 @@ public interface PensionOrganizationDao extends BaseDao<PensionOrganizationEntit ...@@ -17,4 +17,6 @@ public interface PensionOrganizationDao extends BaseDao<PensionOrganizationEntit
List<PensionOrganizationEntity> getAllOrganization(); List<PensionOrganizationEntity> getAllOrganization();
PensionOrganizationEntity getOrgByUserId(Long userId);
} }
\ No newline at end of file
...@@ -21,4 +21,6 @@ public interface PensionOrganizationServiceDao extends BaseDao<PensionOrganizati ...@@ -21,4 +21,6 @@ public interface PensionOrganizationServiceDao extends BaseDao<PensionOrganizati
*/ */
List<Long> findServiceIdListByServiceUserId(Long userId); List<Long> findServiceIdListByServiceUserId(Long userId);
Long getUserOrgId(Long userId);
} }
package io.hmit.modules.serviceOrder.service; package io.hmit.modules.serviceOrder.service;
import io.hmit.common.page.PageData;
import io.hmit.common.service.CrudService; import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.EnrollDTO; import io.hmit.modules.serviceOrder.dto.EnrollDTO;
import io.hmit.modules.serviceOrder.entity.EnrollEntity; import io.hmit.modules.serviceOrder.entity.EnrollEntity;
import java.util.Map;
/** /**
* 报名表 * 报名表
* *
...@@ -12,4 +15,6 @@ import io.hmit.modules.serviceOrder.entity.EnrollEntity; ...@@ -12,4 +15,6 @@ import io.hmit.modules.serviceOrder.entity.EnrollEntity;
*/ */
public interface EnrollService extends CrudService<EnrollEntity, EnrollDTO> { public interface EnrollService extends CrudService<EnrollEntity, EnrollDTO> {
PageData<EnrollDTO> getOrgEnroll(Map<String, Object> params);
} }
\ No newline at end of file
...@@ -18,4 +18,8 @@ public interface PensionOrganizationService extends CrudService<PensionOrganizat ...@@ -18,4 +18,8 @@ public interface PensionOrganizationService extends CrudService<PensionOrganizat
List<PensionOrganizationDTO> getAllOrganization(); List<PensionOrganizationDTO> getAllOrganization();
Long getUserOrgId(Long userId);
PensionOrganizationDTO getUserOrg(Long userId);
} }
package io.hmit.modules.serviceOrder.service.impl; package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.CrudServiceImpl; import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.SubListForPageUtil;
import io.hmit.modules.serviceOrder.dao.EnrollDao; import io.hmit.modules.serviceOrder.dao.EnrollDao;
import io.hmit.modules.serviceOrder.dto.EnrollDTO; import io.hmit.modules.serviceOrder.dto.EnrollDTO;
import io.hmit.modules.serviceOrder.entity.EnrollEntity; import io.hmit.modules.serviceOrder.entity.EnrollEntity;
import io.hmit.modules.serviceOrder.service.EnrollService; import io.hmit.modules.serviceOrder.service.EnrollService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -20,6 +24,9 @@ import java.util.Map; ...@@ -20,6 +24,9 @@ import java.util.Map;
@Service @Service
public class EnrollServiceImpl extends CrudServiceImpl<EnrollDao, EnrollEntity, EnrollDTO> implements EnrollService { public class EnrollServiceImpl extends CrudServiceImpl<EnrollDao, EnrollEntity, EnrollDTO> implements EnrollService {
@Autowired
private EnrollDao enrollDao;
@Override @Override
public QueryWrapper<EnrollEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<EnrollEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id"); String id = (String)params.get("id");
...@@ -30,5 +37,10 @@ public class EnrollServiceImpl extends CrudServiceImpl<EnrollDao, EnrollEntity, ...@@ -30,5 +37,10 @@ public class EnrollServiceImpl extends CrudServiceImpl<EnrollDao, EnrollEntity,
return wrapper; return wrapper;
} }
@Override
public PageData<EnrollDTO> getOrgEnroll(Map<String, Object> params) {
List<EnrollDTO> list = enrollDao.getEnrollByOrgId(Long.parseLong(params.get("orgId").toString()));
return getPageData(SubListForPageUtil.getSubList(params, list), list.size(), EnrollDTO.class);
}
} }
\ No newline at end of file
...@@ -41,7 +41,7 @@ public class PensionEventServiceImpl extends CrudServiceImpl<PensionEventDao, Pe ...@@ -41,7 +41,7 @@ public class PensionEventServiceImpl extends CrudServiceImpl<PensionEventDao, Pe
pensionEventEntity.setStatus(EventEnum.SUCCESS.getCode()); pensionEventEntity.setStatus(EventEnum.SUCCESS.getCode());
} }
}else if (status.equals(EventEnum.OVER.getCode())) { //停止报名 }else if (status.equals(EventEnum.OVER.getCode())) { //停止报名
if (pensionEventEntity.getStatus().equals(EventEnum.NEW.getCode())){ if (pensionEventEntity.getStatus().equals(EventEnum.SUCCESS.getCode())){
pensionEventEntity.setStatus(EventEnum.OVER.getCode()); pensionEventEntity.setStatus(EventEnum.OVER.getCode());
} }
}else if (status.equals(EventEnum.COMPLETE.getCode())) { //活动结束 }else if (status.equals(EventEnum.COMPLETE.getCode())) { //活动结束
...@@ -49,6 +49,8 @@ public class PensionEventServiceImpl extends CrudServiceImpl<PensionEventDao, Pe ...@@ -49,6 +49,8 @@ public class PensionEventServiceImpl extends CrudServiceImpl<PensionEventDao, Pe
pensionEventEntity.setStatus(EventEnum.COMPLETE.getCode()); pensionEventEntity.setStatus(EventEnum.COMPLETE.getCode());
pensionEventEntity.setEventClock(eventClock); pensionEventEntity.setEventClock(eventClock);
pensionEventEntity.setEventEndDescribe(endDesc); pensionEventEntity.setEventEndDescribe(endDesc);
}else if (pensionEventEntity.getStatus().equals(EventEnum.HIDDEN.getCode())) {
pensionEventEntity.setStatus(EventEnum.COMPLETE.getCode());
} }
}else if (status.equals(EventEnum.HIDDEN.getCode())){ //活动隐藏 }else if (status.equals(EventEnum.HIDDEN.getCode())){ //活动隐藏
if (pensionEventEntity.getStatus().equals(EventEnum.COMPLETE.getCode())){ if (pensionEventEntity.getStatus().equals(EventEnum.COMPLETE.getCode())){
......
...@@ -50,4 +50,14 @@ public class PensionOrganizationServiceImpl extends CrudServiceImpl<PensionOrgan ...@@ -50,4 +50,14 @@ public class PensionOrganizationServiceImpl extends CrudServiceImpl<PensionOrgan
public List<PensionOrganizationDTO> getAllOrganization() { public List<PensionOrganizationDTO> getAllOrganization() {
return ConvertUtils.sourceToTarget(pensionOrganizationDao.getAllOrganization(), PensionOrganizationDTO.class); return ConvertUtils.sourceToTarget(pensionOrganizationDao.getAllOrganization(), PensionOrganizationDTO.class);
} }
@Override
public Long getUserOrgId(Long userId) {
return pensionOrganizationServiceDao.getUserOrgId(userId);
}
@Override
public PensionOrganizationDTO getUserOrg(Long userId) {
return ConvertUtils.sourceToTarget(pensionOrganizationDao.getOrgByUserId(userId), PensionOrganizationDTO.class);
}
} }
...@@ -15,6 +15,8 @@ import io.hmit.common.validator.group.UpdateGroup; ...@@ -15,6 +15,8 @@ import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.security.password.PasswordUtils; import io.hmit.modules.security.password.PasswordUtils;
import io.hmit.modules.security.user.SecurityUser; import io.hmit.modules.security.user.SecurityUser;
import io.hmit.modules.security.user.UserDetail; import io.hmit.modules.security.user.UserDetail;
import io.hmit.modules.serviceOrder.dto.PensionOrganizationDTO;
import io.hmit.modules.serviceOrder.service.PensionOrganizationService;
import io.hmit.modules.sys.dto.PasswordDTO; import io.hmit.modules.sys.dto.PasswordDTO;
import io.hmit.modules.sys.dto.SysUserDTO; import io.hmit.modules.sys.dto.SysUserDTO;
import io.hmit.modules.sys.excel.SysUserExcel; import io.hmit.modules.sys.excel.SysUserExcel;
...@@ -48,6 +50,8 @@ public class SysUserController { ...@@ -48,6 +50,8 @@ public class SysUserController {
private SysUserService sysUserService; private SysUserService sysUserService;
@Autowired @Autowired
private SysRoleUserService sysRoleUserService; private SysRoleUserService sysRoleUserService;
@Autowired
private PensionOrganizationService pensionOrganizationService;
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页") @ApiOperation("分页")
...@@ -87,6 +91,11 @@ public class SysUserController { ...@@ -87,6 +91,11 @@ public class SysUserController {
public Result<SysUserDTO> info() { public Result<SysUserDTO> info() {
SysUserDTO data = ConvertUtils.sourceToTarget(SecurityUser.getUser(), SysUserDTO.class); SysUserDTO data = ConvertUtils.sourceToTarget(SecurityUser.getUser(), SysUserDTO.class);
try{
PensionOrganizationDTO organizationDTO = pensionOrganizationService.getUserOrg(SecurityUser.getUserId());
data.setOrgId(organizationDTO.getId());
data.setOrgName(organizationDTO.getName());
}catch (Exception ignore){}
return new Result<SysUserDTO>().ok(data); return new Result<SysUserDTO>().ok(data);
} }
......
package io.hmit.modules.sys.dto; package io.hmit.modules.sys.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.hmit.common.validator.group.AddGroup; import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup; import io.hmit.common.validator.group.DefaultGroup;
...@@ -83,4 +84,11 @@ public class SysUserDTO implements Serializable { ...@@ -83,4 +84,11 @@ public class SysUserDTO implements Serializable {
@ApiModelProperty(value = "部门名称") @ApiModelProperty(value = "部门名称")
private String deptName; private String deptName;
@JsonInclude(value= JsonInclude.Include.NON_NULL)
@ApiModelProperty(value = "机构Id")
private Long orgId;
@JsonInclude(value= JsonInclude.Include.NON_NULL)
@ApiModelProperty(value = "机构名称")
private String orgName;
} }
\ No newline at end of file
...@@ -20,5 +20,9 @@ ...@@ -20,5 +20,9 @@
<result property="updateDate" column="update_date"/> <result property="updateDate" column="update_date"/>
</resultMap> </resultMap>
<select id="getEnrollByOrgId" resultType="io.hmit.modules.serviceOrder.dto.EnrollDTO">
SELECT * FROM pension_event pe, tb_enroll te
WHERE pe.id = te.event_id AND event_org_id = #{orgId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -16,4 +16,9 @@ ...@@ -16,4 +16,9 @@
SELECT po.id, po.name, po.icon FROM pension_organization po SELECT po.id, po.name, po.icon FROM pension_organization po
</select> </select>
<select id="getOrgByUserId" resultType="io.hmit.modules.serviceOrder.entity.PensionOrganizationEntity">
SELECT * FROM pension_organization po, pension_organization_user pou
WHERE po.id = pou.organization_id AND pou.user_id = #{userId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -16,5 +16,9 @@ ...@@ -16,5 +16,9 @@
WHERE pou.organization_id = pos.organization_id and pou.user_id = #{userId} WHERE pou.organization_id = pos.organization_id and pou.user_id = #{userId}
</select> </select>
<select id="getUserOrgId" resultType="Long">
SELECT pension_organization_user.organization_id
FROM pension_organization_user WHERE user_id = #{userId}
</select>
</mapper> </mapper>
...@@ -27,7 +27,7 @@ public class SwaggerConfig { ...@@ -27,7 +27,7 @@ public class SwaggerConfig {
@Bean @Bean
public Docket createRestApi() { public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.SWAGGER_2)
.host("byyl.zjhmit.com") // .host("byyl.zjhmit.com")
.apiInfo(apiInfo()) .apiInfo(apiInfo())
.select() .select()
//加了ApiOperation注解的类,才生成接口文档 //加了ApiOperation注解的类,才生成接口文档
......
...@@ -55,6 +55,7 @@ public class WebMvcConfig implements WebMvcConfigurer { ...@@ -55,6 +55,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionorder/**"); registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionorder/**");
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionservicetype/**"); registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionservicetype/**");
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionconsignee/**"); registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionconsignee/**");
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/enroll/doEnroll");
} }
@Override @Override
......
package io.hmit.modules.serviceOrder.controller; package io.hmit.modules.serviceOrder.controller;
import io.hmit.annotation.Login;
import io.hmit.annotation.LoginUser;
import io.hmit.common.constant.Constant; import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData; import io.hmit.common.page.PageData;
import io.hmit.common.utils.Result; import io.hmit.common.utils.Result;
...@@ -8,6 +10,7 @@ import io.hmit.common.validator.ValidatorUtils; ...@@ -8,6 +10,7 @@ import io.hmit.common.validator.ValidatorUtils;
import io.hmit.common.validator.group.AddGroup; import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup; import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup; import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.EnrollDTO; import io.hmit.modules.serviceOrder.dto.EnrollDTO;
import io.hmit.modules.serviceOrder.service.EnrollService; import io.hmit.modules.serviceOrder.service.EnrollService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -48,6 +51,18 @@ public class EnrollController { ...@@ -48,6 +51,18 @@ public class EnrollController {
return new Result<PageData<EnrollDTO>>().ok(page); return new Result<PageData<EnrollDTO>>().ok(page);
} }
@Login
@PostMapping("doEnroll")
@ApiOperation("报名")
public Result doEnroll(@ApiIgnore @LoginUser UserEntity user,
@RequestParam("eventId") Long eventId){
EnrollDTO enrollDTO = new EnrollDTO();
enrollDTO.setUserId(user.getId());
enrollService.addEnrollInfo(enrollDTO, eventId);
return new Result();
}
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation("信息") @ApiOperation("信息")
public Result<EnrollDTO> get(@PathVariable("id") Long id){ public Result<EnrollDTO> get(@PathVariable("id") Long id){
......
...@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -45,6 +46,19 @@ public class PensionEventController { ...@@ -45,6 +46,19 @@ public class PensionEventController {
return new Result<PageData<PensionEventDTO>>().ok(page); return new Result<PageData<PensionEventDTO>>().ok(page);
} }
@GetMapping("userPage")
@ApiOperation(value = "展示分页", notes = "返回值不包括未发布和隐藏内容")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
public Result<PageData<PensionEventDTO>> userPage(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<PensionEventDTO> page = pensionEventService.getUserPage(params);
return new Result<PageData<PensionEventDTO>>().ok(page);
}
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation("信息") @ApiOperation("信息")
public Result<PensionEventDTO> get(@PathVariable("id") Long id){ public Result<PensionEventDTO> get(@PathVariable("id") Long id){
......
package io.hmit.modules.serviceOrder.dao; package io.hmit.modules.serviceOrder.dao;
import io.hmit.common.dao.BaseDao; import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.dto.PensionEventDTO;
import io.hmit.modules.serviceOrder.entity.PensionEventEntity; import io.hmit.modules.serviceOrder.entity.PensionEventEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 活动表 * 活动表
* *
...@@ -12,5 +15,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -12,5 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface PensionEventDao extends BaseDao<PensionEventEntity> { public interface PensionEventDao extends BaseDao<PensionEventEntity> {
List<PensionEventDTO> getEventForUser();
} }
\ No newline at end of file
package io.hmit.modules.serviceOrder.service; package io.hmit.modules.serviceOrder.service;
import io.hmit.common.page.PageData;
import io.hmit.common.service.CrudService; import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.EnrollDTO; import io.hmit.modules.serviceOrder.dto.EnrollDTO;
import io.hmit.modules.serviceOrder.entity.EnrollEntity; import io.hmit.modules.serviceOrder.entity.EnrollEntity;
import java.util.Map;
/** /**
* 报名表 * 报名表
* *
...@@ -12,4 +15,6 @@ import io.hmit.modules.serviceOrder.entity.EnrollEntity; ...@@ -12,4 +15,6 @@ import io.hmit.modules.serviceOrder.entity.EnrollEntity;
*/ */
public interface EnrollService extends CrudService<EnrollEntity, EnrollDTO> { public interface EnrollService extends CrudService<EnrollEntity, EnrollDTO> {
Boolean addEnrollInfo(EnrollDTO enrollDTO, Long eventId);
} }
\ No newline at end of file
package io.hmit.modules.serviceOrder.service; package io.hmit.modules.serviceOrder.service;
import io.hmit.common.page.PageData;
import io.hmit.common.service.CrudService; import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionEventDTO; import io.hmit.modules.serviceOrder.dto.PensionEventDTO;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.entity.PensionEventEntity; import io.hmit.modules.serviceOrder.entity.PensionEventEntity;
import java.util.List;
import java.util.Map;
/** /**
* 活动表 * 活动表
* *
...@@ -12,4 +17,6 @@ import io.hmit.modules.serviceOrder.entity.PensionEventEntity; ...@@ -12,4 +17,6 @@ import io.hmit.modules.serviceOrder.entity.PensionEventEntity;
*/ */
public interface PensionEventService extends CrudService<PensionEventEntity, PensionEventDTO> { public interface PensionEventService extends CrudService<PensionEventEntity, PensionEventDTO> {
PageData<PensionEventDTO> getUserPage(Map<String, Object> params);
} }
\ No newline at end of file
package io.hmit.modules.serviceOrder.service.impl; package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.CrudServiceImpl; import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.SubListForPageUtil;
import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dao.EnrollDao; import io.hmit.modules.serviceOrder.dao.EnrollDao;
import io.hmit.modules.serviceOrder.dto.EnrollDTO; import io.hmit.modules.serviceOrder.dto.EnrollDTO;
import io.hmit.modules.serviceOrder.dto.PensionEventDTO;
import io.hmit.modules.serviceOrder.entity.EnrollEntity; import io.hmit.modules.serviceOrder.entity.EnrollEntity;
import io.hmit.modules.serviceOrder.entity.PensionEventEntity;
import io.hmit.modules.serviceOrder.service.EnrollService; import io.hmit.modules.serviceOrder.service.EnrollService;
import io.hmit.modules.serviceOrder.service.PensionEventService;
import io.hmit.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import sun.rmi.runtime.Log;
import java.util.Date;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -17,9 +30,16 @@ import java.util.Map; ...@@ -17,9 +30,16 @@ import java.util.Map;
* @author Shen Yuanfeng syf0412@vip.qq.com * @author Shen Yuanfeng syf0412@vip.qq.com
* @since 1.0.0 2021-05-12 * @since 1.0.0 2021-05-12
*/ */
@Slf4j
@Service @Service
public class EnrollServiceImpl extends CrudServiceImpl<EnrollDao, EnrollEntity, EnrollDTO> implements EnrollService { public class EnrollServiceImpl extends CrudServiceImpl<EnrollDao, EnrollEntity, EnrollDTO> implements EnrollService {
@Autowired
private PensionEventService pensionEventService;
@Autowired
private UserService userService;
@Override @Override
public QueryWrapper<EnrollEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<EnrollEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id"); String id = (String)params.get("id");
...@@ -31,4 +51,31 @@ public class EnrollServiceImpl extends CrudServiceImpl<EnrollDao, EnrollEntity, ...@@ -31,4 +51,31 @@ public class EnrollServiceImpl extends CrudServiceImpl<EnrollDao, EnrollEntity,
} }
@Override
public Boolean addEnrollInfo(EnrollDTO enrollDTO, Long eventId) {
try {
PensionEventEntity pensionEventEntity = pensionEventService.selectById(eventId);
BeanUtils.copyProperties(pensionEventEntity, enrollDTO);
enrollDTO.setEventId(eventId);
UserEntity userEntity = userService.selectById(enrollDTO.getUserId());
enrollDTO.setName(userEntity.getUsername());
enrollDTO.setMobile(userEntity.getMobile());
Integer gender = 1;
if (null != userEntity.getGender() && userEntity.getGender().equals("女")) {
gender = 2;
}
enrollDTO.setId(null);
enrollDTO.setStatus(0);
enrollDTO.setCreateDate(null);
enrollDTO.setUpdateDate(null);
enrollDTO.setGender(gender);
save(enrollDTO);
//TODO 推送用户报名信息
}catch (Exception e) {
log.error(e.getMessage());
return false;
}
return true;
}
} }
\ No newline at end of file
package io.hmit.modules.serviceOrder.service.impl; package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.CrudServiceImpl; import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.SubListForPageUtil;
import io.hmit.modules.serviceOrder.dao.PensionEventDao; import io.hmit.modules.serviceOrder.dao.PensionEventDao;
import io.hmit.modules.serviceOrder.dto.PensionEventDTO; import io.hmit.modules.serviceOrder.dto.PensionEventDTO;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.entity.PensionEventEntity; import io.hmit.modules.serviceOrder.entity.PensionEventEntity;
import io.hmit.modules.serviceOrder.service.PensionEventService; import io.hmit.modules.serviceOrder.service.PensionEventService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -30,5 +35,12 @@ public class PensionEventServiceImpl extends CrudServiceImpl<PensionEventDao, Pe ...@@ -30,5 +35,12 @@ public class PensionEventServiceImpl extends CrudServiceImpl<PensionEventDao, Pe
return wrapper; return wrapper;
} }
@Autowired
private PensionEventDao pensionEventDao;
@Override
public PageData<PensionEventDTO> getUserPage(Map<String, Object> params) {
List<PensionEventDTO> list = pensionEventDao.getEventForUser();
return getPageData(SubListForPageUtil.getSubList(params, list), list.size(), PensionEventDTO.class);
}
} }
\ No newline at end of file
...@@ -17,8 +17,9 @@ ...@@ -17,8 +17,9 @@
<select id="getAllOrganizationStaff" resultType="Long"> <select id="getAllOrganizationStaff" resultType="Long">
SELECT user_id FROM pension_organization_user SELECT user_id FROM pension_organization_user
WHERE organization_id = (SELECT organization_id FROM pension_organization_user WHERE organization_id =
WHERE user_id = #{userId}); (SELECT organization_id FROM pension_organization_user pou, tb_user tu
WHERE pou.user_id = tu.user_id AND tu.id = #{userId})
</select> </select>
<select id="getOrgUserByUserId" resultType="io.hmit.dto.OrgUserInfoDTO"> <select id="getOrgUserByUserId" resultType="io.hmit.dto.OrgUserInfoDTO">
......
...@@ -28,5 +28,9 @@ ...@@ -28,5 +28,9 @@
<result property="updateDate" column="update_date"/> <result property="updateDate" column="update_date"/>
</resultMap> </resultMap>
<select id="getEventForUser" resultType="io.hmit.modules.serviceOrder.dto.PensionEventDTO">
SELECT pe.id, pe.event_title, pe.event_image_url, pe.event_org_name, pe.event_date
FROM pension_event pe WHERE pe.status != 0 AND pe.status != 4
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment