'提交代码'

dev-discount
= 3 years ago
parent 27f65146f2
commit 7c51254bdd
  1. 7
      hai-cweb/src/main/java/com/cweb/controller/HighMerchantStoreController.java
  2. 6
      hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java
  3. 17
      hai-cweb/src/main/java/com/cweb/controller/HighUserController.java
  4. 6
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  5. 10
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  6. 21
      hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java
  7. 2
      hai-schedule/src/main/resources/dev/application.yml
  8. 2
      hai-service/src/main/java/com/hai/common/security/AESEncodeUtil.java
  9. 20
      hai-service/src/main/java/com/hai/dao/HighUserPayPasswordMapper.java
  10. 14
      hai-service/src/main/java/com/hai/dao/HighUserPayPasswordSqlProvider.java
  11. 16
      hai-service/src/main/java/com/hai/entity/HighUserPayPassword.java
  12. 60
      hai-service/src/main/java/com/hai/entity/HighUserPayPasswordExample.java
  13. 11
      hai-service/src/main/java/com/hai/model/UserModel.java
  14. 7
      hai-service/src/main/java/com/hai/service/HighUserPayPasswordService.java
  15. 11
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  16. 9
      hai-service/src/main/java/com/hai/service/impl/HighUserPayPasswordServiceImpl.java
  17. 11
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java

@ -64,7 +64,12 @@ public class HighMerchantStoreController {
public ResponseData getMerchantStoreById(@RequestParam(name = "id", required = true) Long id) {
try {
return ResponseMsgUtil.success(highMerchantStoreService.getMerchantStoreById(id));
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(id);
if (store != null) {
store.setHighMerchant(highMerchantService.getMerchantById(store.getMerchantId()));
store.setSecUser(null);
}
return ResponseMsgUtil.success(store);
} catch (Exception e) {
log.error("HighMerchantStoreController -> getMerchantStoreById() error!",e);

@ -1,10 +1,5 @@
package com.cweb.controller;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SessionKeyCache;
import com.cweb.config.WxMaConfiguration;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
@ -17,7 +12,6 @@ import com.hai.model.ResponseData;
import com.hai.service.HighUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;

@ -62,7 +62,6 @@ public class HighUserController {
@ApiOperation(value = "根据id查询详情")
public ResponseData findById( HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
@ -72,6 +71,7 @@ public class HighUserController {
highUser.setUnusedCouponNum( highUserCouponService.getCouponList(highUser.getId(), 1).size()); //未使用卡卷数量
highUser.setUnpaid(highOrderService.countOrderByUserId(highUser.getId() , 1));
highUser.setUnusedDiscount(highOrderService.countUnusedDiscountByUserId(highUser.getId() , 1));
highUser.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(userInfoModel.getHighUser().getId()));
}
return ResponseMsgUtil.success(highUser);
@ -122,10 +122,7 @@ public class HighUserController {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (highUserPayPasswordService.getDetailByUser(userInfoModel.getHighUser().getId()) != null) {
return ResponseMsgUtil.success(true);
}
return ResponseMsgUtil.success(false);
return ResponseMsgUtil.success(highUserPayPasswordService.isSetPayPwd(userInfoModel.getHighUser().getId()));
} catch (Exception e) {
log.error("HighUserController --> setUserPayPwd() error!", e);
@ -159,7 +156,15 @@ public class HighUserController {
userPayPassword.setUserId(userInfoModel.getHighUser().getId());
userPayPassword.setPassword(AESEncodeUtil.aesEncrypt(body.getString("password")));
highUserPayPasswordService.editUserPayPwd(userPayPassword);
return ResponseMsgUtil.success("操作成功");
// 定义个人所有数据
HighUser user = highUserService.findByUserId(userInfoModel.getHighUser().getId());
HighUserModel highUserModel = new HighUserModel();
user.setPassword(null);
user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(user.getId()));
highUserModel.setHighUser(user);
SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
log.error("HighUserController --> setUserPayPwd() error!", e);

@ -21,6 +21,7 @@ import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighUser;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.HighUserPayPasswordService;
import com.hai.service.HighUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -53,6 +54,9 @@ public class WechatController {
@Resource
private HighUserService highUserService;
@Resource
private HighUserPayPasswordService highUserPayPasswordService;
@RequestMapping(value = "/handleCode", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "小程序code解析")
@ -204,6 +208,7 @@ public class WechatController {
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
user.setPassword(null);
user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(user.getId()));
highUserModel.setHighUser(user);
SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
@ -320,6 +325,7 @@ public class WechatController {
HighUserModel highUserModel = new HighUserModel();
user.setPassword(null);
highUserModel.setHighUser(user);
user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(user.getId()));
SessionObject so = new SessionObject(userInfo.getString("unionid"), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);

@ -229,18 +229,16 @@ public class OrderController {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
if (StringUtils.isBlank(password)) {
log.error("orderToPay error!", "未输入支付密码");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, "");
}
// 查询用户支付密码
HighUserPayPassword userPayPassword = highUserPayPasswordService.getDetailByUser(userInfoModel.getHighUser().getId());
if (userPayPassword == null) {
log.error("orderToPay error!", "未设置支付密码");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_SET_USER_PAY_PWD, "");
}
if (StringUtils.isBlank(password)) {
log.error("orderToPay error!", "未输入支付密码");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, "");
}
// 校验支付密码是否一直
if (!AESEncodeUtil.aesEncrypt(password).equals(userPayPassword.getPassword())) {
log.error("orderToPay error!", "");

@ -7,6 +7,7 @@ import com.hai.common.exception.SysCode;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.HuiLianTongConfig;
import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighUserCouponMapper;
import com.hai.entity.*;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserCouponService;
@ -16,6 +17,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
@ -31,6 +33,9 @@ public class HighCouponSchedule {
@Resource
private HighUserCouponService highUserCouponService;
@Resource
private HighUserCouponMapper highUserCouponMapper;
@Resource
private HighCouponCodeOtherMapper highCouponCodeOtherMapper;
@ -80,6 +85,20 @@ public class HighCouponSchedule {
if (data.getJSONObject("data").getInteger("state") != 20) {
couponCodeOther.setStatus(data.getJSONObject("data").getInteger("state"));
highCouponCodeOtherMapper.updateByPrimaryKey(couponCodeOther);
HighUserCouponExample userCouponExample = new HighUserCouponExample();
userCouponExample.createCriteria().andQrCodeImgEqualTo(couponCodeOther.getCouNo()).andStatusEqualTo(1);
List<HighUserCoupon> list = highUserCouponMapper.selectByExample(userCouponExample);
if (list.size() > 0) {
HighUserCoupon userCoupon = list.get(0);
if (data.getJSONObject("data").getInteger("state") == 40) {
userCoupon.setStatus(2);
userCoupon.setConsumeTime(new Date());
} else {
userCoupon.setStatus(0);
}
highUserCouponMapper.updateByPrimaryKey(userCoupon);
}
}
// 查询订单中的汇联通卡券全部已处理
@ -90,8 +109,6 @@ public class HighCouponSchedule {
}
}
}
}
}

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

@ -62,7 +62,7 @@ public class AESEncodeUtil {
public static void main(String[] args) throws Exception{
long currentTimeMillis = System.currentTimeMillis();
System.out.println(AESEncodeUtil.aesEncrypt("1"));
System.out.println(AESEncodeUtil.aesEncrypt("123456"));
/* String content = "{\"create_time\":1573544092110,\"order_serial_no\":\"40280e816db49c0b016db4a2c31f0004\",\"product_code\":\"8a9e80045cf85e54015cf8809fcd\",\"product_name\":\"平安发票贷\",\"uscc\":\"91370781687233838E\"}";
System.out.println("加密前" + content);

@ -39,14 +39,12 @@ public interface HighUserPayPasswordMapper extends HighUserPayPasswordMapperExt
int deleteByPrimaryKey(Long id);
@Insert({
"insert into high_user_pay_password (user_id, user_phone, ",
"`password`, create_time, ",
"update_time, ext_1, ",
"ext_2, ext_3)",
"values (#{userId,jdbcType=BIGINT}, #{userPhone,jdbcType=BIGINT}, ",
"#{password,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"insert into high_user_pay_password (user_id, `password`, ",
"create_time, update_time, ",
"ext_1, ext_2, ext_3)",
"values (#{userId,jdbcType=BIGINT}, #{password,jdbcType=VARCHAR}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighUserPayPassword record);
@ -59,7 +57,6 @@ public interface HighUserPayPasswordMapper extends HighUserPayPasswordMapperExt
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.BIGINT),
@Result(column="password", property="password", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@ -71,15 +68,13 @@ public interface HighUserPayPasswordMapper extends HighUserPayPasswordMapperExt
@Select({
"select",
"id, user_id, user_phone, `password`, create_time, update_time, ext_1, ext_2, ",
"ext_3",
"id, user_id, `password`, create_time, update_time, ext_1, ext_2, ext_3",
"from high_user_pay_password",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.BIGINT),
@Result(column="password", property="password", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@ -101,7 +96,6 @@ public interface HighUserPayPasswordMapper extends HighUserPayPasswordMapperExt
@Update({
"update high_user_pay_password",
"set user_id = #{userId,jdbcType=BIGINT},",
"user_phone = #{userPhone,jdbcType=BIGINT},",
"`password` = #{password,jdbcType=VARCHAR},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",

@ -32,10 +32,6 @@ public class HighUserPayPasswordSqlProvider {
sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}");
}
if (record.getUserPhone() != null) {
sql.VALUES("user_phone", "#{userPhone,jdbcType=BIGINT}");
}
if (record.getPassword() != null) {
sql.VALUES("`password`", "#{password,jdbcType=VARCHAR}");
}
@ -71,7 +67,6 @@ public class HighUserPayPasswordSqlProvider {
sql.SELECT("id");
}
sql.SELECT("user_id");
sql.SELECT("user_phone");
sql.SELECT("`password`");
sql.SELECT("create_time");
sql.SELECT("update_time");
@ -103,10 +98,6 @@ public class HighUserPayPasswordSqlProvider {
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
}
if (record.getUserPhone() != null) {
sql.SET("user_phone = #{record.userPhone,jdbcType=BIGINT}");
}
if (record.getPassword() != null) {
sql.SET("`password` = #{record.password,jdbcType=VARCHAR}");
}
@ -141,7 +132,6 @@ public class HighUserPayPasswordSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
sql.SET("user_phone = #{record.userPhone,jdbcType=BIGINT}");
sql.SET("`password` = #{record.password,jdbcType=VARCHAR}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
@ -162,10 +152,6 @@ public class HighUserPayPasswordSqlProvider {
sql.SET("user_id = #{userId,jdbcType=BIGINT}");
}
if (record.getUserPhone() != null) {
sql.SET("user_phone = #{userPhone,jdbcType=BIGINT}");
}
if (record.getPassword() != null) {
sql.SET("`password` = #{password,jdbcType=VARCHAR}");
}

@ -23,11 +23,6 @@ public class HighUserPayPassword implements Serializable {
*/
private Long userId;
/**
* 用户手机号
*/
private Long userPhone;
/**
* 密码
*/
@ -67,14 +62,6 @@ public class HighUserPayPassword implements Serializable {
this.userId = userId;
}
public Long getUserPhone() {
return userPhone;
}
public void setUserPhone(Long userPhone) {
this.userPhone = userPhone;
}
public String getPassword() {
return password;
}
@ -137,7 +124,6 @@ public class HighUserPayPassword implements Serializable {
HighUserPayPassword other = (HighUserPayPassword) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getUserPhone() == null ? other.getUserPhone() == null : this.getUserPhone().equals(other.getUserPhone()))
&& (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
@ -152,7 +138,6 @@ public class HighUserPayPassword implements Serializable {
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getUserPhone() == null) ? 0 : getUserPhone().hashCode());
result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
@ -170,7 +155,6 @@ public class HighUserPayPassword implements Serializable {
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", userId=").append(userId);
sb.append(", userPhone=").append(userPhone);
sb.append(", password=").append(password);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);

@ -245,66 +245,6 @@ public class HighUserPayPasswordExample {
return (Criteria) this;
}
public Criteria andUserPhoneIsNull() {
addCriterion("user_phone is null");
return (Criteria) this;
}
public Criteria andUserPhoneIsNotNull() {
addCriterion("user_phone is not null");
return (Criteria) this;
}
public Criteria andUserPhoneEqualTo(Long value) {
addCriterion("user_phone =", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneNotEqualTo(Long value) {
addCriterion("user_phone <>", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneGreaterThan(Long value) {
addCriterion("user_phone >", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneGreaterThanOrEqualTo(Long value) {
addCriterion("user_phone >=", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneLessThan(Long value) {
addCriterion("user_phone <", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneLessThanOrEqualTo(Long value) {
addCriterion("user_phone <=", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneIn(List<Long> values) {
addCriterion("user_phone in", values, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneNotIn(List<Long> values) {
addCriterion("user_phone not in", values, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneBetween(Long value1, Long value2) {
addCriterion("user_phone between", value1, value2, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneNotBetween(Long value1, Long value2) {
addCriterion("user_phone not between", value1, value2, "userPhone");
return (Criteria) this;
}
public Criteria andPasswordIsNull() {
addCriterion("`password` is null");
return (Criteria) this;

@ -16,6 +16,9 @@ public class UserModel {
// 待支付数量
private Integer unpaid;
// 是否设置支付密码
private Boolean isSetPayPwd;
public Integer getUnusedCouponNum() {
return unusedCouponNum;
}
@ -39,4 +42,12 @@ public class UserModel {
public void setUnpaid(Integer unpaid) {
this.unpaid = unpaid;
}
public Boolean getIsSetPayPwd() {
return isSetPayPwd;
}
public void setIsSetPayPwd(Boolean setPayPwd) {
isSetPayPwd = setPayPwd;
}
}

@ -20,4 +20,11 @@ public interface HighUserPayPasswordService {
*/
HighUserPayPassword getDetailByUser(Long userId);
/**
* 查询用户是否设置支付密码
* @param userId
* @return
*/
Boolean isSetPayPwd(Long userId);
}

@ -215,6 +215,17 @@ public class HighOrderServiceImpl implements HighOrderService {
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
highCouponCodeOtherMapper.insert(couponCodeOther);
// 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setMerchantId(coupon.getMerchantId());
highUserCoupon.setCouponId(coupon.getId());
highUserCoupon.setUserId(highOrder.getMemId());
highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(dataObject.getString("couNo"));
highUserCoupon.setUseEndTime(dataObject.getDate("validEndDate"));
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon);
}
}
// 推送记录

@ -38,4 +38,13 @@ public class HighUserPayPasswordServiceImpl implements HighUserPayPasswordServic
}
return null;
}
@Override
public Boolean isSetPayPwd(Long userId) {
HighUserPayPassword data = getDetailByUser(userId);
if (data != null) {
return true;
}
return false;
}
}

@ -147,6 +147,17 @@ public class GoodsOrderServiceImpl implements PayService {
couponCodeOther.setValidStartDate(dataObject.getDate("validStartDate"));
couponCodeOther.setValidEndDate(dataObject.getDate("validEndDate"));
highCouponCodeOtherMapper.insert(couponCodeOther);
// 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setMerchantId(coupon.getMerchantId());
highUserCoupon.setCouponId(coupon.getId());
highUserCoupon.setUserId(order.getMemId());
highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(dataObject.getString("couNo"));
highUserCoupon.setUseEndTime(dataObject.getDate("validEndDate"));
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon);
}
}

Loading…
Cancel
Save