From 613b7f906a900a2e050b3f9c61192b790a846839 Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Tue, 21 May 2024 15:11:42 +0800 Subject: [PATCH] Changes --- .../order/BsOrderGoodsController.java | 88 ++++++++++++ .../main/java/com/cweb/config/AuthConfig.java | 1 + .../cweb/controller/wx/WxMsgController.java | 127 ++++++++++++++++++ .../java/com/hfkj/common/utils/WxUtils.java | 44 ++++++ .../com/hfkj/config/WeChatQrcodeUtils.java | 90 +++++++++++++ .../java/com/hfkj/dao/BsOrderGoodsMapper.java | 11 +- .../com/hfkj/dao/BsOrderGoodsSqlProvider.java | 16 ++- .../java/com/hfkj/entity/BsOrderGoods.java | 16 +++ .../com/hfkj/entity/BsOrderGoodsExample.java | 72 +++++++++- .../goods/impl/BsOrderGoodsServiceImpl.java | 49 ++++++- .../service/order/OrderCreateService.java | 1 + .../resources/dev/commonConfig.properties | 11 +- .../resources/prod/commonConfig.properties | 10 +- 13 files changed, 520 insertions(+), 16 deletions(-) create mode 100644 bweb/src/main/java/com/bweb/controller/order/BsOrderGoodsController.java create mode 100644 cweb/src/main/java/com/cweb/controller/wx/WxMsgController.java create mode 100644 service/src/main/java/com/hfkj/config/WeChatQrcodeUtils.java diff --git a/bweb/src/main/java/com/bweb/controller/order/BsOrderGoodsController.java b/bweb/src/main/java/com/bweb/controller/order/BsOrderGoodsController.java new file mode 100644 index 0000000..b54f7dd --- /dev/null +++ b/bweb/src/main/java/com/bweb/controller/order/BsOrderGoodsController.java @@ -0,0 +1,88 @@ +package com.bweb.controller.order; + +import com.bweb.controller.goods.GoodsController; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hfkj.common.security.SessionObject; +import com.hfkj.common.security.UserCenter; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.model.ResponseData; +import com.hfkj.model.SecUserSessionObject; +import com.hfkj.service.goods.BsOrderGoodsService; +import com.hfkj.sysenum.SecUserObjectTypeEnum; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; + +@Controller +@RequestMapping(value="/orderGoods") +@Api(value="实物订单管理") +public class BsOrderGoodsController { + + private static final Logger log = LoggerFactory.getLogger(BsOrderGoodsController.class); + + @Resource + private BsOrderGoodsService bsOrderGoodsService; + + @Resource + private UserCenter userCenter; + + + @RequestMapping(value="/getListGoods",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询列表") + public ResponseData getListGoods(@RequestParam(value = "logisticsNo" , required = false) String logisticsNo, + @RequestParam(value = "goodsType" , required = false) Long goodsType, + @RequestParam(value = "goodsBrand" , required = false) Long goodsBrand, + @RequestParam(value = "orderNo" , required = false) String orderNo, + @RequestParam(value = "childOrderNo" , required = false) String childOrderNo, + @RequestParam(value = "userPhone" , required = false) String userPhone, + @RequestParam(value = "goodsSpecsName" , required = false) String goodsSpecsName, + @RequestParam(value = "goodsName" , required = false) String goodsName, + @RequestParam(value = "payType" , required = false) Integer payType, + @RequestParam(value = "status" , required = false) Integer status, + @RequestParam(value = "pageNum" , required = true) Integer pageNum, + @RequestParam(value = "pageSize" , required = true) Integer pageSize, HttpServletRequest request) { + try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); + + Map map = new HashMap<>(); + + if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { + map.put("merId", userModel.getAccount().getId()); + } + + map.put("logisticsNo", logisticsNo); + map.put("goodsType", goodsType); + map.put("goodsBrand", goodsBrand); + map.put("orderNo", orderNo); + map.put("childOrderNo", childOrderNo); + map.put("userPhone", userPhone); + map.put("goodsSpecsName", goodsSpecsName); + map.put("goodsName", goodsName); + map.put("payType", payType); + map.put("status", status); + + PageHelper.startPage(pageNum, pageSize); + return ResponseMsgUtil.success(new PageInfo<>(bsOrderGoodsService.getList(map))); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/cweb/src/main/java/com/cweb/config/AuthConfig.java b/cweb/src/main/java/com/cweb/config/AuthConfig.java index e0c1458..846b070 100644 --- a/cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -90,6 +90,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/cms/*") .excludePathPatterns("/common/*") .excludePathPatterns("/fileUpload/*") + .excludePathPatterns("/wxMsg/*") ; } diff --git a/cweb/src/main/java/com/cweb/controller/wx/WxMsgController.java b/cweb/src/main/java/com/cweb/controller/wx/WxMsgController.java new file mode 100644 index 0000000..f85b68a --- /dev/null +++ b/cweb/src/main/java/com/cweb/controller/wx/WxMsgController.java @@ -0,0 +1,127 @@ +package com.cweb.controller.wx; + +import com.alibaba.fastjson.JSONObject; + +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.utils.HttpsUtils; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.common.utils.WxUtils; +import com.hfkj.config.CommonSysConst; +import com.hfkj.config.WeChatQrcodeUtils; +import com.hfkj.model.ResponseData; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.*; + +/** + * @author sum1dream + */ + +@Controller +@RequestMapping(value = "/wxMsg") +@Api(value = "微信") +public class WxMsgController { + + private static final Logger log = LoggerFactory.getLogger(WxMsgController.class); + + @Autowired + private WeChatQrcodeUtils weChatQrcodeUtils; + + +// @RequestMapping(value = "/verifyWxToken", method = RequestMethod.GET) +// @ResponseBody +// @ApiOperation(value = "验证servlet") +// public String verifyWxToken( +// @RequestParam(name = "signature", required = false) String signature, +// @RequestParam(name = "timestamp", required = false) String timestamp, +// @RequestParam(name = "nonce", required = false) String nonce, +// @RequestParam(name = "echostr", required = false) String echostr +// ) { +// +// try { +// +// String signatureStr = WxUtils.getSHA1("RgAWdnR5oEOLBdyEjfr4" , timestamp , nonce); +// log.info("signatureStr!!!!!" + signatureStr); +// log.info("signature!!!!!" + signature); +// if (signature.equals(signatureStr)) { +// log.info("验证通过!!!!!"); +// return echostr; +// } +// log.info("验证失败!!!!!"); +// return null; +// } catch (Exception e) { +// return null; +// } +// +// } + + + @RequestMapping(value = "/verifyWx", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "微信编译URL") + public ResponseData verifyWx(@RequestParam(value = "url", required = true) String url) { + + try { + + JSONObject jsapiTicket = weChatQrcodeUtils.getTicket(false); + log.info("获取jsapiTicket"+ jsapiTicket); + // 拼接签名 + Map map = new HashMap<>(); + map.put("noncestr", WxUtils.makeNonStr()); + map.put("jsapi_ticket",jsapiTicket.getString("ticket")); + map.put("timestamp", new Date().getTime()); + map.put("url",url); + + log.info("拼接map"+ map); + + Map objectMap = new HashMap<>(); + objectMap.put("appId" , CommonSysConst.getSysConfig().getWechatMpAppid()); + objectMap.put("timestamp" , map.get("timestamp")); + objectMap.put("nonceStr" , map.get("noncestr")); + objectMap.put("signature" , WxUtils.getSHA1(map)); + + log.info("拼接objectMap"+ objectMap); + + return ResponseMsgUtil.success(objectMap); + } catch (Exception e) { + return null; + } + + } + + + @RequestMapping(value = "/createMenu", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "创建菜单") + public ResponseData createMenu(@RequestBody JSONObject object) { + try { + Map params = new HashMap<>(); + params.put("appid", CommonSysConst.getSysConfig().getWechatMpAppid()); + params.put("secret", CommonSysConst.getSysConfig().getWechatMpSecret()); + params.put("grant_type", "client_credential"); + + JSONObject accessTokenObject = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/token", params); + if (accessTokenObject == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取微信access_token失败"); + } + + JSONObject jsonObject = HttpsUtils.doPost("https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + accessTokenObject.getString("access_token"), object); + + return ResponseMsgUtil.success(jsonObject); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + + +} diff --git a/service/src/main/java/com/hfkj/common/utils/WxUtils.java b/service/src/main/java/com/hfkj/common/utils/WxUtils.java index 491c072..7c18dff 100644 --- a/service/src/main/java/com/hfkj/common/utils/WxUtils.java +++ b/service/src/main/java/com/hfkj/common/utils/WxUtils.java @@ -413,5 +413,49 @@ public class WxUtils { } } + /** + * 用SHA1算法生成安全签名 + * @param data 数据 + * @return 安全签名 + * @throws Exception + */ + public static String getSHA1(final Map data) throws Exception + { + try { + Set keySet = data.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) || k.equals("apiKey")) { + continue; + } + if (data.get(k) != null) // 参数值为空,则不参与签名 + { + sb.append(k).append("=").append(data.get(k)).append("&"); + } + } + String str = sb.substring(0 , sb.length()-1); + // SHA1签名生成 + MessageDigest md = MessageDigest.getInstance("SHA-1"); + md.update(str.getBytes()); + byte[] digest = md.digest(); + + StringBuffer hexstr = new StringBuffer(); + String shaHex = ""; + for (int i = 0; i < digest.length; i++) { + shaHex = Integer.toHexString(digest[i] & 0xFF); + if (shaHex.length() < 2) { + hexstr.append(0); + } + hexstr.append(shaHex); + } + return hexstr.toString(); + } catch (Exception e) { + e.printStackTrace(); + throw new Exception(String.format("Invalid sign_type: %s")); + } + } + } diff --git a/service/src/main/java/com/hfkj/config/WeChatQrcodeUtils.java b/service/src/main/java/com/hfkj/config/WeChatQrcodeUtils.java new file mode 100644 index 0000000..6e97a48 --- /dev/null +++ b/service/src/main/java/com/hfkj/config/WeChatQrcodeUtils.java @@ -0,0 +1,90 @@ +package com.hfkj.config; + + +import com.alibaba.fastjson.JSONObject; + +import com.hfkj.common.utils.HttpsUtils; +import com.hfkj.common.utils.RedisUtil; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +import java.util.HashMap; +import java.util.Map; + + +/** + * @serviceName WeChatQrcodeUtils.java + * @author Sum1Dream + * @version 1.0.0 + * @Description // 生成带参数的二维码 + * @createTime 16:11 2022/9/2 + **/ +@Component +public class WeChatQrcodeUtils { + + private static final Logger log = LoggerFactory.getLogger(WeChatQrcodeUtils.class); + + + @Resource + private RedisUtil redisUtil; + + + // 获取微信Token存入redis + public String getWxToken(Boolean whetherRedis) { + + if (!whetherRedis) { + Object token = redisUtil.get("WxToken"); + if (null != token) { + return token.toString(); + } + } + + log.info("获取最新微信token"); + + // 获取access_token + JSONObject params = new JSONObject(); + params.put("appid", CommonSysConst.getSysConfig().getWechatMpAppid()); + params.put("secret", CommonSysConst.getSysConfig().getWechatMpSecret()); + params.put("grant_type", "client_credential"); + JSONObject accessTokenObject = HttpsUtils.doPost("https://api.weixin.qq.com/cgi-bin/stable_token", params); + redisUtil.set("WxToken", accessTokenObject.getString("access_token"), 7000); + return accessTokenObject.getString("access_token"); + } + + + // 获取签名 + public JSONObject getTicket(Boolean whetherRedis) { + + int WxTokenRequestNum = Integer.parseInt(redisUtil.get("WxTokenRequestNum") == null ? "1" : redisUtil.get("WxTokenRequestNum").toString()); + + redisUtil.set("WxTokenRequestNum", WxTokenRequestNum + 1, 1000); + + String token = getWxToken(whetherRedis); + ; + + log.info("获取微信token次数: " + WxTokenRequestNum); + log.info("获取微信token-回调参数: " + token); + + JSONObject jsapiTicket; + + // 获取ticket + Map ticketParams = new HashMap<>(); + ticketParams.put("access_token", token); + ticketParams.put("type", "jsapi"); + jsapiTicket = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/ticket/getticket", ticketParams); + + log.info("获取ticket-回调参数: " + jsapiTicket); + + if (jsapiTicket != null && jsapiTicket.getInteger("errcode") != 0 && WxTokenRequestNum < 6) { + jsapiTicket = getTicket(true); + } + + redisUtil.del("WxTokenRequestNum"); + return jsapiTicket; + + } +} diff --git a/service/src/main/java/com/hfkj/dao/BsOrderGoodsMapper.java b/service/src/main/java/com/hfkj/dao/BsOrderGoodsMapper.java index 7e64287..a25a22e 100644 --- a/service/src/main/java/com/hfkj/dao/BsOrderGoodsMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsOrderGoodsMapper.java @@ -43,7 +43,7 @@ public interface BsOrderGoodsMapper extends BsOrderGoodsMapperExt { "delivery_address_id, delivery_address, ", "order_no, child_order_no, ", "mer_id, user_id, user_phone, ", - "goods_id, goods_name, ", + "goods_id, img, goods_name, ", "goods_type_id, goods_type_name, ", "goods_brand_id, goods_brand_name, ", "goods_specs_id, goods_specs_name, ", @@ -61,7 +61,7 @@ public interface BsOrderGoodsMapper extends BsOrderGoodsMapperExt { "#{deliveryAddressId,jdbcType=BIGINT}, #{deliveryAddress,jdbcType=VARCHAR}, ", "#{orderNo,jdbcType=VARCHAR}, #{childOrderNo,jdbcType=VARCHAR}, ", "#{merId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{userPhone,jdbcType=VARCHAR}, ", - "#{goodsId,jdbcType=BIGINT}, #{goodsName,jdbcType=VARCHAR}, ", + "#{goodsId,jdbcType=BIGINT}, #{img,jdbcType=VARCHAR}, #{goodsName,jdbcType=VARCHAR}, ", "#{goodsTypeId,jdbcType=BIGINT}, #{goodsTypeName,jdbcType=VARCHAR}, ", "#{goodsBrandId,jdbcType=BIGINT}, #{goodsBrandName,jdbcType=VARCHAR}, ", "#{goodsSpecsId,jdbcType=BIGINT}, #{goodsSpecsName,jdbcType=VARCHAR}, ", @@ -96,6 +96,7 @@ public interface BsOrderGoodsMapper extends BsOrderGoodsMapperExt { @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR), @Result(column="goods_id", property="goodsId", jdbcType=JdbcType.BIGINT), + @Result(column="img", property="img", jdbcType=JdbcType.VARCHAR), @Result(column="goods_name", property="goodsName", jdbcType=JdbcType.VARCHAR), @Result(column="goods_type_id", property="goodsTypeId", jdbcType=JdbcType.BIGINT), @Result(column="goods_type_name", property="goodsTypeName", jdbcType=JdbcType.VARCHAR), @@ -129,7 +130,7 @@ public interface BsOrderGoodsMapper extends BsOrderGoodsMapperExt { @Select({ "select", "id, logistics_no, freight_price, delivery_address_id, delivery_address, order_no, ", - "child_order_no, mer_id, user_id, user_phone, goods_id, goods_name, goods_type_id, ", + "child_order_no, mer_id, user_id, user_phone, goods_id, img, goods_name, goods_type_id, ", "goods_type_name, goods_brand_id, goods_brand_name, goods_specs_id, goods_specs_name, ", "goods_spesc_original_price, goods_count, total_price, total_deduction_price, ", "coupon_discount_price, integral_discount_price, pay_real_price, pay_channel, ", @@ -150,6 +151,7 @@ public interface BsOrderGoodsMapper extends BsOrderGoodsMapperExt { @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR), @Result(column="goods_id", property="goodsId", jdbcType=JdbcType.BIGINT), + @Result(column="img", property="img", jdbcType=JdbcType.VARCHAR), @Result(column="goods_name", property="goodsName", jdbcType=JdbcType.VARCHAR), @Result(column="goods_type_id", property="goodsTypeId", jdbcType=JdbcType.BIGINT), @Result(column="goods_type_name", property="goodsTypeName", jdbcType=JdbcType.VARCHAR), @@ -201,6 +203,7 @@ public interface BsOrderGoodsMapper extends BsOrderGoodsMapperExt { "user_id = #{userId,jdbcType=BIGINT},", "user_phone = #{userPhone,jdbcType=VARCHAR},", "goods_id = #{goodsId,jdbcType=BIGINT},", + "img = #{img,jdbcType=VARCHAR},", "goods_name = #{goodsName,jdbcType=VARCHAR},", "goods_type_id = #{goodsTypeId,jdbcType=BIGINT},", "goods_type_name = #{goodsTypeName,jdbcType=VARCHAR},", @@ -231,4 +234,4 @@ public interface BsOrderGoodsMapper extends BsOrderGoodsMapperExt { "where id = #{id,jdbcType=BIGINT}" }) int updateByPrimaryKey(BsOrderGoods record); -} \ No newline at end of file +} diff --git a/service/src/main/java/com/hfkj/dao/BsOrderGoodsSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsOrderGoodsSqlProvider.java index 5e19030..0c9331b 100644 --- a/service/src/main/java/com/hfkj/dao/BsOrderGoodsSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsOrderGoodsSqlProvider.java @@ -68,6 +68,10 @@ public class BsOrderGoodsSqlProvider { sql.VALUES("goods_id", "#{goodsId,jdbcType=BIGINT}"); } + if (record.getImg() != null) { + sql.VALUES("img", "#{img,jdbcType=VARCHAR}"); + } + if (record.getGoodsName() != null) { sql.VALUES("goods_name", "#{goodsName,jdbcType=VARCHAR}"); } @@ -196,6 +200,7 @@ public class BsOrderGoodsSqlProvider { sql.SELECT("user_id"); sql.SELECT("user_phone"); sql.SELECT("goods_id"); + sql.SELECT("img"); sql.SELECT("goods_name"); sql.SELECT("goods_type_id"); sql.SELECT("goods_type_name"); @@ -284,6 +289,10 @@ public class BsOrderGoodsSqlProvider { sql.SET("goods_id = #{record.goodsId,jdbcType=BIGINT}"); } + if (record.getImg() != null) { + sql.SET("img = #{record.img,jdbcType=VARCHAR}"); + } + if (record.getGoodsName() != null) { sql.SET("goods_name = #{record.goodsName,jdbcType=VARCHAR}"); } @@ -411,6 +420,7 @@ public class BsOrderGoodsSqlProvider { sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}"); sql.SET("goods_id = #{record.goodsId,jdbcType=BIGINT}"); + sql.SET("img = #{record.img,jdbcType=VARCHAR}"); sql.SET("goods_name = #{record.goodsName,jdbcType=VARCHAR}"); sql.SET("goods_type_id = #{record.goodsTypeId,jdbcType=BIGINT}"); sql.SET("goods_type_name = #{record.goodsTypeName,jdbcType=VARCHAR}"); @@ -488,6 +498,10 @@ public class BsOrderGoodsSqlProvider { sql.SET("goods_id = #{goodsId,jdbcType=BIGINT}"); } + if (record.getImg() != null) { + sql.SET("img = #{img,jdbcType=VARCHAR}"); + } + if (record.getGoodsName() != null) { sql.SET("goods_name = #{goodsName,jdbcType=VARCHAR}"); } @@ -693,4 +707,4 @@ public class BsOrderGoodsSqlProvider { sql.WHERE(sb.toString()); } } -} \ No newline at end of file +} diff --git a/service/src/main/java/com/hfkj/entity/BsOrderGoods.java b/service/src/main/java/com/hfkj/entity/BsOrderGoods.java index 55b22a8..5945b92 100644 --- a/service/src/main/java/com/hfkj/entity/BsOrderGoods.java +++ b/service/src/main/java/com/hfkj/entity/BsOrderGoods.java @@ -69,6 +69,11 @@ public class BsOrderGoods implements Serializable { */ private Long goodsId; + /** + * 图片 + */ + private String img; + /** * 商品名称 */ @@ -285,6 +290,14 @@ public class BsOrderGoods implements Serializable { this.goodsId = goodsId; } + public String getImg() { + return img; + } + + public void setImg(String img) { + this.img = img; + } + public String getGoodsName() { return goodsName; } @@ -524,6 +537,7 @@ public class BsOrderGoods implements Serializable { && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) && (this.getUserPhone() == null ? other.getUserPhone() == null : this.getUserPhone().equals(other.getUserPhone())) && (this.getGoodsId() == null ? other.getGoodsId() == null : this.getGoodsId().equals(other.getGoodsId())) + && (this.getImg() == null ? other.getImg() == null : this.getImg().equals(other.getImg())) && (this.getGoodsName() == null ? other.getGoodsName() == null : this.getGoodsName().equals(other.getGoodsName())) && (this.getGoodsTypeId() == null ? other.getGoodsTypeId() == null : this.getGoodsTypeId().equals(other.getGoodsTypeId())) && (this.getGoodsTypeName() == null ? other.getGoodsTypeName() == null : this.getGoodsTypeName().equals(other.getGoodsTypeName())) @@ -568,6 +582,7 @@ public class BsOrderGoods implements Serializable { result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); result = prime * result + ((getUserPhone() == null) ? 0 : getUserPhone().hashCode()); result = prime * result + ((getGoodsId() == null) ? 0 : getGoodsId().hashCode()); + result = prime * result + ((getImg() == null) ? 0 : getImg().hashCode()); result = prime * result + ((getGoodsName() == null) ? 0 : getGoodsName().hashCode()); result = prime * result + ((getGoodsTypeId() == null) ? 0 : getGoodsTypeId().hashCode()); result = prime * result + ((getGoodsTypeName() == null) ? 0 : getGoodsTypeName().hashCode()); @@ -615,6 +630,7 @@ public class BsOrderGoods implements Serializable { sb.append(", userId=").append(userId); sb.append(", userPhone=").append(userPhone); sb.append(", goodsId=").append(goodsId); + sb.append(", img=").append(img); sb.append(", goodsName=").append(goodsName); sb.append(", goodsTypeId=").append(goodsTypeId); sb.append(", goodsTypeName=").append(goodsTypeName); diff --git a/service/src/main/java/com/hfkj/entity/BsOrderGoodsExample.java b/service/src/main/java/com/hfkj/entity/BsOrderGoodsExample.java index eb8d7c8..725a8e6 100644 --- a/service/src/main/java/com/hfkj/entity/BsOrderGoodsExample.java +++ b/service/src/main/java/com/hfkj/entity/BsOrderGoodsExample.java @@ -836,6 +836,76 @@ public class BsOrderGoodsExample { return (Criteria) this; } + public Criteria andImgIsNull() { + addCriterion("img is null"); + return (Criteria) this; + } + + public Criteria andImgIsNotNull() { + addCriterion("img is not null"); + return (Criteria) this; + } + + public Criteria andImgEqualTo(String value) { + addCriterion("img =", value, "img"); + return (Criteria) this; + } + + public Criteria andImgNotEqualTo(String value) { + addCriterion("img <>", value, "img"); + return (Criteria) this; + } + + public Criteria andImgGreaterThan(String value) { + addCriterion("img >", value, "img"); + return (Criteria) this; + } + + public Criteria andImgGreaterThanOrEqualTo(String value) { + addCriterion("img >=", value, "img"); + return (Criteria) this; + } + + public Criteria andImgLessThan(String value) { + addCriterion("img <", value, "img"); + return (Criteria) this; + } + + public Criteria andImgLessThanOrEqualTo(String value) { + addCriterion("img <=", value, "img"); + return (Criteria) this; + } + + public Criteria andImgLike(String value) { + addCriterion("img like", value, "img"); + return (Criteria) this; + } + + public Criteria andImgNotLike(String value) { + addCriterion("img not like", value, "img"); + return (Criteria) this; + } + + public Criteria andImgIn(List values) { + addCriterion("img in", values, "img"); + return (Criteria) this; + } + + public Criteria andImgNotIn(List values) { + addCriterion("img not in", values, "img"); + return (Criteria) this; + } + + public Criteria andImgBetween(String value1, String value2) { + addCriterion("img between", value1, value2, "img"); + return (Criteria) this; + } + + public Criteria andImgNotBetween(String value1, String value2) { + addCriterion("img not between", value1, value2, "img"); + return (Criteria) this; + } + public Criteria andGoodsNameIsNull() { addCriterion("goods_name is null"); return (Criteria) this; @@ -2631,4 +2701,4 @@ public class BsOrderGoodsExample { this(condition, value, secondValue, null); } } -} \ No newline at end of file +} diff --git a/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java b/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java index f5d8264..62cbb4b 100644 --- a/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java @@ -4,10 +4,11 @@ import com.hfkj.dao.BsOrderGoodsMapper; import com.hfkj.entity.BsOrderGoods; import com.hfkj.entity.BsOrderGoodsExample; import com.hfkj.service.goods.BsOrderGoodsService; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; @@ -66,6 +67,50 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService { @Override public List getList(Map map) { - return Collections.emptyList(); + BsOrderGoodsExample example = new BsOrderGoodsExample(); + BsOrderGoodsExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getLong(map, "merId") != null) { + criteria.andMerIdEqualTo(MapUtils.getLong(map, "merId")); + } + if (StringUtils.isNotBlank(MapUtils.getString(map, "logisticsNo"))) { + criteria.andLogisticsNoEqualTo(MapUtils.getString(map, "logisticsNo")); + } + if (StringUtils.isNotBlank(MapUtils.getString(map, "orderNo"))) { + criteria.andOrderNoEqualTo(MapUtils.getString(map, "orderNo")); + } + if (StringUtils.isNotBlank(MapUtils.getString(map, "childOrderNo"))) { + criteria.andChildOrderNoEqualTo(MapUtils.getString(map, "childOrderNo")); + } + if (StringUtils.isNotBlank(MapUtils.getString(map, "userPhone"))) { + criteria.andUserPhoneEqualTo(MapUtils.getString(map, "userPhone")); + } + if (MapUtils.getLong(map, "goodsType") != null) { + criteria.andGoodsTypeIdEqualTo(MapUtils.getLong(map, "goodsType")); + } + if (MapUtils.getLong(map, "goodsBrand") != null) { + criteria.andGoodsBrandIdEqualTo(MapUtils.getLong(map, "goodsBrand")); + } + if (StringUtils.isNotBlank(MapUtils.getString(map, "goodsSpecsName"))) { + criteria.andGoodsSpecsNameEqualTo(MapUtils.getString(map, "goodsSpecsName")); + } + + if (StringUtils.isNotBlank(MapUtils.getString(map, "goodsName"))) { + criteria.andGoodsNameLike("%"+MapUtils.getString(map, "goodsName")+"%"); + } + + if (StringUtils.isNotBlank(MapUtils.getString(map, "deliveryAddress"))) { + criteria.andDeliveryAddressLike("%"+MapUtils.getString(map, "deliveryAddress")+"%"); + } + if (MapUtils.getInteger(map, "payType") != null) { + criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType")); + } + if (MapUtils.getInteger(map, "status") != null) { + criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); + } else { + criteria.andStatusNotEqualTo(0); + } + + return bsOrderGoodsMapper.selectByExample(example); } } diff --git a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java index 2d14c3b..de43249 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java @@ -184,6 +184,7 @@ public class OrderCreateService { orderGoods.setUserId(order.getUserId()); orderGoods.setUserPhone(order.getUserPhone()); orderGoods.setGoodsId(goodsMsg.getId()); + orderGoods.setImg(goodsSpecs.getShowImg()); orderGoods.setGoodsName(goodsMsg.getTitle()); orderGoods.setGoodsTypeId(goodsMsg.getGoodsType()); orderGoods.setGoodsTypeName(goodsMsg.getGoodsTypeName()); diff --git a/service/src/main/resources/dev/commonConfig.properties b/service/src/main/resources/dev/commonConfig.properties index a2c58d9..7857f1b 100644 --- a/service/src/main/resources/dev/commonConfig.properties +++ b/service/src/main/resources/dev/commonConfig.properties @@ -1,7 +1,10 @@ -wechatMaAppid= -wechatMaSecret= -wechatMpAppid= -wechatMpSecret= + + +wechatMpAppid=wxa075e8509802f826 +wechatMpSecret=0e606fc1378d35e359fcf3f15570b2c5 + +wechatMaAppid=wx8d49e2f83025229d +wechatMaSecret=d8d6dcaef77d3b659258a01b5ddba5df obsBucketName=phg-test obsEndPoint=https://obs.cn-southwest-2.myhuaweicloud.com diff --git a/service/src/main/resources/prod/commonConfig.properties b/service/src/main/resources/prod/commonConfig.properties index 0720d23..63f050b 100644 --- a/service/src/main/resources/prod/commonConfig.properties +++ b/service/src/main/resources/prod/commonConfig.properties @@ -1,7 +1,9 @@ -wechatMaAppid= -wechatMaSecret= -wechatMpAppid= -wechatMpSecret= + +wechatMpAppid=wxa075e8509802f826 +wechatMpSecret=0e606fc1378d35e359fcf3f15570b2c5 + +wechatMaAppid=wx8d49e2f83025229d +wechatMaSecret=d8d6dcaef77d3b659258a01b5ddba5df huiPayPreorderNotifyUrl=https://phgcs.dctpay.com/order/notify/huipay