Merge branch 'new-dev' into 2.0-dev

# Conflicts:
#	hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java
#	hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java
master
袁野 11 months ago
commit f81e68b623
  1. 1
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java
  2. 3
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java
  3. 2
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  4. 149
      hai-cweb/src/main/java/com/cweb/controller/HighDiscountPackageController.java
  5. 105
      hai-order/src/main/java/com/web/controller/business/ApiMerOrderController.java
  6. 33
      hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java
  7. 125
      hai-service/src/main/java/com/hai/dao/BsTemporaryMapper.java
  8. 7
      hai-service/src/main/java/com/hai/dao/BsTemporaryMapperExt.java
  9. 332
      hai-service/src/main/java/com/hai/dao/BsTemporarySqlProvider.java
  10. 21
      hai-service/src/main/java/com/hai/dao/HighDiscountPackageActualMapperExt.java
  11. 241
      hai-service/src/main/java/com/hai/entity/BsTemporary.java
  12. 1003
      hai-service/src/main/java/com/hai/entity/BsTemporaryExample.java
  13. 1
      hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java
  14. 8
      hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java
  15. 1
      hai-service/src/main/java/com/hai/order/model/ExportOrderMobileModel.java
  16. 1
      hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java
  17. 4
      hai-service/src/main/java/com/hai/order/type/OrderChildGoodsType.java
  18. 54
      hai-service/src/main/java/com/hai/service/BsTemporaryServices.java
  19. 4
      hai-service/src/main/java/com/hai/service/HighDiscountPackageActualService.java
  20. 10
      hai-service/src/main/java/com/hai/service/HighDiscountPackageService.java
  21. 55
      hai-service/src/main/java/com/hai/service/impl/BsTemporaryServicesImpl.java
  22. 1
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentRelServiceImpl.java
  23. 6
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageActualServiceImpl.java
  24. 8
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageAgentServiceImpl.java
  25. 74
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java
  26. 10
      hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java
  27. 19
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java
  28. 2
      hai-user/src/main/java/com/web/controller/LoginController.java
  29. 28
      v1/src/main/java/com/v1/controller/orderController.java

@ -195,6 +195,7 @@ public class HighDiscountAgentRelController {
}
}
@RequestMapping(value="/getDiscountCodeList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询优惠券码 列表")

@ -10,6 +10,7 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighDiscount;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighDiscountService;
@ -47,6 +48,8 @@ public class HighDiscountController {
@Resource
private HighDiscountService highDiscountService;
@Resource
private HighDiscountUserRelService discountUserRelService;
@Resource
private HighDiscountUserRelService discountUserRelService;

@ -102,6 +102,8 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/discount/getCouponByDiscount")
.excludePathPatterns("/discountPackage/getDiscountPackageList")
.excludePathPatterns("/discountPackage/getDiscountPackageDetail")
.excludePathPatterns("/discountPackage/receivePackageTemporary")
.excludePathPatterns("/discountPackage/getDiscountPackageCode")
.excludePathPatterns("/discount/getDiscountByDiscountAgentId")
.excludePathPatterns("/highMerchantStore/getMerchantStoreById")
.excludePathPatterns("/highMerchantStore/getStoreListByCoupon")

@ -15,7 +15,6 @@ import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.*;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -23,6 +22,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@ -50,6 +50,22 @@ public class HighDiscountPackageController {
@Resource
private CommonService commonService;
@Resource
private HighDiscountPackageAgentService discountPackageAgentService;
@Resource
private BsTemporaryServices bsTemporaryServices;
@Autowired
private RedisTemplate redisTemplate;
@Resource
private UserCenter userCenter;
@Resource
private HighUserService userService;
@RequestMapping(value = "/getDiscountPackageList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取优惠券包列表")
@ -106,11 +122,135 @@ public class HighDiscountPackageController {
}
}
@RequestMapping(value = "/receivePackageTemporary", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "券包临时领取")
public ResponseData receivePackageTemporary(@RequestParam(name = "packageId", required = true) Integer packageId,
@RequestParam(name = "openId", required = true) String openId,
@RequestParam(name = "agentId", required = true) Long agentId) {
String key = "receivePackage_" + packageId + "_" + agentId;
Map<String, Object> param = new HashMap<>();
param.put("openIdH5", openId);
List<HighUser> userList = userService.getUserList(param);
try {
// 分布式锁占坑
Boolean lock = redisTemplate.opsForValue().setIfAbsent(key, openId);
if (Boolean.TRUE.equals(lock)) {
Map<String , Object> map = new HashMap<>();
map.put("agentId" , agentId);
map.put("discountPackageId" , packageId);
map.put("status" , 1);
List<HighDiscountPackageAgentCode> list = discountPackageAgentService.getDiscountPackageAgentCodeList(map);
if (list.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未查询当相关内容!");
}
HighDiscountPackageAgentCode discountPackageAgentCode = list.get(0);
if (list.size() == 0) {
log.error("HighDiscountController -> getDiscountByQrCode() error!","当前券包库存不足");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前券包库存不足");
}
BsTemporary bsTemporary = bsTemporaryServices.findByCode(openId , 7);
if (bsTemporary != null) {
if (userList.size() > 0) {
HighUser user = userList.get(0);
if (StringUtils.isNotBlank(user.getPhone())) {
highDiscountPackageService.decodeCode(bsTemporary.getCode() , user);
return ResponseMsgUtil.success("领取成功!");
}
}
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "今日已领取,请尽快使用!");
}
if (userList.size() > 0) {
HighUser user = userList.get(0);
if (StringUtils.isNotBlank(user.getPhone())) {
highDiscountPackageService.decodeCode(discountPackageAgentCode.getCode() , user);
return ResponseMsgUtil.success("领取成功!");
}
}
bsTemporary = new BsTemporary();
bsTemporary.setCode(discountPackageAgentCode.getCode());
bsTemporary.setCreateTime(new Date());
bsTemporary.setUpdateTime(new Date());
bsTemporary.setSourceCode(openId);
bsTemporary.setStatus(1);
bsTemporary.setType(7);
bsTemporaryServices.insert(bsTemporary);
discountPackageAgentCode.setStatus(5);
discountPackageAgentCode.setUpdateTime(new Date());
discountPackageAgentService.updateDiscountPackageAgentCode(discountPackageAgentCode);
} else {
// 加锁失败,重试
Thread.sleep(100);
receivePackageTemporary(packageId , openId , agentId);
}
return ResponseMsgUtil.success("领取成功!");
} catch (Exception e) {
log.error("HighDiscountPackageController --> getDiscountPackageDetail() error!", e);
return ResponseMsgUtil.exception(e);
} finally {
// 删除key,释放锁
redisTemplate.delete(key);
}
}
@RequestMapping(value = "/test", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "test")
public ResponseData test() {
try {
// 用户
List<BsTemporary> list = bsTemporaryServices.getList(new HashMap<>());
for (BsTemporary bsTemporary : list) {
HighDiscountPackageAgentCode discountPackageAgentCode = discountPackageAgentService.findDiscountPackageAgentCode(bsTemporary.getCode());
discountPackageAgentCode.setStatus(1);
discountPackageAgentCode.setUpdateTime(new Date());
discountPackageAgentService.updateDiscountPackageAgentCode(discountPackageAgentCode);
bsTemporary.setStatus(0);
bsTemporary.setUpdateTime(new Date());
bsTemporaryServices.update(bsTemporary);
}
return ResponseMsgUtil.success("成功!");
} catch (Exception e) {
log.error("HighDiscountPackageController --> giveAway() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/receivePackage", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "领取券包")
public ResponseData receivePackage(@RequestParam(name = "code", required = false) String code) {
public ResponseData receivePackage(@RequestParam(name = "code", required = false) String code, HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
// 用户
String jsonData;
try {
@ -127,8 +267,11 @@ public class HighDiscountPackageController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前业务不支持!");
}
JSONObject object = new JSONObject();
object.put("code" , code);
object.put("discountPackageActualId" , jsonObject.getInteger("id"));
highDiscountPackageService.receivePackage(jsonObject.getInteger("id") , code);
highDiscountPackageService.receivePackage(object , userInfoModel.getHighUser());
return ResponseMsgUtil.success("领取成功!");

@ -0,0 +1,105 @@
package com.web.controller.business;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.enum_type.UserObjectTypeEnum;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.order.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "apiMerOrder")
@Api(value = "接口商户订单业务")
public class ApiMerOrderController {
private static Logger log = LoggerFactory.getLogger(OrderThirdPartyController.class);
@Resource
private UserCenter userCenter;
@Resource
private OrderService orderService;
@RequestMapping(value = "/getOrderList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询api商户订单列表")
public ResponseData getOrderList(@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "memPhone", required = false) String memPhone,
@RequestParam(name = "memCardNo", required = false) String memCardNo,
@RequestParam(name = "payType", required = false) Integer payType,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "companyId", required = false) Long companyId,
@RequestParam(name = "promoteCode", required = false) Long promoteCode,
@RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE,
@RequestParam(name = "payTimeS", required = false) Long payTimeS,
@RequestParam(name = "payTimeE", required = false) Long payTimeE,
@RequestParam(name = "productType", required = false) Integer productType,
@RequestParam(name = "finishTimeS", required = false) Long finishTimeS,
@RequestParam(name = "finishTimeE", required = false) Long finishTimeE,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
try {
Map<String,Object> map = new HashMap<>();
map.put("createTimeS", createTimeS);
map.put("createTimeE", createTimeE);
map.put("payTimeS", payTimeS);
map.put("payTimeE", payTimeE);
map.put("finishTimeS", finishTimeS);
map.put("finishTimeE", finishTimeE);
map.put("orderNo", orderNo);
map.put("memPhone", memPhone);
map.put("memCardNo", memCardNo);
map.put("productType", productType);
map.put("status", status);
map.put("payType", payType);
map.put("promoteCode", promoteCode);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(orderService.getOrderList(map)));
} catch (Exception e) {
log.error("OrderCouponController --> getOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getOrderDetail",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询订单详情")
public ResponseData getOrderDetail(@RequestParam(name = "orderNo", required = true) String orderNo) {
try {
Map<String, Object> map = new HashMap<>();
map.put("tradeOrder", orderService.getOrderDetailByNo(orderNo));
return ResponseMsgUtil.success(map);
} catch (Exception e) {
log.error("OrderIntegralRechargeController -> getOrderDetail() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,9 +1,9 @@
package com.hai.schedule;
import com.hai.entity.HighDiscountAgentCode;
import com.hai.entity.HighDiscountUserRel;
import com.hai.entity.HighOrder;
import com.hai.entity.*;
import com.hai.service.BsTemporaryServices;
import com.hai.service.HighDiscountAgentCodeService;
import com.hai.service.HighDiscountPackageAgentService;
import com.hai.service.HighDiscountUserRelService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -11,6 +11,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
@ -29,6 +31,12 @@ public class HighDiscountSchedule {
@Resource
private HighDiscountAgentCodeService highDiscountAgentCodeService;
@Resource
private BsTemporaryServices bsTemporaryServices;
@Resource
private HighDiscountPackageAgentService discountPackageAgentService;
/**
* @Author 胡锐
* @Description 处理过期的优惠券
@ -55,4 +63,23 @@ public class HighDiscountSchedule {
}
}
@Scheduled(cron = "0 5 0 * * ?") // 每日凌晨00:00:5执行一次
public void deleteOilNo() {
List<BsTemporary> list = bsTemporaryServices.getList(new HashMap<>());
for (BsTemporary bsTemporary : list) {
HighDiscountPackageAgentCode discountPackageAgentCode = discountPackageAgentService.findDiscountPackageAgentCode(bsTemporary.getCode());
discountPackageAgentCode.setStatus(1);
discountPackageAgentCode.setUpdateTime(new Date());
discountPackageAgentService.updateDiscountPackageAgentCode(discountPackageAgentCode);
bsTemporary.setStatus(0);
bsTemporary.setUpdateTime(new Date());
bsTemporaryServices.update(bsTemporary);
}
}
}

@ -0,0 +1,125 @@
package com.hai.dao;
import com.hai.entity.BsTemporary;
import com.hai.entity.BsTemporaryExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface BsTemporaryMapper extends BsTemporaryMapperExt {
@SelectProvider(type=BsTemporarySqlProvider.class, method="countByExample")
long countByExample(BsTemporaryExample example);
@DeleteProvider(type=BsTemporarySqlProvider.class, method="deleteByExample")
int deleteByExample(BsTemporaryExample example);
@Delete({
"delete from bs_temporary",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into bs_temporary (code, `type`, ",
"source_code, create_time, ",
"update_time, `status`, ",
"op_id, op_name, ext_1, ",
"ext_2, ext_3)",
"values (#{code,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, ",
"#{sourceCode,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{opId,jdbcType=BIGINT}, #{opName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsTemporary record);
@InsertProvider(type=BsTemporarySqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(BsTemporary record);
@SelectProvider(type=BsTemporarySqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="code", property="code", jdbcType=JdbcType.VARCHAR),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="source_code", property="sourceCode", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT),
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<BsTemporary> selectByExample(BsTemporaryExample example);
@Select({
"select",
"id, code, `type`, source_code, create_time, update_time, `status`, op_id, op_name, ",
"ext_1, ext_2, ext_3",
"from bs_temporary",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="code", property="code", jdbcType=JdbcType.VARCHAR),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="source_code", property="sourceCode", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT),
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
BsTemporary selectByPrimaryKey(Long id);
@UpdateProvider(type=BsTemporarySqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") BsTemporary record, @Param("example") BsTemporaryExample example);
@UpdateProvider(type=BsTemporarySqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") BsTemporary record, @Param("example") BsTemporaryExample example);
@UpdateProvider(type=BsTemporarySqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(BsTemporary record);
@Update({
"update bs_temporary",
"set code = #{code,jdbcType=VARCHAR},",
"`type` = #{type,jdbcType=INTEGER},",
"source_code = #{sourceCode,jdbcType=VARCHAR},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"`status` = #{status,jdbcType=INTEGER},",
"op_id = #{opId,jdbcType=BIGINT},",
"op_name = #{opName,jdbcType=VARCHAR},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(BsTemporary record);
}

@ -0,0 +1,7 @@
package com.hai.dao;
/**
* mapper扩展类
*/
public interface BsTemporaryMapperExt {
}

@ -0,0 +1,332 @@
package com.hai.dao;
import com.hai.entity.BsTemporary;
import com.hai.entity.BsTemporaryExample.Criteria;
import com.hai.entity.BsTemporaryExample.Criterion;
import com.hai.entity.BsTemporaryExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class BsTemporarySqlProvider {
public String countByExample(BsTemporaryExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("bs_temporary");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(BsTemporaryExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("bs_temporary");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(BsTemporary record) {
SQL sql = new SQL();
sql.INSERT_INTO("bs_temporary");
if (record.getCode() != null) {
sql.VALUES("code", "#{code,jdbcType=VARCHAR}");
}
if (record.getType() != null) {
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}");
}
if (record.getSourceCode() != null) {
sql.VALUES("source_code", "#{sourceCode,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getOpId() != null) {
sql.VALUES("op_id", "#{opId,jdbcType=BIGINT}");
}
if (record.getOpName() != null) {
sql.VALUES("op_name", "#{opName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(BsTemporaryExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("code");
sql.SELECT("`type`");
sql.SELECT("source_code");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("`status`");
sql.SELECT("op_id");
sql.SELECT("op_name");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("bs_temporary");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
BsTemporary record = (BsTemporary) parameter.get("record");
BsTemporaryExample example = (BsTemporaryExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("bs_temporary");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getCode() != null) {
sql.SET("code = #{record.code,jdbcType=VARCHAR}");
}
if (record.getType() != null) {
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
}
if (record.getSourceCode() != null) {
sql.SET("source_code = #{record.sourceCode,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getOpId() != null) {
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}");
}
if (record.getOpName() != null) {
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("bs_temporary");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("code = #{record.code,jdbcType=VARCHAR}");
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
sql.SET("source_code = #{record.sourceCode,jdbcType=VARCHAR}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}");
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
BsTemporaryExample example = (BsTemporaryExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(BsTemporary record) {
SQL sql = new SQL();
sql.UPDATE("bs_temporary");
if (record.getCode() != null) {
sql.SET("code = #{code,jdbcType=VARCHAR}");
}
if (record.getType() != null) {
sql.SET("`type` = #{type,jdbcType=INTEGER}");
}
if (record.getSourceCode() != null) {
sql.SET("source_code = #{sourceCode,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getOpId() != null) {
sql.SET("op_id = #{opId,jdbcType=BIGINT}");
}
if (record.getOpName() != null) {
sql.SET("op_name = #{opName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, BsTemporaryExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -1,7 +1,28 @@
package com.hai.dao;
import com.hai.entity.HighCouponAgentCode;
import com.hai.entity.HighDiscountPackageActual;
import com.hai.entity.HighDiscountPackageRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;
import java.util.List;
/**
* mapper扩展类
*/
public interface HighDiscountPackageActualMapperExt {
@Select(
" SELECT *" +
" FROM high_discount_package_actual" +
" WHERE" +
" status = 3 " +
" AND allocation_time >= DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL #{day} DAY) " +
" AND user_id = #{userId} " +
" AND discount_package_id = #{discountPackageId}; "
)
List<HighDiscountPackageActual> receivePackageLimit(@Param("userId") Integer userId, @Param("discountPackageId") Integer discountPackageId, @Param("day") Integer day);
}

@ -0,0 +1,241 @@
package com.hai.entity;
import java.io.Serializable;
import java.util.Date;
/**
* bs_temporary
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class BsTemporary implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 编码
*/
private String code;
/**
* 类型1星巴克 2肯德基 3会员充值 4积分充值 5购买卡券 6加油服务 7优惠券包 8汇联通充值 9话费充值 10:电影票 11:贵州中石化 12:实物商品 13:比邻星停车场
*/
private Integer type;
/**
* 来源
*/
private String sourceCode;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 状态 1正常 0 删除
*/
private Integer status;
/**
* 操作人
*/
private Long opId;
/**
* 操作人名称
*/
private String opName;
/**
* ext_1
*/
private String ext1;
/**
* ext_2
*/
private String ext2;
/**
* ext_3
*/
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getSourceCode() {
return sourceCode;
}
public void setSourceCode(String sourceCode) {
this.sourceCode = sourceCode;
}
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 Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Long getOpId() {
return opId;
}
public void setOpId(Long opId) {
this.opId = opId;
}
public String getOpName() {
return opName;
}
public void setOpName(String opName) {
this.opName = opName;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
BsTemporary other = (BsTemporary) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getSourceCode() == null ? other.getSourceCode() == null : this.getSourceCode().equals(other.getSourceCode()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getOpId() == null ? other.getOpId() == null : this.getOpId().equals(other.getOpId()))
&& (this.getOpName() == null ? other.getOpName() == null : this.getOpName().equals(other.getOpName()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getSourceCode() == null) ? 0 : getSourceCode().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getOpId() == null) ? 0 : getOpId().hashCode());
result = prime * result + ((getOpName() == null) ? 0 : getOpName().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", code=").append(code);
sb.append(", type=").append(type);
sb.append(", sourceCode=").append(sourceCode);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", status=").append(status);
sb.append(", opId=").append(opId);
sb.append(", opName=").append(opName);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -496,7 +496,6 @@ public class ApiOrderCreateHandleServiceImpl implements ApiOrderCreateHandleServ
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前卡券已停用!");
}
// 查询折扣比例
Map<String, Object> mapProduct = new HashMap<>();
mapProduct.put("mchId" , object.getString("merchId"));

@ -58,12 +58,16 @@ public class ApiOrderServiceImpl implements ApiOrderService {
@Override
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW)
public ApiOrder createOrder(JSONObject object) throws Exception {
ApiOrder apiOrder = new ApiOrder();
// 获取下单内容
JSONObject dataObject = JSONObject.parseObject(object.getString("content"));
CreateOrderModel createOrderModel = new CreateOrderModel();
createOrderModel.setChildOrderList(new ArrayList<>());
@ -278,8 +282,6 @@ public class ApiOrderServiceImpl implements ApiOrderService {
createOrderChildModel.setIsTyAgent(false);
createOrderChildModel.setGoodsPrice(apiOrder.getOrderPrice());
createOrderChildModel.setPrice(apiOrder.getCostPrice());
createOrderModel.setMemName("接口用户");
createOrderModel.setMemPhone(dataObject.getString("userMobile"));
// 组装订单
createOrderModel.getChildOrderList().add(createOrderChildModel);
@ -305,7 +307,7 @@ public class ApiOrderServiceImpl implements ApiOrderService {
@Override
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW , timeout = 30)
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW)
public ApiOrder payOrder(JSONObject object) throws Exception{
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));

@ -62,7 +62,6 @@ public class ExportOrderMobileModel {
private String orderStatus;
@ColumnWidth(15)
@ExcelProperty("创建时间")
private Date createTime;

@ -687,7 +687,6 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
private void petroCoupon(HighOrder order , HighChildOrder childOrder) throws Exception {
// 派发停车券
ApiCoupon apiCoupon = apiCouponService.findCoupon(childOrder.getGoodsSpecName());

@ -22,8 +22,8 @@ public enum OrderChildGoodsType {
TYPE11(11, "实物商品购买"),
TYPE12(12, "比邻星停车券"),
TYPE13(13, "比邻星停车"),
TYPE14(14, "个人油卡充值"),
TYPE15(15, "升级会员"),
TYPE14(14, "升级会员"),
TYPE15(15, "个人油卡充值"),
TYPE17(17, "团购套餐"),
TYPE18(18, "中石油卡券"),
;

@ -0,0 +1,54 @@
package com.hai.service;
import com.hai.entity.BsMsg;
import com.hai.entity.BsPushScheduleTask;
import com.hai.entity.BsTemporary;
import java.util.List;
import java.util.Map;
public interface BsTemporaryServices {
/**
* @Author Sum1Dream
* @Name insert
* @Description // 新增
* @Date 16:22 2023/12/22
* @Param bsTemporary
* @return void
*/
void insert(BsTemporary bsTemporary);
/**
* @Author Sum1Dream
* @Name update
* @Description // 更新
* @Date 16:23 2023/12/22
* @Param bsTemporary
* @return void
*/
void update(BsTemporary bsTemporary);
/**
* @Author Sum1Dream
* @Name findById
* @Description // 查询
* @Date 16:23 2023/12/22
* @Param id
* @return com.hai.entity.BsMsg
*/
BsTemporary findById(Long id);
BsTemporary findByCode(String openId , Integer type);
/**
* @Author Sum1Dream
* @Name getList
* @Description // 查询列表
* @Date 16:23 2023/12/22
* @Param map
* @return java.util.List<com.hai.entity.BsMsg>
*/
List<BsTemporary> getList(Map<String , Object> map);
}

@ -2,6 +2,8 @@ package com.hai.service;
import com.hai.entity.HighDiscountPackageActual;
import com.hai.entity.HighDiscountPackageDiscountActual;
import io.swagger.models.auth.In;
import javassist.runtime.Inner;
import java.util.List;
import java.util.Map;
@ -93,4 +95,6 @@ public interface HighDiscountPackageActualService {
*/
Long userPurchaseByUserId(Integer userId , Integer discountPackage);
Integer receivePackageLimit(Integer userId , Integer discountPackage , Integer dat);
}

@ -1,14 +1,12 @@
package com.hai.service;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.HighDiscount;
import com.hai.entity.HighDiscountPackage;
import com.hai.entity.HighDiscountPackageActual;
import com.hai.entity.HighDiscountPackageRecord;
import com.hai.entity.HighUser;
import com.hai.model.UserInfoModel;
import io.swagger.models.auth.In;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@ -116,7 +114,7 @@ public interface HighDiscountPackageService {
* @Param [packageId, phone, sourceType, sourceId]
* @Return java.lang.String
*/
String giveAway(Long packageId, String phone , Integer sourceType , String sourceId) throws Exception;
void giveAway(Long packageId, String phone , Integer sourceType , String sourceId) throws Exception;
/**
* @Author Sum1Dream
@ -126,6 +124,8 @@ public interface HighDiscountPackageService {
* @Param object
* @return void
*/
void receivePackage(Integer discountPackageActualId , String code);
void receivePackage(JSONObject object, HighUser user );
void decodeCode(String code , HighUser highUser);
}

@ -0,0 +1,55 @@
package com.hai.service.impl;
import com.hai.dao.BsTemporaryMapper;
import com.hai.entity.BsMsg;
import com.hai.entity.BsTemporary;
import com.hai.entity.BsTemporaryExample;
import com.hai.service.BsTemporaryServices;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service("bsTemporaryServices")
public class BsTemporaryServicesImpl implements BsTemporaryServices {
@Resource
private BsTemporaryMapper bsTemporaryMapper;
@Override
public void insert(BsTemporary bsTemporary) {
bsTemporaryMapper.insert(bsTemporary);
}
@Override
public void update(BsTemporary bsTemporary) {
bsTemporaryMapper.updateByPrimaryKey(bsTemporary);
}
@Override
public BsTemporary findById(Long id) {
return bsTemporaryMapper.selectByPrimaryKey(id);
}
@Override
public BsTemporary findByCode(String openId , Integer type) {
BsTemporaryExample example = new BsTemporaryExample();
example.createCriteria().andSourceCodeEqualTo(openId).andTypeEqualTo(type).andStatusEqualTo(1);
List<BsTemporary> list = bsTemporaryMapper.selectByExample(example);
if (list.size() > 0 ) {
return list.get(0);
}
return null;
}
@Override
public List<BsTemporary> getList(Map<String, Object> map) {
BsTemporaryExample example = new BsTemporaryExample();
example.createCriteria().andStatusEqualTo(1);
return bsTemporaryMapper.selectByExample(example);
}
}

@ -160,6 +160,7 @@ public class HighDiscountAgentRelServiceImpl implements HighDiscountAgentRelServ
return list;
}
@Override
public List<HighDiscountAgentRel> getDiscountUseCount(Map<String, Object> map) {
HighDiscountAgentRelExample example = new HighDiscountAgentRelExample();

@ -103,4 +103,10 @@ public class HighDiscountPackageActualServiceImpl implements HighDiscountPackage
example.createCriteria().andDiscountPackageIdEqualTo(discountPackage).andUserIdEqualTo(userId).andStatusIn(statusList);
return discountPackageActualMapper.countByExample(example);
}
@Override
public Integer receivePackageLimit(Integer userId, Integer discountPackageId , Integer day) {
List <HighDiscountPackageActual> list = discountPackageActualMapper.receivePackageLimit( userId, discountPackageId , day);
return list.size();
}
}

@ -168,11 +168,12 @@ public class HighDiscountPackageAgentServiceImpl implements HighDiscountPackageA
HighDiscountPackageAgentCode discountPackageAgentCode ;
mapCode.put("type" , "DISCOUNT_PACKAGE");
int percent;
int num = object.getInteger("num");
for (int i = 1; i <= object.getInteger("num"); i++) {
for (int i = 0; i < object.getInteger("num"); i++) {
// 生成百分比
percent = i*100/object.getInteger("num");
percent = i*100/(num -1);
redisUtil.set(object.getString("serialNumber") , percent , 3600);
HighDiscountPackageActual discountPackageActual = discountPackageActualList.get(i);
@ -283,6 +284,9 @@ public class HighDiscountPackageAgentServiceImpl implements HighDiscountPackageA
if (MapUtils.getLong(map, "discountPackageId") != null) {
criteria.andDiscountPackageIdEqualTo(MapUtils.getLong(map, "discountPackageId"));
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}
return discountPackageAgentCodeMapper.selectByExample(example);
}

@ -1,12 +1,13 @@
package com.hai.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.google.common.base.Stopwatch;
import com.hai.common.Base64Util;
import com.hai.common.exception.BaseException;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
@ -18,21 +19,15 @@ import com.hai.model.HighUserModel;
import com.hai.model.UserInfoModel;
import com.hai.service.*;
import com.hai.service.HighDiscountPackageService;
import io.lettuce.core.RedisURI;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StopWatch;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* @serviceName HighDiscountPackageServiceImpl.java
@ -103,6 +98,9 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
@Autowired
private RedisUtil redisUtil;
@Resource
private SecConfigService secConfigService;
@Override
public List<HighDiscountPackage> getDiscountPackageList(Map<String, Object> map) {
@ -465,7 +463,7 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
}
@Override
public String giveAway(Long packageId, String phone, Integer sourceType, String sourceId) {
public void giveAway(Long packageId, String phone, Integer sourceType, String sourceId) {
// 查询优惠券包
HighDiscountPackage discountPackage = findDiscountPackageById(packageId.intValue());
@ -554,14 +552,15 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
redisUtil.del(serialNum);
}).start();
return serialNum;
}
@Override
@Transactional(propagation= Propagation.REQUIRED)
public void receivePackage(Integer discountPackageActualId , String code) {
HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class);
@Override
@Transactional(propagation= Propagation.NESTED)
public void receivePackage(JSONObject objectData , HighUser user) {
Integer discountPackageActualId = objectData.getInteger("discountPackageActualId");
String code = objectData.getString("code");
String key = "receivePackage_" + discountPackageActualId;
try {
@ -574,10 +573,11 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
HighDiscountPackageAgentCode discountPackageAgentCode = discountPackageAgentService.findDiscountPackageAgentCode(code);
if (discountPackageAgentCode == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前系统繁忙,请联系客服人员!");
}
if (discountPackageAgentCode.getStatus() != 1) {
if (discountPackageAgentCode.getStatus() == 2 || discountPackageAgentCode.getStatus() == 3 || discountPackageAgentCode.getStatus() == 4 ) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "券包已领取!");
}
@ -611,10 +611,11 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
object.put("discountPackageName" , discountPackage.getTitle());
object.put("discountPackageId" , discountPackage.getId());
object.put("userId" , userInfoModel.getHighUser().getId());
object.put("userName" , userInfoModel.getHighUser().getName());
object.put("userPhone" , userInfoModel.getHighUser().getPhone());
object.put("userId" , user.getId());
object.put("userName" , user.getName());
object.put("userPhone" , user.getPhone());
object.put("companyId" , discountPackage.getCompanyId());
object.put("agentId" , discountPackageAgentCode.getAgentId());
object.put("discountPackageActualId" , discountPackageActualId);
object.put("usingAttribution" , 3);
object.put("type" , 3);
@ -638,7 +639,7 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
} else {
// 加锁失败,重试
Thread.sleep(100);
receivePackage(discountPackageActualId , code);
receivePackage(objectData , user);
}
} catch (BaseException baseException) {
redisTemplate.delete(key);
@ -655,6 +656,31 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
}
@Override
public void decodeCode(String code , HighUser user) {
try {
// 用户
String jsonData;
jsonData = AESEncodeUtil.aesDecrypt(Base64Util.decode(code));
JSONObject jsonObject = JSON.parseObject(jsonData);
String type = jsonObject.getString("type");
if (!type.equals("DISCOUNT_PACKAGE")){
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前业务不支持!");
}
JSONObject object = new JSONObject();
object.put("code" , code);
object.put("discountPackageActualId" , jsonObject.getInteger("id"));
highDiscountPackageService.receivePackage(object , user);
} catch (Exception e) {
System.out.println(e);
}
}
private void getDiscountPackageDeliver(JSONObject object) {
@ -705,7 +731,9 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
userRel.setDiscountUsingRange(discount.getUsingRange());
userRel.setDiscountType(discount.getDiscountType());
userRel.setDiscountCondition(discount.getDiscountCondition());
userRel.setExt1(object.getString("agentId"));
userRel.setExt2("优惠券包");
userRel.setExt3(object.getString("userPhone"));
userRel.setDiscountPrice(discount.getDiscountPrice());
userRel.setAgentId(actualList.getAgentId());
userRel.setUserId(object.getLong("userId"));
@ -754,4 +782,12 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
discountPackageRecord.setCreatedTime(new Date());
highDiscountPackageRecordMapper.insert(discountPackageRecord);
}
// 查询当前是否已经超出使用
private Boolean receivePackageLimit(Integer userId , Integer num , Integer discountPackageId , Integer day) {
return num <= discountPackageActualService.receivePackageLimit(userId, discountPackageId , day);
}
}

@ -276,6 +276,12 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
if (MapUtils.getLong(map, "userId") != null) {
criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId"));
}
if (MapUtils.getLong(map, "agentId") != null) {
criteria.andAgentIdEqualTo(MapUtils.getLong(map, "agentId"));
}
if (MapUtils.getString(map, "discountName") != null) {
criteria.andDiscountNameLike("%" + MapUtils.getString(map, "discountName") + "%");
}
if (MapUtils.getInteger(map, "discountPlatform") != null) {
criteria.andDiscountPlatformEqualTo(MapUtils.getInteger(map, "discountPlatform"));
@ -288,6 +294,10 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
criteria.andExt1EqualTo(MapUtils.getString(map, "ext1"));
}
if (MapUtils.getString(map, "ext1") != null) {
criteria.andExt1EqualTo(MapUtils.getString(map, "ext1"));
}
if (MapUtils.getInteger(map, "discountUseScope") != null) {
criteria.andDiscountUseScopeEqualTo(MapUtils.getInteger(map, "discountUseScope"));
}

@ -49,6 +49,9 @@ public class HighUserServiceImpl implements HighUserService {
@Resource
private HighGoldRecService highGoldRecService;
@Resource
private HighDiscountPackageService highDiscountPackageService;
@Resource
private HighUserCouponService highUserCouponService;
@ -83,7 +86,8 @@ public class HighUserServiceImpl implements HighUserService {
private HighUserLoginLogMapper userLoginLogMapper;
@Resource
private HighStoreUserService highStoreUserService;
private BsTemporaryServices bsTemporaryServices;
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW, timeout = 30, rollbackFor = Exception.class)
@ -142,6 +146,19 @@ public class HighUserServiceImpl implements HighUserService {
loginLog.setUserId(user.getId());
userLoginLogMapper.insert(loginLog);
if (user.getOpenIdH5() != null) {
BsTemporary bsTemporary = bsTemporaryServices.findByCode(user.getOpenIdH5() , 7);
if (bsTemporary != null) {
bsTemporary.setStatus(0);
bsTemporary.setUpdateTime(new Date());
bsTemporaryServices.update(bsTemporary);
highDiscountPackageService.decodeCode(bsTemporary.getCode() , user);
}
}
// 缓存登录信息
HighUserModel highUserModel = new HighUserModel();
highUserModel.setHighUser(getDetailDataByUser(user.getId()));

File diff suppressed because one or more lines are too long

@ -167,33 +167,7 @@ public class orderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写下单手机号,就餐方式,下单信息,门店编码");
}
}
// if (object.getInteger("productType").equals(OrderProductType.PRODUCT_TYPE13.getNumber())) {
// if ( StringUtils.isBlank(dataObject.getString("couponCode"))
// || StringUtils.isBlank(dataObject.getString("userMobile"))
// || dataObject.getInteger("receiverCount") == null
// ) {
// log.error("OrderController -> create() error!","");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写卡券编码,手机号,购买数量");
// }
// }
// if (object.getInteger("productType").equals(OrderProductType.PRODUCT_TYPE14.getNumber())) {
// if ( StringUtils.isBlank(dataObject.getString("userMobile"))
// || StringUtils.isBlank(dataObject.getString("userCouponCode"))
// || StringUtils.isBlank(dataObject.getString("parkOrderId"))
// || StringUtils.isBlank(dataObject.getString("parkName"))
// || dataObject.getInteger("orderType") == null
// || dataObject.getBigDecimal("prePrice") == null
// || dataObject.getBigDecimal("currentamt") == null
// || dataObject.getInteger("parkId") == null
// || dataObject.getInteger("parkTime") == null
// || dataObject.getString("inTime") == null
// || dataObject.getString("outTime") == null
// || dataObject.getString("carNo") == null
// ) {
// log.error("OrderController -> create() error!","");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写相关参数");
// }
// }
if (object.getInteger("productType").equals(OrderProductType.PRODUCT_TYPE18.getNumber())) {
if ( StringUtils.isBlank(dataObject.getString("userMobile"))
|| StringUtils.isBlank(dataObject.getString("couponCode"))

Loading…
Cancel
Save