diff --git a/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java b/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java index 958937b..c7a1d42 100644 --- a/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java +++ b/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java @@ -128,6 +128,8 @@ public class BsOrderGoodsController { } // 删除缓存 orderService.cacheDelete(goodsOrder.getOrderNo()); + bsOrderGoodsService.cacheDelete(goodsOrder.getId()); + bsOrderGoodsService.update(goodsOrder); return ResponseMsgUtil.success("更新成功!"); diff --git a/service/src/main/java/com/hfkj/dao/BsOrderGoodsMapper.java b/service/src/main/java/com/hfkj/dao/BsOrderGoodsMapper.java index 658287c..ed2b500 100644 --- a/service/src/main/java/com/hfkj/dao/BsOrderGoodsMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsOrderGoodsMapper.java @@ -52,7 +52,8 @@ public interface BsOrderGoodsMapper extends BsOrderGoodsMapperExt { "coupon_discount_price, integral_discount_price, ", "pay_real_price, pay_channel, ", "pay_serial_no, pay_type, ", - "`status`, create_time, ", + "`status`, logistics_status_desc, ", + "logistics_status, create_time, ", "pay_time, cancel_time, ", "refund_time, finish_time, ", "update_time, ext_1, ", @@ -70,7 +71,8 @@ public interface BsOrderGoodsMapper extends BsOrderGoodsMapperExt { "#{couponDiscountPrice,jdbcType=DECIMAL}, #{integralDiscountPrice,jdbcType=DECIMAL}, ", "#{payRealPrice,jdbcType=DECIMAL}, #{payChannel,jdbcType=INTEGER}, ", "#{paySerialNo,jdbcType=VARCHAR}, #{payType,jdbcType=INTEGER}, ", - "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{status,jdbcType=INTEGER}, #{logisticsStatusDesc,jdbcType=VARCHAR}, ", + "#{logisticsStatus,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", "#{payTime,jdbcType=TIMESTAMP}, #{cancelTime,jdbcType=TIMESTAMP}, ", "#{refundTime,jdbcType=TIMESTAMP}, #{finishTime,jdbcType=TIMESTAMP}, ", "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", @@ -115,6 +117,8 @@ public interface BsOrderGoodsMapper extends BsOrderGoodsMapperExt { @Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR), @Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="logistics_status_desc", property="logisticsStatusDesc", jdbcType=JdbcType.VARCHAR), + @Result(column="logistics_status", property="logisticsStatus", jdbcType=JdbcType.VARCHAR), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP), @@ -134,8 +138,9 @@ public interface BsOrderGoodsMapper extends BsOrderGoodsMapperExt { "goods_type_name, goods_brand_id, goods_brand_name, goods_specs_id, goods_specs_name, ", "goods_specs_original_price, goods_count, total_price, total_deduction_price, ", "coupon_discount_price, integral_discount_price, pay_real_price, pay_channel, ", - "pay_serial_no, pay_type, `status`, create_time, pay_time, cancel_time, refund_time, ", - "finish_time, update_time, ext_1, ext_2, ext_3", + "pay_serial_no, pay_type, `status`, logistics_status_desc, logistics_status, ", + "create_time, pay_time, cancel_time, refund_time, finish_time, update_time, ext_1, ", + "ext_2, ext_3", "from bs_order_goods", "where id = #{id,jdbcType=BIGINT}" }) @@ -170,6 +175,8 @@ public interface BsOrderGoodsMapper extends BsOrderGoodsMapperExt { @Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR), @Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="logistics_status_desc", property="logisticsStatusDesc", jdbcType=JdbcType.VARCHAR), + @Result(column="logistics_status", property="logisticsStatus", jdbcType=JdbcType.VARCHAR), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP), @@ -222,6 +229,8 @@ public interface BsOrderGoodsMapper extends BsOrderGoodsMapperExt { "pay_serial_no = #{paySerialNo,jdbcType=VARCHAR},", "pay_type = #{payType,jdbcType=INTEGER},", "`status` = #{status,jdbcType=INTEGER},", + "logistics_status_desc = #{logisticsStatusDesc,jdbcType=VARCHAR},", + "logistics_status = #{logisticsStatus,jdbcType=VARCHAR},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "pay_time = #{payTime,jdbcType=TIMESTAMP},", "cancel_time = #{cancelTime,jdbcType=TIMESTAMP},", diff --git a/service/src/main/java/com/hfkj/dao/BsOrderGoodsSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsOrderGoodsSqlProvider.java index 4f91406..6b2f795 100644 --- a/service/src/main/java/com/hfkj/dao/BsOrderGoodsSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsOrderGoodsSqlProvider.java @@ -144,6 +144,14 @@ public class BsOrderGoodsSqlProvider { sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); } + if (record.getLogisticsStatusDesc() != null) { + sql.VALUES("logistics_status_desc", "#{logisticsStatusDesc,jdbcType=VARCHAR}"); + } + + if (record.getLogisticsStatus() != null) { + sql.VALUES("logistics_status", "#{logisticsStatus,jdbcType=VARCHAR}"); + } + if (record.getCreateTime() != null) { sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); } @@ -219,6 +227,8 @@ public class BsOrderGoodsSqlProvider { sql.SELECT("pay_serial_no"); sql.SELECT("pay_type"); sql.SELECT("`status`"); + sql.SELECT("logistics_status_desc"); + sql.SELECT("logistics_status"); sql.SELECT("create_time"); sql.SELECT("pay_time"); sql.SELECT("cancel_time"); @@ -365,6 +375,14 @@ public class BsOrderGoodsSqlProvider { sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); } + if (record.getLogisticsStatusDesc() != null) { + sql.SET("logistics_status_desc = #{record.logisticsStatusDesc,jdbcType=VARCHAR}"); + } + + if (record.getLogisticsStatus() != null) { + sql.SET("logistics_status = #{record.logisticsStatus,jdbcType=VARCHAR}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); } @@ -439,6 +457,8 @@ public class BsOrderGoodsSqlProvider { sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}"); sql.SET("pay_type = #{record.payType,jdbcType=INTEGER}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + sql.SET("logistics_status_desc = #{record.logisticsStatusDesc,jdbcType=VARCHAR}"); + sql.SET("logistics_status = #{record.logisticsStatus,jdbcType=VARCHAR}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}"); sql.SET("cancel_time = #{record.cancelTime,jdbcType=TIMESTAMP}"); @@ -574,6 +594,14 @@ public class BsOrderGoodsSqlProvider { sql.SET("`status` = #{status,jdbcType=INTEGER}"); } + if (record.getLogisticsStatusDesc() != null) { + sql.SET("logistics_status_desc = #{logisticsStatusDesc,jdbcType=VARCHAR}"); + } + + if (record.getLogisticsStatus() != null) { + sql.SET("logistics_status = #{logisticsStatus,jdbcType=VARCHAR}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsOrderGoods.java b/service/src/main/java/com/hfkj/entity/BsOrderGoods.java index ed3b314..74e159e 100644 --- a/service/src/main/java/com/hfkj/entity/BsOrderGoods.java +++ b/service/src/main/java/com/hfkj/entity/BsOrderGoods.java @@ -160,10 +160,20 @@ public class BsOrderGoods implements Serializable { private Integer payType; /** - * 1:待发货 2:已发货 3:配送中 4:已送达 5:已取消 6:退货中 7:已退货 8:待支付 9:已收货 0:删除 + * 1:待发货 2:已发货 3:配送中 4:已送达 5:已取消 6:退货中 7:已退货 8:待支付 0:删除 */ private Integer status; + /** + * 物流状态描述 + */ + private String logisticsStatusDesc; + + /** + * 物流状态描述 + */ + private String logisticsStatus; + /** * 创建时间 */ @@ -442,6 +452,22 @@ public class BsOrderGoods implements Serializable { this.status = status; } + public String getLogisticsStatusDesc() { + return logisticsStatusDesc; + } + + public void setLogisticsStatusDesc(String logisticsStatusDesc) { + this.logisticsStatusDesc = logisticsStatusDesc; + } + + public String getLogisticsStatus() { + return logisticsStatus; + } + + public void setLogisticsStatus(String logisticsStatus) { + this.logisticsStatus = logisticsStatus; + } + public Date getCreateTime() { return createTime; } @@ -556,6 +582,8 @@ public class BsOrderGoods implements Serializable { && (this.getPaySerialNo() == null ? other.getPaySerialNo() == null : this.getPaySerialNo().equals(other.getPaySerialNo())) && (this.getPayType() == null ? other.getPayType() == null : this.getPayType().equals(other.getPayType())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) + && (this.getLogisticsStatusDesc() == null ? other.getLogisticsStatusDesc() == null : this.getLogisticsStatusDesc().equals(other.getLogisticsStatusDesc())) + && (this.getLogisticsStatus() == null ? other.getLogisticsStatus() == null : this.getLogisticsStatus().equals(other.getLogisticsStatus())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getPayTime() == null ? other.getPayTime() == null : this.getPayTime().equals(other.getPayTime())) && (this.getCancelTime() == null ? other.getCancelTime() == null : this.getCancelTime().equals(other.getCancelTime())) @@ -601,6 +629,8 @@ public class BsOrderGoods implements Serializable { result = prime * result + ((getPaySerialNo() == null) ? 0 : getPaySerialNo().hashCode()); result = prime * result + ((getPayType() == null) ? 0 : getPayType().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); + result = prime * result + ((getLogisticsStatusDesc() == null) ? 0 : getLogisticsStatusDesc().hashCode()); + result = prime * result + ((getLogisticsStatus() == null) ? 0 : getLogisticsStatus().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getPayTime() == null) ? 0 : getPayTime().hashCode()); result = prime * result + ((getCancelTime() == null) ? 0 : getCancelTime().hashCode()); @@ -649,6 +679,8 @@ public class BsOrderGoods implements Serializable { sb.append(", paySerialNo=").append(paySerialNo); sb.append(", payType=").append(payType); sb.append(", status=").append(status); + sb.append(", logisticsStatusDesc=").append(logisticsStatusDesc); + sb.append(", logisticsStatus=").append(logisticsStatus); sb.append(", createTime=").append(createTime); sb.append(", payTime=").append(payTime); sb.append(", cancelTime=").append(cancelTime); @@ -662,4 +694,4 @@ public class BsOrderGoods implements Serializable { sb.append("]"); return sb.toString(); } -} +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsOrderGoodsExample.java b/service/src/main/java/com/hfkj/entity/BsOrderGoodsExample.java index 3187257..2f42d35 100644 --- a/service/src/main/java/com/hfkj/entity/BsOrderGoodsExample.java +++ b/service/src/main/java/com/hfkj/entity/BsOrderGoodsExample.java @@ -2036,6 +2036,146 @@ public class BsOrderGoodsExample { return (Criteria) this; } + public Criteria andLogisticsStatusDescIsNull() { + addCriterion("logistics_status_desc is null"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusDescIsNotNull() { + addCriterion("logistics_status_desc is not null"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusDescEqualTo(String value) { + addCriterion("logistics_status_desc =", value, "logisticsStatusDesc"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusDescNotEqualTo(String value) { + addCriterion("logistics_status_desc <>", value, "logisticsStatusDesc"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusDescGreaterThan(String value) { + addCriterion("logistics_status_desc >", value, "logisticsStatusDesc"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusDescGreaterThanOrEqualTo(String value) { + addCriterion("logistics_status_desc >=", value, "logisticsStatusDesc"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusDescLessThan(String value) { + addCriterion("logistics_status_desc <", value, "logisticsStatusDesc"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusDescLessThanOrEqualTo(String value) { + addCriterion("logistics_status_desc <=", value, "logisticsStatusDesc"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusDescLike(String value) { + addCriterion("logistics_status_desc like", value, "logisticsStatusDesc"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusDescNotLike(String value) { + addCriterion("logistics_status_desc not like", value, "logisticsStatusDesc"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusDescIn(List values) { + addCriterion("logistics_status_desc in", values, "logisticsStatusDesc"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusDescNotIn(List values) { + addCriterion("logistics_status_desc not in", values, "logisticsStatusDesc"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusDescBetween(String value1, String value2) { + addCriterion("logistics_status_desc between", value1, value2, "logisticsStatusDesc"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusDescNotBetween(String value1, String value2) { + addCriterion("logistics_status_desc not between", value1, value2, "logisticsStatusDesc"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusIsNull() { + addCriterion("logistics_status is null"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusIsNotNull() { + addCriterion("logistics_status is not null"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusEqualTo(String value) { + addCriterion("logistics_status =", value, "logisticsStatus"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusNotEqualTo(String value) { + addCriterion("logistics_status <>", value, "logisticsStatus"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusGreaterThan(String value) { + addCriterion("logistics_status >", value, "logisticsStatus"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusGreaterThanOrEqualTo(String value) { + addCriterion("logistics_status >=", value, "logisticsStatus"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusLessThan(String value) { + addCriterion("logistics_status <", value, "logisticsStatus"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusLessThanOrEqualTo(String value) { + addCriterion("logistics_status <=", value, "logisticsStatus"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusLike(String value) { + addCriterion("logistics_status like", value, "logisticsStatus"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusNotLike(String value) { + addCriterion("logistics_status not like", value, "logisticsStatus"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusIn(List values) { + addCriterion("logistics_status in", values, "logisticsStatus"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusNotIn(List values) { + addCriterion("logistics_status not in", values, "logisticsStatus"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusBetween(String value1, String value2) { + addCriterion("logistics_status between", value1, value2, "logisticsStatus"); + return (Criteria) this; + } + + public Criteria andLogisticsStatusNotBetween(String value1, String value2) { + addCriterion("logistics_status not between", value1, value2, "logisticsStatus"); + return (Criteria) this; + } + public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java b/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java index c598e37..9c36f58 100644 --- a/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java +++ b/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.hfkj.entity.BsOrderGoods; import com.hfkj.entity.GoodsBrand; import com.hfkj.entity.GoodsLogistics; +import com.hfkj.model.order.OrderModel; import java.util.List; import java.util.Map; @@ -119,6 +120,21 @@ public interface BsOrderGoodsService { */ Object getLogisticsMsg(Long orderGoodsId); + /** + * 更新缓存 + * @param orderGoodsId + * @param logistics + * @return + */ + GoodsLogistics cache(Long orderGoodsId , GoodsLogistics logistics); + + /** + * 删除缓存 + * @param orderGoodsId + * @return + */ + void cacheDelete(Long orderGoodsId); + /** * @Author Sum1Dream * @Name getLogisticsMsg 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 19951d8..c1af2e4 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 @@ -12,6 +12,7 @@ import com.hfkj.entity.BsOrderGoods; import com.hfkj.entity.BsOrderGoodsExample; import com.hfkj.entity.GoodsLogistics; import com.hfkj.entity.GoodsLogisticsExample; +import com.hfkj.model.order.OrderModel; import com.hfkj.service.goods.BsOrderGoodsService; import com.hfkj.service.order.BsOrderService; import org.apache.commons.collections4.MapUtils; @@ -225,13 +226,14 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService { if (jsonObjects == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未发货!"); } - redisUtil.set(CACHE_KEY + orderGoods.getLogisticsNo(), jsonObjects, CACHE_TIME); if (jsonObjects.getInteger("code") == 200 && jsonObjects.getBoolean("success")) { jsonObjects.getJSONObject("data").put("orderId" , orderGoodsId); GoodsLogistics logistics = editLogistics((JSONObject) jsonObjects.get("data")); - redisUtil.set(CACHE_KEY + orderGoodsId, logistics, CACHE_TIME); - return logistics; + orderGoods.setLogisticsStatus(logistics.getLogisticsStatus()); + orderGoods.setLogisticsStatusDesc(logistics.getLogisticsStatusDesc()); + update(orderGoods); + return cache(orderGoodsId , logistics); } return jsonObjects; } else { @@ -239,6 +241,19 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService { } } + @Override + public GoodsLogistics cache(Long orderGoodsId , GoodsLogistics logistics) { + // 缓存 + redisUtil.set(CACHE_KEY + orderGoodsId, logistics, CACHE_TIME); + return logistics; + } + + @Override + public void cacheDelete(Long orderGoodsId) { + // 缓存 + redisUtil.del(CACHE_KEY + orderGoodsId); + } + @Override public void confirmReceipt(Long orderGoodsId) { BsOrderGoods orderGoods = queryDetail(orderGoodsId);