59 changed files with 3408 additions and 32 deletions
@ -0,0 +1,57 @@ |
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.activity.form.ActSignInFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInScanQrCodeFormDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInScanQrCodeResultDTO; |
|||
import com.elink.esua.epdc.common.token.dto.TokenDto; |
|||
import com.elink.esua.epdc.commons.tools.annotation.LoginUser; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.service.ActSignInService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* 居民端-活动扫码签到 |
|||
* |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 17:33 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("act/actsignin") |
|||
public class ApiActSignInController { |
|||
|
|||
@Autowired |
|||
private ActSignInService actSignInService; |
|||
|
|||
/** |
|||
* 居民扫签到码获取活动信息接口 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.activity.result.ActSignInScanQrCodeResultDTO> |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 18:00 |
|||
*/ |
|||
@GetMapping("actInfo") |
|||
public Result<ActSignInScanQrCodeResultDTO> getActInfo(@LoginUser TokenDto userDetail, ActSignInScanQrCodeFormDTO formDto) { |
|||
ValidatorUtils.validateEntity(formDto); |
|||
formDto.setUserId(userDetail.getUserId()); |
|||
return actSignInService.getSignInActInfo(formDto); |
|||
} |
|||
|
|||
/** |
|||
* 居民扫码签到 |
|||
* |
|||
* @param userDetail |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author Liuchuang |
|||
* @since 2021/2/25 13:55 |
|||
*/ |
|||
@PostMapping("signin") |
|||
public Result scanSignIn(@LoginUser TokenDto userDetail, @RequestBody ActSignInFormDTO formDto) { |
|||
ValidatorUtils.validateEntity(formDto); |
|||
formDto.setUserId(userDetail.getUserId()); |
|||
return actSignInService.scanSignIn(formDto); |
|||
} |
|||
} |
@ -0,0 +1,75 @@ |
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.activity.form.ActSignInListFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInRecordFormDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInListResultDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInQrCodeResultDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInRecordsDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInRecordsResultDTO; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.service.ActSignInService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 工作端-活动扫码签到 |
|||
* |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 13:39 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("work/actsignin") |
|||
public class ApiWorkActSignInController { |
|||
|
|||
@Autowired |
|||
private ActSignInService actSignInService; |
|||
|
|||
/** |
|||
* 活动列表(打卡中的活动) |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.activity.result.ActSignInListResultDTO>> |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 13:49 |
|||
*/ |
|||
@GetMapping("actlist") |
|||
public Result<List<ActSignInListResultDTO>> getSignInActList(ActSignInListFormDTO formDto) { |
|||
ValidatorUtils.validateEntity(formDto); |
|||
|
|||
return actSignInService.listOfSignInActs(formDto); |
|||
} |
|||
|
|||
/** |
|||
* 获取活动签到码 |
|||
* |
|||
* @param actId |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 14:22 |
|||
*/ |
|||
@GetMapping("getqrcode/{actId}") |
|||
public Result<ActSignInQrCodeResultDTO> getActSignInQrCode(@PathVariable("actId") String actId) { |
|||
return actSignInService.getActSignInQrCode(actId); |
|||
} |
|||
|
|||
/** |
|||
* 获取活动签到记录 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.activity.result.ActSignInRecordResultDTO>> |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 15:20 |
|||
*/ |
|||
@GetMapping("getsigninlist") |
|||
public Result<ActSignInRecordsResultDTO> getSignInList(ActSignInRecordFormDTO formDto) { |
|||
ValidatorUtils.validateEntity(formDto); |
|||
|
|||
return actSignInService.listOfSignInRecords(formDto); |
|||
} |
|||
} |
@ -0,0 +1,69 @@ |
|||
package com.elink.esua.epdc.service; |
|||
|
|||
import com.elink.esua.epdc.activity.form.ActSignInFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInListFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInRecordFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInScanQrCodeFormDTO; |
|||
import com.elink.esua.epdc.activity.result.*; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 工作端-活动扫码签到 |
|||
* |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 13:39 |
|||
*/ |
|||
public interface ActSignInService { |
|||
|
|||
/** |
|||
* 活动列表(打卡中的活动) |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.activity.result.ActSignInListResultDTO>> |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 13:51 |
|||
*/ |
|||
Result<List<ActSignInListResultDTO>> listOfSignInActs(ActSignInListFormDTO formDto); |
|||
|
|||
/** |
|||
* 获取活动签到码 |
|||
* |
|||
* @param actId |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<ActSignInQrCodeResultDTO> |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 14:24 |
|||
*/ |
|||
Result<ActSignInQrCodeResultDTO> getActSignInQrCode(String actId); |
|||
|
|||
/** |
|||
* 获取活动签到记录 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.activity.result.ActSignInRecordResultDTO>> |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 15:22 |
|||
*/ |
|||
Result<ActSignInRecordsResultDTO> listOfSignInRecords(ActSignInRecordFormDTO formDto); |
|||
|
|||
/** |
|||
* 居民扫签到码获取活动信息接口 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.activity.result.ActSignInScanQrCodeResultDTO> |
|||
* @author Liuchuang |
|||
* @since 2021/2/25 9:34 |
|||
*/ |
|||
Result<ActSignInScanQrCodeResultDTO> getSignInActInfo(ActSignInScanQrCodeFormDTO formDto); |
|||
|
|||
/** |
|||
* 居民扫码签到 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author Liuchuang |
|||
* @since 2021/2/25 13:58 |
|||
*/ |
|||
Result scanSignIn(ActSignInFormDTO formDto); |
|||
} |
@ -0,0 +1,46 @@ |
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.elink.esua.epdc.activity.form.ActSignInFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInListFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInRecordFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInScanQrCodeFormDTO; |
|||
import com.elink.esua.epdc.activity.result.*; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.feign.ActInfoFeignClient; |
|||
import com.elink.esua.epdc.service.ActSignInService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class ActSignInServiceImpl implements ActSignInService { |
|||
|
|||
@Autowired |
|||
private ActInfoFeignClient actInfoFeignClient; |
|||
|
|||
@Override |
|||
public Result<List<ActSignInListResultDTO>> listOfSignInActs(ActSignInListFormDTO formDto) { |
|||
return actInfoFeignClient.getSignInActList(formDto); |
|||
} |
|||
|
|||
@Override |
|||
public Result<ActSignInQrCodeResultDTO> getActSignInQrCode(String actId) { |
|||
return actInfoFeignClient.getActSignInQrCode(actId); |
|||
} |
|||
|
|||
@Override |
|||
public Result<ActSignInRecordsResultDTO> listOfSignInRecords(ActSignInRecordFormDTO formDto) { |
|||
return actInfoFeignClient.getSignInList(formDto); |
|||
} |
|||
|
|||
@Override |
|||
public Result<ActSignInScanQrCodeResultDTO> getSignInActInfo(ActSignInScanQrCodeFormDTO formDto) { |
|||
return actInfoFeignClient.getActInfo(formDto); |
|||
} |
|||
|
|||
@Override |
|||
public Result scanSignIn(ActSignInFormDTO formDto) { |
|||
return actInfoFeignClient.scanSignIn(formDto); |
|||
} |
|||
} |
@ -0,0 +1,157 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 用户建议表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-03-02 |
|||
*/ |
|||
@Data |
|||
public class AdviceDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 建议描述 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 建议人 |
|||
*/ |
|||
private String adviceUser; |
|||
|
|||
/** |
|||
* 建议人联系电话 |
|||
*/ |
|||
private String adviceUserMobile; |
|||
|
|||
/** |
|||
* 是否匿名 0-否,1-是 |
|||
*/ |
|||
private String anonymousFlag; |
|||
|
|||
/** |
|||
* 真实姓名 |
|||
*/ |
|||
private String realName; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 用户昵称 |
|||
*/ |
|||
private String nickname; |
|||
|
|||
/** |
|||
* 用户头像 |
|||
*/ |
|||
private String userFace; |
|||
|
|||
/** |
|||
* 用户电话 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 所属部门ID |
|||
*/ |
|||
private Long deptId; |
|||
|
|||
/** |
|||
* 所属部门名称 |
|||
*/ |
|||
private String deptName; |
|||
|
|||
/** |
|||
* 父所有部门ID |
|||
*/ |
|||
private String parentDeptIds; |
|||
|
|||
/** |
|||
* 父所有部门名称 |
|||
*/ |
|||
private String parentDeptNames; |
|||
|
|||
/** |
|||
* 所有部门ID |
|||
*/ |
|||
private String allDeptIds; |
|||
|
|||
/** |
|||
* 所有部门名称 |
|||
*/ |
|||
private String allDeptNames; |
|||
|
|||
/** |
|||
* 屏蔽标识 0:未屏蔽,1:已屏蔽 |
|||
*/ |
|||
private String shieldFlag; |
|||
|
|||
/** |
|||
* 屏蔽原因 |
|||
*/ |
|||
private String shieldReason; |
|||
|
|||
/** |
|||
* 删除标识 0-否,1-是 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.elink.esua.epdc.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 举报问题列表查询参数 |
|||
* |
|||
@author songyunpeng |
|||
@since 2022/3/02 17:12 |
|||
*/ |
|||
@Data |
|||
public class AdviceListFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 2105013928295376961L; |
|||
|
|||
/** |
|||
* 页码 |
|||
*/ |
|||
@NotNull(message = "页码不能为空") |
|||
private Integer pageIndex; |
|||
|
|||
/** |
|||
* 页容量 |
|||
*/ |
|||
@NotNull(message = "页容量不能为空") |
|||
private Integer pageSize; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 图片类型 |
|||
*/ |
|||
private String imgType; |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.elink.esua.epdc.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.Size; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 屏蔽用户举报问题表单 |
|||
* |
|||
* @author songyunpeng |
|||
* * @since 2022/3/02 17:12 |
|||
*/ |
|||
@Data |
|||
public class AdviceShieldFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -3686477439903152467L; |
|||
|
|||
/** |
|||
* 举报问题ID |
|||
*/ |
|||
@NotBlank(message = "记录ID不能为空") |
|||
private String id; |
|||
|
|||
/** |
|||
* 屏蔽原因 |
|||
*/ |
|||
@NotBlank(message = "屏蔽原因不能为空") |
|||
@Size(min = 1, max = 100, message = "屏蔽原因不能为空且在100个字以内") |
|||
private String shieldReason; |
|||
} |
@ -0,0 +1,105 @@ |
|||
package com.elink.esua.epdc.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.Size; |
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 用户建议问题提交表单 |
|||
* |
|||
* @author songyunpeng |
|||
* @since 2022/3/02 17:12 |
|||
*/ |
|||
@Data |
|||
public class AdviceSubmitFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -4805817350334564137L; |
|||
|
|||
/** |
|||
* 问题描述(500字符以内) |
|||
*/ |
|||
@NotBlank(message = "问题描述不能为空") |
|||
@Size(min = 1, max = 500, message = "问题描述不能为空且在500个字以内") |
|||
private String content; |
|||
|
|||
/** |
|||
* 是否匿名(0-否,1-是) |
|||
*/ |
|||
@NotBlank(message = "是否匿名不能为空") |
|||
private String anonymousFlag; |
|||
|
|||
/** |
|||
* 建议人 |
|||
*/ |
|||
@Size(max = 20, message = "建议人信息超出字数限制") |
|||
private String adviceUser; |
|||
|
|||
/** |
|||
* 建议人电话 |
|||
*/ |
|||
@Size(max = 20, message = "建议人电话超出字数限制") |
|||
private String adviceUserMobile; |
|||
|
|||
/** |
|||
* 图片 |
|||
*/ |
|||
private List<String> images; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 昵称 |
|||
*/ |
|||
private String nickname; |
|||
|
|||
/** |
|||
* 用户头像 |
|||
*/ |
|||
private String userFace; |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 真实姓名 |
|||
*/ |
|||
private String realName; |
|||
|
|||
/** |
|||
* 部门名称 |
|||
*/ |
|||
private String deptName; |
|||
/** |
|||
* 部门ID |
|||
*/ |
|||
private Long deptId; |
|||
|
|||
/** |
|||
* 父所有部门ID |
|||
*/ |
|||
private String parentDeptIds; |
|||
/** |
|||
* 父所有部门 |
|||
*/ |
|||
private String parentDeptNames; |
|||
/** |
|||
* 所有部门ID |
|||
*/ |
|||
private String allDeptIds; |
|||
/** |
|||
* 所有部门 |
|||
*/ |
|||
private String allDeptNames; |
|||
|
|||
/** |
|||
*是否提交为内容待审核状态 |
|||
*/ |
|||
private Boolean isConReview = false; |
|||
} |
@ -0,0 +1,50 @@ |
|||
package com.elink.esua.epdc.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 用户建议问题 |
|||
* |
|||
* @author songyunpeng |
|||
* @since 2021/03/02 17:12 |
|||
*/ |
|||
@Data |
|||
public class AdviceResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -4805817350334564137L; |
|||
|
|||
private String id; |
|||
|
|||
/** |
|||
* 问题描述 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 是否匿名 |
|||
*/ |
|||
private String anonymousFlag; |
|||
|
|||
/** |
|||
* 建议人 |
|||
*/ |
|||
private String adviceUser; |
|||
|
|||
/** |
|||
* 建议人电话 |
|||
*/ |
|||
private String adviceUserMobile; |
|||
|
|||
/** |
|||
* 提交时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 图片 |
|||
*/ |
|||
private List<String> images; |
|||
} |
@ -0,0 +1,108 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.advice.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
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.dto.AdviceDTO; |
|||
import com.elink.esua.epdc.dto.form.AdviceShieldFormDTO; |
|||
import com.elink.esua.epdc.modules.advice.excel.AdviceExcel; |
|||
import com.elink.esua.epdc.modules.advice.service.AdviceService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 用户建议表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-03-02 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("advice") |
|||
public class AdviceController { |
|||
|
|||
@Autowired |
|||
private AdviceService adviceService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<AdviceDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<AdviceDTO> page = adviceService.page(params); |
|||
return new Result<PageData<AdviceDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<AdviceDTO> get(@PathVariable("id") String id){ |
|||
AdviceDTO data = adviceService.get(id); |
|||
return new Result<AdviceDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody AdviceDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
adviceService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody AdviceDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
adviceService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
adviceService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<AdviceDTO> list = adviceService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, AdviceExcel.class); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* @Description 屏蔽 |
|||
* @Author songyunpeng |
|||
* @Date 2021/3/2 |
|||
* @Param [formDto] |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
**/ |
|||
@PostMapping("shield") |
|||
public Result shieldReportIssue(@RequestBody AdviceShieldFormDTO formDto) { |
|||
ValidatorUtils.validateEntity(formDto); |
|||
return adviceService.modifyAdviceShieldFlag(formDto); |
|||
} |
|||
} |
@ -0,0 +1,70 @@ |
|||
package com.elink.esua.epdc.modules.advice.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.dto.form.AdviceListFormDTO; |
|||
import com.elink.esua.epdc.dto.form.AdviceSubmitFormDTO; |
|||
import com.elink.esua.epdc.dto.result.AdviceResultDTO; |
|||
import com.elink.esua.epdc.modules.advice.service.AdviceService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 用户建议-移动端接口 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2020-10-22 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(Constant.EPDC_APP + "advice") |
|||
public class AppAdviceController { |
|||
|
|||
@Autowired |
|||
private AdviceService adviceService; |
|||
|
|||
/** |
|||
* 用户建议提交 |
|||
* |
|||
* @param formDto 提交信息 |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author songyunpeng |
|||
* @since 2020/10/22 17:28 |
|||
*/ |
|||
@PostMapping("submit") |
|||
public Result adviceSubmit(@RequestBody AdviceSubmitFormDTO formDto) { |
|||
ValidatorUtils.validateEntity(formDto); |
|||
|
|||
return adviceService.saveAdvice(formDto); |
|||
} |
|||
|
|||
/** |
|||
* 用户建议列表 |
|||
* |
|||
* @param formDto 参数 |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.adviceSubmitResultDTO>> |
|||
* @author songyunpeng |
|||
* @since 2020/10/23 10:06 |
|||
*/ |
|||
@GetMapping("list") |
|||
public Result<List<AdviceResultDTO>> adviceList(@RequestBody AdviceListFormDTO formDto) { |
|||
List<AdviceResultDTO> data = adviceService.listAdvice(formDto); |
|||
return new Result<List<AdviceResultDTO>>().ok(data); |
|||
} |
|||
|
|||
/** |
|||
* 建议详情 |
|||
* |
|||
* @param id 记录ID |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.result.adviceResultDTO> |
|||
* @author songyunpeng |
|||
* @since 2020/10/23 10:39 |
|||
*/ |
|||
@GetMapping("detail/{id}") |
|||
public Result<AdviceResultDTO> adviceDetail(@PathVariable("id") String id) { |
|||
AdviceResultDTO data = adviceService.getAdviceById(id); |
|||
return new Result<AdviceResultDTO>().ok(data); |
|||
} |
|||
} |
@ -0,0 +1,73 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.advice.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.dto.AdviceDTO; |
|||
import com.elink.esua.epdc.dto.form.AdviceListFormDTO; |
|||
import com.elink.esua.epdc.dto.result.AdviceResultDTO; |
|||
import com.elink.esua.epdc.modules.advice.entity.AdviceEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 用户建议表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-03-02 |
|||
*/ |
|||
@Mapper |
|||
public interface AdviceDao extends BaseDao<AdviceEntity> { |
|||
|
|||
/** |
|||
* 用户建议问题列表 |
|||
* |
|||
* @param formDto 参数 |
|||
* @return java.util.List<com.elink.esua.epdc.dto.result.AdviceResultDTO> |
|||
* @author Liuchuang |
|||
* @since 2020/10/23 11:08 |
|||
*/ |
|||
List<AdviceResultDTO> selectListAdvice(AdviceListFormDTO formDto); |
|||
|
|||
/** |
|||
* 建议问题详情 |
|||
* |
|||
* @param id 记录ID |
|||
* @return com.elink.esua.epdc.dto.result.AdviceResultDTO |
|||
* @author Liuchuang |
|||
* @since 2020/10/23 16:23 |
|||
*/ |
|||
AdviceResultDTO selectOneAdvice(String id); |
|||
/** |
|||
* @Description 查询需要修改组织机构信息事件 |
|||
* @Author songyunpeng |
|||
* @Date 2020/11/25 |
|||
* @Param [toString] |
|||
* @return java.util.List<com.elink.esua.epdc.dto.ArchivesDTO> |
|||
**/ |
|||
List<AdviceDTO> selectListOfOrganizationInfo(String toString); |
|||
/** |
|||
* @Description 更新部门名 |
|||
* @Author songyunpeng |
|||
* @Date 2020/11/25 |
|||
* @Param [newDeptName, deptId] |
|||
* @return void |
|||
**/ |
|||
void updateGridByDeptId(String newDeptName, Long deptId); |
|||
} |
@ -0,0 +1,123 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.advice.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 用户建议表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-03-02 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_advice") |
|||
public class AdviceEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 建议描述 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 建议人 |
|||
*/ |
|||
private String adviceUser; |
|||
|
|||
/** |
|||
* 建议人联系电话 |
|||
*/ |
|||
private String adviceUserMobile; |
|||
|
|||
/** |
|||
* 是否匿名 0-否,1-是 |
|||
*/ |
|||
private String anonymousFlag; |
|||
|
|||
/** |
|||
* 真实姓名 |
|||
*/ |
|||
private String realName; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 用户昵称 |
|||
*/ |
|||
private String nickname; |
|||
|
|||
/** |
|||
* 用户头像 |
|||
*/ |
|||
private String userFace; |
|||
|
|||
/** |
|||
* 用户电话 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 所属部门ID |
|||
*/ |
|||
private Long deptId; |
|||
|
|||
/** |
|||
* 所属部门名称 |
|||
*/ |
|||
private String deptName; |
|||
|
|||
/** |
|||
* 父所有部门ID |
|||
*/ |
|||
private String parentDeptIds; |
|||
|
|||
/** |
|||
* 父所有部门名称 |
|||
*/ |
|||
private String parentDeptNames; |
|||
|
|||
/** |
|||
* 所有部门ID |
|||
*/ |
|||
private String allDeptIds; |
|||
|
|||
/** |
|||
* 所有部门名称 |
|||
*/ |
|||
private String allDeptNames; |
|||
|
|||
/** |
|||
* 屏蔽标识 0:未屏蔽,1:已屏蔽 |
|||
*/ |
|||
private String shieldFlag; |
|||
|
|||
/** |
|||
* 屏蔽原因 |
|||
*/ |
|||
private String shieldReason; |
|||
|
|||
} |
@ -0,0 +1,107 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.advice.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 用户建议表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-03-02 |
|||
*/ |
|||
@Data |
|||
public class AdviceExcel { |
|||
|
|||
@Excel(name = "主键") |
|||
private String id; |
|||
|
|||
@Excel(name = "建议描述") |
|||
private String content; |
|||
|
|||
@Excel(name = "建议人") |
|||
private String adviceUser; |
|||
|
|||
@Excel(name = "建议人联系电话") |
|||
private String adviceUserMobile; |
|||
|
|||
@Excel(name = "是否匿名 0-否,1-是") |
|||
private String anonymousFlag; |
|||
|
|||
@Excel(name = "真实姓名") |
|||
private String realName; |
|||
|
|||
@Excel(name = "用户ID") |
|||
private String userId; |
|||
|
|||
@Excel(name = "用户昵称") |
|||
private String nickname; |
|||
|
|||
@Excel(name = "用户头像") |
|||
private String userFace; |
|||
|
|||
@Excel(name = "用户电话") |
|||
private String mobile; |
|||
|
|||
@Excel(name = "所属部门ID") |
|||
private Long deptId; |
|||
|
|||
@Excel(name = "所属部门名称") |
|||
private String deptName; |
|||
|
|||
@Excel(name = "父所有部门ID") |
|||
private String parentDeptIds; |
|||
|
|||
@Excel(name = "父所有部门名称") |
|||
private String parentDeptNames; |
|||
|
|||
@Excel(name = "所有部门ID") |
|||
private String allDeptIds; |
|||
|
|||
@Excel(name = "所有部门名称") |
|||
private String allDeptNames; |
|||
|
|||
@Excel(name = "屏蔽标识 0:未屏蔽,1:已屏蔽") |
|||
private String shieldFlag; |
|||
|
|||
@Excel(name = "屏蔽原因") |
|||
private String shieldReason; |
|||
|
|||
@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; |
|||
|
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.advice.redis; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 用户建议表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-03-02 |
|||
*/ |
|||
@Component |
|||
public class AdviceRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,158 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.advice.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.dto.AdviceDTO; |
|||
import com.elink.esua.epdc.dto.form.AdviceListFormDTO; |
|||
import com.elink.esua.epdc.dto.form.AdviceShieldFormDTO; |
|||
import com.elink.esua.epdc.dto.form.AdviceSubmitFormDTO; |
|||
import com.elink.esua.epdc.dto.result.AdviceResultDTO; |
|||
import com.elink.esua.epdc.modules.advice.entity.AdviceEntity; |
|||
import com.elink.esua.epdc.modules.rocketmq.dto.OrganizationModifyDTO; |
|||
import com.elink.esua.epdc.modules.rocketmq.dto.RejectRecordDTO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 用户建议表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-03-02 |
|||
*/ |
|||
public interface AdviceService extends BaseService<AdviceEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<AdviceDTO> |
|||
* @author generator |
|||
* @date 2021-03-02 |
|||
*/ |
|||
PageData<AdviceDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<AdviceDTO> |
|||
* @author generator |
|||
* @date 2021-03-02 |
|||
*/ |
|||
List<AdviceDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return AdviceDTO |
|||
* @author generator |
|||
* @date 2021-03-02 |
|||
*/ |
|||
AdviceDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-03-02 |
|||
*/ |
|||
void save(AdviceDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-03-02 |
|||
*/ |
|||
void update(AdviceDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-03-02 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 保存用户举报问题 |
|||
* |
|||
* @param formDto 提交信息 |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author songyunpeng |
|||
* @since 2021/03/02 17:32 |
|||
*/ |
|||
Result saveAdvice(AdviceSubmitFormDTO formDto); |
|||
|
|||
/** |
|||
* 用户举报问题列表 |
|||
* |
|||
* @param formDto 参数 |
|||
* @return java.util.List<com.elink.esua.epdc.dto.result.AdviceSubmitResultDTO> |
|||
* @author Liuchuang |
|||
* @since 2021/03/02 03:06 |
|||
*/ |
|||
List<AdviceResultDTO> listAdvice(AdviceListFormDTO formDto); |
|||
|
|||
/** |
|||
* 举报问题详情 |
|||
* |
|||
* @param id 记录ID |
|||
* @return com.elink.esua.epdc.dto.result.AdviceResultDTO |
|||
* @author Liuchuang |
|||
* @since 2021/03/02 03:40 |
|||
*/ |
|||
AdviceResultDTO getAdviceById(String id); |
|||
|
|||
/** |
|||
* 屏蔽举报问题 |
|||
* |
|||
* @param formDto 屏蔽提交信息 |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author Liuchuang |
|||
* @since 2021/03/02 16:41 |
|||
*/ |
|||
Result modifyAdviceShieldFlag(AdviceShieldFormDTO formDto); |
|||
/** |
|||
* @Description 我要举报修改组织机构信息 |
|||
* @Author songyunpeng |
|||
* @Date 2021/11/25 |
|||
* @Param [dto] |
|||
* @return void |
|||
**/ |
|||
void modifyOrganizationInfo(OrganizationModifyDTO dto); |
|||
/** |
|||
* @Description 违规删除 |
|||
* @Author songyunpeng |
|||
* @Date 2021/11/27 |
|||
* @Param [dto] |
|||
* @return void |
|||
**/ |
|||
void rejectActInfo(RejectRecordDTO dto); |
|||
} |
@ -0,0 +1,284 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.advice.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
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.NumConstant; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.security.content.CheckDataUtils; |
|||
import com.elink.esua.epdc.commons.tools.security.content.ModuleName; |
|||
import com.elink.esua.epdc.commons.tools.security.content.dto.form.ParentAndAllDeptDTO; |
|||
import com.elink.esua.epdc.commons.tools.security.content.dto.form.SaveCheckRecordsDTO; |
|||
import com.elink.esua.epdc.commons.tools.security.content.dto.result.CheckResultDTO; |
|||
import com.elink.esua.epdc.commons.tools.security.content.dto.result.CheckResultMessageDTO; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.constant.CustomImageConstant; |
|||
import com.elink.esua.epdc.dto.AdviceDTO; |
|||
import com.elink.esua.epdc.dto.form.AdviceListFormDTO; |
|||
import com.elink.esua.epdc.dto.form.AdviceShieldFormDTO; |
|||
import com.elink.esua.epdc.dto.form.AdviceSubmitFormDTO; |
|||
import com.elink.esua.epdc.dto.result.AdviceResultDTO; |
|||
import com.elink.esua.epdc.modules.advice.dao.AdviceDao; |
|||
import com.elink.esua.epdc.modules.advice.entity.AdviceEntity; |
|||
import com.elink.esua.epdc.modules.advice.service.AdviceService; |
|||
import com.elink.esua.epdc.modules.feign.AdminFeignClient; |
|||
import com.elink.esua.epdc.modules.feign.ContentSecurityFeignClient; |
|||
import com.elink.esua.epdc.modules.reportissue.service.CustomImgService; |
|||
import com.elink.esua.epdc.modules.rocketmq.dto.OrganizationModifyDTO; |
|||
import com.elink.esua.epdc.modules.rocketmq.dto.RejectRecordDTO; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 用户建议表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-03-02 |
|||
*/ |
|||
@Service |
|||
public class AdviceServiceImpl extends BaseServiceImpl<AdviceDao, AdviceEntity> implements AdviceService { |
|||
@Autowired |
|||
private CustomImgService customImgService; |
|||
|
|||
@Autowired |
|||
private AdminFeignClient adminFeignClient; |
|||
|
|||
|
|||
@Autowired |
|||
private ContentSecurityFeignClient contentSecurityFeign; |
|||
@Override |
|||
public PageData<AdviceDTO> page(Map<String, Object> params) { |
|||
// 检索条件
|
|||
String content = ""; |
|||
if (null != params && null != params.get("content")) { |
|||
content = (String)params.get("content"); |
|||
} |
|||
|
|||
String anonymousFlag = (String)params.get("anonymousFlag"); |
|||
String startTime = (String)params.get("startTime"); |
|||
String endTime = (String)params.get("endTime"); |
|||
|
|||
QueryWrapper<AdviceEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.like(StringUtils.isNotBlank(content), "CONTENT", content.trim()); |
|||
wrapper.eq(StringUtils.isNotBlank(anonymousFlag), "ANONYMOUS_FLAG", anonymousFlag); |
|||
wrapper.ge(StringUtils.isNotBlank(startTime), "DATE_FORMAT(CREATED_TIME, '%Y-%m-%d' )", startTime); |
|||
wrapper.le(StringUtils.isNotBlank(endTime), "DATE_FORMAT(CREATED_TIME, '%Y-%m-%d' )", endTime); |
|||
wrapper.eq(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR); |
|||
|
|||
IPage<AdviceEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
wrapper |
|||
); |
|||
return getPageData(page, AdviceDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<AdviceDTO> list(Map<String, Object> params) { |
|||
List<AdviceEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, AdviceDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<AdviceEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<AdviceEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public AdviceDTO get(String id) { |
|||
AdviceEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, AdviceDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(AdviceDTO dto) { |
|||
AdviceEntity entity = ConvertUtils.sourceToTarget(dto, AdviceEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(AdviceDTO dto) { |
|||
AdviceEntity entity = ConvertUtils.sourceToTarget(dto, AdviceEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Result saveAdvice(AdviceSubmitFormDTO formDto) { |
|||
//内容审核 - start
|
|||
Boolean isConReview = formDto.getIsConReview(); |
|||
List<String> textList = new ArrayList<>(); |
|||
textList.add(formDto.getContent()); |
|||
// 获取所有上级机构名称和ID拼接
|
|||
ParentAndAllDeptDTO deptDto = adminFeignClient.getParentAndAllDept(formDto.getDeptId()).getData(); |
|||
CheckResultDTO contentResult = CheckDataUtils.checkContent(textList); |
|||
CheckResultDTO imgResult = CheckDataUtils.checkImgs(formDto.getImages()); |
|||
if(!isConReview && |
|||
((contentResult != null && !contentResult.getAllPass()) || (imgResult != null && !imgResult.getAllPass()))){ |
|||
//组装要保存的信息
|
|||
SaveCheckRecordsDTO record = CheckDataUtils.getPackageRecords(formDto.getUserId(), |
|||
formDto.getNickname(), CheckDataUtils.cate_two, CheckDataUtils.decision_one, ModuleName.REPORT_ISSUE.getCode(), textList, |
|||
formDto.getImages(), null,contentResult, imgResult,null,formDto.getMobile(),"0",deptDto); |
|||
contentSecurityFeign.insertViolationsRecord(record); |
|||
return new Result().error(CheckDataUtils.violations_code,CheckDataUtils.violations_message); |
|||
} |
|||
//内容审核 - end
|
|||
AdviceEntity entity = ConvertUtils.sourceToTarget(formDto, AdviceEntity.class); |
|||
if (insert(entity)) { |
|||
// 保存图片
|
|||
customImgService.saveImages(formDto.getImages(), entity.getId(), CustomImageConstant.IMAGE_TYPE_YJFW_JSQF_JBWT); |
|||
} |
|||
//内容审核 - start
|
|||
//接口异常,保存至待审核信息
|
|||
if((contentResult == null || imgResult == null) && !isConReview) { |
|||
SaveCheckRecordsDTO record = CheckDataUtils.getPackageRecords(formDto.getUserId(), |
|||
formDto.getNickname(), CheckDataUtils.cate_two, null,ModuleName.REPORT_ISSUE.getCode(), textList, |
|||
formDto.getImages(), entity.getId(),null,null, null,formDto.getMobile(),"1",deptDto); |
|||
contentSecurityFeign.insertRecords(record); |
|||
} |
|||
|
|||
//保存待审核记录
|
|||
if (contentResult != null && imgResult != null) { |
|||
CheckResultMessageDTO twoTypes = null; |
|||
if(isConReview){ |
|||
twoTypes = CheckDataUtils.saveTwoTypes(contentResult, imgResult); |
|||
}else{ |
|||
twoTypes = CheckDataUtils.checkTwoTypes(contentResult, imgResult); |
|||
} |
|||
if (CheckDataUtils.review.equals(twoTypes.getSuggestion())) { |
|||
//组装要保存的信息
|
|||
SaveCheckRecordsDTO record = CheckDataUtils.getPackageRecords(formDto.getUserId(), |
|||
formDto.getNickname(), CheckDataUtils.cate_two, null, ModuleName.REPORT_ISSUE.getCode(), textList, |
|||
formDto.getImages(), entity.getId(), null, null, twoTypes, formDto.getMobile(), "0",deptDto); |
|||
contentSecurityFeign.insertRecords(record); |
|||
} |
|||
} |
|||
//内容审核 - end
|
|||
|
|||
|
|||
return new Result(); |
|||
} |
|||
|
|||
@Override |
|||
public List<AdviceResultDTO> listAdvice(AdviceListFormDTO formDto) { |
|||
int pageIndex = (formDto.getPageIndex() - NumConstant.ONE) * formDto.getPageSize(); |
|||
formDto.setPageIndex(pageIndex); |
|||
return baseDao.selectListAdvice(formDto); |
|||
} |
|||
|
|||
@Override |
|||
public AdviceResultDTO getAdviceById(String id) { |
|||
return baseDao.selectOneAdvice(id); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Result modifyAdviceShieldFlag(AdviceShieldFormDTO formDto) { |
|||
AdviceEntity entity = new AdviceEntity(); |
|||
entity.setId(formDto.getId()); |
|||
entity.setShieldReason(formDto.getShieldReason()); |
|||
entity.setShieldFlag(NumConstant.ONE_STR); |
|||
updateById(entity); |
|||
|
|||
return new Result(); |
|||
} |
|||
@Override |
|||
public void modifyOrganizationInfo(OrganizationModifyDTO dto) { |
|||
// 查询需要修改组织机构信息事件
|
|||
List<AdviceDTO> eventsList = baseDao.selectListOfOrganizationInfo(dto.getDeptId().toString()); |
|||
if (null != eventsList && eventsList.size() > 0) { |
|||
// 组织机构信息处理
|
|||
List<AdviceEntity> entities = handleOrganizationInfo(dto, eventsList); |
|||
// 更新事件组织机构信息
|
|||
updateBatchById(entities); |
|||
} |
|||
|
|||
// 更新网格名称
|
|||
baseDao.updateGridByDeptId(dto.getNewDeptName(), dto.getDeptId()); |
|||
} |
|||
|
|||
@Override |
|||
public void rejectActInfo(RejectRecordDTO dto) { |
|||
baseDao.deleteById(dto.getRelationId()); |
|||
} |
|||
|
|||
/** |
|||
* 组织机构信息处理 |
|||
* |
|||
* @return java.util.List<com.elink.esua.epdc.entity.UserEntity> |
|||
* @params [dto, userList] |
|||
* @author liuchuang |
|||
* @since 2020/3/7 15:22 |
|||
*/ |
|||
private List<AdviceEntity> handleOrganizationInfo(OrganizationModifyDTO dto, List<AdviceDTO> userList) { |
|||
List<AdviceEntity> entities = new ArrayList<>(); |
|||
for (AdviceDTO user : userList) { |
|||
AdviceEntity entity = new AdviceEntity(); |
|||
if (StringUtils.isNotEmpty(user.getParentDeptIds()) && StringUtils.isNotEmpty(user.getParentDeptNames())) { |
|||
List<String> parentDeptIds = Arrays.asList(user.getParentDeptIds().split(",")); |
|||
List<String> parentDeptNames = Arrays.asList(user.getParentDeptNames().split("-")); |
|||
int index = parentDeptIds.indexOf(dto.getDeptId().toString()); |
|||
if (index >= 0 && parentDeptNames.size() > index) { |
|||
parentDeptNames.set(index, dto.getNewDeptName()); |
|||
entity.setId(user.getId()); |
|||
entity.setParentDeptNames(StringUtils.join(parentDeptNames, "-")); |
|||
} |
|||
} |
|||
|
|||
if (StringUtils.isNotEmpty(user.getAllDeptIds()) && StringUtils.isNotEmpty(user.getAllDeptNames())) { |
|||
List<String> allDeptIds = Arrays.asList(user.getAllDeptIds().split(",")); |
|||
List<String> allDeptNames = Arrays.asList(user.getAllDeptNames().split("-")); |
|||
int index = allDeptIds.indexOf(dto.getDeptId().toString()); |
|||
if (index >= 0 && allDeptNames.size() > index) { |
|||
allDeptNames.set(index, dto.getNewDeptName()); |
|||
entity.setId(user.getId()); |
|||
entity.setAllDeptNames(StringUtils.join(allDeptNames, "-")); |
|||
} |
|||
} |
|||
|
|||
entities.add(entity); |
|||
} |
|||
|
|||
return entities; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,105 @@ |
|||
<?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.elink.esua.epdc.modules.advice.dao.AdviceDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.advice.entity.AdviceEntity" id="adviceMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="content" column="CONTENT"/> |
|||
<result property="adviceUser" column="ADVICE_USER"/> |
|||
<result property="adviceUserMobile" column="ADVICE_USER_MOBILE"/> |
|||
<result property="anonymousFlag" column="ANONYMOUS_FLAG"/> |
|||
<result property="realName" column="REAL_NAME"/> |
|||
<result property="userId" column="USER_ID"/> |
|||
<result property="nickname" column="NICKNAME"/> |
|||
<result property="userFace" column="USER_FACE"/> |
|||
<result property="mobile" column="MOBILE"/> |
|||
<result property="deptId" column="DEPT_ID"/> |
|||
<result property="deptName" column="DEPT_NAME"/> |
|||
<result property="parentDeptIds" column="PARENT_DEPT_IDS"/> |
|||
<result property="parentDeptNames" column="PARENT_DEPT_NAMES"/> |
|||
<result property="allDeptIds" column="ALL_DEPT_IDS"/> |
|||
<result property="allDeptNames" column="ALL_DEPT_NAMES"/> |
|||
<result property="shieldFlag" column="SHIELD_FLAG"/> |
|||
<result property="shieldReason" column="SHIELD_REASON"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
<resultMap type="com.elink.esua.epdc.dto.result.AdviceResultDTO" id="AdviceMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="content" column="CONTENT"/> |
|||
<result property="adviceUser" column="ADVICE_USER"/> |
|||
<result property="adviceUserMobile" column="ADVICE_USER_MOBILE"/> |
|||
<result property="anonymousFlag" column="ANONYMOUS_FLAG"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<collection property="images" ofType="java.lang.String"> |
|||
<result property="image" column="IMG_URL"/> |
|||
</collection> |
|||
</resultMap> |
|||
|
|||
<select id="selectListAdvice" resultMap="AdviceMap"> |
|||
SELECT |
|||
ri.ID, |
|||
ri.CONTENT, |
|||
ri.ANONYMOUS_FLAG, |
|||
ri.ADVICE_USER, |
|||
ri.ADVICE_USER_MOBILE, |
|||
ri.CREATED_TIME, |
|||
ci.IMG_URL |
|||
FROM |
|||
epdc_advice ri |
|||
LEFT JOIN epdc_custom_img ci ON ci.REFERENCE_ID = ri.ID |
|||
AND ci.DEL_FLAG = '0' |
|||
WHERE |
|||
ri.ID IN ( |
|||
SELECT |
|||
t.ID |
|||
FROM |
|||
( SELECT ID FROM epdc_advice WHERE DEL_FLAG = '0' AND SHIELD_FLAG = '0' AND USER_ID = #{userId} ORDER BY CREATED_TIME DESC LIMIT #{pageIndex},#{pageSize} ) t |
|||
) |
|||
ORDER BY |
|||
ri.CREATED_TIME DESC, |
|||
ci.IMG_URL |
|||
</select> |
|||
|
|||
<select id="selectOneAdvice" resultMap="AdviceMap"> |
|||
SELECT |
|||
ri.ID, |
|||
ri.CONTENT, |
|||
ri.ANONYMOUS_FLAG, |
|||
ri.ADVICE_USER, |
|||
ri.ADVICE_USER_MOBILE, |
|||
ri.CREATED_TIME, |
|||
ci.IMG_URL |
|||
FROM |
|||
epdc_advice ri |
|||
LEFT JOIN epdc_custom_img ci ON ci.REFERENCE_ID = ri.ID |
|||
AND ci.DEL_FLAG = '0' |
|||
WHERE |
|||
ri.DEL_FLAG = '0' |
|||
AND ri.SHIELD_FLAG = '0' |
|||
AND ri.ID = #{id} |
|||
ORDER BY |
|||
ci.IMG_URL |
|||
</select> |
|||
<select id="selectListOfOrganizationInfo" resultType="com.elink.esua.epdc.dto.AdviceDTO"> |
|||
SELECT |
|||
ID, |
|||
PARENT_DEPT_IDS, |
|||
PARENT_DEPT_NAMES, |
|||
ALL_DEPT_IDS, |
|||
ALL_DEPT_NAMES |
|||
FROM |
|||
epdc_advice |
|||
WHERE |
|||
FIND_IN_SET( #{deptId}, ALL_DEPT_IDS ) |
|||
</select> |
|||
<update id="updateGridByDeptId"> |
|||
UPDATE epdc_advice SET DEPT_NAME = #{newDeptName}, UPDATED_TIME = NOW() WHERE DEPT_ID = #{deptId} |
|||
</update> |
|||
|
|||
</mapper> |
@ -0,0 +1,81 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.activity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 活动签到二维码表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-02-24 |
|||
*/ |
|||
@Data |
|||
public class ActSignInQrCodeDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 活动ID |
|||
*/ |
|||
private String actId; |
|||
|
|||
/** |
|||
* 二维码地址 |
|||
*/ |
|||
private String codeUrl; |
|||
|
|||
/** |
|||
* 删除标记:0-否,1-是 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.elink.esua.epdc.activity.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 活动扫码签到-form |
|||
* @author Liuchuang |
|||
*/ |
|||
@Data |
|||
public class ActSignInFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -570057119464433688L; |
|||
|
|||
/** |
|||
* 活动ID |
|||
*/ |
|||
@NotBlank(message = "活动ID不能为空") |
|||
private String actId; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.elink.esua.epdc.activity.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 活动列表-form |
|||
* @author Liuchuang |
|||
*/ |
|||
@Data |
|||
public class ActSignInListFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -2850925877613620284L; |
|||
|
|||
/** |
|||
* 页码,从1开始 |
|||
*/ |
|||
@Min(value = 1, message = "页码必须大于0") |
|||
private Integer pageIndex; |
|||
|
|||
/** |
|||
* 页容量,默认10页 |
|||
*/ |
|||
@Min(value = 1, message = "每页条数必须大于必须大于0") |
|||
private Integer pageSize = 10; |
|||
} |
@ -0,0 +1,34 @@ |
|||
package com.elink.esua.epdc.activity.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 签到记录-form |
|||
* @author Liuchuang |
|||
*/ |
|||
@Data |
|||
public class ActSignInRecordFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 1458931120619377019L; |
|||
|
|||
/** |
|||
* 页码 |
|||
*/ |
|||
@NotNull(message = "页码不能为空") |
|||
private Integer pageIndex; |
|||
|
|||
/** |
|||
* 页容量 |
|||
*/ |
|||
@NotNull(message = "分页数量不能为空") |
|||
private Integer pageSize; |
|||
|
|||
/** |
|||
* 活动ID |
|||
*/ |
|||
@NotBlank(message = "活动ID不能为空") |
|||
private String actId; |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.elink.esua.epdc.activity.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 活动扫签到码-form |
|||
* @author Liuchuang |
|||
*/ |
|||
@Data |
|||
public class ActSignInScanQrCodeFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -6611292881727646051L; |
|||
|
|||
/** |
|||
* 二维码中的qrCodeId |
|||
*/ |
|||
@NotBlank(message = "二维码信息为空,请重新扫码") |
|||
private String qrCodeId; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.elink.esua.epdc.activity.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 活动信息 |
|||
* @author Liuchuang |
|||
*/ |
|||
@Data |
|||
public class ActSignInListResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 5597918895256848428L; |
|||
|
|||
/** |
|||
* 活动ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 活动头图 |
|||
*/ |
|||
private String headPic; |
|||
|
|||
/** |
|||
* 打卡开始时间 |
|||
*/ |
|||
private Date signinStartTime; |
|||
|
|||
/** |
|||
* 打卡截止时间 |
|||
*/ |
|||
private Date signinEndTime; |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.elink.esua.epdc.activity.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 活动签到码 |
|||
* |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 14:51 |
|||
*/ |
|||
@Data |
|||
public class ActSignInQrCodeResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 567506783648999124L; |
|||
|
|||
/** |
|||
* 二维码地址 |
|||
*/ |
|||
private String codeUrl; |
|||
} |
@ -0,0 +1,45 @@ |
|||
package com.elink.esua.epdc.activity.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 签到记录-result |
|||
* @author Liuchuang |
|||
*/ |
|||
@Data |
|||
public class ActSignInRecordsDTO implements Serializable { |
|||
private static final long serialVersionUID = 3786377690296637263L; |
|||
|
|||
/** |
|||
* 记录ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 用户昵称 |
|||
*/ |
|||
private String nickname; |
|||
|
|||
/** |
|||
* 签到时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 操作积分类型 0-减积分,1-加积分 |
|||
*/ |
|||
private String operationPointsType; |
|||
|
|||
/** |
|||
* 操作积分值 |
|||
*/ |
|||
private Integer points; |
|||
|
|||
/** |
|||
* 用户头像 |
|||
*/ |
|||
private String faceImg; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.elink.esua.epdc.activity.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 扫码签到记录 |
|||
* @author Liuchuang |
|||
*/ |
|||
@Data |
|||
public class ActSignInRecordsResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -140813417697540322L; |
|||
|
|||
/** |
|||
* 签到总人数 |
|||
*/ |
|||
private Integer signInTotal; |
|||
|
|||
/** |
|||
* 签到记录 |
|||
*/ |
|||
private List<ActSignInRecordsDTO> signInList; |
|||
} |
@ -0,0 +1,50 @@ |
|||
package com.elink.esua.epdc.activity.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 活动扫签到码-result |
|||
* @author Liuchuang |
|||
*/ |
|||
@Data |
|||
public class ActSignInScanQrCodeResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 2090072774727220817L; |
|||
|
|||
/** |
|||
* 活动ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 活动头图 |
|||
*/ |
|||
private String headPic; |
|||
|
|||
/** |
|||
* 打卡开始时间 |
|||
*/ |
|||
private Date signinStartTime; |
|||
|
|||
/** |
|||
* 打卡截止时间 |
|||
*/ |
|||
private Date signinEndTime; |
|||
|
|||
/** |
|||
* 签到奖励积分 |
|||
*/ |
|||
private Integer reward; |
|||
|
|||
/** |
|||
* 签到状态:0-未签到,1-已签到 |
|||
*/ |
|||
private String signInStatus; |
|||
} |
@ -0,0 +1,84 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.controller; |
|||
|
|||
import com.elink.esua.epdc.activity.ActSignInQrCodeDTO; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
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.UpdateGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.modules.activity.service.ActSignInQrCodeService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 活动签到二维码表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-02-24 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("actsigninqrcode") |
|||
public class ActSignInQrCodeController { |
|||
|
|||
@Autowired |
|||
private ActSignInQrCodeService actSignInQrCodeService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<ActSignInQrCodeDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<ActSignInQrCodeDTO> page = actSignInQrCodeService.page(params); |
|||
return new Result<PageData<ActSignInQrCodeDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<ActSignInQrCodeDTO> get(@PathVariable("id") String id){ |
|||
ActSignInQrCodeDTO data = actSignInQrCodeService.get(id); |
|||
return new Result<ActSignInQrCodeDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody ActSignInQrCodeDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
actSignInQrCodeService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody ActSignInQrCodeDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
actSignInQrCodeService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
actSignInQrCodeService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,90 @@ |
|||
package com.elink.esua.epdc.modules.activity.controller; |
|||
|
|||
import com.elink.esua.epdc.activity.form.ActSignInFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInRecordFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInScanQrCodeFormDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInQrCodeResultDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInRecordsResultDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInScanQrCodeResultDTO; |
|||
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.modules.activity.service.ActSignInQrCodeService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* 签到码移动端接口 |
|||
* |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 14:29 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(Constant.EPDC_APP + "actsigninqrcode") |
|||
public class AppActSignInQrCodeController { |
|||
|
|||
@Autowired |
|||
private ActSignInQrCodeService actSignInQrCodeService; |
|||
|
|||
/** |
|||
* 获取活动签到码 |
|||
* |
|||
* @param actId |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 14:31 |
|||
*/ |
|||
@GetMapping("getqrcode/{actId}") |
|||
public Result<ActSignInQrCodeResultDTO> getActSignInQrCode(@PathVariable("actId") String actId) { |
|||
ActSignInQrCodeResultDTO data = actSignInQrCodeService.getActSignInQrCode(actId); |
|||
|
|||
return new Result<ActSignInQrCodeResultDTO>().ok(data); |
|||
} |
|||
|
|||
/** |
|||
* 获取活动签到记录 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.activity.result.ActSignInRecordResultDTO>> |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 15:26 |
|||
*/ |
|||
@GetMapping("getsigninlist") |
|||
public Result<ActSignInRecordsResultDTO> getSignInList(@RequestBody ActSignInRecordFormDTO formDto) { |
|||
ValidatorUtils.validateEntity(formDto); |
|||
ActSignInRecordsResultDTO data = actSignInQrCodeService.listOfSignInRecords(formDto); |
|||
|
|||
return new Result<ActSignInRecordsResultDTO>().ok(data); |
|||
} |
|||
|
|||
/** |
|||
* 居民扫签到码获取活动信息接口 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.activity.result.ActSignInScanQrCodeResultDTO> |
|||
* @author Liuchuang |
|||
* @since 2021/2/25 9:41 |
|||
*/ |
|||
@GetMapping("actInfo") |
|||
public Result<ActSignInScanQrCodeResultDTO> getActInfo(@RequestBody ActSignInScanQrCodeFormDTO formDto) { |
|||
ValidatorUtils.validateEntity(formDto); |
|||
ActSignInScanQrCodeResultDTO data = actSignInQrCodeService.getSignInActInfo(formDto); |
|||
|
|||
return new Result<ActSignInScanQrCodeResultDTO>().ok(data); |
|||
} |
|||
|
|||
/** |
|||
* 居民扫码签到 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author Liuchuang |
|||
* @since 2021/2/25 13:55 |
|||
*/ |
|||
@PostMapping("signin") |
|||
public Result scanSignIn(@RequestBody ActSignInFormDTO formDto) { |
|||
ValidatorUtils.validateEntity(formDto); |
|||
|
|||
return actSignInQrCodeService.scanSignIn(formDto); |
|||
} |
|||
} |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.modules.activity.entity.ActSignInQrCodeEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 活动签到二维码表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-02-24 |
|||
*/ |
|||
@Mapper |
|||
public interface ActSignInQrCodeDao extends BaseDao<ActSignInQrCodeEntity> { |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 活动签到二维码表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-02-24 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_act_sign_in_qr_code") |
|||
public class ActSignInQrCodeEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 活动ID |
|||
*/ |
|||
private String actId; |
|||
|
|||
/** |
|||
* 二维码地址 |
|||
*/ |
|||
private String codeUrl; |
|||
|
|||
} |
@ -0,0 +1,143 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.service; |
|||
|
|||
import com.elink.esua.epdc.activity.ActSignInQrCodeDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInRecordFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInScanQrCodeFormDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInQrCodeResultDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInRecordsDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInRecordsResultDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInScanQrCodeResultDTO; |
|||
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.activity.entity.ActSignInQrCodeEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 活动签到二维码表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-02-24 |
|||
*/ |
|||
public interface ActSignInQrCodeService extends BaseService<ActSignInQrCodeEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<ActSignInQrCodeDTO> |
|||
* @author generator |
|||
* @date 2021-02-24 |
|||
*/ |
|||
PageData<ActSignInQrCodeDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<ActSignInQrCodeDTO> |
|||
* @author generator |
|||
* @date 2021-02-24 |
|||
*/ |
|||
List<ActSignInQrCodeDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return ActSignInQrCodeDTO |
|||
* @author generator |
|||
* @date 2021-02-24 |
|||
*/ |
|||
ActSignInQrCodeDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-02-24 |
|||
*/ |
|||
void save(ActSignInQrCodeDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-02-24 |
|||
*/ |
|||
void update(ActSignInQrCodeDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-02-24 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 获取活动签到码 |
|||
* |
|||
* @param actId |
|||
* @return com.elink.esua.epdc.activity.result.ActSignInQrCodeResultDTO |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 14:52 |
|||
*/ |
|||
ActSignInQrCodeResultDTO getActSignInQrCode(String actId); |
|||
|
|||
/** |
|||
* 获取活动签到记录 |
|||
* |
|||
* @param formDto |
|||
* @return java.util.List<com.elink.esua.epdc.activity.result.ActSignInRecordResultDTO> |
|||
* @author Liuchuang |
|||
* @since 2021/2/24 15:27 |
|||
*/ |
|||
ActSignInRecordsResultDTO listOfSignInRecords(ActSignInRecordFormDTO formDto); |
|||
|
|||
/** |
|||
* 居民扫签到码获取活动信息接口 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.activity.result.ActSignInScanQrCodeResultDTO |
|||
* @author Liuchuang |
|||
* @since 2021/2/25 9:43 |
|||
*/ |
|||
ActSignInScanQrCodeResultDTO getSignInActInfo(ActSignInScanQrCodeFormDTO formDto); |
|||
|
|||
/** |
|||
* 居民扫码签到 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author Liuchuang |
|||
* @since 2021/2/25 14:02 |
|||
*/ |
|||
Result scanSignIn(ActSignInFormDTO formDto); |
|||
} |
@ -0,0 +1,322 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.elink.esua.epdc.activity.ActInfoDTO; |
|||
import com.elink.esua.epdc.activity.ActSignInQrCodeDTO; |
|||
import com.elink.esua.epdc.activity.ActUserRelationDTO; |
|||
import com.elink.esua.epdc.activity.form.ActPointCheckFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInRecordFormDTO; |
|||
import com.elink.esua.epdc.activity.form.ActSignInScanQrCodeFormDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInQrCodeResultDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInRecordsResultDTO; |
|||
import com.elink.esua.epdc.activity.result.ActSignInScanQrCodeResultDTO; |
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|||
import com.elink.esua.epdc.commons.tools.constant.StrConstant; |
|||
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|||
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.constant.FieldConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.QrCodeUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.constant.ActUserRelationStatusConstant; |
|||
import com.elink.esua.epdc.dto.UploadToOssDTO; |
|||
import com.elink.esua.epdc.modules.activity.dao.ActSignInQrCodeDao; |
|||
import com.elink.esua.epdc.modules.activity.entity.ActSignInQrCodeEntity; |
|||
import com.elink.esua.epdc.modules.activity.service.*; |
|||
import com.elink.esua.epdc.modules.constant.ActSignInQrCodeConstant; |
|||
import com.elink.esua.epdc.modules.feign.EpdcOssFeignClient; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 活动签到二维码表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-02-24 |
|||
*/ |
|||
@Service |
|||
public class ActSignInQrCodeServiceImpl extends BaseServiceImpl<ActSignInQrCodeDao, ActSignInQrCodeEntity> implements ActSignInQrCodeService { |
|||
|
|||
@Autowired |
|||
private EpdcOssFeignClient ossFeignClient; |
|||
|
|||
@Autowired |
|||
private ActInfoService actInfoService; |
|||
|
|||
@Autowired |
|||
private ActUserPointsLogService actUserPointsLogService; |
|||
|
|||
@Autowired |
|||
private ActUserRelationService actUserRelationService; |
|||
|
|||
@Autowired |
|||
private ActUserClockLogService actUserClockLogService; |
|||
|
|||
@Override |
|||
public PageData<ActSignInQrCodeDTO> page(Map<String, Object> params) { |
|||
IPage<ActSignInQrCodeEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, ActSignInQrCodeDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<ActSignInQrCodeDTO> list(Map<String, Object> params) { |
|||
List<ActSignInQrCodeEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, ActSignInQrCodeDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<ActSignInQrCodeEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<ActSignInQrCodeEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public ActSignInQrCodeDTO get(String id) { |
|||
ActSignInQrCodeEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, ActSignInQrCodeDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(ActSignInQrCodeDTO dto) { |
|||
ActSignInQrCodeEntity entity = ConvertUtils.sourceToTarget(dto, ActSignInQrCodeEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(ActSignInQrCodeDTO dto) { |
|||
ActSignInQrCodeEntity entity = ConvertUtils.sourceToTarget(dto, ActSignInQrCodeEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public ActSignInQrCodeResultDTO getActSignInQrCode(String actId) { |
|||
if (StringUtils.isEmpty(actId)) { |
|||
throw new RenException(ActSignInQrCodeConstant.ACT_CREATE_SIGN_IN_CODE_MSG_ACT_ID_NOT_EMPTY); |
|||
} |
|||
|
|||
// 判断活动状态是否在打卡范围内
|
|||
ActInfoDTO actInfoDto = actInfoService.get(actId); |
|||
if (!(System.currentTimeMillis() >= actInfoDto.getSigninStartTime().getTime() |
|||
&& System.currentTimeMillis() <= actInfoDto.getSigninEndTime().getTime())) { |
|||
throw new RenException(ActSignInQrCodeConstant.ACT_CREATE_SIGN_IN_CODE_MSG_NOT_SIGN_IN_TIME); |
|||
} |
|||
|
|||
// 保存签到码信息
|
|||
ActSignInQrCodeEntity entity = new ActSignInQrCodeEntity(); |
|||
entity.setActId(actId); |
|||
insert(entity); |
|||
|
|||
// 生成二维码
|
|||
String codeUrl = generateQRCode(entity.getId()); |
|||
entity.setCodeUrl(codeUrl); |
|||
|
|||
// 更新二维码地址
|
|||
updateById(entity); |
|||
ActSignInQrCodeResultDTO dto = new ActSignInQrCodeResultDTO(); |
|||
dto.setCodeUrl(codeUrl); |
|||
|
|||
return dto; |
|||
} |
|||
|
|||
@Override |
|||
public ActSignInRecordsResultDTO listOfSignInRecords(ActSignInRecordFormDTO formDto) { |
|||
return actUserPointsLogService.listOfSignInRecords(formDto); |
|||
} |
|||
|
|||
@Override |
|||
public ActSignInScanQrCodeResultDTO getSignInActInfo(ActSignInScanQrCodeFormDTO formDto) { |
|||
// 校验签到码
|
|||
ActSignInQrCodeEntity entity = checkSignInQrCode(formDto.getQrCodeId()); |
|||
// 校验活动
|
|||
ActInfoDTO actInfoDto = checkSignInActInfo(entity.getActId()); |
|||
// 校验用户是否已扫码签到
|
|||
String signInStatus = checkUserSignInStatus(formDto.getUserId(), actInfoDto.getId()); |
|||
// 组装返回信息
|
|||
ActSignInScanQrCodeResultDTO dto = ConvertUtils.sourceToTarget(actInfoDto, ActSignInScanQrCodeResultDTO.class); |
|||
dto.setSignInStatus(signInStatus); |
|||
|
|||
return dto; |
|||
} |
|||
|
|||
@Override |
|||
public Result scanSignIn(ActSignInFormDTO formDto) { |
|||
// 校验活动
|
|||
ActInfoDTO actInfoDto = checkSignInActInfo(formDto.getActId()); |
|||
// 校验用户
|
|||
ActUserRelationDTO actUserRelationDto = checkSignInUser(formDto.getUserId(), actInfoDto.getId()); |
|||
// 签到确认积分
|
|||
ActPointCheckFormDTO dto = new ActPointCheckFormDTO(); |
|||
dto.setId(actUserRelationDto.getId()); |
|||
dto.setActId(actInfoDto.getId()); |
|||
dto.setStatus(ActUserRelationStatusConstant.CONFIRM_ADD_POINTS); |
|||
dto.setOperationType(NumConstant.NINE_STR); |
|||
|
|||
return actUserClockLogService.pointCheck(dto); |
|||
} |
|||
|
|||
/** |
|||
* 生成二维码并上传 OSS |
|||
* |
|||
* @param param 二维码参数 |
|||
* @return java.lang.String |
|||
* @author Liuchuang |
|||
* @since 2021/1/19 13:30 |
|||
*/ |
|||
private String generateQRCode(String param) { |
|||
UploadToOssDTO dto = new UploadToOssDTO(); |
|||
dto.setFileByte(QrCodeUtils.encodeByByte(param, "", false)); |
|||
dto.setFileName(param.concat(StrConstant.DOT).concat(StrConstant.SUFFIX_IMG_PNG)); |
|||
|
|||
Result<String> ossResult = ossFeignClient.uploadFile(dto); |
|||
if (null == ossResult || !ossResult.success() || null == ossResult.getData()) { |
|||
throw new RenException("签到码上传失败,请稍后重试"); |
|||
} |
|||
return ossResult.getData(); |
|||
} |
|||
|
|||
/** |
|||
* 校验签到码 |
|||
* |
|||
* @param qrCodeId |
|||
* @return com.elink.esua.epdc.modules.activity.entity.ActSignInQrCodeEntity |
|||
* @author Liuchuang |
|||
* @since 2021/2/25 10:56 |
|||
*/ |
|||
private ActSignInQrCodeEntity checkSignInQrCode(String qrCodeId) { |
|||
ActSignInQrCodeEntity entity = baseDao.selectById(qrCodeId); |
|||
if (null == entity) { |
|||
throw new RenException(ActSignInQrCodeConstant.ACT_SCAN_SIGN_IN_MSG_QR_CODE_INVALID); |
|||
} |
|||
|
|||
// 签到码有效时间1分钟
|
|||
long seconds = (System.currentTimeMillis() - entity.getCreatedTime().getTime()) / 1000; |
|||
if (seconds > NumConstant.SIXTY) { |
|||
throw new RenException(ActSignInQrCodeConstant.ACT_SCAN_SIGN_IN_MSG_QR_CODE_INVALID); |
|||
} |
|||
|
|||
return entity; |
|||
} |
|||
|
|||
/** |
|||
* 校验活动 |
|||
* |
|||
* @param actId |
|||
* @return com.elink.esua.epdc.activity.ActInfoDTO |
|||
* @author Liuchuang |
|||
* @since 2021/2/25 10:57 |
|||
*/ |
|||
private ActInfoDTO checkSignInActInfo(String actId) { |
|||
ActInfoDTO actInfoDto = actInfoService.get(actId); |
|||
if (null == actInfoDto) { |
|||
throw new RenException(ActSignInQrCodeConstant.ACT_SCAN_SIGN_IN_MSG_ACT_NOT_FOUND); |
|||
} |
|||
|
|||
if (System.currentTimeMillis() < actInfoDto.getSigninStartTime().getTime() |
|||
|| System.currentTimeMillis() > actInfoDto.getSigninEndTime().getTime()) { |
|||
throw new RenException(ActSignInQrCodeConstant.ACT_SCAN_SIGN_IN_MSG_NOT_SIGN_IN_TIME); |
|||
} |
|||
|
|||
return actInfoDto; |
|||
} |
|||
|
|||
/** |
|||
* 校验用户是否已扫码签到 |
|||
* |
|||
* @param userId |
|||
* @param actId |
|||
* @return java.lang.String |
|||
* @author Liuchuang |
|||
* @since 2021/2/25 11:00 |
|||
*/ |
|||
private String checkUserSignInStatus(String userId, String actId) { |
|||
if (StringUtils.isEmpty(userId)) { |
|||
throw new RenException(ActSignInQrCodeConstant.ACT_SCAN_SIGN_IN_MSG_USER_NOT_FOUND); |
|||
} |
|||
boolean signInStatus = actUserPointsLogService.checkUserScanSignInStatus(userId, actId); |
|||
|
|||
return signInStatus ? NumConstant.ONE_STR : NumConstant.ZERO_STR; |
|||
} |
|||
|
|||
/** |
|||
* 扫码签到校验用户 |
|||
* |
|||
* @param userId |
|||
* @param actId |
|||
* @return com.elink.esua.epdc.activity.ActUserRelationDTO |
|||
* @author Liuchuang |
|||
* @since 2021/2/25 15:21 |
|||
*/ |
|||
private ActUserRelationDTO checkSignInUser(String userId, String actId) { |
|||
// 校验用户
|
|||
ActUserRelationDTO actUserRelationDto = actUserRelationService.getActUserRelationId(userId, actId, null); |
|||
if (null == actUserRelationDto |
|||
|| StringUtils.isEmpty(actUserRelationDto.getId()) |
|||
|| StringUtils.isEmpty(actUserRelationDto.getStatus())) { |
|||
throw new RenException(ActSignInQrCodeConstant.ACT_SIGN_IN_MSG_NOT_SIGN_UP); |
|||
} |
|||
switch (actUserRelationDto.getStatus()) { |
|||
case ActUserRelationStatusConstant.SIGN_UP: |
|||
throw new RenException(ActSignInQrCodeConstant.ACT_SIGN_IN_MSG_PENDING_SIGN_UP); |
|||
case ActUserRelationStatusConstant.CANCEL_SIGN_UP: |
|||
throw new RenException(ActSignInQrCodeConstant.ACT_SIGN_IN_MSG_CANCEL_SIGN_UP); |
|||
case ActUserRelationStatusConstant.NOT_APPROVED: |
|||
throw new RenException(ActSignInQrCodeConstant.ACT_SIGN_IN_MSG_NOT_APPROVED_SIGN_UP); |
|||
case ActUserRelationStatusConstant.REFUSE_ADD_POINTS: |
|||
throw new RenException(ActSignInQrCodeConstant.ACT_SIGN_IN_MSG_REFUSE_ADD_POINTS); |
|||
default: |
|||
break; |
|||
} |
|||
|
|||
// 校验用户是否已扫码签到
|
|||
String signInStatus = checkUserSignInStatus(userId, actId); |
|||
if (NumConstant.ONE_STR.equals(signInStatus)) { |
|||
throw new RenException(ActSignInQrCodeConstant.ACT_SIGN_IN_MSG_ALREADY_SIGN_IN); |
|||
} |
|||
|
|||
return actUserRelationDto; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.elink.esua.epdc.modules.constant; |
|||
|
|||
/** |
|||
* 活动扫码签到,提示语常量 |
|||
* |
|||
* @author Liuchuang |
|||
* @since 2021/2/25 10:43 |
|||
*/ |
|||
public interface ActSignInQrCodeConstant { |
|||
|
|||
String ACT_SCAN_SIGN_IN_MSG_QR_CODE_INVALID = "签到码已失效,请重新扫码"; |
|||
String ACT_SCAN_SIGN_IN_MSG_ACT_NOT_FOUND = "活动不存在,请重新扫码"; |
|||
String ACT_SCAN_SIGN_IN_MSG_NOT_SIGN_IN_TIME = "当前活动不在打卡时间范围内,不能进行扫码签到"; |
|||
String ACT_SCAN_SIGN_IN_MSG_USER_NOT_FOUND = "获取用户信息失败,请稍后重试"; |
|||
|
|||
String ACT_CREATE_SIGN_IN_CODE_MSG_ACT_ID_NOT_EMPTY = "活动ID不能为空"; |
|||
String ACT_CREATE_SIGN_IN_CODE_MSG_NOT_SIGN_IN_TIME = "当前活动不在打卡时间范围内,不能生成签到码"; |
|||
|
|||
String ACT_SIGN_IN_MSG_ALREADY_SIGN_IN = "当前活动您已签到成功,请勿重复操作"; |
|||
String ACT_SIGN_IN_MSG_NOT_SIGN_UP = "当前活动您未报名,不能签到"; |
|||
String ACT_SIGN_IN_MSG_PENDING_SIGN_UP = "当前活动您的报名申请审核中,不能签到"; |
|||
String ACT_SIGN_IN_MSG_CANCEL_SIGN_UP = "当前活动您已取消报名,不能签到"; |
|||
String ACT_SIGN_IN_MSG_NOT_APPROVED_SIGN_UP = "当前活动您的报名申请未通过,不能签到"; |
|||
String ACT_SIGN_IN_MSG_REFUSE_ADD_POINTS = "当前活动您已被拒绝加积分,不能签到"; |
|||
|
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.elink.esua.epdc.modules.feign; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.UploadFormDTO; |
|||
import com.elink.esua.epdc.dto.UploadToOssDTO; |
|||
import com.elink.esua.epdc.modules.feign.fallback.EpdcOssFeignClientFallback; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
|
|||
/** |
|||
* 文件对象模块 |
|||
* @Author LC |
|||
* @Date 2019/9/8 18:24 |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.EPDC_OSS_SERVER, fallback = EpdcOssFeignClientFallback.class) |
|||
public interface EpdcOssFeignClient { |
|||
|
|||
/** |
|||
* 图片上传 |
|||
* @Params: [base64] |
|||
* @Return: com.elink.esua.epdc.commons.tools.utils.Result<java.lang.String> |
|||
* @Author: liuchuang |
|||
* @Date: 2019/9/11 17:17 |
|||
*/ |
|||
@PostMapping(value = "oss/file/uploadBase64") |
|||
Result<String> upload(UploadFormDTO formDTO); |
|||
|
|||
/** |
|||
* |
|||
* 图片上传 |
|||
* |
|||
* @params [file] |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.UploadDTO> |
|||
* @author liuchuang |
|||
* @since 2019/11/25 16:13 |
|||
*/ |
|||
@PostMapping(value = "oss/file/uploadFile", consumes = MediaType.APPLICATION_JSON_VALUE) |
|||
Result<String> uploadFile(UploadToOssDTO uploadToOssDto); |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.elink.esua.epdc.modules.feign.fallback; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.UploadFormDTO; |
|||
import com.elink.esua.epdc.dto.UploadToOssDTO; |
|||
import com.elink.esua.epdc.modules.feign.EpdcOssFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 文件对象模块 |
|||
* @Author LC |
|||
* @Date 2019/9/8 18:25 |
|||
*/ |
|||
@Component |
|||
public class EpdcOssFeignClientFallback implements EpdcOssFeignClient { |
|||
|
|||
@Override |
|||
public Result<String> upload(UploadFormDTO formDTO) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_OSS_SERVER, "upload", formDTO); |
|||
} |
|||
|
|||
@Override |
|||
public Result<String> uploadFile(UploadToOssDTO uploadToOssDto) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_OSS_SERVER, "uploadFile", uploadToOssDto); |
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
<?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.elink.esua.epdc.modules.activity.dao.ActSignInQrCodeDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.activity.entity.ActSignInQrCodeEntity" id="actSignInQrCodeMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="actId" column="ACT_ID"/> |
|||
<result property="codeUrl" column="CODE_URL"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue