From 1b8d15a0457d70d334bf10bde863136fe36e4dfb Mon Sep 17 00:00:00 2001 From: YUANYE <418471657@qq.com> Date: Wed, 22 Sep 2021 16:35:41 +0800 Subject: [PATCH 1/2] 1 --- .../main/java/com/bweb/config/AuthConfig.java | 1 + .../controller/HighGoldRecController.java | 29 +++++++++++++++++-- .../com/hai/dao/HighGoldRecMapperExt.java | 20 ++++++++++++- .../java/com/hai/model/HighGoldRecModel.java | 23 +++++++++++++++ .../com/hai/service/HighGoldRecService.java | 10 +++++++ .../service/impl/HighGoldRecServiceImpl.java | 11 +++++++ 6 files changed, 90 insertions(+), 4 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/config/AuthConfig.java b/hai-bweb/src/main/java/com/bweb/config/AuthConfig.java index 3e876b46..b359904b 100644 --- a/hai-bweb/src/main/java/com/bweb/config/AuthConfig.java +++ b/hai-bweb/src/main/java/com/bweb/config/AuthConfig.java @@ -96,6 +96,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/telApi/*") .excludePathPatterns("/coupon/getGuizhouSinopec") .excludePathPatterns("/cmsContent/get*") + .excludePathPatterns("/highGoldRec/*") ; } diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGoldRecController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGoldRecController.java index 7964a4d3..9b8fe55a 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighGoldRecController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGoldRecController.java @@ -36,9 +36,6 @@ public class HighGoldRecController { private static Logger log = LoggerFactory.getLogger(HighGoldRecController.class); - @Autowired - private UserCenter userCenter; - @Resource private HighGoldRecService highGoldRecService; @@ -47,12 +44,16 @@ public class HighGoldRecController { @ApiOperation(value = "获取金币情况") public ResponseData getGoldRecList(@RequestParam(name = "goldType", required = false) Integer goldType, @RequestParam(name = "resType", required = false) Integer resType, + @RequestParam(name = "createTimeS", required = false) String createTimeS, + @RequestParam(name = "createTimeE", required = false) String createTimeE, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize) { try { Map map = new HashMap<>(); map.put("goldType", goldType); map.put("resType", resType); + map.put("createTimeS", createTimeS); + map.put("createTimeE", createTimeE); PageHelper.startPage(pageNum,pageSize); return ResponseMsgUtil.success(new PageInfo<>(highGoldRecService.getGoldRec(map))); @@ -63,4 +64,26 @@ public class HighGoldRecController { } } + @RequestMapping(value="/queryGold",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取金币统计") + public ResponseData queryGold(@RequestParam(name = "goldType", required = false) Integer goldType, + @RequestParam(name = "resType", required = false) Integer resType, + @RequestParam(name = "createTimeS", required = false) String createTimeS, + @RequestParam(name = "createTimeE", required = false) String createTimeE) { + try { + Map map = new HashMap<>(); + map.put("goldType", goldType); + map.put("resType", resType); + map.put("createTimeS", createTimeS); + map.put("createTimeE", createTimeE); + + return ResponseMsgUtil.success(highGoldRecService.queryGold(map)); + + } catch (Exception e) { + log.error("HighCouponController -> getCouponList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-service/src/main/java/com/hai/dao/HighGoldRecMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighGoldRecMapperExt.java index 059fbea1..c537735f 100644 --- a/hai-service/src/main/java/com/hai/dao/HighGoldRecMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighGoldRecMapperExt.java @@ -1,7 +1,25 @@ package com.hai.dao; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; +import java.util.Map; + /** * mapper扩展类 */ public interface HighGoldRecMapperExt { -} \ No newline at end of file + @Select({""}) + // 查询申请记录 + List> queryGold(@Param("map") Map map); +} diff --git a/hai-service/src/main/java/com/hai/model/HighGoldRecModel.java b/hai-service/src/main/java/com/hai/model/HighGoldRecModel.java index 8dc82c06..dd52523d 100644 --- a/hai-service/src/main/java/com/hai/model/HighGoldRecModel.java +++ b/hai-service/src/main/java/com/hai/model/HighGoldRecModel.java @@ -6,6 +6,12 @@ public class HighGoldRecModel { private HighUser highUser; + // 收入 + private Long income; + + // 支出 + private Long expend; + public HighUser getHighUser() { return highUser; } @@ -13,4 +19,21 @@ public class HighGoldRecModel { public void setHighUser(HighUser highUser) { this.highUser = highUser; } + + + public Long getIncome() { + return income; + } + + public void setIncome(Long income) { + this.income = income; + } + + public Long getExpend() { + return expend; + } + + public void setExpend(Long expend) { + this.expend = expend; + } } diff --git a/hai-service/src/main/java/com/hai/service/HighGoldRecService.java b/hai-service/src/main/java/com/hai/service/HighGoldRecService.java index ae4369b7..a00fb801 100644 --- a/hai-service/src/main/java/com/hai/service/HighGoldRecService.java +++ b/hai-service/src/main/java/com/hai/service/HighGoldRecService.java @@ -26,4 +26,14 @@ public interface HighGoldRecService { * @Date 2021/3/27 10:03 **/ List getGoldRec(Map map); + + /** + * @Author Sum1Dream + * @name queryGold.java + * @Description // 查询金币使用统计 + * @Date 15:28 2021/9/22 + * @Param [map] + * @return java.util.Map + **/ + List > queryGold(Map map); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGoldRecServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGoldRecServiceImpl.java index bfe843a6..f2644c76 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGoldRecServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGoldRecServiceImpl.java @@ -1,5 +1,6 @@ package com.hai.service.impl; +import com.hai.common.utils.DateUtil; import com.hai.dao.HighGoldRecMapper; import com.hai.entity.HighGoldRec; import com.hai.entity.HighGoldRecExample; @@ -36,6 +37,7 @@ public class HighGoldRecServiceImpl implements HighGoldRecService { HighGoldRecExample example = new HighGoldRecExample(); HighGoldRecExample.Criteria criteria = example.createCriteria(); + if (MapUtils.getLong(map, "userId") != null) { criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId")); } @@ -48,6 +50,10 @@ public class HighGoldRecServiceImpl implements HighGoldRecService { criteria.andResTypeEqualTo(MapUtils.getInteger(map, "resType")); } + if (MapUtils.getString(map, "createTimeS") != null) { + criteria.andCreateTimeBetween(DateUtil.format("yyyy-MM-dd" , MapUtils.getString(map, "createTimeS")) , DateUtil.format("yyyy-MM-dd" , MapUtils.getString(map, "createTimE"))); + } + example.setOrderByClause("create_time desc"); List list = highGoldRecMapper.selectByExample(example); for (HighGoldRec highGoldRec : list) { @@ -55,4 +61,9 @@ public class HighGoldRecServiceImpl implements HighGoldRecService { } return list; } + + @Override + public List> queryGold(Map map) { + return highGoldRecMapper.queryGold(map); + } } From 5ebec0977ec295d8d7230ea6b9ce831042d69c57 Mon Sep 17 00:00:00 2001 From: YUANYE <418471657@qq.com> Date: Fri, 24 Sep 2021 09:43:51 +0800 Subject: [PATCH 2/2] 1 --- .../controller/HighGoldRecController.java | 23 +++++++++++-------- .../service/impl/HighGoldRecServiceImpl.java | 5 +--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGoldRecController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGoldRecController.java index 3acd4a26..c3b07bad 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighGoldRecController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGoldRecController.java @@ -3,6 +3,7 @@ package com.bweb.controller; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.hai.common.security.UserCenter; +import com.hai.common.utils.DateUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.model.ResponseData; import com.hai.service.HighGoldRecService; @@ -41,16 +42,19 @@ public class HighGoldRecController { @ApiOperation(value = "获取金币情况") public ResponseData getGoldRecList(@RequestParam(name = "goldType", required = false) Integer goldType, @RequestParam(name = "resType", required = false) Integer resType, - @RequestParam(name = "createTimeS", required = false) String createTimeS, - @RequestParam(name = "createTimeE", required = false) String createTimeE, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize) { try { Map map = new HashMap<>(); map.put("goldType", goldType); map.put("resType", resType); - map.put("createTimeS", createTimeS); - map.put("createTimeE", createTimeE); + + if (createTimeS != null) { + map.put("createTimeS", DateUtil.long2Date(createTimeS)); + map.put("createTimeE", DateUtil.long2Date(createTimeE)); + } PageHelper.startPage(pageNum,pageSize); return ResponseMsgUtil.success(new PageInfo<>(highGoldRecService.getGoldRec(map))); @@ -66,15 +70,16 @@ public class HighGoldRecController { @ApiOperation(value = "获取金币统计") public ResponseData queryGold(@RequestParam(name = "goldType", required = false) Integer goldType, @RequestParam(name = "resType", required = false) Integer resType, - @RequestParam(name = "createTimeS", required = false) String createTimeS, - @RequestParam(name = "createTimeE", required = false) String createTimeE) { + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE) { try { Map map = new HashMap<>(); map.put("goldType", goldType); map.put("resType", resType); - map.put("createTimeS", createTimeS); - map.put("createTimeE", createTimeE); - + if (createTimeS != null) { + map.put("createTimeS", DateUtil.long2Date(createTimeS)); + map.put("createTimeE", DateUtil.long2Date(createTimeE)); + } return ResponseMsgUtil.success(highGoldRecService.queryGold(map)); } catch (Exception e) { diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGoldRecServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGoldRecServiceImpl.java index f2644c76..558c7c21 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGoldRecServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGoldRecServiceImpl.java @@ -50,10 +50,6 @@ public class HighGoldRecServiceImpl implements HighGoldRecService { criteria.andResTypeEqualTo(MapUtils.getInteger(map, "resType")); } - if (MapUtils.getString(map, "createTimeS") != null) { - criteria.andCreateTimeBetween(DateUtil.format("yyyy-MM-dd" , MapUtils.getString(map, "createTimeS")) , DateUtil.format("yyyy-MM-dd" , MapUtils.getString(map, "createTimE"))); - } - example.setOrderByClause("create_time desc"); List list = highGoldRecMapper.selectByExample(example); for (HighGoldRec highGoldRec : list) { @@ -64,6 +60,7 @@ public class HighGoldRecServiceImpl implements HighGoldRecService { @Override public List> queryGold(Map map) { + return highGoldRecMapper.queryGold(map); } }