diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/UserKindnessTimeLogDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/UserKindnessTimeLogDao.java new file mode 100644 index 0000000000..7659967000 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/UserKindnessTimeLogDao.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.UserKindnessTimeLogEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 用户爱心时长记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-31 + */ +@Mapper +public interface UserKindnessTimeLogDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/UserKindnessTimeLogEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/UserKindnessTimeLogEntity.java new file mode 100644 index 0000000000..a1c8c8dcd6 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/UserKindnessTimeLogEntity.java @@ -0,0 +1,56 @@ +/** + * 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-07-31 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("user_kindness_time_log") +public class UserKindnessTimeLogEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 活动id + */ + private String actId; + + /** + * 居民端用户id + */ + private String resiUserId; + + /** + * 服务时长 + */ + private Integer kindnessTime; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index 4f65a123c3..c228c937a0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -91,6 +91,8 @@ public class WorkActServiceImpl implements WorkActService { private ActSummaryDao actSummaryDao; @Autowired private ActGrantPointLogDao actGrantPointLogDao; + @Autowired + private UserKindnessTimeLogDao userKindnessTimeLogDao; /** * @return void * @author yinzuomei @@ -958,10 +960,20 @@ public class WorkActServiceImpl implements WorkActService { if(ActConstant.ACT_USER_STATUS_SIGNED_IN.equals(actUserRelation.getSignInFlag())){ //已签到的 heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin()); + UserKindnessTimeLogEntity userKindnessTimeLogEntity=new UserKindnessTimeLogEntity(); + userKindnessTimeLogEntity.setActId(actInfoDTO.getId()); + userKindnessTimeLogEntity.setKindnessTime(actInfoDTO.getServiceMin()); + userKindnessTimeLogEntity.setResiUserId(actUserRelation.getUserId()); + userKindnessTimeLogDao.insert(userKindnessTimeLogEntity); }else{ //未签到,但是有积分的 if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){ heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin()); + UserKindnessTimeLogEntity userKindnessTimeLogEntity=new UserKindnessTimeLogEntity(); + userKindnessTimeLogEntity.setActId(actInfoDTO.getId()); + userKindnessTimeLogEntity.setKindnessTime(actInfoDTO.getServiceMin()); + userKindnessTimeLogEntity.setResiUserId(actUserRelation.getUserId()); + userKindnessTimeLogDao.insert(userKindnessTimeLogEntity); } } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql index 3cb7da4267..08eb9a5f57 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql @@ -443,3 +443,17 @@ CREATE TABLE `volunteer_info` ( ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '志愿者信息' ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; + +CREATE TABLE `user_kindness_time_log` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `ACT_ID` varchar(64) NOT NULL COMMENT '活动id', + `RESI_USER_ID` varchar(64) NOT NULL COMMENT '居民端用户id', + `KINDNESS_TIME` int(11) NOT NULL COMMENT '服务时长', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人(工作人员id)', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间(操作的时间)', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户爱心时长记录表'; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/UserKindnessTimeLogDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/UserKindnessTimeLogDao.xml new file mode 100644 index 0000000000..8acc279dbf --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/UserKindnessTimeLogDao.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file