New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.modular.system.model.Area; |
| | | import com.stylefeng.guns.modular.system.model.IntegralOrder; |
| | | import com.stylefeng.guns.modular.system.service.IAreaService; |
| | | import com.stylefeng.guns.modular.system.service.IIntegralGoodsService; |
| | | import com.stylefeng.guns.modular.system.service.IIntegralOrderService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.IntegralGoodsWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.IntegralOrderWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/api/integralGoods") |
| | | public class IntegralGoodsController { |
| | | |
| | | @Autowired |
| | | private IIntegralGoodsService integralGoodsService; |
| | | |
| | | @Autowired |
| | | private IIntegralOrderService integralOrderService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | @Autowired |
| | | private IAreaService areaService; |
| | | |
| | | |
| | | /** |
| | | * 获取大区列表 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryArea") |
| | | @ApiOperation(value = "获取大区列表", tags = {"用户端-积分相关"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<Area>> queryArea(){ |
| | | try { |
| | | return ResultUtil.success(areaService.selectList(new EntityWrapper<Area>())); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取积分兑换的商品 |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryGoods") |
| | | @ApiOperation(value = "获取积分兑换的商品", tags = {"用户端-积分相关"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<IntegralGoodsWarpper>> queryGoods(Integer pageNum, Integer size){ |
| | | try { |
| | | List<Map<String, Object>> list = integralGoodsService.queryGoods(pageNum, size); |
| | | return ResultUtil.success(IntegralGoodsWarpper.getIntegralGoodsWarppers(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取商品详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryGoodsInfo") |
| | | @ApiOperation(value = "获取商品详情", tags = {"用户端-积分相关"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "商品id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryGoodsInfo(Integer id){ |
| | | try { |
| | | Map<String, Object> map = integralGoodsService.queryGoodsInfo(id); |
| | | return ResultUtil.success(IntegralGoodsWarpper.getIntegralGoodsWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 兑换商品 |
| | | * @param integralOrder |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/addIntegralOrder") |
| | | @ApiOperation(value = "兑换商品", tags = {"用户端-积分相关"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "商品id", name = "goodsId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "收件人", name = "consigneeName", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "收件人电话", name = "consigneePhone", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "收货地址", name = "consigneeAddress", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "备注", name = "remark", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "1=中文,2=英文,3=法语", name = "language", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil addIntegralOrder(IntegralOrder integralOrder,Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return integralOrderService.addIntegralOrder(integralOrder,language, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/queryConvertHistory") |
| | | @ApiOperation(value = "获取兑换历史记录", tags = {"用户端-积分相关"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<IntegralOrderWarpper>> queryConvertHistory(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = integralOrderService.queryConvertHistory(pageNum, size, uid); |
| | | return ResultUtil.success(IntegralOrderWarpper.getIntegralOrderWarppers(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.taxi.model.TransactionDetails; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | private TEmailService emailService; |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | @Autowired |
| | | private IPaymentRecordService paymentRecordService; |
| | | |
| | | |
| | | |
| | |
| | | @PostMapping("/api/user/queryRechargeRecord") |
| | | @ApiOperation(value = "用户查询充值记录", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryRechargeRecord(HttpServletRequest request){ |
| | | public ResultUtil queryRechargeRecord(Integer pageNum, Integer size,HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(transactionDetailsService.queryRechargeRecord(uid)); |
| | | RechargeRecordWarpper rechargeRecordWarpper = new RechargeRecordWarpper(); |
| | | List<Map<String,Object>> paymentRecord = paymentRecordService.queryRechargeRecord(uid, pageNum, size); |
| | | // 分装返回充值记录实体 |
| | | List<TransactionDetailsWarpper> transactionDetailsWarpper = TransactionDetailsWarpper.getTransactionDetailsWarpper(paymentRecord); |
| | | |
| | | // 查询充值金额总和 |
| | | double sum = paymentRecordService.queryRechargeMoneySum(uid); |
| | | rechargeRecordWarpper.setSum(sum); |
| | | rechargeRecordWarpper.setTransactionDetailsWarpper(transactionDetailsWarpper); |
| | | return ResultUtil.success(rechargeRecordWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text(orderPrivateCar.getPayType() == 1 ? "手机支付" : "银行卡支付"); |
| | | pay_type_chinese.text(orderPrivateCar.getPayType() == 1 ? "手机支付" : (orderPrivateCar.getPayType() == 2?"银行卡支付":(orderPrivateCar.getPayType() == 3?"余额支付":"现金支付"))); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + orderPrivateCar.getPayMoney()); |
| | | Element pdf_chinese = document.getElementById("pdf_chinese"); |
| | |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text(orderPrivateCar.getPayType() == 1 ? "Mobile money" : "Bank card"); |
| | | pay_type_english.text(orderPrivateCar.getPayType() == 1 ? "Mobile money" :(orderPrivateCar.getPayType() == 2?"Bank card":(orderPrivateCar.getPayType() == 3?"I-GO Wallet":"Cash"))); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + orderPrivateCar.getPayMoney()); |
| | | Element pdf_english = document.getElementById("pdf_english"); |
| | |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text(orderPrivateCar.getPayType() == 1 ? "Argent mobile" : "Carte bancaire"); |
| | | pay_type_french.text(orderPrivateCar.getPayType() == 1 ? "Argent mobile" : (orderPrivateCar.getPayType() == 2?"Carte bancaire":(orderPrivateCar.getPayType() == 3?"Portefeuille I-GO":"En espèces"))); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + orderPrivateCar.getPayMoney()); |
| | | Element pdf_french = document.getElementById("pdf_french"); |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.Area; |
| | | |
| | | public interface AreaMapper extends BaseMapper<Area> { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.IntegralGoods; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface IntegralGoodsMapper extends BaseMapper<IntegralGoods> { |
| | | |
| | | |
| | | List<Map<String, Object>> queryGoods(@Param("pageNum") Integer pageNum, @Param("size") Integer size); |
| | | |
| | | |
| | | Map<String, Object> queryGoodsInfo(@Param("id") Integer id); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.IntegralOrder; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface IntegralOrderMapper extends BaseMapper<IntegralOrder> { |
| | | |
| | | |
| | | /** |
| | | * 获取历史记录 |
| | | * @param pageNum |
| | | * @param size |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryConvertHistory(@Param("pageNum") Integer pageNum, @Param("size") Integer size, |
| | | @Param("uid") Integer uid); |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.AreaMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Area"> |
| | | <id column="id" property="id"/> |
| | | <result column="chineseName" property="chineseName"/> |
| | | <result column="englishName" property="englishName"/> |
| | | <result column="frenchName" property="frenchName"/> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.IntegralGoodsMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.IntegralGoods"> |
| | | <id column="id" property="id"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | <result column="name" property="name"/> |
| | | <result column="imgUrl" property="imgUrl"/> |
| | | <result column="integral" property="integral"/> |
| | | <result column="instructions" property="instructions"/> |
| | | <result column="state" property="state"/> |
| | | <result column="insertUserId" property="insertUserId"/> |
| | | <result column="insertUserRole" property="insertUserRole"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryGoods" resultType="map"> |
| | | select |
| | | id as id, |
| | | `name` as `name`, |
| | | imgUrl as url, |
| | | integral as integral, |
| | | instructions as instructions |
| | | from t_integral_goods where state = 1 order by insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | | |
| | | <select id="queryGoodsInfo" resultType="map"> |
| | | select |
| | | id as id, |
| | | `name` as `name`, |
| | | imgUrl as url, |
| | | integral as integral, |
| | | instructions as instructions |
| | | from t_integral_goods where id = #{id} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.IntegralOrderMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.IntegralOrder"> |
| | | <id column="id" property="id"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="goodsId" property="goodsId"/> |
| | | <result column="integral" property="integral"/> |
| | | <result column="num" property="num"/> |
| | | <result column="consigneeName" property="consigneeName"/> |
| | | <result column="consigneePhone" property="consigneePhone"/> |
| | | <result column="consigneeAddress" property="consigneeAddress"/> |
| | | <result column="remark" property="remark"/> |
| | | <result column="state" property="state"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryConvertHistory" resultType="map"> |
| | | select |
| | | a.id as id, |
| | | b.`name` as `name`, |
| | | DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i') as time, |
| | | CONCAT(a.integral * -1, '积分') as integral |
| | | from t_integral_order a |
| | | left join t_integral_goods b on (a.goodsId = b.id) |
| | | where a.state != 3 and a.userId = #{uid} |
| | | order by a.insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 大区 |
| | | */ |
| | | @TableName("t_area") |
| | | public class Area { |
| | | //主键 |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | //中文名称 |
| | | @TableField("chineseName") |
| | | private String chineseName; |
| | | //英文名称 |
| | | @TableField("englishName") |
| | | private String englishName; |
| | | //法文名称 |
| | | @TableField("frenchName") |
| | | private String frenchName; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getChineseName() { |
| | | return chineseName; |
| | | } |
| | | |
| | | public void setChineseName(String chineseName) { |
| | | this.chineseName = chineseName; |
| | | } |
| | | |
| | | public String getEnglishName() { |
| | | return englishName; |
| | | } |
| | | |
| | | public void setEnglishName(String englishName) { |
| | | this.englishName = englishName; |
| | | } |
| | | |
| | | public String getFrenchName() { |
| | | return frenchName; |
| | | } |
| | | |
| | | public void setFrenchName(String frenchName) { |
| | | this.frenchName = frenchName; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "City{" + |
| | | "id=" + id + |
| | | ", chineseName='" + chineseName + '\'' + |
| | | ", englishName='" + englishName + '\'' + |
| | | ", frenchName='" + frenchName + '\'' + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 积分兑换商品 |
| | | */ |
| | | @TableName("t_integral_goods") |
| | | public class IntegralGoods { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 商品名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 商品图片 |
| | | */ |
| | | @TableField("imgUrl") |
| | | private String imgUrl; |
| | | /** |
| | | * 兑换积分 |
| | | */ |
| | | @TableField("integral") |
| | | private Integer integral; |
| | | /** |
| | | * 商品说明 |
| | | */ |
| | | @TableField("instructions") |
| | | private String instructions; |
| | | /** |
| | | * 状态(1=正常,2=下架,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加用户id |
| | | */ |
| | | @TableField("insertUserId") |
| | | private Integer insertUserId; |
| | | /** |
| | | * 添加用户角色 |
| | | */ |
| | | @TableField("insertUserRole") |
| | | private Integer insertUserRole; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getImgUrl() { |
| | | return imgUrl; |
| | | } |
| | | |
| | | public void setImgUrl(String imgUrl) { |
| | | this.imgUrl = imgUrl; |
| | | } |
| | | |
| | | public Integer getIntegral() { |
| | | return integral; |
| | | } |
| | | |
| | | public void setIntegral(Integer integral) { |
| | | this.integral = integral; |
| | | } |
| | | |
| | | public String getInstructions() { |
| | | return instructions; |
| | | } |
| | | |
| | | public void setInstructions(String instructions) { |
| | | this.instructions = instructions; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Integer getInsertUserId() { |
| | | return insertUserId; |
| | | } |
| | | |
| | | public void setInsertUserId(Integer insertUserId) { |
| | | this.insertUserId = insertUserId; |
| | | } |
| | | |
| | | public Integer getInsertUserRole() { |
| | | return insertUserRole; |
| | | } |
| | | |
| | | public void setInsertUserRole(Integer insertUserRole) { |
| | | this.insertUserRole = insertUserRole; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "IntegralGoods{" + |
| | | "id=" + id + |
| | | ", insertTime=" + insertTime + |
| | | ", name='" + name + '\'' + |
| | | ", imgUrl='" + imgUrl + '\'' + |
| | | ", integral=" + integral + |
| | | ", instructions='" + instructions + '\'' + |
| | | ", state=" + state + |
| | | ", insertUserId=" + insertUserId + |
| | | ", insertUserRole=" + insertUserRole + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 积分兑换订单 |
| | | */ |
| | | @TableName("t_integral_order") |
| | | public class IntegralOrder { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 兑换时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 兑换用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 兑换商品id |
| | | */ |
| | | @TableField("goodsId") |
| | | private Integer goodsId; |
| | | /** |
| | | * 兑换积分 |
| | | */ |
| | | @TableField("integral") |
| | | private Integer integral; |
| | | /** |
| | | * 兑换数量 |
| | | */ |
| | | @TableField("num") |
| | | private Integer num; |
| | | /** |
| | | * 收货人 |
| | | */ |
| | | @TableField("consigneeName") |
| | | private String consigneeName; |
| | | /** |
| | | * 收件人电话 |
| | | */ |
| | | @TableField("consigneePhone") |
| | | private String consigneePhone; |
| | | /** |
| | | * 收货地址 |
| | | */ |
| | | @TableField("consigneeAddress") |
| | | private String consigneeAddress; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @TableField("remark") |
| | | private String remark; |
| | | /** |
| | | * 状态(1=未处理,2=已处理,3=已删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Integer getGoodsId() { |
| | | return goodsId; |
| | | } |
| | | |
| | | public void setGoodsId(Integer goodsId) { |
| | | this.goodsId = goodsId; |
| | | } |
| | | |
| | | public Integer getIntegral() { |
| | | return integral; |
| | | } |
| | | |
| | | public void setIntegral(Integer integral) { |
| | | this.integral = integral; |
| | | } |
| | | |
| | | public Integer getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(Integer num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public String getConsigneeName() { |
| | | return consigneeName; |
| | | } |
| | | |
| | | public void setConsigneeName(String consigneeName) { |
| | | this.consigneeName = consigneeName; |
| | | } |
| | | |
| | | public String getConsigneePhone() { |
| | | return consigneePhone; |
| | | } |
| | | |
| | | public void setConsigneePhone(String consigneePhone) { |
| | | this.consigneePhone = consigneePhone; |
| | | } |
| | | |
| | | public String getConsigneeAddress() { |
| | | return consigneeAddress; |
| | | } |
| | | |
| | | public void setConsigneeAddress(String consigneeAddress) { |
| | | this.consigneeAddress = consigneeAddress; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "IntegralOrder{" + |
| | | "id=" + id + |
| | | ", insertTime=" + insertTime + |
| | | ", userId=" + userId + |
| | | ", goodsId=" + goodsId + |
| | | ", num=" + num + |
| | | ", consigneeName='" + consigneeName + '\'' + |
| | | ", consigneePhone='" + consigneePhone + '\'' + |
| | | ", consigneeAddress='" + consigneeAddress + '\'' + |
| | | ", remark='" + remark + '\'' + |
| | | ", state=" + state + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.Area; |
| | | import com.stylefeng.guns.modular.system.model.City; |
| | | |
| | | public interface IAreaService extends IService<Area> { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.IntegralGoods; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface IIntegralGoodsService extends IService<IntegralGoods> { |
| | | |
| | | |
| | | /** |
| | | * 获取商品列表 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryGoods(Integer pageNum, Integer size) throws Exception; |
| | | |
| | | |
| | | Map<String, Object> queryGoodsInfo(Integer id) throws Exception; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.IntegralOrder; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface IIntegralOrderService extends IService<IntegralOrder> { |
| | | |
| | | |
| | | /** |
| | | * 保存订单 |
| | | * @param integralOrder |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil addIntegralOrder(IntegralOrder integralOrder,Integer language, Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取历史记录 |
| | | * @param pageNum |
| | | * @param size |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryConvertHistory(Integer pageNum, Integer size, Integer uid) throws Exception; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.AreaMapper; |
| | | import com.stylefeng.guns.modular.system.model.Area; |
| | | import com.stylefeng.guns.modular.system.service.IAreaService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IAreaService { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.IntegralGoodsMapper; |
| | | import com.stylefeng.guns.modular.system.model.IntegralGoods; |
| | | import com.stylefeng.guns.modular.system.service.IIntegralGoodsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class IntegralGoodsServiceImpl extends ServiceImpl<IntegralGoodsMapper, IntegralGoods> implements IIntegralGoodsService { |
| | | |
| | | @Resource |
| | | private IntegralGoodsMapper integralGoodsMapper; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取商品列表 |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryGoods(Integer pageNum, Integer size) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | return integralGoodsMapper.queryGoods(pageNum, size); |
| | | } |
| | | |
| | | /** |
| | | * 获取详情 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Map<String, Object> queryGoodsInfo(Integer id) throws Exception { |
| | | return integralGoodsMapper.queryGoodsInfo(id); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.IntegralOrderMapper; |
| | | import com.stylefeng.guns.modular.system.model.IntegralGoods; |
| | | import com.stylefeng.guns.modular.system.model.IntegralOrder; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.service.IIntegralGoodsService; |
| | | import com.stylefeng.guns.modular.system.service.IIntegralOrderService; |
| | | import com.stylefeng.guns.modular.system.service.ISystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | | public class IntegralOrderServiceImpl extends ServiceImpl<IntegralOrderMapper, IntegralOrder> implements IIntegralOrderService { |
| | | |
| | | @Resource |
| | | private IntegralOrderMapper integralOrderMapper; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Autowired |
| | | private IIntegralGoodsService integralGoodsService; |
| | | |
| | | @Autowired |
| | | private ISystemNoticeService systemNoticeService; |
| | | |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | |
| | | |
| | | /** |
| | | * 保存订单 |
| | | * @param integralOrder |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil addIntegralOrder(IntegralOrder integralOrder,Integer language, Integer uid) throws Exception { |
| | | IntegralGoods integralGoods = integralGoodsService.selectById(integralOrder.getGoodsId()); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | if(integralGoods.getIntegral().compareTo(userInfo.getIntegral()) > 0){ |
| | | return ResultUtil.error(language == 1 ? "兑换失败,积分不足!":(language == 2 ? "Redemption failed, insufficient points!":"Échange échoué, points insuffisants!")); |
| | | } |
| | | integralOrder.setInsertTime(new Date()); |
| | | integralGoods.setIntegral(integralGoods.getIntegral()); |
| | | integralOrder.setNum(1); |
| | | integralOrder.setState(1); |
| | | integralOrder.setUserId(uid); |
| | | this.insert(integralOrder); |
| | | |
| | | userInfo.setIntegral(userInfo.getIntegral() - integralGoods.getIntegral()); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您使用" + integralGoods.getIntegral() + "积分成功兑换" + integralGoods.getName() + "商品!", uid, 1); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "积分兑换", integralGoods.getIntegral().doubleValue(), 2, 2, 1, 7, integralOrder.getId()); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | /** |
| | | * 获取历史记录 |
| | | * @param pageNum |
| | | * @param size |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryConvertHistory(Integer pageNum, Integer size, Integer uid) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | return integralOrderMapper.queryConvertHistory(pageNum, size, uid); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("积分商品") |
| | | public class IntegralGoodsWarpper { |
| | | @ApiModelProperty("商品id") |
| | | private Integer id; |
| | | @ApiModelProperty("商品名称") |
| | | private String name; |
| | | @ApiModelProperty("商品图片") |
| | | private String url; |
| | | @ApiModelProperty("兑换积分") |
| | | private Integer integral; |
| | | @ApiModelProperty("商品说明") |
| | | private String instructions; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public Integer getIntegral() { |
| | | return integral; |
| | | } |
| | | |
| | | public void setIntegral(Integer integral) { |
| | | this.integral = integral; |
| | | } |
| | | |
| | | public String getInstructions() { |
| | | return instructions; |
| | | } |
| | | |
| | | public void setInstructions(String instructions) { |
| | | this.instructions = instructions; |
| | | } |
| | | |
| | | public static IntegralGoodsWarpper getIntegralGoodsWarpper(Map<String, Object> map){ |
| | | IntegralGoodsWarpper integralGoodsWarpper = new IntegralGoodsWarpper(); |
| | | if(null != map){ |
| | | integralGoodsWarpper.setId(null != map.get("id") ? Integer.valueOf(map.get("id").toString()) : 0); |
| | | integralGoodsWarpper.setName(null != map.get("name") ? map.get("name").toString() : ""); |
| | | integralGoodsWarpper.setUrl(null != map.get("url") ? map.get("url").toString() : ""); |
| | | integralGoodsWarpper.setIntegral(null != map.get("integral") ? Integer.valueOf(map.get("integral").toString()) : 0); |
| | | integralGoodsWarpper.setInstructions(null != map.get("instructions") ? map.get("instructions").toString() : ""); |
| | | } |
| | | return integralGoodsWarpper; |
| | | } |
| | | |
| | | public static List<IntegralGoodsWarpper> getIntegralGoodsWarppers(List<Map<String, Object>> maps){ |
| | | List<IntegralGoodsWarpper> list = new ArrayList<>(); |
| | | if(null != maps){ |
| | | for(Map<String, Object> map : maps){ |
| | | list.add(IntegralGoodsWarpper.getIntegralGoodsWarpper(map)); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("历史订单") |
| | | public class IntegralOrderWarpper { |
| | | @ApiModelProperty("订单id") |
| | | private Integer id; |
| | | @ApiModelProperty("商品名称") |
| | | private String name; |
| | | @ApiModelProperty("兑换时间") |
| | | private String time; |
| | | @ApiModelProperty("兑换积分") |
| | | private String integral; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getTime() { |
| | | return time; |
| | | } |
| | | |
| | | public void setTime(String time) { |
| | | this.time = time; |
| | | } |
| | | |
| | | public String getIntegral() { |
| | | return integral; |
| | | } |
| | | |
| | | public void setIntegral(String integral) { |
| | | this.integral = integral; |
| | | } |
| | | |
| | | |
| | | public static IntegralOrderWarpper getIntegralOrderWarpper(Map<String, Object> map){ |
| | | IntegralOrderWarpper integralOrderWarpper = new IntegralOrderWarpper(); |
| | | if(null != map){ |
| | | integralOrderWarpper.setId(null != map.get("id") ? Integer.valueOf(map.get("id").toString()) : 0); |
| | | integralOrderWarpper.setName(null != map.get("name") ? map.get("name").toString() : ""); |
| | | integralOrderWarpper.setTime(null != map.get("time") ? map.get("time").toString() : ""); |
| | | integralOrderWarpper.setIntegral(null != map.get("integral") ? map.get("integral").toString() : ""); |
| | | } |
| | | return integralOrderWarpper; |
| | | } |
| | | |
| | | public static List<IntegralOrderWarpper> getIntegralOrderWarppers(List<Map<String, Object>> maps){ |
| | | List<IntegralOrderWarpper> list = new ArrayList<>(); |
| | | if(null != maps){ |
| | | for(Map<String, Object> map : maps){ |
| | | list.add(IntegralOrderWarpper.getIntegralOrderWarpper(map)); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.List; |
| | | |
| | | @ApiModel(value = "用户充值记录汇总warpper") |
| | | public class RechargeRecordWarpper { |
| | | |
| | | /** |
| | | * 金额汇总 |
| | | */ |
| | | @ApiModelProperty("金额汇总") |
| | | private Double sum; |
| | | /** |
| | | * 用户充值记录分页列表 |
| | | */ |
| | | @ApiModelProperty("用户充值记录分页列表") |
| | | private List<TransactionDetailsWarpper> transactionDetailsWarpper; |
| | | |
| | | public Double getSum() { |
| | | return sum; |
| | | } |
| | | |
| | | public void setSum(Double sum) { |
| | | this.sum = sum; |
| | | } |
| | | |
| | | public List<TransactionDetailsWarpper> getTransactionDetailsWarpper() { |
| | | return transactionDetailsWarpper; |
| | | } |
| | | |
| | | public void setTransactionDetailsWarpper(List<TransactionDetailsWarpper> transactionDetailsWarpper) { |
| | | this.transactionDetailsWarpper = transactionDetailsWarpper; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("用户充值信息warpper") |
| | | public class TransactionDetailsWarpper { |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @ApiModelProperty("id") |
| | | private Integer id; |
| | | /** |
| | | * 对象id |
| | | */ |
| | | @ApiModelProperty("用户id") |
| | | private Integer userId; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty("添加时间") |
| | | private String insertTime; |
| | | /** |
| | | * 金额 |
| | | */ |
| | | @ApiModelProperty("金额") |
| | | private Double money; |
| | | |
| | | /** |
| | | * 充值状态 1=充值失败 2=充值成功 |
| | | */ |
| | | @ApiModelProperty("充值状态 1=充值失败 2=充值成功") |
| | | private Integer state; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(String insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "TransactionDetailsWarpper{" + |
| | | "id=" + id + |
| | | ", userId=" + userId + |
| | | ", insertTime=" + insertTime + |
| | | ", money=" + money + |
| | | ", state=" + state + |
| | | '}'; |
| | | } |
| | | |
| | | public static List<TransactionDetailsWarpper> getTransactionDetailsWarpper(List<Map<String, Object>> maps){ |
| | | List<TransactionDetailsWarpper> list = new ArrayList<>(); |
| | | if(null != maps){ |
| | | for (Map<String, Object> map : maps) { |
| | | TransactionDetailsWarpper transactionDetailsWarpper=new TransactionDetailsWarpper(); |
| | | if(null != map){ |
| | | transactionDetailsWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))):0); |
| | | transactionDetailsWarpper.setUserId(null!=map.get("userId")? Integer.valueOf(String.valueOf(map.get("userId"))) :null); |
| | | transactionDetailsWarpper.setInsertTime(null != map.get("insertTime") ? String.valueOf(map.get("insertTime")) : ""); |
| | | transactionDetailsWarpper.setMoney(null!=map.get("money")? Double.valueOf(String.valueOf(map.get("money"))) : 0.00); |
| | | transactionDetailsWarpper.setState(null!=map.get("state")? Integer.valueOf(String.valueOf(map.get("state"))) : 1); |
| | | list.add(transactionDetailsWarpper); |
| | | } |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface PaymentRecordMapper extends BaseMapper<PaymentRecord> { |
| | | |
| | | |
| | |
| | | @Param("type") Integer type, @Param("orderId") Integer orderId, |
| | | @Param("orderType") Integer orderType, @Param("payType") Integer payType, |
| | | @Param("state") Integer state); |
| | | |
| | | /** |
| | | * |
| | | * @param uid 用户id |
| | | * @param pageNum 页码 |
| | | * @param size 每页条数 |
| | | * @return 用户充值记录 |
| | | */ |
| | | List<Map<String, Object>> queryRechargeRecord(@Param("uid") Integer uid, @Param("pageNum")Integer pageNum, @Param("size")Integer size); |
| | | /** |
| | | * 查询充值金额总和 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | double queryRechargeMoneySum(@Param("uid")Integer uid); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.taxi.model.TransactionDetails; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface TransactionDetailsMapper extends BaseMapper<TransactionDetails> { |
| | | /** |
| | | * |
| | | * @param uid 用户id |
| | | * @param pageNum 页码 |
| | | * @param size 每页条数 |
| | | * @return 用户充值记录 |
| | | */ |
| | | List<Map<String, Object>> queryRechargeRecord(@Param("uid") Integer uid, @Param("pageNum")Integer pageNum, @Param("size")Integer size); |
| | | |
| | | double queryRechargeMoneySum(@Param("uid")Integer uid); |
| | | } |
| | |
| | | </if> |
| | | order by insertTime desc limit 0,1 |
| | | </select> |
| | | |
| | | <select id="queryRechargeRecord" resultType="java.util.Map"> |
| | | SELECT |
| | | id as id, |
| | | category as category, |
| | | userId as userId, |
| | | `type` as `type`, |
| | | orderId as orderId, |
| | | orderType as orderType, |
| | | payType as payType, |
| | | amount as amount, |
| | | code as code, |
| | | `state` as state, |
| | | insertTime as insertTime |
| | | FROM t_payment_record |
| | | WHERE category = 2 AND userId = #{uid} AND `type` = 1 |
| | | ORDER BY insertTime DESC |
| | | limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | | <select id="queryRechargeMoneySum" resultType="java.lang.Double"> |
| | | SELECT SUM(amount) |
| | | FROM t_payment_record |
| | | WHERE category = 2 AND userId = #{uid} AND `type` = 1 AND `state` = 2 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result column="orderType" property="orderType"/> |
| | | <result column="orderId" property="orderId"/> |
| | | </resultMap> |
| | | <select id="queryRechargeRecord" resultType="java.util.Map"> |
| | | SELECT id,userId,insertTime,remark,money,`state`,`type`,userType,orderType,orderId |
| | | FROM t_pub_transaction_details |
| | | WHERE userId = #{uid} AND userType = 1 AND `type` = 1 AND orderType = 5 |
| | | ORDER BY insertTime DESC |
| | | limit #{pageNum}, #{size} |
| | | </select> |
| | | <select id="queryRechargeMoneySum" resultType="java.lang.Double"> |
| | | SELECT SUM(money) |
| | | FROM t_pub_transaction_details |
| | | WHERE userId = #{uid} AND userType = 1 AND `type` = 1 AND orderType = 5 |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface IPaymentRecordService extends IService<PaymentRecord> { |
| | | |
| | | |
| | |
| | | */ |
| | | PaymentRecord query(Integer category, Integer userId, Integer type, Integer orderId, Integer orderType, |
| | | Integer payType, Integer state) throws Exception; |
| | | |
| | | /** |
| | | * 查询用户充值数据 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryRechargeRecord(Integer uid, Integer pageNum, Integer size); |
| | | |
| | | /** |
| | | * 查询用户充值金额汇总 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | double queryRechargeMoneySum(Integer uid); |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.taxi.model.TransactionDetails; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface ITransactionDetailsService extends IService<TransactionDetails> { |
| | | |
| | |
| | | * @param state 状态(1=添加,2=减少) |
| | | * @param type 类型(1=金额,2=积分) |
| | | * @param userType 用户类型(1=用户,2=司机) |
| | | * @param orderType 订单类型(1=专车,2=出租车,3=城际,4=小件物流,5=余额充值,6=余额提现) |
| | | * @param orderType 订单类型(1=专车,2=出租车,3=城际,4=小件物流,5=余额充值,6=余额提现,7=积分兑换) |
| | | * @param orderId |
| | | * @throws Exception |
| | | */ |
| | |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<TransactionDetails> queryRechargeRecord(Integer uid); |
| | | List<Map<String,Object>> queryRechargeRecord(Integer uid, Integer pageNum, Integer size); |
| | | |
| | | /** |
| | | * 查询充值金额总和 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | double queryRechargeMoneySum(Integer uid); |
| | | } |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | |
| | | Integer payType, Integer state) throws Exception { |
| | | return paymentRecordMapper.query(category, userId, type, orderId, orderType, payType, state); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryRechargeRecord(Integer uid, Integer pageNum, Integer size) { |
| | | pageNum = (pageNum - 1) * size; |
| | | return this.baseMapper.queryRechargeRecord(uid,pageNum,size); |
| | | } |
| | | |
| | | @Override |
| | | public double queryRechargeMoneySum(Integer uid) { |
| | | return this.baseMapper.queryRechargeMoneySum(uid); |
| | | } |
| | | } |
| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<TransactionDetails> queryRechargeRecord(Integer uid) { |
| | | List<TransactionDetails> transactionDetails = this.selectList(new EntityWrapper<TransactionDetails>() |
| | | .eq("userId", uid) |
| | | .eq("userType", 1) |
| | | .eq("type", 1) |
| | | .eq("orderType", 5)); |
| | | return transactionDetails; |
| | | public List<Map<String,Object>> queryRechargeRecord(Integer uid, Integer pageNum, Integer size) { |
| | | pageNum = (pageNum - 1) * size; |
| | | return this.baseMapper.queryRechargeRecord(uid,pageNum,size); |
| | | } |
| | | |
| | | @Override |
| | | public double queryRechargeMoneySum(Integer uid) { |
| | | return this.baseMapper.queryRechargeMoneySum(uid); |
| | | } |
| | | } |