From cbda0df6d607cecac67bf93ba26af99da7bce2f5 Mon Sep 17 00:00:00 2001 From: cuibaocheng Date: Wed, 8 Sep 2021 16:57:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=95=E5=85=A5=E4=BA=86=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E6=A8=A1=E5=9D=97=20,=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BA=86=E6=B5=B7=E6=8A=A5=E5=88=86=E4=BA=AB=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cardbigdata/CardBigdataAppController.java | 201 +++++++++++++++++- .../dao/accountitem/IAccountItemDao.java | 3 + .../dao/cardcharge/ICardChargeDao.java | 2 + .../pojo/dtos/account/AccountDTO.java | 20 ++ .../dtos/accountitem/AccountItemMoneyDTO.java | 27 +++ .../pojo/vos/account/AccountVO.java | 20 ++ .../systemcard/service/UserService.java | 24 ++- .../accountitem/IAccountItemService.java | 3 + .../impl/AccountItemServiceImpl.java | 9 + .../cardcharge/ICardChargeService.java | 8 + .../impl/CardChargeServiceImpl.java | 5 + .../impl/CardTemplateServiceImpl.java | 3 + .../tenlion/systemcard/util/BaiDuUtil.java | 54 +++++ .../tenlion/systemcard/util/MapPosition.java | 194 +++++++++++++++++ .../com/tenlion/systemcard/util/PayUtil.java | 3 +- .../mybatis/mapper/account/account-mapper.xml | 14 +- .../accountitem/account-item-mapper.xml | 24 ++- .../mapper/cardcharge/card-charge-mapper.xml | 28 +++ .../resources/templates/account/list.html | 9 + 19 files changed, 641 insertions(+), 10 deletions(-) create mode 100644 src/main/java/cn/com/tenlion/systemcard/pojo/dtos/accountitem/AccountItemMoneyDTO.java create mode 100644 src/main/java/cn/com/tenlion/systemcard/util/BaiDuUtil.java create mode 100644 src/main/java/cn/com/tenlion/systemcard/util/MapPosition.java diff --git a/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardbigdata/CardBigdataAppController.java b/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardbigdata/CardBigdataAppController.java index c2dbcce..07a45ab 100644 --- a/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardbigdata/CardBigdataAppController.java +++ b/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardbigdata/CardBigdataAppController.java @@ -1,19 +1,35 @@ package cn.com.tenlion.systemcard.controller.app.api.cardbigdata; +import cn.com.tenlion.bigdata.util.BigDataResult; +import cn.com.tenlion.buildingpictures.service.picturestemplate.IPicturesTemplateService; +import cn.com.tenlion.systemcard.pojo.dtos.account.AccountDTO; +import cn.com.tenlion.systemcard.pojo.dtos.accountitem.AccountItemDTO; +import cn.com.tenlion.systemcard.pojo.dtos.accountitem.AccountItemMoneyDTO; +import cn.com.tenlion.systemcard.pojo.dtos.cardcharge.CardChargeDTO; +import cn.com.tenlion.systemcard.pojo.dtos.cardtemplate.CardTemplateAppDTO; import cn.com.tenlion.systemcard.pojo.dtos.cardviolation.CardViolationDTO; import cn.com.tenlion.systemcard.service.account.IAccountService; +import cn.com.tenlion.systemcard.service.accountitem.IAccountItemService; +import cn.com.tenlion.systemcard.service.cardcharge.ICardChargeService; +import cn.com.tenlion.systemcard.service.cardtemplate.ICardTemplateService; import cn.com.tenlion.systemcard.service.cardviolation.ICardViolationService; import ink.wgink.common.base.DefaultBaseController; import ink.wgink.interfaces.consts.ISystemConstant; +import ink.wgink.module.wechat.pojo.pos.miniapp.MiniappUserPO; +import ink.wgink.module.wechat.service.miniapp.IMiniappUserService; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.ErrorResult; import ink.wgink.pojo.result.SuccessResultList; import io.swagger.annotations.*; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -33,10 +49,175 @@ public class CardBigdataAppController extends DefaultBaseController { private IAccountService accountService; @Autowired private ICardViolationService cardViolationService; + @Autowired + private ICardTemplateService iCardTemplateService; + @Autowired + private IAccountService iAccountService; + @Autowired + private IMiniappUserService iMiniappUserService; + @Autowired + private IAccountItemService iAccountItemService; + @Autowired + private ICardChargeService iCardChargeService; - @ApiOperation(value = "名片系统违规记录表分页列表", notes = "名片系统违规记录表分页列表接口") + @ApiOperation(value = "今日缴费列表", notes = "今日缴费列表L0001") + @ApiImplicitParams({ + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "10"), + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("systemchargelist") + public BigDataResult systemChargeList() { + Map params = requestParams(); + int rows = params.get("rows") == null ? 10 : Integer.valueOf(params.get("rows").toString()); + BigDataResult result = BigDataResult.getInstance(); + Map query = new HashMap(); + List list = iCardChargeService.getToDayList(query); + List> resultList = new ArrayList>(); + int index = 0; + for(CardChargeDTO dto : list) { + if(index >= rows) { + break; + } + MiniappUserPO user = iMiniappUserService.getPO(dto.getCardChargeUserId()); + Map map = new HashMap(); + String cardChargeInvitationUserId = dto.getCardChargeInvitationUserId(); + String invitationNickName = ""; + if(!StringUtils.isEmpty(cardChargeInvitationUserId)) { + MiniappUserPO miniappUserPO = iMiniappUserService.getPO(cardChargeInvitationUserId); + if(miniappUserPO != null) { + invitationNickName = miniappUserPO.getNickName() + " 通过转发.邀请"+ user.getNickName(); + }else{ + miniappUserPO = iMiniappUserService.getPOByUserCode(cardChargeInvitationUserId); + if(miniappUserPO != null) { + invitationNickName = miniappUserPO.getNickName() + " 通过邀请码.邀请" + user.getNickName(); + } + } + } + AccountDTO accountDTO = iAccountService.get(dto.getCardChargeUserId()); + String city = ""; + if (!StringUtils.isEmpty(accountDTO.getAccountCity())) { + city = "【" + accountDTO.getAccountCity() + "】"; + } + map.put("title", user.getNickName() + city ); + map.put("content", invitationNickName + "(开通|续费)" + ("1".equals(dto.getCardChargeMode()) ? "【个人标准版】" : "2".equals(dto.getCardChargeMode()) ? "【企业标准版】" : "【企业高级版】") + "。到期时间:" + dto.getCardChargeEnd()); + map.put("date", dto.getCardChargeOrderTime()); + resultList.add(map); + index++; + } + result.setList(resultList); + return result; + } + + @ApiOperation(value = "今日收益额", notes = "今日收益额A0004") + @ApiImplicitParams({ + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "10"), + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("systemcharge") + public BigDataResult systemCharge() { + BigDataResult result = BigDataResult.getInstance(); + Map query = new HashMap(); + List list = iCardChargeService.getToDayList(query); + double totalValue = 0.00; + for(CardChargeDTO dto : list) { + if(dto.getCardChargePrice() != null) { + totalValue = totalValue + dto.getCardChargePrice(); + } + } + query.put("value", totalValue); + result.setData(query); + return result; + } + + @ApiOperation(value = "邀请新用户收益排名", notes = "邀请新用户收益排名A0010") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"), + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"), + @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listpageaccountitem") + public BigDataResult listPageAccountItem(ListPage page) { + Map params = requestParams(); + page.setParams(params); + SuccessResultList> list = iAccountItemService.listPageMoney(page); + List> resultList = new ArrayList>(); + int index = 1; + for(AccountItemMoneyDTO dto : list.getRows()) { + List contentList = new ArrayList(); + MiniappUserPO user = iMiniappUserService.getPO(dto.getAccountId()); + contentList.add(index + ""); + contentList.add(user.getUserCode()); + contentList.add(StringUtils.isEmpty(user.getNickName()) ? "用户未授权" : user.getNickName() ); + contentList.add((dto.getTotalMoney() / 100.00 ) + "RMB"); + resultList.add(contentList); + index++; + } + BigDataResult result = BigDataResult.getInstance(); + result.setList(resultList); + return result; + } + + @ApiOperation(value = "今日新用户", notes = "今日新用户接口A0012") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"), + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"), + @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listpageaccount") + public BigDataResult listPageAccount( ListPage page) { + Map params = requestParams(); + page.setParams(params); + SuccessResultList> list = iAccountService.listPage(page); + List> resultList = new ArrayList>(); + int index = 1; + for(AccountDTO dto : list.getRows()) { + Map map = new HashMap(); + String city = ""; + if (!StringUtils.isEmpty(dto.getAccountCity())) { + city = "【" + dto.getAccountCity() + "】"; + } + MiniappUserPO user = iMiniappUserService.getPO(dto.getAccountId()); + map.put("content", index + "、" + ( StringUtils.isEmpty(user.getNickName()) ? "用户未授权" : user.getNickName()) + city ); + map.put("src", user.getAvatarUrl()); + resultList.add(map); + index++; + } + BigDataResult result = BigDataResult.getInstance(); + result.setList(resultList); + return result; + } + + @ApiOperation(value = "名片使用次数统计接口", notes = "名片使用次数统计Z0004") + @ApiImplicitParams({ + @ApiImplicitParam(name = "templateMode", value = "1(名片)2(海报)", paramType = "query", dataType = "int", defaultValue = "1"), + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listpagecard") + public BigDataResult listPageCard( ListPage page) throws Exception { + Map params = requestParams(); + params.put("templateMode", params.get("templateMode") == null ? "1" : params.get("templateMode"));// 加载用途为海报 + params.put("templateStatus", "1");// 发布状态为已发布 + List list = iCardTemplateService.listToApp(null, params); + List> resultList = new ArrayList<>(); + for(CardTemplateAppDTO dto : list) { + Map map = new HashMap(); + map.put("name", dto.getPicturesTemplateCode()); + map.put("value", dto.getPicturesTemplateNumber()); + resultList.add(map); + } + BigDataResult result = BigDataResult.getInstance(); + result.setList(resultList); + return result; + } + + @ApiOperation(value = "名片系统违规记录表分页列表", notes = "名片系统违规记录表分页列表接口A0008") @ApiImplicitParams({ - @ApiImplicitParam(name = "token", value = "token", paramType = "header"), @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"), @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"), @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), @@ -45,10 +226,22 @@ public class CardBigdataAppController extends DefaultBaseController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listpageviolation") - public SuccessResultList> listPage( ListPage page) { + public BigDataResult listPageViolation( ListPage page) { Map params = requestParams(); page.setParams(params); - return cardViolationService.listPage(page); + SuccessResultList> list = cardViolationService.listPage(page); + List> resultList = new ArrayList>(); + for(CardViolationDTO dto : list.getRows()) { + Map map = new HashMap(); + map.put("title", (StringUtils.isEmpty(dto.getCardViolationUserNickName()) ? "用户未授权" : dto.getCardViolationUserNickName()) + " 发布的 " + ("1".equals(dto.getCardViolationType()) ? "名片" : "2".equals(dto.getCardViolationType()) ? "栏目" : "海报") + "内容违规" ); + map.put("content", dto.getCardViolationRemark()); + map.put("level", dto.getCardViolationLevel()); + map.put("date", dto.getGmtCreate()); + resultList.add(map); + } + BigDataResult result = BigDataResult.getInstance(); + result.setList(resultList); + return result; } } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemcard/dao/accountitem/IAccountItemDao.java b/src/main/java/cn/com/tenlion/systemcard/dao/accountitem/IAccountItemDao.java index c6dc74c..607c4a7 100644 --- a/src/main/java/cn/com/tenlion/systemcard/dao/accountitem/IAccountItemDao.java +++ b/src/main/java/cn/com/tenlion/systemcard/dao/accountitem/IAccountItemDao.java @@ -1,5 +1,6 @@ package cn.com.tenlion.systemcard.dao.accountitem; +import cn.com.tenlion.systemcard.pojo.dtos.accountitem.AccountItemMoneyDTO; import cn.com.tenlion.systemcard.pojo.dtos.accountitem.MyAccountItemDTO; import ink.wgink.exceptions.RemoveException; import ink.wgink.exceptions.SaveException; @@ -128,4 +129,6 @@ public interface IAccountItemDao { * @return */ Integer getSysMoneyTotal(Map params); + + List listPageMoney(Map params); } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemcard/dao/cardcharge/ICardChargeDao.java b/src/main/java/cn/com/tenlion/systemcard/dao/cardcharge/ICardChargeDao.java index 2e1881b..ff5c8af 100644 --- a/src/main/java/cn/com/tenlion/systemcard/dao/cardcharge/ICardChargeDao.java +++ b/src/main/java/cn/com/tenlion/systemcard/dao/cardcharge/ICardChargeDao.java @@ -126,4 +126,6 @@ public interface ICardChargeDao { CardChargeDTO getChargeByOrderNumber(String cardChargeOrderNumber); List getNotPayList(Map query) throws SearchException; + + List getToDayList(Map map) throws SearchException; } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/account/AccountDTO.java b/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/account/AccountDTO.java index 45cc261..0a4e797 100644 --- a/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/account/AccountDTO.java +++ b/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/account/AccountDTO.java @@ -46,6 +46,26 @@ public class AccountDTO { private String gmtModified; @ApiModelProperty(name = "isDelete", value = "") private Integer isDelete; + @ApiModelProperty(name = "accountIp", value = "") + private String accountIp; + @ApiModelProperty(name = "accountCity", value = "") + private String accountCity; + + public String getAccountIp() { + return accountIp == null ? "" : accountIp; + } + + public void setAccountIp(String accountIp) { + this.accountIp = accountIp; + } + + public String getAccountCity() { + return accountCity == null ? "" : accountCity; + } + + public void setAccountCity(String accountCity) { + this.accountCity = accountCity; + } public String getUserUsername() { return userUsername == null ? "" : userUsername; diff --git a/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/accountitem/AccountItemMoneyDTO.java b/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/accountitem/AccountItemMoneyDTO.java new file mode 100644 index 0000000..63233e4 --- /dev/null +++ b/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/accountitem/AccountItemMoneyDTO.java @@ -0,0 +1,27 @@ +package cn.com.tenlion.systemcard.pojo.dtos.accountitem; + +import io.swagger.annotations.ApiModelProperty; + +public class AccountItemMoneyDTO { + + @ApiModelProperty(name = "accountId", value = "账户ID") + private String accountId; + @ApiModelProperty(name = "totalMoney", value = "总金额") + private Integer totalMoney; + + public Integer getTotalMoney() { + return totalMoney; + } + + public void setTotalMoney(Integer totalMoney) { + this.totalMoney = totalMoney; + } + + public String getAccountId() { + return accountId == null ? "" : accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } +} diff --git a/src/main/java/cn/com/tenlion/systemcard/pojo/vos/account/AccountVO.java b/src/main/java/cn/com/tenlion/systemcard/pojo/vos/account/AccountVO.java index ad61f85..be21fcf 100644 --- a/src/main/java/cn/com/tenlion/systemcard/pojo/vos/account/AccountVO.java +++ b/src/main/java/cn/com/tenlion/systemcard/pojo/vos/account/AccountVO.java @@ -32,6 +32,26 @@ public class AccountVO { private String accountPassword; @ApiModelProperty(name = "accountSign", value = "账户信息") private String accountSign; + @ApiModelProperty(name = "accountIp", value = "账户登录IP") + private String accountIp; + @ApiModelProperty(name = "accountCity", value = "账户登录城市") + private String accountCity; + + public String getAccountIp() { + return accountIp == null ? "" : accountIp; + } + + public void setAccountIp(String accountIp) { + this.accountIp = accountIp; + } + + public String getAccountCity() { + return accountCity == null ? "" : accountCity; + } + + public void setAccountCity(String accountCity) { + this.accountCity = accountCity; + } public Integer getAccountMoney() { return accountMoney == null ? 0 : accountMoney; diff --git a/src/main/java/cn/com/tenlion/systemcard/service/UserService.java b/src/main/java/cn/com/tenlion/systemcard/service/UserService.java index 470b200..7b7a897 100644 --- a/src/main/java/cn/com/tenlion/systemcard/service/UserService.java +++ b/src/main/java/cn/com/tenlion/systemcard/service/UserService.java @@ -4,6 +4,8 @@ import cn.com.tenlion.systemcard.pojo.dtos.account.AccountDTO; import cn.com.tenlion.systemcard.pojo.vos.account.AccountVO; import cn.com.tenlion.systemcard.service.account.IAccountService; import cn.com.tenlion.systemcard.service.cardcharge.ICardChargeService; +import cn.com.tenlion.systemcard.util.BaiDuUtil; +import ink.wgink.common.base.DefaultBaseService; import ink.wgink.module.wechat.pojo.pay.v3.PayNoticeCiphertext; import ink.wgink.module.wechat.pojo.pos.miniapp.MiniappUserPO; import ink.wgink.module.wechat.service.miniapp.IMiniappUserCreateHandleService; @@ -13,10 +15,14 @@ import ink.wgink.service.user.pojo.pos.UserPO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; @Service @Primary -public class UserService implements IMiniappUserCreateHandleService { +public class UserService extends DefaultBaseService implements IMiniappUserCreateHandleService { @Autowired private IAccountService iAccountService; @@ -24,11 +30,25 @@ public class UserService implements IMiniappUserCreateHandleService { @Autowired private IMiniappUserService iMiniappUserService; + private String getRemortIP() throws Exception { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String ip = ""; + if (request.getHeader("x-forwarded-for") == null) { + ip = request.getRemoteAddr(); + }else{ + ip = request.getHeader("x-forwarded-for"); + } + return ip; + } + @Override public void handle(UserPO userPO, String s) throws Exception { /** * 查询是否已经创建 , 如果创建则不执行 */ + String ip = "116.113.1.245"; + String city = BaiDuUtil.getIpPosition(ip).getName(); + LOG.info(userPO.getUserId() + "、IP:" + ip + "、地址:" + city); AccountDTO accountDTO = iAccountService.get(userPO.getUserId()); MiniappUserPO miniappUserPO = iMiniappUserService.getPO(userPO.getUserId()); if(accountDTO == null) { @@ -39,6 +59,8 @@ public class UserService implements IMiniappUserCreateHandleService { accountVO.setAccountPassword(""); accountVO.setAccountStatus("1"); accountVO.setAccountUserId(userPO.getUserId()); + accountVO.setAccountCity(city); + accountVO.setAccountIp(ip); iAccountService.saveAccount(userPO.getUserId(), accountVO); } } diff --git a/src/main/java/cn/com/tenlion/systemcard/service/accountitem/IAccountItemService.java b/src/main/java/cn/com/tenlion/systemcard/service/accountitem/IAccountItemService.java index c680f07..3243a29 100644 --- a/src/main/java/cn/com/tenlion/systemcard/service/accountitem/IAccountItemService.java +++ b/src/main/java/cn/com/tenlion/systemcard/service/accountitem/IAccountItemService.java @@ -1,5 +1,6 @@ package cn.com.tenlion.systemcard.service.accountitem; +import cn.com.tenlion.systemcard.pojo.dtos.accountitem.AccountItemMoneyDTO; import cn.com.tenlion.systemcard.pojo.dtos.accountitem.MyAccountItemDTO; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.SuccessResultList; @@ -199,4 +200,6 @@ public interface IAccountItemService { AccountItemDTO getByOrderNumber(String orderNumber); Integer getSysMoneyTotal(Map params); + + SuccessResultList> listPageMoney(ListPage page); } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemcard/service/accountitem/impl/AccountItemServiceImpl.java b/src/main/java/cn/com/tenlion/systemcard/service/accountitem/impl/AccountItemServiceImpl.java index 4226737..a296654 100644 --- a/src/main/java/cn/com/tenlion/systemcard/service/accountitem/impl/AccountItemServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemcard/service/accountitem/impl/AccountItemServiceImpl.java @@ -1,5 +1,6 @@ package cn.com.tenlion.systemcard.service.accountitem.impl; +import cn.com.tenlion.systemcard.pojo.dtos.accountitem.AccountItemMoneyDTO; import cn.com.tenlion.systemcard.pojo.dtos.accountitem.MyAccountItemDTO; import cn.com.tenlion.systemcard.pojo.dtos.accountwithdraw.AccountWithdrawDTO; import ink.wgink.common.base.DefaultBaseService; @@ -200,6 +201,14 @@ public class AccountItemServiceImpl extends DefaultBaseService implements IAccou return accountItemDao.getSysMoneyTotal(params); } + @Override + public SuccessResultList> listPageMoney(ListPage page) { + PageHelper.startPage(page.getPage(), page.getRows()); + List accountItemDTOs = accountItemDao.listPageMoney(page.getParams()); + PageInfo pageInfo = new PageInfo<>(accountItemDTOs); + return new SuccessResultList<>(accountItemDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); + } + @Autowired protected SecurityComponent securityComponent; diff --git a/src/main/java/cn/com/tenlion/systemcard/service/cardcharge/ICardChargeService.java b/src/main/java/cn/com/tenlion/systemcard/service/cardcharge/ICardChargeService.java index f218816..60a5fb2 100644 --- a/src/main/java/cn/com/tenlion/systemcard/service/cardcharge/ICardChargeService.java +++ b/src/main/java/cn/com/tenlion/systemcard/service/cardcharge/ICardChargeService.java @@ -243,4 +243,12 @@ public interface ICardChargeService { * @return */ List listNotCheckOrder(Map query); + + /** + * 获取今日的充值列表 + * @param map + * @return + */ + List getToDayList(Map map); + } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemcard/service/cardcharge/impl/CardChargeServiceImpl.java b/src/main/java/cn/com/tenlion/systemcard/service/cardcharge/impl/CardChargeServiceImpl.java index 35c0579..c1074b6 100644 --- a/src/main/java/cn/com/tenlion/systemcard/service/cardcharge/impl/CardChargeServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemcard/service/cardcharge/impl/CardChargeServiceImpl.java @@ -654,4 +654,9 @@ public class CardChargeServiceImpl extends DefaultBaseService implements ICardCh return cardChargeDao.listNotCheckOrder(query); } + @Override + public List getToDayList(Map map) { + return cardChargeDao.getToDayList(map); + } + } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplate/impl/CardTemplateServiceImpl.java b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplate/impl/CardTemplateServiceImpl.java index c538db9..1fc17eb 100644 --- a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplate/impl/CardTemplateServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplate/impl/CardTemplateServiceImpl.java @@ -205,6 +205,9 @@ public class CardTemplateServiceImpl extends DefaultBaseService implements ICard private String getUserId(String token) throws Exception { String userId = "notUserId"; + if(StringUtils.isEmpty(token)) { + return userId; + } if (StringUtils.isBlank(token)) { UserInfoBO userInfoBO = securityComponent.getCurrentUser(); userId = userInfoBO.getUserId(); diff --git a/src/main/java/cn/com/tenlion/systemcard/util/BaiDuUtil.java b/src/main/java/cn/com/tenlion/systemcard/util/BaiDuUtil.java new file mode 100644 index 0000000..eeaf45c --- /dev/null +++ b/src/main/java/cn/com/tenlion/systemcard/util/BaiDuUtil.java @@ -0,0 +1,54 @@ +package cn.com.tenlion.systemcard.util; + +import com.alibaba.fastjson.JSONObject; +import org.thymeleaf.util.StringUtils; + +import java.util.HashMap; +import java.util.Map; + + +public class BaiDuUtil { + + private static String ak = "G0k574UiHH2TTg6iiAyHZk7FEXcnpIhS"; + + /** + * 通过ip获取地理位置 + * @param ip + * @return + */ + public static MapPosition getIpPosition(String ip) { + MapPosition mapPosition = new MapPosition(); + Map param = new HashMap(); + param.put("ak", ak); + param.put("coor", "bd09II"); + param.put("ip", ip); + try { + @SuppressWarnings("unchecked") + String result = HttpUtil.doGet("http://api.map.baidu.com/location/ip", param); + String resultCode = StringUtils.unescapeJava(result); + String status = JSONObject.parseObject(resultCode).getString("status"); + if("0".equals(status)) { + JSONObject jsonObject = JSONObject.parseObject(resultCode).getJSONObject("content"); + JSONObject detail = (JSONObject) jsonObject.get("address_detail"); + JSONObject point = (JSONObject) jsonObject.get("point"); + String address = jsonObject.getString("address"); + mapPosition.setDescription(address); + mapPosition.setCity(detail.getString("city")); + mapPosition.setDistrict(detail.getString("district")); + mapPosition.setProvince(detail.getString("province")); + mapPosition.setStreet(detail.getString("street")); + mapPosition.setStreetNumber(detail.getString("street_number")); + mapPosition.setLongitude(point.getDouble("x")); + mapPosition.setLatitude(point.getDouble("y")); + return mapPosition; + } + } catch (Exception e) { + } + return mapPosition; + } + + public static void main(String[] args) { + MapPosition c = getIpPosition("109.94.171.221"); + System.out.println(c); + } +} diff --git a/src/main/java/cn/com/tenlion/systemcard/util/MapPosition.java b/src/main/java/cn/com/tenlion/systemcard/util/MapPosition.java new file mode 100644 index 0000000..f38143a --- /dev/null +++ b/src/main/java/cn/com/tenlion/systemcard/util/MapPosition.java @@ -0,0 +1,194 @@ +package cn.com.tenlion.systemcard.util; + +import java.io.Serializable; +import com.github.pagehelper.util.StringUtil; + +/** + * 地图位置对象 + * ClassName: MapPosition + * @Description: TODO + * 创建工具: MyEclipse2014 + * 运行环境: [Tomcat7以上,MySql5.6以上,JDK7以上] + * @author 崔宝铖 + * @date 2019年6月19日 + */ +public class MapPosition implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 速度 时/公里 + */ + public Double speed; + + /** + * 记录时间 + */ + public String createTime; + + /** + * 经度 + */ + public Double longitude; + + /** + * 纬度 + */ + public Double latitude; + + /** + * 位置名称(国-省-市-县-街-号) + */ + private String name; + + /** + * 位置详细描述 + */ + private String description; + + /** + * 国家 + */ + private String country; + + /** + * 省 + */ + private String province; + + /** + * 市 + */ + private String city; + + /** + * 县 + */ + private String district; + + /** + * 街道 + */ + private String street; + + /** + * 街道编号 + */ + private String streetNumber; + + public Double getSpeed() { + return speed; + } + + public void setSpeed(Double speed) { + this.speed = speed; + } + + public String getCreateTime() { + return createTime; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public MapPosition() { + super(); + } + + public MapPosition(Double longitude, Double latitude) { + super(); + this.longitude = longitude; + this.latitude = latitude; + } + + public MapPosition(Double longitude, Double latitude, String createTime) { + super(); + this.createTime = createTime; + this.longitude = longitude; + this.latitude = latitude; + } + + public String getCountry() { + return country; + } + + public String getProvince() { + return province; + } + + public String getCity() { + return city; + } + + public String getDistrict() { + return district; + } + + public String getStreet() { + return street; + } + + public String getStreetNumber() { + return streetNumber; + } + + public void setCountry(String country) { + this.country = country; + } + + public void setProvince(String province) { + this.province = province; + } + + public void setCity(String city) { + this.city = city; + } + + public void setDistrict(String district) { + this.district = district; + } + + public void setStreet(String street) { + this.street = street; + } + + public void setStreetNumber(String streetNumber) { + this.streetNumber = streetNumber; + } + + public String getName() { + return (StringUtil.isEmpty(province) ? "" : (province)) + (StringUtil.isEmpty(city) ? "" : ("-" + city)) + (StringUtil.isEmpty(district) ? "" : ("-" + district)) + (StringUtil.isEmpty(street) ? "" : ("-" + street)) + (StringUtil.isEmpty(streetNumber) ? "" : ("-" + streetNumber)); + } + + public Double getLongitude() { + return longitude; + } + + public Double getLatitude() { + return latitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + @Override + public String toString() { + return "MapPosition [createTime=" + + createTime + ", longitude=" + longitude + ", latitude=" + + latitude + ", name=" + name + ", description=" + description + + ", country=" + country + ", province=" + province + ", city=" + + city + ", district=" + district + ", street=" + street + + ", streetNumber=" + streetNumber + "]"; + } + +} diff --git a/src/main/java/cn/com/tenlion/systemcard/util/PayUtil.java b/src/main/java/cn/com/tenlion/systemcard/util/PayUtil.java index 1a2ad19..9fb2e2d 100644 --- a/src/main/java/cn/com/tenlion/systemcard/util/PayUtil.java +++ b/src/main/java/cn/com/tenlion/systemcard/util/PayUtil.java @@ -19,6 +19,7 @@ public class PayUtil { } public static void main(String[] args) { - System.out.println("逯"); + String ip = "116.113.1.245"; + System.out.println(BaiDuUtil.getIpPosition(ip).getName()); } } diff --git a/src/main/resources/mybatis/mapper/account/account-mapper.xml b/src/main/resources/mybatis/mapper/account/account-mapper.xml index d527f39..a14418f 100644 --- a/src/main/resources/mybatis/mapper/account/account-mapper.xml +++ b/src/main/resources/mybatis/mapper/account/account-mapper.xml @@ -12,6 +12,8 @@ + + @@ -82,6 +84,8 @@ account_status, account_password, account_sign, + account_ip, + account_city, creator, gmt_create, modifier, @@ -96,6 +100,8 @@ #{accountStatus}, #{accountPassword}, #{accountSign}, + #{accountIp}, + #{accountCity}, #{creator}, #{gmtCreate}, #{modifier}, @@ -174,7 +180,9 @@ t1.account_password, t1.account_sign, t1.account_id, - t1.gmt_create + t1.gmt_create, + t1.account_ip, + t1.account_city FROM e_account t1 WHERE @@ -253,7 +261,9 @@ t1.modifier, t1.gmt_modified, t1.is_delete, - t2.user_username + t2.user_username, + t1.account_ip, + t1.account_city FROM e_account t1 LEFT JOIN diff --git a/src/main/resources/mybatis/mapper/accountitem/account-item-mapper.xml b/src/main/resources/mybatis/mapper/accountitem/account-item-mapper.xml index 42ff742..8d41f6e 100644 --- a/src/main/resources/mybatis/mapper/accountitem/account-item-mapper.xml +++ b/src/main/resources/mybatis/mapper/accountitem/account-item-mapper.xml @@ -29,6 +29,11 @@ + + + + + @@ -97,6 +102,21 @@ + + + @@ -124,7 +144,7 @@ FROM e_account_item t1 WHERE - t1.is_delete = 0 AND t1.account_item_mode = '1' AND t1.account_item_type = '邀请收益' AND t1.account_id = #{userId} + t1.is_delete = 0 AND t1.account_item_mode = '1' AND (t1.account_item_type = '邀请使用名片服务收益' OR t1.account_item_type = '邀请续费名片服务收益') AND t1.account_id = #{userId} AND DATE_FORMAT(t1.gmt_create, '%Y%m' ) = DATE_FORMAT( CURDATE() ,'%Y%m' ) diff --git a/src/main/resources/mybatis/mapper/cardcharge/card-charge-mapper.xml b/src/main/resources/mybatis/mapper/cardcharge/card-charge-mapper.xml index d12c709..1aa57c7 100644 --- a/src/main/resources/mybatis/mapper/cardcharge/card-charge-mapper.xml +++ b/src/main/resources/mybatis/mapper/cardcharge/card-charge-mapper.xml @@ -59,6 +59,34 @@ + + +