修改话费定时任务问题

dev-discount
袁野 2 years ago
parent dbd98fdf32
commit eecae1957e
  1. 1
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  2. 9
      hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java
  3. 11
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  4. 19
      hai-service/src/main/java/com/hai/dao/HighOrderMapper.java
  5. 2
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  6. 16
      hai-service/src/main/java/com/hai/entity/HighOrder.java
  7. 2
      hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java
  8. 2
      hai-service/src/main/java/com/hai/service/HighUserService.java
  9. 54
      hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java
  10. 4
      hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java
  11. 2
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java
  12. 10
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java

@ -451,6 +451,7 @@ public class HighOrderController {
}
highOrder.setMerchId(request.getHeader("mchId"));
highOrder.setWhetherRebate(false);
highOrder.setTotalPrice(totalPrice);
highOrder.setPayablePrice(totalActualPrice);

@ -55,6 +55,8 @@ public class HighUserCommonController {
@ApiOperation(value = "登录接口【用户不存在会自动注册】")
public ResponseData login(@RequestParam(value = "phone", required = true) String phone,
@RequestParam(value = "code", required = true) String code,
@RequestParam(value = "popularizeUserId", required = false) Long popularizeUserId,
@RequestParam(value = "regionId", required = false) String regionId,
HttpServletRequest request, HttpServletResponse response) {
try {
@ -80,7 +82,8 @@ public class HighUserCommonController {
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
highUserService.insertUser(user);
highUserService.insertUser(user , popularizeUserId , regionId);
}
HighUserModel highUserModel = new HighUserModel();
@ -99,6 +102,8 @@ public class HighUserCommonController {
@ResponseBody
@ApiOperation(value = "银联授权手机号登录接口")
public ResponseData unionPhoneLogin(@RequestParam(value = "code", required = true) String code,
@RequestParam(value = "popularizeUserId", required = false) Long popularizeUserId,
@RequestParam(value = "regionId", required = false) String regionId,
HttpServletRequest request, HttpServletResponse response) {
try {
@ -133,7 +138,7 @@ public class HighUserCommonController {
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
highUserService.insertUser(user);
highUserService.insertUser(user , popularizeUserId , regionId);
} else {
user.setUnionOpenId(token.getJSONObject("params").getString("openId"));
user.setUnionUnionId(token.getJSONObject("params").getString("unionId"));

@ -54,9 +54,6 @@ public class WechatController {
@Resource
private HighUserService highUserService;
@Resource
private HighUserPayPasswordService highUserPayPasswordService;
@Resource
private RedisUtil redisUtil;
@ -89,6 +86,8 @@ public class WechatController {
public ResponseData loginByPhone(@RequestParam(value = "encryptedData", required = true) String encryptedData,
@RequestParam(value = "iv", required = true) String iv,
@RequestParam(value = "openId", required = true) String openId,
@RequestParam(value = "popularizeUserId", required = false) Long popularizeUserId,
@RequestParam(value = "regionId", required = false) String regionId,
HttpServletRequest request, HttpServletResponse response) {
try {
log.error("origin encryptedData:" + encryptedData + ";iv:" + iv);
@ -130,7 +129,7 @@ public class WechatController {
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
highUserService.insertUser(user);
highUserService.insertUser(user , popularizeUserId , regionId);
} else {
if (session.getOpenid() == null) {
user.setOpenId(session.getOpenid());
@ -248,6 +247,8 @@ public class WechatController {
@ApiOperation(value = "根据手机号码登陆")
public ResponseData loginByTel(@RequestParam(value = "phone", required = true) String phone,
@RequestParam(value = "code", required = true) String code,
@RequestParam(value = "popularizeUserId", required = false) Long popularizeUserId,
@RequestParam(value = "regionId", required = false) String regionId,
HttpServletRequest request, HttpServletResponse response) {
try {
@ -267,7 +268,7 @@ public class WechatController {
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
highUserService.insertUser(user);
highUserService.insertUser(user , popularizeUserId , regionId);
}
// 获取手机号验证码

@ -58,9 +58,9 @@ public interface HighOrderMapper extends HighOrderMapperExt {
"profit_sharing_ratio, account_merchant_num, ",
"product_type, print_status, ",
"print_num, whether_check, ",
"region_id, company_id, ",
"merch_id, ext_1, ext_2, ",
"ext_3)",
"whether_rebate, region_id, ",
"company_id, merch_id, ",
"ext_1, ext_2, ext_3)",
"values (#{orderNo,jdbcType=VARCHAR}, #{memDiscountId,jdbcType=BIGINT}, ",
"#{memDiscountName,jdbcType=VARCHAR}, #{memId,jdbcType=BIGINT}, ",
"#{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ",
@ -80,9 +80,9 @@ public interface HighOrderMapper extends HighOrderMapperExt {
"#{profitSharingRatio,jdbcType=DECIMAL}, #{accountMerchantNum,jdbcType=VARCHAR}, ",
"#{productType,jdbcType=INTEGER}, #{printStatus,jdbcType=BIT}, ",
"#{printNum,jdbcType=INTEGER}, #{whetherCheck,jdbcType=BIT}, ",
"#{regionId,jdbcType=VARCHAR}, #{companyId,jdbcType=BIGINT}, ",
"#{merchId,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ",
"#{ext3,jdbcType=VARCHAR})"
"#{whetherRebate,jdbcType=BIT}, #{regionId,jdbcType=VARCHAR}, ",
"#{companyId,jdbcType=BIGINT}, #{merchId,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighOrder record);
@ -132,6 +132,7 @@ public interface HighOrderMapper extends HighOrderMapperExt {
@Result(column="print_status", property="printStatus", jdbcType=JdbcType.BIT),
@Result(column="print_num", property="printNum", jdbcType=JdbcType.INTEGER),
@Result(column="whether_check", property="whetherCheck", jdbcType=JdbcType.BIT),
@Result(column="whether_rebate", property="whetherRebate", jdbcType=JdbcType.BIT),
@Result(column="region_id", property="regionId", jdbcType=JdbcType.VARCHAR),
@Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT),
@Result(column="merch_id", property="merchId", jdbcType=JdbcType.VARCHAR),
@ -149,8 +150,8 @@ public interface HighOrderMapper extends HighOrderMapperExt {
"total_price, create_time, pay_time, cancel_time, cancel_remarks, finish_time, ",
"remarks, refund_no, refund_time, refund_price, refund_content, refusal_refund_content, ",
"Identification_code, profit_sharing_status, profit_sharing_ratio, account_merchant_num, ",
"product_type, print_status, print_num, whether_check, region_id, company_id, ",
"merch_id, ext_1, ext_2, ext_3",
"product_type, print_status, print_num, whether_check, whether_rebate, region_id, ",
"company_id, merch_id, ext_1, ext_2, ext_3",
"from high_order",
"where id = #{id,jdbcType=BIGINT}"
})
@ -194,6 +195,7 @@ public interface HighOrderMapper extends HighOrderMapperExt {
@Result(column="print_status", property="printStatus", jdbcType=JdbcType.BIT),
@Result(column="print_num", property="printNum", jdbcType=JdbcType.INTEGER),
@Result(column="whether_check", property="whetherCheck", jdbcType=JdbcType.BIT),
@Result(column="whether_rebate", property="whetherRebate", jdbcType=JdbcType.BIT),
@Result(column="region_id", property="regionId", jdbcType=JdbcType.VARCHAR),
@Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT),
@Result(column="merch_id", property="merchId", jdbcType=JdbcType.VARCHAR),
@ -252,6 +254,7 @@ public interface HighOrderMapper extends HighOrderMapperExt {
"print_status = #{printStatus,jdbcType=BIT},",
"print_num = #{printNum,jdbcType=INTEGER},",
"whether_check = #{whetherCheck,jdbcType=BIT},",
"whether_rebate = #{whetherRebate,jdbcType=BIT},",
"region_id = #{regionId,jdbcType=VARCHAR},",
"company_id = #{companyId,jdbcType=BIGINT},",
"merch_id = #{merchId,jdbcType=VARCHAR},",

@ -1250,7 +1250,7 @@ public interface HighOrderMapperExt {
})
List<SelfOilStationModel> getSelfOilStationOrderList(@Param("goodsId") String goodsId);
@Select("select * from high_order where order_status = 3 and pay_type != 3 and pay_real_price > 0 ")
@Select("select * from high_order where order_status = 3 and pay_type != 3 and pay_real_price > 0 and whether_rebate = false ")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),

@ -210,6 +210,11 @@ public class HighOrder implements Serializable {
*/
private Boolean whetherCheck;
/**
* 是否返利
*/
private Boolean whetherRebate;
/**
* 区域编码
*/
@ -615,6 +620,14 @@ public class HighOrder implements Serializable {
this.whetherCheck = whetherCheck;
}
public Boolean getWhetherRebate() {
return whetherRebate;
}
public void setWhetherRebate(Boolean whetherRebate) {
this.whetherRebate = whetherRebate;
}
public String getRegionId() {
return regionId;
}
@ -714,6 +727,7 @@ public class HighOrder implements Serializable {
&& (this.getPrintStatus() == null ? other.getPrintStatus() == null : this.getPrintStatus().equals(other.getPrintStatus()))
&& (this.getPrintNum() == null ? other.getPrintNum() == null : this.getPrintNum().equals(other.getPrintNum()))
&& (this.getWhetherCheck() == null ? other.getWhetherCheck() == null : this.getWhetherCheck().equals(other.getWhetherCheck()))
&& (this.getWhetherRebate() == null ? other.getWhetherRebate() == null : this.getWhetherRebate().equals(other.getWhetherRebate()))
&& (this.getRegionId() == null ? other.getRegionId() == null : this.getRegionId().equals(other.getRegionId()))
&& (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId()))
&& (this.getMerchId() == null ? other.getMerchId() == null : this.getMerchId().equals(other.getMerchId()))
@ -765,6 +779,7 @@ public class HighOrder implements Serializable {
result = prime * result + ((getPrintStatus() == null) ? 0 : getPrintStatus().hashCode());
result = prime * result + ((getPrintNum() == null) ? 0 : getPrintNum().hashCode());
result = prime * result + ((getWhetherCheck() == null) ? 0 : getWhetherCheck().hashCode());
result = prime * result + ((getWhetherRebate() == null) ? 0 : getWhetherRebate().hashCode());
result = prime * result + ((getRegionId() == null) ? 0 : getRegionId().hashCode());
result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode());
result = prime * result + ((getMerchId() == null) ? 0 : getMerchId().hashCode());
@ -819,6 +834,7 @@ public class HighOrder implements Serializable {
sb.append(", printStatus=").append(printStatus);
sb.append(", printNum=").append(printNum);
sb.append(", whetherCheck=").append(whetherCheck);
sb.append(", whetherRebate=").append(whetherRebate);
sb.append(", regionId=").append(regionId);
sb.append(", companyId=").append(companyId);
sb.append(", merchId=").append(merchId);

@ -23,7 +23,7 @@ public interface BsDistributionUserRelService {
* @Param [java.lang.Long, java.lang.Long]
* @return void
*/
void insertDistributionRebate(Long userId , String userName, Long popularizeUserId);
void insertDistributionRebate(Long userId , Long popularizeUserId , String regionId);
/**
* @Author Sum1Dream

@ -99,7 +99,7 @@ public interface HighUserService {
* @param: [highUser] 用户信息
* @return: com.hai.entity.HighUser
*/
void insertUser(HighUser highUser);
void insertUser(HighUser highUser , Long popularizeUserId , String regionId);
/**
* @Author 胡锐

@ -1,11 +1,8 @@
package com.hai.service.impl;
import com.hai.dao.BsDistributionRebateMapper;
import com.hai.dao.BsDistributionUserRelMapper;
import com.hai.entity.BsDistributionRebate;
import com.hai.entity.BsDistributionUserRel;
import com.hai.entity.BsDistributionUserRelExample;
import com.hai.service.BsDistributionUserRelService;
import com.hai.entity.*;
import com.hai.service.*;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
@ -21,8 +18,23 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe
@Resource
private BsDistributionUserRelMapper bsDistributionUserRelMapper;
@Resource
private HighDiscountPackageService highDiscountPackageService;
@Resource
private HighUserService highUserService;
@Resource
private BsCompanyService bsCompanyService;
@Resource
private CommonService commonService;
@Override
public void insertDistributionRebate(Long userId, String userName , Long popularizeUserId) {
public void insertDistributionRebate(Long userId, Long popularizeUserId , String regionId) {
HighUser user = highUserService.findByUserId(userId);
// 定义分销关联关系
BsDistributionUserRel distributionUserRel = new BsDistributionUserRel();
@ -34,7 +46,7 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe
BsDistributionUserRel popularizeUser = findDistributionUserRel(map);
distributionUserRel.setUserId(userId);
distributionUserRel.setUserName(userName);
distributionUserRel.setUserName(user.getName());
distributionUserRel.setAgentId(popularizeUser.getAgentId());
distributionUserRel.setAgentName(popularizeUser.getAgentName());
distributionUserRel.setPopularizeUserId(popularizeUserId);
@ -45,6 +57,34 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe
bsDistributionUserRelMapper.insert(distributionUserRel);
new Thread(() -> {
try {
SecRegion region = commonService.getParentByRegion(Long.valueOf(regionId));
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString());
// 查询注册有礼优惠券包
HighDiscountPackage discountPackage = highDiscountPackageService.getCallExclusive(3 , bsCompany.getId().intValue());
Map<String, Object> freeMap = new HashMap<>();
freeMap.put("discountPackageId", discountPackage.getId());
freeMap.put("userId", userId);
freeMap.put("userPhone", user.getPhone());
highDiscountPackageService.freeUserDiscountPackage(freeMap);
// 查询推广有礼优惠券包
HighDiscountPackage promoteDiscountPackage = highDiscountPackageService.getCallExclusive(4 , bsCompany.getId().intValue());
Map<String, Object> freeMap1 = new HashMap<>();
freeMap1.put("discountPackageId", promoteDiscountPackage.getId());
freeMap1.put("userId", userId);
freeMap1.put("userPhone", user.getPhone());
highDiscountPackageService.freeUserDiscountPackage(freeMap1);
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
@Override

@ -109,6 +109,10 @@ public class BsIntegralRebateServiceImpl implements BsIntegralRebateService {
HighOrder order = highOrderService.getOrderById(object.getLong("orderId"));
order.setWhetherRebate(true);
highOrderService.updateOrder(order);
highUserService.goldHandle(object.getLong("userId"), integralNum.intValue(), 1, 4, object.getLong("orderId") , object.getString("remark") + integralNum);
}

@ -402,7 +402,7 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
user.setGold(0);
user.setStatus(1);
user.setInfoCompleteStatus(1); // 用户信息完整状态 0:完整 1:需要填写用户信息 2:需要填写手机号
highUserService.insertUser(user);
highUserService.insertUser(user , null , null);
// 赠送卷包
Map<String, Object> freeMap = new HashMap<>();

@ -61,6 +61,9 @@ public class HighUserServiceImpl implements HighUserService {
@Resource
private HighOilCardService oilCardService;
@Resource
private BsDistributionUserRelService distributionUserRelService;
@Override
public List<HighUser> getListUser(Map<String, String> map) {
HighUserExample example = new HighUserExample();
@ -212,7 +215,7 @@ public class HighUserServiceImpl implements HighUserService {
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void insertUser(HighUser highUser) {
public void insertUser(HighUser highUser , Long popularizeUserId , String regionId) {
highUserMapper.insert(highUser);
if (highUser.getPhone() != null) {
@ -221,6 +224,11 @@ public class HighUserServiceImpl implements HighUserService {
highUserCardService.bindCard(UserCardType.type2.getType(), oilCard.getCardNo(), highUser.getId());
}
}
new Thread(()-> {
// 绑定推广关联关系
distributionUserRelService.insertDistributionRebate(highUser.getId() , popularizeUserId , regionId);
});
}
@Override

Loading…
Cancel
Save