You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
208 lines
6.6 KiB
208 lines
6.6 KiB
package com.epmet.controller;
|
|
|
|
import com.epmet.commons.tools.annotation.LoginUser;
|
|
import com.epmet.commons.tools.aop.NoRepeatSubmit;
|
|
import com.epmet.commons.tools.security.dto.TokenDto;
|
|
import com.epmet.commons.tools.utils.Result;
|
|
import com.epmet.commons.tools.validator.ValidatorUtils;
|
|
import com.epmet.dto.form.*;
|
|
import com.epmet.dto.result.*;
|
|
import com.epmet.redis.UserBadgeRedis;
|
|
import com.epmet.service.BadgeService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.validation.constraints.NotBlank;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @author zhaoqifeng
|
|
* @dscription
|
|
* @date 2020/11/3 16:09
|
|
*/
|
|
@RestController
|
|
@RequestMapping("badge")
|
|
public class BadgeController {
|
|
@Autowired
|
|
private BadgeService badgeService;
|
|
@Autowired
|
|
private UserBadgeRedis badgeRedis;
|
|
|
|
/**
|
|
* 徽章列表
|
|
* @author zhaoqifeng
|
|
* @date 2020/11/4 14:27
|
|
* @param tokenDto
|
|
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.BadgeListResultDTO>>
|
|
*/
|
|
@PostMapping("list")
|
|
public Result<List<BadgeListResultDTO>> list(@LoginUser TokenDto tokenDto) {
|
|
List<BadgeListResultDTO> result = badgeService.getList(tokenDto.getCustomerId());
|
|
return new Result<List<BadgeListResultDTO>>().ok(result);
|
|
}
|
|
|
|
/**
|
|
* 添加徽章
|
|
* @author zhaoqifeng
|
|
* @date 2020/11/4 14:27
|
|
* @param tokenDto
|
|
* @param formDTO
|
|
* @return com.epmet.commons.tools.utils.Result
|
|
*/
|
|
@PostMapping("add")
|
|
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddBadgeFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO);
|
|
badgeService.add(tokenDto, formDTO);
|
|
return new Result();
|
|
}
|
|
|
|
/**
|
|
* 徽章详情
|
|
* @author zhaoqifeng
|
|
* @date 2020/11/4 14:27
|
|
* @param tokenDto
|
|
* @param formDTO
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.BadgeDetailResultDTO>
|
|
*/
|
|
@PostMapping("detail")
|
|
public Result<BadgeDetailResultDTO> detail(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO, BadgeFormDTO.ManageGroup.class);
|
|
BadgeDetailResultDTO result = badgeService.detail(tokenDto, formDTO);
|
|
return new Result<BadgeDetailResultDTO>().ok(result);
|
|
}
|
|
|
|
/**
|
|
* 修改
|
|
* @author zhaoqifeng
|
|
* @date 2020/11/4 15:32
|
|
* @param tokenDto
|
|
* @param formDTO
|
|
* @return com.epmet.commons.tools.utils.Result
|
|
*/
|
|
@PostMapping("edit")
|
|
@NoRepeatSubmit
|
|
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditBadgeFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO);
|
|
badgeService.edit(tokenDto, formDTO);
|
|
return new Result();
|
|
}
|
|
|
|
/**
|
|
* 删除徽章
|
|
* @author zhaoqifeng
|
|
* @date 2020/11/4 15:34
|
|
* @param tokenDto
|
|
* @param formDTO
|
|
* @return com.epmet.commons.tools.utils.Result
|
|
*/
|
|
@PostMapping("delete")
|
|
public Result delete(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO, BadgeFormDTO.ManageGroup.class);
|
|
badgeService.deleteBadge(tokenDto, formDTO);
|
|
return new Result();
|
|
}
|
|
|
|
@PostMapping("test-cache")
|
|
public Result testCache(){
|
|
badgeService.testCache();
|
|
return new Result();
|
|
}
|
|
/**
|
|
* 待审核列表
|
|
* @author zhaoqifeng
|
|
* @date 2020/11/5 9:51
|
|
* @param tokenDto
|
|
* @param formDTO
|
|
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.BadgeAuditingResultDTO>>
|
|
*/
|
|
@PostMapping("auditinglist")
|
|
public Result<List<BadgeAuditingResultDTO>> auditingList(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO, BadgeFormDTO.AuditGroup.class);
|
|
List<BadgeAuditingResultDTO> result = badgeService.auditingList(tokenDto, formDTO);
|
|
return new Result<List<BadgeAuditingResultDTO>>().ok(result);
|
|
}
|
|
|
|
/**
|
|
* 审核历史列表
|
|
* @author zhaoqifeng
|
|
* @date 2020/11/5 10:59
|
|
* @param tokenDto
|
|
* @param formDTO
|
|
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.BadgeAuditRecordResultDTO>>
|
|
*/
|
|
@PostMapping("auditrecord")
|
|
public Result<List<BadgeAuditRecordResultDTO>> auditRecord(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO, BadgeFormDTO.AuditGroup.class);
|
|
List<BadgeAuditRecordResultDTO> result = badgeService.auditRecord(tokenDto, formDTO);
|
|
return new Result<List<BadgeAuditRecordResultDTO>>().ok(result);
|
|
}
|
|
|
|
/**
|
|
* 审核
|
|
* @author zhaoqifeng
|
|
* @date 2020/11/5 11:09
|
|
* @param tokenDto
|
|
* @param formDTO
|
|
* @return com.epmet.commons.tools.utils.Result
|
|
*/
|
|
@PostMapping("audit")
|
|
@NoRepeatSubmit
|
|
public Result audit(@LoginUser TokenDto tokenDto, @RequestBody BadgeAuditFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO);
|
|
badgeService.audit(tokenDto, formDTO);
|
|
return new Result();
|
|
}
|
|
|
|
/**
|
|
* @Description 供其他服务调用 查询指定用户需要显示的徽章信息(缓存补偿)
|
|
* @param param
|
|
* @return com.epmet.commons.tools.utils.Result<java.util.Map<java.lang.String,java.util.List<com.epmet.dto.form.UserBadgeUnitFormDTO>>>
|
|
* @author wangc
|
|
* @date 2020.11.10 15:59
|
|
*/
|
|
@PostMapping("usershowbadge")
|
|
public Result<Map<String,List<UserBadgeUnitFormDTO>>> userShowBadge(@RequestBody UserGroupFormDTO param){
|
|
ValidatorUtils.validateEntity(param);
|
|
return new Result<Map<String,List<UserBadgeUnitFormDTO>>>().ok(badgeRedis.batchObtainUserBadge(param.getCustomerId(),param.getUserIds()));
|
|
}
|
|
|
|
/**
|
|
* @param gridIdList
|
|
* @author yinzuomei
|
|
* @description 根据网格id, 查询每个网格有多少个徽章申请单
|
|
* @Date 2020/11/12 15:51
|
|
**/
|
|
@PostMapping("querygridauditingbadgecount")
|
|
public Result<List<GridAuditingBadgeCountResultDTO>> queryGridAuditingBadgeCount(@RequestBody List<String> gridIdList) {
|
|
return new Result<List<GridAuditingBadgeCountResultDTO>>().ok(badgeService.queryGridAuditingBadgeCount(gridIdList));
|
|
}
|
|
|
|
/**
|
|
* @Description 查询用户徽章
|
|
* @Param formDTO
|
|
* @author zxc
|
|
* @date 2021/4/22 下午4:17
|
|
*/
|
|
@PostMapping("userbadges")
|
|
public Result<List<UserBadgesResultDTO>> userBadges(@RequestBody UserBadgesFormDTO formDTO){
|
|
return new Result<List<UserBadgesResultDTO>>().ok(badgeService.userBadges(formDTO));
|
|
}
|
|
|
|
/**
|
|
* @Description
|
|
* @return
|
|
* @author wxz
|
|
* @date 2021.08.02 10:27
|
|
*/
|
|
@PostMapping("list-users-by-badge")
|
|
public Result<List<ListUserByBadgeResultDTO>> listUsersByBadge(@RequestBody ListUserByBadgeFormDTO input) {
|
|
ValidatorUtils.validateEntity(input);
|
|
|
|
String customerId = input.getCustomerId();
|
|
String badgeKey = input.getBadgeKey();
|
|
|
|
List<ListUserByBadgeResultDTO> users = badgeService.listUsersByBadge(customerId, badgeKey);
|
|
return new Result<List<ListUserByBadgeResultDTO>>().ok(users);
|
|
}
|
|
}
|
|
|