Browse Source

Merge remote-tracking branch 'origin/dev_heart' into dev_heart

master
wangchao 5 years ago
parent
commit
07b5ba8136
  1. 33
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/UserKindnessTimeLogDao.java
  2. 56
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/UserKindnessTimeLogEntity.java
  3. 12
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  4. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql
  5. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml
  6. 20
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/UserKindnessTimeLogDao.xml
  7. 2
      epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml
  8. 2
      epmet-module/epmet-point/epmet-point-server/pom.xml

33
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
* <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.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<UserKindnessTimeLogEntity> {
}

56
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
* <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-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;
}

12
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);
}
}
}

14
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='用户爱心时长记录表';

15
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 <![CDATA[ DATE_FORMAT(i.SIGN_UP_END_TIME,'%Y-%m-%d %H:%i:%s') >= ]]> 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
</select>
@ -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
</select>
@ -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'
-- 活动开始时间 > 当前时间 并且 报名截止时间 &lt; 当前时间 报名已结束,活动未开始 未开始
AND ( <![CDATA[ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i:%s') > ]]> NOW() AND <![CDATA[ DATE_FORMAT(i.SIGN_UP_END_TIME,'%Y-%m-%d %H:%i:%s') < ]]> NOW() )
AND i.ACT_STATUS = 'published'
AND i.CUSTOMER_ID = #{customerId}
GROUP BY i.ID
ORDER BY i.CREATED_TIME DESC
</select>
@ -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'
-- 活动开始时间 &lt;= 当前时间 进行中
AND <![CDATA[ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i:%s') <= ]]> NOW()
AND i.ACT_STATUS = 'published'
AND i.CUSTOMER_ID = #{customerId}
GROUP BY i.ID
ORDER BY i.CREATED_TIME DESC
</select>
@ -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}
</select>

20
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/UserKindnessTimeLogDao.xml

@ -0,0 +1,20 @@
<?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.UserKindnessTimeLogDao">
<resultMap type="com.epmet.entity.UserKindnessTimeLogEntity" id="userKindnessTimeLogMap">
<result property="id" column="ID"/>
<result property="actId" column="ACT_ID"/>
<result property="resiUserId" column="RESI_USER_ID"/>
<result property="kindnessTime" column="KINDNESS_TIME"/>
<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>
</mapper>

2
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 # 使用现有网络

2
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">
<modelVersion>4.0.0</modelVersion>
<version>0.0.13</version>
<version>0.0.14</version>
<parent>
<artifactId>epmet-point</artifactId>
<groupId>com.epmet</groupId>

Loading…
Cancel
Save