记得上下班打卡 | git大法好,push需谨慎

Commit 91e873fe authored by 姜秀龙's avatar 姜秀龙

优化完善 admin 财务模块 页面和增加店铺

parent 0b919365
......@@ -3,8 +3,10 @@ package com.liquidnet.client.admin.web.controller.zhengzai.tools;
import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.utils.poi.ExcelUtil;
import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinCommonService;
import com.liquidnet.client.admin.zhengzai.kylin.dto.*;
import com.liquidnet.client.admin.zhengzai.kylin.service.IExportService;
import com.liquidnet.service.goblin.dto.GoblinStoreSearchDto;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
......@@ -13,7 +15,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.*;
import java.util.Arrays;
import java.util.List;
@Controller
@RequestMapping("tools/export")
......@@ -22,6 +25,9 @@ public class ExportDataController extends BaseController {
@Autowired
private IExportService exportService;
@Autowired
private IGoblinCommonService goblinCommonService;
private String prefix = "zhengzai/financial";
......@@ -30,6 +36,17 @@ public class ExportDataController extends BaseController {
return prefix + "/export";
}
/**
* 店铺列表(财务导出用)
*/
@GetMapping("/store/list")
@ResponseBody
public AjaxResult storeList(String storeName) {
List<String> status = Arrays.asList("3", "4", "5");
List<GoblinStoreSearchDto> list = goblinCommonService.storeSearch(storeName, status);
return AjaxResult.success(list);
}
/**
* 导出订单明细
*
......@@ -77,7 +94,12 @@ public class ExportDataController extends BaseController {
}
private boolean timeIsNotNull(String beginTime, String endTime) {
return StringUtils.isNotBlank(beginTime) && StringUtils.isNotBlank(endTime) ? true : false;
return StringUtils.isNotBlank(beginTime) && StringUtils.isNotBlank(endTime);
}
private boolean hasHalfTime(String beginTime, String endTime) {
return (StringUtils.isNotBlank(beginTime) && StringUtils.isBlank(endTime))
|| (StringUtils.isBlank(beginTime) && StringUtils.isNotBlank(endTime));
}
......@@ -104,18 +126,20 @@ public class ExportDataController extends BaseController {
/**
* 导出商品订单
*
* @param beginTime
* @param endTime
* @return
* 店铺 / 下单时间 填了的条件全部 AND
*/
@PostMapping("/export/commodityOrder")
@ResponseBody
public AjaxResult exportCommodityOrder(String beginTime, String endTime) {
if (!timeIsNotNull(beginTime, endTime)) {
return error("开始时间和结束时间不能为空!");
public AjaxResult exportCommodityOrder(String beginTime, String endTime, String storeId) {
boolean hasStoreId = StringUtils.isNotBlank(storeId);
boolean hasOrderTime = timeIsNotNull(beginTime, endTime);
if (!hasStoreId && !hasOrderTime) {
return error("请至少填写店铺或下单时间其中一个条件!");
}
if (hasHalfTime(beginTime, endTime)) {
return error("下单时间请填写完整的开始和结束时间!");
}
List<OrderCommodityExportVo> list = exportService.exportCommodityOrder(beginTime, endTime);
List<OrderCommodityExportVo> list = exportService.exportCommodityOrder(beginTime, endTime, storeId);
if (list.size() == 0) {
return error("查无信息");
}
......
......@@ -46,10 +46,15 @@ public class GoblinCommonServiceImpl implements IGoblinCommonService {
@Override
public List<GoblinStoreSearchDto> storeSearch(String name, List<String> status) {
List<GoblinStoreInfo> list = goblinStoreInfoMapper.selectList(Wrappers.lambdaQuery(GoblinStoreInfo.class)
.like(GoblinStoreInfo::getStoreName, name)
LambdaQueryWrapper<GoblinStoreInfo> queryWrapper = Wrappers.lambdaQuery(GoblinStoreInfo.class);
if (StringUtil.isNotBlank(name)) {
queryWrapper.like(GoblinStoreInfo::getStoreName, name);
}
queryWrapper.eq(GoblinStoreInfo::getDelFlg, "0")
.in(GoblinStoreInfo::getStatus, status)
.select(GoblinStoreInfo::getStoreId, GoblinStoreInfo::getStoreName, GoblinStoreInfo::getStatus));
.orderByAsc(GoblinStoreInfo::getStoreName)
.select(GoblinStoreInfo::getStoreId, GoblinStoreInfo::getStoreName, GoblinStoreInfo::getStatus);
List<GoblinStoreInfo> list = goblinStoreInfoMapper.selectList(queryWrapper);
List<GoblinStoreSearchDto> dtoList = new ArrayList<>();
for (GoblinStoreInfo item : list) {
GoblinStoreSearchDto dto = GoblinStoreSearchDto.getNew();
......
......@@ -11,6 +11,8 @@ public class OrderCommodityExportVo implements Serializable, Cloneable {
@Excel(name = "商户订单号", cellType = Excel.ColumnType.STRING)
private String code;
@Excel(name = "店铺名称", cellType = Excel.ColumnType.STRING)
private String storeName;
@Excel(name = "微信/支付宝订单号", cellType = Excel.ColumnType.STRING)
private String paymentId;
@Excel(name = "商品名称", cellType = Excel.ColumnType.STRING)
......@@ -53,6 +55,7 @@ public class OrderCommodityExportVo implements Serializable, Cloneable {
this.setPriceRefund(source.getPriceRefund());
this.setStatus(source.getStatus());
this.setRefundAt(source.getRefundAt());
this.setStoreName(source.getStoreName());
return this;
}
......
......@@ -23,5 +23,5 @@ public interface IExportService {
List<OrderMemberExportVo> exportMemberOrder(String beginTime, String endTime);
//导出商品订单信息
List<OrderCommodityExportVo> exportCommodityOrder(String beginTime, String endTime);
List<OrderCommodityExportVo> exportCommodityOrder(String beginTime, String endTime, String storeId);
}
......@@ -8,13 +8,13 @@ import com.liquidnet.service.kylin.dao.MemberOrderExportDao;
import com.liquidnet.service.kylin.dao.OrderExportDao;
import com.liquidnet.service.kylin.mapper.KylinPerformancesMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
......@@ -110,12 +110,12 @@ public class ExportServiceImpl implements IExportService {
}
@Override
public List<OrderCommodityExportVo> exportCommodityOrder(String beginTime, String endTime) {
public List<OrderCommodityExportVo> exportCommodityOrder(String beginTime, String endTime, String storeId) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date beginDate = sdf.parse(beginTime);
Date endDate = sdf.parse(endTime);
List<CommodityOrderExportDao> list = performancesMapper.exportCommodityOrder(beginDate, endDate);
Date beginDate = parseDate(sdf, beginTime);
Date endDate = parseDate(sdf, endTime);
List<CommodityOrderExportDao> list = performancesMapper.exportCommodityOrder(beginDate, endDate, storeId);
List<OrderCommodityExportVo> voList = new ArrayList();
for (CommodityOrderExportDao item : list) {
voList.add(OrderCommodityExportVo.getNew().copyCommodityOrderExportVo(item));
......@@ -126,4 +126,11 @@ public class ExportServiceImpl implements IExportService {
throw new BusinessException("导出Excel失败,请联系网站管理员!");
}
}
private Date parseDate(SimpleDateFormat sdf, String time) throws ParseException {
if (StringUtils.isBlank(time)) {
return null;
}
return sdf.parse(time);
}
}
......@@ -24,5 +24,7 @@ public class CommodityOrderExportDao {
private String status;
//退款时间
private String refundAt;
//店铺名称
private String storeName;
}
......@@ -86,7 +86,7 @@ public interface KylinPerformancesMapper extends BaseMapper<KylinPerformances> {
//会员订单信息
List<MemberOrderExportDao> exportMemberOrder(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
//商品订单信息
List<CommodityOrderExportDao> exportCommodityOrder(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
List<CommodityOrderExportDao> exportCommodityOrder(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime, @Param("storeId") String storeId);
List<KylinPerformancesDto> getListAll(String title);
......
......@@ -104,6 +104,7 @@
<result column="price_refund" property="priceRefund"/>
<result column="status" property="status"/>
<result column="refund_at" property="refundAt"/>
<result column="store_name" property="storeName"/>
</resultMap>
<!-- <resultMap id="OrderExportDaoResult" type="com.liquidnet.service.kylin.dao.OrderExportDao">-->
......@@ -1175,7 +1176,8 @@ GROUP BY user_mobile,tickets_id;
WHEN temtable.STATUS = '7' THEN
'退货通过'
END AS status,
temtable.refund_at as refund_at
temtable.refund_at as refund_at,
temtable.store_name as store_name
from
(select do.code,
gso.payment_id,
......@@ -1186,15 +1188,22 @@ GROUP BY user_mobile,tickets_id;
gso.price_express,
gso.price_refund,
gso.status,
gbo.refund_at
gbo.refund_at,
max(gsi.store_name) as store_name
from goblin_store_order gso
inner join goblin_order_sku gos on gos.order_id = gso.order_id
inner join dragon_orders do on do.order_code = gso.master_order_code and do.status = 1
left join goblin_back_order gbo on gbo.order_id = gso.order_id and gbo.status in (2, 8)
where
do.created_at between #{beginTime} and #{endTime}
and gso.status not in (0, 5)
left join goblin_store_info gsi on gsi.store_id = gso.store_id
where gso.status not in (0, 5)
<if test="beginTime != null and endTime != null">
and do.created_at between #{beginTime} and #{endTime}
</if>
<if test="storeId != null and storeId != ''">
and gso.store_id = #{storeId}
</if>
group by do.code
<if test="beginTime != null and endTime != null">
union
select do.code,
gso.payment_id,
......@@ -1205,16 +1214,22 @@ GROUP BY user_mobile,tickets_id;
gso.price_express,
gso.price_refund,
gso.status,
gbo.refund_at
gbo.refund_at,
max(gsi.store_name) as store_name
from goblin_store_order gso
inner join goblin_order_sku gos on gos.order_id = gso.order_id
inner join dragon_orders do on do.order_code = gso.master_order_code and do.status = 1
inner join dragon_order_refunds dor on dor.order_refund_id = do.code
left join goblin_back_order gbo on gbo.order_id = gso.order_id and gbo.status in (2, 8)
where
dor.refund_at between #{beginTime} and #{endTime}
left join goblin_store_info gsi on gsi.store_id = gso.store_id
where dor.refund_at between #{beginTime} and #{endTime}
and gso.status not in (0, 5)
group by do.code) temtable group by temtable.code
<if test="storeId != null and storeId != ''">
and gso.store_id = #{storeId}
</if>
group by do.code
</if>
) temtable group by temtable.code
</select>
<select id="getSubscribeStatisticalByPerformancesId" resultType="com.liquidnet.service.kylin.dao.report.KylinPerformanceSubscribeStatisticalDao">
SELECT A.*,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment