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