New file |
| | |
| | | package com.yeshi.fanli.controller.client;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.DateUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("api/v1/user/order")
|
| | | public class UserOrderController {
|
| | | |
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | | |
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | /**
|
| | | * 订单列表
|
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param uid
|
| | | * @param state 状态:1-未到账 3-已到账 4-已失效
|
| | | * @param type 类型:1-返利订单 2-分享订单 3-邀请订单
|
| | | * @param orderNo 订单号 |
| | | * @param startTime 起始时间
|
| | | * @param endTime 结束时间
|
| | | * @param slotTime 时间段:1-最近三天 2-最近七天 3最近半月 4本月 5近三月 6近半年
|
| | | * @param needCount
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getorder", method = RequestMethod.POST)
|
| | | public void getOrder(AcceptData acceptData, Long page, Long uid, Integer state, Integer type, String orderNo, |
| | | String startTime, String endTime, Integer slotTime, boolean needCount, PrintWriter out) {
|
| | | |
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (page == null || page < 1) {
|
| | | page = 1L;
|
| | | }
|
| | | |
| | | if (state !=null && state == 0) {
|
| | | state = null;
|
| | | }
|
| | | |
| | | if (type != null && type == 0 ) {
|
| | | type = null; // 查询所有类型订单
|
| | | }
|
| | | |
| | | try {
|
| | | if (slotTime != null) {
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
| | | startTime = sd.format(new Date());
|
| | | endTime = convertDate(slotTime, startTime);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | try {
|
| | | long count = 0;
|
| | | List<CommonOrderVO> list = commonOrderService.getOrderByUid(page, uid, state, type, orderNo,
|
| | | startTime, endTime);
|
| | | |
| | | if (list != null && list.size() > 0) {
|
| | | count = commonOrderService.countGroupOrderNoByUid(uid, state, type, orderNo, startTime, endTime);
|
| | | }
|
| | | |
| | | int totalValid = 0;
|
| | | int totalProces = 0;
|
| | | int totalInvite = 0;
|
| | | long todayTotal = 0;
|
| | | BigDecimal todayMoney = null;
|
| | | // 需要统计信息
|
| | | if (needCount && page == 1) {
|
| | | Map<String, BigDecimal> countOrder = commonOrderService.countByUidAndOrderState(uid, type, startTime, endTime);
|
| | | |
| | | if (countOrder.get("totalValid") != null) {
|
| | | totalValid = countOrder.get("totalValid").intValue();
|
| | | } |
| | | |
| | | if (countOrder.get("totalProces") != null) {
|
| | | totalProces = countOrder.get("totalProces").intValue();
|
| | | } |
| | | |
| | | if (countOrder.get("totalInvite") != null) {
|
| | | totalInvite = countOrder.get("totalInvite").intValue();
|
| | | } |
| | | |
| | | todayTotal = commonOrderService.countOrder(uid, 1);
|
| | | todayMoney = commonOrderService.countOrderMoney(uid, 1);
|
| | | }
|
| | | |
| | | if (todayMoney == null) {
|
| | | todayMoney = new BigDecimal(0);
|
| | | }
|
| | | |
| | | String helpUrl = configService.get("order_list_help");
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("result_list", JsonUtil.getApiCommonGson().toJson(list));
|
| | | |
| | | data.put("helpUrl", helpUrl);
|
| | | |
| | | data.put("todayTotal", todayTotal);
|
| | | data.put("todayMoney", todayMoney);
|
| | | data.put("totalValid", totalValid); // 有效数量
|
| | | data.put("totalProces", totalProces); // 维权数量
|
| | | data.put("totalInvite", totalInvite); // 失效数量
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch(CommonOrderException e){
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | /**
|
| | | * 用户订单统计
|
| | | * @param acceptData
|
| | | * @param uid 用户id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "countorder", method = RequestMethod.POST)
|
| | | public void countOrder(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | |
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | UserInfo user = userInfoService.selectByPKey(uid);
|
| | | if (user == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | UserInfo userInfo = UserUtil.filterForClientUser(user);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("userInfo", userInfo);
|
| | | |
| | | /* 总订单统计 */
|
| | | Map<String, BigDecimal> countOrder= commonOrderService.countOrderByHongBaoType(uid, null);
|
| | | int self = 0;
|
| | | if (countOrder.get("totalSelf") != null) {
|
| | | self = countOrder.get("totalSelf").intValue();
|
| | | } |
| | | |
| | | int shared = 0;
|
| | | if (countOrder.get("totalShared") != null) {
|
| | | shared = countOrder.get("totalShared").intValue();
|
| | | } |
| | | |
| | | int invite = 0;
|
| | | if (countOrder.get("totalInvite") != null) {
|
| | | invite = countOrder.get("totalInvite").intValue();
|
| | | } |
| | | |
| | | int total = self + shared + invite;
|
| | | |
| | | data.put("total", total);
|
| | | data.put("self", self);
|
| | | data.put("shared", shared);
|
| | | data.put("invite", invite);
|
| | | |
| | | /* 今日订单统计 */
|
| | | Map<String, BigDecimal> countToday= commonOrderService.countOrderByHongBaoType(uid, 1);
|
| | | |
| | | int todaySelf = 0;
|
| | | if (countToday.get("totalSelf") != null) {
|
| | | todaySelf = countToday.get("totalSelf").intValue();
|
| | | } |
| | | |
| | | int todayShared = 0;
|
| | | if (countToday.get("totalShared") != null) {
|
| | | todayShared = countToday.get("totalShared").intValue();
|
| | | } |
| | | |
| | | int todayInvite = 0;
|
| | | if (countToday.get("totalInvite") != null) {
|
| | | todayInvite = countToday.get("totalInvite").intValue();
|
| | | } |
| | | |
| | | int todayTotal = todaySelf + todayShared + todayInvite;
|
| | | |
| | | JSONObject todaydata = new JSONObject();
|
| | | todaydata.put("total", todayTotal);
|
| | | todaydata.put("self", todaySelf);
|
| | | todaydata.put("shared", todayShared);
|
| | | todaydata.put("invite", todayInvite);
|
| | | |
| | | data.put("today", todaydata);
|
| | | |
| | | /* 昨日订单统计 */
|
| | | Map<String, BigDecimal> countYesterday= commonOrderService.countOrderByHongBaoType(uid, 2);
|
| | | int yesterdaySelf = 0;
|
| | | if (countYesterday.get("totalSelf") != null) {
|
| | | yesterdaySelf = countYesterday.get("totalSelf").intValue();
|
| | | } |
| | | |
| | | int yesterdayShared = 0;
|
| | | if (countYesterday.get("totalShared") != null) {
|
| | | yesterdayShared = countYesterday.get("totalShared").intValue();
|
| | | } |
| | | int yesterdayInvite = 0;
|
| | | if (countYesterday.get("totalInvite") != null) {
|
| | | yesterdayInvite = countYesterday.get("totalInvite").intValue();
|
| | | } |
| | | int yesterdayTotal = yesterdaySelf + yesterdayShared + yesterdayInvite;
|
| | | |
| | | JSONObject yesterdaydata = new JSONObject();
|
| | | yesterdaydata.put("total", yesterdayTotal);
|
| | | yesterdaydata.put("self", yesterdaySelf);
|
| | | yesterdaydata.put("shared", yesterdayShared);
|
| | | yesterdaydata.put("invite", yesterdayInvite);
|
| | | |
| | | data.put("yesterday", yesterdaydata);
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "获取信息失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 统计今日订单收入 以及订单数量
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "countToday", method = RequestMethod.POST)
|
| | | public void countToday(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | |
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | long count = commonOrderService.countOrder(uid, 1);
|
| | | BigDecimal money = commonOrderService.countOrderMoney(uid, 1);
|
| | | |
| | | if (money == null) {
|
| | | money = new BigDecimal(0);
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("money", money);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "获取信息失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 时间转换
|
| | | * @param slotTime
|
| | | * @param startTime
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public String convertDate (Integer slotTime, String startTime) throws Exception {
|
| | | String endTime = null;
|
| | | |
| | | switch (slotTime) {
|
| | | case 1: // 最近三天
|
| | | endTime = DateUtil.plusDay(3, startTime);
|
| | | break;
|
| | | case 2: // 最近七天
|
| | | endTime = DateUtil.plusDay(7, startTime);
|
| | | break;
|
| | | case 3: // 最近15天 (半月)
|
| | | endTime = DateUtil.plusDay(15, startTime);
|
| | | break;
|
| | | case 4: // 最近三十天 (本月)
|
| | | endTime = DateUtil.plusDay(30, startTime);
|
| | | break;
|
| | | case 5: // 最近九十天(近三月)
|
| | | endTime = DateUtil.plusDay(3*30, startTime);
|
| | | break;
|
| | | case 6: // 最近一百八十天(近半年)
|
| | | endTime = DateUtil.plusDay(6*30, startTime);
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | }
|
| | | |
| | | return endTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | | |
| | | public interface HongBaoV2Mapper extends BaseMapper<HongBaoV2> { |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods; |
| | | |
| | | public interface CommonOrderGoodsMapper extends BaseMapper<CommonOrderGoods>{ |
| | | |
| | | /** |
| | | * 根据订单号、订单类型查询商品 |
| | | * @param list 订单对象 |
| | | * @return |
| | | */ |
| | | List<CommonOrderGoods> listByOrderNoAndType(List<CommonOrder> list); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.vo.order.CommonOrderVO; |
| | | |
| | | public interface CommonOrderMapper extends BaseMapper<CommonOrder> { |
| | | |
| | | /** |
| | | * 查询用户订单 并订单号分组 |
| | | * @param start |
| | | * @param count |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<CommonOrderVO> listGroupOrderNoByUid(@Param("start") long start, @Param("count") int count, |
| | | @Param("uid") Long uid,@Param("state") Integer state, @Param("type") Integer type, |
| | | @Param("orderNo")String orderNo, @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | |
| | | |
| | | /** |
| | | * 统计用户订单 并订单号分组 |
| | | * @param start |
| | | * @param count |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | long countGroupOrderNoByUid(@Param("uid") Long uid, @Param("state") Integer state, |
| | | @Param("type") Integer type, @Param("orderNo")String orderNo, |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | |
| | | /** |
| | | * 根据订单号、订单类型查询商品 |
| | | * @param list 订单对象 |
| | | * @return |
| | | */ |
| | | List<CommonOrderVO> listByOrderNoAndType(List<CommonOrderVO> list); |
| | | |
| | | /** |
| | | * 统计订单-根据红包类型 自购 邀请 分享 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | Map<String, BigDecimal> countOrderByHongBaoType(@Param("uid") Long uid, @Param("day") Integer day); |
| | | |
| | | |
| | | /** |
| | | * 总订单 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | long countOrder(@Param("uid")Long uid, @Param("isToday")Integer isToday); |
| | | |
| | | /** |
| | | * 总订单 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | BigDecimal countOrderMoney(@Param("uid")Long uid, @Param("isToday")Integer isToday); |
| | | |
| | | |
| | | /** |
| | | * 昨日总订单-根据红包类型 自购 邀请 分享 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | Map<String, BigDecimal> countByUidAndOrderState(@Param("uid") Long uid, @Param("type") Integer type, |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.order.HongBaoOrder; |
| | | |
| | | public interface HongBaoOrderMapper extends BaseMapper<HongBaoOrder> { |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 订单-简版
|
| | | * |
| | | * @author yj
|
| | | *
|
| | | * @date 2018年12月23日
|
| | | */
|
| | |
|
| | | @Table("yeshi_ec_hongbao_v2")
|
| | | public class HongBaoV2 implements Serializable {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | // 状态编号 1-未到时间不可领取 2-可领取 3-已经领取 4-红包失效
|
| | | public final static int STATE_BUKELINGQU = 1;
|
| | | public final static int STATE_KELINGQU = 2;
|
| | | public final static int STATE_YILINGQU = 3;
|
| | | public final static int STATE_SHIXIAO = 4;
|
| | | |
| | | // 5-部分失效
|
| | | public final static int STATE_BUFENSHIXIAO = 5;
|
| | |
|
| | | // 自购红包 老版 2属于自购
|
| | | public final static int TYPE_ZIGOU = 1;
|
| | | // 活动红包
|
| | | public final static int TYPE_HUODONG = 3;
|
| | | // 新人红包
|
| | | public final static int TYPE_XINREN = 4;
|
| | | |
| | |
|
| | | public final static int TYPE_YAOQING = 5;
|
| | | // 一级分销红包
|
| | | public final static int TYPE_YIJI = 6;
|
| | | // 二级分销红包
|
| | | public final static int TYPE_ERJI = 7;
|
| | | |
| | | // 分享商品得来的红包
|
| | | public final static int TYPE_SHARE_GOODS = 20;
|
| | | // 一级分享赚分销红包
|
| | | public final static int TYPE_SHARE_YIJI = 21;
|
| | | // 二级分享赚分销红包
|
| | | public final static int TYPE_SHARE_ERJI = 22;
|
| | |
|
| | |
|
| | | @Column(name = "hb_id")
|
| | | private Long id;
|
| | |
|
| | | // 用户id
|
| | | @Column(name = "hb_uid")
|
| | | private UserInfo userInfo;
|
| | |
|
| | | // 订单号
|
| | | @Column(name = "hb_urank")
|
| | | private Integer urank;
|
| | |
|
| | | // 类型:淘宝/京东
|
| | | @Column(name = "hb_pid")
|
| | | private HongBaoV2 parent;
|
| | |
|
| | | // 商品
|
| | | @Column(name = "hb_money")
|
| | | private BigDecimal money;
|
| | |
|
| | | // 商品数
|
| | | @Column(name = "hb_type")
|
| | | private Integer type;
|
| | |
|
| | | // 状态:订单付款、订单失效、订单结算
|
| | | @Column(name = "hb_state")
|
| | | private Integer state;
|
| | |
|
| | | // 效果预估
|
| | | @Column(name = "hb_version")
|
| | | private Integer version;
|
| | |
|
| | | // 预估收入
|
| | | @Column(name = "hb_beizhu")
|
| | | private String beizhu;
|
| | |
|
| | | // 付款金额
|
| | | @Column(name = "hb_pre_get_time")
|
| | | private Date preGetTime;
|
| | |
|
| | | // 结算金额
|
| | | @Column(name = "hb_get_time")
|
| | | private Date getTime;
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "cog_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | // 更新时间
|
| | | @Column(name = "cog_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public HongBaoV2() {
|
| | |
|
| | | }
|
| | |
|
| | | public HongBaoV2(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public UserInfo getUserInfo() {
|
| | | return userInfo;
|
| | | }
|
| | |
|
| | | public void setUserInfo(UserInfo userInfo) {
|
| | | this.userInfo = userInfo;
|
| | | }
|
| | |
|
| | | public Integer getUrank() {
|
| | | return urank;
|
| | | }
|
| | |
|
| | | public void setUrank(Integer urank) {
|
| | | this.urank = urank;
|
| | | }
|
| | |
|
| | | public HongBaoV2 getParent() {
|
| | | return parent;
|
| | | }
|
| | |
|
| | | public void setParent(HongBaoV2 parent) {
|
| | | this.parent = parent;
|
| | | }
|
| | |
|
| | | public BigDecimal getMoney() {
|
| | | return money;
|
| | | }
|
| | |
|
| | | public void setMoney(BigDecimal money) {
|
| | | this.money = money;
|
| | | }
|
| | |
|
| | | public Integer getType() {
|
| | | return type;
|
| | | }
|
| | |
|
| | | public void setType(Integer type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public Integer getVersion() {
|
| | | return version;
|
| | | }
|
| | |
|
| | | public void setVersion(Integer version) {
|
| | | this.version = version;
|
| | | }
|
| | |
|
| | | public String getBeizhu() {
|
| | | return beizhu;
|
| | | }
|
| | |
|
| | | public void setBeizhu(String beizhu) {
|
| | | this.beizhu = beizhu;
|
| | | }
|
| | |
|
| | | public Date getPreGetTime() {
|
| | | return preGetTime;
|
| | | }
|
| | |
|
| | | public void setPreGetTime(Date preGetTime) {
|
| | | this.preGetTime = preGetTime;
|
| | | }
|
| | |
|
| | | public Date getGetTime() {
|
| | | return getTime;
|
| | | }
|
| | |
|
| | | public void setGetTime(Date getTime) {
|
| | | this.getTime = getTime;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
|
| | | /**
|
| | | * 订单-简版
|
| | | * |
| | | * @author yj
|
| | | *
|
| | | * @date 2018年12月23日
|
| | | */
|
| | |
|
| | | @Table("yeshi_ec_common_order")
|
| | | public class CommonOrder {
|
| | |
|
| | | // 订单状态 1-付款,成功 2-结算(已收货) 3-维权 4-失效
|
| | | public final static int STATE_FK = 1;
|
| | | public final static int STATE_JS = 2;
|
| | | public final static int STATE_WQ = 3;
|
| | | public final static int STATE_SX = 4;
|
| | | |
| | | // 订单红包类型图片
|
| | | public final static String TYPE_FANLI = "http://ec-1255749512.file.myqcloud.com/resource/order/icon_fanli.png";
|
| | | public final static String TYPE_INVITE = "http://ec-1255749512.file.myqcloud.com/resource/order/icon_invite.png";
|
| | | public final static String TYPE_SHARE = "http://ec-1255749512.file.myqcloud.com/resource/order/icon_share.png";
|
| | | |
| | | |
| | | @Column(name = "co_id")
|
| | | private Long id;
|
| | |
|
| | | // 用户id
|
| | | @Column(name = "co_uid")
|
| | | private UserInfo userInfo;
|
| | |
|
| | | // 订单号
|
| | | @Expose
|
| | | @Column(name = "co_order_no")
|
| | | private String orderNo;
|
| | |
|
| | | // 类型:淘宝/京东
|
| | | @Expose
|
| | | @Column(name = "co_source_type")
|
| | | private Integer sourceType;
|
| | |
|
| | | // 组合来源
|
| | | @Column(name = "co_source_position")
|
| | | private String sourcePosition;
|
| | |
|
| | | // 商品
|
| | | @Expose
|
| | | @Column(name = "co_order_goods_id")
|
| | | private CommonOrderGoods commonOrderGoods;
|
| | |
|
| | | // 商品数
|
| | | @Column(name = "co_count")
|
| | | private Integer count;
|
| | |
|
| | | // 状态:订单付款、订单失效、订单结算
|
| | | @Expose
|
| | | @Column(name = "co_state")
|
| | | private Integer state;
|
| | |
|
| | | // 效果预估
|
| | | @Column(name = "co_estimate")
|
| | | private BigDecimal estimate;
|
| | |
|
| | | // 预估收入
|
| | | @Column(name = "co_eIncome")
|
| | | private BigDecimal eIncome;
|
| | |
|
| | | // 付款金额
|
| | | @Column(name = "co_payment")
|
| | | private BigDecimal payment;
|
| | |
|
| | | // 结算金额
|
| | | @Column(name = "co_settlement")
|
| | | private BigDecimal settlement;
|
| | |
|
| | | // 下单时间-第三方创建时间
|
| | | @Column(name = "co_third_create_time")
|
| | | private Date thirdCreateTime;
|
| | | |
| | | // 收货时间-结算时间
|
| | | @Column(name = "co_settle_time")
|
| | | private Date settleTime;
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "co_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | // 更新时间
|
| | | @Column(name = "co_update_time")
|
| | | private Date updateTime;
|
| | | |
| | | public CommonOrder() {
|
| | |
|
| | | }
|
| | | |
| | | public CommonOrder(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public UserInfo getUserInfo() {
|
| | | return userInfo;
|
| | | }
|
| | |
|
| | | public void setUserInfo(UserInfo userInfo) {
|
| | | this.userInfo = userInfo;
|
| | | }
|
| | |
|
| | | public String getOrderNo() {
|
| | | return orderNo;
|
| | | }
|
| | |
|
| | | public void setOrderNo(String orderNo) {
|
| | | this.orderNo = orderNo;
|
| | | }
|
| | |
|
| | | public Integer getSourceType() {
|
| | | return sourceType;
|
| | | }
|
| | |
|
| | | public void setSourceType(Integer sourceType) {
|
| | | this.sourceType = sourceType;
|
| | | }
|
| | |
|
| | | public String getSourcePosition() {
|
| | | return sourcePosition;
|
| | | }
|
| | |
|
| | | public void setSourcePosition(String sourcePosition) {
|
| | | this.sourcePosition = sourcePosition;
|
| | | }
|
| | |
|
| | | public CommonOrderGoods getCommonOrderGoods() {
|
| | | return commonOrderGoods;
|
| | | }
|
| | |
|
| | | public void setCommonOrderGoods(CommonOrderGoods commonOrderGoods) {
|
| | | this.commonOrderGoods = commonOrderGoods;
|
| | | }
|
| | |
|
| | | public Integer getCount() {
|
| | | return count;
|
| | | }
|
| | |
|
| | | public void setCount(Integer count) {
|
| | | this.count = count;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public BigDecimal getEstimate() {
|
| | | return estimate;
|
| | | }
|
| | |
|
| | | public void setEstimate(BigDecimal estimate) {
|
| | | this.estimate = estimate;
|
| | | }
|
| | |
|
| | | public BigDecimal geteIncome() {
|
| | | return eIncome;
|
| | | }
|
| | |
|
| | | public void seteIncome(BigDecimal eIncome) {
|
| | | this.eIncome = eIncome;
|
| | | }
|
| | |
|
| | | public BigDecimal getPayment() {
|
| | | return payment;
|
| | | }
|
| | |
|
| | | public void setPayment(BigDecimal payment) {
|
| | | this.payment = payment;
|
| | | }
|
| | |
|
| | | public BigDecimal getSettlement() {
|
| | | return settlement;
|
| | | }
|
| | |
|
| | | public void setSettlement(BigDecimal settlement) {
|
| | | this.settlement = settlement;
|
| | | }
|
| | |
|
| | | public Date getThirdCreateTime() {
|
| | | return thirdCreateTime;
|
| | | }
|
| | |
|
| | | public void setThirdCreateTime(Date thirdCreateTime) {
|
| | | this.thirdCreateTime = thirdCreateTime;
|
| | | }
|
| | |
|
| | | public Date getSettleTime() {
|
| | | return settleTime;
|
| | | }
|
| | |
|
| | | public void setSettleTime(Date settleTime) {
|
| | | this.settleTime = settleTime;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.order;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | | /**
|
| | | * 订单商品-简版
|
| | | * |
| | | * @author yj
|
| | | *
|
| | | * @date 2018年12月23日
|
| | | */
|
| | |
|
| | | @Table("yeshi_ec_common_order_goods")
|
| | | public class CommonOrderGoods implements Serializable {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | // 淘宝
|
| | | public final static int TYPE_TAOBAO = 1;
|
| | | // 京东
|
| | | public final static int TYPE_JINGDONG = 2;
|
| | | |
| | | @Column(name = "cog_id")
|
| | | private Long id;
|
| | |
|
| | | // 第三方商品ID
|
| | | @Expose
|
| | | @Column(name = "cog_goods_id")
|
| | | private String goodsId;
|
| | |
|
| | | // 标题(变化时新建)
|
| | | @Expose
|
| | | @Column(name = "cog_title")
|
| | | private String title;
|
| | |
|
| | | // 图片(变化时新建)
|
| | | @Expose
|
| | | @Column(name = "cog_picture")
|
| | | private String picture;
|
| | |
|
| | | // 价格(变化时新建)
|
| | | @Expose
|
| | | @Column(name = "cog_price")
|
| | | private BigDecimal price;
|
| | |
|
| | | // 店铺id
|
| | | @Expose
|
| | | @Column(name = "cog_shop_id")
|
| | | private Long shopId;
|
| | | |
| | | // 店铺名称
|
| | | @Expose
|
| | | @Column(name = "cog_shop_name")
|
| | | private String shopName;
|
| | | |
| | | // 店铺的类型
|
| | | @Expose
|
| | | @Column(name = "cog_shop_type")
|
| | | private String shopType;
|
| | |
|
| | | // 状态:0正常 1下架
|
| | | @Expose
|
| | | @Column(name = "cog_state")
|
| | | private Integer state;
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "cog_create_time")
|
| | | private Date createTime;
|
| | | |
| | | // 更新时间
|
| | | @Column(name = "cog_update_time")
|
| | | private Date updateTime;
|
| | | |
| | |
|
| | | public CommonOrderGoods(){
|
| | | |
| | | }
|
| | | |
| | | public CommonOrderGoods(Long id){
|
| | | this.id = id;
|
| | | }
|
| | | |
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getGoodsId() {
|
| | | return goodsId;
|
| | | }
|
| | |
|
| | | public void setGoodsId(String goodsId) {
|
| | | this.goodsId = goodsId;
|
| | | }
|
| | |
|
| | | public String getTitle() {
|
| | | return title;
|
| | | }
|
| | |
|
| | | public void setTitle(String title) {
|
| | | this.title = title;
|
| | | }
|
| | |
|
| | | public String getPicture() {
|
| | | return picture;
|
| | | }
|
| | |
|
| | | public void setPicture(String picture) {
|
| | | this.picture = picture;
|
| | | }
|
| | |
|
| | | public BigDecimal getPrice() {
|
| | | return price;
|
| | | }
|
| | |
|
| | | public void setPrice(BigDecimal price) {
|
| | | this.price = price;
|
| | | }
|
| | |
|
| | | public Long getShopId() {
|
| | | return shopId;
|
| | | }
|
| | |
|
| | | public void setShopId(Long shopId) {
|
| | | this.shopId = shopId;
|
| | | }
|
| | |
|
| | | public String getShopName() {
|
| | | return shopName;
|
| | | }
|
| | |
|
| | | public void setShopName(String shopName) {
|
| | | this.shopName = shopName;
|
| | | }
|
| | |
|
| | | public String getShopType() {
|
| | | return shopType;
|
| | | }
|
| | |
|
| | | public void setShopType(String shopType) {
|
| | | this.shopType = shopType;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.order;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | |
|
| | | /**
|
| | | * 专题管理
|
| | | * |
| | | * @author yj
|
| | | *
|
| | | * @date 2018年12月23日
|
| | | */
|
| | |
|
| | | @Table("yeshi_ec_hongbao_order")
|
| | | public class HongBaoOrder implements Serializable {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | @Column(name = "ho_id")
|
| | | private Long id;
|
| | |
|
| | | // 红包ID
|
| | | @Column(name = "ho_hongbao_id")
|
| | | private HongBaoV2 hongBaoV2;
|
| | | |
| | | // 订单ID
|
| | | @Column(name = "ho_order_id")
|
| | | private CommonOrder commonOrder;
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "cog_create_time")
|
| | | private Date createTime;
|
| | | |
| | |
|
| | | public HongBaoOrder() {
|
| | | |
| | | }
|
| | | |
| | | public HongBaoOrder(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public HongBaoV2 getHongBaoV2() {
|
| | | return hongBaoV2;
|
| | | }
|
| | |
|
| | | public void setHongBaoV2(HongBaoV2 hongBaoV2) {
|
| | | this.hongBaoV2 = hongBaoV2;
|
| | | }
|
| | |
|
| | | public CommonOrder getCommonOrder() {
|
| | | return commonOrder;
|
| | | }
|
| | |
|
| | | public void setCommonOrder(CommonOrder commonOrder) {
|
| | | this.commonOrder = commonOrder;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.order; |
| | | |
| | | public class CommonOrderException extends Exception { |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | private int code; |
| | | private String msg; |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public CommonOrderException(int code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public CommonOrderException() { |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return this.msg; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.exception.order; |
| | | |
| | | public class CommonOrderGoodsException extends Exception { |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | private int code; |
| | | private String msg; |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public CommonOrderGoodsException(int code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public CommonOrderGoodsException() { |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return this.msg; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.exception.order; |
| | | |
| | | public class HongBaoOrderException extends Exception { |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | private int code; |
| | | private String msg; |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public HongBaoOrderException(int code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public HongBaoOrderException() { |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return this.msg; |
| | | } |
| | | |
| | | } |
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="com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | <id column="hb_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="hb_urank" property="urank" jdbcType="INTEGER"/> |
| | | <result column="hb_money" property="money" jdbcType="DECIMAL"/> |
| | | <result column="hb_type" property="type" jdbcType="INTEGER"/> |
| | | <result column="hb_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="hb_version" property="version" jdbcType="INTEGER"/> |
| | | <result column="hb_beizhu" property="beizhu" jdbcType="VARCHAR"/> |
| | | <result column="hb_pre_get_time" property="preGetTime" jdbcType="TIMESTAMP"/> |
| | | <result column="hb_get_time" property="getTime" jdbcType="TIMESTAMP"/> |
| | | <result column="hb_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="hb_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <association property="userInfo" column="hb_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="hb_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="parent" column="hb_pid" |
| | | javaType="com.yeshi.fanli.entity.push.PushGoods"> |
| | | <id column="hb_pid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <!-- <association property="userInfo" column="hb_uid" resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"/> --> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_common_order where hb_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_common_order where hb_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order (hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{urank,jdbcType=INTEGER},#{parent.id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{type,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{version,jdbcType=INTEGER},#{beizhu,jdbcType=VARCHAR},#{preGetTime,jdbcType=TIMESTAMP},#{getTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">hb_id,</if> |
| | | <if test="userInfo != null">hb_uid,</if> |
| | | <if test="urank != null">hb_urank,</if> |
| | | <if test="parent != null">hb_pid,</if> |
| | | <if test="money != null">hb_money,</if> |
| | | <if test="type != null">hb_type,</if> |
| | | <if test="state != null">hb_state,</if> |
| | | <if test="version != null">hb_version,</if> |
| | | <if test="beizhu != null">hb_beizhu,</if> |
| | | <if test="preGetTime != null">hb_pre_get_time,</if> |
| | | <if test="getTime != null">hb_get_time,</if> |
| | | <if test="createTime != null">hb_create_time,</if> |
| | | <if test="updateTime != null">hb_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="urank != null">#{urank,jdbcType=INTEGER},</if> |
| | | <if test="parent != null">#{parent.id,jdbcType=BIGINT},</if> |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="type != null">#{type,jdbcType=INTEGER},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="version != null">#{version,jdbcType=INTEGER},</if> |
| | | <if test="beizhu != null">#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="preGetTime != null">#{preGetTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="getTime != null">#{getTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2">update yeshi_ec_common_order set hb_uid = #{userInfo.id,jdbcType=BIGINT},hb_urank = #{urank,jdbcType=INTEGER},hb_pid = #{parent.id,jdbcType=BIGINT},hb_money = #{money,jdbcType=DECIMAL},hb_type = #{type,jdbcType=INTEGER},hb_state = #{state,jdbcType=INTEGER},hb_version = #{version,jdbcType=INTEGER},hb_beizhu = #{beizhu,jdbcType=VARCHAR},hb_pre_get_time = #{preGetTime,jdbcType=TIMESTAMP},hb_get_time = #{getTime,jdbcType=TIMESTAMP},hb_create_time = #{createTime,jdbcType=TIMESTAMP},hb_update_time = #{updateTime,jdbcType=TIMESTAMP} where hb_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2">update yeshi_ec_common_order |
| | | <set> |
| | | <if test="userInfo != null">hb_uid=#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="urank != null">hb_urank=#{urank,jdbcType=INTEGER},</if> |
| | | <if test="parent != null">hb_pid=#{parent.id,jdbcType=BIGINT},</if> |
| | | <if test="money != null">hb_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="type != null">hb_type=#{type,jdbcType=INTEGER},</if> |
| | | <if test="state != null">hb_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="version != null">hb_version=#{version,jdbcType=INTEGER},</if> |
| | | <if test="beizhu != null">hb_beizhu=#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="preGetTime != null">hb_pre_get_time=#{preGetTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="getTime != null">hb_get_time=#{getTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">hb_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">hb_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where hb_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
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="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.CommonOrderGoods"> |
| | | <id column="cog_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="cog_goods_id" property="goodsId" jdbcType="VARCHAR"/> |
| | | <result column="cog_title" property="title" jdbcType="VARCHAR"/> |
| | | <result column="cog_picture" property="picture" jdbcType="VARCHAR"/> |
| | | <result column="cog_price" property="price" jdbcType="DECIMAL"/> |
| | | <result column="cog_shop_id" property="shopId" jdbcType="BIGINT"/> |
| | | <result column="cog_shop_name" property="shopName" jdbcType="VARCHAR"/> |
| | | <result column="cog_shop_type" property="shopType" jdbcType="VARCHAR"/> |
| | | <result column="cog_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="cog_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="cog_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">cog_id,cog_goods_id,cog_title,cog_picture,cog_price,cog_shop_id,cog_shop_name,cog_shop_type,cog_state,cog_create_time,cog_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_common_order_goods where cog_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_common_order_goods where cog_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.CommonOrderGoods" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order_goods (cog_id,cog_goods_id,cog_title,cog_picture,cog_price,cog_shop_id,cog_shop_name,cog_shop_type,cog_state,cog_create_time,cog_update_time) values (#{id,jdbcType=BIGINT},#{goodsId,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{price,jdbcType=DECIMAL},#{shopId,jdbcType=BIGINT},#{shopName,jdbcType=VARCHAR},#{shopType,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.CommonOrderGoods" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order_goods |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">cog_id,</if> |
| | | <if test="goodsId != null">cog_goods_id,</if> |
| | | <if test="title != null">cog_title,</if> |
| | | <if test="picture != null">cog_picture,</if> |
| | | <if test="price != null">cog_price,</if> |
| | | <if test="shopId != null">cog_shop_id,</if> |
| | | <if test="shopName != null">cog_shop_name,</if> |
| | | <if test="shopType != null">cog_shop_type,</if> |
| | | <if test="state != null">cog_state,</if> |
| | | <if test="createTime != null">cog_create_time,</if> |
| | | <if test="updateTime != null">cog_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="goodsId != null">#{goodsId,jdbcType=VARCHAR},</if> |
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="price != null">#{price,jdbcType=DECIMAL},</if> |
| | | <if test="shopId != null">#{shopId,jdbcType=BIGINT},</if> |
| | | <if test="shopName != null">#{shopName,jdbcType=VARCHAR},</if> |
| | | <if test="shopType != null">#{shopType,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> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.CommonOrderGoods">update yeshi_ec_common_order_goods set cog_goods_id = #{goodsId,jdbcType=VARCHAR},cog_title = #{title,jdbcType=VARCHAR},cog_picture = #{picture,jdbcType=VARCHAR},cog_price = #{price,jdbcType=DECIMAL},cog_shop_id = #{shopId,jdbcType=BIGINT},cog_shop_name = #{shopName,jdbcType=VARCHAR},cog_shop_type = #{shopType,jdbcType=VARCHAR},cog_state = #{state,jdbcType=INTEGER},cog_create_time = #{createTime,jdbcType=TIMESTAMP},cog_update_time = #{updateTime,jdbcType=TIMESTAMP} where cog_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.CommonOrderGoods">update yeshi_ec_common_order_goods |
| | | <set> |
| | | <if test="goodsId != null">cog_goods_id=#{goodsId,jdbcType=VARCHAR},</if> |
| | | <if test="title != null">cog_title=#{title,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">cog_picture=#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="price != null">cog_price=#{price,jdbcType=DECIMAL},</if> |
| | | <if test="shopId != null">cog_shop_id=#{shopId,jdbcType=BIGINT},</if> |
| | | <if test="shopName != null">cog_shop_name=#{shopName,jdbcType=VARCHAR},</if> |
| | | <if test="shopType != null">cog_shop_type=#{shopType,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">cog_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">cog_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">cog_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where cog_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | </mapper> |
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="com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.CommonOrder"> |
| | | <id column="co_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="co_order_no" property="orderNo" jdbcType="VARCHAR"/> |
| | | <result column="co_source_type" property="sourceType" jdbcType="INTEGER"/> |
| | | <result column="co_source_position" property="sourcePosition" jdbcType="VARCHAR"/> |
| | | <result column="co_count" property="count" jdbcType="INTEGER"/> |
| | | <result column="co_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="co_estimate" property="estimate" jdbcType="DECIMAL"/> |
| | | <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL"/> |
| | | <result column="co_payment" property="payment" jdbcType="DECIMAL"/> |
| | | <result column="co_settlement" property="settlement" jdbcType="DECIMAL"/> |
| | | <result column="co_third_create_time" property="thirdCreateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP"/> |
| | | <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <association property="userInfo" column="co_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="co_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="commonOrderGoods" column="co_order_goods_id" |
| | | javaType="com.yeshi.fanli.entity.order.CommonOrderGoods"> |
| | | <id column="co_order_goods_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | | |
| | | <resultMap id="ResultMap" type="com.yeshi.fanli.vo.order.CommonOrderVO"> |
| | | <id column="co_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="co_order_no" property="orderNo" jdbcType="VARCHAR"/> |
| | | <result column="co_source_type" property="sourceType" jdbcType="INTEGER"/> |
| | | <result column="co_source_position" property="sourcePosition" jdbcType="VARCHAR"/> |
| | | <result column="co_count" property="count" jdbcType="INTEGER"/> |
| | | <result column="co_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="co_estimate" property="estimate" jdbcType="DECIMAL"/> |
| | | <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL"/> |
| | | <result column="co_payment" property="payment" jdbcType="DECIMAL"/> |
| | | <result column="co_settlement" property="settlement" jdbcType="DECIMAL"/> |
| | | <result column="co_third_create_time" property="thirdCreateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP"/> |
| | | <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <result column="totalMoney" property="hongBao" jdbcType="DECIMAL"/> |
| | | <result column="hongBaoState" property="hongBaoState" jdbcType="INTEGER"/> |
| | | <result column="hongBaoType" property="hongBaoType" jdbcType="INTEGER"/> |
| | | <result column="accountTime" property="accountTime" jdbcType="TIMESTAMP"/> |
| | | <result column="preAccountTime" property="preAccountTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <result column="totalCount" property="totalCount" jdbcType="INTEGER"/> |
| | | <result column="totalSettlement" property="totalSettlement" jdbcType="DECIMAL"/> |
| | | |
| | | <association property="userInfo" column="co_uid" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"> |
| | | </association> |
| | | |
| | | <association property="commonOrderGoods" column="co_order_goods_id" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.BaseResultMap"> |
| | | </association> |
| | | |
| | | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,cog_create_time,cog_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.CommonOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order (co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,cog_create_time,cog_update_time) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{sourcePosition,jdbcType=VARCHAR},#{commonOrderGoods.id,jdbcType=BIGINT},#{count,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{estimate,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{thirdCreateTime,jdbcType=TIMESTAMP},#{settleTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">co_id,</if> |
| | | <if test="userInfo != null">co_uid,</if> |
| | | <if test="orderNo != null">co_order_no,</if> |
| | | <if test="sourceType != null">co_source_type,</if> |
| | | <if test="sourcePosition != null">co_source_position,</if> |
| | | <if test="commonOrderGoods != null">co_order_goods_id,</if> |
| | | <if test="count != null">co_count,</if> |
| | | <if test="state != null">co_state,</if> |
| | | <if test="estimate != null">co_estimate,</if> |
| | | <if test="eIncome != null">co_eIncome,</if> |
| | | <if test="payment != null">co_payment,</if> |
| | | <if test="settlement != null">co_settlement,</if> |
| | | <if test="thirdCreateTime != null">co_third_create_time,</if> |
| | | <if test="settleTime != null">co_settle_time,</if> |
| | | <if test="createTime != null">cog_create_time,</if> |
| | | <if test="updateTime != null">cog_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceType != null">#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="sourcePosition != null">#{sourcePosition,jdbcType=VARCHAR},</if> |
| | | <if test="commonOrderGoods != null">#{commonOrderGoods.id,jdbcType=BIGINT},</if> |
| | | <if test="count != null">#{count,jdbcType=INTEGER},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="estimate != null">#{estimate,jdbcType=DECIMAL},</if> |
| | | <if test="eIncome != null">#{eIncome,jdbcType=DECIMAL},</if> |
| | | <if test="payment != null">#{payment,jdbcType=DECIMAL},</if> |
| | | <if test="settlement != null">#{settlement,jdbcType=DECIMAL},</if> |
| | | <if test="thirdCreateTime != null">#{thirdCreateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="settleTime != null">#{settleTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.CommonOrder">update yeshi_ec_common_order set co_uid = #{userInfo.id,jdbcType=BIGINT},co_order_no = #{orderNo,jdbcType=VARCHAR},co_source_type = #{sourceType,jdbcType=INTEGER},co_source_position = #{sourcePosition,jdbcType=VARCHAR},co_order_goods_id = #{commonOrderGoods.id,jdbcType=BIGINT},co_count = #{count,jdbcType=INTEGER},co_state = #{state,jdbcType=INTEGER},co_estimate = #{estimate,jdbcType=DECIMAL},co_eIncome = #{eIncome,jdbcType=DECIMAL},co_payment = #{payment,jdbcType=DECIMAL},co_settlement = #{settlement,jdbcType=DECIMAL},co_third_create_time = #{thirdCreateTime,jdbcType=TIMESTAMP},co_settle_time = #{settleTime,jdbcType=TIMESTAMP},cog_create_time = #{createTime,jdbcType=TIMESTAMP},cog_update_time = #{updateTime,jdbcType=TIMESTAMP} where co_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder">update yeshi_ec_common_order |
| | | <set> |
| | | <if test="userInfo != null">co_uid=#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="orderNo != null">co_order_no=#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceType != null">co_source_type=#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="sourcePosition != null">co_source_position=#{sourcePosition,jdbcType=VARCHAR},</if> |
| | | <if test="commonOrderGoods != null">co_order_goods_id=#{commonOrderGoods.id,jdbcType=BIGINT},</if> |
| | | <if test="count != null">co_count=#{count,jdbcType=INTEGER},</if> |
| | | <if test="state != null">co_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="estimate != null">co_estimate=#{estimate,jdbcType=DECIMAL},</if> |
| | | <if test="eIncome != null">co_eIncome=#{eIncome,jdbcType=DECIMAL},</if> |
| | | <if test="payment != null">co_payment=#{payment,jdbcType=DECIMAL},</if> |
| | | <if test="settlement != null">co_settlement=#{settlement,jdbcType=DECIMAL},</if> |
| | | <if test="thirdCreateTime != null">co_third_create_time=#{thirdCreateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="settleTime != null">co_settle_time=#{settleTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">cog_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">cog_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where co_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="listGroupOrderNoByUid" resultMap="ResultMap" > |
| | | SELECT COALESCE(SUM(th.`hb_money`),0)AS totalMoney,tc.*,th.hb_state AS hongBaoState, th.hb_type AS hongBaoType, |
| | | th.hb_get_time AS accountTime,th.hb_get_time AS accountTime,th.hb_pre_get_time AS preAccountTime |
| | | FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} |
| | | <if test="state != null"> |
| | | AND th.hb_state = #{state} |
| | | </if> |
| | | <if test="type != null and type == 1"> <!-- 自购订单 --> |
| | | AND (th.hb_type =1 or th.hb_type =2) |
| | | </if> |
| | | <if test="type != null and type == 2"> <!-- 分享订单 --> |
| | | AND (th.`hb_type` = 20 OR th.`hb_type` = 21 OR th.`hb_type` = 22) |
| | | </if> |
| | | <if test="type != null and type == 3"> <!-- 邀请订单 --> |
| | | AND (th.`hb_type` = 5 OR th.`hb_type` = 6 OR th.`hb_type` = 7) |
| | | </if> |
| | | <if test="orderNo != null"> |
| | | AND tc.co_order_no = #{orderNo} |
| | | </if> |
| | | <if test="startTime != null"> |
| | | AND <![CDATA[tc.co_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time < #{endTime}]]> |
| | | </if> |
| | | GROUP BY tc.`co_order_no` |
| | | ORDER BY tc.co_create_time DESC |
| | | LIMIT #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="countGroupOrderNoByUid" resultType="java.lang.Long"> |
| | | SELECT IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} |
| | | <if test="state != null"> |
| | | AND th.hb_state = #{state} |
| | | </if> |
| | | <if test="type != null and type == 1"> <!-- 自购订单 --> |
| | | AND (th.hb_type =1 or th.hb_type =2) |
| | | </if> |
| | | <if test="type != null and type == 2"> <!-- 分享订单 --> |
| | | AND (th.`hb_type` = 20 OR th.`hb_type` = 21 OR th.`hb_type` = 22) |
| | | </if> |
| | | <if test="type != null and type == 3"> <!-- 邀请订单 --> |
| | | AND (th.`hb_type` = 5 OR th.`hb_type` = 6 OR th.`hb_type` = 7) |
| | | </if> |
| | | <if test="orderNo != null"> |
| | | AND tc.co_order_no = #{orderNo} |
| | | </if> |
| | | <if test="startTime != null"> |
| | | AND <![CDATA[tc.co_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time < #{endTime}]]> |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="listByOrderNoAndType" resultMap="ResultMap" parameterType="java.util.List"> |
| | | SELECT COALESCE(SUM(tc.`co_settlement`),0)AS totalSettlement,COALESCE(SUM(tc.`co_count`),0)AS totalCount,tc.`co_source_type`,tc.`co_order_no`,tg.* |
| | | FROM yeshi_ec_common_order_goods tg |
| | | LEFT JOIN yeshi_ec_common_order tc ON tc.`co_order_goods_id` = tg.`cog_id` |
| | | WHERE |
| | | <foreach collection="list" item="item" separator=" OR "> |
| | | (tc.`co_source_type` = #{item.sourceType,jdbcType=INTEGER} AND tc.`co_order_no` = #{item.orderNo,jdbcType=VARCHAR}) |
| | | </foreach> |
| | | GROUP BY tc.`co_order_no`,tc.`co_order_goods_id` |
| | | </select> |
| | | |
| | | <select id="countOrderByHongBaoType" resultType="java.util.HashMap"> |
| | | SELECT SUM(self)AS totalSelf, SUM(shared)AS totalShared ,SUM(invite)AS totalInvite FROM ( |
| | | SELECT IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) AS self,0 AS shared,0 AS invite FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON tr.`ho_hongbao_id` = th.`hb_id` |
| | | WHERE th.`hb_uid` = ${uid} |
| | | AND (th.`hb_type` = 1 OR th.`hb_type` = 2) |
| | | <if test="day != null and day == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(tc.`co_create_time`) = 1 |
| | | </if> |
| | | UNION |
| | | |
| | | SELECT 0 AS self, IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) AS shared,0 AS invite FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = ${uid} |
| | | AND (th.`hb_type` = 20 OR th.`hb_type` = 21 OR th.`hb_type` = 22) |
| | | <if test="day != null and day == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(tc.`co_create_time`) = 1 |
| | | </if> |
| | | UNION |
| | | SELECT 0 AS self,0 AS shared,IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) AS invite FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = ${uid} |
| | | AND (th.`hb_type` = 5 OR th.`hb_type` = 6 OR th.`hb_type` = 7) |
| | | <if test="day != null and day == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(tc.`co_create_time`) = 1 |
| | | </if> |
| | | )A |
| | | </select> |
| | | |
| | | |
| | | <select id="countOrder" resultType="java.lang.Long"> |
| | | SELECT IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE 1=1 |
| | | <if test="uid != null"> |
| | | AND th.`hb_uid` = ${uid} |
| | | </if> |
| | | <if test ="isToday == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="countOrderMoney" resultType="java.lang.Long"> |
| | | SELECT IFNULL(SUM(th.`hb_money`),0)AS totalmoney FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = ${uid} |
| | | AND <![CDATA[tc.`co_state` <> 4]]> |
| | | <if test ="isToday == 1"> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | GROUP BY tc.`co_order_no`,tc.`co_source_type` |
| | | </select> |
| | | |
| | | <select id="countByUidAndOrderState" resultType="java.util.HashMap"> |
| | | SELECT SUM(valid)AS totalValid, SUM(proces)AS totalProces ,SUM(Invalid)AS totalInvite |
| | | FROM (SELECT IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) AS valid,0 AS proces,0 AS Invalid |
| | | FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} AND (tc.`co_state` = 1 OR tc.`co_state` = 2) |
| | | <if test="type != null"> |
| | | AND th.hb_type = #{type} |
| | | </if> |
| | | <if test="startTime != null"> |
| | | AND <![CDATA[tc.co_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time < #{endTime}]]> |
| | | </if> |
| | | |
| | | UNION |
| | | |
| | | SELECT 0 AS valid,IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) AS proces,0 AS Invalid |
| | | FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} AND tc.`co_state` =3 |
| | | <if test="type != null"> |
| | | AND th.hb_type = #{type} |
| | | </if> |
| | | <if test="startTime != null"> |
| | | AND <![CDATA[tc.co_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time < #{endTime}]]> |
| | | </if> |
| | | |
| | | UNION |
| | | |
| | | SELECT 0 AS valid,0 AS proces,IFNULL(COUNT(DISTINCT tc.`co_order_no`,tc.`co_source_type`),0) AS Invalid |
| | | FROM yeshi_ec_common_order tc |
| | | LEFT JOIN yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid`= #{uid} AND tc.`co_state` = 4 |
| | | <if test="type != null"> |
| | | AND th.hb_type = #{type} |
| | | </if> |
| | | <if test="startTime != null"> |
| | | AND <![CDATA[tc.co_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time < #{endTime}]]> |
| | | </if> |
| | | )A |
| | | </select> |
| | | |
| | | </mapper> |
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="com.yeshi.fanli.dao.mybatis.order.HongBaoOrderMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.HongBaoOrder"> |
| | | <id column="ho_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="cog_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <association property="hongBaoV2" column="ho_hongbao_id" |
| | | javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | <id column="ho_hongbao_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="commonOrderGoods" column="ho_order_id" |
| | | javaType="com.yeshi.fanli.entity.order.CommonOrder"> |
| | | <id column="ho_order_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">ho_id,ho_hongbao_id,ho_order_id,cog_create_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_hongbao_order where ho_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_hongbao_order where ho_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_hongbao_order (ho_id,ho_hongbao_id,ho_order_id,cog_create_time) values (#{id,jdbcType=BIGINT},#{hongBaoV2.id,jdbcType=BIGINT},#{commonOrder.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_hongbao_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">ho_id,</if> |
| | | <if test="hongBaoV2 != null">ho_hongbao_id,</if> |
| | | <if test="commonOrder != null">ho_order_id,</if> |
| | | <if test="createTime != null">cog_create_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="hongBaoV2 != null">#{hongBaoV2.id,jdbcType=BIGINT},</if> |
| | | <if test="commonOrder != null">#{commonOrder.id,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder">update yeshi_ec_hongbao_order set ho_hongbao_id = #{hongBaoV2.id,jdbcType=BIGINT},ho_order_id = #{commonOrder.id,jdbcType=BIGINT},cog_create_time = #{createTime,jdbcType=TIMESTAMP} where ho_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.HongBaoOrder">update yeshi_ec_hongbao_order |
| | | <set> |
| | | <if test="hongBaoV2 != null">ho_hongbao_id=#{hongBaoV2.id,jdbcType=BIGINT},</if> |
| | | <if test="commonOrder != null">ho_order_id=#{commonOrder.id,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">cog_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where ho_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.hongbao;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | |
|
| | |
|
| | | @Service
|
| | | public class HongBaoV2ServiceImpl implements HongBaoV2Service {
|
| | | |
| | | @Resource
|
| | | private HongBaoV2Mapper hongBaoV2Mapper;
|
| | |
|
| | |
|
| | | @Override
|
| | | public int insert(HongBaoV2 record) {
|
| | | return hongBaoV2Mapper.insert(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int insertSelective(HongBaoV2 record) {
|
| | | return hongBaoV2Mapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKeySelective(HongBaoV2 record) {
|
| | | return hongBaoV2Mapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(HongBaoV2 record) {
|
| | | return hongBaoV2Mapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int deleteByPrimaryKey(Long id) {
|
| | | return hongBaoV2Mapper.deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public HongBaoV2 selectByPrimaryKey(Long id) {
|
| | | return hongBaoV2Mapper.selectByPrimaryKey(id);
|
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.order;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderGoodsService;
|
| | |
|
| | |
|
| | | @Service
|
| | | public class CommonOrderGoodsServiceImpl implements CommonOrderGoodsService {
|
| | | |
| | | @Resource
|
| | | private CommonOrderGoodsMapper commonOrderGoodsMapper;
|
| | |
|
| | |
|
| | | @Override
|
| | | public int insert(CommonOrderGoods record) {
|
| | | return commonOrderGoodsMapper.insert(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int insertSelective(CommonOrderGoods record) {
|
| | | return commonOrderGoodsMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKeySelective(CommonOrderGoods record) {
|
| | | return commonOrderGoodsMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(CommonOrderGoods record) {
|
| | | return commonOrderGoodsMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int deleteByPrimaryKey(Long id) {
|
| | | return commonOrderGoodsMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public CommonOrderGoods selectByPrimaryKey(Long id) {
|
| | | return commonOrderGoodsMapper.selectByPrimaryKey(id);
|
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.HashMap;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderGoodsVO;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | |
|
| | |
|
| | | @Service
|
| | | public class CommonOrderServiceImpl implements CommonOrderService {
|
| | | |
| | | @Resource
|
| | | private CommonOrderMapper commonOrderMapper;
|
| | | |
| | | @Resource
|
| | | private TaoBaoWeiQuanOrderMapper taoBaoWeiQuanOrderMapper;
|
| | | |
| | | @Override
|
| | | public int insert(CommonOrder record) {
|
| | | return commonOrderMapper.insert(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int insertSelective(CommonOrder record) {
|
| | | return commonOrderMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKeySelective(CommonOrder record) {
|
| | | return commonOrderMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(CommonOrder record) {
|
| | | return commonOrderMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int deleteByPrimaryKey(Long id) {
|
| | | return commonOrderMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public CommonOrder selectByPrimaryKey(Long id) {
|
| | | return commonOrderMapper.selectByPrimaryKey(id);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<CommonOrderVO> listGroupOrderNoByUid(long start, int count, Long uid, Integer state, |
| | | Integer type, String orderNo, String startTime,String endTime) throws CommonOrderException{
|
| | | return commonOrderMapper.listGroupOrderNoByUid(start, count, uid, state, type, orderNo, startTime, endTime);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countGroupOrderNoByUid(Long uid,Integer state, Integer type, String orderNo,
|
| | | String startTime,String endTime) throws CommonOrderException{
|
| | | return commonOrderMapper.countGroupOrderNoByUid(uid, state, type, orderNo, startTime, endTime);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<CommonOrderVO> getOrderByUid (Long page, Long uid, Integer state, Integer type,
|
| | | String orderNo, String startTime, String endTime) throws CommonOrderException {
|
| | | |
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | |
| | | List<CommonOrderVO> listOrder = listGroupOrderNoByUid((page - 1) * pageSize, pageSize, uid, |
| | | state, type, orderNo, startTime, endTime);
|
| | | |
| | | // 订单信息为空
|
| | | if (listOrder == null || listOrder.size() == 0) {
|
| | | listOrder = new ArrayList<CommonOrderVO>();
|
| | | return listOrder;
|
| | | }
|
| | | |
| | | // 商品信息
|
| | | List<CommonOrderVO> listGoods = commonOrderMapper.listByOrderNoAndType(listOrder);
|
| | | // 订单商品为空
|
| | | if (listGoods ==null || listGoods.size() == 0) {
|
| | | return listOrder; |
| | | }
|
| | | |
| | | /* 组合商品信息 */
|
| | | for (CommonOrderVO commonOrder: listGoods) {
|
| | | |
| | | CommonOrderGoods goods = commonOrder.getCommonOrderGoods();
|
| | | if (goods == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | String orderNo1 = commonOrder.getOrderNo();
|
| | | Integer sourceType = commonOrder.getSourceType();
|
| | | |
| | | for (CommonOrderVO order: listOrder) {
|
| | | String orderNo2 = order.getOrderNo();
|
| | | Integer sourceType2 = order.getSourceType();
|
| | | |
| | | // 来源、订单号相同
|
| | | if (sourceType.equals(sourceType2) && orderNo1.equals(orderNo2)) {
|
| | | // 加入商品信息
|
| | | List<CommonOrderGoodsVO> listOrderGoods = order.getListOrderGoods();
|
| | | |
| | | CommonOrderGoodsVO commonGoodsVO = new CommonOrderGoodsVO();
|
| | | try {
|
| | | PropertyUtils.copyProperties(commonGoodsVO, goods);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | commonGoodsVO.setActualCount(commonOrder.getTotalCount());
|
| | | commonGoodsVO.setActualPay(commonOrder.getTotalSettlement());
|
| | | |
| | | listOrderGoods.add(commonGoodsVO);
|
| | | |
| | | break;
|
| | | }
|
| | | } |
| | | }
|
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd");
|
| | | |
| | | for (CommonOrderVO order: listOrder) {
|
| | | Date createTime = order.getCreateTime();
|
| | | if (createTime != null) {
|
| | | order.setObtainTime(createTime.getTime());
|
| | | }
|
| | | |
| | | Date thirdCreateTime = order.getThirdCreateTime();
|
| | | if (thirdCreateTime != null) {
|
| | | order.setDownTime(format.format(thirdCreateTime));
|
| | | }
|
| | | |
| | | Date settleTime = order.getSettleTime();
|
| | | if (settleTime != null) {
|
| | | order.setReceiveTime(format.format(settleTime));
|
| | | }
|
| | | |
| | | Date accountTime = order.getAccountTime();
|
| | | if (accountTime != null) {
|
| | | order.setGetTime(formatday.format(accountTime));
|
| | | }
|
| | | |
| | | Date preAccountTime = order.getPreAccountTime();
|
| | | if (preAccountTime != null) {
|
| | | order.setPreGetTime(formatday.format(preAccountTime));
|
| | | }
|
| | | |
| | | |
| | | /* 订单状态 转换处理*/
|
| | | String orderStateContent = "";
|
| | | Map<String, String> orderStateMap = new HashMap<String, String>();
|
| | | |
| | | Integer orderState = order.getState();
|
| | | if (CommonOrder.STATE_FK == orderState ) {
|
| | | orderStateContent = "已付款";
|
| | | } else if (CommonOrder.STATE_JS == orderState) {
|
| | | orderStateContent = "已收货";
|
| | | } else if (CommonOrder.STATE_SX == orderState) {
|
| | | orderStateContent = "已退款";
|
| | | } else if (CommonOrder.STATE_WQ == orderState) {
|
| | | orderStateContent = "已维权";
|
| | | |
| | | /* 订单维权 判断是否全部维权 */
|
| | | List<TaoBaoWeiQuanOrder> listWQ =
|
| | | taoBaoWeiQuanOrderMapper.selectListByOrderIdAndState(order.getOrderNo(), "维权成功");
|
| | | |
| | | boolean isPart = true;
|
| | | if (listWQ != null && listWQ.size() > 0) {
|
| | | BigDecimal fanTotalMoney = new BigDecimal(0);
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder: listWQ) {
|
| | | BigDecimal fanMoney = weiQuanOrder.getFanMoney();
|
| | | if (fanMoney != null) {
|
| | | fanTotalMoney = MoneyBigDecimalUtil.add(fanTotalMoney, fanMoney);
|
| | | }
|
| | | }
|
| | | |
| | | if (fanTotalMoney.compareTo(order.getHongBao()) >= 0) {
|
| | | isPart = false;
|
| | | }
|
| | | }
|
| | | |
| | | if (isPart) {
|
| | | order.setHongBaoState(HongBaoV2.STATE_BUFENSHIXIAO); // 部分失效
|
| | | } else {
|
| | | order.setHongBaoState(HongBaoV2.STATE_SHIXIAO); // 全部失效
|
| | | }
|
| | | }
|
| | | orderStateMap.put("content", orderStateContent);
|
| | | orderStateMap.put("fontColor", "#666666");
|
| | | order.setOrderState(orderStateMap);
|
| | | |
| | | String hongbaoInfo = "";
|
| | | /* 订单返利类型 转换 */
|
| | | Integer hongBaoType = order.getHongBaoType();
|
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) {
|
| | | // 自购
|
| | | hongbaoInfo = "返利";
|
| | | order.setHongBaoType(1); |
| | | order.setHongBaoTypePic(CommonOrder.TYPE_FANLI);
|
| | | } else if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType |
| | | || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) {
|
| | | // 分享
|
| | | hongbaoInfo = "奖金";
|
| | | order.setHongBaoType(2); |
| | | order.setHongBaoTypePic(CommonOrder.TYPE_SHARE);
|
| | | } else if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | | || HongBaoV2.TYPE_ERJI == hongBaoType) {
|
| | | // 邀请
|
| | | hongbaoInfo = "奖金";
|
| | | order.setHongBaoType(3); |
| | | order.setHongBaoTypePic(CommonOrder.TYPE_INVITE);
|
| | | }
|
| | | |
| | | |
| | | String hongBaoState_Str = "";
|
| | | String hongbaoInfoFontColor = "#E5005C";
|
| | | /* 红包状态 转换 */
|
| | | String stateContent = "";
|
| | | Map<String, String> accountState = new HashMap<String, String>();
|
| | | Integer hongBaoState = order.getHongBaoState();
|
| | | if (HongBaoV2.STATE_KELINGQU == hongBaoState || HongBaoV2.STATE_BUKELINGQU == hongBaoState) {
|
| | | stateContent = "未到账";
|
| | | hongBaoState_Str = "预估";
|
| | | hongbaoInfoFontColor = "#888888";
|
| | | |
| | | } else if (HongBaoV2.STATE_YILINGQU == hongBaoState) {
|
| | | stateContent = "已到账";
|
| | | } else if (HongBaoV2.STATE_BUFENSHIXIAO == hongBaoState) {
|
| | | stateContent = "部分失效"; |
| | | } else if (HongBaoV2.STATE_SHIXIAO == hongBaoState) {
|
| | | stateContent = "已失效"; |
| | | }
|
| | | accountState.put("content", stateContent);
|
| | | accountState.put("fontColor", "#E5005C");
|
| | | order.setAccountState(accountState);
|
| | | |
| | | |
| | | if ("奖金".equals(hongbaoInfo) && hongBaoState_Str.trim().length() > 0) {
|
| | | hongbaoInfo = hongBaoState_Str + hongbaoInfo;
|
| | | }
|
| | | BigDecimal hongBao = order.getHongBao();
|
| | | if (hongBao == null) {
|
| | | hongBao = new BigDecimal(0);
|
| | | }
|
| | | Map<String, String> hongBaoMap = new HashMap<String, String>();
|
| | | hongBaoMap.put("content", hongbaoInfo + " ¥" + hongBao);
|
| | | hongBaoMap.put("fontColor", hongbaoInfoFontColor);
|
| | | order.setHongBaoInfo(hongBaoMap);
|
| | | |
| | | |
| | | }
|
| | | |
| | | |
| | | return listOrder;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public Map<String, BigDecimal> countOrderByHongBaoType(Long uid, Integer day) {
|
| | | return commonOrderMapper.countOrderByHongBaoType(uid, day);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countOrder(Long uid, Integer isToday) {
|
| | | return commonOrderMapper.countOrder(uid, isToday);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal countOrderMoney(Long uid, Integer isToday) {
|
| | | return commonOrderMapper.countOrderMoney(uid, isToday);
|
| | | }
|
| | | |
| | | @Override
|
| | | public Map<String, BigDecimal> countByUidAndOrderState(Long uid, Integer type, String startTime,String endTime) {
|
| | | return commonOrderMapper.countByUidAndOrderState(uid, type, startTime, endTime);
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.order;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.HongBaoOrderMapper;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | |
|
| | |
|
| | | @Service
|
| | | public class HongBaoOrderServiceImpl implements HongBaoOrderService {
|
| | | |
| | | @Resource
|
| | | private HongBaoOrderMapper hongBaoOrderMapper;
|
| | |
|
| | |
|
| | | @Override
|
| | | public int insert(HongBaoOrder record) {
|
| | | return hongBaoOrderMapper.insert(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int insertSelective(HongBaoOrder record) {
|
| | | return hongBaoOrderMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKeySelective(HongBaoOrder record) {
|
| | | return hongBaoOrderMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(HongBaoOrder record) {
|
| | | return hongBaoOrderMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int deleteByPrimaryKey(Long id) {
|
| | | return hongBaoOrderMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public HongBaoOrder selectByPrimaryKey(Long id) {
|
| | | return hongBaoOrderMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.hongbao;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | |
|
| | | public interface HongBaoV2Service {
|
| | |
|
| | | public int insert(HongBaoV2 record);
|
| | |
|
| | | public int insertSelective(HongBaoV2 record);
|
| | |
|
| | | public int updateByPrimaryKey(HongBaoV2 record);
|
| | | |
| | | public int updateByPrimaryKeySelective(HongBaoV2 record);
|
| | | |
| | | public int deleteByPrimaryKey(Long id);
|
| | | |
| | | public HongBaoV2 selectByPrimaryKey(Long id);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.order;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | |
|
| | | public interface CommonOrderGoodsService {
|
| | |
|
| | | public int insert(CommonOrderGoods record);
|
| | |
|
| | | public int insertSelective(CommonOrderGoods record);
|
| | |
|
| | | public int updateByPrimaryKey(CommonOrderGoods record);
|
| | | |
| | | public int updateByPrimaryKeySelective(CommonOrderGoods record);
|
| | | |
| | | public int deleteByPrimaryKey(Long id);
|
| | | |
| | | public CommonOrderGoods selectByPrimaryKey(Long id);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | |
|
| | | public interface CommonOrderService {
|
| | |
|
| | | public int insert(CommonOrder record);
|
| | |
|
| | | public int insertSelective(CommonOrder record);
|
| | |
|
| | | public int updateByPrimaryKey(CommonOrder record);
|
| | | |
| | | public int updateByPrimaryKeySelective(CommonOrder record);
|
| | | |
| | | public int deleteByPrimaryKey(Long id);
|
| | | |
| | | public CommonOrder selectByPrimaryKey(Long id);
|
| | |
|
| | |
|
| | | /**
|
| | | * 查询用户订单 并订单号分组
|
| | | * @param start
|
| | | * @param count
|
| | | * @param uid
|
| | | * @param state
|
| | | * @param type
|
| | | * @param orderNo 订单号
|
| | | * @param startTime 起始系统录入时间
|
| | | * @param endTime 结束系统录入时间
|
| | | * @return
|
| | | * @throws CommonOrderException
|
| | | */
|
| | | public List<CommonOrderVO> listGroupOrderNoByUid(long start, int count, Long uid, Integer state, Integer type,
|
| | | String orderNo, String startTime, String endTime) throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 统计查询
|
| | | * @param uid
|
| | | * @param state
|
| | | * @param type
|
| | | * @param orderNo
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | * @throws CommonOrderException
|
| | | */
|
| | | long countGroupOrderNoByUid(Long uid, Integer state, Integer type, String orderNo, String startTime, String endTime)
|
| | | throws CommonOrderException;
|
| | | |
| | | /**
|
| | | * 移动段订单列表
|
| | | * @param start
|
| | | * @param count
|
| | | * @param uid 用户id
|
| | | * @param type 到账状态
|
| | | * @return
|
| | | */
|
| | | public List<CommonOrderVO> getOrderByUid(Long page, Long uid, Integer state, Integer type,
|
| | | String orderNo, String startTime, String endTime) throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 统计订单-根据红包类型 自购 邀请 分享
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public Map<String, BigDecimal> countOrderByHongBaoType(Long uid, Integer day);
|
| | | |
| | | |
| | | /**
|
| | | * 统计订单
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public long countOrder(Long uid, Integer isToday);
|
| | | |
| | | /**
|
| | | * 统计订单
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public BigDecimal countOrderMoney(Long uid, Integer isToday);
|
| | |
|
| | | /**
|
| | | * 根据条件统计
|
| | | * @param uid
|
| | | * @param type
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public Map<String, BigDecimal> countByUidAndOrderState(Long uid, Integer type, String startTime, String endTime);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.order;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | |
|
| | | public interface HongBaoOrderService {
|
| | |
|
| | | public int insert(HongBaoOrder record);
|
| | |
|
| | | public int insertSelective(HongBaoOrder record);
|
| | |
|
| | | public int updateByPrimaryKey(HongBaoOrder record);
|
| | | |
| | | public int updateByPrimaryKeySelective(HongBaoOrder record);
|
| | | |
| | | public int deleteByPrimaryKey(Long id);
|
| | | |
| | | public HongBaoOrder selectByPrimaryKey(Long id);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.vo.order;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | |
|
| | | /**
|
| | | * 订单商品-简版
|
| | | * |
| | | * @author yj
|
| | | *
|
| | | * @date 2018年12月23日
|
| | | */
|
| | |
|
| | | public class CommonOrderGoodsVO extends CommonOrderGoods implements Serializable {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | // 实际总数量
|
| | | @Expose
|
| | | private Integer actualCount;
|
| | | // 实际总付款
|
| | | @Expose
|
| | | private BigDecimal actualPay;
|
| | | |
| | |
|
| | | public Integer getActualCount() {
|
| | | return actualCount;
|
| | | }
|
| | |
|
| | | public void setActualCount(Integer actualCount) {
|
| | | this.actualCount = actualCount;
|
| | | }
|
| | |
|
| | | public BigDecimal getActualPay() {
|
| | | return actualPay;
|
| | | }
|
| | |
|
| | | public void setActualPay(BigDecimal actualPay) {
|
| | | this.actualPay = actualPay;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.vo.order;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | |
|
| | | /**
|
| | | * 订单-简版
|
| | | * |
| | | * @author yj
|
| | | *
|
| | | * @date 2018年12月23日
|
| | | */
|
| | |
|
| | | public class CommonOrderVO extends CommonOrder implements Serializable {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | // 到账时间
|
| | | private Date accountTime;
|
| | | // 预计到账时间
|
| | | private Date preAccountTime;
|
| | | // 实际总数量
|
| | | private Integer totalCount;
|
| | | // 实际总付款
|
| | | private BigDecimal totalSettlement;
|
| | | // 红包类型:
|
| | | private Integer hongBaoType;
|
| | | // 订单总预估奖金
|
| | | private BigDecimal hongBao;
|
| | | // 红包状态
|
| | | private Integer hongBaoState;
|
| | | |
| | | |
| | | // 红包类型图片链接
|
| | | @Expose
|
| | | private String hongBaoTypePic;
|
| | | // 订单状态
|
| | | @Expose
|
| | | private Map<String, String> orderState;
|
| | | // 红包金额
|
| | | @Expose
|
| | | private Map<String, String> hongBaoInfo;
|
| | | // 到账状态
|
| | | @Expose
|
| | | private Map<String, String> accountState;
|
| | | // 创建时间 数字格式
|
| | | @Expose
|
| | | private Long obtainTime;
|
| | | // 下单时间
|
| | | @Expose
|
| | | private String downTime;
|
| | | // 收货时间
|
| | | @Expose
|
| | | private String receiveTime;
|
| | | // 到账时间
|
| | | @Expose
|
| | | private String getTime;
|
| | | // 预计到账时间
|
| | | @Expose
|
| | | private String preGetTime;
|
| | | // 订单下的商品
|
| | | @Expose
|
| | | private List<CommonOrderGoodsVO> listOrderGoods = new ArrayList<CommonOrderGoodsVO>();
|
| | |
|
| | |
|
| | | public Date getAccountTime() {
|
| | | return accountTime;
|
| | | }
|
| | |
|
| | | public void setAccountTime(Date accountTime) {
|
| | | this.accountTime = accountTime;
|
| | | }
|
| | |
|
| | | public Date getPreAccountTime() {
|
| | | return preAccountTime;
|
| | | }
|
| | |
|
| | | public void setPreAccountTime(Date preAccountTime) {
|
| | | this.preAccountTime = preAccountTime;
|
| | | }
|
| | |
|
| | | public BigDecimal getHongBao() {
|
| | | return hongBao;
|
| | | }
|
| | |
|
| | | public void setHongBao(BigDecimal hongBao) {
|
| | | this.hongBao = hongBao;
|
| | | }
|
| | |
|
| | | public Integer getHongBaoState() {
|
| | | return hongBaoState;
|
| | | }
|
| | |
|
| | | public void setHongBaoState(Integer hongBaoState) {
|
| | | this.hongBaoState = hongBaoState;
|
| | | }
|
| | |
|
| | | public Long getObtainTime() {
|
| | | return obtainTime;
|
| | | }
|
| | |
|
| | | public void setObtainTime(Long obtainTime) {
|
| | | this.obtainTime = obtainTime;
|
| | | }
|
| | |
|
| | | public String getDownTime() {
|
| | | return downTime;
|
| | | }
|
| | |
|
| | | public void setDownTime(String downTime) {
|
| | | this.downTime = downTime;
|
| | | }
|
| | |
|
| | | public String getReceiveTime() {
|
| | | return receiveTime;
|
| | | }
|
| | |
|
| | | public void setReceiveTime(String receiveTime) {
|
| | | this.receiveTime = receiveTime;
|
| | | }
|
| | |
|
| | | public String getGetTime() {
|
| | | return getTime;
|
| | | }
|
| | |
|
| | | public void setGetTime(String getTime) {
|
| | | this.getTime = getTime;
|
| | | }
|
| | |
|
| | | public String getPreGetTime() {
|
| | | return preGetTime;
|
| | | }
|
| | |
|
| | | public void setPreGetTime(String preGetTime) {
|
| | | this.preGetTime = preGetTime;
|
| | | }
|
| | |
|
| | | public List<CommonOrderGoodsVO> getListOrderGoods() {
|
| | | return listOrderGoods;
|
| | | }
|
| | |
|
| | | public void setListOrderGoods(List<CommonOrderGoodsVO> listOrderGoods) {
|
| | | this.listOrderGoods = listOrderGoods;
|
| | | }
|
| | |
|
| | | public Integer getTotalCount() {
|
| | | return totalCount;
|
| | | }
|
| | |
|
| | | public void setTotalCount(Integer totalCount) {
|
| | | this.totalCount = totalCount;
|
| | | }
|
| | |
|
| | | public BigDecimal getTotalSettlement() {
|
| | | return totalSettlement;
|
| | | }
|
| | |
|
| | | public void setTotalSettlement(BigDecimal totalSettlement) {
|
| | | this.totalSettlement = totalSettlement;
|
| | | }
|
| | |
|
| | | public Integer getHongBaoType() {
|
| | | return hongBaoType;
|
| | | }
|
| | |
|
| | | public void setHongBaoType(Integer hongBaoType) {
|
| | | this.hongBaoType = hongBaoType;
|
| | | }
|
| | |
|
| | | public String getHongBaoTypePic() {
|
| | | return hongBaoTypePic;
|
| | | }
|
| | |
|
| | | public void setHongBaoTypePic(String hongBaoTypePic) {
|
| | | this.hongBaoTypePic = hongBaoTypePic;
|
| | | }
|
| | |
|
| | | public Map<String, String> getAccountState() {
|
| | | return accountState;
|
| | | }
|
| | |
|
| | | public void setAccountState(Map<String, String> accountState) {
|
| | | this.accountState = accountState;
|
| | | }
|
| | |
|
| | | public Map<String, String> getHongBaoInfo() {
|
| | | return hongBaoInfo;
|
| | | }
|
| | |
|
| | | public void setHongBaoInfo(Map<String, String> hongBaoInfo) {
|
| | | this.hongBaoInfo = hongBaoInfo;
|
| | | }
|
| | |
|
| | | public Map<String, String> getOrderState() {
|
| | | return orderState;
|
| | | }
|
| | |
|
| | | public void setOrderState(Map<String, String> orderState) {
|
| | | this.orderState = orderState;
|
| | | }
|
| | |
|
| | | |
| | | }
|
| | |
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | |
|
| | |
|
| | | public class DateUtil {
|
| | | |
| | |
|
| | | public static String dateDiff(String startTime, String endTime) {
|
| | | |
| | | String datatime = 0 + "天" + 0 + "小时" + 0 + "分钟" ;
|
| | |
|
| | | String datatime = 0 + "天" + 0 + "小时" + 0 + "分钟";
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
| | | |
| | |
|
| | | try {
|
| | | long nm = 1000 * 60;// 一分钟的毫秒数
|
| | | long nh = 1000 * 60 * 60;// 一小时的毫秒数
|
| | | long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数
|
| | | |
| | |
|
| | | // 获得两个时间的毫秒时间差异
|
| | | long diff = sd.parse(endTime).getTime() - sd.parse(startTime).getTime();
|
| | | |
| | |
|
| | | long day = diff / nd;// 计算差多少天
|
| | | long hour = diff % nd / nh;// 计算差多少小时
|
| | | long min = diff % nd % nh / nm;// 计算差多少分钟
|
| | | |
| | | datatime = day + "天" + hour + "小时" + min + "分钟" ;
|
| | | |
| | |
|
| | | datatime = day + "天" + hour + "小时" + min + "分钟";
|
| | |
|
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | return datatime;
|
| | | }
|
| | | |
| | | |
| | | public static String dateDiff2(Date startTime, Date endTime) throws Exception{
|
| | | |
| | | String datatime = 0 + "天" + 0 + "小时" + 0 + "分钟" ;
|
| | | |
| | |
|
| | | public static String dateDiff2(Date startTime, Date endTime) throws Exception {
|
| | |
|
| | | String datatime = 0 + "天" + 0 + "小时" + 0 + "分钟";
|
| | |
|
| | | long nm = 1000 * 60;// 一分钟的毫秒数
|
| | | long nh = 1000 * 60 * 60;// 一小时的毫秒数
|
| | | long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数
|
| | | |
| | |
|
| | | // 获得两个时间的毫秒时间差异
|
| | | long diff = endTime.getTime() - startTime.getTime();
|
| | | |
| | |
|
| | | long day = diff / nd;// 计算差多少天
|
| | | long hour = diff % nd / nh;// 计算差多少小时
|
| | | long min = diff % nd % nh / nm;// 计算差多少分钟
|
| | | |
| | | |
| | | datatime = day + "天" + hour + "小时" + min + "分钟" ;
|
| | | |
| | | |
| | |
|
| | | datatime = day + "天" + hour + "小时" + min + "分钟";
|
| | |
|
| | | return datatime;
|
| | | }
|
| | | |
| | |
|
| | | public String transferLongToDate(String dateFormat, Long millSec) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | Date date = new Date(millSec);
|
| | | return sdf.format(date);
|
| | | }
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | Date date = new Date(millSec);
|
| | | return sdf.format(date);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 验证是否属于同一天
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 指定日期加上天数后的日期
|
| | | * |
| | | * @param num
|
| | | * 为增加的天数
|
| | | * @param nowDate
|
| | | * 创建时间
|
| | | * @return
|
| | | * @throws ParseException
|
| | | */
|
| | | public static String plusDay(int num, String nowDate) throws ParseException {
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
| | | Date currdate = format.parse(nowDate);
|
| | | |
| | | Calendar ca = Calendar.getInstance();
|
| | | ca.setTime(currdate);
|
| | | ca.add(Calendar.DATE, num);
|
| | | |
| | | return format.format(ca.getTime());
|
| | | }
|
| | | } |