diff --git a/bweb/lib/open-platform-sdk-1.0.21.jar b/bweb/lib/open-platform-sdk-1.0.21.jar new file mode 100644 index 0000000..0cbe24f Binary files /dev/null and b/bweb/lib/open-platform-sdk-1.0.21.jar differ diff --git a/bweb/pom.xml b/bweb/pom.xml index 57b112a..6df9864 100644 --- a/bweb/pom.xml +++ b/bweb/pom.xml @@ -18,6 +18,19 @@ service PACKT-SNAPSHOT + + + commons-codec + commons-codec + 1.11 + + + meituan.skd + meituan-open-sdk + system + 1.0.21 + ${basedir}/lib/open-platform-sdk-1.0.21.jar + @@ -26,6 +39,13 @@ src/main/resources/${env} false + + ${basedir}/lib + BOOT-INF/lib/ + + **/*.jar + + diff --git a/bweb/src/main/java/com/bweb/controller/FileUploadController.java b/bweb/src/main/java/com/bweb/controller/FileUploadController.java index eaf109d..898b421 100644 --- a/bweb/src/main/java/com/bweb/controller/FileUploadController.java +++ b/bweb/src/main/java/com/bweb/controller/FileUploadController.java @@ -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(), diff --git a/bweb/src/main/java/com/bweb/controller/TestController.java b/bweb/src/main/java/com/bweb/controller/TestController.java index 34801df..3713e00 100644 --- a/bweb/src/main/java/com/bweb/controller/TestController.java +++ b/bweb/src/main/java/com/bweb/controller/TestController.java @@ -1,18 +1,19 @@ 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.DateUtil; -import com.hfkj.common.utils.OrderUtil; -import com.hfkj.common.utils.ResponseMsgUtil; +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; @@ -29,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; @@ -54,6 +56,9 @@ public class TestController { @Resource private BsOrderGoodsService bsOrderGoodsService; + @Resource + private GoodsUserAddressService addressService; + @RequestMapping(value="/canteenConsume",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "食堂消费") @@ -168,5 +173,131 @@ public class TestController { } } + @RequestMapping(value="/getLogisticsMsg",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询物流") + public ResponseData getLogisticsMsg(@RequestParam(value = "id" , required = false) Long id) { + try { + Map 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 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 map = new HashMap<>(); + Map 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); + } + } + } diff --git a/cweb/src/main/java/com/cweb/controller/qianZhu/CinemaController.java b/cweb/src/main/java/com/cweb/controller/qianZhu/CinemaController.java index 0436e77..cd2f0a1 100644 --- a/cweb/src/main/java/com/cweb/controller/qianZhu/CinemaController.java +++ b/cweb/src/main/java/com/cweb/controller/qianZhu/CinemaController.java @@ -17,6 +17,7 @@ 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; @@ -48,6 +49,9 @@ public class CinemaController { @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 ) { @@ -76,6 +80,9 @@ public class CinemaController { for (Object o : array) { JSONObject item = (JSONObject) o; + if (item.getString("grade") == null) { + item.put("grade" , "0"); + } list.add(item); } @@ -90,14 +97,87 @@ public class CinemaController { } - list = list.stream().sorted( - // 根据对象中的ID进行升序排序 小到大 - Comparator.comparingLong( - e -> DateUtil.timesTamp(JSONObject.parseObject(e.toString()).getString("publishDate")) - ) - // 放开下面的注释,使用reversed()方法,就是降序 大到小 - .reversed() - ).collect(Collectors.toList()); + + 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) { diff --git a/order/src/main/java/com/order/controller/OrderController.java b/order/src/main/java/com/order/controller/OrderController.java index 548984d..39e16ad 100644 --- a/order/src/main/java/com/order/controller/OrderController.java +++ b/order/src/main/java/com/order/controller/OrderController.java @@ -31,10 +31,7 @@ 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; /** @@ -236,5 +233,33 @@ public class OrderController { } } + @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); + } + } } diff --git a/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java b/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java index f4884d5..339b078 100644 --- a/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java +++ b/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java @@ -3,7 +3,6 @@ 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; @@ -17,7 +16,6 @@ import com.hfkj.config.CommonSysConst; import com.hfkj.entity.*; import com.hfkj.model.ResponseData; import com.hfkj.model.SecUserSessionObject; -import com.hfkj.model.UserSessionObject; import com.hfkj.model.order.orderExport.OrderGoodsExportModel; import com.hfkj.service.file.FileRecordsService; import com.hfkj.service.goods.BsOrderGoodsService; @@ -44,8 +42,6 @@ import java.util.*; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Collectors; @Controller @RequestMapping(value="/orderGoods") @@ -408,4 +404,30 @@ public class BsOrderGoodsController { } } + @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 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); + } + } + } diff --git a/order/src/main/resources/dev/logback.xml b/order/src/main/resources/dev/logback.xml index b8a7284..c88e0aa 100644 --- a/order/src/main/resources/dev/logback.xml +++ b/order/src/main/resources/dev/logback.xml @@ -246,4 +246,26 @@ + + + log/MeiTuanLog.log + + log/MeiTuanLog/MeiTuanLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + + diff --git a/order/src/main/resources/prod/logback.xml b/order/src/main/resources/prod/logback.xml index 814ac71..06969bc 100644 --- a/order/src/main/resources/prod/logback.xml +++ b/order/src/main/resources/prod/logback.xml @@ -245,4 +245,26 @@ + + + log/MeiTuanLog.log + + log/MeiTuanLog/MeiTuanLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + + diff --git a/service/lib/open-platform-sdk-1.0.21.jar b/service/lib/open-platform-sdk-1.0.21.jar new file mode 100644 index 0000000..0cbe24f Binary files /dev/null and b/service/lib/open-platform-sdk-1.0.21.jar differ diff --git a/service/pom.xml b/service/pom.xml index 594c1dd..7945b8d 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -20,6 +20,7 @@ 2.9.9 + org.springframework.boot @@ -248,6 +249,20 @@ ocr_api20210707 1.1.1 + + + commons-codec + commons-codec + 1.11 + + + + meituan.skd + meituan-open-sdk + system + 1.0.21 + ${basedir}/lib/open-platform-sdk-1.0.21.jar + @@ -255,6 +270,15 @@ src/main/resources/${env} false + + ${basedir}/lib + BOOT-INF/lib/ + + **/*.jar + + + + diff --git a/service/src/main/java/com/hfkj/common/utils/RandomStringGeneratorUtil.java b/service/src/main/java/com/hfkj/common/utils/RandomStringGeneratorUtil.java new file mode 100644 index 0000000..4b0bb74 --- /dev/null +++ b/service/src/main/java/com/hfkj/common/utils/RandomStringGeneratorUtil.java @@ -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(); + } +} diff --git a/service/src/main/java/com/hfkj/config/CommonSysConfig.java b/service/src/main/java/com/hfkj/config/CommonSysConfig.java index 54b6e89..90afb4f 100644 --- a/service/src/main/java/com/hfkj/config/CommonSysConfig.java +++ b/service/src/main/java/com/hfkj/config/CommonSysConfig.java @@ -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; } diff --git a/service/src/main/java/com/hfkj/meituan/MeiTuanService.java b/service/src/main/java/com/hfkj/meituan/MeiTuanService.java new file mode 100644 index 0000000..243750b --- /dev/null +++ b/service/src/main/java/com/hfkj/meituan/MeiTuanService.java @@ -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 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 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; + + } +} diff --git a/service/src/main/java/com/hfkj/service/card/BsUserCardService.java b/service/src/main/java/com/hfkj/service/card/BsUserCardService.java index 5bb7ee5..ace72b8 100644 --- a/service/src/main/java/com/hfkj/service/card/BsUserCardService.java +++ b/service/src/main/java/com/hfkj/service/card/BsUserCardService.java @@ -27,6 +27,7 @@ public interface BsUserCardService { * @return */ BsUserCard getCard(String cardNo); + BsUserCard getCard(Long userId); /** * @MethodName insertUserCardBatch diff --git a/service/src/main/java/com/hfkj/service/card/impl/BsUserCardServiceImpl.java b/service/src/main/java/com/hfkj/service/card/impl/BsUserCardServiceImpl.java index 91b1e4d..53426ff 100644 --- a/service/src/main/java/com/hfkj/service/card/impl/BsUserCardServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/card/impl/BsUserCardServiceImpl.java @@ -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 list = userCardMapper.selectByExample(example); + if (!list.isEmpty()) { + return list.get(0); + } + return null; + } + @Override public void insertUserCardBatch(List data) { userCardMapper.insertUserCardList(data); diff --git a/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java b/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java index c478dba..62ece48 100644 --- a/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java +++ b/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java @@ -72,7 +72,7 @@ public interface BsOrderGoodsService { * @MethodName findGoodsOrderByChild * @Description: * @param orderChildNo - * @return: com.hfkj.entity.BsOrderGoods + * @return: com.hfkj.entity.BsOrderGoods * @Author: Sum1Dream * @Date: 2024/7/31 上午10:37 */ diff --git a/service/src/main/java/com/hfkj/service/hlt/HuiLianTongUnionCardService.java b/service/src/main/java/com/hfkj/service/hlt/HuiLianTongUnionCardService.java index 812b031..74c3b34 100644 --- a/service/src/main/java/com/hfkj/service/hlt/HuiLianTongUnionCardService.java +++ b/service/src/main/java/com/hfkj/service/hlt/HuiLianTongUnionCardService.java @@ -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 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 订单号 diff --git a/service/src/main/java/com/hfkj/service/order/BsOrderService.java b/service/src/main/java/com/hfkj/service/order/BsOrderService.java index d0717a4..21a790a 100644 --- a/service/src/main/java/com/hfkj/service/order/BsOrderService.java +++ b/service/src/main/java/com/hfkj/service/order/BsOrderService.java @@ -51,6 +51,9 @@ public interface BsOrderService { */ OrderModel cancel(String orderNo, boolean system); + + void deleteOrder(BsOrder order); + /** * 子订单完成 * @param childOrderNo diff --git a/service/src/main/java/com/hfkj/service/order/OrderRefundSuccessService.java b/service/src/main/java/com/hfkj/service/order/OrderRefundSuccessService.java index cb69e69..36b30c3 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderRefundSuccessService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderRefundSuccessService.java @@ -7,15 +7,20 @@ 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.BsOrderGoods; import com.hfkj.model.order.OrderChildModel; import com.hfkj.model.order.OrderModel; import com.hfkj.qianzhu.channel.CinemaService; 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.HashMap; +import java.util.List; import java.util.Map; @@ -30,6 +35,8 @@ public class OrderRefundSuccessService { @Resource private BsOrderCinemaService bsOrderCinemaService; + @Autowired + private BsOrderGoodsServiceImpl bsOrderGoodsService; /** * 订单业务处理 @@ -39,7 +46,8 @@ 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 虚拟产品退款业务 } else if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type3.getCode())) { @@ -52,6 +60,31 @@ public class OrderRefundSuccessService { } } + public void goods(BsOrderChild childOrder) { + // 查询实物订单 + BsOrderGoods orderGoods = bsOrderGoodsService.findGoodsOrderByChild(childOrder.getOrderNo()); + + try { + + if (orderGoods != null) { + Map 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); + } + } catch (Exception e) { + orderGoods.setExceptionStatus(true); + orderGoods.setExceptionMsg(e.getMessage()); + } finally { + bsOrderGoodsService.update(orderGoods); + } + + } + public void cinema(BsOrderChild childOrder) { // 查询电影票订单 BsOrderCinema orderCinema = bsOrderCinemaService.findGoodsOrder(childOrder.getOrderNo()); @@ -64,11 +97,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); } diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java index 76e85de..ed828bd 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java @@ -228,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); } diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java index 1218391..3e76adf 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java @@ -453,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); @@ -596,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); diff --git a/service/src/main/java/com/hfkj/sysenum/order/OrderStatusEnum.java b/service/src/main/java/com/hfkj/sysenum/order/OrderStatusEnum.java index 291685c..5ad6da8 100644 --- a/service/src/main/java/com/hfkj/sysenum/order/OrderStatusEnum.java +++ b/service/src/main/java/com/hfkj/sysenum/order/OrderStatusEnum.java @@ -12,6 +12,10 @@ import java.util.Objects; **/ @Getter public enum OrderStatusEnum { + /** + * 删除 + */ + status0(0, "删除"), /** * 待支付 */ diff --git a/service/src/main/resources/dev/commonConfig.properties b/service/src/main/resources/dev/commonConfig.properties index 2d6f3ad..db598c6 100644 --- a/service/src/main/resources/dev/commonConfig.properties +++ b/service/src/main/resources/dev/commonConfig.properties @@ -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 diff --git a/user/src/main/java/com/user/controller/UserCardController.java b/user/src/main/java/com/user/controller/UserCardController.java index bcd45a6..6af4e2b 100644 --- a/user/src/main/java/com/user/controller/UserCardController.java +++ b/user/src/main/java/com/user/controller/UserCardController.java @@ -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 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); + } + } + }