| New file |
| | |
| | | package com.java110.dto.storeOrder; |
| | | |
| | | import com.java110.dto.PageDto; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @ClassName FloorDto |
| | | * @Description 购物车数据层封装 |
| | | * @Author wuxw |
| | | * @Date 2019/4/24 8:52 |
| | | * @Version 1.0 |
| | | * add by wuxw 2019/4/24 |
| | | **/ |
| | | public class StoreOrderDto extends PageDto implements Serializable { |
| | | |
| | | private String personName; |
| | | private String extOrderId; |
| | | private String orderId; |
| | | private String totalPrice; |
| | | private String payPrice; |
| | | private String personId; |
| | | private String remark; |
| | | private String oId; |
| | | private String state; |
| | | private String freightPrice; |
| | | |
| | | |
| | | private Date createTime; |
| | | |
| | | private String statusCd = "0"; |
| | | |
| | | |
| | | public String getPersonName() { |
| | | return personName; |
| | | } |
| | | public void setPersonName(String personName) { |
| | | this.personName = personName; |
| | | } |
| | | public String getExtOrderId() { |
| | | return extOrderId; |
| | | } |
| | | public void setExtOrderId(String extOrderId) { |
| | | this.extOrderId = extOrderId; |
| | | } |
| | | public String getOrderId() { |
| | | return orderId; |
| | | } |
| | | public void setOrderId(String orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | public String getTotalPrice() { |
| | | return totalPrice; |
| | | } |
| | | public void setTotalPrice(String totalPrice) { |
| | | this.totalPrice = totalPrice; |
| | | } |
| | | public String getPayPrice() { |
| | | return payPrice; |
| | | } |
| | | public void setPayPrice(String payPrice) { |
| | | this.payPrice = payPrice; |
| | | } |
| | | public String getPersonId() { |
| | | return personId; |
| | | } |
| | | public void setPersonId(String personId) { |
| | | this.personId = personId; |
| | | } |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | public String getOId() { |
| | | return oId; |
| | | } |
| | | public void setOId(String oId) { |
| | | this.oId = oId; |
| | | } |
| | | public String getState() { |
| | | return state; |
| | | } |
| | | public void setState(String state) { |
| | | this.state = state; |
| | | } |
| | | public String getFreightPrice() { |
| | | return freightPrice; |
| | | } |
| | | public void setFreightPrice(String freightPrice) { |
| | | this.freightPrice = freightPrice; |
| | | } |
| | | |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getStatusCd() { |
| | | return statusCd; |
| | | } |
| | | |
| | | public void setStatusCd(String statusCd) { |
| | | this.statusCd = statusCd; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.po.storeOrder; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | public class StoreOrderPo implements Serializable { |
| | | |
| | | private String personName; |
| | | private String extOrderId; |
| | | private String orderId; |
| | | private String totalPrice; |
| | | private String payPrice; |
| | | private String personId; |
| | | private String remark; |
| | | private String statusCd = "0"; |
| | | private String oId; |
| | | private String state; |
| | | private String freightPrice; |
| | | public String getPersonName() { |
| | | return personName; |
| | | } |
| | | public void setPersonName(String personName) { |
| | | this.personName = personName; |
| | | } |
| | | public String getExtOrderId() { |
| | | return extOrderId; |
| | | } |
| | | public void setExtOrderId(String extOrderId) { |
| | | this.extOrderId = extOrderId; |
| | | } |
| | | public String getOrderId() { |
| | | return orderId; |
| | | } |
| | | public void setOrderId(String orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | public String getTotalPrice() { |
| | | return totalPrice; |
| | | } |
| | | public void setTotalPrice(String totalPrice) { |
| | | this.totalPrice = totalPrice; |
| | | } |
| | | public String getPayPrice() { |
| | | return payPrice; |
| | | } |
| | | public void setPayPrice(String payPrice) { |
| | | this.payPrice = payPrice; |
| | | } |
| | | public String getPersonId() { |
| | | return personId; |
| | | } |
| | | public void setPersonId(String personId) { |
| | | this.personId = personId; |
| | | } |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | public String getStatusCd() { |
| | | return statusCd; |
| | | } |
| | | public void setStatusCd(String statusCd) { |
| | | this.statusCd = statusCd; |
| | | } |
| | | public String getOId() { |
| | | return oId; |
| | | } |
| | | public void setOId(String oId) { |
| | | this.oId = oId; |
| | | } |
| | | public String getState() { |
| | | return state; |
| | | } |
| | | public void setState(String state) { |
| | | this.state = state; |
| | | } |
| | | public String getFreightPrice() { |
| | | return freightPrice; |
| | | } |
| | | public void setFreightPrice(String freightPrice) { |
| | | this.freightPrice = freightPrice; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | public static final String CODE_PREFIX_statisticsId = "94"; |
| | | public static final String CODE_PREFIX_labelId = "94"; |
| | | public static final String CODE_PREFIX_cartId = "95"; |
| | | public static final String CODE_PREFIX_orderId = "96"; |
| | | |
| | | |
| | | |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="storeOrderServiceDaoImpl"> |
| | | |
| | | |
| | | <!-- 保存购物车信息 add by wuxw 2018-07-03 --> |
| | | <insert id="saveStoreOrderInfo" parameterType="Map"> |
| | | insert into store_order( |
| | | person_name,ext_order_id,order_id,total_price,pay_price,person_id,remark,o_id,state,freight_price |
| | | ) values ( |
| | | #{personName},#{extOrderId},#{orderId},#{totalPrice},#{payPrice},#{personId},#{remark},#{oId},#{state},#{freightPrice} |
| | | ) |
| | | </insert> |
| | | |
| | | |
| | | <!-- 查询购物车信息 add by wuxw 2018-07-03 --> |
| | | <select id="getStoreOrderInfo" parameterType="Map" resultType="Map"> |
| | | select t.person_name,t.person_name personName,t.ext_order_id,t.ext_order_id extOrderId,t.order_id,t.order_id |
| | | orderId,t.total_price,t.total_price totalPrice,t.pay_price,t.pay_price payPrice,t.person_id,t.person_id |
| | | personId,t.remark,t.status_cd,t.status_cd statusCd,t.o_id,t.o_id oId,t.state,t.freight_price,t.freight_price |
| | | freightPrice |
| | | from store_order t |
| | | where 1 =1 |
| | | <if test="personName !=null and personName != ''"> |
| | | and t.person_name= #{personName} |
| | | </if> |
| | | <if test="extOrderId !=null and extOrderId != ''"> |
| | | and t.ext_order_id= #{extOrderId} |
| | | </if> |
| | | <if test="orderId !=null and orderId != ''"> |
| | | and t.order_id= #{orderId} |
| | | </if> |
| | | <if test="totalPrice !=null and totalPrice != ''"> |
| | | and t.total_price= #{totalPrice} |
| | | </if> |
| | | <if test="payPrice !=null and payPrice != ''"> |
| | | and t.pay_price= #{payPrice} |
| | | </if> |
| | | <if test="personId !=null and personId != ''"> |
| | | and t.person_id= #{personId} |
| | | </if> |
| | | <if test="remark !=null and remark != ''"> |
| | | and t.remark= #{remark} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="oId !=null and oId != ''"> |
| | | and t.o_id= #{oId} |
| | | </if> |
| | | <if test="state !=null and state != ''"> |
| | | and t.state= #{state} |
| | | </if> |
| | | <if test="freightPrice !=null and freightPrice != ''"> |
| | | and t.freight_price= #{freightPrice} |
| | | </if> |
| | | order by t.create_time desc |
| | | <if test="page != -1 and page != null "> |
| | | limit #{page}, #{row} |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | <!-- 修改购物车信息 add by wuxw 2018-07-03 --> |
| | | <update id="updateStoreOrderInfo" parameterType="Map"> |
| | | update store_order t set t.status_cd = #{statusCd} |
| | | <if test="newBId != null and newBId != ''"> |
| | | ,t.b_id = #{newBId} |
| | | </if> |
| | | <if test="personName !=null and personName != ''"> |
| | | , t.person_name= #{personName} |
| | | </if> |
| | | <if test="extOrderId !=null and extOrderId != ''"> |
| | | , t.ext_order_id= #{extOrderId} |
| | | </if> |
| | | <if test="totalPrice !=null and totalPrice != ''"> |
| | | , t.total_price= #{totalPrice} |
| | | </if> |
| | | <if test="payPrice !=null and payPrice != ''"> |
| | | , t.pay_price= #{payPrice} |
| | | </if> |
| | | <if test="personId !=null and personId != ''"> |
| | | , t.person_id= #{personId} |
| | | </if> |
| | | <if test="remark !=null and remark != ''"> |
| | | , t.remark= #{remark} |
| | | </if> |
| | | <if test="oId !=null and oId != ''"> |
| | | , t.o_id= #{oId} |
| | | </if> |
| | | <if test="state !=null and state != ''"> |
| | | , t.state= #{state} |
| | | </if> |
| | | <if test="freightPrice !=null and freightPrice != ''"> |
| | | , t.freight_price= #{freightPrice} |
| | | </if> |
| | | where 1=1 |
| | | <if test="orderId !=null and orderId != ''"> |
| | | and t.order_id= #{orderId} |
| | | </if> |
| | | |
| | | </update> |
| | | |
| | | <!-- 查询购物车数量 add by wuxw 2018-07-03 --> |
| | | <select id="queryStoreOrdersCount" parameterType="Map" resultType="Map"> |
| | | select count(1) count |
| | | from store_order t |
| | | where 1 =1 |
| | | <if test="personName !=null and personName != ''"> |
| | | and t.person_name= #{personName} |
| | | </if> |
| | | <if test="extOrderId !=null and extOrderId != ''"> |
| | | and t.ext_order_id= #{extOrderId} |
| | | </if> |
| | | <if test="orderId !=null and orderId != ''"> |
| | | and t.order_id= #{orderId} |
| | | </if> |
| | | <if test="totalPrice !=null and totalPrice != ''"> |
| | | and t.total_price= #{totalPrice} |
| | | </if> |
| | | <if test="payPrice !=null and payPrice != ''"> |
| | | and t.pay_price= #{payPrice} |
| | | </if> |
| | | <if test="personId !=null and personId != ''"> |
| | | and t.person_id= #{personId} |
| | | </if> |
| | | <if test="remark !=null and remark != ''"> |
| | | and t.remark= #{remark} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="oId !=null and oId != ''"> |
| | | and t.o_id= #{oId} |
| | | </if> |
| | | <if test="state !=null and state != ''"> |
| | | and t.state= #{state} |
| | | </if> |
| | | <if test="freightPrice !=null and freightPrice != ''"> |
| | | and t.freight_price= #{freightPrice} |
| | | </if> |
| | | |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | { |
| | | "autoMove": true, |
| | | "id": "cartId", |
| | | "name": "storeCart", |
| | | "id": "orderId", |
| | | "name": "storeOrder", |
| | | "desc": "购物车", |
| | | "shareParam": "storeId", |
| | | "shareColumn": "store_id", |
| | | "shareName": "goods", |
| | | "tableName": "store_cart", |
| | | "tableName": "store_order", |
| | | "param": { |
| | | "cartId": "cart_id", |
| | | "productId": "product_id", |
| | | "storeId": "store_id", |
| | | "valueId": "value_id", |
| | | "orderId": "order_id", |
| | | "oId": "o_id", |
| | | "personId": "person_id", |
| | | "cartNum": "cart_num", |
| | | "personName": "person_name", |
| | | "totalPrice": "total_price", |
| | | "payPrice": "pay_price", |
| | | "freightPrice": "freight_price", |
| | | "extOrderId": "ext_order_id", |
| | | "remark": "remark", |
| | | "state": "state", |
| | | "statusCd": "status_cd" |
| | | }, |
| | | "required": [ |
| | | { |
| | | "code": "productId", |
| | | "msg": "产品不能为空" |
| | | }, |
| | | { |
| | | "code": "valueId", |
| | | "msg": "规格值不能为空" |
| | | }, |
| | | { |
| | | "code": "personId", |
| | | "msg": "用户ID不能为空" |
| | | "msg": "用户不能为空" |
| | | }, |
| | | { |
| | | "code": "cartNum", |
| | | "msg": "产品数量不能为空" |
| | | "code": "personName", |
| | | "msg": "用户名称不能为空" |
| | | }, |
| | | { |
| | | "code": "totalPrice", |
| | | "msg": "总价不能为空" |
| | | }, |
| | | { |
| | | "code": "payPrice", |
| | | "msg": "支付价格不能为空" |
| | | } |
| | | ] |
| | | } |
| New file |
| | |
| | | package com.java110.intf; |
| | | |
| | | import com.java110.config.feign.FeignConfiguration; |
| | | import com.java110.dto.storeOrder.StoreOrderDto; |
| | | import com.java110.po.storeOrder.StoreOrderPo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName IStoreOrderInnerServiceSMO |
| | | * @Description 购物车接口类 |
| | | * @Author wuxw |
| | | * @Date 2019/4/24 9:04 |
| | | * @Version 1.0 |
| | | * add by wuxw 2019/4/24 |
| | | **/ |
| | | @FeignClient(name = "goods-service", configuration = {FeignConfiguration.class}) |
| | | @RequestMapping("/storeOrderApi") |
| | | public interface IStoreOrderInnerServiceSMO { |
| | | |
| | | |
| | | @RequestMapping(value = "/saveStoreOrder", method = RequestMethod.POST) |
| | | public int saveStoreOrder(@RequestBody StoreOrderPo storeOrderPo); |
| | | |
| | | @RequestMapping(value = "/updateStoreOrder", method = RequestMethod.POST) |
| | | public int updateStoreOrder(@RequestBody StoreOrderPo storeOrderPo); |
| | | |
| | | @RequestMapping(value = "/deleteStoreOrder", method = RequestMethod.POST) |
| | | public int deleteStoreOrder(@RequestBody StoreOrderPo storeOrderPo); |
| | | |
| | | /** |
| | | * <p>查询小区楼信息</p> |
| | | * |
| | | * |
| | | * @param storeOrderDto 数据对象分享 |
| | | * @return StoreOrderDto 对象数据 |
| | | */ |
| | | @RequestMapping(value = "/queryStoreOrders", method = RequestMethod.POST) |
| | | List<StoreOrderDto> queryStoreOrders(@RequestBody StoreOrderDto storeOrderDto); |
| | | |
| | | /** |
| | | * 查询<p>小区楼</p>总记录数 |
| | | * |
| | | * @param storeOrderDto 数据对象分享 |
| | | * @return 小区下的小区楼记录数 |
| | | */ |
| | | @RequestMapping(value = "/queryStoreOrdersCount", method = RequestMethod.POST) |
| | | int queryStoreOrdersCount(@RequestBody StoreOrderDto storeOrderDto); |
| | | } |
| New file |
| | |
| | | package com.java110.goods.api; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.dto.storeCart.StoreCartDto; |
| | | import com.java110.dto.storeOrder.StoreOrderDto; |
| | | import com.java110.goods.bmo.storeCart.IDeleteStoreCartBMO; |
| | | import com.java110.goods.bmo.storeCart.IGetStoreCartBMO; |
| | | import com.java110.goods.bmo.storeCart.ISaveStoreCartBMO; |
| | | import com.java110.goods.bmo.storeCart.IUpdateStoreCartBMO; |
| | | import com.java110.goods.bmo.storeOrder.IDeleteStoreOrderBMO; |
| | | import com.java110.goods.bmo.storeOrder.IGetStoreOrderBMO; |
| | | import com.java110.goods.bmo.storeOrder.ISaveStoreOrderBMO; |
| | | import com.java110.goods.bmo.storeOrder.IUpdateStoreOrderBMO; |
| | | import com.java110.po.storeCart.StoreCartPo; |
| | | import com.java110.po.storeOrder.StoreOrderPo; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | |
| | | @RestController |
| | | @RequestMapping(value = "/storeOrder") |
| | | public class StoreOrderApi { |
| | | |
| | | |
| | | @Autowired |
| | | private ISaveStoreCartBMO saveStoreCartBMOImpl; |
| | | @Autowired |
| | | private IUpdateStoreCartBMO updateStoreCartBMOImpl; |
| | | @Autowired |
| | | private IDeleteStoreCartBMO deleteStoreCartBMOImpl; |
| | | |
| | | @Autowired |
| | | private IGetStoreCartBMO getStoreCartBMOImpl; |
| | | |
| | | @Autowired |
| | | private ISaveStoreOrderBMO saveStoreOrderBMOImpl; |
| | | @Autowired |
| | | private IUpdateStoreOrderBMO updateStoreOrderBMOImpl; |
| | | @Autowired |
| | | private IDeleteStoreOrderBMO deleteStoreOrderBMOImpl; |
| | | |
| | | @Autowired |
| | | private IGetStoreOrderBMO getStoreOrderBMOImpl; |
| | | |
| | | /** |
| | | * 微信保存消息模板 |
| | | * |
| | | * @param reqJson |
| | | * @return |
| | | * @serviceCode /storeOrder/saveStoreOrder |
| | | * @path /app/storeOrder/saveStoreOrder |
| | | */ |
| | | @RequestMapping(value = "/saveStoreOrder", method = RequestMethod.POST) |
| | | public ResponseEntity<String> saveStoreOrder(@RequestBody JSONObject reqJson) { |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "personId", "请求报文中未包含personId"); |
| | | Assert.hasKeyAndValue(reqJson, "personName", "请求报文中未包含personName"); |
| | | Assert.hasKeyAndValue(reqJson, "totalPrice", "请求报文中未包含totalPrice"); |
| | | Assert.hasKeyAndValue(reqJson, "payPrice", "请求报文中未包含payPrice"); |
| | | |
| | | |
| | | StoreOrderPo storeOrderPo = BeanConvertUtil.covertBean(reqJson, StoreOrderPo.class); |
| | | return saveStoreOrderBMOImpl.save(storeOrderPo); |
| | | } |
| | | |
| | | /** |
| | | * 微信修改消息模板 |
| | | * |
| | | * @param reqJson |
| | | * @return |
| | | * @serviceCode /storeOrder/updateStoreOrder |
| | | * @path /app/storeOrder/updateStoreOrder |
| | | */ |
| | | @RequestMapping(value = "/updateStoreOrder", method = RequestMethod.POST) |
| | | public ResponseEntity<String> updateStoreOrder(@RequestBody JSONObject reqJson) { |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "personId", "请求报文中未包含personId"); |
| | | Assert.hasKeyAndValue(reqJson, "personName", "请求报文中未包含personName"); |
| | | Assert.hasKeyAndValue(reqJson, "totalPrice", "请求报文中未包含totalPrice"); |
| | | Assert.hasKeyAndValue(reqJson, "payPrice", "请求报文中未包含payPrice"); |
| | | Assert.hasKeyAndValue(reqJson, "orderId", "orderId不能为空"); |
| | | |
| | | |
| | | StoreOrderPo storeOrderPo = BeanConvertUtil.covertBean(reqJson, StoreOrderPo.class); |
| | | return updateStoreOrderBMOImpl.update(storeOrderPo); |
| | | } |
| | | |
| | | /** |
| | | * 微信删除消息模板 |
| | | * |
| | | * @param reqJson |
| | | * @return |
| | | * @serviceCode /storeOrder/deleteStoreOrder |
| | | * @path /app/storeOrder/deleteStoreOrder |
| | | */ |
| | | @RequestMapping(value = "/deleteStoreOrder", method = RequestMethod.POST) |
| | | public ResponseEntity<String> deleteStoreOrder(@RequestBody JSONObject reqJson) { |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空"); |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "orderId", "orderId不能为空"); |
| | | |
| | | |
| | | StoreOrderPo storeOrderPo = BeanConvertUtil.covertBean(reqJson, StoreOrderPo.class); |
| | | return deleteStoreOrderBMOImpl.delete(storeOrderPo); |
| | | } |
| | | |
| | | /** |
| | | * 微信删除消息模板 |
| | | * |
| | | * @return |
| | | * @serviceCode /storeOrder/queryStoreOrder |
| | | * @path /app/storeOrder/queryStoreOrder |
| | | */ |
| | | @RequestMapping(value = "/queryStoreOrder", method = RequestMethod.GET) |
| | | public ResponseEntity<String> queryStoreOrder( |
| | | @RequestParam(value = "page") int page, |
| | | @RequestParam(value = "row") int row) { |
| | | StoreOrderDto storeOrderDto = new StoreOrderDto(); |
| | | storeOrderDto.setPage(page); |
| | | storeOrderDto.setRow(row); |
| | | return getStoreOrderBMOImpl.get(storeOrderDto); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信保存消息模板 |
| | | * |
| | | * @param reqJson |
| | | * @return |
| | | * @serviceCode /storeCart/saveStoreCart |
| | | * @path /app/storeCart/saveStoreCart |
| | | */ |
| | | @RequestMapping(value = "/saveStoreCart", method = RequestMethod.POST) |
| | | public ResponseEntity<String> saveStoreCart(@RequestBody JSONObject reqJson) { |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "productId", "请求报文中未包含productId"); |
| | | Assert.hasKeyAndValue(reqJson, "valueId", "请求报文中未包含valueId"); |
| | | Assert.hasKeyAndValue(reqJson, "personId", "请求报文中未包含personId"); |
| | | Assert.hasKeyAndValue(reqJson, "cartNum", "请求报文中未包含cartNum"); |
| | | |
| | | |
| | | StoreCartPo storeCartPo = BeanConvertUtil.covertBean(reqJson, StoreCartPo.class); |
| | | return saveStoreCartBMOImpl.save(storeCartPo); |
| | | } |
| | | |
| | | /** |
| | | * 微信修改消息模板 |
| | | * |
| | | * @param reqJson |
| | | * @return |
| | | * @serviceCode /storeCart/updateStoreCart |
| | | * @path /app/storeCart/updateStoreCart |
| | | */ |
| | | @RequestMapping(value = "/updateStoreCart", method = RequestMethod.POST) |
| | | public ResponseEntity<String> updateStoreCart(@RequestBody JSONObject reqJson) { |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "productId", "请求报文中未包含productId"); |
| | | Assert.hasKeyAndValue(reqJson, "valueId", "请求报文中未包含valueId"); |
| | | Assert.hasKeyAndValue(reqJson, "personId", "请求报文中未包含personId"); |
| | | Assert.hasKeyAndValue(reqJson, "cartNum", "请求报文中未包含cartNum"); |
| | | Assert.hasKeyAndValue(reqJson, "cartId", "cartId不能为空"); |
| | | |
| | | |
| | | StoreCartPo storeCartPo = BeanConvertUtil.covertBean(reqJson, StoreCartPo.class); |
| | | return updateStoreCartBMOImpl.update(storeCartPo); |
| | | } |
| | | |
| | | /** |
| | | * 微信删除消息模板 |
| | | * |
| | | * @param reqJson |
| | | * @return |
| | | * @serviceCode /storeCart/deleteStoreCart |
| | | * @path /app/storeCart/deleteStoreCart |
| | | */ |
| | | @RequestMapping(value = "/deleteStoreCart", method = RequestMethod.POST) |
| | | public ResponseEntity<String> deleteStoreCart(@RequestBody JSONObject reqJson) { |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空"); |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "cartId", "cartId不能为空"); |
| | | |
| | | |
| | | StoreCartPo storeCartPo = BeanConvertUtil.covertBean(reqJson, StoreCartPo.class); |
| | | return deleteStoreCartBMOImpl.delete(storeCartPo); |
| | | } |
| | | |
| | | /** |
| | | * 微信删除消息模板 |
| | | * |
| | | * @param communityId 小区ID |
| | | * @return |
| | | * @serviceCode /storeCart/queryStoreCart |
| | | * @path /app/storeCart/queryStoreCart |
| | | */ |
| | | @RequestMapping(value = "/queryStoreCart", method = RequestMethod.GET) |
| | | public ResponseEntity<String> queryStoreCart(@RequestParam(value = "communityId") String communityId, |
| | | @RequestParam(value = "page") int page, |
| | | @RequestParam(value = "row") int row) { |
| | | StoreCartDto storeCartDto = new StoreCartDto(); |
| | | storeCartDto.setPage(page); |
| | | storeCartDto.setRow(row); |
| | | //storeCartDto.setCommunityId(communityId); |
| | | return getStoreCartBMOImpl.get(storeCartDto); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.storeOrder; |
| | | import com.java110.po.storeOrder.StoreOrderPo; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | public interface IDeleteStoreOrderBMO { |
| | | |
| | | |
| | | /** |
| | | * 修改购物车 |
| | | * add by wuxw |
| | | * @param storeOrderPo |
| | | * @return |
| | | */ |
| | | ResponseEntity<String> delete(StoreOrderPo storeOrderPo); |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.storeOrder; |
| | | import com.java110.dto.storeOrder.StoreOrderDto; |
| | | import org.springframework.http.ResponseEntity; |
| | | public interface IGetStoreOrderBMO { |
| | | |
| | | |
| | | /** |
| | | * 查询购物车 |
| | | * add by wuxw |
| | | * @param storeOrderDto |
| | | * @return |
| | | */ |
| | | ResponseEntity<String> get(StoreOrderDto storeOrderDto); |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.storeOrder; |
| | | |
| | | import com.java110.po.storeOrder.StoreOrderPo; |
| | | import org.springframework.http.ResponseEntity; |
| | | public interface ISaveStoreOrderBMO { |
| | | |
| | | |
| | | /** |
| | | * 添加购物车 |
| | | * add by wuxw |
| | | * @param storeOrderPo |
| | | * @return |
| | | */ |
| | | ResponseEntity<String> save(StoreOrderPo storeOrderPo); |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.storeOrder; |
| | | import com.java110.po.storeOrder.StoreOrderPo; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | public interface IUpdateStoreOrderBMO { |
| | | |
| | | |
| | | /** |
| | | * 修改购物车 |
| | | * add by wuxw |
| | | * @param storeOrderPo |
| | | * @return |
| | | */ |
| | | ResponseEntity<String> update(StoreOrderPo storeOrderPo); |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.storeOrder.impl; |
| | | |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.goods.bmo.storeOrder.IDeleteStoreOrderBMO; |
| | | import com.java110.intf.IStoreOrderInnerServiceSMO; |
| | | import com.java110.po.storeOrder.StoreOrderPo; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("deleteStoreOrderBMOImpl") |
| | | public class DeleteStoreOrderBMOImpl implements IDeleteStoreOrderBMO { |
| | | |
| | | @Autowired |
| | | private IStoreOrderInnerServiceSMO storeOrderInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * @param storeOrderPo 数据 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | @Java110Transactional |
| | | public ResponseEntity<String> delete(StoreOrderPo storeOrderPo) { |
| | | |
| | | int flag = storeOrderInnerServiceSMOImpl.deleteStoreOrder(storeOrderPo); |
| | | |
| | | if (flag > 0) { |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功"); |
| | | } |
| | | |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.storeOrder.impl; |
| | | |
| | | import com.java110.dto.storeOrder.StoreOrderDto; |
| | | import com.java110.goods.bmo.storeOrder.IGetStoreOrderBMO; |
| | | import com.java110.intf.IStoreOrderInnerServiceSMO; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service("getStoreOrderBMOImpl") |
| | | public class GetStoreOrderBMOImpl implements IGetStoreOrderBMO { |
| | | |
| | | @Autowired |
| | | private IStoreOrderInnerServiceSMO storeOrderInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * @param storeOrderDto |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public ResponseEntity<String> get(StoreOrderDto storeOrderDto) { |
| | | |
| | | |
| | | int count = storeOrderInnerServiceSMOImpl.queryStoreOrdersCount(storeOrderDto); |
| | | |
| | | List<StoreOrderDto> storeOrderDtos = null; |
| | | if (count > 0) { |
| | | storeOrderDtos = storeOrderInnerServiceSMOImpl.queryStoreOrders(storeOrderDto); |
| | | } else { |
| | | storeOrderDtos = new ArrayList<>(); |
| | | } |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) storeOrderDto.getRow()), count, storeOrderDtos); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | return responseEntity; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.storeOrder.impl; |
| | | |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.goods.bmo.storeOrder.ISaveStoreOrderBMO; |
| | | import com.java110.intf.IStoreOrderInnerServiceSMO; |
| | | import com.java110.po.storeOrder.StoreOrderPo; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("saveStoreOrderBMOImpl") |
| | | public class SaveStoreOrderBMOImpl implements ISaveStoreOrderBMO { |
| | | |
| | | @Autowired |
| | | private IStoreOrderInnerServiceSMO storeOrderInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | | * @param storeOrderPo |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | @Java110Transactional |
| | | public ResponseEntity<String> save(StoreOrderPo storeOrderPo) { |
| | | |
| | | storeOrderPo.setOrderId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orderId)); |
| | | int flag = storeOrderInnerServiceSMOImpl.saveStoreOrder(storeOrderPo); |
| | | |
| | | if (flag > 0) { |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功"); |
| | | } |
| | | |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.bmo.storeOrder.impl; |
| | | |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.goods.bmo.storeOrder.IUpdateStoreOrderBMO; |
| | | import com.java110.intf.IStoreOrderInnerServiceSMO; |
| | | import com.java110.po.storeOrder.StoreOrderPo; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("updateStoreOrderBMOImpl") |
| | | public class UpdateStoreOrderBMOImpl implements IUpdateStoreOrderBMO { |
| | | |
| | | @Autowired |
| | | private IStoreOrderInnerServiceSMO storeOrderInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * @param storeOrderPo |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | @Java110Transactional |
| | | public ResponseEntity<String> update(StoreOrderPo storeOrderPo) { |
| | | |
| | | int flag = storeOrderInnerServiceSMOImpl.updateStoreOrder(storeOrderPo); |
| | | |
| | | if (flag > 0) { |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功"); |
| | | } |
| | | |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.dao; |
| | | |
| | | |
| | | import com.java110.utils.exception.DAOException; |
| | | import com.java110.entity.merchant.BoMerchant; |
| | | import com.java110.entity.merchant.BoMerchantAttr; |
| | | import com.java110.entity.merchant.Merchant; |
| | | import com.java110.entity.merchant.MerchantAttr; |
| | | |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 购物车组件内部之间使用,没有给外围系统提供服务能力 |
| | | * 购物车服务接口类,要求全部以字符串传输,方便微服务化 |
| | | * 新建客户,修改客户,删除客户,查询客户等功能 |
| | | * |
| | | * Created by wuxw on 2016/12/27. |
| | | */ |
| | | public interface IStoreOrderServiceDao { |
| | | |
| | | |
| | | /** |
| | | * 保存 购物车信息 |
| | | * @param info |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | void saveStoreOrderInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询购物车信息(instance过程) |
| | | * 根据bId 查询购物车信息 |
| | | * @param info bId 信息 |
| | | * @return 购物车信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | List<Map> getStoreOrderInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改购物车信息 |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | void updateStoreOrderInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | /** |
| | | * 查询购物车总数 |
| | | * |
| | | * @param info 购物车信息 |
| | | * @return 购物车数量 |
| | | */ |
| | | int queryStoreOrdersCount(Map info); |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.dao.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.exception.DAOException; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.core.base.dao.BaseServiceDao; |
| | | import com.java110.goods.dao.IStoreOrderServiceDao; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 购物车服务 与数据库交互 |
| | | * Created by wuxw on 2017/4/5. |
| | | */ |
| | | @Service("storeOrderServiceDaoImpl") |
| | | //@Transactional |
| | | public class StoreOrderServiceDaoImpl extends BaseServiceDao implements IStoreOrderServiceDao { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(StoreOrderServiceDaoImpl.class); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存购物车信息 到 instance |
| | | * @param info bId 信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void saveStoreOrderInfo(Map info) throws DAOException { |
| | | logger.debug("保存购物车信息Instance 入参 info : {}",info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.insert("storeOrderServiceDaoImpl.saveStoreOrderInfo",info); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存购物车信息Instance数据失败:"+ JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询购物车信息(instance) |
| | | * @param info bId 信息 |
| | | * @return List<Map> |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public List<Map> getStoreOrderInfo(Map info) throws DAOException { |
| | | logger.debug("查询购物车信息 入参 info : {}",info); |
| | | |
| | | List<Map> businessStoreOrderInfos = sqlSessionTemplate.selectList("storeOrderServiceDaoImpl.getStoreOrderInfo",info); |
| | | |
| | | return businessStoreOrderInfos; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改购物车信息 |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void updateStoreOrderInfo(Map info) throws DAOException { |
| | | logger.debug("修改购物车信息Instance 入参 info : {}",info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.update("storeOrderServiceDaoImpl.updateStoreOrderInfo",info); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改购物车信息Instance数据失败:"+ JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询购物车数量 |
| | | * @param info 购物车信息 |
| | | * @return 购物车数量 |
| | | */ |
| | | @Override |
| | | public int queryStoreOrdersCount(Map info) { |
| | | logger.debug("查询购物车数据 入参 info : {}",info); |
| | | |
| | | List<Map> businessStoreOrderInfos = sqlSessionTemplate.selectList("storeOrderServiceDaoImpl.queryStoreOrdersCount", info); |
| | | if (businessStoreOrderInfos.size() < 1) { |
| | | return 0; |
| | | } |
| | | |
| | | return Integer.parseInt(businessStoreOrderInfos.get(0).get("count").toString()); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.goods.smo.impl; |
| | | |
| | | |
| | | import com.java110.core.base.smo.BaseServiceSMO; |
| | | import com.java110.dto.PageDto; |
| | | import com.java110.dto.storeOrder.StoreOrderDto; |
| | | import com.java110.goods.dao.IStoreOrderServiceDao; |
| | | import com.java110.intf.IStoreOrderInnerServiceSMO; |
| | | import com.java110.po.storeOrder.StoreOrderPo; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName FloorInnerServiceSMOImpl |
| | | * @Description 购物车内部服务实现类 |
| | | * @Author wuxw |
| | | * @Date 2019/4/24 9:20 |
| | | * @Version 1.0 |
| | | * add by wuxw 2019/4/24 |
| | | **/ |
| | | @RestController |
| | | public class StoreOrderInnerServiceSMOImpl extends BaseServiceSMO implements IStoreOrderInnerServiceSMO { |
| | | |
| | | @Autowired |
| | | private IStoreOrderServiceDao storeOrderServiceDaoImpl; |
| | | |
| | | |
| | | @Override |
| | | public int saveStoreOrder(@RequestBody StoreOrderPo storeOrderPo) { |
| | | int saveFlag = 1; |
| | | storeOrderServiceDaoImpl.saveStoreOrderInfo(BeanConvertUtil.beanCovertMap(storeOrderPo)); |
| | | return saveFlag; |
| | | } |
| | | |
| | | @Override |
| | | public int updateStoreOrder(@RequestBody StoreOrderPo storeOrderPo) { |
| | | int saveFlag = 1; |
| | | storeOrderServiceDaoImpl.updateStoreOrderInfo(BeanConvertUtil.beanCovertMap(storeOrderPo)); |
| | | return saveFlag; |
| | | } |
| | | |
| | | @Override |
| | | public int deleteStoreOrder(@RequestBody StoreOrderPo storeOrderPo) { |
| | | int saveFlag = 1; |
| | | storeOrderPo.setStatusCd("1"); |
| | | storeOrderServiceDaoImpl.updateStoreOrderInfo(BeanConvertUtil.beanCovertMap(storeOrderPo)); |
| | | return saveFlag; |
| | | } |
| | | |
| | | @Override |
| | | public List<StoreOrderDto> queryStoreOrders(@RequestBody StoreOrderDto storeOrderDto) { |
| | | |
| | | //校验是否传了 分页信息 |
| | | |
| | | int page = storeOrderDto.getPage(); |
| | | |
| | | if (page != PageDto.DEFAULT_PAGE) { |
| | | storeOrderDto.setPage((page - 1) * storeOrderDto.getRow()); |
| | | } |
| | | |
| | | List<StoreOrderDto> storeOrders = BeanConvertUtil.covertBeanList(storeOrderServiceDaoImpl.getStoreOrderInfo(BeanConvertUtil.beanCovertMap(storeOrderDto)), StoreOrderDto.class); |
| | | |
| | | return storeOrders; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int queryStoreOrdersCount(@RequestBody StoreOrderDto storeOrderDto) { |
| | | return storeOrderServiceDaoImpl.queryStoreOrdersCount(BeanConvertUtil.beanCovertMap(storeOrderDto)); |
| | | } |
| | | |
| | | public IStoreOrderServiceDao getStoreOrderServiceDaoImpl() { |
| | | return storeOrderServiceDaoImpl; |
| | | } |
| | | |
| | | public void setStoreOrderServiceDaoImpl(IStoreOrderServiceDao storeOrderServiceDaoImpl) { |
| | | this.storeOrderServiceDaoImpl = storeOrderServiceDaoImpl; |
| | | } |
| | | } |