|
|
|
@ -5,14 +5,13 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.hfkj.common.exception.ErrorCode; |
|
|
|
|
import com.hfkj.common.exception.ErrorHelp; |
|
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
|
import com.hfkj.common.utils.DateUtil; |
|
|
|
|
import com.hfkj.common.utils.RequestUtils; |
|
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
|
import com.hfkj.common.utils.*; |
|
|
|
|
import com.hfkj.config.CommonSysConst; |
|
|
|
|
import com.hfkj.entity.BsMer; |
|
|
|
|
import com.hfkj.entity.BsTradeOrder; |
|
|
|
|
import com.hfkj.entity.BsTradeOrderRefund; |
|
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
|
import com.hfkj.obs.HuaWeiYunObs; |
|
|
|
|
import com.hfkj.openapi.v1.model.*; |
|
|
|
|
import com.hfkj.openapi.v1.model.request.*; |
|
|
|
|
import com.hfkj.openapi.v1.model.response.ResponseQueryTradeModel; |
|
|
|
@ -22,11 +21,13 @@ import com.hfkj.openapi.v1.utils.SignatureUtil; |
|
|
|
|
import com.hfkj.service.BsMerKeyService; |
|
|
|
|
import com.hfkj.service.BsMerService; |
|
|
|
|
import com.hfkj.sysenum.*; |
|
|
|
|
import com.obs.services.model.PutObjectResult; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
|
import org.springframework.util.ResourceUtils; |
|
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
@ -35,11 +36,9 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.validation.constraints.NotBlank; |
|
|
|
|
import java.io.File; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.util.Calendar; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
|
@Api(value = "交易订单") |
|
|
|
@ -50,12 +49,12 @@ public class TradeController { |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private BsMerKeyService merKeyService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private OpenApiTradeOrderService openApiTradeOrderService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private BsMerService merService; |
|
|
|
|
@Resource |
|
|
|
|
private RedisTemplate redisTemplate; |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/preorder",method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
@ -267,15 +266,18 @@ public class TradeController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<TradeBillsModel> tradeBills = openApiTradeOrderService.tradeBills(body.getMerchantNo(), body.getBillDateS(), body.getBillDateE()); |
|
|
|
|
String fileName = "/temporary/" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
|
EasyExcel.write(CommonSysConst.getSysConfig().getFilesystem() + fileName, TradeBillsModel.class) |
|
|
|
|
String childPath = "temporary/"; |
|
|
|
|
String fileName = System.currentTimeMillis() + "" + Math.abs(new Random().nextInt() % 1000) + ".xlsx"; |
|
|
|
|
EasyExcel.write(CommonSysConst.getSysConfig().getFilesystem() + "/" + childPath + fileName, TradeBillsModel.class) |
|
|
|
|
.sheet(body.getMerchantNo()) |
|
|
|
|
.doWrite(tradeBills); |
|
|
|
|
|
|
|
|
|
String fileUrl = CommonSysConst.getSysConfig().getDomainName() + "/filesystem" + fileName; |
|
|
|
|
// 上传华为云 OBS
|
|
|
|
|
HuaWeiYunObs.obsUtilPutObject(CommonSysConst.getSysConfig().getFilesystem() + "/" + childPath + fileName, HuaWeiYunObs.bucketName, childPath + fileName); |
|
|
|
|
|
|
|
|
|
String fileUrl = CommonSysConst.getSysConfig().getObs_url() + "/"+ childPath + fileName; |
|
|
|
|
log.info("返回参数:" + fileUrl); |
|
|
|
|
return ResponseMsgUtil.success(fileUrl); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.info("出现异常:", e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
@ -305,12 +307,16 @@ public class TradeController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<TradeRefundBillsModel> tradeBills = openApiTradeOrderService.tradeRefundBills(body.getMerchantNo(), body.getBillDateS(), body.getBillDateE()); |
|
|
|
|
String fileName = "/temporary/" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
|
EasyExcel.write(CommonSysConst.getSysConfig().getFilesystem() + fileName, TradeRefundBillsModel.class) |
|
|
|
|
String childPath = "temporary/"; |
|
|
|
|
String fileName = System.currentTimeMillis() + "" + Math.abs(new Random().nextInt() % 1000) + ".xlsx"; |
|
|
|
|
EasyExcel.write(CommonSysConst.getSysConfig().getFilesystem() + "/" + childPath + fileName, TradeRefundBillsModel.class) |
|
|
|
|
.sheet(body.getMerchantNo()) |
|
|
|
|
.doWrite(tradeBills); |
|
|
|
|
|
|
|
|
|
String fileUrl = CommonSysConst.getSysConfig().getDomainName() + "/filesystem" + fileName; |
|
|
|
|
// 上传华为云 OBS
|
|
|
|
|
HuaWeiYunObs.obsUtilPutObject(CommonSysConst.getSysConfig().getFilesystem() + "/" + childPath + fileName, HuaWeiYunObs.bucketName, childPath + fileName); |
|
|
|
|
|
|
|
|
|
String fileUrl = CommonSysConst.getSysConfig().getObs_url() + "/"+ childPath + fileName; |
|
|
|
|
log.info("返回参数:" + fileUrl); |
|
|
|
|
return ResponseMsgUtil.success(fileUrl); |
|
|
|
|
|
|
|
|
@ -356,12 +362,16 @@ public class TradeController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<TradeDetailBillsModel> tradeBills = openApiTradeOrderService.tradeSettleBills(body.getMerchantNo(), body.getBillDateS(), body.getBillDateE()); |
|
|
|
|
String fileName = "/temporary/" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
|
EasyExcel.write(CommonSysConst.getSysConfig().getFilesystem() + fileName, TradeDetailBillsModel.class) |
|
|
|
|
.sheet("交易结算账单") |
|
|
|
|
String childPath = "temporary/"; |
|
|
|
|
String fileName = System.currentTimeMillis() + "" + Math.abs(new Random().nextInt() % 1000) + ".xlsx"; |
|
|
|
|
EasyExcel.write(CommonSysConst.getSysConfig().getFilesystem() + "/" + childPath + fileName, TradeDetailBillsModel.class) |
|
|
|
|
.sheet(body.getMerchantNo()) |
|
|
|
|
.doWrite(tradeBills); |
|
|
|
|
|
|
|
|
|
String fileUrl = CommonSysConst.getSysConfig().getDomainName() + "/filesystem" + fileName; |
|
|
|
|
// 上传华为云 OBS
|
|
|
|
|
HuaWeiYunObs.obsUtilPutObject(CommonSysConst.getSysConfig().getFilesystem() + "/" + childPath + fileName, HuaWeiYunObs.bucketName, childPath + fileName); |
|
|
|
|
|
|
|
|
|
String fileUrl = CommonSysConst.getSysConfig().getObs_url() + "/"+ childPath + fileName; |
|
|
|
|
log.info("返回参数:" + fileUrl); |
|
|
|
|
return ResponseMsgUtil.success(fileUrl); |
|
|
|
|
|
|
|
|
|