diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ResiUserBadgeDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ResiUserBadgeDTO.java
new file mode 100644
index 0000000000..21e910101f
--- /dev/null
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ResiUserBadgeDTO.java
@@ -0,0 +1,101 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+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-06
+ */
+@Data
+public class ResiUserBadgeDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键ID
+ */
+ private String id;
+
+ /**
+ * 客户Id 默认配置id:default
+ */
+ private String customerId;
+
+ /**
+ * 用户注册网格ID
+ */
+ private String gridId;
+
+ /**
+ * 用户ID
+ */
+ private String userId;
+
+ /**
+ * 徽章ID
+ */
+ private String badgeId;
+
+ /**
+ * 是否开启(点亮) 1:点亮;0:未点亮
+ */
+ private Integer isOpened;
+
+ /**
+ * 认证(审核)状态 待审核:auditing;审核通过:pass;驳回:rejected;
+ */
+ private String certificationAutidStatus;
+
+ /**
+ * 删除标识 1删除;0未删除
+ */
+ private String delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java
index a0c2fb42b6..e20fd8a523 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java
@@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.BadgeDTO;
import com.epmet.dto.result.BadgeAuditRecordResultDTO;
import com.epmet.dto.result.BadgeAuditingResultDTO;
import com.epmet.dto.result.BadgeDetailResultDTO;
@@ -142,4 +143,13 @@ public interface BadgeDao extends BaseDao {
* @date 2020.11.05 15:50
*/
List selectCustomerBadgePool(@Param("customerId") String customerId);
+
+ /**
+ * 插入数据
+ * @author zhaoqifeng
+ * @date 2020/11/6 14:46
+ * @param entity
+ * @return void
+ */
+ void insertBadge(BadgeDTO dto);
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ResiUserBadgeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ResiUserBadgeDao.java
new file mode 100644
index 0000000000..0448b16cee
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ResiUserBadgeDao.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.ResiUserBadgeEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 用户徽章关系表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-11-06
+ */
+@Mapper
+public interface ResiUserBadgeDao extends BaseDao {
+
+}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/ResiUserBadgeEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/ResiUserBadgeEntity.java
new file mode 100644
index 0000000000..4087df8fc6
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/ResiUserBadgeEntity.java
@@ -0,0 +1,71 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+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-06
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("resi_user_badge")
+public class ResiUserBadgeEntity extends BaseEpmetEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 客户Id 默认配置id:default
+ */
+ private String customerId;
+
+ /**
+ * 用户注册网格ID
+ */
+ private String gridId;
+
+ /**
+ * 用户ID
+ */
+ private String userId;
+
+ /**
+ * 徽章ID
+ */
+ private String badgeId;
+
+ /**
+ * 是否开启(点亮) 1:点亮;0:未点亮
+ */
+ private Integer isOpened;
+
+ /**
+ * 认证(审核)状态 待审核:auditing;审核通过:pass;驳回:rejected;
+ */
+ private String certificationAutidStatus;
+
+}
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ResiUserBadgeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ResiUserBadgeService.java
new file mode 100644
index 0000000000..b858776d51
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ResiUserBadgeService.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service;
+
+import com.epmet.commons.mybatis.service.BaseService;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.dto.ResiUserBadgeDTO;
+import com.epmet.entity.ResiUserBadgeEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 用户徽章关系表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-11-06
+ */
+public interface ResiUserBadgeService extends BaseService {
+
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2020-11-06
+ */
+ PageData page(Map params);
+
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2020-11-06
+ */
+ List list(Map params);
+
+ /**
+ * 单条查询
+ *
+ * @param id
+ * @return ResiUserBadgeDTO
+ * @author generator
+ * @date 2020-11-06
+ */
+ ResiUserBadgeDTO get(String id);
+
+ /**
+ * 默认保存
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-11-06
+ */
+ void save(ResiUserBadgeDTO dto);
+
+ /**
+ * 默认更新
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-11-06
+ */
+ void update(ResiUserBadgeDTO dto);
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return void
+ * @author generator
+ * @date 2020-11-06
+ */
+ void delete(String[] ids);
+}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java
index 36ea72d2ff..89c6b72a75 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java
@@ -30,23 +30,17 @@ 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.ResiUserBadgeDTO;
import com.epmet.dto.UserBadgeCertificateRecordDTO;
-import com.epmet.dto.form.AddBadgeFormDTO;
-import com.epmet.dto.form.BadgeAuditFormDTO;
-import com.epmet.dto.form.BadgeFormDTO;
-import com.epmet.dto.form.EditBadgeFormDTO;
+import com.epmet.dto.form.*;
import com.epmet.dto.result.BadgeAuditRecordResultDTO;
import com.epmet.dto.result.BadgeAuditingResultDTO;
-import com.epmet.dto.form.UserBadgeUnitFormDTO;
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.redis.UserBadgeRedis;
-import com.epmet.service.BadgeCertificationConfigService;
-import com.epmet.service.BadgeService;
-import com.epmet.service.UserBadgeCertificateRecordService;
-import com.epmet.service.UserBadgeService;
+import com.epmet.service.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -70,6 +64,10 @@ public class BadgeServiceImpl extends BaseServiceImpl imp
private UserBadgeCertificateRecordService userBadgeCertificateRecordService;
@Autowired
private UserBadgeRedis badgeRedis;
+ @Autowired
+ private UserBadgeService userBadgeService;
+ @Autowired
+ private ResiUserBadgeService resiUserBadgeService;
@Override
@@ -127,7 +125,7 @@ public class BadgeServiceImpl extends BaseServiceImpl imp
/**
* 获取徽章列表
*
- * @param customerId
+ * @param customerId 客户ID
* @return java.util.List
* @author zhaoqifeng
* @date 2020/11/3 17:04
@@ -140,8 +138,8 @@ public class BadgeServiceImpl extends BaseServiceImpl imp
/**
* 添加徽章
*
- * @param tokenDto
- * @param formDTO
+ * @param tokenDto token
+ * @param formDTO 入参
* @return void
* @author zhaoqifeng
* @date 2020/11/4 10:09
@@ -168,16 +166,17 @@ public class BadgeServiceImpl extends BaseServiceImpl imp
badgeList.add(badge);
});
badgeCertificationConfigService.insertBatch(badgeList);
+ //更新Redis
if (BadgeConstant.ONLINE.equals(formDTO.getBadgeStatus())) {
- //TODO 更新Redis
+ userBadgeService.reloadCustomerBadge(tokenDto.getCustomerId());
}
}
/**
* 徽章详情
*
- * @param tokenDto
- * @param formDTO
+ * @param tokenDto token
+ * @param formDTO 入参
* @return com.epmet.dto.result.BadgeDetailResultDTO
* @author zhaoqifeng
* @date 2020/11/4 14:25
@@ -193,8 +192,8 @@ public class BadgeServiceImpl extends BaseServiceImpl imp
/**
* 编辑徽章
*
- * @param tokenDto
- * @param formDTO
+ * @param tokenDto token
+ * @param formDTO 入参
* @return void
* @author zhaoqifeng
* @date 2020/11/4 14:28
@@ -232,16 +231,15 @@ public class BadgeServiceImpl extends BaseServiceImpl imp
badgeList.add(badge);
});
badgeCertificationConfigService.saveConfig(tokenDto.getCustomerId(), formDTO.getBadgeId(), badgeList);
- if (BadgeConstant.OFFLINE.equals(formDTO.getBadgeStatus())) {
- //TODO 更新Redis
- }
+ //更新Redis
+ userBadgeService.reloadCustomerBadge(tokenDto.getCustomerId());
}
/**
* 删除徽章
*
- * @param tokenDto
- * @param formDTO
+ * @param tokenDto token
+ * @param formDTO 入参
* @return void
* @author zhaoqifeng
* @date 2020/11/4 15:34
@@ -254,9 +252,14 @@ public class BadgeServiceImpl extends BaseServiceImpl imp
if (BadgeConstant.PARTY.equals(badgeEntity.getFixationBadgeType())) {
throw new RenException(EpmetErrorCode.DUPLICATE_PARTY_BADGE_NAME.getCode());
}
- badgeEntity.setCustomerId(tokenDto.getCustomerId());
- badgeEntity.setDelFlag(NumConstant.ONE_STR);
- baseDao.insert(badgeEntity);
+ BadgeDTO badgeDTO = ConvertUtils.sourceToTarget(badgeEntity, BadgeDTO.class);
+ badgeDTO.setCustomerId(tokenDto.getCustomerId());
+ badgeDTO.setDelFlag(NumConstant.ONE_STR);
+ badgeDTO.setCreatedBy(tokenDto.getUserId());
+ badgeDTO.setCreatedTime(new Date());
+ badgeDTO.setUpdatedBy(tokenDto.getUserId());
+ badgeDTO.setUpdatedTime(new Date());
+ baseDao.insertBadge(badgeDTO);
} else {
if (BadgeConstant.PARTY.equals(badgeEntity.getFixationBadgeType())) {
throw new RenException(EpmetErrorCode.DUPLICATE_PARTY_BADGE_NAME.getCode());
@@ -264,14 +267,15 @@ public class BadgeServiceImpl extends BaseServiceImpl imp
baseDao.deleteBadge(tokenDto.getCustomerId(), formDTO.getBadgeId());
}
badgeCertificationConfigService.deleteConfig(tokenDto.getCustomerId(), formDTO.getBadgeId());
- //TODO 更新Redis
+ //更新Redis
+ userBadgeService.reloadCustomerBadge(tokenDto.getCustomerId());
}
/**
* 待审核列表
*
- * @param tokenDto
- * @param formDTO
+ * @param tokenDto token
+ * @param formDTO 入参
* @return java.util.List
* @author zhaoqifeng
* @date 2020/11/5 9:50
@@ -280,17 +284,15 @@ public class BadgeServiceImpl extends BaseServiceImpl imp
public List auditingList(TokenDto tokenDto, BadgeFormDTO formDTO) {
int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
List list = baseDao.selectAuditingList(tokenDto.getCustomerId(), pageIndex, formDTO.getPageSize());
- list.forEach(item -> {
- item.setCreateTime(item.getCreateTime()/NumConstant.SIXTY);
- });
+ list.forEach(item -> item.setCreateTime(item.getCreateTime()/NumConstant.SIXTY));
return list;
}
/**
* 审核历史列表
*
- * @param tokenDto
- * @param formDTO
+ * @param tokenDto token
+ * @param formDTO 入参
* @return java.util.List
* @author zhaoqifeng
* @date 2020/11/5 10:59
@@ -299,25 +301,22 @@ public class BadgeServiceImpl extends BaseServiceImpl imp
public List auditRecord(TokenDto tokenDto, BadgeFormDTO formDTO) {
int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
List list = baseDao.selectAuditRecord(tokenDto.getCustomerId(), pageIndex, formDTO.getPageSize());
- list.forEach(item -> {
- item.setCreateTime(item.getCreateTime()/NumConstant.SIXTY);
- });
+ list.forEach(item -> item.setCreateTime(item.getCreateTime()/NumConstant.SIXTY));
return list;
}
/**
* 审核
*
- * @param tokenDto
- * @param formDTO
+ * @param tokenDto token
+ * @param formDTO 入参
* @return void
* @author zhaoqifeng
* @date 2020/11/5 11:08
*/
@Override
public void audit(TokenDto tokenDto, BadgeAuditFormDTO formDTO) {
- UserBadgeCertificateRecordDTO dto = new UserBadgeCertificateRecordDTO();
- dto.setId(formDTO.getRecordId());
+ UserBadgeCertificateRecordDTO dto = userBadgeCertificateRecordService.get(formDTO.getRecordId());
dto.setAuditStatus(formDTO.getAuditStatus());
dto.setAuditRemark(formDTO.getAuditRemark());
dto.setStaffId(tokenDto.getUserId());
@@ -325,8 +324,22 @@ public class BadgeServiceImpl extends BaseServiceImpl imp
userBadgeCertificateRecordService.update(dto);
+ ResiUserBadgeDTO resiUserBadgeDTO = new ResiUserBadgeDTO();
+ resiUserBadgeDTO.setCustomerId(dto.getCustomerId());
+ resiUserBadgeDTO.setBadgeId(dto.getBadgeId());
+ resiUserBadgeDTO.setGridId(dto.getGridId());
+ resiUserBadgeDTO.setUserId(dto.getUserId());
+ resiUserBadgeDTO.setIsOpened(NumConstant.ZERO);
+ resiUserBadgeDTO.setCertificationAutidStatus(dto.getAuditStatus());
+ resiUserBadgeService.save(resiUserBadgeDTO);
+
if(BadgeConstant.APPROVED.equals(formDTO.getAuditStatus())) {
- //TODO 更新Redis
+ //更新Redis
+ OpenedOrClosedFormDTO openedOrClosedFormDTO = new OpenedOrClosedFormDTO();
+ openedOrClosedFormDTO.setCustomerId(dto.getCustomerId());
+ openedOrClosedFormDTO.setUserId(dto.getUserId());
+ openedOrClosedFormDTO.setBadgeId(dto.getBadgeId());
+ userBadgeService.openedOrClosed(openedOrClosedFormDTO);
}
}
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ResiUserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ResiUserBadgeServiceImpl.java
new file mode 100644
index 0000000000..7c0730af71
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ResiUserBadgeServiceImpl.java
@@ -0,0 +1,101 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+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.ResiUserBadgeDao;
+import com.epmet.dto.ResiUserBadgeDTO;
+import com.epmet.entity.ResiUserBadgeEntity;
+import com.epmet.service.ResiUserBadgeService;
+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-06
+ */
+@Service
+public class ResiUserBadgeServiceImpl extends BaseServiceImpl implements ResiUserBadgeService {
+
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, ResiUserBadgeDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, ResiUserBadgeDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String id = (String)params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+
+ return wrapper;
+ }
+
+ @Override
+ public ResiUserBadgeDTO get(String id) {
+ ResiUserBadgeEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, ResiUserBadgeDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(ResiUserBadgeDTO dto) {
+ ResiUserBadgeEntity entity = ConvertUtils.sourceToTarget(dto, ResiUserBadgeEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(ResiUserBadgeDTO dto) {
+ ResiUserBadgeEntity entity = ConvertUtils.sourceToTarget(dto, ResiUserBadgeEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java
index e152d83c20..6b65ba600a 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java
@@ -20,6 +20,7 @@ import com.epmet.service.UserBadgeService;
import com.epmet.service.UserBaseInfoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -27,6 +28,8 @@ import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
/**
* @Author zxc
diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml
index e7d0243bf8..91267d3a5b 100644
--- a/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml
+++ b/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml
@@ -17,6 +17,35 @@
+
+ INSERT INTO badge
+ (`ID`,
+ `CUSTOMER_ID`,
+ `BADGE_NAME`,
+ `BADGE_ICON`,
+ `FIXATION_BADGE_TYPE`,
+ `BADGE_STATUS`,
+ `DEL_FLAG`,
+ `REVISION`,
+ `CREATED_BY`,
+ `CREATED_TIME`,
+ `UPDATED_BY`,
+ `UPDATED_TIME`)
+ VALUES
+ (#{id},
+ #{customerId},
+ #{badgeName},
+ #{badgeIcon},
+ #{fixationBadgeType},
+ #{badgeStatus},
+ #{delFlag},
+ #{revision},
+ #{createdBy},
+ #{createdTime},
+ #{updatedBy},
+ #{updatedTime});
+
+
update badge set
BADGE_NAME = #{badgeName},
@@ -42,7 +71,7 @@
WHERE CUSTOMER_ID = #{customerId} AND DEL_FLAG = '0'
UNION ALL
SELECT * FROM badge a
- WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0' AND BADGE_STATUS = 'online'
+ WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0'
AND NOT EXISTS
( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.ID = b.ID)) t
ORDER BY
diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/ResiUserBadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/ResiUserBadgeDao.xml
new file mode 100644
index 0000000000..221c9c3d3f
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/resources/mapper/ResiUserBadgeDao.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file