master
袁野 6 months ago
parent f4c904c20d
commit 433037a996
  1. 3
      cweb/src/main/java/com/cweb/config/SysConfig.java
  2. 11
      cweb/src/main/java/com/cweb/controller/goods/GoodsController.java
  3. 1
      cweb/src/main/resources/pre/config.properties
  4. 14
      order/src/main/java/com/order/controller/business/BsOrderGoodsController.java
  5. 44
      order/src/main/resources/dev/logback.xml
  6. 4
      service/src/main/java/com/hfkj/entity/BsOrderGoods.java
  7. 44
      service/src/main/java/com/hfkj/service/coupon/channel/PcytCNPCCouponConfig.java
  8. 3
      service/src/main/java/com/hfkj/service/coupon/channel/PetroConfig.java
  9. 10
      service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java
  10. 25
      service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java
  11. 7
      service/src/main/java/com/hfkj/service/goods/impl/GoodsBrandServiceImpl.java
  12. 31
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  13. 4
      service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java

@ -1,5 +1,6 @@
package com.cweb.config;
import lombok.Data;
import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
@ -8,7 +9,7 @@ import org.springframework.stereotype.Component;
@Component("sysConfig")
@ConfigurationProperties
@PropertySource("classpath:/config.properties")
@Getter
@Data
public class SysConfig {
private String fileUrl;

@ -1,5 +1,6 @@
package com.cweb.controller.goods;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
@ -79,13 +80,19 @@ public class GoodsController {
@RequestMapping(value="/getListBrand",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询品牌列表")
public ResponseData getListBrand(@RequestParam(value = "title" , required = false) String title) {
public ResponseData getListBrand(@RequestParam(value = "title" , required = false) String title,
@RequestParam(value = "ext1" , required = false) String ext1) {
try {
Map<String , Object> map = new HashMap<>();
map.put("title", title);
return ResponseMsgUtil.success(goodsBrandService.getList(map));
JSONObject object = new JSONObject();
object.put("list", goodsBrandService.getList(map));
map.put("ext1", "热门");
object.put("listExt", goodsBrandService.getList(map));
return ResponseMsgUtil.success(object);
} catch (Exception e) {
log.error("error!",e);

@ -1,2 +1 @@
fileUrl=/home/project/hsg/filesystem
cmsPath=/home/project/hsg/filesystem/cmsPath

@ -158,4 +158,18 @@ public class BsOrderGoodsController {
}
}
@RequestMapping(value="/confirmReceipt",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "确认收货")
public ResponseData confirmReceipt(@RequestParam(value = "id" , required = false) Long id) {
try {
bsOrderGoodsService.confirmReceipt(id);
return ResponseMsgUtil.success("成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -69,4 +69,48 @@
<logger name="com.hfkj" level="ERROR">
<appender-ref ref="errorlog" />
</logger>
<!-- 定制日志 -->
<!-- 四川中石油 -->
<appender name="ScPetroLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/petroLog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/ScPetroLog/ScPetroLog.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.service.coupon.channel.PetroConfig" level="INFO">
<appender-ref ref="ScPetroLog" />
</logger>
<!-- 中油优途中石油卡券 -->
<appender name="PcytCNPCCouponLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/petroLog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/PcytCNPC/PcytCNPCCouponLog.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.service.coupon.channel.PcytCNPCCouponConfig" level="INFO">
<appender-ref ref="PcytCNPCCouponLog" />
</logger>
</configuration>

@ -160,7 +160,7 @@ public class BsOrderGoods implements Serializable {
private Integer payType;
/**
* 1:待发货 2:已发货 3配送中 4已送达 5已取消 6退货中 7已退货 8待支付 0:删除
* 1:待发货 2:已发货 3配送中 4已送达 5已取消 6退货中 7已退货 8待支付 9:已收货 0:删除
*/
private Integer status;
@ -662,4 +662,4 @@ public class BsOrderGoods implements Serializable {
sb.append("]");
return sb.toString();
}
}
}

@ -1,10 +1,13 @@
package com.hfkj.service.coupon.channel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.MD5Util;
import com.hfkj.config.CommonSysConst;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@ -20,7 +23,9 @@ import java.util.Set;
* @createTime 18:33 2023/11/13
**/
@Configuration
public class PcytCNPCCouponService {
public class PcytCNPCCouponConfig {
private static Logger log = LoggerFactory.getLogger(PcytCNPCCouponConfig.class);
/**
* @Author Sum1Dream
@ -30,11 +35,18 @@ public class PcytCNPCCouponService {
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getCouponList() throws Exception {
log.info("========================请求任务Start=========================");
JSONObject paramMap = new JSONObject();
paramMap.put("method" , "api.coupon.reserve");
paramMap.put("merchant" ,CommonSysConst.getSysConfig().getPcytCnpcMerchant());
paramMap.put("sign", generateSign(paramMap , CommonSysConst.getSysConfig().getPcytCnpcSecret()));
return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>());
log.info("获取卡券列表-请求参数: " + JSON.toJSONString(paramMap));
JSONObject object = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>());
log.info("获取卡券列表-回调参数: " + JSON.toJSONString(object));
log.info("========================请求任务End=========================");
// 请求接口
return object;
}
/**
@ -46,6 +58,7 @@ public class PcytCNPCCouponService {
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getCoupon(String orderNo , String mobile, String reqCode) throws Exception {
log.info("========================请求任务Start=========================");
JSONObject paramMap = new JSONObject();
paramMap.put("method" , "api.coupon.once");
@ -54,7 +67,14 @@ public class PcytCNPCCouponService {
paramMap.put("reqCode" , reqCode);
paramMap.put("merchant" ,CommonSysConst.getSysConfig().getPcytCnpcMerchant());
paramMap.put("sign", generateSign(paramMap , CommonSysConst.getSysConfig().getPcytCnpcSecret()));
return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>());
log.info("获取电子券-请求参数: " + JSON.toJSONString(paramMap));
JSONObject object = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>());
log.info("获取电子券-回调参数: " + JSON.toJSONString(object));
log.info("========================请求任务End=========================");
// 请求接口
return object;
}
/**
@ -66,13 +86,20 @@ public class PcytCNPCCouponService {
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getCouponQuery(String couponCode ) throws Exception {
log.info("========================请求任务Start=========================");
JSONObject paramMap = new JSONObject();
paramMap.put("method" , "api.coupon.query");
paramMap.put("couponCode" , couponCode);
paramMap.put("merchant" ,CommonSysConst.getSysConfig().getPcytCnpcMerchant());
paramMap.put("sign", generateSign(paramMap , CommonSysConst.getSysConfig().getPcytCnpcSecret()));
return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>());
log.info("查询电子券信息-请求参数: " + JSON.toJSONString(paramMap));
JSONObject object = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>());
log.info("查询电子券信息-回调参数: " + JSON.toJSONString(object));
log.info("========================请求任务End=========================");
// 请求接口
return object;
}
/**
@ -84,13 +111,20 @@ public class PcytCNPCCouponService {
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getCouponDestroy(String couponCode ) throws Exception {
log.info("========================请求任务Start=========================");
JSONObject paramMap = new JSONObject();
paramMap.put("method" , "api.coupon.destroy");
paramMap.put("couponCode" , couponCode);
paramMap.put("merchant" ,CommonSysConst.getSysConfig().getPcytCnpcMerchant());
paramMap.put("sign", generateSign(paramMap , CommonSysConst.getSysConfig().getPcytCnpcSecret()));
return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>());
log.info("作废电子券-请求参数: " + JSON.toJSONString(paramMap));
JSONObject object = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>());
log.info("作废电子券-回调参数: " + JSON.toJSONString(object));
log.info("========================请求任务End=========================");
// 请求接口
return object;
}

@ -27,9 +27,6 @@ public class PetroConfig {
private static String petroAppid;
private static String petroAesKey;
private static final String version = "1.0";
private final static String charset = "UTF-8";
private static Logger log = LoggerFactory.getLogger(PetroConfig.class);

@ -118,4 +118,14 @@ public interface BsOrderGoodsService {
* @Return com.alibaba.fastjson.JSONObject
*/
Object getLogisticsMsg(Long orderGoodsId);
/**
* @Author Sum1Dream
* @Name getLogisticsMsg
* @Description // 确认收货
* @Date 16:19 2023/4/20
* @Param [num]
* @Return com.alibaba.fastjson.JSONObject
*/
void confirmReceipt(Long orderGoodsId);
}

@ -13,6 +13,7 @@ import com.hfkj.entity.BsOrderGoodsExample;
import com.hfkj.entity.GoodsLogistics;
import com.hfkj.entity.GoodsLogisticsExample;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.order.BsOrderService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -39,6 +40,10 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
@Resource
private RedisUtil redisUtil;
@Resource
private BsOrderService orderService;
@Override
public void create(BsOrderGoods orderGoods) {
bsOrderGoodsMapper.insert(orderGoods);
@ -233,4 +238,24 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
return data;
}
}
@Override
public void confirmReceipt(Long orderGoodsId) {
BsOrderGoods orderGoods = queryDetail(orderGoodsId);
if (orderGoods == null ||
orderGoods.getStatus() == 1 ||
orderGoods.getStatus() == 5 ||
orderGoods.getStatus() == 6 ||
orderGoods.getStatus() == 7 ||
orderGoods.getStatus() == 8) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前状态,不支持确认收货!");
}
orderGoods.setStatus(9);
// todo 缺少修改主订单状态
update(orderGoods);
// 删除缓存
orderService.cacheDelete(orderGoods.getOrderNo());
}
}

@ -3,15 +3,12 @@ package com.hfkj.service.goods.impl;
import com.hfkj.dao.GoodsBrandMapper;
import com.hfkj.entity.GoodsBrand;
import com.hfkj.entity.GoodsBrandExample;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsType;
import com.hfkj.service.goods.GoodsBrandService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -63,6 +60,10 @@ public class GoodsBrandServiceImpl implements GoodsBrandService {
criteria.andTitleLike("%"+MapUtils.getString(map, "title")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "ext1"))) {
criteria.andExt1EqualTo(MapUtils.getString(map, "ext1"));
}
criteria.andStatusNotEqualTo(0);
return goodsBrandMapper.selectByExample(example);

@ -6,14 +6,13 @@ 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.RedisUtil;
import com.hfkj.entity.*;
import com.hfkj.model.order.OrderModel;
import com.hfkj.service.coupon.BsOrderCouponNoService;
import com.hfkj.service.coupon.BsOrderCouponService;
import com.hfkj.service.coupon.channel.ChongQingCNPCCouponService;
import com.hfkj.service.coupon.channel.HuiLianTongCouponService;
import com.hfkj.service.coupon.channel.PcytCNPCCouponService;
import com.hfkj.service.coupon.channel.PcytCNPCCouponConfig;
import com.hfkj.service.coupon.channel.PetroConfig;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsMsgService;
@ -23,11 +22,9 @@ import com.hfkj.sysenum.GoodsVpdSourceEnum;
import com.hfkj.sysenum.order.OrderChildProductTypeEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -133,30 +130,6 @@ public class OrderPaySuccessService {
}
} else if (vpd.getSource() == GoodsVpdSourceEnum.type6.getCode()) {
/* // 派发停车券
ApiBlxCoupon apiBlxCoupon = apiBlxCouponService.findBlxCoupon(coupon.getCouponKey());
if (apiBlxCoupon == null || apiBlxCoupon.getCouponStatus() != 1) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
}
// 计算上送卡券数量
int num = coupon.getSalesPrice().divide(new BigDecimal(apiBlxCoupon.getDenomination())).intValue();
if (num > 0) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("couponCode" , coupon.getCouponKey());
jsonObject.put("receiverPhone" , order.getMemPhone());
jsonObject.put("receiverCount" , num);
JSONObject object = blxConfig.sendCoupon(jsonObject);
if (object.getInteger("code") == 1) {
order.setOrderStatus(OrderStatus.STATUS3.getNumber());
order.setFinishTime(new Date());
orderService.updateOrderData(order);
highUserCardService.getBlxCouponBalance(order.getMemPhone());
} else {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , object.getString("msg"));
}
}*/
} else if (vpd.getSource() == GoodsVpdSourceEnum.type7.getCode()) {
// 发放卡券
@ -172,7 +145,7 @@ public class OrderPaySuccessService {
} else if (vpd.getSource() == GoodsVpdSourceEnum.type10.getCode()) {
// 发放卡券
JSONObject jsonObject = PcytCNPCCouponService.getCoupon(orderCoupon.getOrderNo() , orderCoupon.getUserPhone() , orderCoupon.getGoodsVpdKey());
JSONObject jsonObject = PcytCNPCCouponConfig.getCoupon(orderCoupon.getOrderNo() , orderCoupon.getUserPhone() , orderCoupon.getGoodsVpdKey());
if (!jsonObject.getString("code").equals("200")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , jsonObject.getString("errMsg"));
}

@ -87,9 +87,7 @@ public class BsOrderChildServiceImpl implements BsOrderChildService {
}
object.put("address", address);
if (orderGoods.getLogisticsNo() != null) {
object.put("logisticsNo", orderGoods.getLogisticsNo());
}
object.put("orderGoodsId", orderGoods.getId());
childModel.setBusiness(object);
}

Loading…
Cancel
Save