提交修改代码

dev-discount
袁野 3 years ago
parent f581118ec4
commit 8e62dedfc8
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  2. 51
      hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java
  3. 1
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  4. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  5. 1
      hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java
  6. 25
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  7. 2
      hai-cweb/src/main/resources/dev/application.yml
  8. 16
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  9. 15
      hai-service/src/main/java/com/hai/dao/HighDiscountAgentCodeMapperExt.java
  10. 1
      hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapperExt.java
  11. 36
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java

File diff suppressed because one or more lines are too long

@ -26,9 +26,11 @@ import com.hai.config.UnionPayConfig;
import com.hai.entity.HighCoupon;
import com.hai.entity.HighRefundAudit;
import com.hai.entity.OutRechargeOrder;
import com.hai.entity.OutRechargeOrderRecord;
import com.hai.model.*;
import com.hai.service.HighRefundAuditService;
import com.hai.service.HighUserService;
import com.hai.service.OutRechargeOrderRecordService;
import com.hai.service.OutRechargeOrderService;
import com.hai.service.pay.impl.GoodsOrderServiceImpl;
import io.swagger.annotations.Api;
@ -70,6 +72,9 @@ public class OutRechargeOrderController {
@Resource
private HighUserService highUserService;
@Resource
private OutRechargeOrderRecordService rechargeOrderRecordService;
@RequestMapping(value = "/getOrderById", method = RequestMethod.GET)
@ResponseBody
@ -314,7 +319,7 @@ public class OutRechargeOrderController {
param.put("refund_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue()));
param.put("sign_type", "HMAC-SHA256");
String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256);
String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256);
param.put("sign", signStr);
String resultXmL = doRefundRequest(param.get("mch_id"), WxUtils.mapToXml(param));
@ -575,24 +580,36 @@ public class OutRechargeOrderController {
@RequestParam(name = "orderId", required = true) Long orderId) {
try {
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(orderId);
String orderNo = "CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5);
JSONObject object = outRechargeOrderService.getMobile(outRechargeOrder.getRechargeContent(),outRechargeOrder.getOrderPrice().intValue(),orderNo , outRechargeOrder.getRechargeType());
if (object.getInteger("code") != 200) {
log.error("getMobileRechargeByOrderId error!", "充值失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object.getString("message"));
OutRechargeOrderRecord rechargeOrderRecord = rechargeOrderRecordService.findByOrderId(orderId);
if (rechargeOrderRecord == null) {
rechargeOrderRecord = new OutRechargeOrderRecord();
// 查询订单
OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId);
if (order.getRechargeType() != null) {
String orderNo = "CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5);
JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , orderNo , order.getRechargeType());
if (object.getInteger("code") != 200) {
order.setRechargeStatus(1);
order.setAbnormalMsg(object.getString("message"));
}
outRechargeOrderService.updateOrder(order);
rechargeOrderRecord.setRechargeOrderId(order.getId());
rechargeOrderRecord.setRechargeOrderNo(orderNo);
rechargeOrderRecord.setCreateTime(new Date());
rechargeOrderRecord.setStatus(1);
rechargeOrderRecordService.insertOrder(rechargeOrderRecord);
}
} else {
// 查询订单
OutRechargeOrder order = outRechargeOrderService.findByOrderId(rechargeOrderRecord.getRechargeOrderId());
if (order.getStatus() == 2) {
outRechargeOrderService.rechargeOrderToRefund(order.getId());
order.setStatus(5);
outRechargeOrderService.updateOrder(order);
}
}
outRechargeOrder.setRechargeStatus(2);
outRechargeOrder.setOrderNo(orderNo);
outRechargeOrderService.updateOrder(outRechargeOrder);
return ResponseMsgUtil.success("请求成功");
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e);

@ -132,6 +132,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/sms/*")
.excludePathPatterns("/czOrder/*")
.excludePathPatterns("/outRechargeOrder/*")
.excludePathPatterns("/userDiscount/*")
;
}

File diff suppressed because one or more lines are too long

@ -181,6 +181,7 @@ public class HighUserDiscountController {
Map<String,Object> map = new HashMap<>();
map.put("userId", userInfoModel.getHighUser().getId());
map.put("useScope", usingAttribution);
map.put("status" , 1);
if (year != null) {
map.put("createTimeS", year + "-01-01 00:00:00");
map.put("createTimeE", year + "-12-31 23:59:59");

@ -270,4 +270,29 @@ public class WechatController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/loginByTel1", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据手机号码登陆")
public ResponseData loginByTel1(@RequestParam(value = "phone", required = true) String phone,
HttpServletRequest request, HttpServletResponse response) {
try {
// 根据手机号查询用户
HighUser user = highUserService.findByPhone(phone);
// 定义个人所有数据
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getPhone(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,5 +1,5 @@
server:
port: 9301
port: 9401
servlet:
context-path: /crest

@ -65,7 +65,7 @@ public class HighOrderSchedule {
* @Param []
* @return void
*/
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次
@Scheduled(cron="0 0/1 * * * ?") //每15分钟执行一次
public void cancelMobileOrder() {
List<OutRechargeOrder> orderList = outRechargeOrderService.getOutRechargeOrderList();
if (orderList != null && orderList.size() > 0) {
@ -269,12 +269,12 @@ public class HighOrderSchedule {
}
}
/* @Scheduled(cron="1 * * * * * ?") //每1分钟执行一次
public void unionStagingPayOrder() {
List<Map<String, Object>> mapList = highOrderService.getFinishGasOrder();
if (mapList != null && mapList.size() > 0) {
}
}*/
// @Scheduled(cron="1 * * * * * ?") //每1分钟执行一次
// public void unionStagingPayOrder() {
// List<Map<String, Object>> mapList = highOrderService.getFinishGasOrder();
// if (mapList != null && mapList.size() > 0) {
//
// }
// }
}

@ -1,9 +1,8 @@
package com.hai.dao;
import com.hai.entity.HighDiscountAgentCode;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import java.util.List;
import java.util.Map;
@ -90,5 +89,15 @@ public interface HighDiscountAgentCodeMapperExt {
List<Map<String,Object>> getDiscountUseConditionList(@Param("param") Map<String, Object> param);
@Select(" select * from high_discount_agent_code where discount_agent_id = #{discountAgentId} and status = 1 limit #{num} " )
@Results({
@Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true),
@Result(column="discount_agent_id", property="discountAgentId", jdbcType=JdbcType.BIGINT),
@Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@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<HighDiscountAgentCode> getDiscountAgentCodByLimit(@Param("discountAgentId") Long discountAgentId ,@Param("num") Long num);
}

@ -33,6 +33,7 @@ public interface HighDiscountUserRelMapperExt {
" 1=1" +
" <if test='map.useScope != null'> and hd.use_scope = #{map.useScope} </if> " +
" <if test='map.userId != null'> and hdur.user_id = #{map.userId} </if>",
" <if test='map.status != null'> and hdur.status = #{map.status} </if>",
" <if test='map.createTimeS != null'> <![CDATA[ and hdur.create_time >= #{map.createTimeS} ]]> </if>",
" <if test='map.createTimeE != null'> <![CDATA[ and hdur.create_time <= #{map.createTimeE} ]]> </if>",
" ORDER BY hdur.create_time desc" +

@ -18,9 +18,7 @@ import com.hai.dao.OutRechargeOrderMapperExt;
import com.hai.entity.*;
import com.hai.enum_type.OrderPushType;
import com.hai.model.*;
import com.hai.service.HighUserCardService;
import com.hai.service.HighUserService;
import com.hai.service.OutRechargeOrderService;
import com.hai.service.*;
import com.hai.service.pay.impl.GoodsOrderServiceImpl;
import io.swagger.models.auth.In;
import org.apache.commons.collections4.MapUtils;
@ -65,6 +63,12 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Resource
private GoodsOrderServiceImpl goodsOrderService;
@Resource
private HighDiscountUserRelService highDiscountUserRelService;
@Resource
private HighDiscountAgentCodeService highDiscountAgentCodeService;
@Override
public List<OutRechargeOrder> getListRechargeOrder(Map<String, String> map) {
OutRechargeOrderExample example = new OutRechargeOrderExample();
@ -142,6 +146,17 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void insertOrder(OutRechargeOrder outRechargeOrder) {
// 使用优惠券
if (outRechargeOrder.getMemDiscountId() != null) {
HighDiscountUserRel discountUserRel = highDiscountUserRelService.getRelById(outRechargeOrder.getMemDiscountId());
discountUserRel.setUseTime(new Date()); // 使用时间
discountUserRel.setStatus(2); //状态 0:已过期 1:未使用 2:已使用
highDiscountUserRelService.updateDiscountUserRel(discountUserRel);
HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(discountUserRel.getDiscountAgentCodeId());
code.setStatus(3);
highDiscountAgentCodeService.updateCode(code);
}
outRechargeOrderMapper.insert(outRechargeOrder);
}
@ -171,8 +186,23 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
if (order != null && order.getStatus() == 1) {
order.setStatus(4); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款
order.setCancelTime(new Date());
if (order.getMemDiscountId() != null) {
HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId());
if (rel != null) {
rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
rel.setUseTime(null);
highDiscountUserRelService.updateDiscountUserRel(rel);
HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(rel.getDiscountAgentCodeId());
code.setStatus(2);
highDiscountAgentCodeService.updateCode(code);
}
}
updateOrder(order);
}
}
@Override

Loading…
Cancel
Save