diff --git a/src/main/java/cn/com/tenlion/operator/controller/app/api/account/AccountAppController.java b/src/main/java/cn/com/tenlion/operator/controller/app/api/account/AccountAppController.java index 177e804..b4dd27d 100644 --- a/src/main/java/cn/com/tenlion/operator/controller/app/api/account/AccountAppController.java +++ b/src/main/java/cn/com/tenlion/operator/controller/app/api/account/AccountAppController.java @@ -3,6 +3,7 @@ package cn.com.tenlion.operator.controller.app.api.account; import ink.wgink.annotation.CheckRequestBodyAnnotation; import ink.wgink.common.base.DefaultBaseController; import ink.wgink.interfaces.consts.ISystemConstant; +import ink.wgink.module.dictionary.service.IDataService; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.ErrorResult; import ink.wgink.pojo.result.SuccessResult; @@ -34,6 +35,7 @@ public class AccountAppController extends DefaultBaseController { @Autowired private IAccountService accountService; + // @ApiOperation(value = "新增客户账户", notes = "新增客户账户接口") // @ApiImplicitParams({ // @ApiImplicitParam(name = "token", value = "token", paramType = "header") diff --git a/src/main/java/cn/com/tenlion/operator/controller/app/api/systemuser/SystemUserAppController.java b/src/main/java/cn/com/tenlion/operator/controller/app/api/systemuser/SystemUserAppController.java index 0b9bbdc..5149809 100644 --- a/src/main/java/cn/com/tenlion/operator/controller/app/api/systemuser/SystemUserAppController.java +++ b/src/main/java/cn/com/tenlion/operator/controller/app/api/systemuser/SystemUserAppController.java @@ -9,17 +9,18 @@ import ink.wgink.annotation.CheckRequestBodyAnnotation; import ink.wgink.common.base.DefaultBaseController; import ink.wgink.exceptions.SearchException; import ink.wgink.interfaces.consts.ISystemConstant; +import ink.wgink.module.dictionary.pojo.dtos.DataDTO; +import ink.wgink.module.dictionary.service.IDataService; import ink.wgink.pojo.dtos.user.UserDTO; import ink.wgink.pojo.result.ErrorResult; import ink.wgink.pojo.result.SuccessResult; import ink.wgink.pojo.result.SuccessResultData; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.xml.crypto.Data; + /** * @ClassName: SystemUserlController * @Description: 系统用户 @@ -41,6 +42,20 @@ public class SystemUserAppController extends DefaultBaseController { @Autowired private UserUtil userUtil; + + @Autowired + private IDataService iDataService; + + /** + * 数据字典 + * @param dataId + * @return + */ + @GetMapping("get" + ISystemConstant.RELEASE_SUFFIX + "/{dataId}") + public DataDTO get(@PathVariable("dataId") String dataId) { + return iDataService.get(dataId); + } + /** * 获取登录跳转地址 * @return diff --git a/src/main/java/cn/com/tenlion/operator/controller/resource/accountitem/AccountItemResourceController.java b/src/main/java/cn/com/tenlion/operator/controller/resource/accountitem/AccountItemResourceController.java index 5824790..af147cb 100644 --- a/src/main/java/cn/com/tenlion/operator/controller/resource/accountitem/AccountItemResourceController.java +++ b/src/main/java/cn/com/tenlion/operator/controller/resource/accountitem/AccountItemResourceController.java @@ -47,6 +47,41 @@ public class AccountItemResourceController extends DefaultBaseController { @Autowired protected SecurityComponent securityComponent; + @ApiOperation(value = "代理商订单完成", notes = "代理商订单完成接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PostMapping("pay-in-shop") + @CheckRequestBodyAnnotation + public SuccessResult payInShop(@RequestBody AccountItemOrderVO accountItemOrderVO) throws Exception { + String code = EncryptUtil.decode(accountItemOrderVO.getCode()); + JSONObject jsonObject = JSONObject.parseObject(code); + String time = jsonObject.getString("time"); + Integer money = jsonObject.getInteger("money"); + String userId = jsonObject.getString("userId"); + String orderId = jsonObject.getString("orderId"); + Date dateTime = sdf.parse(time); + long diffInMillis = Math.abs(System.currentTimeMillis() - dateTime.getTime()); + int secondsDiff = (int)(diffInMillis / 1000); + if (secondsDiff > 30) { + throw new SaveException("鉴权失败"); + } + if (!money.equals(accountItemOrderVO.getAccountMoney()) || !userId.equals(accountItemOrderVO.getUserId()) || !orderId.equals(accountItemOrderVO.getOrderId())) { + throw new SaveException("鉴权失败"); + } + AccountItemVO accountItemVO = new AccountItemVO(); + accountItemVO.setMode(1); // 入账 + accountItemVO.setType(5); // 收入类型 订单收入 + accountItemVO.setAccountId(accountItemOrderVO.getUserId()); + accountItemVO.setAccountMoney(accountItemOrderVO.getAccountMoney()); + accountItemVO.setDescription(accountItemOrderVO.getDescription()); + accountItemVO.setOrderId(accountItemOrderVO.getOrderId()); + accountItemVO.setOrderType("shop"); + accountItemService.saveShopReturnId( accountItemVO); + return new SuccessResult(); + } + @ApiOperation(value = "代理商订单完成", notes = "代理商订单完成接口") @ApiImplicitParams({ @ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query") diff --git a/src/main/java/cn/com/tenlion/operator/pojo/vos/accountitem/AccountItemVO.java b/src/main/java/cn/com/tenlion/operator/pojo/vos/accountitem/AccountItemVO.java index a5ae0d1..d2e26f5 100644 --- a/src/main/java/cn/com/tenlion/operator/pojo/vos/accountitem/AccountItemVO.java +++ b/src/main/java/cn/com/tenlion/operator/pojo/vos/accountitem/AccountItemVO.java @@ -30,8 +30,8 @@ public class AccountItemVO { @ApiModelProperty(name = "mode", value = "方式1:入账,2:出账") @CheckNumberAnnotation(name = "方式1:入账,2:出账") private Integer mode; - @ApiModelProperty(name = "type", value = "流水类型(充值1|支出2|提现3|系统扣款4)") - @CheckNumberAnnotation(name = "流水类型(充值1|支出2|提现3|系统扣款4)") + @ApiModelProperty(name = "type", value = "流水类型(充值1|支出2|提现3|系统扣款4|入账5)") + @CheckNumberAnnotation(name = "流水类型(充值1|支出2|提现3|系统扣款4|入账5)") private Integer type; @ApiModelProperty(name = "description", value = "流水描述") private String description; diff --git a/src/main/java/cn/com/tenlion/operator/service/accountitem/IAccountItemService.java b/src/main/java/cn/com/tenlion/operator/service/accountitem/IAccountItemService.java index 0b47c6d..42ab2e2 100644 --- a/src/main/java/cn/com/tenlion/operator/service/accountitem/IAccountItemService.java +++ b/src/main/java/cn/com/tenlion/operator/service/accountitem/IAccountItemService.java @@ -28,6 +28,8 @@ public interface IAccountItemService { */ String saveItemInReturnId(AccountItemOrderVO accountItemOrderVO, String orderType); + void saveShopReturnId(AccountItemVO accountItemVO); + /** * 保存账户减钱流水 , 如果没有跟order关联 , 无需传入orderId 和 orderType * @param accountItemOrderVO diff --git a/src/main/java/cn/com/tenlion/operator/service/accountitem/impl/AccountItemServiceImpl.java b/src/main/java/cn/com/tenlion/operator/service/accountitem/impl/AccountItemServiceImpl.java index 158cfa3..b1a5652 100644 --- a/src/main/java/cn/com/tenlion/operator/service/accountitem/impl/AccountItemServiceImpl.java +++ b/src/main/java/cn/com/tenlion/operator/service/accountitem/impl/AccountItemServiceImpl.java @@ -279,6 +279,25 @@ public class AccountItemServiceImpl extends DefaultBaseService implements IAccou saveReturnId(accountItemVO1); } + @Override + public void saveShopReturnId(AccountItemVO accountItemVO) { + Map params = super.getHashMap(2); + params.put("orderId", accountItemVO.getOrderId()); + List list = list(params); + for(AccountItemDTO dto : list) { + if(dto.getType().equals("2")) { + if (accountItemVO.getAccountMoney() >= dto.getAccountMoney()) { + throw new SaveException("金额错误"); + } + } + if (dto.getType().equals("5")) { + throw new SaveException("请勿重复操作"); + } + } + accountItemVO.setType(5); + saveReturnId(accountItemVO); + } + @Override public SuccessResultList> listPageBO(ListPage page) { PageHelper.startPage(page.getPage(), page.getRows()); diff --git a/src/main/java/cn/com/tenlion/operator/util/EncryptUtil.java b/src/main/java/cn/com/tenlion/operator/util/EncryptUtil.java index 278cec5..9b022e8 100644 --- a/src/main/java/cn/com/tenlion/operator/util/EncryptUtil.java +++ b/src/main/java/cn/com/tenlion/operator/util/EncryptUtil.java @@ -1,6 +1,7 @@ package cn.com.tenlion.operator.util; import com.alibaba.fastjson.JSONObject; +import ink.wgink.module.sms.factory.sms.SmsSendFactory; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.IOUtils; import javax.crypto.Cipher; 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 bdc499a..0d2f0ea 100644 --- a/src/main/resources/mybatis/mapper/accountitem/account-item-mapper.xml +++ b/src/main/resources/mybatis/mapper/accountitem/account-item-mapper.xml @@ -201,6 +201,12 @@ operator_account_item t1 WHERE t1.account_id = #{accountId} + + AND t1.type = #{type} + + + AND t1.order_id = #{orderId} + AND (