22 changed files with 1598 additions and 5 deletions
@ -0,0 +1,86 @@ |
|||
/** |
|||
* 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.epmet.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 徽章认证配置 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-11-03 |
|||
*/ |
|||
@Data |
|||
public class BadgeCertificationConfigDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户Id 默认配置id:default |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 徽章ID |
|||
*/ |
|||
private String badgeId; |
|||
|
|||
/** |
|||
* 认证信息类型 手机号:mobile;全名:fullname;身份证:idcard;认证证件: certificate;认证说明(备注):remark |
|||
*/ |
|||
private String certificationType; |
|||
|
|||
/** |
|||
* 删除标识 1删除;0未删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,96 @@ |
|||
/** |
|||
* 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.epmet.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 徽章 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-11-03 |
|||
*/ |
|||
@Data |
|||
public class BadgeDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户Id 默认配置id:default |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 徽章名称 |
|||
*/ |
|||
private String badgeName; |
|||
|
|||
/** |
|||
* 徽章图标url |
|||
*/ |
|||
private String badgeIcon; |
|||
|
|||
/** |
|||
* 固有徽章类型 前端页面跳转标识,党员徽章:party;无:none |
|||
*/ |
|||
private String fixationBadgeType; |
|||
|
|||
/** |
|||
* 状态 上线:online;下线:offline; |
|||
*/ |
|||
private String badgeStatus; |
|||
|
|||
/** |
|||
* 删除标识 1删除;0未删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotEmpty; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/11/4 9:47 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class AddBadgeFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -5220529162950147825L; |
|||
/** |
|||
* 徽章名称 |
|||
*/ |
|||
@NotBlank(message = "徽章名称不能为空") |
|||
private String badgeName; |
|||
/** |
|||
* 徽章图标 |
|||
*/ |
|||
@NotBlank(message = "徽章图标不能为空") |
|||
private String badgeIcon; |
|||
/** |
|||
* 徽章状态 上线:online;下线:offline; |
|||
*/ |
|||
@NotBlank(message = "徽章状态不能为空") |
|||
private String badgeStatus; |
|||
/** |
|||
* 认证信息类型数组 手机号:mobile;姓名:fullname;身份证:idcard;认证证件: certificate;认证说明(备注):remark |
|||
*/ |
|||
@NotEmpty(message = "认证信息类型不能为空") |
|||
private List<String> certificationTypes; |
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/11/4 14:22 |
|||
*/ |
|||
@Data |
|||
public class BadgeFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 9156247659994638103L; |
|||
private String badgeId; |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotEmpty; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/11/4 14:23 |
|||
*/ |
|||
@Data |
|||
public class EditBadgeFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 1578890423002035200L; |
|||
private String badgeId; |
|||
/** |
|||
* 徽章名称 |
|||
*/ |
|||
@NotBlank(message = "徽章名称不能为空") |
|||
private String badgeName; |
|||
/** |
|||
* 徽章图标 |
|||
*/ |
|||
@NotBlank(message = "徽章图标不能为空") |
|||
private String badgeIcon; |
|||
/** |
|||
* 徽章状态 上线:online;下线:offline; |
|||
*/ |
|||
@NotBlank(message = "徽章状态不能为空") |
|||
private String badgeStatus; |
|||
/** |
|||
* 认证信息类型数组 手机号:mobile;姓名:fullname;身份证:idcard;认证证件: certificate;认证说明(备注):remark |
|||
*/ |
|||
@NotEmpty(message = "认证信息类型不能为空") |
|||
private List<String> certificationTypes; |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/11/4 14:17 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class BadgeDetailResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 7698898330565297328L; |
|||
|
|||
private String badgeId; |
|||
private String badgeName; |
|||
private String badgeIcon; |
|||
private String badgeStatus; |
|||
private List<String> certificationTypes; |
|||
|
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/11/3 16:58 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class BadgeListResultDTO { |
|||
|
|||
/** |
|||
* 徽章Id |
|||
*/ |
|||
private String badgeId; |
|||
/** |
|||
* 徽章名称 |
|||
*/ |
|||
private String badgeName; |
|||
/** |
|||
* 徽章图标url |
|||
*/ |
|||
private String badgeIcon; |
|||
/** |
|||
* 徽章状态 上线:online;下线:offline; |
|||
*/ |
|||
private String badgeStatus; |
|||
} |
@ -0,0 +1,104 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
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.AddBadgeFormDTO; |
|||
import com.epmet.dto.form.BadgeFormDTO; |
|||
import com.epmet.dto.form.EditBadgeFormDTO; |
|||
import com.epmet.dto.result.BadgeDetailResultDTO; |
|||
import com.epmet.dto.result.BadgeListResultDTO; |
|||
import com.epmet.service.BadgeService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/11/3 16:09 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("badge") |
|||
public class BadgeController { |
|||
@Autowired |
|||
private BadgeService badgeService; |
|||
|
|||
/** |
|||
* 徽章列表 |
|||
* @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) { |
|||
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") |
|||
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) { |
|||
badgeService.deleteBadge(tokenDto, formDTO); |
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,54 @@ |
|||
/** |
|||
* 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.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.BadgeCertificationConfigEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 徽章认证配置 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-11-03 |
|||
*/ |
|||
@Mapper |
|||
public interface BadgeCertificationConfigDao extends BaseDao<BadgeCertificationConfigEntity> { |
|||
/** |
|||
* 获取认证信息类型 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 14:42 |
|||
* @param customerId |
|||
* @param badgeId |
|||
* @return java.util.List<java.lang.String> |
|||
*/ |
|||
List<String> getCertificationType(@Param("customerId") String customerId, @Param("badgeId") String badgeId); |
|||
|
|||
/** |
|||
* 删除认证信息 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 14:43 |
|||
* @param customerId |
|||
* @param badgeId |
|||
* @return int |
|||
*/ |
|||
int deleteConfig(@Param("customerId") String customerId, @Param("badgeId") String badgeId); |
|||
} |
@ -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.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.result.BadgeDetailResultDTO; |
|||
import com.epmet.dto.result.BadgeListResultDTO; |
|||
import com.epmet.entity.BadgeEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 徽章 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-11-03 |
|||
*/ |
|||
@Mapper |
|||
public interface BadgeDao extends BaseDao<BadgeEntity> { |
|||
|
|||
/** |
|||
* 获取徽章列表 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/3 17:30 |
|||
* @param customerId |
|||
* @return java.util.List<com.epmet.dto.result.BadgeListResultDTO> |
|||
*/ |
|||
List<BadgeListResultDTO> selectList(@Param("customerId") String customerId); |
|||
|
|||
/** |
|||
* 重名校验 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 10:40 |
|||
* @param customerId |
|||
* @param badgeName |
|||
* @return java.util.List<com.epmet.dto.result.BadgeListResultDTO> |
|||
*/ |
|||
List<BadgeListResultDTO> getDuplicateName(@Param("customerId") String customerId, @Param("badgeName") String badgeName); |
|||
|
|||
/** |
|||
* 编辑重名校验 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 15:09 |
|||
* @param customerId |
|||
* @param badgeId |
|||
* @param badgeName |
|||
* @return java.util.List<com.epmet.dto.result.BadgeListResultDTO> |
|||
*/ |
|||
List<BadgeListResultDTO> getDuplicateNameForEdit(@Param("customerId") String customerId, @Param("badgeId") String badgeId, |
|||
@Param("badgeName") String badgeName); |
|||
|
|||
/** |
|||
* 获取徽章详情 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 14:30 |
|||
* @param customerId |
|||
* @param badgeId |
|||
* @return com.epmet.dto.result.BadgeDetailResultDTO |
|||
*/ |
|||
BadgeDetailResultDTO selectDetail(@Param("customerId") String customerId, @Param("badgeId") String badgeId); |
|||
|
|||
/** |
|||
* 获取徽章信息 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 15:16 |
|||
* @param customerId |
|||
* @param badgeId |
|||
* @return com.epmet.entity.BadgeEntity |
|||
*/ |
|||
BadgeEntity selectBadgeInfo(@Param("customerId") String customerId, @Param("badgeId") String badgeId); |
|||
|
|||
/** |
|||
* 更新徽章信息 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 15:38 |
|||
* @param entity |
|||
* @return void |
|||
*/ |
|||
void updateBadge(BadgeEntity entity); |
|||
|
|||
/** |
|||
* 删除徽章信息 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 15:39 |
|||
* @param customerId |
|||
* @param badgeId |
|||
* @return void |
|||
*/ |
|||
void deleteBadge(@Param("customerId") String customerId, @Param("badgeId") String badgeId); |
|||
} |
@ -0,0 +1,56 @@ |
|||
/** |
|||
* 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.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 徽章认证配置 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-11-03 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("badge_certification_config") |
|||
public class BadgeCertificationConfigEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户Id 默认配置id:default |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 徽章ID |
|||
*/ |
|||
private String badgeId; |
|||
|
|||
/** |
|||
* 认证信息类型 手机号:mobile;全名:fullname;身份证:idcard;认证证件: certificate;认证说明(备注):remark |
|||
*/ |
|||
private String certificationType; |
|||
|
|||
} |
@ -0,0 +1,66 @@ |
|||
/** |
|||
* 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.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 徽章 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-11-03 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("badge") |
|||
public class BadgeEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户Id 默认配置id:default |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 徽章名称 |
|||
*/ |
|||
private String badgeName; |
|||
|
|||
/** |
|||
* 徽章图标url |
|||
*/ |
|||
private String badgeIcon; |
|||
|
|||
/** |
|||
* 固有徽章类型 前端页面跳转标识,党员徽章:party;无:none |
|||
*/ |
|||
private String fixationBadgeType; |
|||
|
|||
/** |
|||
* 状态 上线:online;下线:offline; |
|||
*/ |
|||
private String badgeStatus; |
|||
|
|||
} |
@ -0,0 +1,127 @@ |
|||
/** |
|||
* 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.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.BadgeCertificationConfigDTO; |
|||
import com.epmet.entity.BadgeCertificationConfigEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 徽章认证配置 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-11-03 |
|||
*/ |
|||
public interface BadgeCertificationConfigService extends BaseService<BadgeCertificationConfigEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<BadgeCertificationConfigDTO> |
|||
* @author generator |
|||
* @date 2020-11-03 |
|||
*/ |
|||
PageData<BadgeCertificationConfigDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<BadgeCertificationConfigDTO> |
|||
* @author generator |
|||
* @date 2020-11-03 |
|||
*/ |
|||
List<BadgeCertificationConfigDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return BadgeCertificationConfigDTO |
|||
* @author generator |
|||
* @date 2020-11-03 |
|||
*/ |
|||
BadgeCertificationConfigDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-11-03 |
|||
*/ |
|||
void save(BadgeCertificationConfigDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-11-03 |
|||
*/ |
|||
void update(BadgeCertificationConfigDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-11-03 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 获取认证信息类型 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 14:39 |
|||
* @param customerId |
|||
* @param badgeId |
|||
* @return java.util.List<java.lang.String> |
|||
*/ |
|||
List<String> getCertificationType(String customerId, String badgeId); |
|||
|
|||
/** |
|||
* 保存认证信息配置 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 15:29 |
|||
* @param customerId |
|||
* @param badgeId |
|||
* @param list |
|||
* @return void |
|||
*/ |
|||
void saveConfig(String customerId, String badgeId, List<BadgeCertificationConfigEntity> list); |
|||
|
|||
/** |
|||
* 删除配置 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 15:41 |
|||
* @param customerId |
|||
* @param badgeId |
|||
* @return void |
|||
*/ |
|||
void deleteConfig(String customerId, String badgeId); |
|||
|
|||
} |
@ -0,0 +1,150 @@ |
|||
/** |
|||
* 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.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.dto.BadgeDTO; |
|||
import com.epmet.dto.form.AddBadgeFormDTO; |
|||
import com.epmet.dto.form.BadgeFormDTO; |
|||
import com.epmet.dto.form.EditBadgeFormDTO; |
|||
import com.epmet.dto.result.BadgeDetailResultDTO; |
|||
import com.epmet.dto.result.BadgeListResultDTO; |
|||
import com.epmet.entity.BadgeEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 徽章 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-11-03 |
|||
*/ |
|||
public interface BadgeService extends BaseService<BadgeEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<BadgeDTO> |
|||
* @author generator |
|||
* @date 2020-11-03 |
|||
*/ |
|||
PageData<BadgeDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<BadgeDTO> |
|||
* @author generator |
|||
* @date 2020-11-03 |
|||
*/ |
|||
List<BadgeDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return BadgeDTO |
|||
* @author generator |
|||
* @date 2020-11-03 |
|||
*/ |
|||
BadgeDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-11-03 |
|||
*/ |
|||
void save(BadgeDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-11-03 |
|||
*/ |
|||
void update(BadgeDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-11-03 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 获取徽章列表 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/3 17:04 |
|||
* @param customerId |
|||
* @return java.util.List<com.epmet.dto.result.BadgeListResultDTO> |
|||
*/ |
|||
List<BadgeListResultDTO> getList(String customerId); |
|||
|
|||
/** |
|||
* 添加徽章 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 10:09 |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return void |
|||
*/ |
|||
void add(TokenDto tokenDto, AddBadgeFormDTO formDTO); |
|||
|
|||
/** |
|||
* 徽章详情 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 14:25 |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return com.epmet.dto.result.BadgeDetailResultDTO |
|||
*/ |
|||
BadgeDetailResultDTO detail(TokenDto tokenDto, BadgeFormDTO formDTO); |
|||
|
|||
/** |
|||
* 编辑徽章 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 14:28 |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return void |
|||
*/ |
|||
void edit(TokenDto tokenDto, EditBadgeFormDTO formDTO); |
|||
|
|||
/** |
|||
* 删除徽章 |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 15:34 |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return void |
|||
*/ |
|||
void deleteBadge(TokenDto tokenDto, BadgeFormDTO formDTO); |
|||
} |
@ -0,0 +1,149 @@ |
|||
/** |
|||
* 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.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.dao.BadgeCertificationConfigDao; |
|||
import com.epmet.dto.BadgeCertificationConfigDTO; |
|||
import com.epmet.entity.BadgeCertificationConfigEntity; |
|||
import com.epmet.service.BadgeCertificationConfigService; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
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 generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-11-03 |
|||
*/ |
|||
@Service |
|||
public class BadgeCertificationConfigServiceImpl extends BaseServiceImpl<BadgeCertificationConfigDao, BadgeCertificationConfigEntity> implements BadgeCertificationConfigService { |
|||
|
|||
|
|||
@Override |
|||
public PageData<BadgeCertificationConfigDTO> page(Map<String, Object> params) { |
|||
IPage<BadgeCertificationConfigEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, BadgeCertificationConfigDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<BadgeCertificationConfigDTO> list(Map<String, Object> params) { |
|||
List<BadgeCertificationConfigEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, BadgeCertificationConfigDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<BadgeCertificationConfigEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<BadgeCertificationConfigEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public BadgeCertificationConfigDTO get(String id) { |
|||
BadgeCertificationConfigEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, BadgeCertificationConfigDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(BadgeCertificationConfigDTO dto) { |
|||
BadgeCertificationConfigEntity entity = ConvertUtils.sourceToTarget(dto, BadgeCertificationConfigEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(BadgeCertificationConfigDTO dto) { |
|||
BadgeCertificationConfigEntity entity = ConvertUtils.sourceToTarget(dto, BadgeCertificationConfigEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
/** |
|||
* 获取认证信息类型 |
|||
* |
|||
* @param customerId |
|||
* @param badgeId |
|||
* @return java.util.List<java.lang.String> |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 14:39 |
|||
*/ |
|||
@Override |
|||
public List<String> getCertificationType(String customerId, String badgeId) { |
|||
List<String> list = baseDao.getCertificationType(customerId, badgeId); |
|||
if (CollectionUtils.isEmpty(list)) { |
|||
list = baseDao.getCertificationType("default", badgeId); |
|||
} |
|||
return list; |
|||
} |
|||
|
|||
/** |
|||
* 保存认证信息配置 |
|||
* |
|||
* @param list |
|||
* @return void |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 15:28 |
|||
*/ |
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void saveConfig(String customerId, String badgeId, List<BadgeCertificationConfigEntity> list) { |
|||
baseDao.deleteConfig(customerId, badgeId); |
|||
insertBatch(list); |
|||
} |
|||
|
|||
/** |
|||
* 删除配置 |
|||
* |
|||
* @param customerId |
|||
* @param badgeId |
|||
* @return void |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 15:41 |
|||
*/ |
|||
@Override |
|||
public void deleteConfig(String customerId, String badgeId) { |
|||
baseDao.deleteConfig(customerId, badgeId); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,248 @@ |
|||
/** |
|||
* 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.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.constant.BadgeConstant; |
|||
import com.epmet.dao.BadgeDao; |
|||
import com.epmet.dto.BadgeDTO; |
|||
import com.epmet.dto.form.AddBadgeFormDTO; |
|||
import com.epmet.dto.form.BadgeFormDTO; |
|||
import com.epmet.dto.form.EditBadgeFormDTO; |
|||
import com.epmet.dto.result.BadgeDetailResultDTO; |
|||
import com.epmet.dto.result.BadgeListResultDTO; |
|||
import com.epmet.entity.BadgeCertificationConfigEntity; |
|||
import com.epmet.entity.BadgeEntity; |
|||
import com.epmet.service.BadgeCertificationConfigService; |
|||
import com.epmet.service.BadgeService; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
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 generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-11-03 |
|||
*/ |
|||
@Service |
|||
public class BadgeServiceImpl extends BaseServiceImpl<BadgeDao, BadgeEntity> implements BadgeService { |
|||
|
|||
@Autowired |
|||
private BadgeCertificationConfigService badgeCertificationConfigService; |
|||
|
|||
|
|||
@Override |
|||
public PageData<BadgeDTO> page(Map<String, Object> params) { |
|||
IPage<BadgeEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, BadgeDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<BadgeDTO> list(Map<String, Object> params) { |
|||
List<BadgeEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, BadgeDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<BadgeEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<BadgeEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public BadgeDTO get(String id) { |
|||
BadgeEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, BadgeDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(BadgeDTO dto) { |
|||
BadgeEntity entity = ConvertUtils.sourceToTarget(dto, BadgeEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(BadgeDTO dto) { |
|||
BadgeEntity entity = ConvertUtils.sourceToTarget(dto, BadgeEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
/** |
|||
* 获取徽章列表 |
|||
* |
|||
* @param customerId |
|||
* @return java.util.List<com.epmet.dto.result.BadgeListResultDTO> |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/3 17:04 |
|||
*/ |
|||
@Override |
|||
public List<BadgeListResultDTO> getList(String customerId) { |
|||
return baseDao.selectList(customerId); |
|||
} |
|||
|
|||
/** |
|||
* 添加徽章 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return void |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 10:09 |
|||
*/ |
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void add(TokenDto tokenDto, AddBadgeFormDTO formDTO) { |
|||
//重名校验
|
|||
List<BadgeListResultDTO> list = baseDao.getDuplicateName(tokenDto.getCustomerId(), formDTO.getBadgeName()); |
|||
if (CollectionUtils.isNotEmpty(list)) { |
|||
throw new RenException(EpmetErrorCode.DUPLICATE_BADGE_NAME.getCode()); |
|||
} |
|||
BadgeEntity entity = ConvertUtils.sourceToTarget(formDTO, BadgeEntity.class); |
|||
entity.setCustomerId(tokenDto.getCustomerId()); |
|||
entity.setFixationBadgeType(BadgeConstant.NONE); |
|||
insert(entity); |
|||
//保存徽章认证配置
|
|||
List<BadgeCertificationConfigEntity> badgeList = new ArrayList<>(); |
|||
formDTO.getCertificationTypes().forEach(item -> { |
|||
BadgeCertificationConfigEntity badge = new BadgeCertificationConfigEntity(); |
|||
badge.setBadgeId(entity.getId()); |
|||
badge.setCertificationType(item); |
|||
badge.setCustomerId(tokenDto.getCustomerId()); |
|||
badgeList.add(badge); |
|||
}); |
|||
badgeCertificationConfigService.insertBatch(badgeList); |
|||
} |
|||
|
|||
/** |
|||
* 徽章详情 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return com.epmet.dto.result.BadgeDetailResultDTO |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 14:25 |
|||
*/ |
|||
@Override |
|||
public BadgeDetailResultDTO detail(TokenDto tokenDto, BadgeFormDTO formDTO) { |
|||
BadgeDetailResultDTO result = baseDao.selectDetail(tokenDto.getCustomerId(), formDTO.getBadgeId()); |
|||
List<String> types = badgeCertificationConfigService.getCertificationType(tokenDto.getCustomerId(), formDTO.getBadgeId()); |
|||
result.setCertificationTypes(types); |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 编辑徽章 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return void |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 14:28 |
|||
*/ |
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void edit(TokenDto tokenDto, EditBadgeFormDTO formDTO) { |
|||
//重名校验
|
|||
List<BadgeListResultDTO> list = baseDao.getDuplicateNameForEdit(tokenDto.getCustomerId(), formDTO.getBadgeId(), formDTO.getBadgeName()); |
|||
if (CollectionUtils.isNotEmpty(list)) { |
|||
throw new RenException(EpmetErrorCode.DUPLICATE_BADGE_NAME.getCode()); |
|||
} |
|||
|
|||
BadgeEntity badgeEntity = baseDao.selectBadgeInfo(tokenDto.getCustomerId(), formDTO.getBadgeId()); |
|||
if (null == badgeEntity) { |
|||
badgeEntity = baseDao.selectBadgeInfo("default", formDTO.getBadgeId()); |
|||
badgeEntity.setCustomerId(tokenDto.getCustomerId()); |
|||
badgeEntity.setBadgeName(formDTO.getBadgeName()); |
|||
badgeEntity.setBadgeIcon(formDTO.getBadgeIcon()); |
|||
badgeEntity.setBadgeStatus(formDTO.getBadgeStatus()); |
|||
baseDao.insert(badgeEntity); |
|||
} else { |
|||
badgeEntity.setBadgeName(formDTO.getBadgeName()); |
|||
badgeEntity.setBadgeIcon(formDTO.getBadgeIcon()); |
|||
badgeEntity.setBadgeStatus(formDTO.getBadgeStatus()); |
|||
baseDao.updateBadge(badgeEntity); |
|||
} |
|||
//保存徽章认证配置
|
|||
List<BadgeCertificationConfigEntity> badgeList = new ArrayList<>(); |
|||
formDTO.getCertificationTypes().forEach(item -> { |
|||
BadgeCertificationConfigEntity badge = new BadgeCertificationConfigEntity(); |
|||
badge.setBadgeId(formDTO.getBadgeId()); |
|||
badge.setCertificationType(item); |
|||
badge.setCustomerId(tokenDto.getCustomerId()); |
|||
badgeList.add(badge); |
|||
}); |
|||
badgeCertificationConfigService.saveConfig(tokenDto.getCustomerId(), formDTO.getBadgeId(), badgeList); |
|||
} |
|||
|
|||
/** |
|||
* 删除徽章 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return void |
|||
* @author zhaoqifeng |
|||
* @date 2020/11/4 15:34 |
|||
*/ |
|||
@Override |
|||
public void deleteBadge(TokenDto tokenDto, BadgeFormDTO formDTO) { |
|||
BadgeEntity badgeEntity = baseDao.selectBadgeInfo(tokenDto.getCustomerId(), formDTO.getBadgeId()); |
|||
if (null == badgeEntity) { |
|||
badgeEntity = baseDao.selectBadgeInfo("default", formDTO.getBadgeId()); |
|||
badgeEntity.setCustomerId(tokenDto.getCustomerId()); |
|||
badgeEntity.setDelFlag(NumConstant.ONE_STR); |
|||
baseDao.insert(badgeEntity); |
|||
} else { |
|||
baseDao.deleteBadge(tokenDto.getCustomerId(), formDTO.getBadgeId()); |
|||
} |
|||
badgeCertificationConfigService.deleteConfig(tokenDto.getCustomerId(), formDTO.getBadgeId()); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,42 @@ |
|||
<?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.epmet.dao.BadgeCertificationConfigDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.BadgeCertificationConfigEntity" id="badgeCertificationConfigMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="badgeId" column="BADGE_ID"/> |
|||
<result property="certificationType" column="CERTIFICATION_TYPE"/> |
|||
<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> |
|||
<delete id="deleteConfig"> |
|||
DELETE a |
|||
FROM |
|||
badge_certification_config a |
|||
WHERE |
|||
EXISTS ( |
|||
SELECT |
|||
* |
|||
FROM |
|||
( SELECT ID FROM badge_certification_config |
|||
WHERE CUSTOMER_ID = #{customerId} |
|||
AND BADGE_ID = #{badgeId} |
|||
AND DEL_FLAG = '0' ) b |
|||
WHERE |
|||
a.ID = b.ID) |
|||
</delete> |
|||
<select id="getCertificationType" resultType="java.lang.String"> |
|||
select CERTIFICATION_TYPE from badge_certification_config |
|||
where CUSTOMER_ID = #{customerId} |
|||
and BADGE_ID = #{badgeId} |
|||
and DEL_FLAG = '0' |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,116 @@ |
|||
<?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.epmet.dao.BadgeDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.BadgeEntity" id="badgeMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="badgeName" column="BADGE_NAME"/> |
|||
<result property="badgeIcon" column="BADGE_ICON"/> |
|||
<result property="fixationBadgeType" column="FIXATION_BADGE_TYPE"/> |
|||
<result property="badgeStatus" column="BADGE_STATUS"/> |
|||
<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> |
|||
<update id="updateBadge" parameterType="com.epmet.entity.BadgeEntity"> |
|||
update badge set |
|||
BADGE_NAME = #{badgeName}, |
|||
BADGE_ICON = #{badgeIcon}, |
|||
BADGE_STATUS = #{badgeStatus} |
|||
where ID = #{id} AND CUSTOMER_ID = #{customerId} |
|||
|
|||
</update> |
|||
<update id="deleteBadge"> |
|||
update badge set |
|||
DEL_FLAG = '1' |
|||
where ID = #{badgeId} AND CUSTOMER_ID = #{customerId} |
|||
</update> |
|||
<select id="selectList" resultType="com.epmet.dto.result.BadgeListResultDTO"> |
|||
SELECT |
|||
ID AS "badgeId", |
|||
BADGE_NAME, |
|||
BADGE_ICON, |
|||
BADGE_STATUS |
|||
FROM |
|||
( |
|||
SELECT * FROM badge |
|||
WHERE CUSTOMER_ID = #{customerId} AND DEL_FLAG = '0' |
|||
UNION ALL |
|||
SELECT * FROM badge a |
|||
WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0' |
|||
AND NOT EXISTS |
|||
( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.BADGE_NAME = b.BADGE_NAME AND b.DEL_FLAG = '0')) t |
|||
ORDER BY |
|||
CREATED_TIME DESC |
|||
</select> |
|||
<select id="getDuplicateName" resultType="com.epmet.dto.result.BadgeListResultDTO"> |
|||
SELECT |
|||
* |
|||
FROM |
|||
(SELECT |
|||
ID AS "badgeId", |
|||
BADGE_NAME, |
|||
BADGE_ICON, |
|||
BADGE_STATUS |
|||
FROM |
|||
( |
|||
SELECT * FROM badge |
|||
WHERE CUSTOMER_ID = #{customerId} AND DEL_FLAG = '0' |
|||
UNION ALL |
|||
SELECT * FROM badge a |
|||
WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0' |
|||
AND NOT EXISTS |
|||
( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.BADGE_NAME = b.BADGE_NAME AND b.DEL_FLAG = '0' )) t) a |
|||
WHERE BADGE_NAME = #{badgeName} |
|||
</select> |
|||
<select id="selectDetail" resultType="com.epmet.dto.result.BadgeDetailResultDTO"> |
|||
SELECT |
|||
* |
|||
FROM |
|||
(SELECT |
|||
ID AS "badgeId", |
|||
BADGE_NAME, |
|||
BADGE_ICON, |
|||
BADGE_STATUS |
|||
FROM |
|||
( |
|||
SELECT * FROM badge |
|||
WHERE CUSTOMER_ID = #{customerId} AND DEL_FLAG = '0' |
|||
UNION ALL |
|||
SELECT * FROM badge a |
|||
WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0' |
|||
AND NOT EXISTS |
|||
( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.BADGE_NAME = b.BADGE_NAME AND b.DEL_FLAG = '0' )) t) a |
|||
WHERE badgeId = #{badgeId} |
|||
</select> |
|||
<select id="getDuplicateNameForEdit" resultType="com.epmet.dto.result.BadgeListResultDTO"> |
|||
SELECT |
|||
* |
|||
FROM |
|||
(SELECT |
|||
ID AS "badgeId", |
|||
BADGE_NAME, |
|||
BADGE_ICON, |
|||
BADGE_STATUS |
|||
FROM |
|||
( |
|||
SELECT * FROM badge |
|||
WHERE CUSTOMER_ID = #{customerId} AND DEL_FLAG = '0' |
|||
UNION ALL |
|||
SELECT * FROM badge a |
|||
WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0' |
|||
AND NOT EXISTS |
|||
( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.BADGE_NAME = b.BADGE_NAME AND b.DEL_FLAG = '0' )) t) a |
|||
WHERE BADGE_NAME = #{badgeName} AND badgeId != #{badgeId} |
|||
</select> |
|||
<select id="selectBadgeInfo" resultType="com.epmet.entity.BadgeEntity"> |
|||
select * from badge where DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} AND ID = #{badgeId} |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue