袁野 3 months ago
commit ba56d995a2
  1. BIN
      bweb/lib/open-platform-sdk-1.0.21.jar
  2. 20
      bweb/pom.xml
  3. 4
      bweb/src/main/java/com/bweb/controller/FileUploadController.java
  4. 210
      bweb/src/main/java/com/bweb/controller/TestController.java
  5. 106
      bweb/src/main/java/com/bweb/controller/file/FileController.java
  6. 1
      cweb/src/main/java/com/cweb/config/AuthConfig.java
  7. 43
      cweb/src/main/java/com/cweb/controller/CommonController.java
  8. 4
      cweb/src/main/java/com/cweb/controller/goods/DeliveryAddressController.java
  9. 133
      cweb/src/main/java/com/cweb/controller/qianZhu/CinemaController.java
  10. 6
      order/src/main/java/com/order/controller/OrderAfterSalesApplyController.java
  11. 67
      order/src/main/java/com/order/controller/OrderController.java
  12. 11
      order/src/main/java/com/order/controller/business/BsOrderDownloadController.java
  13. 286
      order/src/main/java/com/order/controller/business/BsOrderGoodsController.java
  14. 51
      order/src/main/java/com/order/controller/business/OrderCouponController.java
  15. 120
      order/src/main/java/com/order/utils/excel/OrderCouponExcelMergeHandler.java
  16. 22
      order/src/main/resources/dev/logback.xml
  17. 22
      order/src/main/resources/prod/logback.xml
  18. 100
      schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java
  19. BIN
      service/lib/open-platform-sdk-1.0.21.jar
  20. 24
      service/pom.xml
  21. 2
      service/src/main/java/com/hfkj/common/utils/HttpsUtils.java
  22. 3
      service/src/main/java/com/hfkj/common/utils/OrderUtil.java
  23. 23
      service/src/main/java/com/hfkj/common/utils/RandomStringGeneratorUtil.java
  24. 8
      service/src/main/java/com/hfkj/config/CommonSysConfig.java
  25. 147
      service/src/main/java/com/hfkj/dao/BsHltCardRecordMapper.java
  26. 7
      service/src/main/java/com/hfkj/dao/BsHltCardRecordMapperExt.java
  27. 402
      service/src/main/java/com/hfkj/dao/BsHltCardRecordSqlProvider.java
  28. 7
      service/src/main/java/com/hfkj/dao/BsOrderCouponMapper.java
  29. 6
      service/src/main/java/com/hfkj/dao/BsOrderCouponMapperExt.java
  30. 313
      service/src/main/java/com/hfkj/entity/BsHltCardRecord.java
  31. 1334
      service/src/main/java/com/hfkj/entity/BsHltCardRecordExample.java
  32. 2
      service/src/main/java/com/hfkj/entity/BsOrderGoods.java
  33. 74
      service/src/main/java/com/hfkj/meituan/MeiTuanService.java
  34. 8
      service/src/main/java/com/hfkj/model/order/OrderCouponModel.java
  35. 116
      service/src/main/java/com/hfkj/model/order/orderExport/OrderGoodsExportModel.java
  36. 1
      service/src/main/java/com/hfkj/service/card/BsUserCardService.java
  37. 11
      service/src/main/java/com/hfkj/service/card/impl/BsUserCardServiceImpl.java
  38. 83
      service/src/main/java/com/hfkj/service/file/FileRecordsService.java
  39. 71
      service/src/main/java/com/hfkj/service/file/impl/FileRecordsServiceImpl.java
  40. 15
      service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java
  41. 49
      service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java
  42. 59
      service/src/main/java/com/hfkj/service/hlt/BsHltCardRecordService.java
  43. 152
      service/src/main/java/com/hfkj/service/hlt/HltCardRefundService.java
  44. 31
      service/src/main/java/com/hfkj/service/hlt/HuiLianTongUnionCardService.java
  45. 3
      service/src/main/java/com/hfkj/service/order/BsOrderService.java
  46. 3
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  47. 16
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  48. 56
      service/src/main/java/com/hfkj/service/order/OrderRefundSuccessService.java
  49. 12
      service/src/main/java/com/hfkj/service/order/impl/BsOrderAfterSalesApplyServiceImpl.java
  50. 15
      service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java
  51. 24
      service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java
  52. 13
      service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java
  53. 18
      service/src/main/java/com/hfkj/service/order/impl/OrderPayServiceImpl.java
  54. 59
      service/src/main/java/com/hfkj/sysenum/fileRecords/FileRecordsEnum.java
  55. 38
      service/src/main/java/com/hfkj/sysenum/hlt/HltCardRecordPayStatusEnum.java
  56. 32
      service/src/main/java/com/hfkj/sysenum/order/OrderLogisticsStatusEnum.java
  57. 13
      service/src/main/java/com/hfkj/sysenum/order/OrderStatusEnum.java
  58. 8
      service/src/main/resources/dev/commonConfig.properties
  59. 72
      user/src/main/java/com/user/controller/UserCardController.java

@ -18,6 +18,19 @@
<artifactId>service</artifactId>
<version>PACKT-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>meituan.skd</groupId>
<artifactId>meituan-open-sdk</artifactId>
<scope>system</scope>
<version>1.0.21</version>
<systemPath>${basedir}/lib/open-platform-sdk-1.0.21.jar</systemPath>
</dependency>
</dependencies>
<build>
@ -26,6 +39,13 @@
<directory>src/main/resources/${env}</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>${basedir}/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>

@ -101,7 +101,7 @@ public class FileUploadController {
}
@RequestMapping(value = "/fileUpload", method = RequestMethod.POST)
@ApiOperation(value = "上传文件(超过500KB压缩)")
@ApiOperation(value = "上传文件(超过1000KB压缩)")
@ResponseBody
public ResponseData fileUpload(@RequestParam(value = "files" , required = false) MultipartFile files,
HttpServletRequest request,
@ -139,7 +139,7 @@ public class FileUploadController {
fileNames.add(childPath + "/" + fileName);
// 图片压缩
InputStream fis = new FileInputStream(destDirName + File.separator + fileName);
if (fis.available() > 500000) {
if (fis.available() > 1000000) {
Thumbnails.of(new FileInputStream(destDirName + File.separator + fileName)).scale(0.5).toFile(new File(destDirName + File.separator + fileName));
}
PutObjectResult putObjectResult = HuaWeiYunObs.putObject(CommonSysConst.getSysConfig().getObsBucketName(),

@ -1,19 +1,23 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.OrderUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.CouponDiscountGoodsRel;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsSpecs;
import com.hfkj.common.utils.*;
import com.hfkj.entity.*;
import com.hfkj.meituan.MeiTuanService;
import com.hfkj.model.ResponseData;
import com.hfkj.service.discount.CouponDiscountService;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsMsgService;
import com.hfkj.service.goods.GoodsSpecsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.hlt.HltCanteenService;
import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.sysenum.order.OrderLogisticsStatusEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -26,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@ -44,6 +49,16 @@ public class TestController {
@Resource
private CouponDiscountService couponDiscountService;
@Resource
private BsOrderChildService orderChildService;
@Resource
private BsOrderGoodsService orderGoodsService;
@Resource
private BsOrderGoodsService bsOrderGoodsService;
@Resource
private GoodsUserAddressService addressService;
@RequestMapping(value="/canteenConsume",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "食堂消费")
@ -100,4 +115,189 @@ public class TestController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/orderGoodsUpdate",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "商品更新")
public ResponseData orderGoodsUpdate() {
try {
List<BsOrderGoods> orderGoodsList = orderGoodsService.getList();
for (BsOrderGoods goods : orderGoodsList) {
BsOrderChild child = orderChildService.getDetail(goods.getChildOrderNo());
goods.setStatus(child.getStatus());
goods.setUpdateTime(new Date());
orderGoodsService.update(goods);
}
return ResponseMsgUtil.success("成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/orderGoodsConfirmReceipt",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "商品确认收货")
public ResponseData orderGoodsConfirmReceipt() {
try {
Map<String , Object> map = new HashMap<>();
map.put("logisticsStatus" , "SIGN");
map.put("status" , 2);
List<BsOrderGoods> orderGoodsList = orderGoodsService.getList(map);
for (BsOrderGoods goods : orderGoodsList) {
// 判断时间是否是十天前
if (DateUtil.differentDays(goods.getCreateTime() , new Date()) > 9) {
bsOrderGoodsService.confirmReceipt(goods.getId());
goods.setStatus(3);
goods.setUpdateTime(new Date());
orderGoodsService.update(goods);
}
}
return ResponseMsgUtil.success("成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getLogisticsMsg",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询物流")
public ResponseData getLogisticsMsg(@RequestParam(value = "id" , required = false) Long id) {
try {
Map<String, Object> map = new HashMap<>();
BsOrderGoods orderGoods = bsOrderGoodsService.queryDetail(id);
if (orderGoods == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsUserAddress userAddress = addressService.queryDetail(orderGoods.getDeliveryAddressId());
if (userAddress == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(orderGoods.getLogisticsNo() , userAddress.getPhone());
if (logistics.getLogisticsStatus() != null) {
orderGoods.setLogisticsStatus(logistics.getLogisticsStatus());
orderGoods.setLogisticsStatusDesc(logistics.getLogisticsStatusDesc());
} else {
orderGoods.setLogisticsStatus(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getCode());
orderGoods.setLogisticsStatusDesc(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getName());
}
bsOrderGoodsService.update(orderGoods);
map.put("logistics", logistics);
JSONArray object = JSONArray.parseArray(logistics.getLogisticsTraceDetails());
map.put("logisticsTraceDetails", object);
return ResponseMsgUtil.success(map);
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询汇联通工会卡消费记录")
public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType,
@RequestParam(name = "cardNo", required = true) String cardNo) {
try {
JSONObject consumptionRecord = HuiLianTongUnionCardService.queryConsumptionRecordByBusiness(businessType, cardNo, 1661498490000L, 1882423290000L, 1, 10000);
if (StringUtils.isBlank(consumptionRecord.getString("data"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "");
}
JSONArray array = HuiLianTongUnionCardService.resolveResponse(consumptionRecord.getString("data")).getJSONArray(
"records");
return ResponseMsgUtil.success(array);
} catch (Exception e) {
log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/queryTransJournal", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询汇联通工会卡消费记录")
public ResponseData queryTransJournal(@RequestParam(name = "tranType", required = true) String tranType,
@RequestParam(name = "cardNo", required = true) String cardNo,
@RequestParam(value = "pageNum" , required = true) Integer pageNum,
@RequestParam(value = "pageSize" , required = true) Integer pageSize) {
try {
JSONObject consumptionRecord = HuiLianTongUnionCardService.queryTransJournal(cardNo , tranType);
if (StringUtils.isBlank(consumptionRecord.getString("data"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "");
}
JSONArray array = HuiLianTongUnionCardService.resolveResponse(consumptionRecord.getString("data")).getJSONArray(
"journals");
List<JSONObject> list = new ArrayList<>();
for (Object object : array) {
JSONObject journal = (JSONObject) object;
journal.put("tranAmount", journal.getBigDecimal("tranAmount").divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP));
list.add(journal);
}
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, list.size(), pageSize, new PageInfo<>(list)));
} catch (Exception e) {
log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/loginFree", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "H5免登接口")
public ResponseData loginFree(@RequestParam(name = "staffPhone", required = true) String staffPhone,
@RequestParam(name = "productType", required = true) String productType) {
try {
Map<String , Object> map = new HashMap<>();
Map<String , Object> staffInfo = new HashMap<>();
staffInfo.put("staffPhone", staffPhone);
map.put("staffInfo", staffInfo);
map.put("ts", new Date().getTime());
map.put("entId", 104310L);
map.put("productType", productType);
map.put("nonce" , RandomStringGeneratorUtil.generateRandomString(36));
return ResponseMsgUtil.success(MeiTuanService.loginFree(map));
} catch (Exception e) {
log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,106 @@
package com.bweb.controller.file;
import com.bweb.controller.cms.CmsContentController;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.FileRecords;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.file.FileRecordsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value="/file")
@Api(value="文件操作")
public class FileController {
Logger log = LoggerFactory.getLogger(CmsContentController.class);
@Resource
private FileRecordsService fileRecordsService;
@Resource
private UserCenter userCenter;
@RequestMapping(value="/getFileRecordsList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询列表")
public ResponseData getFileRecordsList( HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
Map<String, Object> map = new HashMap<>();
map.put("opId", userModel.getAccount().getId());
return ResponseMsgUtil.success(fileRecordsService.getList(map));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/findFileRecords",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询详情")
public ResponseData findFileRecords(
@RequestParam(value = "id" , required = true) Long id) {
try {
return ResponseMsgUtil.success(fileRecordsService.queryDetail(id));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getDownLoad",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "下载")
public ResponseData getDownLoad(
@RequestParam(value = "id" , required = true) Long id) {
try {
FileRecords fileRecords = fileRecordsService.queryDetail(id);
if (fileRecords.getStatus() != 1) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前状态错误!");
}
fileRecords.setStatus(1);
fileRecords.setUpdateTime(new Date());
fileRecords.setDownloadStatus(1);
fileRecords.setDownloadTime(new Date());
fileRecordsService.update(fileRecords);
return ResponseMsgUtil.success(fileRecords.getFileUrl());
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -93,6 +93,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/wxMsg/*")
.excludePathPatterns("/cinema/*")
.excludePathPatterns("/starbucks/*")
.excludePathPatterns("/c/*")
;
}

@ -7,11 +7,14 @@ import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.RedisUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsOrderGoods;
import com.hfkj.entity.GoodsLogistics;
import com.hfkj.entity.GoodsUserAddress;
import com.hfkj.model.ResponseData;
import com.hfkj.qianzhu.channel.QianZhuService;
import com.hfkj.service.CommonService;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -22,6 +25,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@ -41,19 +45,36 @@ public class CommonController {
@Resource
private BsOrderGoodsService bsOrderGoodsService;
@Resource
private GoodsUserAddressService addressService;
@RequestMapping(value = "/test", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "test")
public ResponseData test() {
try {
JSONObject refundObj = HuiLianTongUnionCardService.refund("R240805090735776", "240803201355633339");
/* String goodsDesc = "";
String tranDesc = "";
String businessType = "HiSen_phg_goods";
String instCode = "11101608";
// 工会卡支付
JSONObject consumption = HuiLianTongUnionCardService.consumption("240803201355633339_1", "8800030115015087807", new BigDecimal("27.40"), businessType, instCode, goodsDesc, tranDesc);
if (!consumption.getString("respCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage"));
}
// 响应参数
JSONObject consumptionResult = HuiLianTongUnionCardService.resolveResponse(consumption.getString("data"));
if (consumptionResult.getBoolean("success") != true) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message"));
}
*/
JSONObject refundObj = HuiLianTongUnionCardService.refund("R240816093659997", "240808134614258487");
if (!refundObj.getString("respCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refundObj.getString("respMessage"));
}
JSONObject consumptionResult = HuiLianTongUnionCardService.resolveResponse(refundObj.getString("data"));
if (!(consumptionResult.getBoolean("success") || Objects.equals(consumptionResult.getString("message"), "原交易已撤销,不可再次操作"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!"+consumptionResult.getString("message"));
if (consumptionResult.getBoolean("success") != true) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "交易失败!"+consumptionResult.getString("message"));
}
return ResponseMsgUtil.success(consumptionResult);
@ -96,7 +117,19 @@ public class CommonController {
Map<String, Object> params = new HashMap<>();
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(logisticsNo);
BsOrderGoods orderGoods = bsOrderGoodsService.findGoodsOrderLogisticsNo(logisticsNo);
if (orderGoods == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsUserAddress userAddress = addressService.queryDetail(orderGoods.getDeliveryAddressId());
if (userAddress == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(logisticsNo , userAddress.getPhone());
params.put("logistics", logistics);
JSONArray object = JSONArray.parseArray(logistics.getLogisticsTraceDetails());

@ -91,9 +91,7 @@ public class DeliveryAddressController {
deliveryAddress.setUpdateTime(new Date());
deliveryAddressService.create(deliveryAddress);
return ResponseMsgUtil.success("新增成功");
return ResponseMsgUtil.success(deliveryAddress);
} catch (Exception e) {
log.error("GoodsDetailController --> insertPrice() error!", e);

@ -2,15 +2,22 @@ package com.cweb.controller.qianZhu;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
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.PageUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsProductConfig;
import com.hfkj.model.ResponseData;
import com.hfkj.model.goods.GoodsModel;
import com.hfkj.qianzhu.channel.CinemaService;
import com.hfkj.service.BsProductConfigService;
import com.hfkj.sysenum.order.OrderChildProductTypeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jacoco.agent.rt.internal_035b120.core.internal.flow.IFrame;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
@ -22,9 +29,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Controller
@ -41,8 +46,12 @@ public class CinemaController {
@ResponseBody
@ApiOperation(value = "根据城市分页查询影片")
public ResponseData filmsPagedQuery(@RequestParam(value = "cityId", required = false) Integer cityId,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "cityCode", required = false) String cityCode,
@RequestParam(value = "cinemaId", required = false) String cinemaId,
@RequestParam(value = "like", required = false) Integer like,
@RequestParam(value = "grade", required = false) Integer grade,
@RequestParam(value = "publishDate", required = false) Integer publishDate,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize
) {
@ -58,10 +67,118 @@ public class CinemaController {
if (cinemaId != null) {
params.put("cinemaId", cinemaId);
}
params.put("pageIndex", pageNum);
params.put("pageSize", pageSize);
params.put("pageIndex", 1);
params.put("pageSize", 499);
JSONObject object = CinemaService.filmsPagedQuery(params);
JSONArray array = object.getJSONArray("data");
List<JSONObject> list = new ArrayList<>();
for (Object o : array) {
JSONObject item = (JSONObject) o;
if (item.getString("grade") == null) {
item.put("grade" , "0");
}
list.add(item);
}
if (list.isEmpty()) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无数据!");
}
if (name != null) {
list = list.stream()
.filter(s -> s.getString("name").contains(name)) // 使用contains方法进行模糊查询
.collect(Collectors.toList()); // 将结果收集到列表中
}
return ResponseMsgUtil.success(CinemaService.filmsPagedQuery(params));
if (publishDate != null) {
if (publishDate == 1) {
list = list.stream().sorted(
// 根据对象中的ID进行升序排序 小到大
Comparator.comparingLong(
e -> DateUtil.timesTamp(JSONObject.parseObject(e.toString()).getString("publishDate"))
)
// 放开下面的注释,使用reversed()方法,就是降序 大到小
// .reversed()
).collect(Collectors.toList());
}
if (publishDate == 2) {
list = list.stream().sorted(
// 根据对象中的ID进行升序排序 小到大
Comparator.comparingLong(
e -> DateUtil.timesTamp(JSONObject.parseObject(e.toString()).getString("publishDate"))
)
// 放开下面的注释,使用reversed()方法,就是降序 大到小
.reversed()
).collect(Collectors.toList());
}
}
// if (like != null) {
// if (like == 1) {
// list = list.stream().sorted(
// // 根据对象中的ID进行升序排序 小到大
// Comparator.comparingLong(
// e -> JSONObject.parseObject(e.toString()).getLong("like")
// )
// // 放开下面的注释,使用reversed()方法,就是降序 大到小
//// .reversed()
// ).collect(Collectors.toList());
// }
// if (like == 2) {
// list = list.stream().sorted(
// // 根据对象中的ID进行升序排序 小到大
// Comparator.comparingLong(
// e -> JSONObject.parseObject(e.toString()).getLong("like")
// )
// // 放开下面的注释,使用reversed()方法,就是降序 大到小
// .reversed()
// ).collect(Collectors.toList());
// }
//
// }
if (grade != null) {
if (grade == 1) {
list = list.stream().sorted(
// 根据对象中的ID进行升序排序 小到大
Comparator.comparingDouble(
e -> JSONObject.parseObject(e.toString()).getDouble("grade")
)
// 放开下面的注释,使用reversed()方法,就是降序 大到小
// .reversed()
).collect(Collectors.toList());
}
if (grade == 2) {
list = list.stream().sorted(
// 根据对象中的ID进行升序排序 小到大
Comparator.comparingDouble(
e -> JSONObject.parseObject(e.toString()).getDouble("grade")
)
// 放开下面的注释,使用reversed()方法,就是降序 大到小
.reversed()
).collect(Collectors.toList());
}
}
// list = list.stream().sorted(
// // 根据对象中的ID进行升序排序 小到大
// Comparator.comparingDouble(
// e -> JSONObject.parseObject(e.toString()).getDouble("grade")
// )
// // 放开下面的注释,使用reversed()方法,就是降序 大到小
// .reversed()
// ).collect(Collectors.toList());
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, list.size(), pageSize, new PageInfo<>(list)));
} catch (Exception e) {
log.error("error!",e);
@ -327,7 +444,7 @@ public class CinemaController {
if (areaPrices != null) {
String[] areaName = new String[]{"特价" , "优选" , "最佳"};
String[] areaName = new String[]{"特价" , "优选" , "最佳" , "中心" , "" , ""};
for (int i = 0; i < areaPrices.size(); i++) {
JSONObject priceObject = (JSONObject) areaPrices.get(i);
@ -337,7 +454,9 @@ public class CinemaController {
} else {
priceObject.put("salePrice" , priceObject.getBigDecimal("price"));
}
priceObject.put("areaName" , areaName[i]);
}
}

@ -226,6 +226,9 @@ public class OrderAfterSalesApplyController {
@RequestParam(value = "childOrderNo" , required = false) String childOrderNo,
@RequestParam(value = "applyNo" , required = false) String applyNo,
@RequestParam(value = "status" , required = false) Integer status,
@RequestParam(value = "productType" , required = false) String productType,
@RequestParam(value = "productName" , required = false) String productName,
@RequestParam(value = "orderNo" , required = false) String orderNo,
@RequestParam(value = "createTimeS" , required = false) Long createTimeS,
@RequestParam(value = "createTimeE" , required = false) Long createTimeE,
@RequestParam(value = "pageNum" , required = true) Integer pageNum,
@ -249,6 +252,9 @@ public class OrderAfterSalesApplyController {
param.put("childOrderNo", childOrderNo);
param.put("applyNo", applyNo);
param.put("status", status);
param.put("productType", productType);
param.put("productName", productName);
param.put("orderNo", orderNo);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);

@ -31,10 +31,8 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* @className: OrderController
@ -87,7 +85,6 @@ public class OrderController {
body.setUserName(userSession.getUser().getName());
body.setUserPhone(userSession.getUser().getPhone());
return ResponseMsgUtil.success(orderService.create(body));
} catch (Exception e) {
@ -204,5 +201,65 @@ public class OrderController {
}
@RequestMapping(value="/orderNum",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "订单数量")
public ResponseData orderNum() {
try {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
Map<String , Object> map = new HashMap<>();
map.put("userId" , userSession.getUser().getId());
List<BsOrder> bsOrder = orderService.getOrderList(map);
Map<Integer, List<BsOrder>> collect = bsOrder.stream().collect(Collectors.groupingBy(BsOrder::getOrderStatus));
List<JSONObject> countRecords = collect.keySet().stream().map(key -> {
JSONObject goodObject = new JSONObject(true);
goodObject.put("name", OrderStatusEnum.getData(key).getName());
goodObject.put("status", key);
goodObject.put("num",collect.get(key).size());
return goodObject;
}).collect(Collectors.toList());
return ResponseMsgUtil.success(countRecords);
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/deleteOrder",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "删除订单")
public ResponseData deleteOrder(@RequestBody JSONObject body) {
try {
if (body == null|| StringUtils.isBlank(body.getString("orderNo"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
BsOrder bsOrder = orderService.getDetail(body.getString("orderNo"));
if (bsOrder.getOrderStatus() != OrderStatusEnum.status5.getCode()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前状态不可删除!");
}
bsOrder.setOrderStatus(OrderStatusEnum.status0.getCode());
bsOrder.setUpdateTime(new Date());
orderService.deleteOrder(bsOrder);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,11 @@
package com.order.controller.business;
import io.swagger.annotations.Api;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping(value="/orderDownload")
@Api(value="订单下载管理")
public class BsOrderDownloadController {
}

@ -1,7 +1,8 @@
package com.order.controller.business;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
@ -9,30 +10,38 @@ import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.OrderUtil;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsOrderGoods;
import com.hfkj.entity.GoodsLogistics;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.*;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.order.orderExport.OrderGoodsExportModel;
import com.hfkj.service.file.FileRecordsService;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.order.OrderGoodsStatusEnum;
import com.hfkj.sysenum.fileRecords.FileRecordsEnum;
import com.hfkj.sysenum.order.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.io.File;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@Controller
@RequestMapping(value="/orderGoods")
@ -50,6 +59,15 @@ public class BsOrderGoodsController {
@Resource
private BsOrderService orderService;
@Resource
private FileRecordsService fileRecordsService;
@Resource
private GoodsUserAddressService addressService;
@Resource
private BsOrderGoodsService orderGoodsService;
@RequestMapping(value="/getListGoods",method = RequestMethod.GET)
@ResponseBody
@ -62,8 +80,10 @@ public class BsOrderGoodsController {
@RequestParam(value = "userPhone" , required = false) String userPhone,
@RequestParam(value = "goodsSpecsName" , required = false) String goodsSpecsName,
@RequestParam(value = "goodsName" , required = false) String goodsName,
@RequestParam(value = "logisticsStatus" , required = false) String logisticsStatus,
@RequestParam(value = "payType" , required = false) Integer payType,
@RequestParam(value = "status" , required = false) Integer status,
@RequestParam(value = "merId" , required = false) Long merId,
@RequestParam(value = "createTimeS" , required = false) Long createTimeS,
@RequestParam(value = "createTimeE" , required = false) Long createTimeE,
@RequestParam(value = "pageNum" , required = true) Integer pageNum,
@ -74,7 +94,9 @@ public class BsOrderGoodsController {
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
Map<String , Object> map = new HashMap<>();
if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
map.put("merId", merId);
}
if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) {
map.put("merId", userModel.getAccount().getObjectId());
}
@ -85,12 +107,12 @@ public class BsOrderGoodsController {
map.put("orderNo", orderNo);
map.put("childOrderNo", childOrderNo);
map.put("userPhone", userPhone);
map.put("logisticsStatus", logisticsStatus);
map.put("goodsSpecsName", goodsSpecsName);
map.put("goodsName", goodsName);
map.put("payType", payType);
map.put("createTimeS", createTimeS);
map.put("createTimeE", createTimeE);
map.put("status", status);
PageHelper.startPage(pageNum, pageSize);
@ -102,6 +124,157 @@ public class BsOrderGoodsController {
}
}
@RequestMapping(value="/exportGoodsOrder",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "导出商品订单")
public ResponseData exportGoodsOrder(@RequestParam(value = "logisticsNo" , required = false) String logisticsNo,
@RequestParam(value = "goodsType" , required = false) Long goodsType,
@RequestParam(value = "goodsBrand" , required = false) Long goodsBrand,
@RequestParam(value = "orderNo" , required = false) String orderNo,
@RequestParam(value = "childOrderNo" , required = false) String childOrderNo,
@RequestParam(value = "userPhone" , required = false) String userPhone,
@RequestParam(value = "goodsSpecsName" , required = false) String goodsSpecsName,
@RequestParam(value = "goodsName" , required = false) String goodsName,
@RequestParam(value = "logisticsStatus" , required = false) String logisticsStatus,
@RequestParam(value = "payType" , required = false) Integer payType,
@RequestParam(value = "status" , required = false) Integer status,
@RequestParam(value = "merId" , required = false) Long merId,
@RequestParam(value = "createTimeS" , required = false) Long createTimeS,
@RequestParam(value = "createTimeE" , required = false) Long createTimeE, HttpServletRequest request) {
// 插入下载记录
FileRecords fileRecords = new FileRecords();
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
Map<String , Object> map = new HashMap<>();
if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
map.put("merId", merId);
}
if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) {
map.put("merId", userModel.getAccount().getObjectId());
}
map.put("logisticsNo", logisticsNo);
map.put("goodsType", goodsType);
map.put("goodsBrand", goodsBrand);
map.put("orderNo", orderNo);
map.put("childOrderNo", childOrderNo);
map.put("userPhone", userPhone);
map.put("logisticsStatus", logisticsStatus);
map.put("goodsSpecsName", goodsSpecsName);
map.put("goodsName", goodsName);
map.put("payType", payType);
map.put("createTimeS", createTimeS);
map.put("createTimeE", createTimeE);
map.put("status", status);
String dataSting = "";
if (createTimeE != null) {
dataSting = DateUtil.date2String(DateUtil.long2Date(createTimeS) , DateUtil.YMDHMS) + "-" + DateUtil.date2String(DateUtil.long2Date(createTimeE) , DateUtil.YMDHMS);
} else {
dataSting = DateUtil.date2String(new Date(), DateUtil.YMDHMS);
}
String fileUrl = CommonSysConst.getSysConfig().getFileUrl();
String filePath = "/temporary/" + userModel.getAccount().getId() + "/" ;
String pathName = filePath + FileRecordsEnum.status1.getName() + "交易数据导出" + dataSting +".xlsx";
if (fileRecordsService.findExported(map.toString() , userModel.getAccount().getId())) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "相同导出内容请勿重复点击!");
}
fileRecords.setCreateTime(new Date());
fileRecords.setBusinessType(FileRecordsEnum.status1.getCode());
fileRecords.setDownloadConditions(map.toString());
fileRecords.setOpId(userModel.getAccount().getId());
fileRecords.setOpName(userModel.getAccount().getUserName());
fileRecords.setStatus(2);
fileRecords.setDownloadStatus(2);
fileRecords.setFileUrl(CommonSysConst.getSysConfig().getDomainName() + "/filesystem" + pathName);
fileRecords.setType("2");
fileRecords.setTitle(FileRecordsEnum.status1.getName() + "交易数据导出" + dataSting + ".xls");
fileRecordsService.create(fileRecords);
// 创建线程
ThreadPoolExecutor executor = new ThreadPoolExecutor(
2, // 核心线程数
5, // 最大线程数
1, // 线程空闲时间
TimeUnit.MINUTES, // 时间单位
new ArrayBlockingQueue<>(5), // 任务队列
new ThreadPoolExecutor.CallerRunsPolicy() // 拒绝策略
);
// 提交任务给线程池
executor.execute(() -> {
try {
List<BsOrderGoods> list = bsOrderGoodsService.getList(map);
List<OrderGoodsExportModel> goodsExportModels = new ArrayList<>();
for (BsOrderGoods bsOrderGoods : list) {
OrderGoodsExportModel orderGoodsExportModel = new OrderGoodsExportModel();
BeanUtils.copyProperties(orderGoodsExportModel, bsOrderGoods);
if (bsOrderGoods.getIntegralDiscountPrice() != null) {
orderGoodsExportModel.setIntegralDiscountPrice(BigDecimal.valueOf(bsOrderGoods.getIntegralDiscountPrice()).divide(new BigDecimal(100)));
}
if (bsOrderGoods.getPayChannel() != null) {
orderGoodsExportModel.setPayChannel(OrderPayChannelEnum.getData(bsOrderGoods.getPayChannel()).getName());
}
if (bsOrderGoods.getPayType() != null) {
orderGoodsExportModel.setPayType(OrderPayTypeEnum.getData(bsOrderGoods.getPayType()).getName());
}
if (bsOrderGoods.getStatus() != null) {
orderGoodsExportModel.setTradeStatus(OrderChildStatusEnum.getData(bsOrderGoods.getStatus()).getName());
}
goodsExportModels.add(orderGoodsExportModel);
}
File file = new File(fileUrl + filePath);
if (!file.exists()) {
file.mkdirs();
}
EasyExcel.write(fileUrl+pathName)
.head(OrderGoodsExportModel.class)
.sheet(fileRecords.getTitle())
.doWrite(goodsExportModels);
fileRecords.setStatus(1);
fileRecords.setUpdateTime(new Date());
fileRecordsService.update(fileRecords);
} catch (Exception e) {
fileRecords.setStatus(3);
fileRecords.setUpdateTime(new Date());
fileRecords.setExt1(e.toString());
fileRecordsService.update(fileRecords);
log.error("error!",e);
}
});
// 关闭线程池
executor.shutdown();
return ResponseMsgUtil.success(fileRecords);
} catch (Exception e) {
fileRecords.setStatus(3);
fileRecords.setUpdateTime(new Date());
fileRecordsService.update(fileRecords);
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/updateLogisticsNo",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "更新物流订单号")
@ -126,14 +299,12 @@ public class BsOrderGoodsController {
goodsOrder.setLogisticsNo(logisticsNo);
goodsOrder.setUpdateTime(new Date());
if (goodsOrder.getStatus() == OrderGoodsStatusEnum.status1.getCode()) {
goodsOrder.setStatus(OrderGoodsStatusEnum.status2.getCode());
}
// 删除缓存
orderService.cacheDelete(goodsOrder.getOrderNo());
bsOrderGoodsService.cacheDelete(goodsOrder.getLogisticsNo());
bsOrderGoodsService.update(goodsOrder);
getLogisticsMsg(goodsOrder.getId());
return ResponseMsgUtil.success("更新成功!");
} catch (Exception e) {
@ -147,19 +318,31 @@ public class BsOrderGoodsController {
@ApiOperation(value = "查询物流")
public ResponseData getLogisticsMsg(@RequestParam(value = "id" , required = false) Long id) {
try {
Map<String , Object> map = new HashMap<>();
Map<String, Object> map = new HashMap<>();
BsOrderGoods orderGoods = bsOrderGoodsService.queryDetail(id);
if (orderGoods == null || orderGoods.getLogisticsNo() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未发货!");
if (orderGoods == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(orderGoods.getLogisticsNo());
GoodsUserAddress userAddress = addressService.queryDetail(orderGoods.getDeliveryAddressId());
orderGoods.setLogisticsStatus(logistics.getLogisticsStatus());
orderGoods.setLogisticsStatusDesc(logistics.getLogisticsStatusDesc());
bsOrderGoodsService.update(orderGoods);
if (userAddress == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(orderGoods.getLogisticsNo() , userAddress.getPhone());
if (logistics.getLogisticsStatus() != null) {
orderGoods.setLogisticsStatus(logistics.getLogisticsStatus());
orderGoods.setLogisticsStatusDesc(logistics.getLogisticsStatusDesc());
} else {
orderGoods.setLogisticsStatus(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getCode());
orderGoods.setLogisticsStatusDesc(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getName());
}
bsOrderGoodsService.update(orderGoods);
map.put("logistics", logistics);
JSONArray object = JSONArray.parseArray(logistics.getLogisticsTraceDetails());
map.put("logisticsTraceDetails", object);
@ -186,4 +369,65 @@ public class BsOrderGoodsController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/updateShippingAddress",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "更新收货地址")
public ResponseData updateShippingAddress(@RequestParam(value = "orderNo" , required = true) String orderNo,
@RequestParam(value = "addressId" , required = true) Long addressId) {
try {
GoodsUserAddress deliveryAddress = addressService.queryDetail(addressId);
if (deliveryAddress == null) {
log.error("GoodsDetailController -> findGoodsDetailById() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相信息");
}
BsOrderGoods orderGoods = orderGoodsService.findGoodsOrder(orderNo);
if (orderGoods == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "未找到相信息");
}
orderGoods.setDeliveryAddressId(deliveryAddress.getId());
orderGoods.setUpdateTime(new Date());
orderGoods.setDeliveryAddress(deliveryAddress.getAddress());
orderGoodsService.update(orderGoods);
return ResponseMsgUtil.success("成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/goodsOrderCount",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "待收货数量")
public ResponseData goodsOrderCount(HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
Map<String , Object> map = new HashMap<>();
if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) {
map.put("merId", userModel.getAccount().getObjectId());
}
map.put("logisticsStatus", "待发货");
map.put("status", 2);
return ResponseMsgUtil.success(bsOrderGoodsService.getList(map).size());
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -7,19 +7,24 @@ import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsOrderCoupon;
import com.hfkj.entity.FileRecords;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.order.OrderCouponModel;
import com.hfkj.service.coupon.BsOrderCouponNoService;
import com.hfkj.service.coupon.BsOrderCouponService;
import com.hfkj.service.file.FileRecordsService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.fileRecords.FileRecordsEnum;
import com.hfkj.sysenum.order.OrderChildStatusEnum;
import com.hfkj.sysenum.order.OrderCouponNoStatusEnum;
import com.hfkj.sysenum.order.OrderPayChannelEnum;
import com.hfkj.sysenum.order.OrderPayTypeEnum;
import com.order.utils.excel.OrderCouponExcelMergeHandler;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -29,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.thymeleaf.util.DateUtils;
import javax.annotation.Resource;
import java.io.File;
@ -51,6 +57,8 @@ public class OrderCouponController {
private BsOrderCouponNoService orderCouponNoService;
@Resource
private UserCenter userCenter;
@Resource
private FileRecordsService fileRecordsService;
@RequestMapping(value="/queryCouNo",method = RequestMethod.GET)
@ResponseBody
@ -147,6 +155,8 @@ public class OrderCouponController {
@RequestParam(value = "couStatus" , required = false) Integer couStatus,
@RequestParam(value = "createTimeS" , required = false) Long createTimeS,
@RequestParam(value = "createTimeE" , required = false) Long createTimeE) {
FileRecords fileRecords = new FileRecords();
try {
Map<String,Object> param = new HashMap<>();
SecUserSessionObject userSessionObject = userCenter.getSessionModel(SecUserSessionObject.class);
@ -154,6 +164,8 @@ public class OrderCouponController {
} else if (SecUserObjectTypeEnum.type2.getCode() == userSessionObject.getAccount().getObjectType()) {
param.put("merId", userSessionObject.getAccount().getObjectId());
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
param.put("orderNo", orderNo);
param.put("userPhone", userPhone);
@ -165,8 +177,22 @@ public class OrderCouponController {
param.put("couStatus", couStatus);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);
List<OrderCouponModel> orderList = orderCouponService.getOrderList(param);
// 下载记录
fileRecords.setCreateTime(new Date());
fileRecords.setBusinessType(FileRecordsEnum.status2.getCode());
fileRecords.setDownloadConditions(param.toString());
fileRecords.setOpId(userSessionObject.getAccount().getId());
fileRecords.setOpName(userSessionObject.getAccount().getUserName());
fileRecords.setStatus(2);
fileRecords.setDownloadStatus(2);
fileRecords.setTitle(FileRecordsEnum.status2.getName() + DateUtil.date2String(new Date(System.currentTimeMillis()),DateUtil.YMDHMS) + ".xlsx");
fileRecords.setFileUrl(CommonSysConst.getSysConfig().getDomainName() + "/filesystem/temporary/" + fileRecords.getTitle());
fileRecords.setType("2");
fileRecordsService.create(fileRecords);
// 查询数据
List<OrderCouponModel> orderList = orderCouponService.getOrderList(param);
for (OrderCouponModel coupon : orderList) {
if (coupon.getPayChannel() != null) {
coupon.setPayChannel(OrderPayChannelEnum.getData(Integer.valueOf(coupon.getPayChannel())).getName());
@ -179,26 +205,35 @@ public class OrderCouponController {
coupon.setExceptionStatus(Boolean.getBoolean(coupon.getExceptionStatus())?"是":"否");
}
// 文件存放地址
String fileUrl = CommonSysConst.getSysConfig().getFileUrl() + "/temporary/";
String pathName = System.currentTimeMillis()+".xlsx";
File file = new File(fileUrl);
if (!file.exists()) {
file.mkdirs();
}
//设置第几列开始合并
int[] mergeColumnIndex = {0,1,2,17};
//设置第几行开始合并
// 需要合并的列
int[] mergeColumnIndex = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};
// 需要从第几行开始合并
int mergeRowIndex = 1;
EasyExcel.write(fileUrl+pathName)
// 生成excel文件
EasyExcel.write(fileUrl+fileRecords.getTitle())
.head(OrderCouponModel.class)
.sheet("虚拟商品订单")
//.registerWriteHandler(new ExcelFillCellMergeStrategyUtils(mergeRowIndex, mergeColumnIndex))
.registerWriteHandler(new OrderCouponExcelMergeHandler(mergeRowIndex, mergeColumnIndex))
.doWrite(orderList);
return ResponseMsgUtil.success(pathName);
fileRecords.setStatus(1);
fileRecords.setUpdateTime(new Date());
fileRecordsService.update(fileRecords);
return ResponseMsgUtil.success(fileRecords);
} catch (Exception e) {
fileRecords.setStatus(3);
fileRecords.setUpdateTime(new Date());
fileRecords.setExt1(e.toString());
fileRecordsService.update(fileRecords);
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}

@ -0,0 +1,120 @@
package com.order.utils.excel;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.write.handler.CellWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;
import java.util.List;
/**
* @className: ExcelMergeHandler
* @author: HuRui
* @date: 2024/8/17
**/
public class OrderCouponExcelMergeHandler implements CellWriteHandler {
private int[] mergeColumnIndex;
private int mergeRowIndex;
public OrderCouponExcelMergeHandler() {
}
/**
* 构造函数
*
* @param mergeRowIndex 合并开始的行索引
* @param mergeColumnIndex 要合并的列索引数组
*/
public OrderCouponExcelMergeHandler(int mergeRowIndex, int[] mergeColumnIndex) {
this.mergeRowIndex = mergeRowIndex;
this.mergeColumnIndex = mergeColumnIndex;
}
@Override
public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Head head, Integer integer, Integer integer1, Boolean aBoolean) {
}
@Override
public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, Head head, Integer integer, Boolean aBoolean) {
}
/**
* 当前单元格向上合并
*
* @param writeSheetHolder 当前工作表持有者
* @param cell 当前单元格
* @param curRowIndex 当前行索引
* @param curColIndex 当前列索引
*/
private void mergeWithPrevRow(WriteSheetHolder writeSheetHolder, Cell cell, int curRowIndex, int curColIndex) {
// 获取当前行的当前列的数据和上一行的当前列列数据,通过上一行数据是否相同进行合并
Object curData = cell.getCellTypeEnum() == CellType.STRING ? cell.getStringCellValue() : cell.getNumericCellValue();
// 获取前一个单元格的数据
Cell preCell = cell.getSheet().getRow(curRowIndex - 1).getCell(curColIndex);
Object preData = preCell.getCellTypeEnum() == CellType.STRING ? preCell.getStringCellValue() : preCell.getNumericCellValue();
// 当前交易单号
Cell curOrderNo = cell.getSheet().getRow(curRowIndex).getCell(0);
// 上一条交易单号
Cell preOrderNo = cell.getSheet().getRow(curRowIndex - 1).getCell(0);
// 判断当前单元格和前一个单元格的数据以及主键是否相同
if (curData.equals(preData) && curOrderNo.getStringCellValue().equals(preOrderNo.getStringCellValue())) {
// 获取工作表
Sheet sheet = writeSheetHolder.getSheet();
// 获取已合并的区域
List<CellRangeAddress> mergeRegions = sheet.getMergedRegions();
boolean isMerged = false;
// 检查前一个单元格是否已经被合并
for (int i = 0; i < mergeRegions.size() && !isMerged; i++) {
CellRangeAddress cellRangeAddr = mergeRegions.get(i);
// 若上一个单元格已经被合并,则先移出原有的合并单元,再重新添加合并单元
if (cellRangeAddr.isInRange(curRowIndex - 1, curColIndex)) {
sheet.removeMergedRegion(i);
cellRangeAddr.setLastRow(curRowIndex);
sheet.addMergedRegion(cellRangeAddr);
isMerged = true;
}
}
// 如果前一个单元格未被合并,则新增合并区域
if (!isMerged) {
CellRangeAddress cellRangeAddress = new CellRangeAddress(curRowIndex - 1, curRowIndex, curColIndex, curColIndex);
sheet.addMergedRegion(cellRangeAddress);
}
}
}
@Override
public void afterCellDataConverted(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, CellData cellData, Cell cell, Head head, Integer integer, Boolean aBoolean) {
}
@Override
public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<CellData> list, Cell cell, Head head, Integer integer, Boolean aBoolean) {
// 当前行索引
int curRowIndex = cell.getRowIndex();
// 当前列索引
int curColIndex = cell.getColumnIndex();
// 如果当前行大于合并开始行
if (curRowIndex > mergeRowIndex) {
// 当前列在需要合并的列中
for (int columnIndex : mergeColumnIndex) {
if (curColIndex == columnIndex) {
// 进行合并操作
mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex);
break;
}
}
}
}
}

@ -246,4 +246,26 @@
</logger>
<!-- 话费接口 -->
<!--美团接口 -->
<appender name="MeiTuanLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/MeiTuanLog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/MeiTuanLog/MeiTuanLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<logger name="com.hfkj.meituan.MeiTuanService" level="INFO">
<appender-ref ref="MeiTuanLog" />
</logger>
<!-- 美团接口 -->
</configuration>

@ -245,4 +245,26 @@
</logger>
<!-- 话费接口 -->
<!--美团接口 -->
<appender name="MeiTuanLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/MeiTuanLog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/MeiTuanLog/MeiTuanLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<logger name="com.hfkj.meituan.MeiTuanService" level="INFO">
<appender-ref ref="MeiTuanLog" />
</logger>
<!-- 美团接口 -->
</configuration>

@ -0,0 +1,100 @@
package com.hfkj.schedule;
import com.alibaba.fastjson.JSONArray;
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.entity.BsOrderGoods;
import com.hfkj.entity.GoodsLogistics;
import com.hfkj.entity.GoodsUserAddress;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.sysenum.order.OrderLogisticsStatusEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName OrderGoodsSchedule
* @Author Sum1Dream
* @Description 实物订单定时任务
* @Date 2024/8/12 下午3:00
**/
@Configuration
public class OrderGoodsSchedule {
private static Logger log = LoggerFactory.getLogger(OrderGoodsSchedule.class);
@Resource
private BsOrderGoodsService orderGoodsService;
@Resource
private BsOrderGoodsService bsOrderGoodsService;
@Resource
private GoodsUserAddressService addressService;
//每日凌晨12点5秒执行一次
@Scheduled(cron = "5 0 0 * * ?")
public void orderGoodsConfirmReceipt() {
Map<String , Object> map = new HashMap<>();
map.put("logisticsStatus" , "SIGN");
map.put("status" , 2);
List<BsOrderGoods> orderGoodsList = orderGoodsService.getList(map);
for (BsOrderGoods goods : orderGoodsList) {
// 判断时间是否是十天前
if (DateUtil.differentDays(goods.getCreateTime() , new Date()) > 10) {
bsOrderGoodsService.confirmReceipt(goods.getId());
}
}
}
@Scheduled(cron = "30 0 0 * * ?")
public void getLogisticsMsg() {
Map<String , Object> objectMap = new HashMap<>();
objectMap.put("status" , 2);
List<BsOrderGoods> orderGoodsList = orderGoodsService.getList(objectMap);
for (BsOrderGoods goods : orderGoodsList) {
if (goods == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsUserAddress userAddress = addressService.queryDetail(goods.getDeliveryAddressId());
if (userAddress == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(goods.getLogisticsNo() , userAddress.getPhone());
if (logistics.getLogisticsStatus() != null) {
goods.setLogisticsStatus(logistics.getLogisticsStatus());
goods.setLogisticsStatusDesc(logistics.getLogisticsStatusDesc());
} else {
goods.setLogisticsStatus(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getCode());
goods.setLogisticsStatusDesc(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getName());
}
goods.setUpdateTime(new Date());
bsOrderGoodsService.update(goods);
}
}
}

@ -20,6 +20,7 @@
<joda-time-version>2.9.9</joda-time-version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -248,6 +249,20 @@
<artifactId>ocr_api20210707</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>meituan.skd</groupId>
<artifactId>meituan-open-sdk</artifactId>
<scope>system</scope>
<version>1.0.21</version>
<systemPath>${basedir}/lib/open-platform-sdk-1.0.21.jar</systemPath>
</dependency>
</dependencies>
<build>
<resources>
@ -255,6 +270,15 @@
<directory>src/main/resources/${env}</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>${basedir}/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources>
</build>
</project>

@ -48,7 +48,7 @@ public class HttpsUtils {
private static PoolingHttpClientConnectionManager connMgr;
private static RequestConfig requestConfig;
private static final int MAX_TIMEOUT = 7000;
private static final int MAX_TIMEOUT = 1000 * 25;
static {
// 设置连接池

@ -71,13 +71,14 @@ public class OrderUtil {
* @return
* @throws Exception
*/
public static JSONObject getLogisticsMsg(String num) {
public static JSONObject getLogisticsMsg(String num , String mobile) {
String appcode = "f9ace4c915054ca697a76fb9a4e1e8c0";
Map<String, String> headers = new HashMap<>();
headers.put("Authorization", "APPCODE " + appcode);
Map<String, String> querys = new HashMap<>();
querys.put("number", num);
querys.put("mobile", mobile);
return HttpsUtils.doGet("https://express3.market.alicloudapi.com/express3" , querys ,headers);
}

@ -0,0 +1,23 @@
package com.hfkj.common.utils;
import java.util.Random;
/**
* @ClassName RandomStringGeneratorUtil
* @Author Sum1Dream
* @Description 生成随机数
* @Date 2024/8/27 上午11:33
**/
public class RandomStringGeneratorUtil {
public static String generateRandomString(int stringLength) {
char[] chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".toCharArray();
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < stringLength; i++) {
char c = chars[random.nextInt(chars.length)];
sb.append(c);
}
return sb.toString();
}
}

@ -130,4 +130,12 @@ public class CommonSysConfig {
private String CtApiKey;
private String ctMemberId;
private String ctPostUrl;
/**
* 美团接口请求参数
*/
private String mtNotifyUrl;
private String mtAccessKey;
private String mtSecretKey;
private String mtPostUrl;
}

@ -0,0 +1,147 @@
package com.hfkj.dao;
import com.hfkj.entity.BsHltCardRecord;
import com.hfkj.entity.BsHltCardRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface BsHltCardRecordMapper extends BsHltCardRecordMapperExt {
@SelectProvider(type=BsHltCardRecordSqlProvider.class, method="countByExample")
long countByExample(BsHltCardRecordExample example);
@DeleteProvider(type=BsHltCardRecordSqlProvider.class, method="deleteByExample")
int deleteByExample(BsHltCardRecordExample example);
@Delete({
"delete from bs_hlt_card_record",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into bs_hlt_card_record (order_no, card_no, ",
"user_phone, pay_order_no, ",
"pay_serial_no, pay_price, ",
"pay_status, create_time, ",
"update_time, pay_time, ",
"refund_time, exception_status, ",
"exception_content, ext_1, ",
"ext_2, ext_3)",
"values (#{orderNo,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, ",
"#{userPhone,jdbcType=VARCHAR}, #{payOrderNo,jdbcType=VARCHAR}, ",
"#{paySerialNo,jdbcType=VARCHAR}, #{payPrice,jdbcType=DECIMAL}, ",
"#{payStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, ",
"#{refundTime,jdbcType=TIMESTAMP}, #{exceptionStatus,jdbcType=BIT}, ",
"#{exceptionContent,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsHltCardRecord record);
@InsertProvider(type=BsHltCardRecordSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(BsHltCardRecord record);
@SelectProvider(type=BsHltCardRecordSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="card_no", property="cardNo", jdbcType=JdbcType.VARCHAR),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_order_no", property="payOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_status", property="payStatus", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="exception_status", property="exceptionStatus", jdbcType=JdbcType.BIT),
@Result(column="exception_content", property="exceptionContent", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<BsHltCardRecord> selectByExample(BsHltCardRecordExample example);
@Select({
"select",
"id, order_no, card_no, user_phone, pay_order_no, pay_serial_no, pay_price, pay_status, ",
"create_time, update_time, pay_time, refund_time, exception_status, exception_content, ",
"ext_1, ext_2, ext_3",
"from bs_hlt_card_record",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="card_no", property="cardNo", jdbcType=JdbcType.VARCHAR),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_order_no", property="payOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_status", property="payStatus", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="exception_status", property="exceptionStatus", jdbcType=JdbcType.BIT),
@Result(column="exception_content", property="exceptionContent", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
BsHltCardRecord selectByPrimaryKey(Long id);
@UpdateProvider(type=BsHltCardRecordSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") BsHltCardRecord record, @Param("example") BsHltCardRecordExample example);
@UpdateProvider(type=BsHltCardRecordSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") BsHltCardRecord record, @Param("example") BsHltCardRecordExample example);
@UpdateProvider(type=BsHltCardRecordSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(BsHltCardRecord record);
@Update({
"update bs_hlt_card_record",
"set order_no = #{orderNo,jdbcType=VARCHAR},",
"card_no = #{cardNo,jdbcType=VARCHAR},",
"user_phone = #{userPhone,jdbcType=VARCHAR},",
"pay_order_no = #{payOrderNo,jdbcType=VARCHAR},",
"pay_serial_no = #{paySerialNo,jdbcType=VARCHAR},",
"pay_price = #{payPrice,jdbcType=DECIMAL},",
"pay_status = #{payStatus,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"pay_time = #{payTime,jdbcType=TIMESTAMP},",
"refund_time = #{refundTime,jdbcType=TIMESTAMP},",
"exception_status = #{exceptionStatus,jdbcType=BIT},",
"exception_content = #{exceptionContent,jdbcType=VARCHAR},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(BsHltCardRecord record);
}

@ -0,0 +1,7 @@
package com.hfkj.dao;
/**
* mapper扩展类
*/
public interface BsHltCardRecordMapperExt {
}

@ -0,0 +1,402 @@
package com.hfkj.dao;
import com.hfkj.entity.BsHltCardRecord;
import com.hfkj.entity.BsHltCardRecordExample.Criteria;
import com.hfkj.entity.BsHltCardRecordExample.Criterion;
import com.hfkj.entity.BsHltCardRecordExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class BsHltCardRecordSqlProvider {
public String countByExample(BsHltCardRecordExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("bs_hlt_card_record");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(BsHltCardRecordExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("bs_hlt_card_record");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(BsHltCardRecord record) {
SQL sql = new SQL();
sql.INSERT_INTO("bs_hlt_card_record");
if (record.getOrderNo() != null) {
sql.VALUES("order_no", "#{orderNo,jdbcType=VARCHAR}");
}
if (record.getCardNo() != null) {
sql.VALUES("card_no", "#{cardNo,jdbcType=VARCHAR}");
}
if (record.getUserPhone() != null) {
sql.VALUES("user_phone", "#{userPhone,jdbcType=VARCHAR}");
}
if (record.getPayOrderNo() != null) {
sql.VALUES("pay_order_no", "#{payOrderNo,jdbcType=VARCHAR}");
}
if (record.getPaySerialNo() != null) {
sql.VALUES("pay_serial_no", "#{paySerialNo,jdbcType=VARCHAR}");
}
if (record.getPayPrice() != null) {
sql.VALUES("pay_price", "#{payPrice,jdbcType=DECIMAL}");
}
if (record.getPayStatus() != null) {
sql.VALUES("pay_status", "#{payStatus,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getPayTime() != null) {
sql.VALUES("pay_time", "#{payTime,jdbcType=TIMESTAMP}");
}
if (record.getRefundTime() != null) {
sql.VALUES("refund_time", "#{refundTime,jdbcType=TIMESTAMP}");
}
if (record.getExceptionStatus() != null) {
sql.VALUES("exception_status", "#{exceptionStatus,jdbcType=BIT}");
}
if (record.getExceptionContent() != null) {
sql.VALUES("exception_content", "#{exceptionContent,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(BsHltCardRecordExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("order_no");
sql.SELECT("card_no");
sql.SELECT("user_phone");
sql.SELECT("pay_order_no");
sql.SELECT("pay_serial_no");
sql.SELECT("pay_price");
sql.SELECT("pay_status");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("pay_time");
sql.SELECT("refund_time");
sql.SELECT("exception_status");
sql.SELECT("exception_content");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("bs_hlt_card_record");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
BsHltCardRecord record = (BsHltCardRecord) parameter.get("record");
BsHltCardRecordExample example = (BsHltCardRecordExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("bs_hlt_card_record");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getOrderNo() != null) {
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
}
if (record.getCardNo() != null) {
sql.SET("card_no = #{record.cardNo,jdbcType=VARCHAR}");
}
if (record.getUserPhone() != null) {
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}");
}
if (record.getPayOrderNo() != null) {
sql.SET("pay_order_no = #{record.payOrderNo,jdbcType=VARCHAR}");
}
if (record.getPaySerialNo() != null) {
sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}");
}
if (record.getPayPrice() != null) {
sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}");
}
if (record.getPayStatus() != null) {
sql.SET("pay_status = #{record.payStatus,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getPayTime() != null) {
sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}");
}
if (record.getRefundTime() != null) {
sql.SET("refund_time = #{record.refundTime,jdbcType=TIMESTAMP}");
}
if (record.getExceptionStatus() != null) {
sql.SET("exception_status = #{record.exceptionStatus,jdbcType=BIT}");
}
if (record.getExceptionContent() != null) {
sql.SET("exception_content = #{record.exceptionContent,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("bs_hlt_card_record");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
sql.SET("card_no = #{record.cardNo,jdbcType=VARCHAR}");
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}");
sql.SET("pay_order_no = #{record.payOrderNo,jdbcType=VARCHAR}");
sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}");
sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}");
sql.SET("pay_status = #{record.payStatus,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}");
sql.SET("refund_time = #{record.refundTime,jdbcType=TIMESTAMP}");
sql.SET("exception_status = #{record.exceptionStatus,jdbcType=BIT}");
sql.SET("exception_content = #{record.exceptionContent,jdbcType=VARCHAR}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
BsHltCardRecordExample example = (BsHltCardRecordExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(BsHltCardRecord record) {
SQL sql = new SQL();
sql.UPDATE("bs_hlt_card_record");
if (record.getOrderNo() != null) {
sql.SET("order_no = #{orderNo,jdbcType=VARCHAR}");
}
if (record.getCardNo() != null) {
sql.SET("card_no = #{cardNo,jdbcType=VARCHAR}");
}
if (record.getUserPhone() != null) {
sql.SET("user_phone = #{userPhone,jdbcType=VARCHAR}");
}
if (record.getPayOrderNo() != null) {
sql.SET("pay_order_no = #{payOrderNo,jdbcType=VARCHAR}");
}
if (record.getPaySerialNo() != null) {
sql.SET("pay_serial_no = #{paySerialNo,jdbcType=VARCHAR}");
}
if (record.getPayPrice() != null) {
sql.SET("pay_price = #{payPrice,jdbcType=DECIMAL}");
}
if (record.getPayStatus() != null) {
sql.SET("pay_status = #{payStatus,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getPayTime() != null) {
sql.SET("pay_time = #{payTime,jdbcType=TIMESTAMP}");
}
if (record.getRefundTime() != null) {
sql.SET("refund_time = #{refundTime,jdbcType=TIMESTAMP}");
}
if (record.getExceptionStatus() != null) {
sql.SET("exception_status = #{exceptionStatus,jdbcType=BIT}");
}
if (record.getExceptionContent() != null) {
sql.SET("exception_content = #{exceptionContent,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, BsHltCardRecordExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -131,10 +131,17 @@ public interface BsOrderCouponMapper extends BsOrderCouponMapperExt {
@Select({
"select",
<<<<<<< HEAD
"id, order_no, child_order_no, mer_id, platform_code, user_id, user_phone, goods_id, ",
"goods_name, goods_type_id, goods_type_name, goods_brand_id, goods_brand_name, ",
"goods_specs_id, goods_specs_name, goods_spesc_original_price, goods_spesc_sale_price, ",
"goods_vpd_id, goods_vpd_key, goods_vpd_source, goods_count, total_price, total_deduction_price, ",
=======
"id, order_no, child_order_no, mer_id, user_id, user_phone, goods_id, goods_name, ",
"goods_type_id, goods_type_name, goods_brand_id, goods_brand_name, goods_specs_id, ",
"goods_specs_name, goods_spesc_original_price, goods_spesc_sale_price, goods_vpd_id, ",
"goods_vpd_key, goods_vpd_source, goods_count, total_price, total_deduction_price, ",
>>>>>>> 829e638cdd103b441766e88156903755733dca7a
"coupon_discount_price, integral_discount_price, pay_real_price, pay_channel, ",
"pay_serial_no, pay_type, `status`, create_time, pay_time, cancel_time, refund_time, ",
"finish_time, update_time, ext_1, ext_2, ext_3",

@ -20,7 +20,8 @@ public interface BsOrderCouponMapperExt {
" b.goods_vpd_key goodsKey," +
" b.goods_name goodsName," +
" b.goods_specs_name goodsSpecsName, " +
" b.goods_spesc_original_price goodsPrice," +
" b.goods_spesc_original_price goodsOriginalPrice," +
" b.goods_spesc_sale_price goodsSalePrice," +
" b.goods_count goodsCount," +
" b.total_price totalPrice," +
" b.total_deduction_price totalDeductionPrice," +
@ -56,7 +57,8 @@ public interface BsOrderCouponMapperExt {
" <if test='param.createTimeS != null'><![CDATA[ and b.create_time >= #{param.createTimeS} ]]></if>" +
" <if test='param.createTimeE != null'><![CDATA[ and b.create_time <= #{param.createTimeE} ]]></if>" +
" GROUP BY a.id" +
" ORDER BY b.create_time desc,b.order_no" +
" ORDER BY b.create_time desc,b.child_order_no" +
"</script>")
List<OrderCouponModel> getOrderList(@Param("param") Map<String,Object> param);
}

@ -0,0 +1,313 @@
package com.hfkj.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* bs_hlt_card_record
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class BsHltCardRecord implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 订单号
*/
private String orderNo;
/**
* 卡号
*/
private String cardNo;
/**
* 用户电话
*/
private String userPhone;
/**
* 支付订单号
*/
private String payOrderNo;
/**
* 渠道支付订单号
*/
private String paySerialNo;
/**
* 支付金额
*/
private BigDecimal payPrice;
/**
* 支付状态 1待支付 2已支付 3已退款
*/
private Integer payStatus;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 支付时间
*/
private Date payTime;
/**
* 退款时间
*/
private Date refundTime;
/**
* 是否异常0 1
*/
private Boolean exceptionStatus;
/**
* 异常内容
*/
private String exceptionContent;
private String ext1;
private String ext2;
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getCardNo() {
return cardNo;
}
public void setCardNo(String cardNo) {
this.cardNo = cardNo;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public String getPayOrderNo() {
return payOrderNo;
}
public void setPayOrderNo(String payOrderNo) {
this.payOrderNo = payOrderNo;
}
public String getPaySerialNo() {
return paySerialNo;
}
public void setPaySerialNo(String paySerialNo) {
this.paySerialNo = paySerialNo;
}
public BigDecimal getPayPrice() {
return payPrice;
}
public void setPayPrice(BigDecimal payPrice) {
this.payPrice = payPrice;
}
public Integer getPayStatus() {
return payStatus;
}
public void setPayStatus(Integer payStatus) {
this.payStatus = payStatus;
}
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;
}
public Date getPayTime() {
return payTime;
}
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
public Date getRefundTime() {
return refundTime;
}
public void setRefundTime(Date refundTime) {
this.refundTime = refundTime;
}
public Boolean getExceptionStatus() {
return exceptionStatus;
}
public void setExceptionStatus(Boolean exceptionStatus) {
this.exceptionStatus = exceptionStatus;
}
public String getExceptionContent() {
return exceptionContent;
}
public void setExceptionContent(String exceptionContent) {
this.exceptionContent = exceptionContent;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
BsHltCardRecord other = (BsHltCardRecord) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo()))
&& (this.getCardNo() == null ? other.getCardNo() == null : this.getCardNo().equals(other.getCardNo()))
&& (this.getUserPhone() == null ? other.getUserPhone() == null : this.getUserPhone().equals(other.getUserPhone()))
&& (this.getPayOrderNo() == null ? other.getPayOrderNo() == null : this.getPayOrderNo().equals(other.getPayOrderNo()))
&& (this.getPaySerialNo() == null ? other.getPaySerialNo() == null : this.getPaySerialNo().equals(other.getPaySerialNo()))
&& (this.getPayPrice() == null ? other.getPayPrice() == null : this.getPayPrice().equals(other.getPayPrice()))
&& (this.getPayStatus() == null ? other.getPayStatus() == null : this.getPayStatus().equals(other.getPayStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getPayTime() == null ? other.getPayTime() == null : this.getPayTime().equals(other.getPayTime()))
&& (this.getRefundTime() == null ? other.getRefundTime() == null : this.getRefundTime().equals(other.getRefundTime()))
&& (this.getExceptionStatus() == null ? other.getExceptionStatus() == null : this.getExceptionStatus().equals(other.getExceptionStatus()))
&& (this.getExceptionContent() == null ? other.getExceptionContent() == null : this.getExceptionContent().equals(other.getExceptionContent()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode());
result = prime * result + ((getCardNo() == null) ? 0 : getCardNo().hashCode());
result = prime * result + ((getUserPhone() == null) ? 0 : getUserPhone().hashCode());
result = prime * result + ((getPayOrderNo() == null) ? 0 : getPayOrderNo().hashCode());
result = prime * result + ((getPaySerialNo() == null) ? 0 : getPaySerialNo().hashCode());
result = prime * result + ((getPayPrice() == null) ? 0 : getPayPrice().hashCode());
result = prime * result + ((getPayStatus() == null) ? 0 : getPayStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getPayTime() == null) ? 0 : getPayTime().hashCode());
result = prime * result + ((getRefundTime() == null) ? 0 : getRefundTime().hashCode());
result = prime * result + ((getExceptionStatus() == null) ? 0 : getExceptionStatus().hashCode());
result = prime * result + ((getExceptionContent() == null) ? 0 : getExceptionContent().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", orderNo=").append(orderNo);
sb.append(", cardNo=").append(cardNo);
sb.append(", userPhone=").append(userPhone);
sb.append(", payOrderNo=").append(payOrderNo);
sb.append(", paySerialNo=").append(paySerialNo);
sb.append(", payPrice=").append(payPrice);
sb.append(", payStatus=").append(payStatus);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", payTime=").append(payTime);
sb.append(", refundTime=").append(refundTime);
sb.append(", exceptionStatus=").append(exceptionStatus);
sb.append(", exceptionContent=").append(exceptionContent);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -170,7 +170,7 @@ public class BsOrderGoods implements Serializable {
private Integer payType;
/**
* 1:待发货 2:已发货 3配送中 4已送达 5已取消 6退货中 7已退货 8待支付 0:删除
* bs_order_child订单表同步
*/
private Integer status;

@ -0,0 +1,74 @@
package com.hfkj.meituan;
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.HttpsUtils;
import com.hfkj.config.CommonSysConst;
import com.meituan.sqt.utils.EncryptUtil;
import com.meituan.sqt.utils.JsonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
/**
* @ClassName MeiTuanService
* @Author Sum1Dream
* @Description 美团接口
* @Date 2024/8/26 下午4:52
**/
public class MeiTuanService {
private static Logger log = LoggerFactory.getLogger(MeiTuanService.class);
/**
* @MethodName loginFree
* @Description: H5免登接口
* @param map
* @return: com.alibaba.fastjson.JSONObject
* @Author: Sum1Dream
* @Date: 2024/8/27 上午11:16
*/
public static JSONObject loginFree(Map<String , Object> map) throws Exception {
JSONObject object = request("" , map);
if (object.getBoolean("success") && object.getInteger("code") == 10000) {
return object;
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询失败!");
}
}
/**
* 请求
* @param postUrl 接口请求地址
* @param param 参数
* @return
* @throws Exception
*/
public static JSONObject request(String postUrl, Map<String,Object> param) throws Exception {
log.info("============ 千猪请求-START =============");
param.put("accessKey", CommonSysConst.getSysConfig().getMtAccessKey());
param.put("content", EncryptUtil.aesEncrypt(JsonUtil.object2Json(param), CommonSysConst.getSysConfig().getMtSecretKey()));
log.info("请求接口:" + postUrl);
log.info("请求参数:" + JSONObject.toJSONString(param));
JSONObject response = HttpsUtils.doPost(CommonSysConst.getSysConfig().getMtPostUrl() + postUrl, JSONObject.toJSONString(param));
log.info("响应参数:" + response.toJSONString());
log.info("============ 千猪请求-END ==============");
return response;
}
}

@ -41,8 +41,12 @@ public class OrderCouponModel {
public String goodsSpecsName;
@ColumnWidth(20)
@ExcelProperty("商品价格")
public String goodsPrice;
@ExcelProperty("商品原价(单价)")
public String goodsOriginalPrice;
@ColumnWidth(20)
@ExcelProperty("商品销售价(单价)")
public String goodsSalePrice;
@ColumnWidth(20)
@ExcelProperty("购买数量")

@ -0,0 +1,116 @@
package com.hfkj.model.order.orderExport;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @ClassName OrderGoodsExportModel
* @Author Sum1Dream
* @Description 实物订单导出
* @Date 2024/8/12 下午5:07
**/
@Data
public class OrderGoodsExportModel {
@ColumnWidth(50)
@ExcelProperty("商品名称")
public String goodsName;
@ColumnWidth(20)
@ExcelProperty("商户名称")
public String merName;
@ColumnWidth(20)
@ExcelProperty("类型名称")
public String goodsTypeName;
@ColumnWidth(20)
@ExcelProperty("品牌名称")
public String goodsBrandName;
@ColumnWidth(20)
@ExcelProperty("用户手机号")
public String userPhone;
@ColumnWidth(40)
@ExcelProperty("订单号")
public String orderNo;
@ColumnWidth(15)
@ExcelProperty("子订单号")
public String childOrderNo;
@ColumnWidth(20)
@ExcelProperty("物流单号")
public String logisticsNo;
@ColumnWidth(30)
@ExcelProperty("商品规格")
public String goodsSpecsName;
@ColumnWidth(20)
@ExcelProperty("商品价格")
public BigDecimal goodsPrice;
@ColumnWidth(20)
@ExcelProperty("购买数量")
public Integer goodsCount;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "订单金额"})
public BigDecimal totalPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "总优惠"})
public BigDecimal totalDeductionPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "优惠券优惠"})
public BigDecimal couponDiscountPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "积分抵扣"})
public BigDecimal integralDiscountPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "实付金额"})
public BigDecimal payRealPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "支付渠道"})
public String payChannel;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "支付方式"})
public String payType;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "支付单号"})
public String paySerialNo;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "交易状态"})
public String tradeStatus;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "创建时间"})
public Date createTime;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "支付时间"})
public Date payTime;
@ColumnWidth(20)
@ExcelProperty("物流状态")
public String logisticsStatusDesc;
@ColumnWidth(20)
@ExcelProperty("完成时间")
public Date finishTime;
}

@ -27,6 +27,7 @@ public interface BsUserCardService {
* @return
*/
BsUserCard getCard(String cardNo);
BsUserCard getCard(Long userId);
/**
* @MethodName insertUserCardBatch

@ -55,6 +55,17 @@ public class BsUserCardServiceImpl implements BsUserCardService {
return null;
}
@Override
public BsUserCard getCard(Long userId) {
BsUserCardExample example = new BsUserCardExample();
example.createCriteria().andUserIdEqualTo(userId).andStatusNotEqualTo(UserCardStatusEnum.status0.getCode());
List<BsUserCard> list = userCardMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public void insertUserCardBatch(List<BsUserCard> data) {
userCardMapper.insertUserCardList(data);

@ -0,0 +1,83 @@
package com.hfkj.service.file;
import com.hfkj.entity.FileRecords;
import java.util.List;
import java.util.Map;
/**
* @ClassName FileRecordsService
* @Author Sum1Dream
* @Description 文件记录
* @Date 2024/8/12 下午2:04
**/
public interface FileRecordsService {
/**
* @MethodName create
* @Description: 创建
* @param fileRecords
* @Author: Sum1Dream
* @Date: 2024/8/12 下午2:06
*/
void create(FileRecords fileRecords);
/**
* @MethodName update
* @Description: 更新
* @param fileRecords
* @Author: Sum1Dream
* @Date: 2024/8/12 下午2:06
*/
void update(FileRecords fileRecords);
/**
* @MethodName delete
* @Description: 删除
* @param id
* @param fullDelete
* @Author: Sum1Dream
* @Date: 2024/8/12 下午2:06
*/
void delete(Long id , Boolean fullDelete);
/**
* @MethodName queryDetail
* @Description: 查询详情
* @param id
* @return: com.hfkj.entity.FileRecords
* @Author: Sum1Dream
* @Date: 2024/8/12 下午2:07
*/
FileRecords queryDetail(Long id);
/**
* @MethodName queryDetailByMap
* @Description: 查询
* @param map
* @return: com.hfkj.entity.FileRecords
* @Author: Sum1Dream
* @Date: 2024/8/12 下午2:07
*/
FileRecords queryDetailByMap(Map<String , Object> map);
/**
* @MethodName getList
* @Description: 查询列表
* @param map
* @return: java.util.List<com.hfkj.entity.FileRecords>
* @Author: Sum1Dream
* @Date: 2024/8/12 下午2:07
*/
List<FileRecords> getList(Map<String , Object> map);
/**
* @MethodName findExported
* @Description: 是否可以导出
* @param content
* @return: java.lang.Boolean
* @Author: Sum1Dream
* @Date: 2024/8/14 下午5:03
*/
Boolean findExported(String content , Long opId);
}

@ -0,0 +1,71 @@
package com.hfkj.service.file.impl;
import com.hfkj.dao.FileRecordsMapper;
import com.hfkj.entity.FileRecords;
import com.hfkj.entity.FileRecordsExample;
import com.hfkj.service.file.FileRecordsService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@Service("fileRecordsService")
public class FileRecordsServiceImpl implements FileRecordsService {
@Resource
private FileRecordsMapper fileRecordsMapper;
@Override
public void create(FileRecords fileRecords) {
fileRecordsMapper.insert(fileRecords);
}
@Override
public void update(FileRecords fileRecords) {
fileRecordsMapper.updateByPrimaryKeySelective(fileRecords);
}
@Override
public void delete(Long id, Boolean fullDelete) {
fileRecordsMapper.deleteByPrimaryKey(id);
}
@Override
public FileRecords queryDetail(Long id) {
return fileRecordsMapper.selectByPrimaryKey(id);
}
@Override
public FileRecords queryDetailByMap(Map<String, Object> map) {
return null;
}
@Override
public List<FileRecords> getList(Map<String, Object> map) {
FileRecordsExample example = new FileRecordsExample();
FileRecordsExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "opId") != null) {
criteria.andOpIdEqualTo(MapUtils.getLong(map, "opId"));
}
example.setOrderByClause("create_time desc");
return fileRecordsMapper.selectByExample(example);
}
@Override
public Boolean findExported(String content , Long opId) {
FileRecordsExample example = new FileRecordsExample();
FileRecordsExample.Criteria criteria = example.createCriteria();
criteria.andDownloadConditionsEqualTo(content).andOpIdEqualTo(opId).andStatusEqualTo(2);
List<FileRecords> list = fileRecordsMapper.selectByExample(example);
return !list.isEmpty();
}
}

@ -58,11 +58,21 @@ public interface BsOrderGoodsService {
*/
BsOrderGoods findGoodsOrder(String orderNo);
/**
* @MethodName findGoodsOrderLogisticsNo
* @Description: 根据物流单好查询
* @param logisticsNo
* @return: com.hfkj.entity.BsOrderGoods
* @Author: Sum1Dream
* @Date: 2024/8/13 上午9:50
*/
BsOrderGoods findGoodsOrderLogisticsNo(String logisticsNo);
/**
* @MethodName findGoodsOrderByChild
* @Description:
* @param orderChildNo
* @return: com.hfkj.entity.BsOrderGoods
* @return: com.hfkj.entity.BsOrderGoods
* @Author: Sum1Dream
* @Date: 2024/7/31 上午10:37
*/
@ -87,6 +97,7 @@ public interface BsOrderGoodsService {
* @return java.util.List<com.hfkj.entity.GoodsBrand>
*/
List<BsOrderGoods> getList(Map<String , Object> map);
List<BsOrderGoods> getList();
/**
* @Author Sum1Dream
@ -126,7 +137,7 @@ public interface BsOrderGoodsService {
* @Param [num]
* @Return com.alibaba.fastjson.JSONObject
*/
Object getLogisticsMsg(String logisticsNo);
Object getLogisticsMsg(String logisticsNo , String mobile);
/**
* 更新缓存

@ -15,15 +15,13 @@ import com.hfkj.entity.GoodsLogisticsExample;
import com.hfkj.model.order.OrderModel;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.order.OrderChildStatusEnum;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
@Service("bsOrderGoodsService")
public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
@ -31,7 +29,7 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
// 缓存前缀KEY
public final static String CACHE_KEY = "LOGISTICS:";
// 订单缓存时间 7天
public final static Integer CACHE_TIME = 60*60*6;
public final static Integer CACHE_TIME = 60*30;
@Resource
private BsOrderGoodsMapper bsOrderGoodsMapper;
@ -70,7 +68,21 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
@Override
public BsOrderGoods findGoodsOrder(String orderNo) {
BsOrderGoodsExample example = new BsOrderGoodsExample();
example.createCriteria().andStatusNotEqualTo(0).andOrderNoEqualTo(orderNo);
example.createCriteria().andOrderNoEqualTo(orderNo);
List<BsOrderGoods> list = bsOrderGoodsMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public BsOrderGoods findGoodsOrderLogisticsNo(String logisticsNo) {
BsOrderGoodsExample example = new BsOrderGoodsExample();
example.createCriteria().andStatusNotEqualTo(0).andLogisticsNoEqualTo(logisticsNo);
List<BsOrderGoods> list = bsOrderGoodsMapper.selectByExample(example);
@ -84,7 +96,7 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
@Override
public BsOrderGoods findGoodsOrderByChild(String orderChildNo) {
BsOrderGoodsExample example = new BsOrderGoodsExample();
example.createCriteria().andStatusNotEqualTo(0).andChildOrderNoEqualTo(orderChildNo);
example.createCriteria().andChildOrderNoEqualTo(orderChildNo);
List<BsOrderGoods> list = bsOrderGoodsMapper.selectByExample(example);
@ -125,6 +137,14 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
if (StringUtils.isNotBlank(MapUtils.getString(map, "userPhone"))) {
criteria.andUserPhoneEqualTo(MapUtils.getString(map, "userPhone"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "logisticsStatus"))) {
if (MapUtils.getString(map , "logisticsStatus").equals("待发货")) {
criteria.andLogisticsStatusIsNull();
} else {
criteria.andLogisticsStatusEqualTo(MapUtils.getString(map, "logisticsStatus"));
}
}
if (MapUtils.getLong(map, "goodsType") != null) {
criteria.andGoodsTypeIdEqualTo(MapUtils.getLong(map, "goodsType"));
}
@ -160,6 +180,13 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
return bsOrderGoodsMapper.selectByExample(example);
}
@Override
public List<BsOrderGoods> getList() {
BsOrderGoodsExample example = new BsOrderGoodsExample();
return bsOrderGoodsMapper.selectByExample(example);
}
@Override
public GoodsLogistics findGoodsLogistics(Long orderGoodsId) {
GoodsLogisticsExample example = new GoodsLogisticsExample();
@ -227,10 +254,10 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
}
@Override
public Object getLogisticsMsg(String logisticsNo) {
public Object getLogisticsMsg(String logisticsNo , String mobile) {
Object data = redisUtil.get(CACHE_KEY + logisticsNo);
if (data == null) {
JSONObject jsonObjects = OrderUtil.getLogisticsMsg(logisticsNo);
JSONObject jsonObjects = OrderUtil.getLogisticsMsg(logisticsNo , mobile);
if (jsonObjects == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未发货!");
}
@ -270,9 +297,11 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前状态,不支持确认收货!");
}
orderGoods.setStatus(9);
// 子订单完成
orderService.childOrderComplete(orderGoods.getChildOrderNo());
orderGoods.setStatus(OrderChildStatusEnum.status3.getCode());
orderGoods.setUpdateTime(new Date());
update(orderGoods);
// 删除缓存
orderService.cacheDelete(orderGoods.getOrderNo());

@ -0,0 +1,59 @@
package com.hfkj.service.hlt;
import com.hfkj.dao.BsHltCardRecordMapper;
import com.hfkj.entity.BsHltCardRecord;
import com.hfkj.entity.BsHltCardRecordExample;
import com.hfkj.sysenum.hlt.HltCardRecordPayStatusEnum;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* @className: BsHltCardRecordService
* @author: HuRui
* @date: 2024/8/21
**/
@Component
public class BsHltCardRecordService {
@Resource
private BsHltCardRecordMapper hltCardRecordMapper;
/**
* 创建
* @param record
*/
public void create(BsHltCardRecord record) {
record.setCreateTime(new Date());
record.setUpdateTime(new Date());
hltCardRecordMapper.insert(record);
}
/**
* 修改
* @param record
*/
public void update(BsHltCardRecord record) {
record.setUpdateTime(new Date());
hltCardRecordMapper.updateByPrimaryKey(record);
}
/**
* 获取最新支付单号
* @param orderNo 订单号
* @return
*/
public BsHltCardRecord getNewPayOrderNo(String orderNo) {
BsHltCardRecordExample example = new BsHltCardRecordExample();
example.createCriteria()
.andOrderNoEqualTo(orderNo)
.andPayStatusEqualTo(HltCardRecordPayStatusEnum.status2.getCode());
List<BsHltCardRecord> list = hltCardRecordMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
}

@ -0,0 +1,152 @@
package com.hfkj.service.hlt;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.BaseException;
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.RandomUtils;
import com.hfkj.entity.BsHltCardRecord;
import com.hfkj.entity.BsMerPayConfig;
import com.hfkj.entity.BsOrderRefund;
import com.hfkj.mer.BsMerPayConfigService;
import com.hfkj.model.order.OrderChildModel;
import com.hfkj.model.order.OrderModel;
import com.hfkj.service.order.BsOrderRefundService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.hlt.HltCardRecordPayStatusEnum;
import com.hfkj.sysenum.mer.PayPlatformEnum;
import com.hfkj.sysenum.order.OrderChildStatusEnum;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @className: HltCardRefundService
* @author: HuRui
* @date: 2024/8/21
**/
@Component
public class HltCardRefundService {
@Resource
private BsHltCardRecordService hltCardRecordService;
@Resource
private BsOrderRefundService orderRefundService;
@Resource
private BsMerPayConfigService merPayConfigService;
@Resource
private BsOrderService orderService;
/**
* 退款
* @param orderRefund
* @return
*/
public boolean refund(BsOrderRefund orderRefund) {
// 查询系统订单号
BsHltCardRecord oldCardRecord = hltCardRecordService.getNewPayOrderNo(orderRefund.getOrderNo());
if (oldCardRecord == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到最新的支付订单");
}
try {
// 订单退款
JSONObject refundObj = HuiLianTongUnionCardService.refund(orderRefund.getRefundOrderNo(), oldCardRecord.getPayOrderNo());
if (!refundObj.getString("respCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refundObj.getString("respMessage"));
}
JSONObject consumptionResult = HuiLianTongUnionCardService.resolveResponse(refundObj.getString("data"));
if (consumptionResult.getBoolean("success") != true) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "交易失败!"+consumptionResult.getString("message"));
}
oldCardRecord.setRefundTime(new Date());
oldCardRecord.setPayStatus(HltCardRecordPayStatusEnum.status3.getCode());
hltCardRecordService.update(oldCardRecord);
orderRefund.setRefundSerialNo(consumptionResult.getString("orderId"));
orderRefundService.editData(orderRefund);
// 重新支付金额
BigDecimal newPayPrice = oldCardRecord.getPayPrice().subtract(orderRefund.getRefundPrice());
if (newPayPrice.compareTo(new BigDecimal("0")) > 0) {
BsHltCardRecord newRecord = new BsHltCardRecord();
try {
newRecord.setOrderNo(orderRefund.getOrderNo());
newRecord.setCardNo(oldCardRecord.getCardNo());
newRecord.setUserPhone(oldCardRecord.getUserPhone());
newRecord.setPayOrderNo(DateUtil.date2String(new Date(), "yyMMddHHmmss") + RandomUtils.number(6, false));
newRecord.setPayPrice(newPayPrice);
newRecord.setPayStatus(HltCardRecordPayStatusEnum.status1.getCode());
newRecord.setExceptionStatus(false);
hltCardRecordService.create(newRecord);
// 查询订单
OrderModel order = orderService.getDetail(orderRefund.getOrderNo());
// 查询平台
BsMerPayConfig merPay = merPayConfigService.getMerPay(order.getOrderChildList().get(0).getMerId(), PayPlatformEnum.type2);
if (merPay == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付");
}
// 重新扣款
String goodsDesc = "";
String tranDesc = "";
String businessType = "HiSen_phg_goods";
List<OrderChildModel> childModelList = order.getOrderChildList().stream()
.filter(o -> o.getStatus().equals(OrderChildStatusEnum.status2.getCode())
|| o.getStatus().equals(OrderChildStatusEnum.status3.getCode()))
.collect(Collectors.toList());
for (OrderChildModel orderChild :childModelList) {
if (StringUtils.isBlank(tranDesc)) {
tranDesc = tranDesc + orderChild.getProductName();
} else {
tranDesc = tranDesc +","+ orderChild.getProductName();
}
}
// 描述超过30字符,截取加省略号
if (tranDesc.length()>30) {
tranDesc = tranDesc.substring(1,30) + "...";
}
JSONObject consumption = HuiLianTongUnionCardService.consumption(newRecord.getPayOrderNo(), newRecord.getCardNo(), newRecord.getPayPrice(), businessType, merPay.getHltInstCode(), goodsDesc, tranDesc);
if (!consumption.getString("respCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage"));
}
// 响应参数
JSONObject payConsumptionResult = HuiLianTongUnionCardService.resolveResponse(consumption.getString("data"));
if (payConsumptionResult.getBoolean("success") != true) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, payConsumptionResult.getString("message"));
}
newRecord.setPaySerialNo(consumptionResult.getString("orderId"));
newRecord.setPayTime(new Date());
newRecord.setPayStatus(HltCardRecordPayStatusEnum.status2.getCode());
hltCardRecordService.update(newRecord);
} catch (BaseException e) {
newRecord.setExceptionStatus(true);
newRecord.setExceptionContent(e.getErrorMsg());
hltCardRecordService.update(newRecord);
} catch (Exception e) {
newRecord.setExceptionStatus(true);
newRecord.setExceptionContent("未知错误");
hltCardRecordService.update(newRecord);
}
}
} catch (BaseException e) {
oldCardRecord.setExceptionStatus(true);
oldCardRecord.setExceptionContent(e.getErrorMsg());
hltCardRecordService.update(oldCardRecord);
} catch (Exception e) {
oldCardRecord.setExceptionStatus(true);
oldCardRecord.setExceptionContent("未知错误");
hltCardRecordService.update(oldCardRecord);
}
return !oldCardRecord.getExceptionStatus();
}
}

@ -98,6 +98,29 @@ public class HuiLianTongUnionCardService {
}
/**
* @MethodName queryTransJournal
* @Description: 查询交易记录
* @param cardNo
* @param tranType
* @return: com.alibaba.fastjson.JSONObject
* @Author: Sum1Dream
* @Date: 2024/8/27 上午9:40
*/
public static JSONObject queryTransJournal(String cardNo , String tranType) throws Exception {
try {
Map<String,Object> dataMap = new HashMap<>();
dataMap.put("tranType", tranType);
dataMap.put("cardNo", cardNo);
dataMap.put("page", 1);
dataMap.put("pageSize", 10000);
return request("coresystem/queryTransJournal", dataMap);
} catch (Exception e) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_TIMED_OUT, "");
}
}
/**
* 充值
* @param orderNo 订单号
@ -229,15 +252,11 @@ public class HuiLianTongUnionCardService {
public static JSONObject resolveResponse(String param) {
String data = param.replace("\\n", "");
String decodeData = DesUtil.decode(HLT_CARD_SIGN_CODE, data, Charset.forName("UTF-8"));
log.info("============请求任务Start=============");
log.info("解析响应的参数-请求参数: " + data);
log.info("响应data参数: " + data);
JSONObject returnObject = JSONObject.parseObject(decodeData);
log.info("解析响应的参数-响应参数: " + returnObject.toJSONString());
log.info("============请求任务End==============");
log.info("解析响应参数: " + returnObject.toJSONString());
return returnObject;
}

@ -51,6 +51,9 @@ public interface BsOrderService {
*/
OrderModel cancel(String orderNo, boolean system);
void deleteOrder(BsOrder order);
/**
* 子订单完成
* @param childOrderNo

@ -133,6 +133,7 @@ public class OrderCreateService {
orderCoupon.setGoodsSpecsId(goodsSpecs.getId());
orderCoupon.setGoodsSpecsName(goodsSpecs.getName());
orderCoupon.setGoodsSpescOriginalPrice(goodsSpecs.getOriginalPrice());
orderCoupon.setGoodsSpescSalePrice(goodsSpecs.getSalePrice());
orderCoupon.setGoodsVpdId(goodsVpd.getId());
orderCoupon.setGoodsVpdKey(goodsVpd.getKey());
orderCoupon.setGoodsVpdSource(goodsVpd.getSource());
@ -239,7 +240,7 @@ public class OrderCreateService {
orderGoods.setGoodsSpecsName(goodsSpecs.getName());
orderGoods.setGoodsSpecsOriginalPrice(goodsSpecs.getOriginalPrice());
orderGoods.setGoodsCount(orderChild.getProductCount());
orderGoods.setStatus(OrderGoodsStatusEnum.status8.getCode());
orderGoods.setStatus(orderChild.getStatus());
orderGoods.setDeliveryAddress(address.getAddress());
orderGoods.setDeliveryAddressId(address.getId());
orderGoods.setCreateTime(new Date());

@ -124,6 +124,7 @@ public class OrderPaySuccessService {
for (Object data : dataArray) {
JSONObject dataObject = (JSONObject) data;
couponNo.setExpireTime(dataObject.getDate("validEndDate"));
couponNo.setDeliverTime(new Date());
couponNo.setGoodsVpdSourceCouNo(dataObject.getString("couNo"));
couponNo.setStatus(OrderCouponNoStatusEnum.status2.getCode());
orderCouponNoService.editData(couponNo);
@ -140,6 +141,7 @@ public class OrderPaySuccessService {
JSONArray codeList = response.getJSONArray("codeList");
for (Object data : codeList) {
couponNo.setExpireTime(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd"));
couponNo.setDeliverTime(new Date());
couponNo.setGoodsVpdSourceCouNo(ChongQingCNPCCouponService.decryptCouponCode(String.valueOf(data)));
couponNo.setStatus(OrderCouponNoStatusEnum.status2.getCode());
orderCouponNoService.editData(couponNo);
@ -157,8 +159,9 @@ public class OrderPaySuccessService {
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
JSONObject object = JSONObject.parseObject(data);
couponNo.setExpireTime(vpd.getSalesEndTime());
couponNo.setDeliverTime(new Date());
couponNo.setGoodsVpdSourceCouNo(object.getString("voucher"));
couponNo.setStatus(OrderCouponNoStatusEnum.status2.getCode());
couponNo.setStatus(OrderCouponNoStatusEnum.status2.getCode());
orderCouponService.editData(orderCoupon);
} else if (vpd.getSource() == GoodsVpdSourceEnum.type10.getCode()) {
@ -169,6 +172,7 @@ public class OrderPaySuccessService {
}
JSONObject object = jsonObject.getJSONObject("data");
couponNo.setExpireTime(vpd.getSalesEndTime());
couponNo.setDeliverTime(new Date());
couponNo.setGoodsVpdSourceCouNo(object.getString("couponCode"));
couponNo.setStatus(OrderCouponNoStatusEnum.status2.getCode());
orderCouponNoService.editData(couponNo);
@ -224,14 +228,16 @@ public class OrderPaySuccessService {
goodsOrder.setPaySerialNo(order.getPaySerialNo());
goodsOrder.setPayTime(order.getPayTime());
goodsOrder.setUpdateTime(new Date());
goodsOrder.setStatus(1);
goodsOrder.setStatus(childOrder.getStatus());
bsOrderGoodsService.update(goodsOrder);
} catch (Exception e) {
goodsOrder.setExceptionStatus(true);
if (goodsOrder == null) {
goodsOrder = new BsOrderGoods();
}
goodsOrder.setExceptionMsg(e.getMessage());
bsOrderGoodsService.update(goodsOrder);
}
bsOrderGoodsService.update(goodsOrder);
}
public void cinema(OrderModel order,BsOrderChild childOrder) {

@ -7,15 +7,23 @@ import com.hfkj.common.exception.SysCode;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsOrderChild;
import com.hfkj.entity.BsOrderCinema;
import com.hfkj.entity.BsOrderCoupon;
import com.hfkj.entity.BsOrderGoods;
import com.hfkj.model.order.OrderChildModel;
import com.hfkj.model.order.OrderModel;
import com.hfkj.qianzhu.channel.CinemaService;
import com.hfkj.service.coupon.BsOrderCouponService;
import com.hfkj.service.goods.BsOrderCinemaService;
import com.hfkj.service.goods.impl.BsOrderGoodsServiceImpl;
import com.hfkj.sysenum.order.OrderChildProductTypeEnum;
import com.hfkj.sysenum.order.OrderChildStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -30,6 +38,10 @@ public class OrderRefundSuccessService {
@Resource
private BsOrderCinemaService bsOrderCinemaService;
@Autowired
private BsOrderGoodsServiceImpl bsOrderGoodsService;
@Resource
private BsOrderCouponService orderCouponService;
/**
* 订单业务处理
@ -39,9 +51,11 @@ public class OrderRefundSuccessService {
public void orderRefundHandle(OrderChildModel orderChild) {
try {
if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) {
// todo 实物产品退款业务
// 实物产品退款业务
goods(orderChild);
} else if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type2.getCode())) {
// todo 虚拟产品退款业务
// 虚拟产品退款业务
orderCoupon(orderChild);
} else if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type3.getCode())) {
// 电影票退款业务
cinema(orderChild);
@ -52,6 +66,42 @@ public class OrderRefundSuccessService {
}
}
public void goods(BsOrderChild childOrder) {
// 查询实物订单
BsOrderGoods orderGoods = bsOrderGoodsService.findGoodsOrderByChild(childOrder.getOrderNo());
try {
if (orderGoods != null) {
Map<String , Object> map = new HashMap<>();
map.put("orderNo", childOrder.getOrderNo());
CinemaService.refundMovieOrder(map);
orderGoods.setStatus(OrderChildStatusEnum.status4.getCode());
orderGoods.setLogisticsStatusDesc(null);
orderGoods.setLogisticsNo(null);
orderGoods.setLogisticsStatus(null);
orderGoods.setExceptionStatus(false);
bsOrderGoodsService.update(orderGoods);
}
} catch (Exception e) {
orderGoods.setExceptionStatus(true);
orderGoods.setExceptionMsg(e.getMessage());
bsOrderGoodsService.update(orderGoods);
}
}
public void orderCoupon(BsOrderChild childOrder) {
// 查询虚拟订单
BsOrderCoupon orderCoupon = orderCouponService.getDetailByChildOrderNo(childOrder.getChildOrderNo());
if (orderCoupon != null) {
orderCoupon.setRefundTime(new Date());
orderCoupon.setStatus(OrderChildStatusEnum.status4.getCode());
orderCouponService.editData(orderCoupon);
}
}
public void cinema(BsOrderChild childOrder) {
// 查询电影票订单
BsOrderCinema orderCinema = bsOrderCinemaService.findGoodsOrder(childOrder.getOrderNo());
@ -64,11 +114,11 @@ public class OrderRefundSuccessService {
CinemaService.refundMovieOrder(map);
orderCinema.setStatus(-5);
orderCinema.setExceptionStatus(false);
bsOrderCinemaService.update(orderCinema);
}
} catch (Exception e) {
orderCinema.setExceptionStatus(true);
orderCinema.setExceptionMsg(e.getMessage());
} finally {
bsOrderCinemaService.update(orderCinema);
}

@ -286,10 +286,22 @@ public class BsOrderAfterSalesApplyServiceImpl implements BsOrderAfterSalesApply
criteria.andUserPhoneLike("%"+MapUtils.getString(param, "userPhone")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "orderNo"))) {
criteria.andOrderNoLike("%"+MapUtils.getString(param, "orderNo")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "childOrderNo"))) {
criteria.andChildOrderNoLike("%"+MapUtils.getString(param, "childOrderNo")+"%");
}
if (MapUtils.getInteger(param, "productType") != null) {
criteria.andProductTypeEqualTo(MapUtils.getInteger(param, "productType"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "productName"))) {
criteria.andProductNameLike("%"+MapUtils.getString(param, "productName")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "applyNo"))) {
criteria.andApplyNoLike("%"+MapUtils.getString(param, "applyNo")+"%");
}

@ -12,8 +12,10 @@ import com.hfkj.service.BsProductConfigService;
import com.hfkj.service.goods.*;
import com.hfkj.service.goods.impl.BsOrderStarbucksServiceImpl;
import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.order.OrderChildProductTypeEnum;
import com.hfkj.sysenum.order.OrderChildStatusEnum;
import com.hfkj.sysenum.order.OrderLogisticsStatusEnum;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
@ -48,6 +50,9 @@ public class BsOrderChildServiceImpl implements BsOrderChildService {
@Resource
private BsProductConfigService bsProductConfigService;
@Resource
private BsOrderService orderService;
@Override
public void editData(BsOrderChild data) {
data.setUpdateTime(new Date());
@ -113,6 +118,16 @@ public class BsOrderChildServiceImpl implements BsOrderChildService {
object.put("orderGoodsId", orderGoods.getId());
childModel.setBusiness(object);
if (orderGoods.getLogisticsStatus() != null && orderGoods.getLogisticsStatus().equals(OrderLogisticsStatusEnum.statusSIGN.getCode())) {
// 子订单完成
orderService.childOrderComplete(orderGoods.getChildOrderNo());
orderGoods.setStatus(OrderChildStatusEnum.status3.getCode());
orderGoods.setUpdateTime(new Date());
orderGoodsService.update(orderGoods);
// 删除缓存
orderService.cacheDelete(orderGoods.getOrderNo());
}
}
} else if (childModel.getProductType().equals(OrderChildProductTypeEnum.type2.getCode())) {
childModel.setBusiness(goodsVpdService.queryDetailBySpecsId(childModel.getProductSpecId()));

@ -15,6 +15,7 @@ import com.hfkj.entity.BsOrderRefundExample;
import com.hfkj.mer.BsMerPayConfigService;
import com.hfkj.model.order.OrderChildModel;
import com.hfkj.model.order.OrderModel;
import com.hfkj.service.hlt.HltCardRefundService;
import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.service.order.BsOrderRefundService;
@ -56,10 +57,10 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
@Resource
private UserIntegralService userIntegralService;
@Resource
private BsMerPayConfigService merPayConfigService;
@Resource
private TradeService huiftTradeService;
@Resource
private HltCardRefundService hltCardRefundService;
@Resource
private OrderRefundSuccessService orderRefundSuccessService;
@Override
public void editData(BsOrderRefund data) {
@ -100,19 +101,10 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
orderRefund.setRefundPayChannelOrderNo(refundObj.getString("refundOrderNo"));
return true;
} /*else if (OrderPayChannelEnum.type4.getCode() == orderRefund.getRefundPayChannel()) {
} else if (OrderPayChannelEnum.type4.getCode() == orderRefund.getRefundPayChannel()) {
// 商户退款
JSONObject refundObj = HuiLianTongUnionCardService.refund(orderRefund.getRefundOrderNo(), orderRefund.getOrderNo());
if (!refundObj.getString("respCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refundObj.getString("respMessage"));
}
JSONObject consumptionResult = HuiLianTongUnionCardService.resolveResponse(refundObj.getString("data"));
if (!(consumptionResult.getBoolean("success") || Objects.equals(consumptionResult.getString("message"), "原交易已撤销,不可再次操作"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!"+consumptionResult.getString("message"));
}
orderRefund.setRefundSerialNo(consumptionResult.getString("orderId"));
return true;
}*/ else {
return hltCardRefundService.refund(orderRefund);
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!该支付方式暂不支持退款");
}
} catch (BaseException e) {
@ -236,9 +228,7 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
orderChild.setStatus(orderChild.getSurplusRefundCount()==0?OrderChildStatusEnum.status4.getCode():orderChild.getStatus());
// 退款业务处理
if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type3.getCode())) {
orderRefundSuccessService.orderRefundHandle(orderChild);
}
orderRefundSuccessService.orderRefundHandle(orderChild);
orderChildService.editData(orderChild);
}

@ -231,7 +231,7 @@ public class BsOrderServiceImpl implements BsOrderService {
childOrder.setSurplusRefundCount(childOrder.getProductCount());
// 计算 子订单 在交易订单金额中的占比
BigDecimal ratio = childOrder.getProductTotalPrice().divide(order.getTotalPrice(), 2, BigDecimal.ROUND_DOWN);
BigDecimal ratio = childOrder.getProductTotalPrice().divide(order.getTotalPrice(), 4, BigDecimal.ROUND_DOWN);
// 优惠券优惠
if (order.getDeduction().getCouponDiscountActualPrice().compareTo(BigDecimal.ZERO) > 0) {
@ -263,10 +263,10 @@ public class BsOrderServiceImpl implements BsOrderService {
// 积分差值
Long integralDiscountDifference = order.getDeduction().getIntegralDiscountPrice() - totalIntegralDiscountPrice;
if (integralDiscountDifference > 0) {
if (integralDiscountDifference > 0L) {
// 大于0
childOrder.setIntegralDiscountPrice(childOrder.getIntegralDiscountPrice() + integralDiscountDifference);
} else if (integralDiscountDifference < 0) {
} else if (integralDiscountDifference < 0L) {
// 小于0
childOrder.setIntegralDiscountPrice(childOrder.getIntegralDiscountPrice() - integralDiscountDifference);
}
@ -274,7 +274,6 @@ public class BsOrderServiceImpl implements BsOrderService {
// 商品订单总优惠
childOrder.setTotalDeductionPrice(childOrder.getCouponDiscountPrice().add(new BigDecimal(childOrder.getIntegralDiscountPrice()).divide(new BigDecimal("100"))));
// 可退款金额 产品总价 - 优惠总价
childOrder.setSurplusRefundPrice(childOrder.getProductTotalPrice().subtract(childOrder.getTotalDeductionPrice()));
// 可退款积分 积分优惠
@ -454,6 +453,11 @@ public class BsOrderServiceImpl implements BsOrderService {
return order;
}
@Override
public void deleteOrder(BsOrder order) {
orderMapper.updateByPrimaryKey(order);
}
@Override
public void childOrderComplete(String childOrderNo) {
BsOrderChild orderChild = orderChildService.getDetail(childOrderNo);
@ -597,6 +601,7 @@ public class BsOrderServiceImpl implements BsOrderService {
if (MapUtils.getLong(param, "cancelTimeE") != null) {
criteria.andCancelTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "cancelTimeE")));
}
criteria.andOrderStatusNotEqualTo(0);
example.setOrderByClause("create_time desc");
return orderMapper.selectByExample(example);

@ -4,13 +4,16 @@ 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.entity.BsHltCardRecord;
import com.hfkj.entity.BsUserCard;
import com.hfkj.model.order.OrderChildModel;
import com.hfkj.model.order.OrderModel;
import com.hfkj.service.hlt.BsHltCardRecordService;
import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.order.OrderPayService;
import com.hfkj.service.order.OrderPaySuccessService;
import com.hfkj.sysenum.hlt.HltCardRecordPayStatusEnum;
import com.hfkj.sysenum.order.OrderPayChannelEnum;
import com.hfkj.sysenum.order.OrderPayTypeEnum;
import org.apache.commons.lang3.StringUtils;
@ -28,7 +31,8 @@ import java.util.Date;
public class OrderPayServiceImpl implements OrderPayService {
@Resource
private BsOrderService orderService;
@Resource
private BsHltCardRecordService hltCardRecordService;
@Override
public OrderModel hltCardPay(String instCode,OrderModel order, BsUserCard userCard) throws Exception {
String goodsDesc = "";
@ -68,6 +72,18 @@ public class OrderPayServiceImpl implements OrderPayService {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message"));
}
BsHltCardRecord cardRecord = new BsHltCardRecord();
cardRecord.setOrderNo(order.getOrderNo());
cardRecord.setCardNo(userCard.getCardNo());
cardRecord.setUserPhone(order.getUserPhone());
cardRecord.setPayOrderNo(order.getOrderNo());
cardRecord.setPaySerialNo(consumptionResult.getString("orderId"));
cardRecord.setPayPrice(order.getPayRealPrice());
cardRecord.setPayStatus(HltCardRecordPayStatusEnum.status2.getCode());
cardRecord.setPayTime(new Date());
cardRecord.setExceptionStatus(false);
hltCardRecordService.create(cardRecord);
order.setPayChannel(OrderPayChannelEnum.type4.getCode());
order.setPayType(OrderPayTypeEnum.type4.getCode());
order.setPaySerialNo(consumptionResult.getString("orderId"));

@ -0,0 +1,59 @@
package com.hfkj.sysenum.fileRecords;
import lombok.Getter;
import java.util.Objects;
@Getter
public enum FileRecordsEnum {
/**
* 实物订单
*/
status1(1, "实物订单"),
/**
* 虚拟订单
*/
status2(2, "虚拟产品订单"),
/**
* 肯德基订单
*/
status3(3, "肯德基订单"),
/**
* 星巴克订单
*/
status4(4, "星巴克订单"),
/**
* 财务对账订单
*/
status5(5, "财务对账订单"),
/**
* 物流订单上传订单
*/
status6(6, "物流订单上传订单"),
status7(7, "物流订单下载订单"),
;
private final int code;
private final String name;
FileRecordsEnum(int code, String name) {
this.code = code;
this.name = name;
}
public static FileRecordsEnum getData(Integer type) {
for (FileRecordsEnum ele : values()) {
if (Objects.equals(type,ele.getCode())) return ele;
}
return null;
}
}

@ -0,0 +1,38 @@
package com.hfkj.sysenum.hlt;
import lombok.Getter;
/**
*
* @author hurui
*/
@Getter
public enum HltCardRecordPayStatusEnum {
/**
* 待支付
*/
status1(1, "待支付"),
/**
* 已支付
*/
status2(2, "已支付"),
/**
* 已退款
*/
status3(3, "已退款"),
;
private int code;
private String name;
HltCardRecordPayStatusEnum(int code, String name) {
this.code = code;
this.name = name;
}
}

@ -0,0 +1,32 @@
package com.hfkj.sysenum.order;
import lombok.Getter;
@Getter
public enum OrderLogisticsStatusEnum {
statusDELIVERING("派件中" , "DELIVERING"),
statusTRANSPORT("运输中", "TRANSPORT"),
statusAGENT_SIGN("已代签收", "AGENT_SIGN"),
statusSIGN("已签收", "SIGN"),
statusACCEPT("已揽收", "ACCEPT"),
statusFAILED("包裹异常", "FAILED"),
statusWAIT_ACCEPT("待揽收", "WAIT_ACCEPT"),
;
private final String code;
private final String name;
OrderLogisticsStatusEnum(String name, String code) {
this.code = code;
this.name = name;
}
}

@ -2,6 +2,8 @@ package com.hfkj.sysenum.order;
import lombok.Getter;
import java.util.Objects;
/**
* 交易订单状态
* @className: OrderChildProductType
@ -10,6 +12,10 @@ import lombok.Getter;
**/
@Getter
public enum OrderStatusEnum {
/**
* 删除
*/
status0(0, "删除"),
/**
* 待支付
*/
@ -45,4 +51,11 @@ public enum OrderStatusEnum {
this.code = code;
this.name = name;
}
public static OrderStatusEnum getData(Integer type) {
for (OrderStatusEnum ele : values()) {
if (Objects.equals(type,ele.getCode())) return ele;
}
return null;
}
}

@ -1,4 +1,4 @@
fileUrl=/Users/chenyao/Desktop/img
fileUrl=/home/project/phg/filesystem
domainName=https://phgcs.dctpay.com
wechatMpAppid=wxa075e8509802f826
@ -70,3 +70,9 @@ ctNotifyUrl = 1
ctApiKey=3fd74e7c16b04681a0f481c5bc0a96d3
ctMemberId=1622808562621276161
ctPostUrl=http://113.250.49.100:8088/recharge/
mtNotifyUrl = https://phg.dctpay.com/order/cinemaNotify/notify
mtAccessKey=DVNKSHSDHHJ6-TK
mtSecretKey=lj2YDjGnqroY1OuR5zriWg==
mtPostUrl=https://waimai-openapi.apigw.test.meituan.com/api/sqt/open/login/h5/loginFree/redirection?test_open_swimlane=test-open

@ -1,11 +1,14 @@
package com.user.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.PageUtil;
import com.hfkj.common.utils.RedisUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsUserCard;
@ -24,6 +27,8 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
@ -186,5 +191,72 @@ public class UserCardController {
}
}
@RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询汇联通工会卡消费记录")
public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "cardNo", required = true) String cardNo) {
try {
// 用户
UserSessionObject userSessionObject = userCenter.getSessionModel(UserSessionObject.class);
BsUserCard userCard = userCardService.getCard(userSessionObject.getUser().getId());
if (userCard != null) {
JSONObject consumptionRecord = HuiLianTongUnionCardService.queryConsumptionRecordByBusiness("HiSen_phg_goods", cardNo, 1661498490000L, 1882423290000L, 1, 10000);
if (StringUtils.isBlank(consumptionRecord.getString("data"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "");
}
JSONArray array = HuiLianTongUnionCardService.resolveResponse(consumptionRecord.getString("data")).getJSONArray(
"records");
return ResponseMsgUtil.success(array);
}
return ResponseMsgUtil.success(null);
} catch (Exception e) {
log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/queryTransJournal", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询汇联通工会卡消费记录")
public ResponseData queryTransJournal(@RequestParam(name = "tranType", required = true) String tranType,
@RequestParam(name = "cardNo", required = true) String cardNo,
@RequestParam(value = "pageNum" , required = true) Integer pageNum,
@RequestParam(value = "pageSize" , required = true) Integer pageSize) {
try {
JSONObject consumptionRecord = HuiLianTongUnionCardService.queryTransJournal(cardNo , tranType);
if (StringUtils.isBlank(consumptionRecord.getString("data"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "");
}
JSONArray array = HuiLianTongUnionCardService.resolveResponse(consumptionRecord.getString("data")).getJSONArray(
"journals");
List<JSONObject> list = new ArrayList<>();
for (Object object : array) {
JSONObject journal = (JSONObject) object;
journal.put("tranAmount", journal.getBigDecimal("tranAmount").divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP));
list.add(journal);
}
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, list.size(), pageSize, new PageInfo<>(list)));
} catch (Exception e) {
log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

Loading…
Cancel
Save