Merge remote-tracking branch 'origin/master'
| | |
| | | }
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
|
| | | } catch (PushException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送失败"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送失败"));
|
| | | e.printStackTrace();
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
|
| | |
|
| | | } catch (PushException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送失败"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送失败"));
|
| | | e.printStackTrace();
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | qualityFactoryService.addBatch(auctionIdList,lableNames, admin);
|
| | | qualityFactoryService.addBatchGoodsByTaoBaoId(auctionIdList,lableNames, admin);
|
| | |
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("添加成功")));
|
| | |
|
| | |
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | | @Resource
|
| | | private QualityFactoryService selectionGoodsService;
|
| | | private QualityFactoryService qualityFactoryService;
|
| | | @Resource
|
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | |
|
| | |
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | | SearchFilter filter = new SearchFilter();
|
| | |
|
| | | // 页大小,默认20,1~100
|
| | | if (pageSize == null || pageSize < 1)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | filter.setPageSize(pageSize);
|
| | |
|
| | | // 第几页,默认:1
|
| | | if (pageIndex == null || pageIndex < 1)
|
| | | pageIndex = 1;
|
| | |
|
| | | filter.setPage(pageIndex);
|
| | |
|
| | | // 查询词 key------ 不能为空---------
|
| | | if (!StringUtil.isNullOrEmpty(key))
|
| | | filter.setKey(key);
|
| | |
|
| | | if (tbClassId != null) {
|
| | | GoodsClass rb = goodsClassService.getGoodsClass(tbClassId);
|
| | | if (rb == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该类型已不存在,请刷新重试"));
|
| | | return;
|
| | | } else {
|
| | |
|
| | | // 淘宝类目id
|
| | | String taoBaoCatIds = taoBaoClassService.getTaoBaoCatIds(tbClassId);
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(taoBaoCatIds)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该类型淘宝id为空,请通知相关人员进行维护"));
|
| | | return;
|
| | | } else {
|
| | | filter.setCateIds(taoBaoCatIds);
|
| | | }
|
| | | }
|
| | | // 查询物料
|
| | | TaoBaoSearchResult result = getGoodsByWuLiao(pageIndex, pageSize, key, tbClassId, startPrice, endPrice, startTkRate, endTkRate, sort,
|
| | | istmall, hasCoupon, baoYou, startDsr, overseas, needPrepay, includePayRate30, includeGoodRate, |
| | | includeRfdRate, npxLevel);
|
| | | |
| | | if (result == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未获取到淘宝商品信息"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 查询条件和类目id不能同时为空
|
| | | if (StringUtil.isNullOrEmpty(key) && tbClassId == null) {
|
| | | filter.setKey("女装");
|
| | | }
|
| | |
|
| | | // 折扣价范围下限
|
| | | if (startPrice != null)
|
| | | filter.setStartPrice(new BigDecimal(startPrice));
|
| | |
|
| | | // 折扣价范围上限
|
| | | if (endPrice != null && endPrice > 0)
|
| | | filter.setEndPrice(new BigDecimal(endPrice));
|
| | |
|
| | | // 淘客佣金比率下限 如:1234表示12.34%
|
| | | if (!StringUtil.isNullOrEmpty(startTkRate)) {
|
| | | int tkRate = (int) (Float.parseFloat(startTkRate) * 100);
|
| | | filter.setStartTkRate(tkRate);
|
| | | }
|
| | |
|
| | | // 淘客佣金比率上限 如:1234表示12.34%
|
| | | if (!StringUtil.isNullOrEmpty(endTkRate)) {
|
| | | int tkRate = (int) (Float.parseFloat(endTkRate) * 100);
|
| | | filter.setEndTkRate(tkRate);
|
| | | }
|
| | |
|
| | | // 排序字段
|
| | | // 销量(total_sales)淘客佣金比率(tk_rate)累计推广量(tk_total_sales)总支出佣金(tk_total_commi)
|
| | | if (sort != null)
|
| | | filter.setSort(sort);
|
| | | // 查询天猫 1 true
|
| | | if (istmall != null && istmall == 1)
|
| | | filter.setTmall(true);
|
| | | // 是否有券 1 true
|
| | | if (hasCoupon != null && hasCoupon == 1)
|
| | | filter.setQuan(1);
|
| | | // 是否包邮,true表示包邮,空或false表示不限
|
| | | if (baoYou != null && baoYou == 1) {
|
| | | filter.setBaoYou(true);
|
| | | // filter.setIp("113.251.22.10");// 重庆
|
| | | filter.setIp("218.72.111.105");// 杭州
|
| | |
|
| | | }
|
| | |
|
| | | // 店铺dsr评分
|
| | | if (startDsr != null && startDsr >= 0 && startDsr <= 50000)
|
| | | filter.setStartDsr(startDsr);
|
| | | // 是否海外商品
|
| | | if (overseas != null && overseas == 1)
|
| | | filter.setOverseas(true);
|
| | | // 是否加入消费者保障,
|
| | | if (needPrepay != null && needPrepay == 1)
|
| | | filter.setNeedPrepay(true);
|
| | | // 成交转化是否高于行业均值
|
| | | if (includePayRate30 != null && includePayRate30 == 1)
|
| | | filter.setIncludePayRate30(true);
|
| | | // 好评率是否高于行业均值
|
| | | if (includeGoodRate != null && includeGoodRate == 1)
|
| | | filter.setIncludeGoodRate(true);
|
| | |
|
| | | // 退款率是否低于行业均值
|
| | | if (includeRfdRate != null && includeRfdRate == 1)
|
| | | filter.setIncludeRfdRate(true);
|
| | |
|
| | | // 牛皮癣程度,取值:1:不限,2:无,3:轻微
|
| | | if (npxLevel != null && npxLevel > 0 && npxLevel < 4)
|
| | | filter.setNpxLevel(npxLevel);
|
| | |
|
| | | boolean islink = false;
|
| | | Long auctionId = null;
|
| | |
|
| | | /* 判断是否是商品链接搜索 */
|
| | | if (key != null && key.contains("//") && key.contains("&")) {
|
| | | String[] keyArray = key.split("\\?")[1].split("&");
|
| | | if (keyArray != null && keyArray.length > 0) {
|
| | | String id = keyArray[0].replace("id=", "").trim();
|
| | | if (!StringUtil.isNullOrEmpty(id)) {
|
| | | auctionId = Long.parseLong(id);
|
| | | islink = true;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | TaoBaoSearchResult result = null;
|
| | | List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = null;
|
| | |
|
| | | if (!islink) {
|
| | | /* 淘宝物料搜索 */
|
| | | result = TaoKeApiUtil.searchWuLiao(filter);
|
| | | if (result == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未获取到淘宝商品信息"));
|
| | | return;
|
| | | } else {
|
| | | taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs();
|
| | | }
|
| | |
|
| | | } else {
|
| | | /* 商品链接搜索 */
|
| | |
|
| | | TaoBaoGoodsBrief searchGoodsDetail = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | | if (searchGoodsDetail == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未获取到淘宝商品信息"));
|
| | | return;
|
| | | } else {
|
| | | taoBaoGoodsBriefs = new ArrayList<>();
|
| | | taoBaoGoodsBriefs.add(searchGoodsDetail);
|
| | |
|
| | | result = new TaoBaoSearchResult();
|
| | | result.setTaoBaoGoodsBriefs(taoBaoGoodsBriefs);
|
| | |
|
| | | PageEntity pageEntity = new PageEntity(pageIndex, pageSize, 0, 0);
|
| | | result.setPageEntity(pageEntity);
|
| | | }
|
| | | }
|
| | |
|
| | | if (taoBaoGoodsBriefs == null || taoBaoGoodsBriefs.size() == 0) {
|
| | | |
| | | List<TaoBaoGoodsBrief> listTaoBaoGoods = result.getTaoBaoGoodsBriefs();
|
| | | if (listTaoBaoGoods == null || listTaoBaoGoods.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未查询到淘宝商品信息"));
|
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | // 插入商品集合
|
| | | List<Long> listAuctionId = new ArrayList<Long>();
|
| | | for (TaoBaoGoodsBrief goodsBrief : taoBaoGoodsBriefs) {
|
| | | for (TaoBaoGoodsBrief goodsBrief : listTaoBaoGoods) {
|
| | | listAuctionId.add(goodsBrief.getAuctionId());
|
| | | }
|
| | |
|
| | | // 验证是否存在数据库
|
| | | List<QualityFactory> listHas = selectionGoodsService.listQueryByAuctionId(listAuctionId);
|
| | | List<QualityFactory> listHas = qualityFactoryService.listQueryByAuctionId(listAuctionId);
|
| | |
|
| | | List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
|
| | |
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : listTaoBaoGoods) {
|
| | |
|
| | | taoBaoGoodsBrief.setId(null);
|
| | |
|
| | |
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | // 插入本地数据-淘宝数据记录
|
| | | taoBaoGoodsBriefRecordService.insertBatch(taoBaoGoodsBriefs);
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | | |
| | | /**
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param key
|
| | | * 关键词
|
| | | * @param startPrice
|
| | | * 价格小值
|
| | | * @param endPrice
|
| | | * 价格大值
|
| | | * @param startTkRate
|
| | | * 佣金小值
|
| | | * @param endTkRate
|
| | | * 佣金大值
|
| | | * @param sort
|
| | | * 排序
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "addTBGoodsFactory")
|
| | | public void addTBGoodsFactory(String callback, Integer pageIndex, Integer pageSize, String key, Long tbClassId,
|
| | | Integer startPrice, Integer endPrice, String startTkRate, String endTkRate, Integer sort, Integer istmall,
|
| | | Integer hasCoupon, Integer baoYou, Integer startDsr, Integer overseas, Integer needPrepay,
|
| | | Integer includePayRate30, Integer includeGoodRate, Integer includeRfdRate, Integer npxLevel,
|
| | | String auctionIds, String lableNames, HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(auctionIds)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选择正确的商品入库")));
|
| | | return;
|
| | | }
|
| | |
|
| | | Gson gson2 = new Gson();
|
| | | List<Long> listTaoBaoId = gson2.fromJson(auctionIds, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | if (listTaoBaoId == null || listTaoBaoId.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选择正确的商品入库")));
|
| | | return;
|
| | | }
|
| | | |
| | | // 查询物料
|
| | | TaoBaoSearchResult result = getGoodsByWuLiao(pageIndex, pageSize, key, tbClassId, startPrice, endPrice, startTkRate, endTkRate, sort,
|
| | | istmall, hasCoupon, baoYou, startDsr, overseas, needPrepay, includePayRate30, includeGoodRate, |
| | | includeRfdRate, npxLevel);
|
| | | |
| | | if (result == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未获取到淘宝商品信息"));
|
| | | return;
|
| | | }
|
| | | |
| | | List<TaoBaoGoodsBrief> listTaoBaoGoods = result.getTaoBaoGoodsBriefs();
|
| | | if (listTaoBaoGoods == null || listTaoBaoGoods.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未查询到淘宝商品信息"));
|
| | | return;
|
| | | }
|
| | | |
| | | List<TaoBaoGoodsBrief> listAddGoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief: listTaoBaoGoods) {
|
| | | Long auctionId = taoBaoGoodsBrief.getAuctionId();
|
| | | if (listTaoBaoId.contains(auctionId)) {
|
| | | listAddGoods.add(taoBaoGoodsBrief);
|
| | | listTaoBaoId.remove(auctionId);
|
| | | }
|
| | | }
|
| | | |
| | | if (listTaoBaoId != null && listTaoBaoId.size() > 0) {
|
| | | for (Long auctionId: listTaoBaoId) {
|
| | | /* 根据auctionId 获取淘宝商品 */
|
| | | TaoBaoGoodsBrief goodsBrief = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | | if (goodsBrief != null) {
|
| | | listAddGoods.add(goodsBrief);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | | // 插入精选库
|
| | | qualityFactoryService.addBatchTaoBaoGoods(listAddGoods, lableNames, admin);
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, e.getMessage()));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据条件淘宝商品查询
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key
|
| | | * @param tbClassId
|
| | | * @param startPrice
|
| | | * @param endPrice
|
| | | * @param startTkRate
|
| | | * @param endTkRate
|
| | | * @param sort
|
| | | * @param istmall
|
| | | * @param hasCoupon
|
| | | * @param baoYou
|
| | | * @param startDsr
|
| | | * @param overseas
|
| | | * @param needPrepay
|
| | | * @param includePayRate30
|
| | | * @param includeGoodRate
|
| | | * @param includeRfdRate
|
| | | * @param npxLevel
|
| | | * @throws Exception
|
| | | */
|
| | | public TaoBaoSearchResult getGoodsByWuLiao(Integer pageIndex, Integer pageSize, String key, Long tbClassId,
|
| | | Integer startPrice, Integer endPrice, String startTkRate, String endTkRate, Integer sort, Integer istmall,
|
| | | Integer hasCoupon, Integer baoYou, Integer startDsr, Integer overseas, Integer needPrepay,
|
| | | Integer includePayRate30, Integer includeGoodRate, Integer includeRfdRate, Integer npxLevel)
|
| | | throws Exception {
|
| | |
|
| | | SearchFilter filter = new SearchFilter();
|
| | | filter.setPageSize(pageSize);
|
| | | filter.setPage(pageIndex);
|
| | |
|
| | | // 查询词 key------ 不能为空---------
|
| | | if (!StringUtil.isNullOrEmpty(key))
|
| | | filter.setKey(key);
|
| | |
|
| | | if (tbClassId != null) {
|
| | | GoodsClass rb = goodsClassService.getGoodsClass(tbClassId);
|
| | | if (rb == null) {
|
| | | throw new Exception("该类型已不存在,请刷新重试");
|
| | | } |
| | | |
| | | // 淘宝类目id
|
| | | String taoBaoCatIds = taoBaoClassService.getTaoBaoCatIds(tbClassId);
|
| | | if (StringUtil.isNullOrEmpty(taoBaoCatIds)) {
|
| | | throw new Exception("该类型淘宝id为空,请通知相关人员进行维护");
|
| | | } else {
|
| | | filter.setCateIds(taoBaoCatIds);
|
| | | }
|
| | | }
|
| | |
|
| | | // 查询条件和类目id不能同时为空
|
| | | if (StringUtil.isNullOrEmpty(key) && tbClassId == null) {
|
| | | filter.setKey("女装");
|
| | | }
|
| | | // 折扣价范围下限
|
| | | if (startPrice != null) {
|
| | | filter.setStartPrice(new BigDecimal(startPrice));
|
| | | }
|
| | | // 折扣价范围上限
|
| | | if (endPrice != null && endPrice > 0) {
|
| | | filter.setEndPrice(new BigDecimal(endPrice));
|
| | | }
|
| | | // 淘客佣金比率下限 如:1234表示12.34%
|
| | | if (!StringUtil.isNullOrEmpty(startTkRate)) {
|
| | | int tkRate = (int) (Float.parseFloat(startTkRate) * 100);
|
| | | filter.setStartTkRate(tkRate);
|
| | | }
|
| | | // 淘客佣金比率上限 如:1234表示12.34%
|
| | | if (!StringUtil.isNullOrEmpty(endTkRate)) {
|
| | | int tkRate = (int) (Float.parseFloat(endTkRate) * 100);
|
| | | filter.setEndTkRate(tkRate);
|
| | | }
|
| | | // 排序字段 销量(total_sales)淘客佣金比率(tk_rate)累计推广量(tk_total_sales)总支出佣金(tk_total_commi)
|
| | | if (sort != null) {
|
| | | filter.setSort(sort);
|
| | | }
|
| | | // 查询天猫 1 true
|
| | | if (istmall != null && istmall == 1) {
|
| | | filter.setTmall(true);
|
| | | }
|
| | | // 是否有券 1 true
|
| | | if (hasCoupon != null && hasCoupon == 1) {
|
| | | filter.setQuan(1);
|
| | | }
|
| | | // 是否包邮,true表示包邮,空或false表示不限
|
| | | if (baoYou != null && baoYou == 1) {
|
| | | filter.setBaoYou(true);
|
| | | // filter.setIp("113.251.22.10");// 重庆
|
| | | filter.setIp("218.72.111.105");// 杭州
|
| | | }
|
| | | // 店铺dsr评分
|
| | | if (startDsr != null && startDsr >= 0 && startDsr <= 50000) {
|
| | | filter.setStartDsr(startDsr);
|
| | | }
|
| | | // 是否海外商品
|
| | | if (overseas != null && overseas == 1) {
|
| | | filter.setOverseas(true);
|
| | | }
|
| | | // 是否加入消费者保障,
|
| | | if (needPrepay != null && needPrepay == 1) {
|
| | | filter.setNeedPrepay(true);
|
| | | }
|
| | | // 成交转化是否高于行业均值
|
| | | if (includePayRate30 != null && includePayRate30 == 1) {
|
| | | filter.setIncludePayRate30(true);
|
| | | }
|
| | | // 好评率是否高于行业均值
|
| | | if (includeGoodRate != null && includeGoodRate == 1) {
|
| | | filter.setIncludeGoodRate(true);
|
| | | }
|
| | | // 退款率是否低于行业均值
|
| | | if (includeRfdRate != null && includeRfdRate == 1) {
|
| | | filter.setIncludeRfdRate(true);
|
| | | }
|
| | | // 牛皮癣程度,取值:1:不限,2:无,3:轻微
|
| | | if (npxLevel != null && npxLevel > 0 && npxLevel < 4) {
|
| | | filter.setNpxLevel(npxLevel);
|
| | | }
|
| | | |
| | | |
| | | boolean islink = false;
|
| | | Long auctionId = null;
|
| | | /* 判断是否是商品链接搜索 */
|
| | | if (key != null && key.contains("//") && key.contains("&")) {
|
| | | String[] keyArray = key.split("\\?")[1].split("&");
|
| | | if (keyArray != null && keyArray.length > 0) {
|
| | | String id = keyArray[0].replace("id=", "").trim();
|
| | | if (!StringUtil.isNullOrEmpty(id)) {
|
| | | auctionId = Long.parseLong(id);
|
| | | islink = true;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | TaoBaoSearchResult result = null;
|
| | |
|
| | | if (!islink) {
|
| | | /* 淘宝物料搜索 */
|
| | | result = TaoKeApiUtil.searchWuLiao(filter);
|
| | | } else {
|
| | | /* 商品链接搜索 */
|
| | | TaoBaoGoodsBrief searchGoodsDetail = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | | if (searchGoodsDetail != null) {
|
| | | List<TaoBaoGoodsBrief> listGoods = new ArrayList<>();
|
| | | listGoods.add(searchGoodsDetail);
|
| | |
|
| | | result = new TaoBaoSearchResult();
|
| | | result.setTaoBaoGoodsBriefs(listGoods);
|
| | | PageEntity pageEntity = new PageEntity(pageIndex, pageSize, 1, 1);
|
| | | result.setPageEntity(pageEntity);
|
| | | }
|
| | | }
|
| | |
|
| | | return result;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | if (goodsBrief != null) {
|
| | | Long id = goodsBrief.getId();
|
| | | // 查询精选库
|
| | | Long has = selectionGoodsService.queryCountByGoodsId(id);
|
| | | Long has = qualityFactoryService.queryCountByGoodsId(id);
|
| | |
|
| | | if (has != null && has > 0l) {
|
| | | existence = 1; // 存在商品中
|
| | |
| | | }
|
| | |
|
| | | // 验证是否存在数据库
|
| | | List<QualityFactory> listHas = selectionGoodsService.listQueryByAuctionId(listAuctionId);
|
| | | List<QualityFactory> listHas = qualityFactoryService.listQueryByAuctionId(listAuctionId);
|
| | |
|
| | | List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
|
| | |
|
| | |
| | | }
|
| | |
|
| | | // 验证是否存在数据库
|
| | | List<QualityFactory> listHas = selectionGoodsService.listQueryByAuctionId(listAuctionId);
|
| | | List<QualityFactory> listHas = qualityFactoryService.listQueryByAuctionId(listAuctionId);
|
| | |
|
| | | List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.controller.apph5;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.alibaba.fastjson.JSONArray;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.DeviceLotteryRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.ShamUser;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
|
| | | import com.yeshi.fanli.service.inter.user.DeviceLotteryRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.ShamUserService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | | * 用户
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Controller
|
| | | @RequestMapping("api/apph5/v1/user")
|
| | | public class AppH5UserController {
|
| | |
|
| | | @Resource
|
| | | private DeviceLotteryRecordService deviceLotteryRecordService;
|
| | | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | |
| | | @Resource
|
| | | private CommonOrderCountService commonOrderCountService;
|
| | | |
| | | @Resource
|
| | | private ShamUserService shamUserService;
|
| | | |
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | | @Resource
|
| | | private SystemCouponService systemCouponService;
|
| | | |
| | | |
| | | /**
|
| | | * 获取抽奖次数
|
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getLotteryCount")
|
| | | public void getLotteryCount(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | int count = 0;
|
| | | try {
|
| | | count = getSurplusCount(acceptData, uid);
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage()));
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | try {
|
| | | // 抽奖规则
|
| | | String lotteryRule = configService.get("lottery_rule_newbies");
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("rule", lotteryRule);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取抽奖次数
|
| | | * @param callback
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRadioList")
|
| | | public void getRadioList(String callback, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | // 随机20条数据
|
| | | List<ShamUser> listUser = shamUserService.listRandUser(20);
|
| | | |
| | | JSONArray array = new JSONArray();
|
| | | for (ShamUser shamUser: listUser) {
|
| | | JSONObject dataInfo = new JSONObject();
|
| | | |
| | | String name = shamUser.getName();
|
| | | if (name.length() == 1) {
|
| | | name = "Jx****" + name;
|
| | | } else {
|
| | | name = name.substring(0, 1) + "****" + name.substring(name.length() - 2, name.length() - 1);
|
| | | }
|
| | | |
| | | String prize = generateAward();
|
| | | if (prize == null) {
|
| | | prize = "抽中一张福利免单券";
|
| | | }
|
| | | |
| | | dataInfo.put("pic", shamUser.getPicUrl());
|
| | | dataInfo.put("content", name + ",抽中" + prize);
|
| | | array.add(dataInfo);
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("result_list", array);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取抽奖结果
|
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getLotteryResult")
|
| | | public void getLotteryResult(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | |
|
| | | int count = 0;
|
| | | try {
|
| | | count = getSurplusCount(acceptData, uid);
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage()));
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | try {
|
| | | String prize = "No_Prizes"; // freeCoupon 、 rebateCoupon
|
| | | |
| | | if (uid == null) { // 未登录
|
| | | int platformType = 0;
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equals(platform)) {
|
| | | platformType = 1;
|
| | | } else if ("ios".equals(platform)) {
|
| | | platformType = 2;
|
| | | } else {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("平台有误"));
|
| | | return;
|
| | | }
|
| | | |
| | | String device = acceptData.getDevice();
|
| | | if (device == null || device.trim().length() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("设备不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | List<DeviceLotteryRecord> list = deviceLotteryRecordService.listByPlatformAndDevice(platformType, device);
|
| | | if (list != null && list.size() == 5) { // 无抽奖机会
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "抽奖次数不足"));
|
| | | return;
|
| | | } else if (list != null && list.size() < 5 ){ // 拥有抽奖机会 |
| | | int hasPrize = 0;
|
| | | Long couponId = null;
|
| | | |
| | | for (DeviceLotteryRecord deviceLotteryRecord: list) {
|
| | | Long systemCouponId = deviceLotteryRecord.getSystemCouponId();
|
| | | if (systemCouponId != null) {
|
| | | hasPrize ++;
|
| | | couponId = systemCouponId;
|
| | | }
|
| | | }
|
| | | |
| | | // 前3次没有奖励时、后面两次必中
|
| | | if (hasPrize == 0 && list.size() == 3) {
|
| | | long result = (1 + Math.round(Math.random() * (9)));
|
| | | |
| | | if (result <=5) {
|
| | | prize = CouponTypeEnum.welfareFreeCoupon.name(); // 福利免费券
|
| | | } else {
|
| | | prize = CouponTypeEnum.rebatePercentCoupon.name(); // 奖励券
|
| | | }
|
| | | |
| | | } else if (hasPrize == 1 && list.size() == 4) {
|
| | | SystemCoupon systemCoupon = systemCouponService.selectByPrimaryKey(couponId);
|
| | | |
| | | if (systemCoupon != null) {
|
| | | CouponTypeEnum type = systemCoupon.getType();
|
| | | if (type == CouponTypeEnum.welfareFreeCoupon) {
|
| | | prize = CouponTypeEnum.rebatePercentCoupon.name(); // 奖励券
|
| | | } else {
|
| | | prize = CouponTypeEnum.welfareFreeCoupon.name(); // 福利免费券
|
| | | }
|
| | | } else {
|
| | | prize = CouponTypeEnum.rebatePercentCoupon.name(); // 奖励券
|
| | | }
|
| | | } else { // 大于3次机会
|
| | | |
| | | if (hasPrize < 2 ) { // 不足两个奖品
|
| | | |
| | | } else {
|
| | | |
| | | }
|
| | | |
| | | |
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | }
|
| | | |
| | | } else { //已登录
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("信息不正确"));
|
| | | return;
|
| | | }
|
| | | |
| | | Integer lotteryNewbies = userInfoExtra.getLotteryNewbies();
|
| | | if (lotteryNewbies == null ) { // 未抽过
|
| | | // 是否有过订单:返利、分享订单
|
| | | boolean hasOrder = commonOrderCountService.hasRebateAndShareOrder(uid);
|
| | | if (hasOrder) {
|
| | | count = 0; // 不算新用户
|
| | | }
|
| | | |
| | | } else {
|
| | | count = lotteryNewbies; // 剩余次数
|
| | | }
|
| | | }
|
| | | |
| | | // 抽奖规则
|
| | | String lotteryRule = configService.get("lottery_rule_newbies");
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("rule", lotteryRule);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | /**
|
| | | * 获取抽奖结果
|
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | public int getSurplusCount(AcceptData acceptData, Long uid) throws Exception {
|
| | |
|
| | | //默认最大抽奖次数
|
| | | int count = 5;
|
| | | |
| | | if (uid == null) { // 未登录
|
| | | int platformType = 0;
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equals(platform)) {
|
| | | platformType = 1;
|
| | | } else if ("ios".equals(platform)) {
|
| | | platformType = 2;
|
| | | } else {
|
| | | throw new Exception("平台有误");
|
| | | }
|
| | | |
| | | String device = acceptData.getDevice();
|
| | | if (device == null || device.trim().length() == 0) {
|
| | | throw new Exception("设备不存在");
|
| | | }
|
| | | |
| | | List<DeviceLotteryRecord> list = deviceLotteryRecordService.listByPlatformAndDevice(platformType, device);
|
| | | if (list != null && list.size() > 0) {
|
| | | count = count - list.size();
|
| | | }
|
| | | |
| | | } else { //已登录
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra == null) {
|
| | | throw new Exception("信息不正确");
|
| | | }
|
| | | |
| | | Integer lotteryNewbies = userInfoExtra.getLotteryNewbies();
|
| | | if (lotteryNewbies == null ) { // 未抽过
|
| | | // 是否有过订单:返利、分享订单
|
| | | boolean hasOrder = commonOrderCountService.hasRebateAndShareOrder(uid);
|
| | | if (hasOrder) {
|
| | | count = 0; // 不算新用户
|
| | | }
|
| | | |
| | | } else {
|
| | | count = lotteryNewbies; // 剩余次数
|
| | | }
|
| | | }
|
| | | |
| | | return count;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /**
|
| | | * 生成奖项
|
| | | * |
| | | * @return
|
| | | */
|
| | | public String generateAward() {
|
| | | |
| | | RandomGift randomGift1 = new RandomGift();
|
| | | randomGift1.prize = "抽中华为手机20一台";
|
| | | randomGift1.probability = 2;
|
| | | |
| | | RandomGift randomGift2 = new RandomGift();
|
| | | randomGift2.prize = "现金红包¥188";
|
| | | randomGift2.probability = 5;
|
| | | |
| | | RandomGift randomGift3 = new RandomGift();
|
| | | randomGift3.prize = "现金红包¥88";
|
| | | randomGift3.probability = 13;
|
| | | |
| | | RandomGift randomGift4 = new RandomGift();
|
| | | randomGift4.prize = "一张福利免单券";
|
| | | randomGift4.probability = 40;
|
| | | |
| | | RandomGift randomGift5 = new RandomGift();
|
| | | randomGift5.prize = "一张返利奖励券";
|
| | | randomGift5.probability = 40;
|
| | | |
| | | List<RandomGift> giftList = new ArrayList<RandomGift>();
|
| | | giftList.add(randomGift1);
|
| | | giftList.add(randomGift2);
|
| | | giftList.add(randomGift3);
|
| | | giftList.add(randomGift4);
|
| | | giftList.add(randomGift5);
|
| | | |
| | | long result = (1 + Math.round(Math.random() * (99)));
|
| | | |
| | | int minRange = 0;
|
| | | int maxRange = 0;
|
| | | |
| | | String prize = null;
|
| | | |
| | | for (int i = 0; i < giftList.size(); i++) {
|
| | | RandomGift obj2 = giftList.get(i);
|
| | | int probability = obj2.probability;
|
| | | |
| | | maxRange = maxRange + probability;
|
| | | minRange = 100 - maxRange;
|
| | | |
| | | if (probability != 0) {
|
| | | if (result > minRange && result <= maxRange) {
|
| | | prize = obj2.prize;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | return prize;
|
| | | }
|
| | |
|
| | | class RandomGift {
|
| | | public String prize;// 奖项
|
| | | public int probability; // 概率
|
| | | }
|
| | | }
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 活动列表
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getSpecialActivities")
|
| | | public void getSpecialActivities(AcceptData acceptData, PrintWriter out) {
|
| | |
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | // 专题活动
|
| | | String specialCard = "special_activities";
|
| | | |
| | | List<Special> listSpecial = specialService.listPageBySystemAndCard(0, Integer.MAX_VALUE, |
| | | specialCard, system.getId());
|
| | |
|
| | | if (listSpecial != null && listSpecial.size() > 0) {
|
| | | for (Special special : listSpecial) {
|
| | | special.setCreatetime(null);
|
| | | special.setUpdatetime(null);
|
| | | special.setState(null);
|
| | | special.setRemark(null);
|
| | | special.setCard(null);
|
| | | special.setCardId(null);
|
| | | |
| | | JumpDetailV2 jumpDetail = special.getJumpDetail();
|
| | | if (jumpDetail != null) {
|
| | | jumpDetail.setId(null);
|
| | | jumpDetail.setName(null);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("special", listSpecial);
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.controller.client;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.exception.user.UserSystemCouponException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponRecordVO;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | | * 福利中心
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Controller
|
| | | @RequestMapping("api/v1/user/coupon")
|
| | | public class UserCouponController {
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private UserSystemCouponService UserSystemCouponService;
|
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | | |
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | | |
| | | /**
|
| | | * 用户券列表查询
|
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getCouponList", method = RequestMethod.POST)
|
| | | public void getCouponList(AcceptData acceptData, Integer page, Long uid, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | if (page == null || page < 1) {
|
| | | page = 1;
|
| | | }
|
| | | |
| | | // 福利中心图片
|
| | | String topPicture = null; |
| | | if(page == 1) {
|
| | | List<SwiperPicture> listswiper = swiperPictureService.getByBannerCard("welfare_top");
|
| | | if (listswiper != null && listswiper.size() > 0) {
|
| | | topPicture = listswiper.get(0).getSrc();
|
| | | }
|
| | | }
|
| | | |
| | | long count = 0;
|
| | | List<UserSystemCouponVO> resultList = UserSystemCouponService.getUserCouponVOList((page - 1) * Constant.PAGE_SIZE, |
| | | Constant.PAGE_SIZE, uid );
|
| | | |
| | | if (resultList != null && resultList.size() > 0) {
|
| | | count = UserSystemCouponService.countUserCouponList(uid);
|
| | | } else if (resultList == null) {
|
| | | resultList = new ArrayList<UserSystemCouponVO>();
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("topPicture", topPicture);
|
| | | data.put("count", count);
|
| | | data.put("result_list", JsonUtil.getApiCommonGson().toJson(resultList));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (UserSystemCouponException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 用户奖励券
|
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getGoodsCouponList", method = RequestMethod.POST)
|
| | | public void getGoodsCouponList(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | List<UserSystemCouponVO> resultList = UserSystemCouponService.getGoodsCouponList(uid);
|
| | | |
| | | if (resultList == null ) {
|
| | | resultList =new ArrayList<UserSystemCouponVO>();
|
| | | }
|
| | | |
| | | JSONObject dataTip = new JSONObject();
|
| | | dataTip.put("content", configService.get("free_coupon_tip"));
|
| | | dataTip.put("fontColor", "#F14242");
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("helpLink", configService.get("free_coupon_help"));
|
| | | data.put("tip", dataTip);
|
| | | data.put("count", resultList.size());
|
| | | data.put("result_list", JsonUtil.getApiCommonGson().toJson(resultList));
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (UserSystemCouponException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 免单券使用记录 以及状态修改
|
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "useFreeCoupon", method = RequestMethod.POST)
|
| | | public void useFreeCoupon(AcceptData acceptData, Long uid, Long cid, Long goodId, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | UserSystemCouponService.useGoodsCoupon(uid, cid, goodId);
|
| | | out.print(JsonUtil.loadTrueResult("使用成功"));
|
| | | } catch (UserSystemCouponException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "使用失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 用户奖励券
|
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getOrderCouponList", method = RequestMethod.POST)
|
| | | public void getOrderCouponList(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | |
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | List<UserSystemCouponVO> resultList = UserSystemCouponService.getOrderCouponList(uid);
|
| | | |
| | | if (resultList == null ) {
|
| | | resultList =new ArrayList<UserSystemCouponVO>();
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("helpLink", configService.get("reward_coupon_help"));
|
| | | data.put("count", resultList.size());
|
| | | data.put("result_list", JsonUtil.getApiCommonGson().toJson(resultList));
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (UserSystemCouponException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 免单券使用记录 以及状态修改
|
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "useRewardCoupon", method = RequestMethod.POST)
|
| | | public void useRewardCoupon(AcceptData acceptData, Long uid, Long cid, String orderNo, PrintWriter out) {
|
| | | |
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | UserSystemCouponService.useOrderCoupon(uid, cid, orderNo);
|
| | | |
| | | JSONObject data = commonOrderService.getRewardJumpInfo(orderNo);
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (UserSystemCouponException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "使用失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 订单-奖励进度详情
|
| | | * @param acceptData
|
| | | * @param orderNo 订单号
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRewardRecord", method = RequestMethod.POST)
|
| | | public void getRewardCounponRecord(AcceptData acceptData, String orderNo, PrintWriter out) {
|
| | | |
| | | try {
|
| | | |
| | | UserSystemCouponRecordVO rewardRecord = UserSystemCouponService.getRewardCouponRecord(orderNo);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("rewardRecord", rewardRecord);
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (UserSystemCouponException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 订单-奖励进度详情
|
| | | * @param acceptData
|
| | | * @param orderNo 订单号
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getFreeCounponRecord", method = RequestMethod.POST)
|
| | | public void getFreeCounponRecord(AcceptData acceptData, String orderNo, PrintWriter out) {
|
| | | |
| | | try {
|
| | | |
| | | UserSystemCouponRecordVO rewardRecord = UserSystemCouponService.getFreeCouponRecord(orderNo);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("frreCouponRecord", rewardRecord);
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (UserSystemCouponException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.system.SystemCoupon; |
| | | |
| | | public interface SystemCouponMapper extends BaseMapper<SystemCoupon> { |
| | | /** |
| | | * 批量删除 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | int deleteBatchByPrimaryKey(List<Long> list); |
| | | |
| | | /** |
| | | * 根据类型查询且启用券 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | List<SystemCoupon> getCouponListByType(@Param("list")List<String> list); |
| | | |
| | | } |
| | |
| | | */ |
| | | List<Special> listBySystemAndCard(@Param("card") String card, @Param("systemId") Long systemId); |
| | | |
| | | /** |
| | | * 根据标识、系统查询启用专题-分页 |
| | | * @param card |
| | | * @param systemId |
| | | * @return |
| | | */ |
| | | List<Special> listPageBySystemAndCard(@Param("start") long start, @Param("count") int count, |
| | | @Param("card") String card, @Param("systemId") Long systemId); |
| | | |
| | | } |
| | |
| | | @Param("day")Integer day); |
| | | |
| | | |
| | | /** |
| | | * 统计自购、分享有效订单数量 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | long countValidOrder(@Param("uid")Long uid); |
| | | |
| | | } |
| | |
| | | */ |
| | | List<CommonOrder> listBySourceTypeAndOrderNo(@Param("sourceType") int sourceType, @Param("orderNo") String orderNo); |
| | | |
| | | |
| | | /** |
| | | * 查询券奖励金额以及订单信息 |
| | | * @param uid |
| | | * @param state |
| | | * @param orderNo |
| | | * @return |
| | | */ |
| | | List<CommonOrderVO> getCouponHongbaoByOrderNo(@Param("uid") Long uid, @Param("hongBaoState") Integer hongBaoState, |
| | | @Param("orderNo") String orderNo); |
| | | |
| | | |
| | | /** |
| | | * 查询券奖励金额以及订单信息 |
| | | * @param uid |
| | | * @param state |
| | | * @param orderNo |
| | | * @return |
| | | */ |
| | | CommonOrderVO getCommonOrderByOrderNo(@Param("uid") Long uid, @Param("orderNo") String orderNo, |
| | | @Param("orderState") Integer orderState); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.DeviceLotteryRecord; |
| | | |
| | | public interface DeviceLotteryRecordMapper extends BaseMapper<DeviceLotteryRecord> { |
| | | |
| | | /** |
| | | * 根据 平台、设备 查询抽奖记录 |
| | | * @param platform |
| | | * @param device |
| | | * @return |
| | | */ |
| | | List<DeviceLotteryRecord> listByPlatformAndDevice(@Param("platform")int platform, @Param("device")String device); |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon; |
| | | import com.yeshi.fanli.vo.user.UserSystemCouponVO; |
| | | |
| | | public interface UserSystemCouponMapper extends BaseMapper<UserSystemCoupon> { |
| | | |
| | | List<UserSystemCoupon> getUserCouponList(@Param("start") long start, @Param("count") int count, |
| | | @Param("uid") Long uid); |
| | | |
| | | List<UserSystemCouponVO> getUserCouponVOList(@Param("start") long start, @Param("count") int count, |
| | | @Param("uid") Long uid); |
| | | |
| | | long countUserCouponList(@Param("uid") Long uid); |
| | | |
| | | /** |
| | | * 根据券id查询可使用券 |
| | | * @param uid |
| | | * @param typeList |
| | | * @return |
| | | */ |
| | | List<UserSystemCouponVO> getEnableListByCouponId(@Param("uid") Long uid, @Param("activated") Integer activated, |
| | | @Param("list") List<Long> listCouponId); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord; |
| | | |
| | | public interface UserSystemCouponRecordMapper extends BaseMapper<UserSystemCouponRecord> { |
| | | |
| | | /** |
| | | * 根据单个订单查询 |
| | | * @param uid |
| | | * @param activated |
| | | * @param listCouponId |
| | | * @return |
| | | */ |
| | | UserSystemCouponRecord getRecordByOrderNo(@Param("orderNo") String orderNo, @Param("state") Integer state); |
| | | |
| | | |
| | | /** |
| | | * 根据订单号列表查询 |
| | | * @param uid |
| | | * @param activated |
| | | * @param listCouponId |
| | | * @return |
| | | */ |
| | | List<UserSystemCouponRecord> getRecordByOrderNoList(@Param("list") List<String> list); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | | /**
|
| | | * 设备抽奖获得记录
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_device_lottery_record")
|
| | | public class DeviceLotteryRecord {
|
| | |
|
| | | @Expose
|
| | | @Column(name = "dlr_id")
|
| | | private Long id;
|
| | |
|
| | | // 平台 1-android 2-ios
|
| | | @Column(name = "dlr_platform")
|
| | | private Integer platform;
|
| | |
|
| | | // 设备
|
| | | @Column(name = "dlr_device")
|
| | | private String device;
|
| | |
|
| | | // 系统券
|
| | | @Expose
|
| | | @Column(name = "dlr_system_counpon_id")
|
| | | private Long systemCouponId;
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "dlr_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Integer getPlatform() {
|
| | | return platform;
|
| | | }
|
| | |
|
| | | public void setPlatform(Integer platform) {
|
| | | this.platform = platform;
|
| | | }
|
| | |
|
| | | public String getDevice() {
|
| | | return device;
|
| | | }
|
| | |
|
| | | public void setDevice(String device) {
|
| | | this.device = device;
|
| | | }
|
| | |
|
| | | public Long getSystemCouponId() {
|
| | | return systemCouponId;
|
| | | }
|
| | |
|
| | | public void setSystemCouponId(Long systemCouponId) {
|
| | | this.systemCouponId = systemCouponId;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | // 新人红包
|
| | | public final static int TYPE_XINREN = 4;
|
| | |
|
| | | // 使用券红包
|
| | | public final static int TYPE_COUPON = 10;
|
| | | |
| | |
|
| | | public final static int TYPE_YAOQING = 5;
|
| | | // 一级分销红包
|
| | |
| | | @Column(name = "uie_invite_code")
|
| | | private String inviteCode;
|
| | |
|
| | | // 新人抽奖次数
|
| | | @Column(name = "uie_lottery_newbies")
|
| | | private Integer lotteryNewbies;
|
| | |
|
| | | |
| | | // 创建时间
|
| | | @Column(name = "uie_create_time")
|
| | | private Date createTime;
|
| | |
| | | public void setInviteCode(String inviteCode) {
|
| | | this.inviteCode = inviteCode;
|
| | | }
|
| | |
|
| | | public Integer getLotteryNewbies() {
|
| | | return lotteryNewbies;
|
| | | }
|
| | |
|
| | | public void setLotteryNewbies(Integer lotteryNewbies) {
|
| | | this.lotteryNewbies = lotteryNewbies;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | |
|
| | | /**
|
| | | * 用户获得券
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_user_system_coupon")
|
| | | public class UserSystemCoupon {
|
| | |
|
| | | // 状态:未使用1、使用中2、已使用3、已过期4
|
| | | public final static int STATE_CAN_USE = 1;
|
| | | public final static int STATE_IN_USE = 2;
|
| | | public final static int STATE_END_USE = 3;
|
| | | public final static int STATE_OVERDUE = 4;
|
| | | |
| | | |
| | | // 来源: 新人抽奖、邀请奖励
|
| | | public final static String SOURCE_CHOUJIANG = "新人抽奖";
|
| | | public final static String SOURCE_YAOQING = "邀请奖励";
|
| | | |
| | | @Expose
|
| | | @Column(name = "usc_id")
|
| | | private Long id;
|
| | |
|
| | | // 用户id
|
| | | @Column(name = "usc_uid")
|
| | | private Long uid;
|
| | |
|
| | | // 券
|
| | | @Column(name = "usc_coupon_id")
|
| | | private SystemCoupon systemCoupon;
|
| | |
|
| | | // 券来源
|
| | | @Expose
|
| | | @Column(name = "usc_source")
|
| | | private String source;
|
| | |
|
| | | // 状态
|
| | | @Expose
|
| | | @Column(name = "usc_state")
|
| | | private Integer state;
|
| | | |
| | | // 激活状态 未激活0 已激活1
|
| | | @Expose
|
| | | @Column(name = "usc_state_activate")
|
| | | private Integer stateActivated;
|
| | |
|
| | | // 起始时间
|
| | | @Column(name = "usc_start_time")
|
| | | private Date startTime;
|
| | |
|
| | | // 结束时间
|
| | | @Column(name = "usc_end_time")
|
| | | private Date endTime;
|
| | | |
| | | // 使用时间
|
| | | @Column(name = "usc_use_time")
|
| | | private Date useTime;
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "usc_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | // 更新时间
|
| | | @Column(name = "usc_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public SystemCoupon getSystemCoupon() {
|
| | | return systemCoupon;
|
| | | }
|
| | |
|
| | | public void setSystemCoupon(SystemCoupon systemCoupon) {
|
| | | this.systemCoupon = systemCoupon;
|
| | | }
|
| | |
|
| | | public String getSource() {
|
| | | return source;
|
| | | }
|
| | |
|
| | | public void setSource(String source) {
|
| | | this.source = source;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public Date getStartTime() {
|
| | | return startTime;
|
| | | }
|
| | |
|
| | | public void setStartTime(Date startTime) {
|
| | | this.startTime = startTime;
|
| | | }
|
| | |
|
| | | public Date getEndTime() {
|
| | | return endTime;
|
| | | }
|
| | |
|
| | | public void setEndTime(Date endTime) {
|
| | | this.endTime = endTime;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public Date getUseTime() {
|
| | | return useTime;
|
| | | }
|
| | |
|
| | | public void setUseTime(Date useTime) {
|
| | | this.useTime = useTime;
|
| | | }
|
| | |
|
| | | public Integer getStateActivated() {
|
| | | return stateActivated;
|
| | | }
|
| | |
|
| | | public void setStateActivated(Integer stateActivated) {
|
| | | this.stateActivated = stateActivated;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 用户券使用记录
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_user_system_coupon_record")
|
| | | public class UserSystemCouponRecord {
|
| | |
|
| | | // 状态: 匹配中0 规则不匹配1 退款退回4 免单中2 使用成功3
|
| | | public final static int STATE_WAIT= 0;
|
| | | public final static int STATE_FAIL_RULE =1;
|
| | | public final static int STATE_FAIL_DRAWBACK = 4;
|
| | | |
| | | public final static int STATE_FREE_ON = 2;
|
| | | public final static int STATE_SUCCESS = 3;
|
| | | |
| | | |
| | | @Column(name = "ucr_id")
|
| | | private Long id;
|
| | |
|
| | | // 商品id
|
| | | @Column(name = "ucr_good_id")
|
| | | private Long goodId;
|
| | |
|
| | | // 商品来源
|
| | | @Column(name = "ucr_good_source")
|
| | | private int goodSource;
|
| | |
|
| | | // 用户券
|
| | | @Column(name = "ucr_user_coupon_id")
|
| | | private UserSystemCoupon userSystemCoupon;
|
| | | |
| | | // 券类型
|
| | | @Column(name = "ucr_coupon_type")
|
| | | private String couponType;
|
| | |
|
| | | // 订单号
|
| | | @Column(name = "ucr_order_no")
|
| | | private String orderNo;
|
| | |
|
| | | // 状态: 待匹配0 使用成功1 规则不匹配2 退款退回3
|
| | | @Column(name = "ucr_state")
|
| | | private Integer state;
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "ucr_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | // 更新时间
|
| | | @Column(name = "ucr_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getGoodId() {
|
| | | return goodId;
|
| | | }
|
| | |
|
| | | public void setGoodId(Long goodId) {
|
| | | this.goodId = goodId;
|
| | | }
|
| | |
|
| | | public int getGoodSource() {
|
| | | return goodSource;
|
| | | }
|
| | |
|
| | | public void setGoodSource(int goodSource) {
|
| | | this.goodSource = goodSource;
|
| | | }
|
| | |
|
| | | public UserSystemCoupon getUserSystemCoupon() {
|
| | | return userSystemCoupon;
|
| | | }
|
| | |
|
| | | public void setUserSystemCoupon(UserSystemCoupon userSystemCoupon) {
|
| | | this.userSystemCoupon = userSystemCoupon;
|
| | | }
|
| | |
|
| | | public String getOrderNo() {
|
| | | return orderNo;
|
| | | }
|
| | |
|
| | | public void setOrderNo(String orderNo) {
|
| | | this.orderNo = orderNo;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | | |
| | | public String getCouponType() {
|
| | | return couponType;
|
| | | }
|
| | |
|
| | | public void setCouponType(String couponType) {
|
| | | this.couponType = couponType;
|
| | | }
|
| | | }
|
| | |
| | | import javax.persistence.Id;
|
| | | import javax.persistence.Table;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | | /**
|
| | | * 跳转详情-v2版
|
| | | *
|
| | |
| | | private String name;
|
| | |
|
| | | // Android链接
|
| | | @Expose
|
| | | @Column(name = "jp_activity")
|
| | | @org.yeshi.utils.mybatis.Column(name = "jp_activity")
|
| | | private String activity;
|
| | |
|
| | | // IOS跳转链接
|
| | | @Expose
|
| | | @Column(name = "jp_controller")
|
| | | @org.yeshi.utils.mybatis.Column(name = "jp_controller")
|
| | | private String controller;
|
| | |
|
| | | // 跳转类型
|
| | | @Expose
|
| | | @Column(name = "jp_type")
|
| | | @org.yeshi.utils.mybatis.Column(name = "jp_type")
|
| | | private String type;
|
New file |
| | |
| | | package com.yeshi.fanli.entity.system;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 本地自定义券信息
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_system_coupon")
|
| | | public class SystemCoupon {
|
| | |
|
| | | // 券类型
|
| | | public enum CouponTypeEnum {
|
| | | freeCoupon("免单"), welfareFreeCoupon("福利免单"), rebatePercentCoupon("返利比提成奖励券");
|
| | |
|
| | | private final String desc;
|
| | |
|
| | | private CouponTypeEnum(String desc) {
|
| | | this.desc = desc;
|
| | | }
|
| | |
|
| | | public String getDesc() {
|
| | | return desc;
|
| | | }
|
| | | }
|
| | |
|
| | | @Column(name = "sc_id")
|
| | | private Long id;
|
| | |
|
| | | // 用户id
|
| | | @Column(name = "sc_name")
|
| | | private String name;
|
| | |
|
| | | // 图片
|
| | | @Column(name = "sc_picture")
|
| | | private String picture;
|
| | | |
| | | // 简介作用:任性0元购、再返10%
|
| | | @Column(name = "sc_effect")
|
| | | private String effect;
|
| | | |
| | | // 券类型
|
| | | @Column(name = "sc_type")
|
| | | private CouponTypeEnum type;
|
| | |
|
| | | // 券面返利比例值
|
| | | @Column(name = "sc_percent")
|
| | | private BigDecimal percent;
|
| | |
|
| | | // 券面值
|
| | | @Column(name = "sc_amount")
|
| | | private String amount;
|
| | |
|
| | | // 有效期天数
|
| | | @Column(name = "sc_expiry_day")
|
| | | private Integer expiryDay;
|
| | |
|
| | | // 规则
|
| | | @Column(name = "sc_rule")
|
| | | private String rule;
|
| | |
|
| | | // 备注说明
|
| | | @Column(name = "sc_remark")
|
| | | private String remark;
|
| | |
|
| | | // 领取数量
|
| | | @Column(name = "sc_receive_count")
|
| | | private Integer receiveCount;
|
| | |
|
| | | // 状态 0未启用 1已启用
|
| | | @Column(name = "sc_state")
|
| | | private Integer state;
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "sc_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | // 更新时间
|
| | | @Column(name = "sc_update_time")
|
| | | private Date updateTime;
|
| | | |
| | | public SystemCoupon() {}
|
| | | |
| | | public SystemCoupon(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | |
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getName() {
|
| | | return name;
|
| | | }
|
| | |
|
| | | public void setName(String name) {
|
| | | this.name = name;
|
| | | }
|
| | |
|
| | | public String getPicture() {
|
| | | return picture;
|
| | | }
|
| | |
|
| | | public void setPicture(String picture) {
|
| | | this.picture = picture;
|
| | | }
|
| | |
|
| | | public CouponTypeEnum getType() {
|
| | | return type;
|
| | | }
|
| | |
|
| | | public void setType(CouponTypeEnum type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | public BigDecimal getPercent() {
|
| | | return percent;
|
| | | }
|
| | |
|
| | | public void setPercent(BigDecimal percent) {
|
| | | this.percent = percent;
|
| | | }
|
| | |
|
| | | public String getAmount() {
|
| | | return amount;
|
| | | }
|
| | |
|
| | | public void setAmount(String amount) {
|
| | | this.amount = amount;
|
| | | }
|
| | |
|
| | | public Integer getExpiryDay() {
|
| | | return expiryDay;
|
| | | }
|
| | |
|
| | | public void setExpiryDay(Integer expiryDay) {
|
| | | this.expiryDay = expiryDay;
|
| | | }
|
| | |
|
| | | public String getRule() {
|
| | | return rule;
|
| | | }
|
| | |
|
| | | public void setRule(String rule) {
|
| | | this.rule = rule;
|
| | | }
|
| | |
|
| | | public String getRemark() {
|
| | | return remark;
|
| | | }
|
| | |
|
| | | public void setRemark(String remark) {
|
| | | this.remark = remark;
|
| | | }
|
| | |
|
| | | public Integer getReceiveCount() {
|
| | | return receiveCount;
|
| | | }
|
| | |
|
| | | public void setReceiveCount(Integer receiveCount) {
|
| | | this.receiveCount = receiveCount;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public String getEffect() {
|
| | | return effect;
|
| | | }
|
| | |
|
| | | public void setEffect(String effect) {
|
| | | this.effect = effect;
|
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.user; |
| | | |
| | | public class UserSystemCouponException extends Exception { |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | private int code; |
| | | private String msg; |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public UserSystemCouponException(int code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public UserSystemCouponException() { |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return this.msg; |
| | | } |
| | | |
| | | } |
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.yeshi.fanli.dao.mybatis.SystemCouponMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.system.SystemCoupon"> |
| | | <id column="sc_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="sc_name" property="name" jdbcType="VARCHAR"/> |
| | | <result column="sc_picture" property="picture" jdbcType="VARCHAR"/> |
| | | <result column="sc_effect" property="effect" jdbcType="VARCHAR"/> |
| | | <result column="sc_type" property="type" jdbcType="VARCHAR"/> |
| | | <result column="sc_percent" property="percent" jdbcType="DECIMAL"/> |
| | | <result column="sc_amount" property="amount" jdbcType="VARCHAR"/> |
| | | <result column="sc_expiry_day" property="expiryDay" jdbcType="INTEGER"/> |
| | | <result column="sc_rule" property="rule" jdbcType="VARCHAR"/> |
| | | <result column="sc_remark" property="remark" jdbcType="VARCHAR"/> |
| | | <result column="sc_receive_count" property="receiveCount" jdbcType="INTEGER"/> |
| | | <result column="sc_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="sc_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="sc_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">sc_id,sc_name,sc_picture,sc_effect,sc_type,sc_percent,sc_amount,sc_expiry_day,sc_rule,sc_remark,sc_receive_count,sc_state,sc_create_time,sc_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_system_coupon where sc_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_system_coupon where sc_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.system.SystemCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_system_coupon (sc_id,sc_name,sc_picture,sc_effect,sc_type,sc_percent,sc_amount,sc_expiry_day,sc_rule,sc_remark,sc_receive_count,sc_state,sc_create_time,sc_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{effect,jdbcType=VARCHAR},#{type,jdbcType=VARCHAR},#{percent,jdbcType=DECIMAL},#{amount,jdbcType=VARCHAR},#{expiryDay,jdbcType=INTEGER},#{rule,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{receiveCount,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.system.SystemCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_system_coupon |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">sc_id,</if> |
| | | <if test="name != null">sc_name,</if> |
| | | <if test="picture != null">sc_picture,</if> |
| | | <if test="effect != null">sc_effect,</if> |
| | | <if test="type != null">sc_type,</if> |
| | | <if test="percent != null">sc_percent,</if> |
| | | <if test="amount != null">sc_amount,</if> |
| | | <if test="expiryDay != null">sc_expiry_day,</if> |
| | | <if test="rule != null">sc_rule,</if> |
| | | <if test="remark != null">sc_remark,</if> |
| | | <if test="receiveCount != null">sc_receive_count,</if> |
| | | <if test="state != null">sc_state,</if> |
| | | <if test="createTime != null">sc_create_time,</if> |
| | | <if test="updateTime != null">sc_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="effect != null">#{effect,jdbcType=VARCHAR},</if> |
| | | <if test="type != null">#{type,jdbcType=VARCHAR},</if> |
| | | <if test="percent != null">#{percent,jdbcType=DECIMAL},</if> |
| | | <if test="amount != null">#{amount,jdbcType=VARCHAR},</if> |
| | | <if test="expiryDay != null">#{expiryDay,jdbcType=INTEGER},</if> |
| | | <if test="rule != null">#{rule,jdbcType=VARCHAR},</if> |
| | | <if test="remark != null">#{remark,jdbcType=VARCHAR},</if> |
| | | <if test="receiveCount != null">#{receiveCount,jdbcType=INTEGER},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.system.SystemCoupon">update yeshi_ec_system_coupon set sc_name = #{name,jdbcType=VARCHAR},sc_picture = #{picture,jdbcType=VARCHAR},sc_effect = #{effect,jdbcType=VARCHAR},sc_type = #{type,jdbcType=VARCHAR},sc_percent = #{percent,jdbcType=DECIMAL},sc_amount = #{amount,jdbcType=VARCHAR},sc_expiry_day = #{expiryDay,jdbcType=INTEGER},sc_rule = #{rule,jdbcType=VARCHAR},sc_remark = #{remark,jdbcType=VARCHAR},sc_receive_count = #{receiveCount,jdbcType=INTEGER},sc_state = #{state,jdbcType=INTEGER},sc_create_time = #{createTime,jdbcType=TIMESTAMP},sc_update_time = #{updateTime,jdbcType=TIMESTAMP} where sc_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.system.SystemCoupon">update yeshi_ec_system_coupon |
| | | <set> |
| | | <if test="name != null">sc_name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">sc_picture=#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="effect != null">sc_effect=#{effect,jdbcType=VARCHAR},</if> |
| | | <if test="type != null">sc_type=#{type,jdbcType=VARCHAR},</if> |
| | | <if test="percent != null">sc_percent=#{percent,jdbcType=DECIMAL},</if> |
| | | <if test="amount != null">sc_amount=#{amount,jdbcType=VARCHAR},</if> |
| | | <if test="expiryDay != null">sc_expiry_day=#{expiryDay,jdbcType=INTEGER},</if> |
| | | <if test="rule != null">sc_rule=#{rule,jdbcType=VARCHAR},</if> |
| | | <if test="remark != null">sc_remark=#{remark,jdbcType=VARCHAR},</if> |
| | | <if test="receiveCount != null">sc_receive_count=#{receiveCount,jdbcType=INTEGER},</if> |
| | | <if test="state != null">sc_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">sc_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">sc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where sc_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <delete id="deleteBatchByPrimaryKey" parameterType="java.util.List"> |
| | | delete FROM yeshi_ec_system_coupon WHERE sc_id in |
| | | <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | </delete> |
| | | |
| | | <select id="getCouponListByType" resultMap="BaseResultMap" parameterType="java.util.List"> |
| | | select * FROM yeshi_ec_system_coupon |
| | | WHERE sc_state = 1 |
| | | AND sc_type in |
| | | <foreach collection="list" index="index" item="item" open="(" close=")" |
| | | separator=",">'${item}'</foreach> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | ORDER BY p.`b_orderby` |
| | | </select> |
| | | |
| | | <select id="listPageBySystemAndCard" resultMap="BaseResultMap"> |
| | | SELECT p.* FROM `yeshi_ec_special` p LEFT JOIN `yeshi_ec_special_card` c ON p.`b_card_id` = c.`cd_id` |
| | | LEFT JOIN `yeshi_ec_super_special_card` s ON s.`sp_special_cid` = c.`cd_id` |
| | | WHERE p.`b_state` = 0 AND c.`cd_state` = 0 AND s.sp_id is not null |
| | | AND c.`cd_card` = #{card} AND s.`sp_system_id` = #{systemId} |
| | | ORDER BY p.`b_orderby` |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | )A |
| | | </select> |
| | | |
| | | <select id="countValidOrder" resultType="java.lang.Long"> |
| | | SELECT IFNULL(COUNT(co.`co_id`),0) FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= #{uid} AND v2.`hb_type` IN(1,20))hb |
| | | ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL AND <![CDATA[co.`co_state` <> 4]]> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | |
| | | <result column="totalMoney" property="hongBao" jdbcType="DECIMAL" /> |
| | | <result column="couponMoney" property="couponMoney" jdbcType="DECIMAL" /> |
| | | |
| | | <result column="hongBaoState" property="hongBaoState" jdbcType="INTEGER" /> |
| | | <result column="hongBaoType" property="hongBaoType" jdbcType="INTEGER" /> |
| | | <result column="accountTime" property="accountTime" jdbcType="TIMESTAMP" /> |
| | |
| | | FROM yeshi_ec_hongbao_order ho |
| | | |
| | | LEFT JOIN (SELECT <include refid="Hongbao_Column_List"/> FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= #{uid} |
| | | WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE"/> <!-- 红包类型 --> |
| | | )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | |
| | | SELECT IFNULL(COUNT(ho_id),0) FROM |
| | | (SELECT ho.ho_id FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN (SELECT <include refid="Hongbao_Column_List"/> FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= #{uid} |
| | | WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE"/> <!-- 红包类型 --> |
| | | )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getCouponHongbaoByOrderNo" resultMap="ResultMap"> |
| | | SELECT COALESCE(SUM(IF(hb.hb_type=1,hb.`hb_money`,0)),0)AS totalMoney, |
| | | COALESCE(SUM(IF(hb.hb_type=10,hb.`hb_money`,0)),0)AS couponMoney, |
| | | hb.`hb_type` AS hongBaoType, |
| | | MAX(hb.`hb_get_time`) AS accountTime, |
| | | MAX(hb.`hb_pre_get_time`) AS preAccountTime, |
| | | hb.hb_state AS hongBaoState, |
| | | <include refid="Order_Column_List"/> |
| | | FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} |
| | | <if test="hongBaoState != null"> |
| | | AND v2.`hb_state` = #{hongBaoState} |
| | | </if> |
| | | )hb ON hb.hb_id = ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL AND co.co_order_no = #{orderNo} |
| | | </select> |
| | | |
| | | <select id="getCommonOrderByOrderNo" resultMap="ResultMap"> |
| | | <!-- 查询用户订单 --> |
| | | SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalMoney, COALESCE(SUM(co.`co_payment`),0)AS totalPayment, |
| | | hb.hb_state AS hongBaoState, |
| | | hb.`hb_type` AS hongBaoType, |
| | | <include refid="Order_Column_List"/> |
| | | FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN (SELECT <include refid="Hongbao_Column_List"/> FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> |
| | | )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL AND co.co_order_no = #{orderNo} |
| | | <if test="orderState != null"> |
| | | AND co.co_state = #{orderState} <!-- 已收货 --> |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` |
| | | </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.yeshi.fanli.dao.mybatis.user.DeviceLotteryRecordMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.DeviceLotteryRecord"> |
| | | <id column="dlr_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="dlr_platform" property="platform" jdbcType="INTEGER"/> |
| | | <result column="dlr_device" property="device" jdbcType="VARCHAR"/> |
| | | <result column="dlr_system_counpon_id" property="systemCouponId" jdbcType="BIGINT"/> |
| | | <result column="dlr_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">dlr_id,dlr_platform,dlr_device,dlr_system_counpon_id,dlr_create_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_device_lottery_record where dlr_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_device_lottery_record where dlr_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.DeviceLotteryRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_device_lottery_record (dlr_id,dlr_platform,dlr_device,dlr_system_counpon_id,dlr_create_time) values (#{id,jdbcType=BIGINT},#{platform,jdbcType=INTEGER},#{device,jdbcType=VARCHAR},#{systemCouponId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.DeviceLotteryRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_device_lottery_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">dlr_id,</if> |
| | | <if test="platform != null">dlr_platform,</if> |
| | | <if test="device != null">dlr_device,</if> |
| | | <if test="systemCouponId != null">dlr_system_counpon_id,</if> |
| | | <if test="createTime != null">dlr_create_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="platform != null">#{platform,jdbcType=INTEGER},</if> |
| | | <if test="device != null">#{device,jdbcType=VARCHAR},</if> |
| | | <if test="systemCouponId != null">#{systemCouponId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.DeviceLotteryRecord">update yeshi_device_lottery_record set dlr_platform = #{platform,jdbcType=INTEGER},dlr_device = #{device,jdbcType=VARCHAR},dlr_system_counpon_id = #{systemCouponId,jdbcType=BIGINT},dlr_create_time = #{createTime,jdbcType=TIMESTAMP} where dlr_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.DeviceLotteryRecord">update yeshi_device_lottery_record |
| | | <set> |
| | | <if test="platform != null">dlr_platform=#{platform,jdbcType=INTEGER},</if> |
| | | <if test="device != null">dlr_device=#{device,jdbcType=VARCHAR},</if> |
| | | <if test="systemCouponId != null">dlr_system_counpon_id=#{systemCouponId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">dlr_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where dlr_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="listByPlatformAndDevice" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_device_lottery_record |
| | | WHERE `dlr_platform` = #{platform} AND `dlr_device`= #{device} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result column="uie_rank_order_num" property="rankOrderNum" jdbcType="INTEGER"/> |
| | | <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/> |
| | | <result column="uie_lottery_newbies" property="lotteryNewbies" jdbcType="INTEGER"/> |
| | | <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | |
| | | <result column="uie_rank_order_num" property="rankOrderNum" jdbcType="INTEGER"/> |
| | | <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/> |
| | | <result column="uie_lottery_newbies" property="lotteryNewbies" jdbcType="INTEGER"/> |
| | | <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | |
| | | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_create_time,uie_update_time</sql> |
| | | <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_create_time,uie_update_time</sql> |
| | | |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT} |
| | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT}</delete> |
| | | |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_extra (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_create_time,uie_update_time) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_extra (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_create_time,uie_update_time) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{lotteryNewbies,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_extra |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="rankOrderNum != null">uie_rank_order_num,</if> |
| | | <if test="rankUpdateTime != null">uie_rank_update_time,</if> |
| | | <if test="inviteCode != null">uie_invite_code,</if> |
| | | <if test="lotteryNewbies != null">uie_lottery_newbies,</if> |
| | | <if test="createTime != null">uie_create_time,</if> |
| | | <if test="updateTime != null">uie_update_time,</if> |
| | | </trim>values |
| | |
| | | <if test="rankOrderNum != null">#{rankOrderNum,jdbcType=INTEGER},</if> |
| | | <if test="rankUpdateTime != null">#{rankUpdateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="inviteCode != null">#{inviteCode,jdbcType=VARCHAR},</if> |
| | | <if test="lotteryNewbies != null">#{lotteryNewbies,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra set uie_uid = #{userInfo.id,jdbcType=BIGINT},uie_rank_id = #{userRank.id,jdbcType=BIGINT},uie_rank_source = #{rankSource,jdbcType=INTEGER},uie_rank_order_num = #{rankOrderNum,jdbcType=INTEGER},uie_rank_update_time = #{rankUpdateTime,jdbcType=TIMESTAMP},uie_invite_code = #{inviteCode,jdbcType=VARCHAR},uie_create_time = #{createTime,jdbcType=TIMESTAMP},uie_update_time = #{updateTime,jdbcType=TIMESTAMP} where uie_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra set uie_uid = #{userInfo.id,jdbcType=BIGINT},uie_rank_id = #{userRank.id,jdbcType=BIGINT},uie_rank_source = #{rankSource,jdbcType=INTEGER},uie_rank_order_num = #{rankOrderNum,jdbcType=INTEGER},uie_rank_update_time = #{rankUpdateTime,jdbcType=TIMESTAMP},uie_invite_code = #{inviteCode,jdbcType=VARCHAR},uie_lottery_newbies = #{lotteryNewbies,jdbcType=INTEGER},uie_create_time = #{createTime,jdbcType=TIMESTAMP},uie_update_time = #{updateTime,jdbcType=TIMESTAMP} where uie_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra |
| | | <set> |
| | | <if test="userInfo != null">uie_uid=#{userInfo.id,jdbcType=BIGINT},</if> |
| | |
| | | <if test="rankOrderNum != null">uie_rank_order_num=#{rankOrderNum,jdbcType=INTEGER},</if> |
| | | <if test="rankUpdateTime != null">uie_rank_update_time=#{rankUpdateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="inviteCode != null">uie_invite_code=#{inviteCode,jdbcType=VARCHAR},</if> |
| | | <if test="lotteryNewbies != null">uie_lottery_newbies=#{lotteryNewbies,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where uie_id = #{id,jdbcType=BIGINT} |
| | |
| | | <if test="rankOrderNum != null">uie_rank_order_num=#{rankOrderNum,jdbcType=INTEGER},</if> |
| | | <if test="rankUpdateTime != null">uie_rank_update_time=#{rankUpdateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="inviteCode != null">uie_invite_code=#{inviteCode,jdbcType=VARCHAR},</if> |
| | | <if test="lotteryNewbies != null">uie_lottery_newbies=#{lotteryNewbies,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where uie_uid = #{userInfo.id,jdbcType=BIGINT} |
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.yeshi.fanli.dao.mybatis.user.UserSystemCouponMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserSystemCoupon"> |
| | | <id column="usc_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="usc_uid" property="uid" jdbcType="BIGINT"/> |
| | | <result column="usc_source" property="source" jdbcType="VARCHAR"/> |
| | | <result column="usc_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="usc_state_activate" property="stateActivated" jdbcType="INTEGER"/> |
| | | <result column="usc_start_time" property="startTime" jdbcType="TIMESTAMP"/> |
| | | <result column="usc_end_time" property="endTime" jdbcType="TIMESTAMP"/> |
| | | <result column="usc_use_time" property="useTime" jdbcType="TIMESTAMP"/> |
| | | <result column="usc_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="usc_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <association column="usc_coupon_id" property="systemCoupon" |
| | | javaType="com.yeshi.fanli.entity.system.SystemCoupon"> |
| | | <id column="usc_coupon_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | |
| | | <resultMap id="ResultVOMap" type="com.yeshi.fanli.vo.user.UserSystemCouponVO"> |
| | | <id column="usc_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="usc_uid" property="uid" jdbcType="BIGINT"/> |
| | | <result column="usc_source" property="source" jdbcType="VARCHAR"/> |
| | | <result column="usc_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="usc_state_activate" property="stateActivated" jdbcType="INTEGER"/> |
| | | <result column="usc_start_time" property="startTime" jdbcType="TIMESTAMP"/> |
| | | <result column="usc_end_time" property="endTime" jdbcType="TIMESTAMP"/> |
| | | <result column="usc_use_time" property="useTime" jdbcType="TIMESTAMP"/> |
| | | <result column="usc_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="usc_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <association column="usc_coupon_id" property="systemCoupon" |
| | | javaType="com.yeshi.fanli.entity.system.SystemCoupon"> |
| | | <id column="usc_coupon_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">usc_id,usc_uid,usc_coupon_id,usc_source,usc_state,usc_state_activate,usc_start_time,usc_end_time,usc_use_time,usc_create_time,usc_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_system_coupon where usc_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_system_coupon where usc_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon (usc_id,usc_uid,usc_coupon_id,usc_source,usc_state,usc_state_activate,usc_start_time,usc_end_time,usc_use_time,usc_create_time,usc_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{systemCoupon.id,jdbcType=BIGINT},#{source,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{stateActivated,jdbcType=INTEGER},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{useTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">usc_id,</if> |
| | | <if test="uid != null">usc_uid,</if> |
| | | <if test="systemCoupon != null">usc_coupon_id,</if> |
| | | <if test="source != null">usc_source,</if> |
| | | <if test="state != null">usc_state,</if> |
| | | <if test="stateActivated != null">usc_state_activate,</if> |
| | | <if test="startTime != null">usc_start_time,</if> |
| | | <if test="endTime != null">usc_end_time,</if> |
| | | <if test="useTime != null">usc_use_time,</if> |
| | | <if test="createTime != null">usc_create_time,</if> |
| | | <if test="updateTime != null">usc_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="systemCoupon != null">#{systemCoupon.id,jdbcType=BIGINT},</if> |
| | | <if test="source != null">#{source,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="stateActivated != null">#{stateActivated,jdbcType=INTEGER},</if> |
| | | <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="useTime != null">#{useTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCoupon">update yeshi_ec_user_system_coupon set usc_uid = #{uid,jdbcType=BIGINT},usc_coupon_id = #{systemCoupon.id,jdbcType=BIGINT},usc_source = #{source,jdbcType=VARCHAR},usc_state = #{state,jdbcType=INTEGER},usc_state_activate = #{stateActivated,jdbcType=INTEGER},usc_start_time = #{startTime,jdbcType=TIMESTAMP},usc_end_time = #{endTime,jdbcType=TIMESTAMP},usc_use_time = #{useTime,jdbcType=TIMESTAMP},usc_create_time = #{createTime,jdbcType=TIMESTAMP},usc_update_time = #{updateTime,jdbcType=TIMESTAMP} where usc_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCoupon">update yeshi_ec_user_system_coupon |
| | | <set> |
| | | <if test="uid != null">usc_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="systemCoupon != null">usc_coupon_id=#{systemCoupon.id,jdbcType=BIGINT},</if> |
| | | <if test="source != null">usc_source=#{source,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">usc_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="stateActivated != null">usc_state_activate=#{stateActivated,jdbcType=INTEGER},</if> |
| | | <if test="startTime != null">usc_start_time=#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">usc_end_time=#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="useTime != null">usc_use_time=#{useTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">usc_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">usc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where usc_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="getUserCouponList" resultMap="BaseResultMap"> |
| | | SELECT * FROM `yeshi_ec_user_system_coupon` uc |
| | | WHERE uc.`usc_uid`= #{uid} |
| | | ORDER BY uc.`usc_state`,uc.`usc_create_time` DESC |
| | | LIMIT #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="getUserCouponVOList" resultMap="ResultVOMap"> |
| | | SELECT * FROM `yeshi_ec_user_system_coupon` uc |
| | | WHERE uc.`usc_uid`= #{uid} |
| | | ORDER BY uc.`usc_state`,uc.`usc_create_time` DESC |
| | | LIMIT #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="countUserCouponList" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(uc.`usc_id`),0) FROM `yeshi_ec_user_system_coupon` uc |
| | | WHERE uc.`usc_uid`= #{uid} |
| | | </select> |
| | | |
| | | <select id="getEnableListByCouponId" resultMap="ResultVOMap"> |
| | | SELECT * FROM `yeshi_ec_user_system_coupon` uc |
| | | WHERE uc.`usc_uid`= #{uid} AND uc.usc_state = 1 |
| | | <if test="activated != null">AND uc.usc_state_activate = #{activated}</if> |
| | | AND uc.usc_coupon_id in |
| | | <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | ORDER BY uc.`usc_create_time` |
| | | </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.yeshi.fanli.dao.mybatis.user.UserSystemCouponRecordMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord"> |
| | | <id column="ucr_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="ucr_good_id" property="goodId" jdbcType="BIGINT"/> |
| | | <result column="ucr_good_source" property="goodSource" jdbcType="VARCHAR"/> |
| | | <result column="ucr_coupon_type" property="couponType" jdbcType="VARCHAR"/> |
| | | <result column="ucr_order_no" property="orderNo" jdbcType="VARCHAR"/> |
| | | <result column="ucr_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="ucr_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="ucr_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <association property="userSystemCoupon" column="ucr_user_coupon_id" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.user.UserSystemCouponMapper.BaseResultMap"/> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">ucr_id,ucr_good_id,ucr_good_source,ucr_user_coupon_id,ucr_coupon_type,ucr_order_no,ucr_state,ucr_create_time,ucr_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_system_coupon_record where ucr_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_system_coupon_record where ucr_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon_record (ucr_id,ucr_good_id,ucr_good_source,ucr_user_coupon_id,ucr_coupon_type,ucr_order_no,ucr_state,ucr_create_time,ucr_update_time) values (#{id,jdbcType=BIGINT},#{goodId,jdbcType=BIGINT},#{goodSource,jdbcType=VARCHAR},#{userSystemCoupon.id,jdbcType=BIGINT},#{couponType,jdbcType=VARCHAR},#{orderNo,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">ucr_id,</if> |
| | | <if test="goodId != null">ucr_good_id,</if> |
| | | <if test="goodSource != null">ucr_good_source,</if> |
| | | <if test="userSystemCoupon != null">ucr_user_coupon_id,</if> |
| | | <if test="couponType != null">ucr_coupon_type,</if> |
| | | <if test="orderNo != null">ucr_order_no,</if> |
| | | <if test="state != null">ucr_state,</if> |
| | | <if test="createTime != null">ucr_create_time,</if> |
| | | <if test="updateTime != null">ucr_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="goodId != null">#{goodId,jdbcType=BIGINT},</if> |
| | | <if test="goodSource != null">#{goodSource,jdbcType=VARCHAR},</if> |
| | | <if test="userSystemCoupon != null">#{userSystemCoupon.id,jdbcType=BIGINT},</if> |
| | | <if test="couponType != null">#{couponType,jdbcType=VARCHAR},</if> |
| | | <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord">update yeshi_ec_user_system_coupon_record set ucr_good_id = #{goodId,jdbcType=BIGINT},ucr_good_source = #{goodSource,jdbcType=VARCHAR},ucr_user_coupon_id = #{userSystemCoupon.id,jdbcType=BIGINT},ucr_coupon_type = #{couponType,jdbcType=VARCHAR},ucr_order_no = #{orderNo,jdbcType=VARCHAR},ucr_state = #{state,jdbcType=INTEGER},ucr_create_time = #{createTime,jdbcType=TIMESTAMP},ucr_update_time = #{updateTime,jdbcType=TIMESTAMP} where ucr_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord">update yeshi_ec_user_system_coupon_record |
| | | <set> |
| | | <if test="goodId != null">ucr_good_id=#{goodId,jdbcType=BIGINT},</if> |
| | | <if test="goodSource != null">ucr_good_source=#{goodSource,jdbcType=VARCHAR},</if> |
| | | <if test="userSystemCoupon != null">ucr_user_coupon_id=#{userSystemCoupon.id,jdbcType=BIGINT},</if> |
| | | <if test="couponType != null">ucr_coupon_type=#{couponType,jdbcType=VARCHAR},</if> |
| | | <if test="orderNo != null">ucr_order_no=#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">ucr_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">ucr_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">ucr_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where ucr_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="getRecordByOrderNo" resultMap="BaseResultMap"> |
| | | SELECT * FROM `yeshi_ec_user_system_coupon_record` cd |
| | | LEFT JOIN `yeshi_ec_user_system_coupon` uc ON uc.`usc_id` = cd.`ucr_user_coupon_id` |
| | | WHERE cd.`ucr_order_no` = #{orderNo} |
| | | <if test="state != null"> |
| | | AND cd.`ucr_state` = #{state} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getRecordByOrderNoList" resultMap="BaseResultMap"> |
| | | SELECT * FROM `yeshi_ec_user_system_coupon_record` cd |
| | | LEFT JOIN `yeshi_ec_user_system_coupon` uc ON uc.`usc_id` = cd.`ucr_user_coupon_id` |
| | | WHERE cd.`ucr_order_no` in |
| | | <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.config;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.SystemCouponMapper;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.service.inter.config.SystemCouponService;
|
| | |
|
| | | @Service
|
| | | public class SystemCouponServiceImpl implements SystemCouponService {
|
| | |
|
| | | @Resource
|
| | | private SystemCouponMapper systemCouponMapper;
|
| | |
|
| | | |
| | | @Override
|
| | | public int insertSelective(SystemCoupon record) {
|
| | | return systemCouponMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public SystemCoupon selectByPrimaryKey(Long id) {
|
| | | return systemCouponMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKeySelective(SystemCoupon record) {
|
| | | return systemCouponMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(SystemCoupon record) {
|
| | | return systemCouponMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int deleteBatchByPrimaryKey(List<Long> list) {
|
| | | return systemCouponMapper.deleteBatchByPrimaryKey(list);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<SystemCoupon> getOrderCouponList() {
|
| | | List<String> listType = new ArrayList<String>();
|
| | | listType.add(CouponTypeEnum.rebatePercentCoupon.name());
|
| | | |
| | | return systemCouponMapper.getCouponListByType(listType);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<SystemCoupon> getGoodsCouponList() {
|
| | | List<String> listType = new ArrayList<String>();
|
| | | listType.add(CouponTypeEnum.freeCoupon.name());
|
| | | listType.add(CouponTypeEnum.welfareFreeCoupon.name());
|
| | | |
| | | return systemCouponMapper.getCouponListByType(listType);
|
| | | }
|
| | | }
|
| | |
| | | return countOrderNumberBySettleTime(uid, 2, 4); // 根据
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean hasRebateAndShareOrder(Long uid) {
|
| | | boolean has = false;
|
| | | |
| | | long count = commonOrderCountMapper.countValidOrder(uid);
|
| | | if (count > 0) {
|
| | | has = true; |
| | | }
|
| | | |
| | | return has;
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | |
|
| | | @Override
|
| | | @Cacheable(value = "configCache", key = "'listBySystemAndCard-'+#card+'-'+#systemId")
|
| | | public List<Special> listBySystemAndCard( String card, Long systemId) {
|
| | | public List<Special> listBySystemAndCard(String card, Long systemId) {
|
| | | return specialMapper.listBySystemAndCard(card, systemId);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | @Cacheable(value = "configCache", key = "'listPageBySystemAndCard-'+#card+'-'+#systemId+'-'+#start +'-'+#count")
|
| | | public List<Special> listPageBySystemAndCard(long start, int count, String card, Long systemId) {
|
| | | return specialMapper.listPageBySystemAndCard(start, count, card, systemId);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void uploadPicture(MultipartFile file, Special record, Long cardId) throws Exception {
|
| | |
|
| | | InputStream inputStream = file.getInputStream();
|
| | |
| | | package com.yeshi.fanli.service.impl.lable;
|
| | |
|
| | | import java.io.InputStream;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashSet;
|
| | | import java.util.List;
|
| | |
| | | return labelMapper.getByGoodsId(goodsId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Label> addBatchByNames(String lableNames, AdminUser admin) throws LabelException{
|
| | | if (lableNames == null || lableNames.trim().length() == 0) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | List<Label> listLabs = new ArrayList<Label>();
|
| | | // 空格隔开
|
| | | String[] arrtitles = lableNames.split("\\s+");
|
| | | |
| | | for (String title : arrtitles) {
|
| | | /* 遍历标签名称:查询数据库中是否已存在 */
|
| | | List<Label> labels = labelService.selectByTitle(title.trim());
|
| | | if (labels != null && labels.size() > 0) {
|
| | | Label label = labels.get(0);
|
| | | listLabs.add(label);
|
| | | } else {
|
| | | // 新增
|
| | | Label label = new Label();
|
| | | label.setTitle(title);// 名称
|
| | | label.setEntrymode(Label.MODE_SYSTEM); // 批量录入
|
| | | label.setCreatetime(new Date());
|
| | | label.setUpdatetime(new Date());
|
| | | label.setCreateUser(admin);
|
| | | label.setIosClick(0l);
|
| | | label.setAndroidClick(0l);
|
| | | labelService.insertSelective(label);
|
| | | |
| | | listLabs.add(label);
|
| | | }
|
| | | }
|
| | | |
| | | return listLabs;
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | |
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void addBatch(List<Long> auctionIdList, String lableNames, AdminUser admin) throws Exception {
|
| | |
|
| | | List<Label> listLabs = new ArrayList<Label>();
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(lableNames)) {
|
| | | // 空格隔开
|
| | | String[] arrtitles = lableNames.split("\\s+");
|
| | | for (String title : arrtitles) {
|
| | | /* 遍历标签名称:查询数据库中是否已存在 */
|
| | | List<Label> labels = labelService.selectByTitle(title.trim());
|
| | |
|
| | | if (labels != null && labels.size() > 0) {
|
| | | Label label = labels.get(0);
|
| | |
|
| | | listLabs.add(label);
|
| | | } else {
|
| | | // 新增
|
| | | Label label = new Label();
|
| | | label.setTitle(title);// 名称
|
| | | label.setEntrymode(Label.MODE_SYSTEM); // 批量录入
|
| | | label.setCreatetime(new Date());
|
| | | label.setUpdatetime(new Date());
|
| | | label.setCreateUser(admin);
|
| | | label.setIosClick(0l);
|
| | | label.setAndroidClick(0l);
|
| | | labelService.insertSelective(label);
|
| | |
|
| | | listLabs.add(label);
|
| | | public void addBatchGoodsByTaoBaoId(List<Long> listTaoBaoId, String lableNames, AdminUser admin) |
| | | throws Exception {
|
| | | |
| | | List<TaoBaoGoodsBrief> listAddGoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | if (listTaoBaoId != null && listTaoBaoId.size() > 0) {
|
| | | for (Long auctionId: listTaoBaoId) {
|
| | | /* 根据auctionId 获取淘宝商品 */
|
| | | TaoBaoGoodsBrief goodsBrief = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | | if (goodsBrief != null) {
|
| | | listAddGoods.add(goodsBrief);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> existList = taoBaoGoodsBriefRecordMapper.queryByAuctionIdList(auctionIdList);
|
| | | |
| | | @Override
|
| | | @Transactional
|
| | | public void addBatchTaoBaoGoods(List<TaoBaoGoodsBrief> listTaoBaoGoods, String lableNames, AdminUser admin) throws Exception {
|
| | | |
| | | if (listTaoBaoGoods == null || listTaoBaoGoods.size() == 0) {
|
| | | throw new Exception("未找到匹配的商品");
|
| | | }
|
| | | |
| | | // 创建标签
|
| | | List<Label> listLabel = labelService.addBatchByNames(lableNames, admin);
|
| | |
|
| | | List<QualityFactory> addList = new ArrayList<QualityFactory>();
|
| | | List<LabelGoods> addLabelList = new ArrayList<LabelGoods>();
|
| | | List<QualityFactory> listQuality = new ArrayList<QualityFactory>();
|
| | | List<LabelGoods> listLabelGoods = new ArrayList<LabelGoods>();
|
| | |
|
| | | for (Long auctionId : auctionIdList) {
|
| | | for (TaoBaoGoodsBrief goodsBrief: listTaoBaoGoods) {
|
| | |
|
| | | boolean process = false;
|
| | | TaoBaoGoodsBrief goodsBrief = null;
|
| | | // 本地是否已存在此商品
|
| | | List<TaoBaoGoodsBrief> hasList = taoBaoGoodsBriefService.queryByAuctionId(goodsBrief.getAuctionId());
|
| | |
|
| | | if (existList != null && existList.size() > 0) {
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : existList) {
|
| | | Long aId = taoBaoGoodsBrief.getAuctionId();
|
| | | if (auctionId.equals(aId)) {
|
| | | goodsBrief = taoBaoGoodsBrief;
|
| | | goodsBrief.setId(null);
|
| | | process = true;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (!process) {
|
| | | /* 根据auctionId 获取淘宝商品 */
|
| | | goodsBrief = redisManager.getTaoBaoGoodsBrief(auctionId);
|
| | | }
|
| | |
|
| | | if (goodsBrief == null)
|
| | | continue;
|
| | |
|
| | | /* 判断商品 是否已经存在数据库 */
|
| | | List<TaoBaoGoodsBrief> taoBaoGoodsBriefList = taoBaoGoodsBriefService.queryByAuctionId(auctionId);
|
| | |
|
| | | if (taoBaoGoodsBriefList != null && taoBaoGoodsBriefList.size() > 0) {
|
| | |
|
| | | TaoBaoGoodsBrief currentGoodsBrief = taoBaoGoodsBriefList.get(0);
|
| | |
|
| | | if (hasList != null && hasList.size() > 0) {
|
| | | TaoBaoGoodsBrief currentGoodsBrief = hasList.get(0);
|
| | | goodsBrief.setId(currentGoodsBrief.getId());
|
| | |
|
| | | |
| | | // 更新商品最新信息
|
| | | taoBaoGoodsUpdateService.updateTaoBaoGoods(goodsBrief);
|
| | |
|
| | | } else {
|
| | |
|
| | | // 插入本地数据库
|
| | | goodsBrief.setId(null);
|
| | | goodsBrief.setState(0);
|
| | | goodsBrief.setCreatetime(new Date());
|
| | | goodsBrief.setUpdatetime(new Date());
|
| | | // 非空项 处理
|
| | | // 非空项 设置默认值
|
| | | setTaoBaoGoodsBriefDefault(goodsBrief);
|
| | |
|
| | | // 保存至本地
|
| | | taoBaoGoodsBriefService.insertSelective(goodsBrief);
|
| | | }
|
| | |
|
| | | // 是否已入库
|
| | | Long id = goodsBrief.getId();
|
| | | List<QualityFactory> selectionList = qualityFactoryMapper.queryByGoodsId(id);
|
| | | List<QualityFactory> selectionList = qualityFactoryMapper.queryByGoodsId(goodsBrief.getId());
|
| | |
|
| | | /* 进入精选商品库 */
|
| | | if (selectionList == null || selectionList.size() == 0) {
|
| | | // 添加至精选商品库
|
| | | QualityFactory selectionGoods = new QualityFactory();
|
| | |
| | | selectionGoods.setEntryMode(QualityFactory.MODE_MANUAL);// 人工筛选
|
| | | selectionGoods.setGoodsSource(QualityFactory.SOURCE_TAOBAO);// 来源淘宝
|
| | |
|
| | | addList.add(selectionGoods);
|
| | | listQuality.add(selectionGoods);
|
| | | } else {
|
| | | // 更新商品
|
| | | QualityFactory selectionGoods = selectionList.get(0);
|
| | |
| | | qualityFactoryMapper.updateByPrimaryKeySelective(selectionGoods);
|
| | | }
|
| | |
|
| | | if (listLabs.size() > 0) {
|
| | | for (Label label : listLabs) {
|
| | | if (listLabel != null && listLabel.size() > 0) {
|
| | | for (Label label : listLabel) {
|
| | | /* 贴上标签 : 已贴不处理则 */
|
| | | Long existence = labelGoodsMapper.isExistence(id, label.getId());
|
| | | Long existence = labelGoodsMapper.isExistence(goodsBrief.getId(), label.getId());
|
| | |
|
| | | // 该商品不存在此标签则添加, 反之不做处理
|
| | | if (existence == null || existence == 0l) {
|
| | |
| | | lg.setCreateUser(admin);
|
| | | lg.setCreatetime(new Date());
|
| | | lg.setTaoBaoGoodsBrief(goodsBrief);
|
| | |
|
| | | addLabelList.add(lg);
|
| | | listLabelGoods.add(lg);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | if (addList.size() > 0) {
|
| | | qualityFactoryMapper.insertBatch(addList);
|
| | | if (listQuality.size() > 0) {
|
| | | qualityFactoryMapper.insertBatch(listQuality);
|
| | | }
|
| | |
|
| | | if (addLabelList.size() > 0) {
|
| | | labelGoodsMapper.insertBatch(addLabelList);
|
| | | if (listLabelGoods.size() > 0) {
|
| | | labelGoodsMapper.insertBatch(listLabelGoods);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Transactional
|
| | | public void setWeightBatch(List<Long> idList, AdminUser admin, Integer weight, Integer weightSmall,
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.CommonOrderGoodsFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderGoodsVO;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Service
|
| | | public class CommonOrderServiceImpl implements CommonOrderService {
|
| | |
| | |
|
| | | @Resource
|
| | | private CommonOrderGoodsMapper commonOrderGoodsMapper;
|
| | | |
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | | |
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | | |
| | | @Resource
|
| | | private UserSystemCouponRecordService userSystemCouponRecordService;
|
| | | |
| | | @Resource
|
| | | private SystemCouponService systemCouponService;
|
| | | |
| | | |
| | | // 奖励订单图片
|
| | | public final static String PIC_REWARD= "http://192.168.1.200/icon/jl.png";
|
| | | |
| | | // 免单状态图片
|
| | | public final static String PIC_FREE_ON = "http://192.168.1.200/icon/state1.png";
|
| | | public final static String PIC_FREE_FAIL = "http://192.168.1.200/icon/state2.png";
|
| | | public final static String PIC_FREE_SUCCEED = "http://192.168.1.200/icon/state3.png";
|
| | |
|
| | |
|
| | | @Override
|
| | | public int insert(CommonOrder record) {
|
| | |
| | |
|
| | | return listOrder;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public Map<String, BigDecimal> countHistoryOrder(Long uid, Integer day) {
|
| | | return commonOrderMapper.countHistoryOrder(uid, day);
|
| | |
| | |
|
| | | public void listDataFactory(List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, Long uid) {
|
| | |
|
| | | List<String> listNo = new ArrayList<String>();
|
| | | for (CommonOrderVO commonOrderVO: listOrder) {
|
| | | listNo.add(commonOrderVO.getOrderNo());
|
| | | }
|
| | | |
| | | // 已经使用券订单
|
| | | List<UserSystemCouponRecord> couponRecordList = userSystemCouponRecordService.getRecordByOrderNoList(listNo);
|
| | | |
| | | |
| | | /* 组合商品信息 */
|
| | | for (CommonOrderVO commonOrder : listGoods) {
|
| | |
|
| | |
| | |
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd");
|
| | |
|
| | | |
| | | // 是否存在奖励券
|
| | | boolean hasRewardCoupon = userSystemCouponService.hasRewardCoupon(uid);
|
| | | |
| | | /* 组织订单状态 等信息 */
|
| | | for (CommonOrderVO order : listOrder) {
|
| | |
|
| | | Date thirdCreateTime = order.getThirdCreateTime();
|
| | |
| | | order.setOrderState(orderStateMap);
|
| | |
|
| | | String hongbaoInfo = "";
|
| | | // 订单标识
|
| | | List<String> signList = new ArrayList<String>();
|
| | | /* 订单返利类型 转换 */
|
| | | Integer hongBaoType = order.getHongBaoType();
|
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) {
|
| | |
| | | hongbaoInfo = "返利";
|
| | | order.setOrderOrigin("1");
|
| | | order.setHongBaoTypePic(CommonOrder.TYPE_FANLI);
|
| | | signList.add(CommonOrder.TYPE_FANLI);
|
| | | } else if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType) {
|
| | | // 分享
|
| | | hongbaoInfo = "奖金";
|
| | | order.setOrderOrigin("2");
|
| | | order.setHongBaoTypePic(CommonOrder.TYPE_SHARE);
|
| | | signList.add(CommonOrder.TYPE_SHARE);
|
| | | |
| | | } else if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
|
| | | || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType
|
| | | || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) {
|
| | |
| | | hongbaoInfo = "奖金";
|
| | | order.setOrderOrigin("3");
|
| | | order.setHongBaoTypePic(CommonOrder.TYPE_INVITE);
|
| | | signList.add(CommonOrder.TYPE_INVITE);
|
| | | }
|
| | |
|
| | | String hongBaoDate = null;
|
| | |
| | | hongBaoMap.put("content", hongbaoInfo + " ¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | hongBaoMap.put("fontColor", hongbaoInfoFontColor);
|
| | | order.setHongBaoInfo(hongBaoMap);
|
| | | |
| | | |
| | | // 是否免单商品
|
| | | boolean freeOrder = false;
|
| | | // 是否奖励成功
|
| | | boolean rewardSuccess = false;
|
| | | // 奖励订单、免单
|
| | | if (couponRecordList != null && couponRecordList.size() > 0) {
|
| | | |
| | | for (UserSystemCouponRecord couponRecord: couponRecordList) {
|
| | | // 订单号匹配
|
| | | if (order.getOrderNo().equals(couponRecord.getOrderNo())) {
|
| | | |
| | | String systemCouponType = couponRecord.getCouponType();
|
| | | Integer state = couponRecord.getState();
|
| | | |
| | | // 奖励订单: 且成功
|
| | | if (CouponTypeEnum.rebatePercentCoupon.name().equals(systemCouponType)
|
| | | && UserSystemCouponRecord.STATE_SUCCESS == state) {
|
| | | rewardSuccess = true;
|
| | | signList.add(PIC_REWARD); // 加入奖励成功图片
|
| | | |
| | | } else if (CouponTypeEnum.freeCoupon.name().equals(systemCouponType)
|
| | | || CouponTypeEnum.welfareFreeCoupon.name().equals(systemCouponType)) {
|
| | | |
| | | if (UserSystemCouponRecord.STATE_FREE_ON == state) {
|
| | | // 免单中
|
| | | freeOrder = true;
|
| | | signList.add(PIC_FREE_ON);
|
| | | } else if (UserSystemCouponRecord.STATE_SUCCESS == state) {
|
| | | // 免单成功
|
| | | freeOrder = true;
|
| | | signList.add(PIC_FREE_SUCCEED);
|
| | | } else if (UserSystemCouponRecord.STATE_FAIL_RULE == state || UserSystemCouponRecord.STATE_FAIL_DRAWBACK == state) {
|
| | | // 规则不匹配、退款
|
| | | freeOrder = true;
|
| | | signList.add(PIC_FREE_FAIL);
|
| | | } |
| | | }
|
| | | |
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | // 订单标识
|
| | | order.setSignList(signList);
|
| | | |
| | | boolean rewardOrder = false;
|
| | | |
| | | int type = 1; // 1 常规跳转页面 2弹出选项(奖励券)
|
| | | if (rewardSuccess) {
|
| | | // 奖励成功
|
| | | rewardOrder = true; |
| | | } else if(hasRewardCoupon && !freeOrder && HongBaoV2.STATE_YILINGQU == hongBaoState) {
|
| | | // 有可用的奖励券 、非免单订单 、且已到账的
|
| | | type = 2;
|
| | | rewardOrder = true; |
| | | }
|
| | | |
| | | if (rewardOrder) { |
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
|
| | | // 奖励券进度详情
|
| | | rewardStyleVO.setContent("返利奖励 >");
|
| | | rewardStyleVO.setColor( "#E5005C");
|
| | | rewardStyleVO.setBottomColor("#FFDCEA");
|
| | | |
| | | Map<String, Object> jumpLink = new HashMap<String,Object>();
|
| | | jumpLink.put("orderNo", order.getOrderNo());
|
| | | |
| | | Map<String, Object> jump = new HashMap<String,Object>();
|
| | | jump.put("type", type); |
| | | jump.put("params", jumpLink);
|
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
|
| | | |
| | | Map<String, Object> rewardMap = new HashMap<String,Object>();
|
| | | rewardMap.put("text", rewardStyleVO);
|
| | | rewardMap.put("jump", jump);
|
| | | |
| | | order.setRewardDetail(rewardMap);
|
| | | }
|
| | | |
| | | if (freeOrder) { |
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
|
| | | // 返利、免单详情
|
| | | rewardStyleVO.setContent("免单详情 >");
|
| | | rewardStyleVO.setColor( "#E5005C");
|
| | | rewardStyleVO.setBottomColor("#FFDCEA");
|
| | | |
| | | Map<String, Object> jumpLink = new HashMap<String,Object>();
|
| | | jumpLink.put("orderNo", order.getOrderNo());
|
| | | |
| | | Map<String, Object> jump = new HashMap<String,Object>();
|
| | | jump.put("type", 1); // 页面跳转
|
| | | jump.put("params", jumpLink);
|
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("freeCouponDetail"));
|
| | | |
| | | Map<String, Object> rewardMap = new HashMap<String,Object>();
|
| | | rewardMap.put("text", rewardStyleVO);
|
| | | rewardMap.put("jump", jump);
|
| | | |
| | | order.setRewardDetail(rewardMap);
|
| | | }
|
| | | |
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CommonOrder> listBySourceTypeAndOrderId(int sourceType, String orderId) {
|
| | |
|
| | | return commonOrderMapper.listBySourceTypeAndOrderNo(sourceType, orderId);
|
| | | }
|
| | |
|
| | |
| | | return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public CommonOrderVO getInfoByOrderNo(Long uid,String orderNo) throws CommonOrderException{
|
| | | List<CommonOrderVO> list = getOrderByUid(1, uid, null, null, null, orderNo, null, null, null);
|
| | | if (list == null || list.size() == 0) {
|
| | | return null;
|
| | | } else {
|
| | | return list.get(0);
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | public CommonOrderVO getCommonOrderByOrderNo(Long uid, String orderNo, Integer orderState) throws CommonOrderException {
|
| | |
|
| | | CommonOrderVO commonOrderVO = commonOrderMapper.getCommonOrderByOrderNo(uid, orderNo, orderState);
|
| | | // 订单信息为空
|
| | | if (commonOrderVO == null) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | List<CommonOrderVO> listOrder = new ArrayList<CommonOrderVO>();
|
| | | listOrder.add(commonOrderVO);
|
| | |
|
| | | // 商品信息
|
| | | List<CommonOrderVO> listGoods = commonOrderMapper.listOrderGoodsInfo(listOrder);
|
| | | // 订单商品为空
|
| | | if (listGoods == null || listGoods.size() == 0) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | /* 组合商品信息 */
|
| | | for (CommonOrderVO commonOrder : listGoods) {
|
| | |
|
| | | CommonOrderGoods goods = commonOrder.getCommonOrderGoods();
|
| | | if (goods == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | String orderNo1 = commonOrder.getOrderNo();
|
| | | Integer sourceType = commonOrder.getSourceType();
|
| | |
|
| | | String orderNo2 = commonOrderVO.getOrderNo();
|
| | | Integer sourceType2 = commonOrderVO.getSourceType();
|
| | |
|
| | | // 来源、订单号相同
|
| | | if (sourceType.equals(sourceType2) && orderNo1.equals(orderNo2)) {
|
| | | // 加入商品信息
|
| | | List<CommonOrderGoodsVO> listOrderGoods = commonOrderVO.getListOrderGoods();
|
| | |
|
| | | CommonOrderGoodsVO commonGoodsVO = new CommonOrderGoodsVO();
|
| | | try {
|
| | | PropertyUtils.copyProperties(commonGoodsVO, goods);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | String picture = commonGoodsVO.getPicture();
|
| | | if (!StringUtil.isNullOrEmpty(picture) && !picture.contains("320x320")) {
|
| | | commonGoodsVO.setPicture(TbImgUtil.getTBSize320Img(picture));
|
| | | }
|
| | |
|
| | | Integer hongBaoType = commonOrderVO.getHongBaoType();
|
| | | // 邀请订单信息保护
|
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
|
| | | || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType
|
| | | || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) {
|
| | | Map<String, String> titleMap = new HashMap<String, String>();
|
| | | titleMap.put("content", "为保障用户隐私,商品信息已隐藏!");
|
| | | titleMap.put("fontColor", "#888888");
|
| | | titleMap.put("bottomColor", "#E9E9E9");
|
| | | commonGoodsVO.setTitle(null);
|
| | | commonGoodsVO.setGoodsTitle(titleMap);
|
| | | }
|
| | |
|
| | | // 购买数量
|
| | | commonGoodsVO.setActualCount(commonOrder.getTotalCount() + "件");
|
| | |
|
| | | BigDecimal totalSettlement = commonOrder.getTotalSettlement();
|
| | | if (totalSettlement == null || totalSettlement.compareTo(new BigDecimal(0)) <= 0) {
|
| | | totalSettlement = commonOrder.getTotalPayment();
|
| | | }
|
| | | // 实付款
|
| | | commonGoodsVO.setActualPay("实付款:¥" + totalSettlement);
|
| | |
|
| | | listOrderGoods.add(commonGoodsVO);
|
| | |
|
| | | Integer orderType = commonOrder.getOrderType();
|
| | | if (orderType == null) {
|
| | | String shopType = commonGoodsVO.getShopType();
|
| | | if (CommonOrderGoodsVO.TYPE_TAOBAO.equalsIgnoreCase(shopType)) {
|
| | | commonOrder.setOrderType(1);
|
| | | } else if (CommonOrderGoodsVO.TYPE_TMALL.equalsIgnoreCase(shopType)) {
|
| | | commonOrder.setOrderType(2);
|
| | | }
|
| | | }
|
| | |
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | return commonOrderVO;
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<CommonOrderVO> getCouponHongbaoByOrderNo(Long uid, Integer hongBaoState, String orderNo) throws CommonOrderException {
|
| | |
|
| | | List<CommonOrderVO> listOrder = commonOrderMapper.getCouponHongbaoByOrderNo(uid, hongBaoState, orderNo);
|
| | |
|
| | | // 订单信息为空
|
| | | if (listOrder == null || listOrder.size() == 0) {
|
| | | listOrder = new ArrayList<CommonOrderVO>();
|
| | | return listOrder;
|
| | | }
|
| | |
|
| | | // 商品信息
|
| | | List<CommonOrderVO> listGoods = commonOrderMapper.listOrderGoodsInfo(listOrder);
|
| | | // 订单商品为空
|
| | | if (listGoods == null || listGoods.size() == 0) {
|
| | | return listOrder;
|
| | | }
|
| | |
|
| | | // 数据加工重新组织
|
| | | listDataFactory(listOrder, listGoods, uid);
|
| | |
|
| | | return listOrder;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public JSONObject getRewardJumpInfo(String orderNo) {
|
| | | |
| | | JSONObject map = new JSONObject();
|
| | | // 订单标识
|
| | | List<String> signList = new ArrayList<String>();
|
| | | signList.add(CommonOrder.TYPE_FANLI);
|
| | | signList.add(PIC_REWARD); // 加入奖励成功图片
|
| | | map.put("signList", signList);
|
| | | |
| | | |
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
|
| | | // 奖励券进度详情
|
| | | rewardStyleVO.setContent("返利奖励 >");
|
| | | rewardStyleVO.setColor( "#E5005C");
|
| | | rewardStyleVO.setBottomColor("#FFDCEA");
|
| | | |
| | | Map<String, Object> jumpLink = new HashMap<String,Object>();
|
| | | jumpLink.put("orderNo", orderNo);
|
| | | |
| | | Map<String, Object> jump = new HashMap<String,Object>();
|
| | | jump.put("type", 1); |
| | | jump.put("params", jumpLink);
|
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
|
| | | |
| | | Map<String, Object> rewardMap = new HashMap<String,Object>();
|
| | | rewardMap.put("text", rewardStyleVO);
|
| | | rewardMap.put("jump", jump);
|
| | | |
| | | map.put("rewardDetail", rewardMap);
|
| | | |
| | | return map;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.DeviceLotteryRecordMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.DeviceLotteryRecord;
|
| | | import com.yeshi.fanli.service.inter.user.DeviceLotteryRecordService;
|
| | |
|
| | | @Service
|
| | | public class DeviceLotteryRecordServiceImpl implements DeviceLotteryRecordService {
|
| | | |
| | | @Resource
|
| | | private DeviceLotteryRecordMapper reviceLotteryRecordMapper;
|
| | |
|
| | | |
| | | @Override
|
| | | public int insertSelective(DeviceLotteryRecord record) {
|
| | | return reviceLotteryRecordMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public DeviceLotteryRecord selectByPrimaryKey(Long id) {
|
| | | return reviceLotteryRecordMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKeySelective(DeviceLotteryRecord record) {
|
| | | return reviceLotteryRecordMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(DeviceLotteryRecord record) {
|
| | | return reviceLotteryRecordMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DeviceLotteryRecord> listByPlatformAndDevice(int platform, String device) {
|
| | | return reviceLotteryRecordMapper.listByPlatformAndDevice(platform, device);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<ShamUser> listRandUser(int count) {
|
| | | return shamUserMapper.listRand(count);
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponRecordMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | |
|
| | | @Service
|
| | | public class UserSystemCouponRecordServiceImpl implements UserSystemCouponRecordService {
|
| | | |
| | | @Resource
|
| | | private UserSystemCouponRecordMapper userSystemCouponRecordMapper;
|
| | |
|
| | | |
| | | @Override
|
| | | public int insertSelective(UserSystemCouponRecord record) {
|
| | | return userSystemCouponRecordMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserSystemCouponRecord selectByPrimaryKey(Long id) {
|
| | | return userSystemCouponRecordMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKeySelective(UserSystemCouponRecord record) {
|
| | | return userSystemCouponRecordMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(UserSystemCouponRecord record) {
|
| | | return userSystemCouponRecordMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserSystemCouponRecord getRecordByOrderNo(String orderNo, Integer state) {
|
| | | return userSystemCouponRecordMapper.getRecordByOrderNo(orderNo, state);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<UserSystemCouponRecord> getRecordByOrderNoList(List<String> list) {
|
| | | return userSystemCouponRecordMapper.getRecordByOrderNoList(list);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.exception.user.UserSystemCouponException;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponRecordVO;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Service
|
| | | public class UserSystemCouponServiceImpl implements UserSystemCouponService {
|
| | |
|
| | | @Resource
|
| | | private UserSystemCouponMapper userSystemCouponMapper;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | |
|
| | | @Resource
|
| | | private SystemCouponService systemCouponService;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | @Resource
|
| | | private UserSystemCouponRecordService userSystemCouponRecordService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderService hongBaoOrderService;
|
| | | |
| | | // 券失效图片
|
| | | public final static String PIC_INVALID= "http://192.168.1.200/icon/mian_invalid.png";
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public int insertSelective(UserSystemCoupon record) {
|
| | | return userSystemCouponMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserSystemCoupon selectByPrimaryKey(Long id) {
|
| | | return userSystemCouponMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKeySelective(UserSystemCoupon record) {
|
| | | return userSystemCouponMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(UserSystemCoupon record) {
|
| | | return userSystemCouponMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<UserSystemCoupon> getUserCouponList(long start, int count, Long uid) {
|
| | | return userSystemCouponMapper.getUserCouponList(start, count, uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countUserCouponList(Long uid) {
|
| | | return userSystemCouponMapper.countUserCouponList(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<UserSystemCouponVO> getUserCouponVOList(long start, int count, Long uid)
|
| | | throws UserSystemCouponException, Exception {
|
| | |
|
| | | if (uid == null) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | List<UserSystemCouponVO> listVO = userSystemCouponMapper.getUserCouponVOList(start, count, uid);
|
| | | if (listVO == null || listVO.size() == 0) {
|
| | | return listVO;
|
| | | }
|
| | |
|
| | | // 数据组织
|
| | | listDataFactory(listVO);
|
| | |
|
| | | return listVO;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 数据组织
|
| | | * |
| | | * @param listVO
|
| | | */
|
| | | public void listDataFactory(List<UserSystemCouponVO> listVO) {
|
| | |
|
| | | for (UserSystemCouponVO userCouponVO : listVO) {
|
| | |
|
| | | SystemCoupon systemCoupon = userCouponVO.getSystemCoupon();
|
| | | if (systemCoupon != null && systemCoupon.getId() != null) {
|
| | | systemCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
|
| | | }
|
| | |
|
| | | if (systemCoupon == null) {
|
| | | continue; // 券信息不完整
|
| | | }
|
| | |
|
| | | String source = userCouponVO.getSource();
|
| | | userCouponVO.setSource("来源:" + source);
|
| | |
|
| | | userCouponVO.setCouponName(systemCoupon.getName());
|
| | | userCouponVO.setCouponPicture(systemCoupon.getPicture());
|
| | | userCouponVO.setCouponEffect(systemCoupon.getEffect());
|
| | | userCouponVO.setCouponRule(systemCoupon.getRule());
|
| | | |
| | | // 使用中状态 改变为已使用
|
| | | Integer state = userCouponVO.getState();
|
| | | if (UserSystemCoupon.STATE_IN_USE == state) { |
| | | state = UserSystemCoupon.STATE_END_USE;
|
| | | userCouponVO.setState(state);
|
| | | }
|
| | | |
| | | |
| | | // 按钮跳转
|
| | |
|
| | | Map<String, Object> jumpBtn = null;
|
| | | Integer stateActivated = userCouponVO.getStateActivated();
|
| | | if (stateActivated == null || stateActivated == 0) {
|
| | | // 显示规则
|
| | | userCouponVO.setCouponRule(systemCoupon.getRemark());
|
| | | systemCoupon.setEffect("待激活");
|
| | | |
| | | // 状态未激活
|
| | | userCouponVO.setState(0);
|
| | |
|
| | | jumpBtn = new HashMap<String, Object>();
|
| | | Map<String, Object> jumpLink = new HashMap<String, Object>();
|
| | | jumpLink.put("url", configService.get("invite_activation_url"));
|
| | | jumpBtn.put("params", jumpLink);
|
| | | jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("invite"));
|
| | |
|
| | | } else if (stateActivated == 1) {
|
| | | // 显示规则
|
| | | userCouponVO.setCouponRule(systemCoupon.getRule());
|
| | |
|
| | | if (UserSystemCoupon.STATE_CAN_USE == state) {
|
| | | Map<String, Object> jumpLink = new HashMap<String, Object>();
|
| | |
|
| | | CouponTypeEnum type = systemCoupon.getType();
|
| | | if (CouponTypeEnum.freeCoupon == type || CouponTypeEnum.welfareFreeCoupon == type) {
|
| | | // 免单券、 福利免单券
|
| | | jumpLink.put("url", configService.get("invite_activation_url"));
|
| | |
|
| | | jumpBtn = new HashMap<String, Object>();
|
| | | jumpBtn.put("params", jumpLink);
|
| | | jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("web"));
|
| | |
|
| | | } else if (CouponTypeEnum.rebatePercentCoupon == type) {
|
| | | // 返利奖励券
|
| | | jumpLink.put("url", configService.get("invite_activation_url"));
|
| | |
|
| | | jumpBtn = new HashMap<String, Object>();
|
| | | jumpBtn.put("params", jumpLink);
|
| | | jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("invite"));
|
| | | }
|
| | | } else if (UserSystemCoupon.STATE_END_USE == state || UserSystemCoupon.STATE_OVERDUE == state) {
|
| | | userCouponVO.setCouponPicture(PIC_INVALID);
|
| | | }
|
| | | |
| | | }
|
| | | userCouponVO.setJumpBtn(jumpBtn);
|
| | |
|
| | | String couponTerm = "有效期:";
|
| | | Date startTime = userCouponVO.getStartTime();
|
| | | Date endTime = userCouponVO.getEndTime();
|
| | | if (endTime != null && startTime != null) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | couponTerm = couponTerm + sdf.format(startTime) + "-" + sdf.format(endTime);
|
| | | }
|
| | | userCouponVO.setCouponTerm(couponTerm);
|
| | |
|
| | | if (UserSystemCoupon.STATE_CAN_USE == state) {
|
| | | int differentDays = 0;
|
| | | if (endTime != null && startTime != null) {
|
| | | differentDays = DateUtil.differentDaysByMillisecond(new Date(), endTime) + 1;
|
| | | if (differentDays < 0) {
|
| | | differentDays = 0;
|
| | | }
|
| | | }
|
| | |
|
| | | // 剩余天数
|
| | | Map<String, Object> remainDays = new HashMap<String, Object>();
|
| | | remainDays.put("content", "还剩" + differentDays + "天过期");
|
| | | remainDays.put("fontColor", "#F14242");
|
| | | userCouponVO.setRemainDays(remainDays);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<UserSystemCouponVO> getEnableListByCouponId(Long uid, Integer activated, List<SystemCoupon> couponList)
|
| | | throws UserSystemCouponException, Exception {
|
| | |
|
| | | List<Long> listCouponId = new ArrayList<Long>();
|
| | | for (SystemCoupon systemCoupon : couponList) {
|
| | | listCouponId.add(systemCoupon.getId());
|
| | | }
|
| | |
|
| | | List<UserSystemCouponVO> listVO = userSystemCouponMapper.getEnableListByCouponId(uid, activated,
|
| | | listCouponId);
|
| | | |
| | | if (listVO == null || listVO.size() == 0) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | for (UserSystemCouponVO userCouponVO : listVO) {
|
| | |
|
| | | SystemCoupon systemCoupon = userCouponVO.getSystemCoupon();
|
| | | if (systemCoupon == null) {
|
| | | continue; // 券信息不完整
|
| | | }
|
| | |
|
| | | for (SystemCoupon coupon : couponList) {
|
| | | if (coupon.getId().equals(systemCoupon.getId()) || coupon.getId() == systemCoupon.getId()) {
|
| | | systemCoupon = coupon;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | String source = userCouponVO.getSource();
|
| | | userCouponVO.setSource("来源:" + source);
|
| | |
|
| | | userCouponVO.setCouponName(systemCoupon.getName());
|
| | | userCouponVO.setCouponEffect(systemCoupon.getEffect());
|
| | | userCouponVO.setCouponRule(systemCoupon.getRule());
|
| | | |
| | | Integer stateActivated = userCouponVO.getStateActivated();
|
| | | if (stateActivated == null || stateActivated == 0) {
|
| | | userCouponVO.setCouponPicture(PIC_INVALID); // 未激活
|
| | | userCouponVO.setState(0);
|
| | | } else {
|
| | | userCouponVO.setCouponPicture(systemCoupon.getPicture());
|
| | | }
|
| | |
|
| | | int differentDays = 0;
|
| | | String couponTerm = "有效期:";
|
| | | Date startTime = userCouponVO.getStartTime();
|
| | | Date endTime = userCouponVO.getEndTime();
|
| | | if (endTime != null && startTime != null) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | couponTerm = couponTerm + sdf.format(startTime) + "-" + sdf.format(endTime);
|
| | |
|
| | | differentDays = DateUtil.differentDaysByMillisecond(new Date(), endTime) + 1;
|
| | | if (differentDays < 0) {
|
| | | differentDays = 0;
|
| | | }
|
| | | }
|
| | |
|
| | | userCouponVO.setCouponTerm(couponTerm);
|
| | |
|
| | | // 剩余天数
|
| | | Map<String, Object> remainDays = new HashMap<String, Object>();
|
| | | remainDays.put("content", "还剩" + differentDays + "天过期");
|
| | | remainDays.put("fontColor", "#F14242");
|
| | | userCouponVO.setRemainDays(remainDays);
|
| | | }
|
| | |
|
| | | return listVO;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 是否存在奖励券
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public boolean hasRewardCoupon(Long uid) {
|
| | | boolean hasCoupon = false;
|
| | |
|
| | | try {
|
| | | List<UserSystemCouponVO> orderCouponList = getOrderCouponList(uid);
|
| | | if (orderCouponList != null && orderCouponList.size() > 0) {
|
| | | hasCoupon = true;
|
| | | }
|
| | | } catch (UserSystemCouponException e) {
|
| | | e.printStackTrace();
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | return hasCoupon;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<UserSystemCouponVO> getOrderCouponList(Long uid) throws UserSystemCouponException, Exception {
|
| | | if (uid == null) {
|
| | | throw new UserSystemCouponException(1, "用户未登录");
|
| | | }
|
| | | // 订单相关的券
|
| | | List<SystemCoupon> couponList = systemCouponService.getOrderCouponList();
|
| | | if (couponList == null || couponList.size() == 0) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | return getEnableListByCouponId(uid, 1, couponList);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<UserSystemCouponVO> getGoodsCouponList(Long uid) throws UserSystemCouponException, Exception {
|
| | | if (uid == null) {
|
| | | throw new UserSystemCouponException(1, "用户未登录");
|
| | | }
|
| | | // 商品相关的券
|
| | | List<SystemCoupon> couponList = systemCouponService.getGoodsCouponList();
|
| | | if (couponList == null || couponList.size() == 0) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | return getEnableListByCouponId(uid, null, couponList);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void useGoodsCoupon(Long uid, Long id, Long goodId) throws UserSystemCouponException, Exception {
|
| | | if (uid == null) {
|
| | | throw new UserSystemCouponException(1, "用户未登录");
|
| | | }
|
| | |
|
| | | if (id == null) {
|
| | | throw new UserSystemCouponException(1, "券数据有误");
|
| | | }
|
| | |
|
| | | UserSystemCoupon userSystemCoupon = selectByPrimaryKey(id);
|
| | | if (userSystemCoupon == null) {
|
| | | throw new UserSystemCouponException(1, "券数据不正确");
|
| | | }
|
| | |
|
| | | Long couponUid = userSystemCoupon.getUid();
|
| | | if (!uid.equals(couponUid)) {
|
| | | throw new UserSystemCouponException(1, "传递参数不匹配");
|
| | | }
|
| | | |
| | | SystemCoupon systemCoupon = userSystemCoupon.getSystemCoupon();
|
| | | |
| | | SystemCoupon baseCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
|
| | | if (baseCoupon == null || baseCoupon.getId() == null) {
|
| | | throw new UserSystemCouponException(1, "未找到券基本信息");
|
| | | }
|
| | |
|
| | | Date date = new Date();
|
| | | // 更新券使用
|
| | | userSystemCoupon.setState(UserSystemCoupon.STATE_IN_USE); // 正在匹配
|
| | | userSystemCoupon.setUseTime(date);
|
| | | userSystemCoupon.setUpdateTime(date);
|
| | | userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
|
| | |
|
| | | // 插入使用券记录
|
| | | UserSystemCouponRecord couponRecord = new UserSystemCouponRecord();
|
| | | couponRecord.setGoodId(goodId);
|
| | | couponRecord.setGoodSource(Constant.SOURCE_TYPE_TAOBAO); // 默认淘宝
|
| | | couponRecord.setState(UserSystemCouponRecord.STATE_WAIT); // 正在匹配
|
| | | couponRecord.setUserSystemCoupon(userSystemCoupon);
|
| | | couponRecord.setCouponType(baseCoupon.getType().name());
|
| | | couponRecord.setCreateTime(date);
|
| | | couponRecord.setUpdateTime(date);
|
| | | userSystemCouponRecordService.insertSelective(couponRecord);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void useOrderCoupon(Long uid, Long id, String orderNo) throws UserSystemCouponException, Exception {
|
| | |
|
| | | if (id == null) {
|
| | | throw new UserSystemCouponException(1, "券id不存在");
|
| | | }
|
| | |
|
| | | // 用户券
|
| | | UserSystemCoupon userSystemCoupon = selectByPrimaryKey(id);
|
| | | if (userSystemCoupon == null) {
|
| | | throw new UserSystemCouponException(1, "券信息不存在");
|
| | | }
|
| | |
|
| | | // 系统券信息
|
| | | SystemCoupon systemCoupon = userSystemCoupon.getSystemCoupon();
|
| | | if (systemCoupon != null && systemCoupon.getId() != null) {
|
| | | systemCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
|
| | | if (systemCoupon == null) {
|
| | | throw new UserSystemCouponException(1, "券已不存在");
|
| | | }
|
| | | }
|
| | |
|
| | | if (orderNo == null || orderNo.trim().length() == 0) {
|
| | | throw new UserSystemCouponException(1, "订单号不存在");
|
| | | }
|
| | |
|
| | | // 订单
|
| | | CommonOrderVO orderVO = commonOrderService.getCommonOrderByOrderNo(uid, orderNo, CommonOrder.STATE_JS);
|
| | | if (orderVO == null) {
|
| | | throw new UserSystemCouponException(1, "订单信息获取失败");
|
| | | }
|
| | |
|
| | | Long commonOrderId = orderVO.getId();
|
| | |
|
| | | BigDecimal hongBao = orderVO.getHongBao();
|
| | | // 红包状态
|
| | | Integer hongBaoState = orderVO.getHongBaoState();
|
| | | // 红包类型
|
| | | Integer hongBaoType = orderVO.getHongBaoType();
|
| | |
|
| | | // 条件: A:必须是返利订单 、B:必须已经处于已到账状态
|
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType && HongBaoV2.STATE_YILINGQU == hongBaoState || hongBao != null) {
|
| | |
|
| | | /* 奖金计算 以及相关红包信息处理 */
|
| | |
|
| | | // 转换成小数点
|
| | | BigDecimal percent = MoneyBigDecimalUtil.mul(systemCoupon.getPercent(), new BigDecimal(0.01));
|
| | | // 提成金额
|
| | | BigDecimal money = MoneyBigDecimalUtil.mul(hongBao, percent);
|
| | |
|
| | | // 1、插入红包数据
|
| | | HongBaoV2 hongBaoV2 = new HongBaoV2();
|
| | | hongBaoV2.setMoney(money);
|
| | | hongBaoV2.setType(HongBaoV2.TYPE_COUPON);
|
| | | hongBaoV2.setState(HongBaoV2.STATE_YILINGQU);
|
| | | hongBaoV2.setVersion(2);
|
| | | hongBaoV2.setCreateTime(new Date());
|
| | | hongBaoV2.setUpdateTime(new Date());
|
| | | hongBaoV2.setUserInfo(new UserInfo(uid));
|
| | | hongBaoV2Service.insertSelective(hongBaoV2);
|
| | |
|
| | | // 2、订单关联红包表
|
| | | HongBaoOrder hongBaoOrder = new HongBaoOrder();
|
| | | hongBaoOrder.setHongBaoV2(hongBaoV2);
|
| | | hongBaoOrder.setCommonOrder(new CommonOrder(commonOrderId));
|
| | | hongBaoOrderService.insertSelective(hongBaoOrder);
|
| | |
|
| | | // TODO 红包相关信息插入以及通知
|
| | |
|
| | | /* 用户券信息状态及记录处理 */
|
| | |
|
| | | Date date = new Date();
|
| | | // 更新券状态:已使用
|
| | | userSystemCoupon.setState(UserSystemCoupon.STATE_END_USE);
|
| | | userSystemCoupon.setUseTime(date);
|
| | | userSystemCoupon.setUpdateTime(date);
|
| | | userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
|
| | |
|
| | | // 插入使用券记录
|
| | | UserSystemCouponRecord couponRecord = new UserSystemCouponRecord();
|
| | | couponRecord.setState(UserSystemCouponRecord.STATE_SUCCESS);
|
| | | couponRecord.setOrderNo(orderNo);
|
| | | couponRecord.setUserSystemCoupon(userSystemCoupon);
|
| | | couponRecord.setCouponType(systemCoupon.getType().name());
|
| | | couponRecord.setCreateTime(date);
|
| | | couponRecord.setUpdateTime(date);
|
| | | userSystemCouponRecordService.insertSelective(couponRecord);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public UserSystemCouponRecordVO getRewardCouponRecord(String orderNo) throws UserSystemCouponException, Exception {
|
| | |
|
| | | if (orderNo == null || orderNo.trim().length() == 0) {
|
| | | throw new UserSystemCouponException(1, "订单号不存在");
|
| | | }
|
| | |
|
| | | // 查询记录
|
| | | UserSystemCouponRecord record = userSystemCouponRecordService.getRecordByOrderNo(orderNo,
|
| | | UserSystemCouponRecord.STATE_SUCCESS);
|
| | | if (record == null) {
|
| | | throw new UserSystemCouponException(1, "没有使用券记录");
|
| | | }
|
| | |
|
| | | UserSystemCoupon userSystemCoupon = record.getUserSystemCoupon();
|
| | | if (userSystemCoupon == null) {
|
| | | throw new UserSystemCouponException(1, "未找到用户的券信息");
|
| | | }
|
| | |
|
| | | SystemCoupon systemCoupon = userSystemCoupon.getSystemCoupon();
|
| | | if (systemCoupon == null || systemCoupon.getId() == null) {
|
| | | throw new UserSystemCouponException(1, "未找到用户的券信息");
|
| | | }
|
| | |
|
| | | SystemCoupon baseCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
|
| | | if (baseCoupon == null || baseCoupon.getId() == null) {
|
| | | throw new UserSystemCouponException(1, "未找到券基本信息");
|
| | | }
|
| | |
|
| | | CouponTypeEnum couponType = baseCoupon.getType();
|
| | | if (CouponTypeEnum.rebatePercentCoupon != couponType) {
|
| | | throw new UserSystemCouponException(1, "券类型不正确");
|
| | | }
|
| | |
|
| | | List<CommonOrderVO> list = commonOrderService.getCouponHongbaoByOrderNo(userSystemCoupon.getUid(),
|
| | | HongBaoV2.STATE_YILINGQU, orderNo);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | throw new UserSystemCouponException(1, "订单信息获取失败");
|
| | | }
|
| | |
|
| | | UserSystemCouponRecordVO userRecordVO = new UserSystemCouponRecordVO();
|
| | | userRecordVO.setCouponMoneyState("已到账");
|
| | | userRecordVO.setCommonOrder(list.get(0));
|
| | | userRecordVO.setCouponName("奖励金: ¥" + list.get(0).getCouponMoney().setScale(2, BigDecimal.ROUND_DOWN));
|
| | |
|
| | | // 比例
|
| | | BigDecimal percent = baseCoupon.getPercent();
|
| | | BigDecimal hongBao = list.get(0).getHongBao().setScale(2, BigDecimal.ROUND_DOWN);
|
| | | userRecordVO.setCouponEffect("返利¥" + hongBao + "已返" + percent + "%");
|
| | |
|
| | | // 跳转福利中心
|
| | | JumpDetailV2 welfareCore = jumpDetailV2Service.getByTypeCache("welfareCore");
|
| | | Map<String, Object> jumpWelfare = new HashMap<String, Object>();
|
| | | jumpWelfare.put("jumpDetail", welfareCore);
|
| | | Map<String, Object> jumpparms = new HashMap<String, Object>();
|
| | | jumpWelfare.put("parms", jumpparms);
|
| | | userRecordVO.setJumpWelfare(jumpWelfare);
|
| | |
|
| | | // 跳转奖励券规则
|
| | | userRecordVO.setRuleLink(configService.get("reward_coupon_help"));
|
| | |
|
| | | String rewardCouponRemark = configService.get("reward_coupon_remark");
|
| | | if (rewardCouponRemark != null && rewardCouponRemark.trim().length() > 0) {
|
| | | userRecordVO.setRemark(JSONObject.fromObject(rewardCouponRemark));
|
| | | }
|
| | |
|
| | | return userRecordVO;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public UserSystemCouponRecordVO getFreeCouponRecord(String orderNo) throws UserSystemCouponException, Exception {
|
| | |
|
| | | if (orderNo == null || orderNo.trim().length() == 0) {
|
| | | throw new UserSystemCouponException(1, "订单号不存在");
|
| | | }
|
| | |
|
| | | // 查询记录
|
| | | UserSystemCouponRecord record = userSystemCouponRecordService.getRecordByOrderNo(orderNo, null);
|
| | | if (record == null) {
|
| | | throw new UserSystemCouponException(1, "没有使用券记录");
|
| | | }
|
| | |
|
| | | UserSystemCoupon userSystemCoupon = record.getUserSystemCoupon();
|
| | | if (userSystemCoupon == null) {
|
| | | throw new UserSystemCouponException(1, "未找到用户的券信息");
|
| | | }
|
| | |
|
| | | SystemCoupon systemCoupon = userSystemCoupon.getSystemCoupon();
|
| | | if (systemCoupon == null || systemCoupon.getId() == null) {
|
| | | throw new UserSystemCouponException(1, "未找到用户的券信息");
|
| | | }
|
| | |
|
| | | SystemCoupon baseCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
|
| | | if (baseCoupon == null || baseCoupon.getId() == null) {
|
| | | throw new UserSystemCouponException(1, "未找到券基本信息");
|
| | | }
|
| | |
|
| | | // 订单
|
| | | CommonOrderVO orderVO = commonOrderService.getCommonOrderByOrderNo(userSystemCoupon.getUid(), orderNo, null);
|
| | | if (orderVO == null) {
|
| | | throw new UserSystemCouponException(1, "订单信息获取失败");
|
| | | }
|
| | | |
| | | UserSystemCouponRecordVO userRecordVO = new UserSystemCouponRecordVO();
|
| | | userRecordVO.setCommonOrder(orderVO);
|
| | | |
| | | ClientTextStyleVO fanMoney = new ClientTextStyleVO();
|
| | | fanMoney.setContent("返利: ¥" + orderVO.getHongBao().setScale(2, BigDecimal.ROUND_DOWN)); |
| | | fanMoney.setColor("#000000"); // 默认黑色
|
| | | userRecordVO.setFanMoney(fanMoney);
|
| | | |
| | | ClientTextStyleVO payMoney = new ClientTextStyleVO();
|
| | | payMoney.setContent("实付款:¥"+ orderVO.getPayment().setScale(2, BigDecimal.ROUND_DOWN)); |
| | | payMoney.setColor("#000000"); // 默认黑色
|
| | | |
| | | |
| | | String progressMsg = "";
|
| | | String progressColor = "";
|
| | | // 跳转奖励券规则
|
| | | userRecordVO.setRuleLink(configService.get("reward_coupon_help"));
|
| | |
|
| | | // 进度: 1 灰色 2 红色 3 绿色
|
| | | String progressState1 = "3";
|
| | | String progressState2 = "1"; |
| | | String progressState3 = "1";
|
| | | String progressState4 = "1";
|
| | | |
| | | String goodsState = "商品收货";
|
| | | // 文字状态
|
| | | String text2Color = "#999999";
|
| | | String text3Color = "#999999";
|
| | | String text4Color = "#999999";
|
| | | |
| | | // 底部备注
|
| | | String rewardCouponRemark = "";
|
| | | // 状态跳转
|
| | | JumpDetailV2 jumpDetail = null;
|
| | | // 进度状态 1等待 2 失败 3成功
|
| | | int progressState = 1;
|
| | | |
| | | Integer stateRecord = record.getState();
|
| | | if (UserSystemCouponRecord.STATE_FAIL_RULE == stateRecord) {
|
| | | // 规则不匹配
|
| | | progressState = 2;
|
| | | |
| | | progressColor = "#E41212";
|
| | | progressMsg = "抱歉不符合免单规则,免单失败" ;
|
| | | |
| | | progressState1 = "2"; //不匹配
|
| | | |
| | | payMoney.setColor("#E41212");
|
| | | |
| | | userRecordVO.setCouponMoneyState("已退回");
|
| | | userRecordVO.setCouponName(baseCoupon.getName());
|
| | | |
| | | jumpDetail = jumpDetailV2Service.getByTypeCache("welfareCore");
|
| | | |
| | | rewardCouponRemark = configService.get("free_coupon_back_remark");
|
| | | |
| | | } else if (UserSystemCouponRecord.STATE_FAIL_DRAWBACK == stateRecord) {
|
| | | // 退款
|
| | | progressState = 2;
|
| | | |
| | | progressColor = "#E41212";
|
| | | progressMsg = "商品已退款,免单失败";
|
| | | |
| | | text2Color = "#E41212";
|
| | | goodsState = "商品已退款";
|
| | | |
| | | progressState2 = "2";
|
| | | |
| | | userRecordVO.setCouponMoneyState("已退回");
|
| | | userRecordVO.setCouponName(baseCoupon.getName());
|
| | | |
| | | jumpDetail = jumpDetailV2Service.getByTypeCache("welfareCore");
|
| | | |
| | | rewardCouponRemark = configService.get("free_coupon_back_remark");
|
| | | |
| | | } else if (UserSystemCouponRecord.STATE_FREE_ON == stateRecord) {
|
| | | // 免单中
|
| | | if (CommonOrder.STATE_JS == orderVO.getState()) {
|
| | | progressColor = "#ECA01B";
|
| | | progressMsg = "免单进行中,等待返利到账";
|
| | | text2Color = "#000000";
|
| | | progressState2 = "3";
|
| | | } else {
|
| | | progressColor = "#ECA01B";
|
| | | progressMsg = "免单发起,等待收货";
|
| | | }
|
| | | |
| | | rewardCouponRemark = configService.get("free_coupon_remark");
|
| | | |
| | | } else if (UserSystemCouponRecord.STATE_SUCCESS == stateRecord) {
|
| | | // 免单成功
|
| | | progressState = 3;
|
| | | |
| | | progressColor = "#3EBF13";
|
| | | progressMsg = "免单成功,免单金已转入余额";
|
| | | |
| | | progressState2 = "3";
|
| | | progressState3 = "3";
|
| | | progressState4 = "3";
|
| | | |
| | | text2Color = "#000000";
|
| | | text3Color = "#000000";
|
| | | text4Color = "#000000";
|
| | | |
| | | userRecordVO.setCouponMoneyState("已到账");
|
| | | userRecordVO.setCouponName("返利: ¥" + orderVO.getHongBao().setScale(2, BigDecimal.ROUND_DOWN));
|
| | | |
| | | jumpDetail = jumpDetailV2Service.getByTypeCache("capitalDetails");
|
| | | |
| | | rewardCouponRemark = configService.get("free_coupon_remark");
|
| | | }
|
| | | userRecordVO.setProgressState(progressState);
|
| | | userRecordVO.setPayMoney(payMoney);
|
| | | |
| | | // 显示提示较大字
|
| | | ClientTextStyleVO progressMsgStyle = new ClientTextStyleVO();
|
| | | progressMsgStyle.setContent(progressMsg); |
| | | progressMsgStyle.setColor(progressColor);
|
| | | userRecordVO.setProgressMsg(progressMsgStyle);
|
| | | |
| | | /* --- 进度点 ---- */
|
| | | Map<String, Object> map1 = new HashMap<String, Object>();
|
| | | map1.put("state", progressState1);
|
| | | |
| | | Map<String, Object> map2 = new HashMap<String, Object>();
|
| | | map2.put("state", progressState2);
|
| | | ClientTextStyleVO style2 = new ClientTextStyleVO();
|
| | | style2.setContent(goodsState); |
| | | style2.setColor(text2Color);
|
| | | map2.put("text", style2);
|
| | | |
| | | Map<String, Object> map3 = new HashMap<String, Object>();
|
| | | map3.put("state", progressState3);
|
| | | ClientTextStyleVO style3 = new ClientTextStyleVO();
|
| | | style3.setContent("返利到账"); |
| | | style3.setColor(text3Color);
|
| | | map3.put("text", style3);
|
| | | |
| | | Map<String, Object> map4 = new HashMap<String, Object>();
|
| | | map4.put("state", progressState4);
|
| | | ClientTextStyleVO style4 = new ClientTextStyleVO();
|
| | | style4.setContent("免单成功"); |
| | | style4.setColor(text4Color);
|
| | | map4.put("text", style4);
|
| | | |
| | | // 圆点颜色
|
| | | List<Object> progressList = new ArrayList<Object>();
|
| | | progressList.add(map1);
|
| | | progressList.add(map2);
|
| | | progressList.add(map3);
|
| | | progressList.add(map4);
|
| | | userRecordVO.setProgressList(progressList);
|
| | | |
| | | if (jumpDetail != null) {
|
| | | Map<String, Object> jumpState = new HashMap<String, Object>();
|
| | | jumpState.put("jumpDetail", jumpDetail);
|
| | | Map<String, Object> jumpparms = new HashMap<String, Object>();
|
| | | jumpState.put("parms", jumpparms);
|
| | | userRecordVO.setJumpWelfare(jumpState);
|
| | | }
|
| | |
|
| | | if (rewardCouponRemark != null && rewardCouponRemark.trim().length() > 0) {
|
| | | userRecordVO.setRemark(JSONObject.fromObject(rewardCouponRemark));
|
| | | }
|
| | | |
| | | return userRecordVO;
|
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.config;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | |
|
| | | public interface SystemCouponService {
|
| | |
|
| | | public int insertSelective(SystemCoupon record);
|
| | |
|
| | | public SystemCoupon selectByPrimaryKey(Long id);
|
| | |
|
| | | public int updateByPrimaryKeySelective(SystemCoupon record);
|
| | |
|
| | | public int updateByPrimaryKey(SystemCoupon record);
|
| | | |
| | | /**
|
| | | * 根据主键批量删除
|
| | | * @param list
|
| | | * @return
|
| | | */
|
| | | public int deleteBatchByPrimaryKey(List<Long> list);
|
| | |
|
| | | /**
|
| | | * 跟订单使用的券
|
| | | * @return
|
| | | */
|
| | | public List<SystemCoupon> getOrderCouponList();
|
| | | |
| | |
|
| | | /**
|
| | | * 跟商品使用的券
|
| | | * @return
|
| | | */
|
| | | public List<SystemCoupon> getGoodsCouponList();
|
| | | |
| | | }
|
| | |
| | | */
|
| | | public List<Special> listBySystemAndCard(String card, Long systemId);
|
| | |
|
| | | /**
|
| | | * 活动列表-分页
|
| | | * @param start
|
| | | * @param count
|
| | | * @param card
|
| | | * @param systemId
|
| | | * @return
|
| | | */
|
| | | public List<Special> listPageBySystemAndCard(long start, int count, String card, Long systemId);
|
| | |
|
| | | }
|
| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.lable.Label;
|
| | |
| | |
|
| | |
|
| | | public List<Label> selectByTitleCache(String labKey, String title) throws LabelException;
|
| | |
|
| | | /**
|
| | | * 新建标签
|
| | | * @param lableNames 空格隔开
|
| | | * @param admin
|
| | | * @return
|
| | | */
|
| | | public List<Label> addBatchByNames(String lableNames, AdminUser admin) throws LabelException;
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public Long queryCountByGoodsId(Long goodsId);
|
| | |
|
| | | /**
|
| | | * 批量入库--淘宝
|
| | | * |
| | | * @param auctionIdList
|
| | | * @param admin
|
| | | * @throws Exception
|
| | | */
|
| | | public void addBatch(List<Long> auctionIdList, String las, AdminUser admin) throws Exception;
|
| | |
|
| | | /**
|
| | | * 精选库商品筛选
|
| | |
| | | */
|
| | | public List<QualityFactory> listByMinSalesCountOrderByCreateTimeDesc(int salesCount, int page, int pageSize);
|
| | |
|
| | | /**
|
| | | * 批量添加商品至精选库 并贴上标签
|
| | | * @param listTaoBaoGoods
|
| | | * @param lableNames
|
| | | * @param admin
|
| | | * @throws Exception
|
| | | */
|
| | | public void addBatchTaoBaoGoods(List<TaoBaoGoodsBrief> listTaoBaoGoods, String lableNames, AdminUser admin)
|
| | | throws Exception;
|
| | |
|
| | | /**
|
| | | * 根据淘宝id获取详情插入精选库
|
| | | * @param listTaoBaoId
|
| | | * @param lableNames
|
| | | * @param admin
|
| | | * @throws Exception
|
| | | */
|
| | | public void addBatchGoodsByTaoBaoId(List<Long> listTaoBaoId, String lableNames, AdminUser admin) throws Exception;
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public Map<String, Object> lastMonthSettleOrderNumber(Long uid);
|
| | |
|
| | | /**
|
| | | * 是否产生订单:自购、分享有效订单数量
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public boolean hasRebateAndShareOrder(Long uid);
|
| | |
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | public interface CommonOrderService {
|
| | |
|
| | | public int insert(CommonOrder record);
|
| | |
| | | public long countQuery(Integer keyType, String key, Integer state, Integer type, Integer orderState, String startTime,
|
| | | String endTime) throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 根据订单号获取信息
|
| | | * @param orderNo
|
| | | * @return
|
| | | * @throws CommonOrderException
|
| | | */
|
| | | public CommonOrderVO getInfoByOrderNo(Long uid, String orderNo) throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 查询券奖励金额以及订单信息
|
| | | * @param uid
|
| | | * @param state
|
| | | * @param orderNo
|
| | | * @return
|
| | | * @throws CommonOrderException
|
| | | */
|
| | | public List<CommonOrderVO> getCouponHongbaoByOrderNo(Long uid, Integer state, String orderNo) throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 查询订单
|
| | | * @param uid
|
| | | * @param orderNo
|
| | | * @return
|
| | | * @throws CommonOrderException
|
| | | */
|
| | | public CommonOrderVO getCommonOrderByOrderNo(Long uid, String orderNo, Integer orderState) throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 使用奖励券成功后跳转 修改
|
| | | * @param orderNo
|
| | | * @return
|
| | | */
|
| | | public JSONObject getRewardJumpInfo(String orderNo);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.DeviceLotteryRecord;
|
| | |
|
| | | public interface DeviceLotteryRecordService {
|
| | |
|
| | | public int insertSelective(DeviceLotteryRecord record);
|
| | |
|
| | | public DeviceLotteryRecord selectByPrimaryKey(Long id);
|
| | |
|
| | | public int updateByPrimaryKeySelective(DeviceLotteryRecord record);
|
| | |
|
| | | public int updateByPrimaryKey(DeviceLotteryRecord record);
|
| | |
|
| | | public List<DeviceLotteryRecord> listByPlatformAndDevice(int platform, String device);
|
| | | |
| | | }
|
| | |
| | | public int insertBatch(List<ShamUser> list);
|
| | |
|
| | | public int updateBatchSelective(List<ShamUser> list);
|
| | |
|
| | | /**
|
| | | * 随机一定的用户
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | public List<ShamUser> listRandUser(int count);
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | |
|
| | | public interface UserSystemCouponRecordService {
|
| | |
|
| | | public int insertSelective(UserSystemCouponRecord record);
|
| | |
|
| | | public UserSystemCouponRecord selectByPrimaryKey(Long id);
|
| | |
|
| | | public int updateByPrimaryKeySelective(UserSystemCouponRecord record);
|
| | |
|
| | | public int updateByPrimaryKey(UserSystemCouponRecord record);
|
| | |
|
| | | public UserSystemCouponRecord getRecordByOrderNo(String orderNo, Integer state);
|
| | |
|
| | | public List<UserSystemCouponRecord> getRecordByOrderNoList(List<String> list);
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.exception.user.UserSystemCouponException;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponRecordVO;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponVO;
|
| | |
|
| | | public interface UserSystemCouponService {
|
| | | public int insertSelective(UserSystemCoupon record);
|
| | |
|
| | | public UserSystemCoupon selectByPrimaryKey(Long id);
|
| | |
|
| | | public int updateByPrimaryKeySelective(UserSystemCoupon record);
|
| | |
|
| | | public int updateByPrimaryKey(UserSystemCoupon record);
|
| | |
|
| | | /**
|
| | | * 查询用户券列表 返回基础对象
|
| | | * @param start
|
| | | * @param count
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public List<UserSystemCoupon> getUserCouponList(long start, int count, Long uid);
|
| | |
|
| | | /**
|
| | | * 查询用户券列表 返回VO对象
|
| | | * @param start
|
| | | * @param count
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public List<UserSystemCouponVO> getUserCouponVOList(long start, int count, Long uid) throws UserSystemCouponException, Exception;
|
| | |
|
| | | /**
|
| | | * 统计数量
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public long countUserCouponList(Long uid);
|
| | |
|
| | | /**
|
| | | * 券ID信息查询用户拥有券
|
| | | * @param uid
|
| | | * @param couponList
|
| | | * @return
|
| | | * @throws UserSystemCouponException
|
| | | * @throws Exception
|
| | | */
|
| | | public List<UserSystemCouponVO> getEnableListByCouponId(Long uid, Integer activated, List<SystemCoupon> couponList)
|
| | | throws UserSystemCouponException, Exception;
|
| | |
|
| | | /**
|
| | | * 查询订单使用相关券
|
| | | * @param uid
|
| | | * @return
|
| | | * @throws UserSystemCouponException
|
| | | * @throws Exception
|
| | | */
|
| | | public List<UserSystemCouponVO> getOrderCouponList(Long uid) throws UserSystemCouponException, Exception;
|
| | |
|
| | | /**
|
| | | * 查询商品使用相关券
|
| | | * @param uid
|
| | | * @return
|
| | | * @throws UserSystemCouponException
|
| | | * @throws Exception
|
| | | */
|
| | | public List<UserSystemCouponVO> getGoodsCouponList(Long uid) throws UserSystemCouponException, Exception;
|
| | |
|
| | | /**
|
| | | * 更新券使用记录
|
| | | * @param uid
|
| | | * @param id
|
| | | * @throws UserSystemCouponException
|
| | | * @throws Exception
|
| | | */
|
| | | public void useGoodsCoupon(Long uid, Long id, Long goodId) throws UserSystemCouponException, Exception;
|
| | | |
| | | |
| | | /**
|
| | | * 更新券使用记录
|
| | | * @param uid
|
| | | * @param id
|
| | | * @throws UserSystemCouponException
|
| | | * @throws Exception
|
| | | */
|
| | | public void useOrderCoupon(Long uid, Long id, String orderNo) throws UserSystemCouponException, Exception;
|
| | |
|
| | | /**
|
| | | * 根据订单号获取奖励券使用进度
|
| | | * @param orderNo
|
| | | * @return |
| | | * @throws UserSystemCouponException
|
| | | * @throws Exception
|
| | | */
|
| | | public UserSystemCouponRecordVO getRewardCouponRecord(String orderNo) throws UserSystemCouponException, Exception;
|
| | |
|
| | | /**
|
| | | * 是否存在奖励券
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public boolean hasRewardCoupon(Long uid);
|
| | |
|
| | | /**
|
| | | * 根据订单号获取免单券使用进度
|
| | | * @param orderNo
|
| | | * @return
|
| | | * @throws UserSystemCouponException
|
| | | * @throws Exception
|
| | | */
|
| | | public UserSystemCouponRecordVO getFreeCouponRecord(String orderNo) throws UserSystemCouponException, Exception;
|
| | |
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.mybatishandler;
|
| | |
|
| | | import java.sql.CallableStatement;
|
| | | import java.sql.PreparedStatement;
|
| | | import java.sql.ResultSet;
|
| | | import java.sql.SQLException;
|
| | |
|
| | | import org.apache.ibatis.type.BaseTypeHandler;
|
| | | import org.apache.ibatis.type.JdbcType;
|
| | |
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | |
|
| | | public class CouponTypeEnumHandler extends BaseTypeHandler<CouponTypeEnum> {
|
| | |
|
| | | @Override
|
| | | public CouponTypeEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
|
| | | String key = arg0.getString(arg1);
|
| | | if (arg0.wasNull()) {
|
| | | return null;
|
| | | } else {
|
| | | return CouponTypeEnum.valueOf(key);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public CouponTypeEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
|
| | | String key = arg0.getString(arg1);
|
| | | if (arg0.wasNull()) {
|
| | | return null;
|
| | | } else {
|
| | | // 根据数据库中的key值,定位SexEnum子类
|
| | | return CouponTypeEnum.valueOf(key);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public CouponTypeEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
|
| | | String key = arg0.getString(arg1);
|
| | | if (arg0.wasNull()) {
|
| | | return null;
|
| | | } else {
|
| | | // 根据数据库中的key值,定位SexEnum子类
|
| | | return CouponTypeEnum.valueOf(key);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void setNonNullParameter(PreparedStatement arg0, int arg1, CouponTypeEnum arg2, JdbcType arg3)
|
| | | throws SQLException {
|
| | | arg0.setString(arg1, arg2.name());
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.vo.msg;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | | public class ClientTextStyleVO {
|
| | | @Expose
|
| | | private String content;
|
| | | @Expose
|
| | | private String color;
|
| | | @Expose
|
| | | private String bottomColor;
|
| | | @Expose
|
| | | private String img;
|
| | |
|
| | | public ClientTextStyleVO(String content, String color) {
|
| | |
| | | public void setColor(String color) {
|
| | | this.color = color;
|
| | | }
|
| | |
|
| | | public String getBottomColor() {
|
| | | return bottomColor;
|
| | | }
|
| | |
|
| | | public void setBottomColor(String bottomColor) {
|
| | | this.bottomColor = bottomColor;
|
| | | }
|
| | | }
|
| | |
| | | // 订单总预估奖金
|
| | | private BigDecimal hongBao;
|
| | |
|
| | | // 券红包金额
|
| | | @Expose
|
| | | private BigDecimal couponMoney;
|
| | | // 1 淘宝 2 天猫
|
| | | @Expose
|
| | | private Integer orderType;
|
| | |
| | | @Expose
|
| | | private List<CommonOrderGoodsVO> listOrderGoods = new ArrayList<CommonOrderGoodsVO>();
|
| | |
|
| | | // 订单状态列表
|
| | | @Expose
|
| | | private List<String> signList;
|
| | | // 收货时间
|
| | | @Expose
|
| | | private Map<String, Object> rewardDetail;
|
| | | |
| | | |
| | |
|
| | | // 直接收益人-ID
|
| | | private String userId;
|
| | |
| | | this.userPortrait = userPortrait;
|
| | | }
|
| | |
|
| | |
|
| | | public Map<String, Object> getRewardDetail() {
|
| | | return rewardDetail;
|
| | | }
|
| | |
|
| | | public void setRewardDetail(Map<String, Object> rewardDetail) {
|
| | | this.rewardDetail = rewardDetail;
|
| | | }
|
| | |
|
| | | public List<String> getSignList() {
|
| | | return signList;
|
| | | }
|
| | |
|
| | | public void setSignList(List<String> signList) {
|
| | | this.signList = signList;
|
| | | }
|
| | |
|
| | | public BigDecimal getCouponMoney() {
|
| | | return couponMoney;
|
| | | }
|
| | |
|
| | | public void setCouponMoney(BigDecimal couponMoney) {
|
| | | this.couponMoney = couponMoney;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.vo.user;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | public class UserSystemCouponRecordVO extends UserSystemCouponRecord implements Serializable {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | // 券名称 /返利多少
|
| | | @Expose
|
| | | private String couponName;
|
| | |
|
| | | // 顶部返利金额信息
|
| | | @Expose
|
| | | private String couponEffect;
|
| | | |
| | | // 是否到账
|
| | | @Expose
|
| | | private String couponMoneyState;
|
| | | |
| | | // 订单信息
|
| | | @Expose
|
| | | private CommonOrderVO commonOrder;
|
| | | |
| | | // 状态栏按钮
|
| | | @Expose
|
| | | private Map<String, Object> jumpWelfare;
|
| | | |
| | | // 券规则按钮
|
| | | @Expose
|
| | | private String ruleLink;
|
| | | |
| | | // 备注
|
| | | private JSONObject remark;
|
| | | |
| | | // 进度状态
|
| | | @Expose
|
| | | private Integer progressState;
|
| | | |
| | | // 上方文字
|
| | | @Expose
|
| | | private ClientTextStyleVO progressMsg;
|
| | | |
| | | // 实付款
|
| | | @Expose
|
| | | private ClientTextStyleVO payMoney;
|
| | | |
| | | // 返利
|
| | | @Expose
|
| | | private ClientTextStyleVO fanMoney;
|
| | | |
| | | @Expose
|
| | | private List<Object> progressList;
|
| | | |
| | |
|
| | | public String getCouponName() {
|
| | | return couponName;
|
| | | }
|
| | |
|
| | | public void setCouponName(String couponName) {
|
| | | this.couponName = couponName;
|
| | | }
|
| | |
|
| | | public String getCouponEffect() {
|
| | | return couponEffect;
|
| | | }
|
| | |
|
| | | public void setCouponEffect(String couponEffect) {
|
| | | this.couponEffect = couponEffect;
|
| | | }
|
| | |
|
| | | public String getCouponMoneyState() {
|
| | | return couponMoneyState;
|
| | | }
|
| | |
|
| | | public void setCouponMoneyState(String couponMoneyState) {
|
| | | this.couponMoneyState = couponMoneyState;
|
| | | }
|
| | |
|
| | | public CommonOrderVO getCommonOrder() {
|
| | | return commonOrder;
|
| | | }
|
| | |
|
| | | public void setCommonOrder(CommonOrderVO commonOrder) {
|
| | | this.commonOrder = commonOrder;
|
| | | }
|
| | |
|
| | | public Map<String, Object> getJumpWelfare() {
|
| | | return jumpWelfare;
|
| | | }
|
| | |
|
| | | public void setJumpWelfare(Map<String, Object> jumpWelfare) {
|
| | | this.jumpWelfare = jumpWelfare;
|
| | | }
|
| | |
|
| | | public String getRuleLink() {
|
| | | return ruleLink;
|
| | | }
|
| | |
|
| | | public void setRuleLink(String ruleLink) {
|
| | | this.ruleLink = ruleLink;
|
| | | }
|
| | |
|
| | | public JSONObject getRemark() {
|
| | | return remark;
|
| | | }
|
| | |
|
| | | public void setRemark(JSONObject remark) {
|
| | | this.remark = remark;
|
| | | }
|
| | |
|
| | | public ClientTextStyleVO getProgressMsg() {
|
| | | return progressMsg;
|
| | | }
|
| | |
|
| | | public void setProgressMsg(ClientTextStyleVO progressMsg) {
|
| | | this.progressMsg = progressMsg;
|
| | | }
|
| | |
|
| | | public ClientTextStyleVO getPayMoney() {
|
| | | return payMoney;
|
| | | }
|
| | |
|
| | | public void setPayMoney(ClientTextStyleVO payMoney) {
|
| | | this.payMoney = payMoney;
|
| | | }
|
| | |
|
| | | public ClientTextStyleVO getFanMoney() {
|
| | | return fanMoney;
|
| | | }
|
| | |
|
| | | public void setFanMoney(ClientTextStyleVO fanMoney) {
|
| | | this.fanMoney = fanMoney;
|
| | | }
|
| | |
|
| | | public List<Object> getProgressList() {
|
| | | return progressList;
|
| | | }
|
| | |
|
| | | public void setProgressList(List<Object> progressList) {
|
| | | this.progressList = progressList;
|
| | | }
|
| | |
|
| | | public Integer getProgressState() {
|
| | | return progressState;
|
| | | }
|
| | |
|
| | | public void setProgressState(Integer progressState) {
|
| | | this.progressState = progressState;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.vo.user;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | |
|
| | | public class UserSystemCouponVO extends UserSystemCoupon implements Serializable {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | // 顶部图片
|
| | | @Expose
|
| | | private String topPicture;
|
| | | |
| | | // 券名称
|
| | | @Expose
|
| | | private String couponName;
|
| | | // 券图片
|
| | | @Expose
|
| | | private String couponPicture;
|
| | | // 券作用
|
| | | @Expose
|
| | | private String couponEffect;
|
| | | // 券规则
|
| | | @Expose
|
| | | private String couponRule;
|
| | | // 有效期
|
| | | @Expose
|
| | | private String couponTerm;
|
| | | |
| | | // 有效期
|
| | | @Expose
|
| | | private String couponState;
|
| | | |
| | | // 跳转按钮
|
| | | @Expose
|
| | | private Map<String, Object> jumpBtn;
|
| | | // 剩下天数
|
| | | @Expose
|
| | | private Map<String, Object> remainDays;
|
| | | |
| | |
|
| | | public String getTopPicture() {
|
| | | return topPicture;
|
| | | }
|
| | |
|
| | | public void setTopPicture(String topPicture) {
|
| | | this.topPicture = topPicture;
|
| | | }
|
| | |
|
| | | public String getCouponTerm() {
|
| | | return couponTerm;
|
| | | }
|
| | |
|
| | | public void setCouponTerm(String couponTerm) {
|
| | | this.couponTerm = couponTerm;
|
| | | }
|
| | |
|
| | | public Map<String, Object> getRemainDays() {
|
| | | return remainDays;
|
| | | }
|
| | |
|
| | | public void setRemainDays(Map<String, Object> remainDays) {
|
| | | this.remainDays = remainDays;
|
| | | }
|
| | |
|
| | | public String getCouponName() {
|
| | | return couponName;
|
| | | }
|
| | |
|
| | | public void setCouponName(String couponName) {
|
| | | this.couponName = couponName;
|
| | | }
|
| | |
|
| | | public String getCouponPicture() {
|
| | | return couponPicture;
|
| | | }
|
| | |
|
| | | public void setCouponPicture(String couponPicture) {
|
| | | this.couponPicture = couponPicture;
|
| | | }
|
| | |
|
| | | public String getCouponEffect() {
|
| | | return couponEffect;
|
| | | }
|
| | |
|
| | | public void setCouponEffect(String couponEffect) {
|
| | | this.couponEffect = couponEffect;
|
| | | }
|
| | |
|
| | | public String getCouponRule() {
|
| | | return couponRule;
|
| | | }
|
| | |
|
| | | public void setCouponRule(String couponRule) {
|
| | | this.couponRule = couponRule;
|
| | | }
|
| | |
|
| | | public Map<String, Object> getJumpBtn() {
|
| | | return jumpBtn;
|
| | | }
|
| | |
|
| | | public void setJumpBtn(Map<String, Object> jumpBtn) {
|
| | | this.jumpBtn = jumpBtn;
|
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package org.fanli.random;
|
| | |
|
| | | import com.alibaba.fastjson.JSON;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | public class ExtractGift {
|
| | |
|
| | | /**
|
| | | * 生成奖项
|
| | | * |
| | | * @return
|
| | | */
|
| | | public static RandomGift generateAward() {
|
| | | List<RandomGift> giftList = new ArrayList<RandomGift>();
|
| | | giftList.add(new RandomGift(1, "\r\n" + |
| | | " na****La,抽中华为手机\r\n" + |
| | | " ", 1));
|
| | | giftList.add(new RandomGift(2, "100", 3));
|
| | | giftList.add(new RandomGift(3, "50", 30));
|
| | | giftList.add(new RandomGift(4, "30", 30));
|
| | | giftList.add(new RandomGift(5, "20", 26));
|
| | | giftList.add(new RandomGift(6, "10", 10));
|
| | |
|
| | | long result = (1 + Math.round(Math.random() * (99)));
|
| | | System.out.println("result:"+result);
|
| | | |
| | | int minRange = 0;
|
| | | int maxRange = 0;
|
| | | RandomGift returnobj = null;
|
| | | |
| | | for (int i = 0; i < giftList.size(); i++) {
|
| | | RandomGift obj2 = giftList.get(i);
|
| | | int probability = obj2.getProbability();
|
| | | |
| | | maxRange = maxRange + probability;
|
| | | minRange = 100 - maxRange;
|
| | | |
| | | System.out.println("maxRange: "+maxRange);
|
| | | System.out.println("minRange: "+minRange);
|
| | | |
| | | if (probability != 0) {
|
| | | if (result > minRange && result <= maxRange) {
|
| | | returnobj = obj2;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | return returnobj;
|
| | | }
|
| | |
|
| | |
|
| | | public static void main(String[] args) {
|
| | | System.out.println(JSON.toJSONString(generateAward()));
|
| | | }
|
| | |
|
| | | } |
| | |
| | |
|
| | | return datatime;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 通过时间秒毫秒数判断两个时间的间隔
|
| | | * @param date1
|
| | | * @param date2
|
| | | * @return
|
| | | */
|
| | | public static int differentDaysByMillisecond(Date start, Date end) {
|
| | | return (int) ((end.getTime() - start.getTime()) / (1000*3600*24));
|
| | | }
|
| | | |
| | | public String transferLongToDate(String dateFormat, Long millSec) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | Date date = new Date(millSec);
|