fanli/src/main/java/com/yeshi/fanli/dao/mybatis/elme/ElmeOrderMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
fanli/src/main/java/com/yeshi/fanli/exception/elme/ElmeOrderException.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
fanli/src/main/java/com/yeshi/fanli/mapping/elme/ElmeHongBaoOrderMapMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
fanli/src/main/java/com/yeshi/fanli/service/impl/elme/ElmeOrderServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
fanli/src/main/java/com/yeshi/fanli/service/inter/elme/ElmeOrderService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
fanli/src/main/java/com/yeshi/fanli/util/elme/ElmeOrderUtil.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/elme/ElmeOrderMapper.java
@@ -5,4 +5,11 @@ public interface ElmeOrderMapper extends BaseMapper<ElmeOrder> { /** * 根据订单号查询 * @param orderId * @return */ ElmeOrder selectByOrderId(String orderId); } fanli/src/main/java/com/yeshi/fanli/exception/elme/ElmeOrderException.java
New file @@ -0,0 +1,16 @@ package com.yeshi.fanli.exception.elme; import com.yeshi.fanli.exception.BaseException; public class ElmeOrderException extends BaseException { private static final long serialVersionUID = 1L; public ElmeOrderException(int code, String msg) { super(code, msg); } public ElmeOrderException() { super(); } } fanli/src/main/java/com/yeshi/fanli/mapping/elme/ElmeHongBaoOrderMapMapper.xml
@@ -29,7 +29,7 @@ useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_elme_order_hongbao (eoh_id,eoh_order_id,eoh_hongbao_id,eoh_create_time) values (#{id,jdbcType=BIGINT},#{elmeOrder,jdbcType=VARCHAR},#{hongBao,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP}) (#{id,jdbcType=BIGINT},#{elmeOrder.id,jdbcType=BIGINT},#{hongBao.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP}) </insert> <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap" useGeneratedKeys="true" keyProperty="id"> @@ -43,22 +43,22 @@ values <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">#{id,jdbcType=BIGINT},</if> <if test="elmeOrder != null">#{elmeOrder,jdbcType=VARCHAR},</if> <if test="hongBao != null">#{hongBao,jdbcType=VARCHAR},</if> <if test="elmeOrder != null">#{elmeOrder.id,jdbcType=BIGINT},</if> <if test="hongBao != null">#{hongBao.id,jdbcType=BIGINT},</if> <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> </trim> </insert> <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap">update yeshi_ec_elme_order_hongbao set eoh_order_id = #{elmeOrder,jdbcType=VARCHAR},eoh_hongbao_id = #{hongBao,jdbcType=VARCHAR},eoh_create_time = #{elmeOrder.id,jdbcType=BIGINT},eoh_hongbao_id = #{hongBao.id,jdbcType=BIGINT},eoh_create_time = #{createTime,jdbcType=TIMESTAMP} where eoh_id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap"> update yeshi_ec_elme_order_hongbao <set> <if test="elmeOrder != null">eoh_order_id=#{elmeOrder,jdbcType=VARCHAR},</if> <if test="hongBao != null">eoh_hongbao_id=#{hongBao,jdbcType=VARCHAR},</if> <if test="elmeOrder != null">eoh_order_id=#{elmeOrder.id,jdbcType=BIGINT},</if> <if test="hongBao != null">eoh_hongbao_id=#{hongBao.id,jdbcType=BIGINT},</if> <if test="createTime != null">eoh_create_time=#{createTime,jdbcType=TIMESTAMP},</if> </set> where eoh_id = #{id,jdbcType=BIGINT} fanli/src/main/java/com/yeshi/fanli/service/impl/elme/ElmeOrderServiceImpl.java
New file @@ -0,0 +1,42 @@ package com.yeshi.fanli.service.impl.elme; import java.util.Date; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.yeshi.fanli.dao.mybatis.elme.ElmeOrderMapper; import com.yeshi.fanli.entity.elme.ElmeOrder; import com.yeshi.fanli.exception.elme.ElmeOrderException; import com.yeshi.fanli.service.inter.elme.ElmeOrderService; import com.yeshi.fanli.util.StringUtil; @Service public class ElmeOrderServiceImpl implements ElmeOrderService { @Resource private ElmeOrderMapper elmeOrderMapper; @Override public void addOrder(ElmeOrder order) throws ElmeOrderException { if (StringUtil.isNullOrEmpty(order.getOrderId()) || order.getPayMoney() == null) throw new ElmeOrderException(1, "信息不完整"); ElmeOrder oldOrder = elmeOrderMapper.selectByOrderId(order.getOrderId()); if (oldOrder == null) { if (order.getCreateTime() == null) order.setCreateTime(new Date()); if (order.getUpdateTime() == null) order.setUpdateTime(new Date()); elmeOrderMapper.insertSelective(order); } else { // 更新付款金额,计算状态 ElmeOrder update = new ElmeOrder(); update.setId(oldOrder.getId()); update.setIsSettle(order.getIsSettle()); update.setPayMoney(order.getPayMoney()); update.setUpdateTime(new Date()); elmeOrderMapper.updateByPrimaryKeySelective(update); } } } fanli/src/main/java/com/yeshi/fanli/service/inter/elme/ElmeOrderService.java
New file @@ -0,0 +1,19 @@ package com.yeshi.fanli.service.inter.elme; import com.yeshi.fanli.entity.elme.ElmeOrder; import com.yeshi.fanli.exception.elme.ElmeOrderException; /** * 饿了么订单服务 * * @author Administrator * */ public interface ElmeOrderService { /** * 添加订单 * * @param order */ public void addOrder(ElmeOrder order) throws ElmeOrderException; } fanli/src/main/java/com/yeshi/fanli/util/elme/ElmeOrderUtil.java
New file @@ -0,0 +1,25 @@ package com.yeshi.fanli.util.elme; import java.io.InputStream; import java.util.List; import com.yeshi.fanli.entity.elme.ElmeOrder; public class ElmeOrderUtil { /** * 解析订单(从输入流) * * @param input * @return */ public static List<ElmeOrder> parseOrder(InputStream input) { return null; } } fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java
@@ -2029,7 +2029,7 @@ return get2.getResponseHeader("location").getValue(); // 真实地址 } catch (Exception ex) { ex.printStackTrace(); } } return null; }