dev-discount
胡锐 3 years ago
commit 2204933d61
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  3. 4
      hai-bweb/src/main/resources/dev/application.yml
  4. 2
      hai-bweb/src/main/resources/pre/application.yml
  5. 1
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  6. 2
      hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java
  7. 3
      hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java
  8. 19
      hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java
  9. 2
      hai-cweb/src/main/resources/pre/application.yml
  10. 4
      hai-cweb/src/test/common/test.java
  11. 65
      hai-service/src/main/java/com/hai/dao/CmsContentMapperExt.java
  12. 13
      hai-service/src/main/java/com/hai/service/CmsContentService.java
  13. 10
      hai-service/src/main/java/com/hai/service/HighDiscountPackageService.java
  14. 1
      hai-service/src/main/java/com/hai/service/HighDiscountService.java
  15. 33
      hai-service/src/main/java/com/hai/service/HighTestService.java
  16. 5
      hai-service/src/main/java/com/hai/service/impl/CmsContentServiceImpl.java
  17. 97
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java
  18. 136
      hai-service/src/main/java/com/hai/service/impl/HighTestServiceImpl.java
  19. 3
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java
  20. 2
      hai-service/src/main/java/com/hai/service/impl/HltUnionCardVipServiceImpl.java

@ -252,7 +252,7 @@ public class HighDiscountPackageController {
highDiscountPackage.setCompanyId(highDiscountPackages.getCompanyId());
highDiscountPackage.setCreatedUserId(highDiscountPackages.getCreatedUserId());
highDiscountPackage.setCreatedTime(highDiscountPackages.getCreatedTime());
highDiscountPackage.setTotalStock(highDiscountPackage.getTotalStock());
highDiscountPackage.setTotalStock(highDiscountPackages.getTotalStock());
highDiscountPackageService.updateDiscountPackage(highDiscountPackage);

File diff suppressed because one or more lines are too long

@ -28,11 +28,11 @@ spring:
poolPreparedStatements: true
maxOpenPreparedStatements: 20
redis:
database: 0
database: 5
host: 139.159.177.244
port: 36379
password: HF123456.Redis
timeout: 1000
timeout: 36000000
jedis:
pool:
max-active: 20

@ -9,7 +9,7 @@ debug: false
#datasource数据源设置
spring:
datasource:
url: jdbc:mysql://139.159.177.244:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://122.9.135.148:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: HF123456.
type: com.alibaba.druid.pool.DruidDataSource

@ -130,7 +130,6 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/highBrand/*")
.excludePathPatterns("/highGoodsType/*")
.excludePathPatterns("/sendSms/*")
.excludePathPatterns("/test/*")
.excludePathPatterns("/sms/*")
;
}

@ -55,7 +55,7 @@ public class CmsContentController {
map.put("companyId", bsCompany.getId().toString());
map.put("status", "2");
map.put("categoryCode", categoryCode);
return ResponseMsgUtil.success(cmsContentService.getListContent(map));
return ResponseMsgUtil.success(cmsContentService.getListContentByCrest(map));
}
}
return ResponseMsgUtil.success(new ArrayList<>());

@ -53,9 +53,6 @@ public class HighCouponController {
@Resource
private HighCouponCodeService highCouponCodeService;
@Resource
private HighOrderService highOrderService;
@Resource
private HighUserCouponService highUserCouponService;

@ -122,15 +122,16 @@ public class OutRechargeOrderController {
// 支付类型 1.微信支付
outRechargeOrder.setPayType(1);
// 判断充值模式:1 电信 2. 移动 3. 联通
JSONObject telObject = telApiService.outApiTel(outRechargeOrder.getRechargeContent());
if (telObject.get("status").equals(0)) {
JSONObject o = telObject.getObject("result",JSONObject.class);
// 拼接内容
remarks = o.get("province").toString() + o.get("company").toString() + "充值" + outRechargeOrder.getOrderPrice() + "元";
} else {
log.error("orderToPay error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR);
}
// 拼接内容
remarks = outRechargeOrder.getRechargeContent() + "充值" + outRechargeOrder.getOrderPrice() + "元";
// JSONObject telObject = telApiService.outApiTel(outRechargeOrder.getRechargeContent());
// if (telObject.get("status").equals(0)) {
// JSONObject o = telObject.getObject("result",JSONObject.class);
//
// } else {
// log.error("orderToPay error!");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR);
// }
HighDiscountUserRel highDiscountUserRel = null;
if (outRechargeOrder.getMemDiscountId() != null) {

@ -9,7 +9,7 @@ debug: false
#datasource数据源设置
spring:
datasource:
url: jdbc:mysql://139.159.177.244:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://122.9.135.148:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: HF123456.
type: com.alibaba.druid.pool.DruidDataSource

@ -46,7 +46,7 @@ public class test {
@Test
public void test(){
/* List<HighDiscountAgentCode> codeList = highDiscountAgentCodeService.getDiscountCodeByDiscountAgentId(55L);
List<HighDiscountAgentCode> codeList = highDiscountAgentCodeService.getDiscountCodeByDiscountAgentId(55L);
List<HighUser> userList = highUserService.getUserList();
@ -55,7 +55,7 @@ public class test {
// 领取优惠券
highDiscountUserRelService.receiveDiscount(user.getId(), codeList.get(num).getId());
num++;
}*/
}
}

@ -44,7 +44,7 @@ public interface CmsContentMapperExt {
" AND cc.status = #{status}",
" </when>",
"</choose>",
"ORDER BY cc.category_code",
"ORDER BY cc.category_code and cc.sort_id",
"</script>"
})
@Results({
@ -76,4 +76,67 @@ public interface CmsContentMapperExt {
})
List<CmsContentModel> getListContent(Map<String, String> paramsMap) throws Exception;
@Select(value = {
"<script>",
"SELECT",
"cc.*",
", cca.name AS category_name",
"FROM cms_content AS cc",
", cms_category AS cca",
"WHERE cc.category_id = cca.id",
"<if test=\"title != null\">",
" AND cc.title REGEXP #{title}",
"</if>",
"<if test=\"category != null\">",
" AND cc.category_id = #{category}",
"</if>",
"<if test=\"categoryCode != null\">",
" AND cc.category_code = #{categoryCode}",
"</if>",
"<if test=\"companyId != null\">",
" AND cc.company_id = #{companyId}",
"</if>",
"<if test=\"tag != null\">",
" AND cc.tag = #{tag}",
"</if>",
"<choose>",
" <when test=\"status == null\">",
" AND cc.status != 0",
" </when>",
" <when test=\"status != null\">",
" AND cc.status = #{status}",
" </when>",
"</choose>",
"ORDER BY cc.sort_id",
"</script>"
})
@Results({
@Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true),
@Result(column="title", property="title", jdbcType= JdbcType.VARCHAR),
@Result(column="category_id", property="categoryId", jdbcType= JdbcType.BIGINT),
@Result(column="category_code", property="categoryCode", jdbcType= JdbcType.VARCHAR),
@Result(column="description", property="description", jdbcType= JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType= JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType= JdbcType.INTEGER),
@Result(column="has_patch", property="hasPatch", jdbcType= JdbcType.TINYINT),
@Result(column="visit_count", property="visitCount", jdbcType= JdbcType.INTEGER),
@Result(column="tag", property="tag", jdbcType= JdbcType.VARCHAR),
@Result(column="img_source", property="imgSource", jdbcType= JdbcType.TINYINT),
@Result(column="img_data", property="imgData", jdbcType= JdbcType.VARCHAR),
@Result(column="jump_type", property="jumpType", jdbcType= JdbcType.INTEGER),
@Result(column="jump_name", property="jumpName", jdbcType= JdbcType.VARCHAR),
@Result(column="jump_url", property="jumpUrl", jdbcType= JdbcType.VARCHAR),
@Result(column="sort_id", property="sortId", jdbcType= JdbcType.INTEGER),
@Result(column="update_time", property="updateTime", jdbcType= JdbcType.TIMESTAMP),
@Result(column="recommend", property="recommend", jdbcType= JdbcType.BIT),
@Result(column="company_id", property="companyId", jdbcType= JdbcType.BIGINT),
@Result(column="op_id", property="opId", jdbcType= JdbcType.BIGINT),
@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),
@Result(column="content", property="content", jdbcType= JdbcType.LONGVARCHAR),
@Result(column="category_name", property="categoryName", jdbcType= JdbcType.VARCHAR),
})
List<CmsContentModel> getListContentByCrest(Map<String, String> paramsMap) throws Exception;
}

@ -85,6 +85,19 @@ public interface CmsContentService {
*/
List<CmsContentModel> getListContent(Map<String, String> paramsMap) throws Exception;
/**
*
* @Title: getListContent
* @Description: 查询内容列表
* @author: gongjia
* @param: [paramsMap]
* @return: java.util.List<com.ncsmesc.entity.CmsContent>
* @throws
*/
List<CmsContentModel> getListContentByCrest(Map<String, String> paramsMap) throws Exception;
/**
*
* @Title: getCorporateAdvertising

@ -89,4 +89,14 @@ public interface HighDiscountPackageService {
*/
void addDiscountPackageStock(HighDiscountPackage highDiscountPackage, UserInfoModel userInfoModel , Integer num);
/**
* @Author Sum1Dream
* @name freeUserDiscountPackage.java
* @Description // 赠送用户优惠券包内容
* @Date 3:09 下午 2021/12/24
* @Param [java.lang.Long]
* @return void
*/
void freeUserDiscountPackage(Map<String , Object> map) throws Exception;
}

@ -39,5 +39,6 @@ public interface HighDiscountService {
* @Date 2021/4/3 21:39
**/
List<HighDiscount> getDiscount(Map<String,Object> map);
}

@ -0,0 +1,33 @@
package com.hai.service;
/**
* @serviceName HltMerchantService.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 测试接口
* @createTime 11:46 上午 2021/12/15
**/
public interface HighTestService {
/**
* @Author Sum1Dream
* @name getReadFile.java
* @Description //读取文件
* @Date 5:31 下午 2021/12/16
* @Param []
* @return void
*/
void getReadFile() throws Exception;
/**
* @Author Sum1Dream
* @name getUserDiscount.java
* @Description // 赠送用户卡券
* @Date 7:14 下午 2021/12/24
* @Param []
* @return void
*/
void getUserDiscount(Long id) throws Exception;
}

@ -178,6 +178,11 @@ public class CmsContentServiceImpl implements CmsContentService {
return cmsContentMapper.getListContent(paramsMap);
}
@Override
public List<CmsContentModel> getListContentByCrest(Map<String, String> paramsMap) throws Exception {
return cmsContentMapper.getListContentByCrest(paramsMap);
}
@Override
public List<CmsContent> getCorporateAdvertising() {
CmsContentExample example = new CmsContentExample();

@ -3,12 +3,16 @@ package com.hai.service.impl;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.RedisUtil;
import com.hai.dao.*;
import com.hai.entity.*;
import com.hai.model.UserInfoModel;
import com.hai.service.*;
import com.hai.service.HighDiscountPackageService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
@ -52,6 +56,28 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
@Resource
private HighDiscountInventoryRecordMapper discountInventoryRecordMapper;
@Resource
private HighUserService highUserService;
@Resource
private HighDiscountPackageService highDiscountPackageService;
@Resource
private HighDiscountUserRelMapper highDiscountUserRelMapper;
@Resource
private HighDiscountService highDiscountService;
@Resource
private HighDiscountPackageActualService discountPackageActualService;
@Resource
private HighDiscountPackageDiscountActualService discountPackageDiscountActualService;
@Autowired
private RedisUtil redisUtil;
@Override
public List<HighDiscountPackage> getDiscountPackageList(Map<String, Object> map) {
@ -223,4 +249,75 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
highDiscountPackageMapper.updateByPrimaryKey(highDiscountPackage);
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void freeUserDiscountPackage(Map<String , Object> map) throws Exception {
HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(MapUtils.getInteger(map , "discountPackageId"));
// 查询优惠券包实际库存
HighDiscountPackageActual discountPackageActual = discountPackageActualService.getHighDiscountPackageActualList(highDiscountPackage.getId()).get(0);
// 修改优惠券包实际库存为已使用
discountPackageActual.setStatus(0);
discountPackageActual.setUserId(MapUtils.getInteger(map , "userId"));
discountPackageActual.setAllocationTime(new Date());
discountPackageActualService.updateHighDiscountPackageActual(discountPackageActual);
// 查询优惠券包实际库存中实际优惠券数量
List<HighDiscountPackageDiscountActual> discountPackageDiscountActual = discountPackageDiscountActualService.getHighDiscountPackageDiscountActualList(discountPackageActual.getId());
// 循环赠送优惠券
for (HighDiscountPackageDiscountActual actualList: discountPackageDiscountActual) {
HighDiscountUserRel highDiscountUserRel = new HighDiscountUserRel();
highDiscountUserRel.setDiscountId(actualList.getDiscountId());
highDiscountUserRel.setUserId(MapUtils.getLong(map , "userId"));
highDiscountUserRel.setAgentId(actualList.getAgentId());
highDiscountUserRel.setDiscountAgentCodeId(actualList.getAgentDiscountCodeId());
highDiscountUserRel.setStatus(1);
highDiscountUserRel.setCreateTime(new Date());
HighDiscount highDiscount = highDiscountService.getDiscountById(actualList.getDiscountId());
// 计算使用有效期
Calendar userEndTime = Calendar.getInstance();
userEndTime.setTime(new Date());
userEndTime.set(Calendar.HOUR_OF_DAY, 23);
userEndTime.set(Calendar.MINUTE, 59);
userEndTime.set(Calendar.SECOND, 59);
userEndTime.add(Calendar.DATE, highDiscount.getEffectiveDay());
highDiscountUserRel.setUseEndTime(userEndTime.getTime());
HighDiscountAgentCode discountAgentCode = highDiscountAgentCodeService.getCodeById(actualList.getAgentDiscountCodeId());
// 修改优惠券二维码状态
discountAgentCode.setStatus(2);
highDiscountAgentCodeService.updateCode(discountAgentCode);
// 新增优惠券与用户的绑定关系
highDiscountUserRelMapper.insert(highDiscountUserRel);
// 修改优惠券包实际库存实际优惠券状态
actualList.setStatus(0);
discountPackageDiscountActualService.updateHighDiscountPackageDiscountActual(actualList);
}
// 增加赠送记录
HighDiscountPackageRecord discountPackageRecord = new HighDiscountPackageRecord();
discountPackageRecord.setDiscountPackageId(highDiscountPackage.getId());
discountPackageRecord.setDiscountPackageTitle(highDiscountPackage.getTitle());
discountPackageRecord.setCompanyId(highDiscountPackage.getCompanyId());
discountPackageRecord.setStatus(1);
discountPackageRecord.setUsingAttribution(1);
discountPackageRecord.setRecordNo("DP" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5) );
discountPackageRecord.setSalesType(2);
discountPackageRecord.setUserId(MapUtils.getInteger(map , "userId"));
discountPackageRecord.setExt1(MapUtils.getString(map , "userPhone"));
discountPackageRecord.setCreatedTime(new Date());
highDiscountPackageRecordMapper.insert(discountPackageRecord);
}
}

@ -0,0 +1,136 @@
package com.hai.service.impl;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.RedisUtil;
import com.hai.dao.HighUserEtcMapper;
import com.hai.entity.HighDiscountAgentCode;
import com.hai.entity.HighUser;
import com.hai.entity.HighUserEtc;
import com.hai.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("highTestService")
public class HighTestServiceImpl implements HighTestService {
private static Logger log = LoggerFactory.getLogger(HighTestService.class);
@Resource
private HighUserService highUserService;
@Resource
private HighUserEtcMapper highUserEtcMapper;
@Resource
private HighDiscountAgentCodeService highDiscountAgentCodeService;
@Resource
private HighDiscountUserRelService highDiscountUserRelService;
@Autowired
private RedisUtil redisUtil;
@Override
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW)
public void getReadFile() throws Exception {
// BufferedReader bufferedReader = null;
//
// Map<String , String> mapUser = new HashMap<>();
//
// //cookie过期时间为7天
// int EXPIRE = 3600*24*7;
//
// List<HighUser> highUsers = highUserService.getListUser(mapUser);
//
// for (HighUser user: highUsers) {
// redisUtil.set(user.getPhone(), user.getPhone(), EXPIRE);
// }
//
// FileReader fileReader = new FileReader("/home/project/hsg/readFile/etccq.txt");
// if (fileReader == null) {
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "读取空数据");
// }
//
// bufferedReader = new BufferedReader(fileReader);
// String temp = bufferedReader.readLine();
// int i = 0;
// while (temp != null) {
// i++;
// String[] arr = temp.split(";");
//
// String phone = (String) redisUtil.get(arr[3]);
//
// if (phone == null || highUsers.size() == 0) {
// HighUser user = new HighUser();
//
// user.setStatus(1);
// user.setInfoCompleteStatus(1);
// user.setGold(0);
// user.setRegTime(new Date());
// user.setName(arr[2]);
// user.setPhone(arr[3]);
// user.setExt4("1");
//
// highUserService.insertUser(user);
//
// HighUserEtc userEtc = new HighUserEtc();
//
// userEtc.setCreateTime(new Date());
// userEtc.setStatus(1);
// userEtc.setUserId(user.getId());
// userEtc.setCustomerName(arr[2]);
// userEtc.setCustomerTel(arr[3]);
// userEtc.setVehicleId(arr[0]);
// userEtc.setVehiclePlate(arr[1]);
//
// highUserEtcMapper.insert(userEtc);
//
//// Map<String , Object> map = new HashMap<>();
//// map.put("userId" , user.getId());
//// map.put("userPhone" , user.getPhone());
//// map.put("discountPackageId" , 48);
//
//// highDiscountPackageService.freeUserDiscountPackage(map);
// }
//
// temp = bufferedReader.readLine();
// }
}
@Override
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW)
public void getUserDiscount(Long id) throws Exception{
List<HighDiscountAgentCode> codeList = highDiscountAgentCodeService.getDiscountCodeByStatus(id , 1);
Map<String , String> map = new HashMap<>();
map.put("ext4" , "1");
List<HighUser> userList = highUserService.getListUser(map);
int num = 0;
for (HighUser user : userList) {
// 领取优惠券
highDiscountUserRelService.receiveDiscount(user.getId(), codeList.get(num).getId());
num++;
}
}
}

@ -65,6 +65,9 @@ public class HighUserServiceImpl implements HighUserService {
if (StringUtils.isNotBlank(map.get("status"))) {
criteria.andStatusEqualTo(Integer.valueOf(map.get("status")));
}
if (StringUtils.isNotBlank(map.get("ext4"))) {
criteria.andExt4EqualTo(String.valueOf(map.get("ext4")));
}
if (StringUtils.isNotBlank(map.get("regTimeStart")) && StringUtils.isNotBlank(map.get("regTimeEnd"))) {
criteria.andRegTimeBetween(
DateUtil.format(map.get("regTimeStart") , "yyyy-MM-dd HH:mm:ss") ,

@ -116,8 +116,6 @@ public class HltUnionCardVipServiceImpl implements HltUnionCardVipService {
HighDiscountPackage highDiscountPackage = highDiscountPackages.get(0);
highDiscountPackageService.updateDiscountPackage(highDiscountPackage);
// 查询优惠券包实际库存
HighDiscountPackageActual discountPackageActual = discountPackageActualService.getHighDiscountPackageActualList(highDiscountPackage.getId()).get(0);

Loading…
Cancel
Save