New file |
| | |
| | | package com.yeshi.fanli.controller.admin.shop;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.lang.reflect.Type;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.JsonElement;
|
| | | import com.google.gson.JsonPrimitive;
|
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopOrderException;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderPayService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/blOrder")
|
| | | public class BanLiShopOrderAdminController {
|
| | |
|
| | | @Resource
|
| | | private BanLiShopOrderService banLiShopOrderService;
|
| | |
|
| | | @Resource
|
| | | private BanLiShopOrderPayService banLiShopOrderPayService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | /**
|
| | | * 获取订单列表
|
| | | * |
| | | * @param callback
|
| | | * @param orderId
|
| | | * -订单号 可为空
|
| | | * @param page
|
| | | * -页码
|
| | | * @param state-状态数组
|
| | | * [1,2]
|
| | | * @param uid
|
| | | * 用户ID
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listOrder")
|
| | | public void listOrder(String callback, String orderId, int page, String state, Long uid, PrintWriter out) {
|
| | | long count = 0;
|
| | | List<BanLiShopOrder> orderList = new ArrayList<>();
|
| | | if (!StringUtil.isNullOrEmpty(orderId)) {
|
| | | BanLiShopOrder order = banLiShopOrderService.selectByOrderNo(orderId);
|
| | | if (order != null) {
|
| | | orderList.add(order);
|
| | | count = 1;
|
| | | }
|
| | | } else {
|
| | | List<Integer> stateList = null;
|
| | | if (!StringUtil.isNullOrEmpty(state)) {
|
| | | net.sf.json.JSONArray array = net.sf.json.JSONArray.fromObject(state);
|
| | |
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | if (stateList == null)
|
| | | stateList = new ArrayList<>();
|
| | |
|
| | | stateList.add(array.optInt(i));
|
| | | }
|
| | |
|
| | | }
|
| | | orderList = banLiShopOrderService.listByUidAndState(uid, stateList, page, Constant.PAGE_SIZE);
|
| | | count = banLiShopOrderService.countByUidAndState(uid, stateList);
|
| | | }
|
| | |
|
| | | GsonBuilder gb = new GsonBuilder();
|
| | | gb.registerTypeAdapter(java.util.Date.class, new JsonSerializer<Date>() {
|
| | |
|
| | | public JsonElement serialize(Date arg0, Type arg1, JsonSerializationContext arg2) {
|
| | | return new JsonPrimitive(TimeUtil.getGernalTime(arg0.getTime(), "yyyy-MM-dd HH:mm:ss"));
|
| | | }
|
| | | });
|
| | | PageEntity pe = new PageEntity(page, Constant.PAGE_SIZE, count,
|
| | | (int) (count % Constant.PAGE_SIZE == 0 ? count / Constant.PAGE_SIZE : count / Constant.PAGE_SIZE + 1));
|
| | |
|
| | | Gson gson = gb.create();
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("list", gson.toJson(orderList));
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | }
|
| | |
|
| | | // 订单充值
|
| | | @RequestMapping(value = "charge")
|
| | | public void charge(String callback, Long id, String code, HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | | /* 检验是否登陆 */
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | | if (admin == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。"));
|
| | | return;
|
| | | }
|
| | |
|
| | | /* 检验是否通过验证 */
|
| | | String codeType = (String) request.getSession().getAttribute(Constant.SESSION_EXTRACT_VERIFY_RESULT);
|
| | | if (!"1".equals(codeType)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(9999, "邮箱验证未通过"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | banLiShopOrderPayService.charge(id);
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("")));
|
| | | } catch (BanLiShopOrderException e) {
|
| | | e.printStackTrace();
|
| | | BanLiShopOrder order = new BanLiShopOrder(id);
|
| | | String stateDesc = String.format("错误码:%s 错误原因:%s", e.getCode() + "", e.getMsg());
|
| | | order.setStateDesc(stateDesc);
|
| | | order.setUpdateTime(new Date());
|
| | | banLiShopOrderService.udpateSelectiveByPrimaryKey(order);
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getCode(), e.getMsg())));
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "reject")
|
| | | public void reject(String callback, Long id, String desc,HttpServletRequest request, PrintWriter out) {
|
| | | /* 检验是否登陆 */
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | | if (admin == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。"));
|
| | | return;
|
| | | }
|
| | |
|
| | | /* 检验是否通过验证 */
|
| | | String codeType = (String) request.getSession().getAttribute(Constant.SESSION_EXTRACT_VERIFY_RESULT);
|
| | | if (!"1".equals(codeType)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(9999, "邮箱验证未通过"));
|
| | | return;
|
| | | }
|
| | | try {
|
| | | banLiShopOrderService.rejectOrder(id, desc);
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("")));
|
| | | } catch (BanLiShopOrderException e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getCode(), e.getMsg())));
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getOrderDetail")
|
| | | public void getOrderDetail(String callback, Long id, PrintWriter out) {
|
| | | BanLiShopOrder order = banLiShopOrderService.selectByPrimaryKey(id);
|
| | | if (order == null) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "订单不存在")));
|
| | | return;
|
| | | }
|
| | | // 查询用户信息
|
| | | UserInfo user = userInfoService.selectByPKey(order.getUid());
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("order", order);
|
| | | data.put("user", user);
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | if (order.getMoneyPayment() != null && order.getMoneyPayment().compareTo(new BigDecimal(0)) > 0) {
|
| | | // 走微信支付
|
| | | String payUrl = BanLiShopWXPayUtil.getWXH5PayUrl(order.getOrderNo(), request.getRemoteAddr(),
|
| | | order.getOrderGoods().getGoodsName(), order.getMoneyPayment());
|
| | | order.getOrderGoods().getGoodsName(), order.getMoneyPayment(), acceptData.getPlatform());
|
| | | if (StringUtil.isNullOrEmpty(payUrl)) {
|
| | | if (!StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(102, "微信支付创建失败")));
|
| | |
| | | @Resource
|
| | | private RedPackWinNewUserService redPackWinNewUserService;
|
| | |
|
| | | |
| | | /**
|
| | | * s 首页配置信息
|
| | | *
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * s 首页配置信息
|
| | | *
|
| | |
| | | floatImgVO.setJumpDetail(jumpDetail);
|
| | | floatImgVO.setShowTime(floatAD.getShowMode());
|
| | | floatImgVO.setAccountLogin(floatAD.isJumpNeedLogin());
|
| | | if (floatAD.getPlaySound() != null)
|
| | | floatImgVO.setPlaySound(floatAD.getPlaySound());// 默认都播放音效
|
| | | else
|
| | | floatImgVO.setPlaySound(false);
|
| | | listVO.add(floatImgVO);
|
| | | }
|
| | | }
|
| | |
| | | // 领券帮助链接,1.5.2后生效
|
| | | String couponHelp = configService.get("taobao_coupon_help");
|
| | | data.put("couponHelpUrl", couponHelp);
|
| | |
|
| | |
|
| | | // 判断新老用户 显示热门功能按钮滑动
|
| | | UserActiveLog da = null;
|
| | |
| | | configService.getByVersion("hot_function_url", platform, Integer.parseInt(acceptData.getVersion())));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 消息中心弹框
|
| | |
| | | data.put("goodsDetail", false);// 不需要拦截商品详情
|
| | | }
|
| | | //TODO 前端需要处理
|
| | | // if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | // if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(),
|
| | | // acceptData.getVersion())) {
|
| | | // JSONObject js = new JSONObject();
|
| | | // String jsStr = configService.get("url_extract_id");
|
| | | // String md5 = StringUtil.Md5(jsStr);
|
| | |
| | | * @param count |
| | | * @return |
| | | */ |
| | | List<BanLiShopOrder> listByUid(@Param("stateList") List<Integer> stateList, @Param("uid") Long uid, |
| | | List<BanLiShopOrder> listByUidAndState(@Param("stateList") List<Integer> stateList, @Param("uid") Long uid, |
| | | @Param("start") long start, @Param("count") int count); |
| | | |
| | | /** |
| | |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | long countByUid(@Param("stateList") List<Integer> stateList, @Param("uid") Long uid); |
| | | long countByUidAndState(@Param("stateList") List<Integer> stateList, @Param("uid") Long uid); |
| | | |
| | | /** |
| | | * 根据订单号查询 |
| | | * |
| | | * @param orderNo |
| | | * @return |
| | | */ |
| | |
| | | @Column(name = "fa_state")
|
| | | private Integer state;
|
| | |
|
| | | @Column(name = "fa_play_sound")
|
| | | private Boolean playSound;//是否播放音效
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "fa_create_time")
|
| | | private Date createTime;
|
| | |
| | | this.type = type;
|
| | | }
|
| | |
|
| | | public Boolean getPlaySound() {
|
| | | return playSound;
|
| | | }
|
| | |
|
| | | public void setPlaySound(Boolean playSound) {
|
| | | this.playSound = playSound;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | public final static int STATE_REJECT_REFUND_FAIL = 15;// 审核拒绝-退款失败
|
| | | public final static int STATE_SUCCESS = 20;// 交易成功
|
| | |
|
| | | public BanLiShopOrder(Long id) {
|
| | | super();
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public BanLiShopOrder() {
|
| | | }
|
| | |
|
| | | @Column(name = "so_id")
|
| | | private Long id;
|
| | | @Column(name = "so_uid")
|
| | |
| | | private Date updateTime;// 更新时间
|
| | | @Column(name = "so_order_goods_id")
|
| | | private BanLiShopOrderGoods orderGoods;
|
| | |
|
| | |
|
| | | public BanLiShopOrderGoods getOrderGoods() {
|
| | | return orderGoods;
|
New file |
| | |
| | | package com.yeshi.fanli.exception.shop;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | /**
|
| | | * 福禄充值异常
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class FuLuChargeException extends BaseException {
|
| | |
|
| | | public static int CODE_BALANCE_NOT_ENOUGH = 2004;// 账户余额不足
|
| | | public static int CODE_ORDER_NO_EXIST = 4010;// 订单号已经存在
|
| | |
|
| | | private static final long serialVersionUID = 572112205824229000L;
|
| | |
|
| | | public FuLuChargeException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public FuLuChargeException() {
|
| | | super();
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| | |
|
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.homemodule.FloatADMapper">
|
| | |
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.homemodule.FloatAD">
|
| | | <id column="fa_id" property="id" jdbcType="BIGINT"/>
|
| | | <result column="fa_name" property="name" jdbcType="VARCHAR"/>
|
| | | <result column="fa_picture" property="picture" jdbcType="VARCHAR"/>
|
| | | <result column="fa_show_mode" property="showMode" jdbcType="VARCHAR"/>
|
| | | <result column="fa_params" property="params" jdbcType="VARCHAR"/>
|
| | | <result column="fa_jump_need_login" property="jumpNeedLogin" jdbcType="VARCHAR"/>
|
| | | <result column="fa_jump_need_login" property="jumpNeedLogin" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="fa_start_time" property="startTime" jdbcType="TIMESTAMP"/>
|
| | | <result column="fa_end_time" property="endTime" jdbcType="TIMESTAMP"/>
|
| | | <result column="fa_position" property="position" jdbcType="VARCHAR"/>
|
| | |
| | | <result column="fa_state" property="state" jdbcType="INTEGER"/>
|
| | | <result column="fa_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
| | | <result column="fa_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
| | | |
| | | <association property="jumpDetail" column="fa_jumpid" javaType="com.yeshi.fanli.entity.common.JumpDetailV2">
|
| | | <result column="fa_play_sound" property="playSound" jdbcType="BOOLEAN" /> |
| | | <association property="jumpDetail" column="fa_jumpid" |
| | | javaType="com.yeshi.fanli.entity.common.JumpDetailV2"> |
| | | <id column="fa_jumpid" property="id" jdbcType="BIGINT" />
|
| | | </association>
|
| | |
|
| | | </resultMap>
|
| | | <sql id="Base_Column_List">fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time</sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
| | | <include refid="Base_Column_List"/>from yeshi_ec_float_ad where fa_id = #{id,jdbcType=BIGINT}
|
| | | <sql id="Base_Column_List">fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time,fa_play_sound |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_float_ad where fa_id = #{id,jdbcType=BIGINT} |
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_float_ad where fa_id = #{id,jdbcType=BIGINT}</delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_float_ad (fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{showMode,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpNeedLogin,jdbcType=VARCHAR},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{position,jdbcType=VARCHAR},#{order,jdbcType=INTEGER},#{type,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_float_ad
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_float_ad where fa_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_float_ad |
| | | (fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time,fa_id,fa_play_sound) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{showMode,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpNeedLogin,jdbcType=VARCHAR},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{position,jdbcType=VARCHAR},#{order,jdbcType=INTEGER},#{type,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{id,jdbcType=BIGINT},#{playSound,jdbcType=BOOLEAN}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_float_ad |
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">fa_id,</if>
|
| | | <if test="name != null">fa_name,</if>
|
| | |
| | | <if test="state != null">fa_state,</if>
|
| | | <if test="createTime != null">fa_create_time,</if>
|
| | | <if test="updateTime != null">fa_update_time,</if>
|
| | | </trim>values
|
| | | <if test="playSound != null">fa_play_sound,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if>
|
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if>
|
| | |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if>
|
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="playSound != null">#{playSound,jdbcType=BOOLEAN}</if> |
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD">update yeshi_ec_float_ad set fa_name = #{name,jdbcType=VARCHAR},fa_picture = #{picture,jdbcType=VARCHAR},fa_show_mode = #{showMode,jdbcType=VARCHAR},fa_jumpid = #{jumpDetail.id,jdbcType=BIGINT},fa_params = #{params,jdbcType=VARCHAR},fa_jump_need_login = #{jumpNeedLogin,jdbcType=VARCHAR},fa_start_time = #{startTime,jdbcType=TIMESTAMP},fa_end_time = #{endTime,jdbcType=TIMESTAMP},fa_position = #{position,jdbcType=VARCHAR},fa_order = #{order,jdbcType=INTEGER},fa_type = #{type,jdbcType=INTEGER},fa_state = #{state,jdbcType=INTEGER},fa_create_time = #{createTime,jdbcType=TIMESTAMP},fa_update_time = #{updateTime,jdbcType=TIMESTAMP} where fa_id = #{id,jdbcType=BIGINT}</update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD">update yeshi_ec_float_ad
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD">update |
| | | yeshi_ec_float_ad set fa_name = #{name,jdbcType=VARCHAR},fa_picture = |
| | | #{picture,jdbcType=VARCHAR},fa_show_mode = |
| | | #{showMode,jdbcType=VARCHAR},fa_jumpid = |
| | | #{jumpDetail.id,jdbcType=BIGINT},fa_params = |
| | | #{params,jdbcType=VARCHAR},fa_jump_need_login = |
| | | #{jumpNeedLogin,jdbcType=VARCHAR},fa_start_time = |
| | | #{startTime,jdbcType=TIMESTAMP},fa_end_time = |
| | | #{endTime,jdbcType=TIMESTAMP},fa_position = |
| | | #{position,jdbcType=VARCHAR},fa_order = |
| | | #{order,jdbcType=INTEGER},fa_type = #{type,jdbcType=INTEGER},fa_state |
| | | = #{state,jdbcType=INTEGER},fa_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},fa_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,fa_play_sound |
| | | =#{playSound,jdbcType=BOOLEAN} where fa_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD"> |
| | | update yeshi_ec_float_ad |
| | | <set>
|
| | | <if test="name != null">fa_name=#{name,jdbcType=VARCHAR},</if>
|
| | | <if test="picture != null">fa_picture=#{picture,jdbcType=VARCHAR},</if>
|
| | | <if test="showMode != null">fa_show_mode=#{showMode,jdbcType=VARCHAR},</if>
|
| | | <if test="jumpDetail != null">fa_jumpid=#{jumpDetail.id,jdbcType=BIGINT},</if>
|
| | | <if test="params != null">fa_params=#{params,jdbcType=VARCHAR},</if>
|
| | | <if test="jumpNeedLogin != null">fa_jump_need_login=#{jumpNeedLogin,jdbcType=VARCHAR},</if>
|
| | | <if test="jumpNeedLogin != null">fa_jump_need_login=#{jumpNeedLogin,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="startTime != null">fa_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="endTime != null">fa_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="position != null">fa_position=#{position,jdbcType=VARCHAR},</if>
|
| | |
| | | <if test="state != null">fa_state=#{state,jdbcType=INTEGER},</if>
|
| | | <if test="createTime != null">fa_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">fa_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | </set> where fa_id = #{id,jdbcType=BIGINT}
|
| | | <if test="playSound !=null">fa_play_sound =#{playSound,jdbcType=BOOLEAN},</if> |
| | | </set> |
| | | where fa_id = #{id,jdbcType=BIGINT} |
| | | </update>
|
| | | |
| | | <delete id="deleteByPrimaryKeyList" parameterType="java.util.List">
|
| | | delete from yeshi_ec_float_ad |
| | | WHERE fa_id in <foreach collection="list" item="item" open="(" separator="," close=")">#{item}</foreach>
|
| | | delete from yeshi_ec_float_ad WHERE fa_id in |
| | | <foreach collection="list" item="item" open="(" separator="," |
| | | close=")">#{item}</foreach> |
| | | </delete>
|
| | | |
| | | |
| | | <select id="listQuery" resultMap="BaseResultMap">
|
| | | SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_float_ad fd |
| | | WHERE 1=1 |
| | | <if test="key != null and key !='' ">
|
| | | AND fd.`fa_name` LIKE '%${key}%'
|
| | | </if>
|
| | | <if test="state != null">
|
| | | AND fd.`fa_state` = #{state}
|
| | | </if>
|
| | | ORDER BY fd.`fa_position`,fd.`fa_order`
|
| | | LIMIT ${start},${count}
|
| | | SELECT |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_float_ad fd WHERE 1=1 |
| | | <if test="key != null and key !='' ">AND fd.`fa_name` LIKE '%${key}%'</if> |
| | | <if test="state != null">AND fd.`fa_state` = #{state}</if> |
| | | ORDER BY fd.`fa_position`,fd.`fa_order` LIMIT ${start},${count} |
| | | </select>
|
| | | |
| | | <select id="countQuery" resultType="java.lang.Long">
|
| | | SELECT IFNULL(COUNT(fd.`fa_id`),0) FROM yeshi_ec_float_ad fd |
| | | WHERE 1=1 |
| | | <if test="key != null and key !='' ">
|
| | | AND fd.`fa_name` LIKE '%${key}%'
|
| | | </if>
|
| | | <if test="state != null">
|
| | | AND fd.`fa_state` = #{state}
|
| | | </if>
|
| | | SELECT IFNULL(COUNT(fd.`fa_id`),0) FROM yeshi_ec_float_ad fd WHERE 1=1 |
| | | <if test="key != null and key !='' ">AND fd.`fa_name` LIKE '%${key}%'</if> |
| | | <if test="state != null">AND fd.`fa_state` = #{state}</if> |
| | | </select>
|
| | | |
| | | <select id="getMaxOrderByPosition" resultType="java.lang.Integer">
|
| | | SELECT IFNULL(MAX(fa_order),0) FROM yeshi_ec_float_ad
|
| | | WHERE fa_position = #{position}
|
| | | <select id="getMaxOrderByPosition" resultType="java.lang.Integer">SELECT |
| | | IFNULL(MAX(fa_order),0) FROM yeshi_ec_float_ad WHERE fa_position = |
| | | #{position} |
| | | </select>
|
| | | |
| | | <select id="getByAdjoinOrder" resultMap="BaseResultMap">
|
| | | SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_float_ad fd |
| | | WHERE fd.`fa_position` = #{position}
|
| | | <if test="type == -1">
|
| | | AND fd.`fa_order` <![CDATA[<]]> #{order} |
| | | ORDER BY fd.`fa_order` desc
|
| | | SELECT |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_float_ad fd WHERE fd.`fa_position` = #{position} |
| | | <if test="type == -1">AND |
| | | fd.`fa_order` <![CDATA[<]]> |
| | | #{order} ORDER BY fd.`fa_order` desc |
| | | </if>
|
| | | |
| | | <if test="type == 1">
|
| | | AND fd.`fa_order` <![CDATA[>]]> #{order} |
| | | ORDER BY fd.`fa_order` |
| | | <if test="type == 1">AND |
| | | fd.`fa_order` <![CDATA[>]]> |
| | | #{order} ORDER BY fd.`fa_order` |
| | | </if>
|
| | | LIMIT 1
|
| | | </select>
|
| | | |
| | | <select id="countByPosition" resultType="java.lang.Integer">
|
| | | SELECT IFNULL(COUNT(fd.`fa_id`),0) FROM yeshi_ec_float_ad fd |
| | | WHERE fd.`fa_position` = #{position}
|
| | | <select id="countByPosition" resultType="java.lang.Integer">SELECT |
| | | IFNULL(COUNT(fd.`fa_id`),0) FROM yeshi_ec_float_ad fd WHERE |
| | | fd.`fa_position` = #{position} |
| | | </select>
|
| | | |
| | | <select id="ListByPrimaryKey" parameterType="java.util.List" resultMap="BaseResultMap">
|
| | | SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_float_ad
|
| | | WHERE fa_id in <foreach collection="list" item="item" open="(" separator="," close=")">#{item}</foreach>
|
| | | <select id="ListByPrimaryKey" parameterType="java.util.List" |
| | | resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_float_ad WHERE fa_id in |
| | | <foreach collection="list" item="item" open="(" separator="," |
| | | close=")">#{item}</foreach> |
| | | </select>
|
| | | |
| | | <select id="getEffectiveFloatAD" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_float_ad fd |
| | | WHERE fd.`fa_position` = #{position} AND fd.`fa_state` = 1
|
| | | AND IF(fd.`fa_start_time` IS NULL,TRUE,fd.`fa_start_time` <![CDATA[<=]]> NOW()) |
| | | AND IF(fd.`fa_end_time` IS NULL,TRUE,fd.`fa_end_time` <![CDATA[>=]]> NOW())
|
| | | <if test="type != null">
|
| | | AND fa_type = #{type}
|
| | | </if>
|
| | | ORDER BY fd.`fa_order` |
| | | LIMIT 1
|
| | | <select id="getEffectiveFloatAD" resultMap="BaseResultMap">SELECT |
| | | * FROM yeshi_ec_float_ad fd WHERE fd.`fa_position` = #{position} AND |
| | | fd.`fa_state` = 1 AND IF(fd.`fa_start_time` IS |
| | | NULL,TRUE,fd.`fa_start_time`<![CDATA[<=]]> |
| | | NOW()) AND IF(fd.`fa_end_time` IS NULL,TRUE,fd.`fa_end_time` <![CDATA[>=]]> |
| | | NOW()) |
| | | <if test="type != null">AND fa_type = #{type}</if> |
| | | ORDER BY fd.`fa_order` LIMIT 1 |
| | | </select>
|
| | | |
| | | <select id="getValidFloatAD" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_float_ad fd |
| | | WHERE fd.`fa_position` = #{position} AND fd.`fa_state` = 1
|
| | | AND IF(fd.`fa_start_time` IS NULL,TRUE,fd.`fa_start_time` <![CDATA[<=]]> NOW()) |
| | | AND IF(fd.`fa_end_time` IS NULL,TRUE,fd.`fa_end_time` <![CDATA[>=]]> NOW())
|
| | | <if test="type != null">
|
| | | AND fa_type = #{type}
|
| | | </if>
|
| | | <select id="getValidFloatAD" resultMap="BaseResultMap">SELECT |
| | | * FROM yeshi_ec_float_ad fd WHERE fd.`fa_position` = #{position} AND |
| | | fd.`fa_state` = 1 AND IF(fd.`fa_start_time` IS |
| | | NULL,TRUE,fd.`fa_start_time`<![CDATA[<=]]> |
| | | NOW()) AND IF(fd.`fa_end_time` IS NULL,TRUE,fd.`fa_end_time` <![CDATA[>=]]> |
| | | NOW()) |
| | | <if test="type != null">AND fa_type = #{type}</if> |
| | | ORDER BY fd.`fa_order`
|
| | | </select>
|
| | | </mapper>
|
| | |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_order where so_id = #{0} for update |
| | | </select> |
| | | <select id="listByUid" resultMap="BaseResultMap"> |
| | | <select id="listByUidAndState" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_order where so_uid = #{uid} |
| | | from yeshi_ec_shop_order where 1=1 |
| | | |
| | | <if test="uid!=null"> |
| | | and so_uid = #{uid} |
| | | </if> |
| | | |
| | | <if test="stateList!=null"> |
| | | <foreach collection="stateList" item="state" open=" and (" |
| | | close=")" separator=" or ">so_state=#{state}</foreach> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="countByUid" resultType="java.lang.Long"> |
| | | select count(*) from yeshi_ec_shop_order where so_uid = #{uid} |
| | | <select id="countByUidAndState" resultType="java.lang.Long"> |
| | | select count(*) from yeshi_ec_shop_order where 1=1 |
| | | <if test="uid!=null"> |
| | | and so_uid = #{uid} |
| | | </if> |
| | | |
| | | <if test="stateList!=null"> |
| | | <foreach collection="stateList" item="state" open=" and (" |
| | | close=")" separator=" or ">so_state=#{state}</foreach> |
| | | </if> |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_shop_order where so_id = #{id,jdbcType=BIGINT}</delete> |
| | | yeshi_ec_shop_order where so_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.shop.BanLiShopOrder" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_shop_order |
| | | (so_id,so_uid,so_order_no,so_goods_id,so_goods_set_id,so_payment_hongbao,so_payment_hongbao_state,so_payment_money,so_payment_money_state,so_payment_balance,so_payment_balance_state,so_pay_time,so_reject_time,so_success_time,so_state,so_state_desc,so_charge_account,so_charge_account2,so_beizhu,so_create_time,so_update_time,so_order_goods_id,so_charge_account_type) |
| | |
| | | #{updateTime,jdbcType=TIMESTAMP} ,so_order_goods_id |
| | | =#{orderGoods.id,jdbcType=BIGINT} ,so_charge_account_type |
| | | =#{chargeAccountType,jdbcType=VARCHAR} where so_id = |
| | | #{id,jdbcType=BIGINT}</update> |
| | | #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopOrder"> |
| | | update yeshi_ec_shop_order |
| | | <set> |
| | |
| | | </if> |
| | | <if test="hongBaoPaymentState != null">so_payment_hongbao_state=#{hongBaoPaymentState,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="balancePayment != null">so_payment_balance=#{balancePayment,jdbcType=DECIMAL},</if> |
| | | <if test="balancePayment != null">so_payment_balance=#{balancePayment,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="balancePaymentState != null">so_payment_balance_state=#{balancePaymentState,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="moneyPayment != null">so_payment_money=#{moneyPayment,jdbcType=DECIMAL},</if> |
| | |
| | | <if test="updateTime != null">so_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderGoods !=null">so_order_goods_id =#{orderGoods.id,jdbcType=BIGINT},</if> |
| | | <if test="chargeAccountType !=null">so_charge_account_type |
| | | =#{chargeAccountType,jdbcType=VARCHAR},</if> |
| | | =#{chargeAccountType,jdbcType=VARCHAR}, |
| | | </if> |
| | | </set> |
| | | where so_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | if (setList != null)
|
| | | for (BanLiShopGoodsSets set : setList)
|
| | | banLiShopGoodsSetService.deleteByPrimaryKey(set.getId());
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addSalesCount(Long id, int count) {
|
| | | BanLiShopGoods goods = selectByPrimaryKey(id);
|
| | | if (goods != null) {
|
| | | BanLiShopGoods update = new BanLiShopGoods(id);
|
| | | update.setSalesCount(goods.getSalesCount() + count);
|
| | | update.setUpdateTime(new Date());
|
| | | updateSelectiveByPrimaryKey(goods);
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<BanLiShopGoodsSets> listQuery(int page, int pageSize, String key) {
|
| | | return banLiShopGoodsSetsMapper.listQuery((page - 1) * pageSize, pageSize, key);
|
| | |
| | | return banLiShopGoodsSetsMapper.countQuery(key);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addSalesCount(Long id, int count) {
|
| | | BanLiShopGoodsSets set = banLiShopGoodsSetsMapper.selectByPrimaryKey(id);
|
| | | BanLiShopGoodsSets update = new BanLiShopGoodsSets();
|
| | | update.setId(set.getId());
|
| | | update.setSalesCount(set.getSalesCount() + count);
|
| | | update.setStock(set.getStock() - count);
|
| | | banLiShopGoodsSetsMapper.updateByPrimaryKeySelective(update); |
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | | import org.yeshi.utils.exception.WXOrderException;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | |
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsClass;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.entity.shop.ChargeTypeEnum;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackDetailException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopOrderException;
|
| | | import com.yeshi.fanli.exception.shop.FuLuChargeException;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackDetailService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsClassService;
|
| | |
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderPayService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.charge.FuLuChargeApiUtil;
|
| | | import com.yeshi.fanli.util.factory.RedPackDetailFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.wx.BanLiShopWXPayUtil;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void charge(Long orderId) throws BanLiShopOrderException {
|
| | | BanLiShopOrder order = banLiShopOrderService.selectByPrimaryKey(orderId);
|
| | | if (order == null)
|
| | | throw new BanLiShopOrderException(1, "订单不存在");
|
| | | if (order.getState() != BanLiShopOrder.STATE_PAID) {
|
| | | throw new BanLiShopOrderException(100, "订单不是处于付款状态");
|
| | | }
|
| | | if (order.getChargeAccountType() == ChargeTypeEnum.phone) {
|
| | | if (!StringUtil.isMobile(order.getChargeAccount())) {
|
| | | throw new BanLiShopOrderException(101, "电话号码格式不正确");
|
| | | }
|
| | | } else if (order.getChargeAccountType() == ChargeTypeEnum.qq) {
|
| | | if (!NumberUtil.isNumeric(order.getChargeAccount())) {
|
| | | throw new BanLiShopOrderException(101, "QQ号格式错误");
|
| | | }
|
| | | } else {
|
| | | throw new BanLiShopOrderException(102, "非充值商品");
|
| | | }
|
| | | // 获取福禄的套餐
|
| | | BanLiShopGoodsSets set = banLiShopGoodsSetService.selectByPrimaryKey(order.getGoodsSet().getId());
|
| | | if (set == null) {
|
| | | throw new BanLiShopOrderException(104, "商品套餐已下线");
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(set.getChargeFuLuNum())) {
|
| | | throw new BanLiShopOrderException(105, "福禄充值ID为空");
|
| | | }
|
| | |
|
| | | // 改变状态为成功
|
| | | BanLiShopOrder update = new BanLiShopOrder(order.getId());
|
| | | update.setState(BanLiShopOrder.STATE_SUCCESS);
|
| | | update.setStateDesc("充值成功");
|
| | | update.setUpdateTime(new Date());
|
| | | update.setSuccessTime(new Date());
|
| | | banLiShopOrderService.udpateSelectiveByPrimaryKey(update);
|
| | |
|
| | | try {
|
| | | if (Constant.IS_TEST) {
|
| | | FuLuChargeApiUtil.shaXiangCharge(set.getChargeFuLuNum(), "banlishop" + order.getOrderNo(),
|
| | | order.getChargeAccount());
|
| | | } else
|
| | | FuLuChargeApiUtil.charge(set.getChargeFuLuNum(), "banlishop" + order.getOrderNo(),
|
| | | order.getChargeAccount());
|
| | | } catch (FuLuChargeException e) {
|
| | | throw new BanLiShopOrderException(e.getCode(), e.getMsg());
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | order.setOrderNo(orderNo);
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | |
|
| | | // 增加销量
|
| | | banLiShopGoodsSetService.addSalesCount(order.getGoodsSet().getId(), 1);
|
| | | banLiShopGoodsService.addSalesCount(order.getGoods().getId(), 1);
|
| | |
|
| | | // 订单添加成功 ,延时通知后续
|
| | | sendPlaceOrderMsg(order.getId(), order.getUid());
|
| | | }
|
| | |
| | | @Override
|
| | | public List<BanLiShopOrder> listByUid(Long uid, int page, int pageSize) {
|
| | |
|
| | | return banLiShopOrderMapper.listByUid(null, uid, (page - 1) * pageSize, pageSize);
|
| | | return banLiShopOrderMapper.listByUidAndState(null, uid, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByUid(Long uid) {
|
| | | return banLiShopOrderMapper.countByUid(null, uid);
|
| | | return banLiShopOrderMapper.countByUidAndState(null, uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | update.setState(BanLiShopOrder.STATE_REJECT);
|
| | | update.setStateDesc(msg);
|
| | | update.setUpdateTime(new Date());
|
| | | update.setRejectTime(new Date());
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | | transactionManager.commit(transactionStatus);
|
| | | } catch (Exception e) {
|
| | |
| | | return banLiShopOrderMapper.selectByOrderNo(orderNo);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<BanLiShopOrder> listByUidAndState(Long uid, List<Integer> stateList, int page, int pageSize) {
|
| | | return banLiShopOrderMapper.listByUidAndState(stateList, uid, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByUidAndState(Long uid, List<Integer> stateList) {
|
| | | return banLiShopOrderMapper.countByUidAndState(stateList, uid);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * @param id
|
| | | */
|
| | | public void deleteByPrimaryKey(Long id);
|
| | | |
| | | /**
|
| | | * 增加销量
|
| | | * @param id
|
| | | * @param count
|
| | | */
|
| | | public void addSalesCount(Long id,int count);
|
| | | |
| | |
|
| | | }
|
| | |
| | | public List<BanLiShopGoodsSets> listQuery(int page, int pageSize, String key);
|
| | |
|
| | | public long countQuery(String key);
|
| | | |
| | | /**
|
| | | * 销量增加
|
| | | * @param id
|
| | | * @param count
|
| | | */
|
| | | public void addSalesCount(Long id,int count);
|
| | |
|
| | | }
|
| | |
| | | * @throws BanLiShopOrderException
|
| | | */
|
| | | public void refund(Long orderId) throws BanLiShopOrderException;
|
| | |
|
| | | /**
|
| | | * 充值(按照订单号)
|
| | | * |
| | | * @param orderId
|
| | | * @throws BanLiShopOrderException
|
| | | */
|
| | | public void charge(Long orderId) throws BanLiShopOrderException;
|
| | | }
|
| | |
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopOrderException;
|
| | |
| | | */
|
| | | public void addOrder(BanLiShopOrder order) throws BanLiShopOrderException;
|
| | |
|
| | | |
| | | /**
|
| | | * 构造订单
|
| | | * |
| | | * @param pay
|
| | | * @param uid
|
| | | * @return
|
| | | * @throws BanLiShopOrderException
|
| | | */
|
| | | public BanLiShopOrder createOrder(Long goodsSetPayId,String chargeAccount,Long uid) throws BanLiShopOrderException;;
|
| | | public BanLiShopOrder createOrder(Long goodsSetPayId, String chargeAccount, Long uid)
|
| | | throws BanLiShopOrderException;;
|
| | |
|
| | | /**
|
| | | * 使订单失效
|
| | |
| | | public long countByUid(Long uid);
|
| | |
|
| | | /**
|
| | | * 根据用户ID,状态查询
|
| | | * |
| | | * @param uid
|
| | | * @param stateList
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | public List<BanLiShopOrder> listByUidAndState(Long uid, List<Integer> stateList, int page, int pageSize);
|
| | |
|
| | | /**
|
| | | * 根据用户ID,状态查询
|
| | | * |
| | | * @param uid
|
| | | * @param stateList
|
| | | * @return
|
| | | */
|
| | | public long countByUidAndState(Long uid, List<Integer> stateList);
|
| | |
|
| | | /**
|
| | | * 根据主键检索
|
| | | *
|
| | | * @param id
|
| | |
| | |
|
| | | /**
|
| | | * 根据订单号查询
|
| | | * |
| | | * @param orderNo
|
| | | * @return
|
| | | */
|
| | |
| | | import org.apache.commons.httpclient.HttpException;
|
| | | import org.apache.commons.httpclient.methods.PostMethod;
|
| | |
|
| | | import com.yeshi.fanli.exception.shop.FuLuChargeException;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | |
| | | */
|
| | | public class FuLuChargeApiUtil {
|
| | | //测试
|
| | | // private final static String APP_KEY = "i4esv1l+76l/7NQCL3QudG90Fq+YgVfFGJAWgT+7qO1Bm9o/adG/1iwO2qXsAXNB";
|
| | | // private final static String APP_SECRET = "0a091b3aa4324435aab703142518a8f7";
|
| | | private final static String APP_KEY = "i4esv1l+76l/7NQCL3QudG90Fq+YgVfFGJAWgT+7qO1Bm9o/adG/1iwO2qXsAXNB";
|
| | | private final static String APP_SECRET = "0a091b3aa4324435aab703142518a8f7";
|
| | | //正式
|
| | | private final static String APP_KEY = "CrtDnTh1E5eYY5D42T8uArVrl4GWq9AWR9ZrNC2qvXYIBMwOTuiJQy7YYaJSYlb6";
|
| | | private final static String APP_SECRET = "a5f6c827903e4b1eac6eb2ba2cf715be";
|
| | | // private final static String APP_KEY =
|
| | | // "CrtDnTh1E5eYY5D42T8uArVrl4GWq9AWR9ZrNC2qvXYIBMwOTuiJQy7YYaJSYlb6";
|
| | | // private final static String APP_SECRET =
|
| | | // "a5f6c827903e4b1eac6eb2ba2cf715be";
|
| | |
|
| | | @SuppressWarnings("deprecation")
|
| | | private static String post(String url, String body) {
|
| | | HttpClient client = new HttpClient();
|
| | | client.getHostConfiguration().setProxy("192.168.1.122", 8888);
|
| | | // client.getHostConfiguration().setProxy("192.168.1.122", 8888);
|
| | | PostMethod method = new PostMethod(url);
|
| | | method.addRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
| | | method.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | private static void baseRequest(String method, JSONObject bizContent) {
|
| | | // String url = "http://pre.openapi.fulu.com/api/getway";
|
| | | String url="http://openapi.fulu.com/api/getway";
|
| | | private static void baseRequest(String method, JSONObject bizContent) throws FuLuChargeException {
|
| | | String url = "http://pre.openapi.fulu.com/api/getway";
|
| | | // String url = "http://openapi.fulu.com/api/getway";
|
| | | Map<String, String> params = new HashMap<>();
|
| | | params.put("app_key", APP_KEY);
|
| | | params.put("method", method);
|
| | |
| | | params.put("sign", sign);
|
| | | String result = post(url, JSONObject.fromObject(params).toString());
|
| | | System.out.println(result);
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | {
|
| | | if (json.optInt("code") != 0) {// 成功
|
| | | throw new FuLuChargeException(json.optInt("code"), json.optString("message"));
|
| | | } else {
|
| | | }
|
| | | }
|
| | |
|
| | | public static void charge(String goodsNo, String orderId, String account) {
|
| | | }
|
| | |
|
| | | /**
|
| | | * 充值
|
| | | * |
| | | * @param goodsNo-商品编号
|
| | | * @param orderId-商户订单号
|
| | | * @param account-数量
|
| | | */
|
| | | public static void charge(String goodsNo, String orderId, String account) throws FuLuChargeException {
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("charge_type", "爱奇艺会员");
|
| | | json.put("customer_order_no", orderId);
|
| | |
| | | baseRequest("fulu.order.direct.add", json);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 沙箱充值
|
| | | */
|
| | | public static void shaXiangCharge(String goodsNo, String orderId, String account) throws FuLuChargeException {
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("charge_type", "爱奇艺会员");
|
| | | json.put("customer_order_no", orderId);
|
| | | json.put("product_id", "10000586 ");
|
| | | json.put("charge_account", account);
|
| | | json.put("buy_num", "1");
|
| | | baseRequest("fulu.order.direct.add", json);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * @param money
|
| | | * @return
|
| | | */
|
| | | public static String getWXH5PayUrl(String orderNo, String ip, String goodsName, BigDecimal money) {
|
| | | public static String getWXH5PayUrl(String orderNo, String ip, String goodsName, BigDecimal money, String platform) {
|
| | | String wxOrderNo = BanLiShopOrderUtil.getWXPayOrderNo(orderNo);
|
| | | WXPlaceOrderParams params = new WXPlaceOrderParams();
|
| | | params.setBody(goodsName);
|
| | |
| | | params.setTradeType("MWEB");
|
| | | try {
|
| | | Map<String, String> map = WXPayUtil.produceOrder(params);
|
| | | return map.get("mweb_url") + "&redirect_url=" + URLEncoder
|
| | | .encode("http://shop.banliapp.com/order.html?from=pay", "UTF-8");
|
| | | if ("ios".equalsIgnoreCase(platform))
|
| | | return map.get("mweb_url") + "&redirect_url="
|
| | | + URLEncoder.encode("shop.banliapp.com://shop.banliapp.com/order.html?from=pay", "UTF-8");
|
| | | else
|
| | | return map.get("mweb_url") + "&redirect_url="
|
| | | + URLEncoder.encode("http://shop.banliapp.com/order.html?from=pay", "UTF-8");
|
| | | } catch (WXPlaceOrderParamsException e) {
|
| | | e.printStackTrace();
|
| | | } catch (Exception e) {
|
| | |
| | | private String showTime;
|
| | | @Expose
|
| | | private boolean accountLogin;
|
| | | @Expose
|
| | | private boolean playSound;
|
| | |
|
| | | public boolean isPlaySound() {
|
| | | return playSound;
|
| | | }
|
| | |
|
| | | public void setPlaySound(boolean playSound) {
|
| | | this.playSound = playSound;
|
| | | }
|
| | |
|
| | | public String getImg() {
|
| | | return img;
|