dev-discount
袁野 3 years ago
commit 4bd004fa4a
  1. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  2. 4
      hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java
  3. 8
      hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java
  4. 2
      hai-cweb/src/main/java/com/cweb/controller/SendSmsController.java
  5. 2
      hai-cweb/src/main/java/com/cweb/controller/SmsContentController.java
  6. 353
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  7. 272
      hai-service/src/main/java/com/hai/config/CommonSysConfig.java
  8. 103
      hai-service/src/main/java/com/hai/config/UnionStagingPayConfig.java
  9. 131
      hai-service/src/main/java/com/hai/dao/HighDiscountInventoryRecordMapper.java
  10. 7
      hai-service/src/main/java/com/hai/dao/HighDiscountInventoryRecordMapperExt.java
  11. 346
      hai-service/src/main/java/com/hai/dao/HighDiscountInventoryRecordSqlProvider.java
  12. 257
      hai-service/src/main/java/com/hai/entity/HighDiscountInventoryRecord.java
  13. 1043
      hai-service/src/main/java/com/hai/entity/HighDiscountInventoryRecordExample.java
  14. 7
      hai-service/src/main/resources/dev/commonConfig.properties

File diff suppressed because one or more lines are too long

@ -142,7 +142,7 @@ public class HighUserCardController {
}
// 获取手机号验证码
String phoneSmsCode = (String) redisUtil.get(body.getString("phone"));
String phoneSmsCode = (String) redisUtil.get("SMS_"+body.getString("phone"));
// 验证码校验
if (StringUtils.isNotBlank(phoneSmsCode) && Objects.equals(phoneSmsCode,body.getString("smsCode"))) {
@ -153,7 +153,7 @@ public class HighUserCardController {
userCard.setType(UserCardType.type1.getType());
highUserCardService.editCard(userCard);
redisUtil.del(body.getString("phone"));
redisUtil.del("SMS_"+body.getString("phone"));
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();

@ -59,13 +59,13 @@ public class HighUserCommonController {
try {
// 获取手机号验证码
String phoneSmsCode = (String) redisUtil.get(phone);
String phoneSmsCode = (String) redisUtil.get("SMS_"+phone);
// 校验验证码
if (StringUtils.isBlank(phoneSmsCode) || !Objects.equals(phoneSmsCode,code)) {
log.error("HighUserController --> bindUserPhone() error!", "验证码错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误");
}
redisUtil.del(phone);
redisUtil.del("SMS_"+phone);
HighUser user = highUserService.findByPhone(phone);
if(user == null) {
@ -87,7 +87,7 @@ public class HighUserCommonController {
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(StringUtils.isNotBlank(user.getUnionId())?user.getUnionId():detailData.getId().toString(), 1 , highUserModel);
SessionObject so = new SessionObject(user.getPhone(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
@ -145,7 +145,7 @@ public class HighUserCommonController {
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(StringUtils.isNotBlank(user.getUnionId())?user.getUnionId():detailData.getId().toString(), 1 , highUserModel);
SessionObject so = new SessionObject(user.getPhone(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {

@ -93,7 +93,7 @@ public class SendSmsController {
JSONObject object = HttpsUtils.doPostSendSms(url, map);
String code = object.getString("code");
if (code.equals("000000")) {
redisUtil.set(phone,smsCode, 60*10);
redisUtil.set("SMS_"+phone,smsCode, 60*10);
return ResponseMsgUtil.success("发送成功");
}
return ResponseMsgUtil.success(object);

@ -170,7 +170,7 @@ public class SmsContentController {
e.printStackTrace();
}
}
redisUtil.set(phone,smsCode, 60*10);
redisUtil.set("SMS_"+phone,smsCode, 60*10);
return ResponseMsgUtil.success("发送成功");
} catch (Exception e) {

@ -87,36 +87,6 @@ public class WechatController {
}
}
@RequestMapping(value = "/login", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "小程序授权用户登录接口")
public ResponseData login(@RequestParam(value = "openId", required = true) String openId,
HttpServletRequest request, HttpServletResponse response) {
try {
//校验code,openId不能同时为空
if (StringUtils.isEmpty(openId)) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.REQ_PARAMS_ERROR, "");
}
HighUser highUser = highUserService.findByOpenId(openId);
if (highUser == null) {
log.error("login error!", "未找到用户");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "");
}
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(highUser.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(highUser.getUnionId(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/loginByPhone", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "小程序根据手机号登录或注册")
@ -136,7 +106,7 @@ public class WechatController {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.REQ_PARAMS_ERROR, "");
}
//请求微信api,获取用户session_key以及openId
Object skObject = redisUtil.hget(WX_OPENID_SESSION_REDIS,openId);
Object skObject = redisUtil.hget(WX_OPENID_SESSION_REDIS, openId);
if (skObject == null){
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_LOGIN_ERROR);
}
@ -148,37 +118,25 @@ public class WechatController {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "用户phoneNumber解析失败");
}
HighUser user = highUserService.findByOpenId(session.getOpenid());
if (user != null) {
if (StringUtils.isBlank(user.getPhone())) {
if (highUserService.findByPhone(phoneNoInfo.getPurePhoneNumber()) != null) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.COMMON_ERROR, "手机号已被绑定,请更换后重新授权");
}
user.setPhone(phoneNoInfo.getPurePhoneNumber());
highUserService.updateUser(user);
}
// 根据手机号查询用户
HighUser user = highUserService.findByPhone(phoneNoInfo.getPurePhoneNumber());
if (user == null) {
user = new HighUser();
user.setName("用户" + IDGenerator.nextId(5));
user.setPhone(phoneNoInfo.getPurePhoneNumber());
user.setRegTime(new Date());
user.setGold(0);
user.setOpenId(session.getOpenid());
user.setUnionId(session.getUnionid());
user.setStatus(1);
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
highUserService.insertUser(user);
} else {
// 根据手机号查询用户
user = highUserService.findByPhone(phoneNoInfo.getPurePhoneNumber());
if (user == null) {
user = new HighUser();
user.setName("用户" + IDGenerator.nextId(5));
user.setPhone(phoneNoInfo.getPurePhoneNumber());
user.setRegTime(new Date());
user.setGold(0);
user.setOpenId(session.getOpenid());
user.setUnionId(session.getUnionid());
user.setStatus(1);
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
highUserService.insertUser(user);
} else {
if (StringUtils.isBlank(user.getName())) {
user.setName("用户" + IDGenerator.nextId(5));
}
if (session.getOpenid() == null) {
user.setOpenId(session.getOpenid());
user.setUnionId(session.getUnionid());
highUserService.updateUser(user);
@ -190,62 +148,13 @@ public class WechatController {
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getPhoneNumber", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "小程序获取用户手机号码")
public ResponseData getPhoneNumber(@RequestParam(value = "encryptedData", required = true) String encryptedData,
@RequestParam(value = "iv", required = true) String iv,
@RequestParam(value = "openId", required = true) String openId,
HttpServletRequest request, HttpServletResponse response) {
try {
log.error("origin encryptedData:" + encryptedData + ";iv:" + iv);
//校验openId不能为空
//encryptedData,iv与unionId不能同时为空
encryptedData = encryptedData.replace(" ", "+");
iv = iv.replace(" ", "+");
log.error("dest encryptedData:" + encryptedData + ";iv:" + iv);
if (StringUtils.isEmpty(openId)
|| StringUtils.isEmpty(encryptedData) || StringUtils.isEmpty(iv)) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.REQ_PARAMS_ERROR, "");
}
//请求微信api,获取用户session_key以及openId
Object skObject = redisUtil.hget(WX_OPENID_SESSION_REDIS,openId);
if (skObject == null){
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_LOGIN_ERROR);
}
WxMaJscode2SessionResult session = (WxMaJscode2SessionResult)skObject;
final WxMaService wxService = WxMaConfiguration.getMaService();
WxMaPhoneNumberInfo phoneNoInfo = wxService.getUserService().getPhoneNoInfo(session.getSessionKey(), encryptedData, iv);
if (phoneNoInfo == null || StringUtils.isEmpty(phoneNoInfo.getPurePhoneNumber())) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "用户phoneNumber解析失败");
}
HighUser user = highUserService.bindUserPhone(phoneNoInfo.getPurePhoneNumber(), request);
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
SessionObject so = new SessionObject(user.getPhone(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@ -257,12 +166,16 @@ public class WechatController {
@RequestParam(value = "openId", required = true) String openId,
HttpServletRequest request, HttpServletResponse response) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
//校验openId不能为空
//encryptedData,iv与unionId不能同时为空
encryptedData = encryptedData.replace(" ", "+");
iv = iv.replace(" ", "+");
if (StringUtils.isEmpty(openId)
|| StringUtils.isEmpty(encryptedData) || StringUtils.isEmpty(iv)) {
if (StringUtils.isEmpty(openId) || StringUtils.isEmpty(encryptedData) || StringUtils.isEmpty(iv)) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.REQ_PARAMS_ERROR, "");
}
//请求微信api,获取用户session_key以及openId
@ -277,46 +190,36 @@ public class WechatController {
if (userInfo == null) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "用户phoneNumber解析失败");
}
if (StringUtils.isBlank(session.getUnionid())) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "获取UnionId失败");
}
HighUser user = highUserService.findByOpenId(session.getOpenid());
HighUser user = highUserService.findByUserId(userInfoModel.getHighUser().getId());
if (user == null) {
user = new HighUser();
user.setUnionId(session.getUnionid());
user.setOpenId(openId);
user.setRegTime(new Date());
user.setStatus(1);
user.setGold(0);
user.setHeaderImg(userInfo.getAvatarUrl());
user.setName(userInfo.getNickName());
user.setInfoCompleteStatus(2);
highUserService.insertUser(user);
} else {
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
if (user.getInfoCompleteStatus() == 1) {
if (StringUtils.isNotBlank(user.getPhone())) {
user.setInfoCompleteStatus(0);
} else {
user.setInfoCompleteStatus(2);
}
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.COMMON_ERROR, "未找到用户信息");
}
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
if (user.getInfoCompleteStatus() == 1) {
if (StringUtils.isNotBlank(user.getPhone())) {
user.setInfoCompleteStatus(0);
} else {
user.setInfoCompleteStatus(2);
}
user.setUnionId(session.getUnionid());
user.setHeaderImg(userInfo.getAvatarUrl());
user.setName(userInfo.getNickName());
user.setOpenId(userInfo.getOpenId());
highUserService.updateUser(user);
}
user.setName(userInfo.getNickName());
user.setHeaderImg(userInfo.getAvatarUrl());
highUserService.updateUser(user);
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
if (user.getPhone() == null) {
log.error("login error!", "未绑定手机号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定手机号");
}
SessionObject so = new SessionObject(user.getPhone(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
@ -326,39 +229,6 @@ public class WechatController {
}
}
@RequestMapping(value = "/getH5Code", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "【H5】获取Code")
public ResponseData getH5Code() {
try {
Map<String, Object> params = new LinkedHashMap<>();
params.put("appid", SysConst.getSysConfig().getWxH5AppId());
params.put("redirect_uri", URLEncoder.encode("https://hsgcs.dctpay.com/H5/index.html#/", "utf-8"));
//params.put("redirect_uri", "https://hsgcs.dctpay.com/H5/index.html#/");
params.put("response_type", "code");
params.put("scope", "snsapi_userinfo");
params.put("state", "STATE");
String apiUrl = "https://open.weixin.qq.com/connect/oauth2/authorize";
StringBuffer param = new StringBuffer();
int i = 0;
for (String key : params.keySet()) {
if (i == 0)
param.append("?");
else
param.append("&");
param.append(key).append("=").append(params.get(key));
i++;
}
apiUrl += param + "#wechat_redirect";
return ResponseMsgUtil.success(apiUrl);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getH5AccessToken", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "【H5】获取AccessToken")
@ -375,133 +245,4 @@ public class WechatController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getH5UserInfo", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "【H5】获取用户信息")
public ResponseData getH5UserInfo(@RequestParam(value = "code", required = true) String code,
HttpServletRequest request, HttpServletResponse response) {
try {
// 获取access_token
Map<String, Object> params = new HashMap<>();
params.put("appid", SysConst.getSysConfig().getWxH5AppId());
params.put("secret", SysConst.getSysConfig().getWxH5AppSecret());
params.put("code", code);
params.put("grant_type", "authorization_code");
JSONObject jsonObject = HttpsUtils.doGet("https://api.weixin.qq.com/sns/oauth2/access_token", params);
String accessToken = jsonObject.getString("access_token");
String openid = jsonObject.getString("openid");
if (StringUtils.isBlank(accessToken) || StringUtils.isBlank(openid)) {
log.error("getH5UserInfo error!", "获取微信access_token失败" );
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取微信access_token失败");
}
params.clear();
params.put("access_token", accessToken);
params.put("openid", openid);
params.put("lang", "zh_CN");
JSONObject userInfo = HttpsUtils.doGet("https://api.weixin.qq.com/sns/userinfo", params);
if (StringUtils.isNotBlank(userInfo.getString("errcode"))) {
log.error("getH5UserInfo error!", "获取微信用户信息失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取微信用户信息失败");
}
if (StringUtils.isBlank(userInfo.getString("unionid"))) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "获取UnionId失败");
}
HighUser user = highUserService.findByUnionId(userInfo.getString("unionid"));
if (user == null) {
user = new HighUser();
user.setUnionId(userInfo.getString("unionid"));
user.setOpenIdH5(openid);
user.setRegTime(new Date());
user.setStatus(1);
user.setGold(0);
user.setHeaderImg(userInfo.getString("headimgurl"));
user.setName(userInfo.getString("nickname"));
user.setInfoCompleteStatus(2);
highUserService.insertUser(user);
} else {
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
if (user.getInfoCompleteStatus() == 1) {
if (StringUtils.isNotBlank(user.getPhone())) {
user.setInfoCompleteStatus(0);
} else {
user.setInfoCompleteStatus(2);
}
}
user.setOpenIdH5(openid);
user.setHeaderImg(userInfo.getString("headimgurl"));
user.setName(userInfo.getString("nickname"));
highUserService.updateUser(user);
}
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getUnionId", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "刷取unionid")
public ResponseData getUnionId(HttpServletRequest request, HttpServletResponse response) {
try {
// 获取access_token
Map<String, Object> params = new HashMap<>();
params.put("appid", SysConst.getSysConfig().getWxAppId());
params.put("secret", SysConst.getSysConfig().getWxAppSecret());
params.put("grant_type", "client_credential");
JSONObject jsonObject = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/token", params);
System.out.println(jsonObject.toJSONString());
String accessToken = jsonObject.getString("access_token");
if (StringUtils.isBlank(accessToken)) {
log.error("getH5UserInfo error!", "获取微信access_token失败" );
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取微信access_token失败");
}
params.clear();
List<Map<String,Object>> userMapList = new ArrayList<>();
Map<String,Object> userMap;
int pageNum = 1;
while (true) {
userMapList.clear();;
PageHelper.startPage(pageNum, 100);
PageInfo<HighUser> pageInfo = new PageInfo<>(highUserService.getListUser(new HashMap<>()));
if (pageInfo.getList().size() > 0) {
for (HighUser user : pageInfo.getList()) {
userMap = new HashMap<>();
userMap.put("openid", user.getOpenId());
userMap.put("lang", "zh_CN");
userMapList.add(userMap);
}
params.put("user_list", userMapList);
System.out.println(JSONObject.toJSONString(params));
JSONObject userInfo = HttpsUtils.doPost("https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token=" + accessToken, JSONObject.toJSONString(params));
System.out.println(userInfo.toJSONString());
}
pageNum++;
break;
}
return ResponseMsgUtil.success("处理成功");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
}

@ -39,6 +39,14 @@ public class CommonSysConfig {
private String unionPayNotifyUrl;
private String unionPayTelNotifyUrl;
private String unionStagingPayUrl;
private String unionStagingPayOrgId;
private String unionStagingPayOrgMerCode;
private String unionStagingPayOrgTermNo;
private String unionStagingPaySignKey;
private String unionStagingPayNotifyUrl;
private String wx_cert;
private String telApiKey;
@ -47,52 +55,92 @@ public class CommonSysConfig {
private String telUrl;
private String czOrderNotify;
public String getUnionPayTelNotifyUrl() {
return unionPayTelNotifyUrl;
public String getTuanYouUrl() {
return tuanYouUrl;
}
public void setUnionPayTelNotifyUrl(String unionPayTelNotifyUrl) {
this.unionPayTelNotifyUrl = unionPayTelNotifyUrl;
public void setTuanYouUrl(String tuanYouUrl) {
this.tuanYouUrl = tuanYouUrl;
}
public String getUnionPayNotifyUrl() {
return unionPayNotifyUrl;
public String getTuanYouAppKey() {
return tuanYouAppKey;
}
public void setUnionPayNotifyUrl(String unionPayNotifyUrl) {
this.unionPayNotifyUrl = unionPayNotifyUrl;
public void setTuanYouAppKey(String tuanYouAppKey) {
this.tuanYouAppKey = tuanYouAppKey;
}
public String getHuiLianTongUnionCardUrl() {
return HuiLianTongUnionCardUrl;
public String getTuanYouAppSecret() {
return tuanYouAppSecret;
}
public void setHuiLianTongUnionCardUrl(String huiLianTongUnionCardUrl) {
HuiLianTongUnionCardUrl = huiLianTongUnionCardUrl;
public void setTuanYouAppSecret(String tuanYouAppSecret) {
this.tuanYouAppSecret = tuanYouAppSecret;
}
public String getHuiLianTongUnionCardAccessCode() {
return HuiLianTongUnionCardAccessCode;
public String getTuanYouDieselAccount() {
return tuanYouDieselAccount;
}
public void setHuiLianTongUnionCardAccessCode(String huiLianTongUnionCardAccessCode) {
HuiLianTongUnionCardAccessCode = huiLianTongUnionCardAccessCode;
public void setTuanYouDieselAccount(String tuanYouDieselAccount) {
this.tuanYouDieselAccount = tuanYouDieselAccount;
}
public String getHuiLianTongUnionCardSignCode() {
return HuiLianTongUnionCardSignCode;
public String getTuanYouGasolineAccount() {
return tuanYouGasolineAccount;
}
public void setHuiLianTongUnionCardSignCode(String huiLianTongUnionCardSignCode) {
HuiLianTongUnionCardSignCode = huiLianTongUnionCardSignCode;
public void setTuanYouGasolineAccount(String tuanYouGasolineAccount) {
this.tuanYouGasolineAccount = tuanYouGasolineAccount;
}
public String getHuiliantongAppNo() {
return huiliantongAppNo;
public String getQinzhuUrl() {
return qinzhuUrl;
}
public void setHuiliantongAppNo(String huiliantongAppNo) {
this.huiliantongAppNo = huiliantongAppNo;
public void setQinzhuUrl(String qinzhuUrl) {
this.qinzhuUrl = qinzhuUrl;
}
public String getQinzhuHtmlUrl() {
return qinzhuHtmlUrl;
}
public void setQinzhuHtmlUrl(String qinzhuHtmlUrl) {
this.qinzhuHtmlUrl = qinzhuHtmlUrl;
}
public String getQinzhuMobileUrl() {
return qinzhuMobileUrl;
}
public void setQinzhuMobileUrl(String qinzhuMobileUrl) {
this.qinzhuMobileUrl = qinzhuMobileUrl;
}
public String getQinzhuPlatformId() {
return qinzhuPlatformId;
}
public void setQinzhuPlatformId(String qinzhuPlatformId) {
this.qinzhuPlatformId = qinzhuPlatformId;
}
public String getQinzhuSecret() {
return qinzhuSecret;
}
public void setQinzhuSecret(String qinzhuSecret) {
this.qinzhuSecret = qinzhuSecret;
}
public String getQianzhuOrderNotify() {
return qianzhuOrderNotify;
}
public void setQianzhuOrderNotify(String qianzhuOrderNotify) {
this.qianzhuOrderNotify = qianzhuOrderNotify;
}
public String getHuiliantongUrl() {
@ -103,6 +151,14 @@ public class CommonSysConfig {
this.huiliantongUrl = huiliantongUrl;
}
public String getHuiliantongAppNo() {
return huiliantongAppNo;
}
public void setHuiliantongAppNo(String huiliantongAppNo) {
this.huiliantongAppNo = huiliantongAppNo;
}
public String getHuiliantongAppkey() {
return huiliantongAppkey;
}
@ -119,100 +175,132 @@ public class CommonSysConfig {
this.huiliantongAppsecret = huiliantongAppsecret;
}
public String getQinzhuHtmlUrl() {
return qinzhuHtmlUrl;
public String getHuiLianTongUnionCardUrl() {
return HuiLianTongUnionCardUrl;
}
public void setQinzhuHtmlUrl(String qinzhuHtmlUrl) {
this.qinzhuHtmlUrl = qinzhuHtmlUrl;
public void setHuiLianTongUnionCardUrl(String huiLianTongUnionCardUrl) {
HuiLianTongUnionCardUrl = huiLianTongUnionCardUrl;
}
public String getCzOrderNotify() {
return czOrderNotify;
public String getHuiLianTongUnionCardAccessCode() {
return HuiLianTongUnionCardAccessCode;
}
public void setCzOrderNotify(String czOrderNotify) {
this.czOrderNotify = czOrderNotify;
public void setHuiLianTongUnionCardAccessCode(String huiLianTongUnionCardAccessCode) {
HuiLianTongUnionCardAccessCode = huiLianTongUnionCardAccessCode;
}
public String getQinzhuMobileUrl() {
return qinzhuMobileUrl;
public String getHuiLianTongUnionCardSignCode() {
return HuiLianTongUnionCardSignCode;
}
public void setQinzhuMobileUrl(String qinzhuMobileUrl) {
this.qinzhuMobileUrl = qinzhuMobileUrl;
public void setHuiLianTongUnionCardSignCode(String huiLianTongUnionCardSignCode) {
HuiLianTongUnionCardSignCode = huiLianTongUnionCardSignCode;
}
public String getQianzhuOrderNotify() {
return qianzhuOrderNotify;
public String getUnionPayUrl() {
return unionPayUrl;
}
public void setQianzhuOrderNotify(String qianzhuOrderNotify) {
this.qianzhuOrderNotify = qianzhuOrderNotify;
public void setUnionPayUrl(String unionPayUrl) {
this.unionPayUrl = unionPayUrl;
}
public String getTuanYouUrl() {
return tuanYouUrl;
public String getUnionPayChannelid() {
return unionPayChannelid;
}
public void setTuanYouUrl(String tuanYouUrl) {
this.tuanYouUrl = tuanYouUrl;
public void setUnionPayChannelid(String unionPayChannelid) {
this.unionPayChannelid = unionPayChannelid;
}
public String getTuanYouAppKey() {
return tuanYouAppKey;
public String getUnionPayMerid() {
return unionPayMerid;
}
public void setTuanYouAppKey(String tuanYouAppKey) {
this.tuanYouAppKey = tuanYouAppKey;
public void setUnionPayMerid(String unionPayMerid) {
this.unionPayMerid = unionPayMerid;
}
public String getTuanYouAppSecret() {
return tuanYouAppSecret;
public String getUnionPayTermid() {
return unionPayTermid;
}
public void setTuanYouAppSecret(String tuanYouAppSecret) {
this.tuanYouAppSecret = tuanYouAppSecret;
public void setUnionPayTermid(String unionPayTermid) {
this.unionPayTermid = unionPayTermid;
}
public String getTuanYouDieselAccount() {
return tuanYouDieselAccount;
public String getUnionPaySignKey() {
return unionPaySignKey;
}
public void setTuanYouDieselAccount(String tuanYouDieselAccount) {
this.tuanYouDieselAccount = tuanYouDieselAccount;
public void setUnionPaySignKey(String unionPaySignKey) {
this.unionPaySignKey = unionPaySignKey;
}
public String getTuanYouGasolineAccount() {
return tuanYouGasolineAccount;
public String getUnionPayNotifyUrl() {
return unionPayNotifyUrl;
}
public void setTuanYouGasolineAccount(String tuanYouGasolineAccount) {
this.tuanYouGasolineAccount = tuanYouGasolineAccount;
public void setUnionPayNotifyUrl(String unionPayNotifyUrl) {
this.unionPayNotifyUrl = unionPayNotifyUrl;
}
public String getQinzhuUrl() {
return qinzhuUrl;
public String getUnionPayTelNotifyUrl() {
return unionPayTelNotifyUrl;
}
public void setQinzhuUrl(String qinzhuUrl) {
this.qinzhuUrl = qinzhuUrl;
public void setUnionPayTelNotifyUrl(String unionPayTelNotifyUrl) {
this.unionPayTelNotifyUrl = unionPayTelNotifyUrl;
}
public String getQinzhuPlatformId() {
return qinzhuPlatformId;
public String getUnionStagingPayUrl() {
return unionStagingPayUrl;
}
public void setQinzhuPlatformId(String qinzhuPlatformId) {
this.qinzhuPlatformId = qinzhuPlatformId;
public void setUnionStagingPayUrl(String unionStagingPayUrl) {
this.unionStagingPayUrl = unionStagingPayUrl;
}
public String getQinzhuSecret() {
return qinzhuSecret;
public String getUnionStagingPayOrgId() {
return unionStagingPayOrgId;
}
public void setQinzhuSecret(String qinzhuSecret) {
this.qinzhuSecret = qinzhuSecret;
public void setUnionStagingPayOrgId(String unionStagingPayOrgId) {
this.unionStagingPayOrgId = unionStagingPayOrgId;
}
public String getUnionStagingPayOrgMerCode() {
return unionStagingPayOrgMerCode;
}
public void setUnionStagingPayOrgMerCode(String unionStagingPayOrgMerCode) {
this.unionStagingPayOrgMerCode = unionStagingPayOrgMerCode;
}
public String getUnionStagingPayOrgTermNo() {
return unionStagingPayOrgTermNo;
}
public void setUnionStagingPayOrgTermNo(String unionStagingPayOrgTermNo) {
this.unionStagingPayOrgTermNo = unionStagingPayOrgTermNo;
}
public String getUnionStagingPaySignKey() {
return unionStagingPaySignKey;
}
public void setUnionStagingPaySignKey(String unionStagingPaySignKey) {
this.unionStagingPaySignKey = unionStagingPaySignKey;
}
public String getUnionStagingPayNotifyUrl() {
return unionStagingPayNotifyUrl;
}
public void setUnionStagingPayNotifyUrl(String unionStagingPayNotifyUrl) {
this.unionStagingPayNotifyUrl = unionStagingPayNotifyUrl;
}
public String getWx_cert() {
@ -255,43 +343,11 @@ public class CommonSysConfig {
this.telUrl = telUrl;
}
public String getUnionPayUrl() {
return unionPayUrl;
}
public void setUnionPayUrl(String unionPayUrl) {
this.unionPayUrl = unionPayUrl;
}
public String getUnionPayChannelid() {
return unionPayChannelid;
}
public void setUnionPayChannelid(String unionPayChannelid) {
this.unionPayChannelid = unionPayChannelid;
}
public String getUnionPayMerid() {
return unionPayMerid;
}
public void setUnionPayMerid(String unionPayMerid) {
this.unionPayMerid = unionPayMerid;
}
public String getUnionPayTermid() {
return unionPayTermid;
}
public void setUnionPayTermid(String unionPayTermid) {
this.unionPayTermid = unionPayTermid;
}
public String getUnionPaySignKey() {
return unionPaySignKey;
public String getCzOrderNotify() {
return czOrderNotify;
}
public void setUnionPaySignKey(String unionPaySignKey) {
this.unionPaySignKey = unionPaySignKey;
public void setCzOrderNotify(String czOrderNotify) {
this.czOrderNotify = czOrderNotify;
}
}

@ -0,0 +1,103 @@
package com.hai.config;
import com.alibaba.fastjson.JSONObject;
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
import org.apache.commons.codec.binary.Base64;
import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.HttpsUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.*;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.*;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.*;
/**
* 银联分期
* @author hurui
*/
public class UnionStagingPayConfig {
/**
* 银联分期支付H5预下单-标准
* 文档地址 https://doc.eycard.cn/web/#/42?page_id=1516
* @param orderNo 订单号
* @param orgTrace 订单号
* @param openId 支付宝微信云闪付用户授权唯一标识(如果没有:-)
* @param payPrice 支付金额 单位
* @return 响应信息
* @throws Exception
*/
public static JSONObject advancePay(String orderNo, String orgTrace, BigDecimal payPrice, String openId, String notifyUrl) throws Exception {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId());
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode());
paramMap.put("orgTermNo", CommonSysConst.getSysConfig().getUnionStagingPayOrgTermNo());
paramMap.put("prodTrace", orderNo);
paramMap.put("orgTrace", orgTrace);
paramMap.put("prodCode", "ISYH");
paramMap.put("signType", "RSA");
Map<String, Object> bizDataMap = new HashMap<>();
bizDataMap.put("transAmt", payPrice.multiply(new BigDecimal("100")).intValue());
bizDataMap.put("openId", openId);
bizDataMap.put("notifyUrl", notifyUrl);
paramMap.put("bizData", bizDataMap);
paramMap.put("sign", generateSign(bizDataMap));
JSONObject responseParam = HttpsUtils.doPost(CommonSysConst.getSysConfig().getUnionStagingPayUrl()+"cashier/apply/advancePay", paramMap, new HashMap<>());
return responseParam;
}
/**
* 参数排序
* @param param
* @return
*/
private static String paramSort(final Map<String, Object> param) {
Set<String> keySet = param.keySet();
String[] keyArray = keySet.toArray(new String[keySet.size()]);
Arrays.sort(keyArray);
StringBuilder sb = new StringBuilder();
for (String k : keyArray) {
if (k.equals(WXPayConstants.FIELD_SIGN)) {
continue;
}
if (StringUtils.isBlank(sb.toString())) {
sb.append(k).append("=").append(param.get(k));
} else {
sb.append("&").append(k).append("=").append(param.get(k));
}
}
return sb.toString();
}
/**
* 生成签名
* @param data
* @return
* @throws Exception
*/
private static String generateSign(final Map<String, Object> data) throws IOException {
String paramSort = paramSort(data);
PrivateKey privateKey = PemUtil.loadPrivateKey(new FileInputStream("/home/project/wx_cert/BZ0001toORG000000000001.key"));
String signStr = null;
try {
Signature sign = Signature.getInstance("SHA256withRSA");
sign.initSign(privateKey);
sign.update(paramSort.getBytes("utf-8"));
signStr = java.util.Base64.getEncoder().encodeToString(sign.sign());
} catch (SignatureException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
}
return signStr;
}
}

@ -0,0 +1,131 @@
package com.hai.dao;
import com.hai.entity.HighDiscountInventoryRecord;
import com.hai.entity.HighDiscountInventoryRecordExample;
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 HighDiscountInventoryRecordMapper extends HighDiscountInventoryRecordMapperExt {
@SelectProvider(type=HighDiscountInventoryRecordSqlProvider.class, method="countByExample")
long countByExample(HighDiscountInventoryRecordExample example);
@DeleteProvider(type=HighDiscountInventoryRecordSqlProvider.class, method="deleteByExample")
int deleteByExample(HighDiscountInventoryRecordExample example);
@Delete({
"delete from high_discount_inventory_record",
"where id = #{id,jdbcType=INTEGER}"
})
int deleteByPrimaryKey(Integer id);
@Insert({
"insert into high_discount_inventory_record (discount_package_title, discount_package_id, ",
"now_stock_num, front_stock_num, ",
"stock_num, company_id, ",
"created_user_id, created_time, ",
"`status`, ext_1, ext_2, ",
"ext_3)",
"values (#{discountPackageTitle,jdbcType=VARCHAR}, #{discountPackageId,jdbcType=INTEGER}, ",
"#{nowStockNum,jdbcType=INTEGER}, #{frontStockNum,jdbcType=INTEGER}, ",
"#{stockNum,jdbcType=INTEGER}, #{companyId,jdbcType=INTEGER}, ",
"#{createdUserId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ",
"#{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighDiscountInventoryRecord record);
@InsertProvider(type=HighDiscountInventoryRecordSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(HighDiscountInventoryRecord record);
@SelectProvider(type=HighDiscountInventoryRecordSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER),
@Result(column="now_stock_num", property="nowStockNum", jdbcType=JdbcType.INTEGER),
@Result(column="front_stock_num", property="frontStockNum", jdbcType=JdbcType.INTEGER),
@Result(column="stock_num", property="stockNum", jdbcType=JdbcType.INTEGER),
@Result(column="company_id", property="companyId", jdbcType=JdbcType.INTEGER),
@Result(column="created_user_id", property="createdUserId", jdbcType=JdbcType.INTEGER),
@Result(column="created_time", property="createdTime", 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<HighDiscountInventoryRecord> selectByExample(HighDiscountInventoryRecordExample example);
@Select({
"select",
"id, discount_package_title, discount_package_id, now_stock_num, front_stock_num, ",
"stock_num, company_id, created_user_id, created_time, `status`, ext_1, ext_2, ",
"ext_3",
"from high_discount_inventory_record",
"where id = #{id,jdbcType=INTEGER}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER),
@Result(column="now_stock_num", property="nowStockNum", jdbcType=JdbcType.INTEGER),
@Result(column="front_stock_num", property="frontStockNum", jdbcType=JdbcType.INTEGER),
@Result(column="stock_num", property="stockNum", jdbcType=JdbcType.INTEGER),
@Result(column="company_id", property="companyId", jdbcType=JdbcType.INTEGER),
@Result(column="created_user_id", property="createdUserId", jdbcType=JdbcType.INTEGER),
@Result(column="created_time", property="createdTime", 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)
})
HighDiscountInventoryRecord selectByPrimaryKey(Integer id);
@UpdateProvider(type=HighDiscountInventoryRecordSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") HighDiscountInventoryRecord record, @Param("example") HighDiscountInventoryRecordExample example);
@UpdateProvider(type=HighDiscountInventoryRecordSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") HighDiscountInventoryRecord record, @Param("example") HighDiscountInventoryRecordExample example);
@UpdateProvider(type=HighDiscountInventoryRecordSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(HighDiscountInventoryRecord record);
@Update({
"update high_discount_inventory_record",
"set discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR},",
"discount_package_id = #{discountPackageId,jdbcType=INTEGER},",
"now_stock_num = #{nowStockNum,jdbcType=INTEGER},",
"front_stock_num = #{frontStockNum,jdbcType=INTEGER},",
"stock_num = #{stockNum,jdbcType=INTEGER},",
"company_id = #{companyId,jdbcType=INTEGER},",
"created_user_id = #{createdUserId,jdbcType=INTEGER},",
"created_time = #{createdTime,jdbcType=TIMESTAMP},",
"`status` = #{status,jdbcType=INTEGER},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=INTEGER}"
})
int updateByPrimaryKey(HighDiscountInventoryRecord record);
}

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

@ -0,0 +1,346 @@
package com.hai.dao;
import com.hai.entity.HighDiscountInventoryRecord;
import com.hai.entity.HighDiscountInventoryRecordExample.Criteria;
import com.hai.entity.HighDiscountInventoryRecordExample.Criterion;
import com.hai.entity.HighDiscountInventoryRecordExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class HighDiscountInventoryRecordSqlProvider {
public String countByExample(HighDiscountInventoryRecordExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("high_discount_inventory_record");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(HighDiscountInventoryRecordExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("high_discount_inventory_record");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(HighDiscountInventoryRecord record) {
SQL sql = new SQL();
sql.INSERT_INTO("high_discount_inventory_record");
if (record.getDiscountPackageTitle() != null) {
sql.VALUES("discount_package_title", "#{discountPackageTitle,jdbcType=VARCHAR}");
}
if (record.getDiscountPackageId() != null) {
sql.VALUES("discount_package_id", "#{discountPackageId,jdbcType=INTEGER}");
}
if (record.getNowStockNum() != null) {
sql.VALUES("now_stock_num", "#{nowStockNum,jdbcType=INTEGER}");
}
if (record.getFrontStockNum() != null) {
sql.VALUES("front_stock_num", "#{frontStockNum,jdbcType=INTEGER}");
}
if (record.getStockNum() != null) {
sql.VALUES("stock_num", "#{stockNum,jdbcType=INTEGER}");
}
if (record.getCompanyId() != null) {
sql.VALUES("company_id", "#{companyId,jdbcType=INTEGER}");
}
if (record.getCreatedUserId() != null) {
sql.VALUES("created_user_id", "#{createdUserId,jdbcType=INTEGER}");
}
if (record.getCreatedTime() != null) {
sql.VALUES("created_time", "#{createdTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
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(HighDiscountInventoryRecordExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("discount_package_title");
sql.SELECT("discount_package_id");
sql.SELECT("now_stock_num");
sql.SELECT("front_stock_num");
sql.SELECT("stock_num");
sql.SELECT("company_id");
sql.SELECT("created_user_id");
sql.SELECT("created_time");
sql.SELECT("`status`");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("high_discount_inventory_record");
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) {
HighDiscountInventoryRecord record = (HighDiscountInventoryRecord) parameter.get("record");
HighDiscountInventoryRecordExample example = (HighDiscountInventoryRecordExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("high_discount_inventory_record");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=INTEGER}");
}
if (record.getDiscountPackageTitle() != null) {
sql.SET("discount_package_title = #{record.discountPackageTitle,jdbcType=VARCHAR}");
}
if (record.getDiscountPackageId() != null) {
sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=INTEGER}");
}
if (record.getNowStockNum() != null) {
sql.SET("now_stock_num = #{record.nowStockNum,jdbcType=INTEGER}");
}
if (record.getFrontStockNum() != null) {
sql.SET("front_stock_num = #{record.frontStockNum,jdbcType=INTEGER}");
}
if (record.getStockNum() != null) {
sql.SET("stock_num = #{record.stockNum,jdbcType=INTEGER}");
}
if (record.getCompanyId() != null) {
sql.SET("company_id = #{record.companyId,jdbcType=INTEGER}");
}
if (record.getCreatedUserId() != null) {
sql.SET("created_user_id = #{record.createdUserId,jdbcType=INTEGER}");
}
if (record.getCreatedTime() != null) {
sql.SET("created_time = #{record.createdTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
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("high_discount_inventory_record");
sql.SET("id = #{record.id,jdbcType=INTEGER}");
sql.SET("discount_package_title = #{record.discountPackageTitle,jdbcType=VARCHAR}");
sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=INTEGER}");
sql.SET("now_stock_num = #{record.nowStockNum,jdbcType=INTEGER}");
sql.SET("front_stock_num = #{record.frontStockNum,jdbcType=INTEGER}");
sql.SET("stock_num = #{record.stockNum,jdbcType=INTEGER}");
sql.SET("company_id = #{record.companyId,jdbcType=INTEGER}");
sql.SET("created_user_id = #{record.createdUserId,jdbcType=INTEGER}");
sql.SET("created_time = #{record.createdTime,jdbcType=TIMESTAMP}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
HighDiscountInventoryRecordExample example = (HighDiscountInventoryRecordExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(HighDiscountInventoryRecord record) {
SQL sql = new SQL();
sql.UPDATE("high_discount_inventory_record");
if (record.getDiscountPackageTitle() != null) {
sql.SET("discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR}");
}
if (record.getDiscountPackageId() != null) {
sql.SET("discount_package_id = #{discountPackageId,jdbcType=INTEGER}");
}
if (record.getNowStockNum() != null) {
sql.SET("now_stock_num = #{nowStockNum,jdbcType=INTEGER}");
}
if (record.getFrontStockNum() != null) {
sql.SET("front_stock_num = #{frontStockNum,jdbcType=INTEGER}");
}
if (record.getStockNum() != null) {
sql.SET("stock_num = #{stockNum,jdbcType=INTEGER}");
}
if (record.getCompanyId() != null) {
sql.SET("company_id = #{companyId,jdbcType=INTEGER}");
}
if (record.getCreatedUserId() != null) {
sql.SET("created_user_id = #{createdUserId,jdbcType=INTEGER}");
}
if (record.getCreatedTime() != null) {
sql.SET("created_time = #{createdTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
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=INTEGER}");
return sql.toString();
}
protected void applyWhere(SQL sql, HighDiscountInventoryRecordExample 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());
}
}
}

@ -0,0 +1,257 @@
package com.hai.entity;
import java.io.Serializable;
import java.util.Date;
/**
* high_discount_inventory_record
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class HighDiscountInventoryRecord implements Serializable {
/**
* 主键
*/
private Integer id;
/**
* 标题
*/
private String discountPackageTitle;
/**
* 优惠券包id
*/
private Integer discountPackageId;
/**
* 当前库存数量
*/
private Integer nowStockNum;
/**
* 原库存数量
*/
private Integer frontStockNum;
/**
* 补库数量
*/
private Integer stockNum;
/**
* 公司id
*/
private Integer companyId;
/**
* 创建人
*/
private Integer createdUserId;
/**
* 创建时间
*/
private Date createdTime;
/**
* 状态
*/
private Integer status;
/**
* 扩展字段
*/
private String ext1;
/**
* 扩展字段
*/
private String ext2;
/**
* 扩展字段
*/
private String ext3;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDiscountPackageTitle() {
return discountPackageTitle;
}
public void setDiscountPackageTitle(String discountPackageTitle) {
this.discountPackageTitle = discountPackageTitle;
}
public Integer getDiscountPackageId() {
return discountPackageId;
}
public void setDiscountPackageId(Integer discountPackageId) {
this.discountPackageId = discountPackageId;
}
public Integer getNowStockNum() {
return nowStockNum;
}
public void setNowStockNum(Integer nowStockNum) {
this.nowStockNum = nowStockNum;
}
public Integer getFrontStockNum() {
return frontStockNum;
}
public void setFrontStockNum(Integer frontStockNum) {
this.frontStockNum = frontStockNum;
}
public Integer getStockNum() {
return stockNum;
}
public void setStockNum(Integer stockNum) {
this.stockNum = stockNum;
}
public Integer getCompanyId() {
return companyId;
}
public void setCompanyId(Integer companyId) {
this.companyId = companyId;
}
public Integer getCreatedUserId() {
return createdUserId;
}
public void setCreatedUserId(Integer createdUserId) {
this.createdUserId = createdUserId;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
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;
}
HighDiscountInventoryRecord other = (HighDiscountInventoryRecord) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getDiscountPackageTitle() == null ? other.getDiscountPackageTitle() == null : this.getDiscountPackageTitle().equals(other.getDiscountPackageTitle()))
&& (this.getDiscountPackageId() == null ? other.getDiscountPackageId() == null : this.getDiscountPackageId().equals(other.getDiscountPackageId()))
&& (this.getNowStockNum() == null ? other.getNowStockNum() == null : this.getNowStockNum().equals(other.getNowStockNum()))
&& (this.getFrontStockNum() == null ? other.getFrontStockNum() == null : this.getFrontStockNum().equals(other.getFrontStockNum()))
&& (this.getStockNum() == null ? other.getStockNum() == null : this.getStockNum().equals(other.getStockNum()))
&& (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId()))
&& (this.getCreatedUserId() == null ? other.getCreatedUserId() == null : this.getCreatedUserId().equals(other.getCreatedUserId()))
&& (this.getCreatedTime() == null ? other.getCreatedTime() == null : this.getCreatedTime().equals(other.getCreatedTime()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (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 + ((getDiscountPackageTitle() == null) ? 0 : getDiscountPackageTitle().hashCode());
result = prime * result + ((getDiscountPackageId() == null) ? 0 : getDiscountPackageId().hashCode());
result = prime * result + ((getNowStockNum() == null) ? 0 : getNowStockNum().hashCode());
result = prime * result + ((getFrontStockNum() == null) ? 0 : getFrontStockNum().hashCode());
result = prime * result + ((getStockNum() == null) ? 0 : getStockNum().hashCode());
result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode());
result = prime * result + ((getCreatedUserId() == null) ? 0 : getCreatedUserId().hashCode());
result = prime * result + ((getCreatedTime() == null) ? 0 : getCreatedTime().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().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(", discountPackageTitle=").append(discountPackageTitle);
sb.append(", discountPackageId=").append(discountPackageId);
sb.append(", nowStockNum=").append(nowStockNum);
sb.append(", frontStockNum=").append(frontStockNum);
sb.append(", stockNum=").append(stockNum);
sb.append(", companyId=").append(companyId);
sb.append(", createdUserId=").append(createdUserId);
sb.append(", createdTime=").append(createdTime);
sb.append(", status=").append(status);
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();
}
}

@ -32,6 +32,13 @@ unionPaySignKey=1dfk0i0fl7ild07l2k5oj8dddikkivd0
unionPayNotifyUrl=https://hsgcs.dctpay.com/crest/unionPay/notify
unionPayTelNotifyUrl=https://hsgcs.dctpay.com/crest/unionPay/notifyTel
unionStagingPayUrl=https://mtest.eycard.cn/
unionStagingPayOrgId=ORG000000000001
unionStagingPayOrgMerCode=890000000123679
unionStagingPayOrgTermNo=W0616228
unionStagingPaySignKey=1dfk0i0fl7ild07l2k5oj8dddikkivd0
unionStagingPayNotifyUrl=https://hsgcs.dctpay.com/crest/unionPay/notify
# ??????
wx_cert=/home/project/wx_cert/

Loading…
Cancel
Save