|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
package com.web.controller.business; |
|
|
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
@ -7,10 +8,18 @@ import com.hai.common.exception.ErrorHelp; |
|
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
|
import com.hai.common.security.UserCenter; |
|
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
|
import com.hai.entity.HighGasOrder; |
|
|
|
|
import com.hai.entity.HighOrder; |
|
|
|
|
import com.hai.enum_type.OrderPayTypeEnum; |
|
|
|
|
import com.hai.enum_type.OrderStatusEnum; |
|
|
|
|
import com.hai.enum_type.UserObjectTypeEnum; |
|
|
|
|
import com.hai.model.ResponseData; |
|
|
|
|
import com.hai.model.UserInfoModel; |
|
|
|
|
import com.hai.order.model.ExportGasOrderModel; |
|
|
|
|
import com.hai.order.model.OrderThirdPartyModel; |
|
|
|
|
import com.hai.order.service.OrderService; |
|
|
|
|
import com.hai.order.type.OrderOilStatus; |
|
|
|
|
import com.web.config.SysConst; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
@ -23,8 +32,12 @@ import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.io.File; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
@ -112,4 +125,92 @@ public class OrderThirdPartyController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/exportThirdPartyOrderList", method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "导出第三方订单列表") |
|
|
|
|
public ResponseData exportThirdPartyOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, |
|
|
|
|
@RequestParam(name = "memPhone", required = false) String memPhone, |
|
|
|
|
@RequestParam(name = "memCardNo", required = false) String memCardNo, |
|
|
|
|
@RequestParam(name = "payType", required = false) Integer payType, |
|
|
|
|
@RequestParam(name = "status", required = false) Integer status, |
|
|
|
|
@RequestParam(name = "companyId", required = false) Long companyId, |
|
|
|
|
@RequestParam(name = "createTimeS", required = false) Long createTimeS, |
|
|
|
|
@RequestParam(name = "createTimeE", required = false) Long createTimeE, |
|
|
|
|
@RequestParam(name = "payTimeS", required = false) Long payTimeS, |
|
|
|
|
@RequestParam(name = "payTimeE", required = false) Long payTimeE, |
|
|
|
|
@RequestParam(name = "productType", required = false) Integer productType, |
|
|
|
|
@RequestParam(name = "finishTimeS", required = false) Long finishTimeS, |
|
|
|
|
@RequestParam(name = "finishTimeE", required = false) Long finishTimeE) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
|
|
|
|
if (userInfoModel == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
|
|
|
|
} |
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { |
|
|
|
|
map.put("companyId" , companyId); |
|
|
|
|
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { |
|
|
|
|
map.put("companyId", userInfoModel.getBsCompany().getId()); |
|
|
|
|
} else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
|
|
|
|
} |
|
|
|
|
map.put("createTimeS", createTimeS); |
|
|
|
|
map.put("createTimeE", createTimeE); |
|
|
|
|
map.put("payTimeS", payTimeS); |
|
|
|
|
map.put("payTimeE", payTimeE); |
|
|
|
|
map.put("finishTimeS", finishTimeS); |
|
|
|
|
map.put("finishTimeE", finishTimeE); |
|
|
|
|
map.put("orderNo", orderNo); |
|
|
|
|
map.put("memPhone", memPhone); |
|
|
|
|
map.put("memCardNo", memCardNo); |
|
|
|
|
map.put("productType", productType); |
|
|
|
|
map.put("status", status); |
|
|
|
|
map.put("payType", payType); |
|
|
|
|
|
|
|
|
|
// 查询数据
|
|
|
|
|
List<HighOrder> orderList = orderService.getOrderList(map); |
|
|
|
|
|
|
|
|
|
List<OrderThirdPartyModel> dataList = new ArrayList<>(); |
|
|
|
|
OrderThirdPartyModel model; |
|
|
|
|
|
|
|
|
|
for (HighOrder thirdPartyModel : orderList) { |
|
|
|
|
model = new OrderThirdPartyModel(); |
|
|
|
|
|
|
|
|
|
model.setOrderNo(thirdPartyModel.getOrderNo()); |
|
|
|
|
model.setMemPhone(thirdPartyModel.getMemPhone()); |
|
|
|
|
model.setTitle(thirdPartyModel.getTitle()); |
|
|
|
|
model.setTotalPrice(thirdPartyModel.getTotalPrice()); |
|
|
|
|
model.setTotalDeductionPrice(thirdPartyModel.getTotalDeductionPrice()); |
|
|
|
|
model.setDeductionProductPrice(thirdPartyModel.getDeductionProductPrice()); |
|
|
|
|
model.setPayablePrice(thirdPartyModel.getPayablePrice()); |
|
|
|
|
model.setPayPrice(thirdPartyModel.getPayPrice()); |
|
|
|
|
model.setPayType(OrderPayTypeEnum.getNameByType(thirdPartyModel.getPayType())); |
|
|
|
|
model.setOrderStatus(OrderStatusEnum.getNameByType(thirdPartyModel.getOrderStatus())); |
|
|
|
|
model.setCreateTime(thirdPartyModel.getCreateTime()); |
|
|
|
|
model.setPayTime(thirdPartyModel.getPayTime()); |
|
|
|
|
dataList.add(model); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String fileUrl = SysConst.getSysConfig().getFileUrl() + "temporary/"; |
|
|
|
|
String pathName = System.currentTimeMillis()+".xlsx"; |
|
|
|
|
File file = new File(fileUrl); |
|
|
|
|
if (!file.exists()) { |
|
|
|
|
file.mkdirs(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
EasyExcel.write(fileUrl+pathName) |
|
|
|
|
.head(ExportGasOrderModel.class) |
|
|
|
|
.sheet("交易订单") |
|
|
|
|
.doWrite(dataList); |
|
|
|
|
return ResponseMsgUtil.success(pathName); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("OrderCouponController --> getOrderList() error!", e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|