From 7bad1a49ff295fb7f2a44c859d7f3b5c9dd6d20f Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Tue, 26 May 2020 18:22:36 +0800 Subject: [PATCH] 20200526 代码提交 --- src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java | 5 src/main/java/com/xcong/excoin/modules/coin/parameter/dto/SubmitSalesWalletCoinOrderDto.java | 2 src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java | 3 src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java | 7 + src/test/java/com/xcong/excoin/mapper/MapStructMapper.java | 191 +++++++++++++++++++++++++---------------------- src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinMapper.java | 2 src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAccountMoneyChangeInfoVo.java | 7 + src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java | 4 src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml | 4 9 files changed, 128 insertions(+), 97 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java b/src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java index e0b3804..62de78e 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java +++ b/src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java @@ -139,8 +139,11 @@ */ @ApiOperation(value = "币币是否自选", notes = "币币是否自选") @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberSelectSymbolsVo.class)}) - @PostMapping(value="/checkIsCollect") - public Result checkIsCollect(@ApiParam(name="symbol",value="币种",required=true)String symbol) { + @ApiImplicitParams({ + @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query") + }) + @GetMapping(value = "/checkIsCollect") + public Result checkIsCollect(String symbol) { return orderCoinService.checkIsCollect(symbol); } diff --git a/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java b/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java index c9a3155..5844ba7 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java +++ b/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java @@ -1,14 +1,16 @@ package com.xcong.excoin.modules.coin.mapper; +import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity; import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealVo; +@Mapper public abstract class OrderWalletCoinDealMapper { public static final OrderWalletCoinDealMapper INSTANCE = Mappers.getMapper(OrderWalletCoinDealMapper.class); - public abstract OrderWalletCoinDealVo entityToVo(OrderCoinsDealEntity orderCoinsDealEntity); + public abstract OrderWalletCoinDealVo entityToVoOrder(OrderCoinsDealEntity orderCoinsDealEntity); } diff --git a/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinMapper.java b/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinMapper.java index c4a006e..742896f 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinMapper.java +++ b/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinMapper.java @@ -1,10 +1,12 @@ package com.xcong.excoin.modules.coin.mapper; +import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity; import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinVo; +@Mapper public abstract class OrderWalletCoinMapper { public static final OrderWalletCoinMapper INSTANCE = Mappers.getMapper(OrderWalletCoinMapper.class); diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/SubmitSalesWalletCoinOrderDto.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/SubmitSalesWalletCoinOrderDto.java index b8b0ac1..72d4b67 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/SubmitSalesWalletCoinOrderDto.java +++ b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/SubmitSalesWalletCoinOrderDto.java @@ -16,7 +16,7 @@ private String symbol; @NotNull(message = "交易类型不能为空") - @ApiModelProperty(value = "买入卖出类型买入:1,卖出:2", example = "USDT") + @ApiModelProperty(value = "买入卖出类型买入:1,卖出:2", example = "1") private Integer type; @NotNull(message = "交易方式不能为空") diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAccountMoneyChangeInfoVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAccountMoneyChangeInfoVo.java index 67e7b67..a60edeb 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAccountMoneyChangeInfoVo.java +++ b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAccountMoneyChangeInfoVo.java @@ -1,6 +1,9 @@ package com.xcong.excoin.modules.coin.parameter.vo; import java.math.BigDecimal; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -35,5 +38,9 @@ */ @ApiModelProperty(value = "状态【0:待审核 1:成功2:失败】") private int status; + + @ApiModelProperty(value = "时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date updateTime; } diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java index a5615d3..89e583b 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java @@ -349,6 +349,7 @@ memberAccountMoneyChangeInfoVo.setStatus(memberAccountMoneyChange.getStatus()); memberAccountMoneyChangeInfoVo.setSymbol(memberAccountMoneyChange.getSymbol()); memberAccountMoneyChangeInfoVo.setType(memberAccountMoneyChange.getType()); + memberAccountMoneyChangeInfoVo.setUpdateTime(memberAccountMoneyChange.getUpdateTime()); arrayList.add(memberAccountMoneyChangeInfoVo); } } @@ -371,6 +372,7 @@ memberAccountMoneyChangeInfoVo.setStatus(memberAccountMoneyChange.getStatus()); memberAccountMoneyChangeInfoVo.setSymbol(memberAccountMoneyChange.getSymbol()); memberAccountMoneyChangeInfoVo.setType(memberAccountMoneyChange.getType()); + memberAccountMoneyChangeInfoVo.setUpdateTime(memberAccountMoneyChange.getUpdateTime()); arrayList.add(memberAccountMoneyChangeInfoVo); } } @@ -395,6 +397,7 @@ memberAccountMoneyChangeInfoVo.setStatus(memberAccountMoneyChange.getStatus()); memberAccountMoneyChangeInfoVo.setSymbol(memberAccountMoneyChange.getSymbol()); memberAccountMoneyChangeInfoVo.setType(memberAccountMoneyChange.getType()); + memberAccountMoneyChangeInfoVo.setUpdateTime(memberAccountMoneyChange.getUpdateTime()); arrayList.add(memberAccountMoneyChangeInfoVo); } } diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java index eed4b40..bcee12b 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java @@ -397,7 +397,7 @@ List<OrderCoinsDealEntity> selectAllWalletCoinOrder = orderCoinDealDao.selectAllWalletCoinOrder(memberId); if(CollUtil.isNotEmpty(selectAllWalletCoinOrder)) { for(OrderCoinsDealEntity orderCoinsDealEntity: selectAllWalletCoinOrder) { - OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVo(orderCoinsDealEntity); + OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVoOrder(orderCoinsDealEntity); arrayList.add(entityToVo); } } @@ -410,7 +410,7 @@ //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); OrderCoinsDealEntity selectWalletCoinOrder = orderCoinDealDao.selectWalletCoinOrder(orderId,memberId); - OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVo(selectWalletCoinOrder); + OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVoOrder(selectWalletCoinOrder); return Result.ok(entityToVo); } @@ -428,6 +428,7 @@ }else { Map<String, Object> columnMap = new HashMap<>(); columnMap.put("symbol", symbol); + columnMap.put("member_id", memberId); memberSelectSymbolsDao.deleteByMap(columnMap);; return Result.ok(MessageSourceUtils.getString("order_service_0016")); } diff --git a/src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml b/src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml index 5e132d8..14705e8 100644 --- a/src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml +++ b/src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml @@ -6,14 +6,14 @@ select * from coins_order_deal <where> <if test="memberId != null and memberId != ''"> - and memberid = #{memberId} + and member_id = #{memberId} </if> </where> order by id desc </select> <select id="selectWalletCoinOrder" resultType="com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity"> - select * from coins_order_deal where order_id= #{orderId} and memberid = #{memberId} + select * from coins_order_deal where order_id= #{orderId} and member_id = #{memberId} </select> </mapper> diff --git a/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java b/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java index 97436ae..08beda8 100644 --- a/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java +++ b/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java @@ -1,89 +1,102 @@ -package com.xcong.excoin.mapper; - -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * @author wzy - * @date 2020-05-05 10:59 - **/ -@Slf4j -@SpringBootTest -public class MapStructMapper { - - - @Test - public void mapperConvert() { - Car car = new Car(); - car.setColor("123"); - car.setName("321"); - car.setCreateTime(new Date()); - CarDto carDto = CarMapper.INSTANCE.carToCarDto(car); - log.info(carDto.toString()); - } - - @Test - public void carDtoToCarConvert() { - CarDto carDto = new CarDto(); - carDto.setName("dddd"); - carDto.setColor("aaaa"); - carDto.setCreateTime("2020-12-12 12:22:22"); - Car car = CarMapper.INSTANCE.carDtoToCar(carDto); - log.info(car.toString()); - } - - @Test - public void carToCarEntity() { - Car car = new Car(); - car.setName("123"); - car.setColor("33333"); - car.setCreateTime(new Date()); - CarEntity carEntity = CarMapper.INSTANCE.carToCarEntity(car); - log.info(carEntity.toString()); - } - - @Test - public void carEntityToCar() { - CarEntity carEntity = new CarEntity(); - carEntity.setUserName("11111"); - carEntity.setUserColor("33333"); - carEntity.setTime("2020-12-12 12:22:22"); - Car car = CarMapper.INSTANCE.carEntityToCar(carEntity); - log.info(car.toString()); - } - - @Test - public void carEntityListToCarList() { - List<CarEntity> list = new ArrayList<>(); - for (int i = 0; i < 4; i++) { - CarEntity carEntity = new CarEntity(); - carEntity.setTime("2020-12-12 12:22:33"); - carEntity.setUserName("zs" + i); - carEntity.setUserColor("red" + i); - list.add(carEntity); - } - List<Car> cars = CarMapper.INSTANCE.carsToCarEntities(list); - log.info(cars.toString()); - } - - @Test - public void carToCarEntityList() { - List<Car> list = new ArrayList<>(); - for (int i = 0; i < 4; i++) { - Car car = new Car(); - car.setName("zs"+i); - car.setColor("black" + i); - car.setCreateTime(new Date()); - list.add(car); - } - - List<CarEntity> entities = CarMapper.INSTANCE.carEntitiesToCarList(list); - log.info(entities.toString()); - } - -} +package com.xcong.excoin.mapper; + +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity; +import com.xcong.excoin.modules.coin.mapper.OrderWalletCoinDealMapper; +import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealVo; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * @author wzy + * @date 2020-05-05 10:59 + **/ +@Slf4j +@SpringBootTest +public class MapStructMapper { + + + @Test + public void mapperConvert() { + Car car = new Car(); + car.setColor("123"); + car.setName("321"); + car.setCreateTime(new Date()); + CarDto carDto = CarMapper.INSTANCE.carToCarDto(car); + log.info(carDto.toString()); + } + + @Test + public void carDtoToCarConvert() { + CarDto carDto = new CarDto(); + carDto.setName("dddd"); + carDto.setColor("aaaa"); + carDto.setCreateTime("2020-12-12 12:22:22"); + Car car = CarMapper.INSTANCE.carDtoToCar(carDto); + log.info(car.toString()); + } + + @Test + public void carToCarEntity() { + Car car = new Car(); + car.setName("123"); + car.setColor("33333"); + car.setCreateTime(new Date()); + CarEntity carEntity = CarMapper.INSTANCE.carToCarEntity(car); + log.info(carEntity.toString()); + } + + @Test + public void carEntityToCar() { + CarEntity carEntity = new CarEntity(); + carEntity.setUserName("11111"); + carEntity.setUserColor("33333"); + carEntity.setTime("2020-12-12 12:22:22"); + Car car = CarMapper.INSTANCE.carEntityToCar(carEntity); + log.info(car.toString()); + } + + @Test + public void carEntityListToCarList() { + List<CarEntity> list = new ArrayList<>(); + for (int i = 0; i < 4; i++) { + CarEntity carEntity = new CarEntity(); + carEntity.setTime("2020-12-12 12:22:33"); + carEntity.setUserName("zs" + i); + carEntity.setUserColor("red" + i); + list.add(carEntity); + } + List<Car> cars = CarMapper.INSTANCE.carsToCarEntities(list); + log.info(cars.toString()); + } + + @Test + public void carToCarEntityList() { + List<Car> list = new ArrayList<>(); + for (int i = 0; i < 4; i++) { + Car car = new Car(); + car.setName("zs"+i); + car.setColor("black" + i); + car.setCreateTime(new Date()); + list.add(car); + } + + List<CarEntity> entities = CarMapper.INSTANCE.carEntitiesToCarList(list); + log.info(entities.toString()); + } + + @Test + public void walletCoinTest() { + OrderCoinsDealEntity orderCoinsDealEntity = new OrderCoinsDealEntity(); + orderCoinsDealEntity.setMemberId(1L); + orderCoinsDealEntity.setOrderNo("123445"); + OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVoOrder(orderCoinsDealEntity); + System.out.println(entityToVo); + } + +} -- Gitblit v1.9.1