From 211c3306b36db4aa48100e977ec0ae25a7ff5404 Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 11 Aug 2020 17:57:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=A8=E3=80=81=E6=9C=88=E6=8E=92=E5=90=8D?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E7=94=A8=E6=88=B7=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E6=97=A5=E7=BB=9F=E8=AE=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/TestController.java | 13 +++-- .../dao/UserPointStatisticalDailyDao.java | 9 ++++ .../UserPointStatisticalDailyService.java | 2 + .../impl/UserPointActionLogServiceImpl.java | 1 + .../UserPointStatisticalDailyServiceImpl.java | 9 +++- .../db/migration/V0.0.2__unixKey.sql | 1 + .../mapper/UserPointStatisticalDailyDao.xml | 52 ++++++++++++++++++- 7 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.2__unixKey.sql diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/TestController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/TestController.java index 3418b3a5f3..b3cbf19d45 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/TestController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/TestController.java @@ -4,12 +4,12 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.Result; +import com.epmet.entity.UserPointStatisticalDailyEntity; +import com.epmet.service.UserPointStatisticalDailyService; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.Map; @@ -27,6 +27,8 @@ public class TestController { private Logger logger = LogManager.getLogger(TestController.class); @Autowired private LoginUserUtil loginUserUtil; + @Autowired + private UserPointStatisticalDailyService userPointStatisticalDailyService; @GetMapping("test") public Result test(@LoginUser TokenDto tokenDto){ Map map=new HashMap<>(); @@ -42,5 +44,10 @@ public class TestController { result.setData("success"); return result; } + @PostMapping("testinsert") + public Result testInsert(@RequestBody UserPointStatisticalDailyEntity entity){ + userPointStatisticalDailyService.test(entity); + return new Result(); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java index 1c3352a090..9f9783797d 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java @@ -53,4 +53,13 @@ public interface UserPointStatisticalDailyDao extends BaseDao【%s】", JSON.toJSON(event))); throw new RenException("无法识别事件类型与积分规则"); diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java index 51537b8fac..6be4ae538e 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java @@ -210,13 +210,20 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl + + + + + SELECT replace(uuid(),'-','') AS ID + + + INSERT INTO user_point_statistical_daily + ( + id, + user_id, + date_id, + week_id, + month_id, + quarter_id, + year_id, + action_flag, + customer_id, + point_change, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) VALUE ( + #{id}, + #{userId}, + #{dateId}, + #{weekId}, + #{monthId}, + #{quarterId}, + #{yearId}, + #{actionFlag}, + #{customerId}, + #{pointChange}, + '1', + 0, + #{createdBy}, + now(), + #{createdBy}, + now() + + ) ON DUPLICATE KEY UPDATE + POINT_CHANGE = (POINT_CHANGE + #{pointChange}), + UPDATED_TIME = NOW(), + UPDATED_BY = #{createdBy} + + + \ No newline at end of file