From d329605cc1f4d58ad07375af83c79e8a40748c3d Mon Sep 17 00:00:00 2001 From: wangchao Date: Fri, 31 Jul 2020 16:59:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=A7=AF=E5=88=86=20+=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-point-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-point/epmet-point-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml index 3d45a6715b..3f44fa403f 100644 --- a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-point-server: container_name: epmet-point-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.13 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.14 ports: - "8112:8112" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-point/epmet-point-server/pom.xml b/epmet-module/epmet-point/epmet-point-server/pom.xml index 99a6073d4f..6f01ad765a 100644 --- a/epmet-module/epmet-point/epmet-point-server/pom.xml +++ b/epmet-module/epmet-point/epmet-point-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.0.13 + 0.0.14 epmet-point com.epmet From 427978366d17af9aab0cbb39571b46da8cdbad8e Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 31 Jul 2020 17:05:16 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=96=B0=E5=A2=9Euser=5Fkindness=5Ftime=5F?= =?UTF-8?q?log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dao/UserKindnessTimeLogDao.java | 33 +++++++++++ .../entity/UserKindnessTimeLogEntity.java | 56 +++++++++++++++++++ .../service/impl/WorkActServiceImpl.java | 12 ++++ .../resources/db/migration/epmet_heart.sql | 14 +++++ .../mapper/UserKindnessTimeLogDao.xml | 20 +++++++ 5 files changed, 135 insertions(+) create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/UserKindnessTimeLogDao.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/UserKindnessTimeLogEntity.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/UserKindnessTimeLogDao.xml 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 From 007abfd18e32b28a8509e6d6a7a5990da73a7c14 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Fri, 31 Jul 2020 17:34:29 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=97=E8=A1=A8sql=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/ActInfoDao.xml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index d362229eba..b3d4fb4fe0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -65,14 +65,13 @@ 'signing_up' AS actCurrentState, -- 活动状态:报名中,未报满 IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag FROM act_info i - LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' AND u.`STATUS` != 'refused' AND u.`STATUS` != 'canceled' + LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' AND u.`STATUS` != 'refused' AND u.`STATUS` != 'canceled' AND u.USER_ID = #{userId} LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND i.ACT_STATUS = 'published' AND = ]]> NOW() -- 报名截止时间 >= 当前时间 AND (i.ACT_QUOTA_CATEGORY = 0 OR i.ACT_QUOTA > IFNULL(c.signupNum, 0)) -- 不限名额或者报名人数未报满 AND i.CUSTOMER_ID = #{customerId} - GROUP BY i.ID ORDER BY i.ACT_QUOTA_CATEGORY DESC,i.CREATED_TIME DESC @@ -92,7 +91,7 @@ 'enough' AS actCurrentState, -- 活动状态:报名中,已报满 IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag FROM act_info i - LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' AND u.`STATUS` != 'refused' AND u.`STATUS` != 'canceled' + LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' AND u.`STATUS` != 'refused' AND u.`STATUS` != 'canceled' AND u.USER_ID = #{userId} LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND i.ACT_STATUS = 'published' @@ -100,7 +99,6 @@ AND i.ACT_QUOTA_CATEGORY = 1 -- 固定名额 AND i.ACT_QUOTA = IFNULL(c.signupNum, 0) -- 名额已满 AND i.CUSTOMER_ID = #{customerId} - GROUP BY i.ID ORDER BY i.CREATED_TIME DESC @@ -120,14 +118,13 @@ 'end_sign_up' AS actCurrentState, -- 活动状态:未开始 IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag FROM act_info i - LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' AND u.`STATUS` != 'refused' AND u.`STATUS` != 'canceled' + LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' AND u.`STATUS` != 'refused' AND u.`STATUS` != 'canceled' AND u.USER_ID = #{userId} LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' -- 活动开始时间 > 当前时间 并且 报名截止时间 < 当前时间 报名已结束,活动未开始 未开始 AND ( ]]> NOW() AND NOW() ) AND i.ACT_STATUS = 'published' AND i.CUSTOMER_ID = #{customerId} - GROUP BY i.ID ORDER BY i.CREATED_TIME DESC @@ -147,14 +144,13 @@ 'in_progress' AS actCurrentState, -- 活动状态:进行中 IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag FROM act_info i - LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' AND u.`STATUS` != 'refused' AND u.`STATUS` != 'canceled' + LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' AND u.`STATUS` != 'refused' AND u.`STATUS` != 'canceled' AND u.USER_ID = #{userId} LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` = 'passed' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' -- 活动开始时间 <= 当前时间 进行中 AND NOW() AND i.ACT_STATUS = 'published' AND i.CUSTOMER_ID = #{customerId} - GROUP BY i.ID ORDER BY i.CREATED_TIME DESC @@ -174,12 +170,11 @@ 'finished' AS actCurrentState, -- 活动状态:已结束 IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag FROM act_info i - LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' AND u.`STATUS` != 'refused' AND u.`STATUS` != 'canceled' + LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' AND u.`STATUS` != 'refused' AND u.`STATUS` != 'canceled' AND u.USER_ID = #{userId} LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` = 'passed' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND i.ACT_STATUS = 'finished' AND i.CUSTOMER_ID = #{customerId} - GROUP BY i.ID ORDER BY i.CREATED_TIME DESC LIMIT #{pageNo}, #{pageSize}