一号通平台功能优化

This commit is contained in:
stivepeim
2021-01-13 12:30:38 +08:00
parent debb5e654d
commit 4e42da0fc1
13 changed files with 265 additions and 284 deletions

View File

@@ -36,6 +36,5 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
public class CrmebApplication{
public static void main(String[] args) {
SpringApplication.run(CrmebApplication.class, args);
System.out.println("CRMEB Started!");
}
}

View File

@@ -107,15 +107,16 @@ public class ExpressController {
public CommonResult<Express> info(@RequestParam(value = "id") Integer id){
Express express = expressService.getById(id);
return CommonResult.success(express);
}
}
/**
* 查询全部物流公司
*/
@ApiOperation(value = "查询全部物流公司")
@RequestMapping(value = "/all", method = RequestMethod.GET)
public CommonResult<List<Express>> all() {
return CommonResult.success(expressService.findAll());
@ApiImplicitParam(name="type", value="类型normal-普通elec-电子面单")
public CommonResult<List<Express>> all(@RequestParam(value = "type") String type) {
return CommonResult.success(expressService.findAll(type));
}
/**
@@ -129,6 +130,3 @@ public class ExpressController {
return CommonResult.success(expressService.template(com));
}
}

View File

@@ -11,8 +11,8 @@ import com.zbkj.crmeb.express.request.ExpressUpdateShowRequest;
import java.util.List;
/**
* ExpressService 接口
* +----------------------------------------------------------------------
* ExpressService 接口
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
@@ -21,17 +21,17 @@ import java.util.List;
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
*/
public interface ExpressService extends IService<Express> {
/**
* 列表
* @param request 搜索条件
* @param pageParamRequest 分页类参数
* @author Mr.Zhang
* @since 2020-04-17
* @return List<Express>
*/
* 列表
* @param request 搜索条件
* @param pageParamRequest 分页类参数
* @author Mr.Zhang
* @since 2020-04-17
* @return List<Express>
*/
List<Express> getList(ExpressSearchRequest request, PageParamRequest pageParamRequest);
Express info(Integer id);
@@ -53,8 +53,9 @@ public interface ExpressService extends IService<Express> {
/**
* 查询全部快递公司
* @param type 类型normal-普通elec-电子面单
*/
List<Express> findAll();
List<Express> findAll(String type);
/**
* 查询快递公司面单模板

View File

@@ -45,7 +45,7 @@ import java.util.stream.Collectors;
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
*/
@Service
public class ExpressServiceImpl extends ServiceImpl<ExpressDao, Express> implements ExpressService {
@@ -148,12 +148,15 @@ public class ExpressServiceImpl extends ServiceImpl<ExpressDao, Express> impleme
/**
* 查询全部物流公司
* @param type 类型normal-普通elec-电子面单
*/
@Override
public List<Express> findAll() {
public List<Express> findAll(String type) {
LambdaQueryWrapper<Express> lqw = new LambdaQueryWrapper<>();
lqw.eq(Express::getIsShow, true);
lqw.eq(Express::getStatus, true);
if (type.equals("elec")) {
lqw.eq(Express::getStatus, true);
}
lqw.orderByDesc(Express::getSort, Express::getId);
return dao.selectList(lqw);
}
@@ -268,4 +271,3 @@ public class ExpressServiceImpl extends ServiceImpl<ExpressDao, Express> impleme
public static String st = "mnc7Yay0RsvF70LWX7i6k";
public static String sk = "¥bugJEjOmF01hxGr~qj5";
}

View File

@@ -26,8 +26,8 @@ import java.util.concurrent.TimeUnit;
/**
* ExpressServiceImpl 接口实现
* +----------------------------------------------------------------------
* ExpressServiceImpl 接口实现
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
@@ -36,7 +36,7 @@ import java.util.concurrent.TimeUnit;
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
*/
@Data
@Service
public class LogisticsServiceImpl implements LogisticService {
@@ -119,38 +119,14 @@ public class LogisticsServiceImpl implements LogisticService {
resultVo.setNumber(queryVo.getNum());
resultVo.setExpName(queryVo.getCom());
resultVo.setIsSign(queryVo.getIscheck());
switch (queryVo.getStatus()) {
case "0":// 在途
case "1":// 揽收
case "7":// 转单
resultVo.setDeliveryStatus("1");
break;
case "2":// 疑难
resultVo.setDeliveryStatus("5");
break;
case "3":// 签收
resultVo.setDeliveryStatus("3");
break;
case "4":// 退签
resultVo.setDeliveryStatus("6");
break;
case "5":// 派件
resultVo.setDeliveryStatus("2");
break;
case "6":// 退回
resultVo.setDeliveryStatus("6");
break;
default:
resultVo.setDeliveryStatus(queryVo.getStatus());
}
resultVo.setDeliveryStatus(queryVo.getNum());
resultVo.setDeliveryStatus(queryVo.getStatus());
if (CollUtil.isNotEmpty(queryVo.getContent())) {
List<LogisticsResultListVo> list = CollUtil.newArrayList();
queryVo.getContent().forEach(i -> {
LogisticsResultListVo listVo = new LogisticsResultListVo();
listVo.setTime(i.getTime());
listVo.setStatus(i.getContext());
listVo.setStatus(i.getStatus());
list.add(listVo);
});
resultVo.setList(list);
@@ -166,7 +142,7 @@ public class LogisticsServiceImpl implements LogisticService {
private JSONObject getCache() {
Object data = redisUtil.get(getRedisKey() + getExpressNo());
if(null != data){
return JSONObject.parseObject(data.toString());
return JSONObject.parseObject(data.toString());
}
return null;
}
@@ -191,4 +167,3 @@ public class LogisticsServiceImpl implements LogisticService {
}
}
}

View File

@@ -3,12 +3,8 @@ package com.zbkj.crmeb.front.controller;
import com.common.CommonPage;
import com.common.CommonResult;
import com.common.PageParamRequest;
import com.constants.Constants;
import com.zbkj.crmeb.express.model.Express;
import com.zbkj.crmeb.express.request.ExpressSearchRequest;
import com.zbkj.crmeb.express.service.ExpressService;
import com.zbkj.crmeb.system.service.SystemCityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -45,9 +41,8 @@ public class ExpressController {
@ApiOperation(value = "列表")
@RequestMapping(value = "/logistics", method = RequestMethod.GET)
public CommonResult<CommonPage<Express>> register(){
return CommonResult.success(CommonPage.restPage(expressService.findAll()));
return CommonResult.success(CommonPage.restPage(expressService.findAll("normal")));
}
}

View File

@@ -31,7 +31,7 @@ public class OnePassLogisticsQueryVo {
@ApiModelProperty(value = "是否签收")
private String ischeck;
@ApiModelProperty(value = "物流状态0在途1揽收2疑难3签收4退签5派件6退回7转单10待清关11清关中12已清关13清关异常14收件人拒签")
@ApiModelProperty(value = "物流状态0:快递收件(揽件)1.在途中 2.正在派件 3.已签收 4.派送失败 5.疑难件 6.退件签收 ")
private String status;
@ApiModelProperty(value = "物流公司")

View File

@@ -32,5 +32,5 @@ public class OnePassLogisticsTrackVo {
private String ftime;
@ApiModelProperty(value = "变动详情")
private String context;
private String status;
}

View File

@@ -1,7 +1,5 @@
package com.zbkj.crmeb.store.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
@@ -40,9 +38,6 @@ public class StoreProductDescription implements Serializable {
this.type = type;
}
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "商品ID")
private Integer productId;

View File

@@ -38,8 +38,8 @@ public class StoreOrderRefundRequest {
@DecimalMin(value = "0.00", message = "退款金额不能少于0.00")
private BigDecimal amount;
// @ApiModelProperty(value = "status 1 = 直接退款, 2 = 退款后,返回原状态", allowableValues = "range[1,2]")
// @Range(min = 1, max = 2, message = "请选择退款状态 1 = 直接退款, 2 = 退款后,返回原状态")
// private int type;
@ApiModelProperty(value = "status 1 = 直接退款, 2 = 退款后,返回原状态", allowableValues = "range[1,2]")
@Range(min = 1, max = 2, message = "请选择退款状态 1 = 直接退款, 2 = 退款后,返回原状态")
private int type;
}

View File

@@ -760,19 +760,18 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
/** 退款
* @param request StoreOrderRefundRequest 退款参数
* @author Mr.Zhang
* @since 2020-06-10
* @return boolean
* 这里只处理订单状态
* 余额支付需要把余额给用户加回去
* 其余处理放入redis中处理
*/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean refund(StoreOrderRefundRequest request) {
StoreOrder storeOrder = getById(request.getOrderId());
if(ObjectUtil.isNull(storeOrder)){throw new CrmebException("未查到订单");}
if(null == storeOrder){throw new CrmebException("未查到订单");}
if(!storeOrder.getPaid()){throw new CrmebException("未支付无法退款");}
if(storeOrder.getRefundPrice().add(request.getAmount()).compareTo(storeOrder.getPayPrice()) > 0) {
throw new CrmebException("退款金额大于支付金额,请修改退款金额");
}
if(storeOrder.getRefundPrice().add(request.getAmount()).compareTo(storeOrder.getPayPrice()) > 0){throw new CrmebException("退款金额大于支付金额,请修改退款金额");}
//用户
User user = userService.getById(storeOrder.getUid());
@@ -786,45 +785,61 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
throw new CrmebException("微信申请退款失败!");
}
}
if (storeOrder.getPayType().equals(Constants.PAY_TYPE_YUE)) {
UserOperateFundsRequest userOperateFundsRequest = new UserOperateFundsRequest();
userOperateFundsRequest.setUid(storeOrder.getUid());
userOperateFundsRequest.setValue(request.getAmount());
userOperateFundsRequest.setFoundsCategory(Constants.USER_BILL_CATEGORY_MONEY);
userOperateFundsRequest.setFoundsType(Constants.ORDER_STATUS_REFUNDED);
userOperateFundsRequest.setType(1);
userOperateFundsRequest.setTitle(Constants.ORDER_STATUS_STR_REFUNDED);
boolean addMoney = userService.updateFounds(userOperateFundsRequest, false); //更新余额
if(!addMoney){throw new CrmebException("余额退款失败");}
//新增日志
boolean addBill = userBillService.saveRefundBill(request, user);
if(!addBill){throw new CrmebException("余额退款失败");}
}
//修改订单退款状态
storeOrder.setRefundStatus(3);
if(request.getType() == 1){
storeOrder.setRefundStatus(2);
}else if(request.getType() == 2){
storeOrder.setRefundStatus(0);
}else{
throw new CrmebException("选择退款状态错误");
}
storeOrder.setRefundPrice(request.getAmount());
Boolean execute = transactionTemplate.execute(e -> {
updateById(storeOrder);
if (storeOrder.getPayType().equals(Constants.PAY_TYPE_YUE)) {
// 更新用户金额 TODO 后期要调整
UserOperateFundsRequest userOperateFundsRequest = new UserOperateFundsRequest();
userOperateFundsRequest.setUid(storeOrder.getUid());
userOperateFundsRequest.setValue(request.getAmount());
userOperateFundsRequest.setFoundsCategory(Constants.USER_BILL_CATEGORY_MONEY);
userOperateFundsRequest.setFoundsType(Constants.ORDER_STATUS_REFUNDED);
userOperateFundsRequest.setType(1);
userOperateFundsRequest.setTitle(Constants.ORDER_STATUS_STR_REFUNDED);
userService.updateFounds(userOperateFundsRequest, false); //更新余额
//新增日志
userBillService.saveRefundBill(request, user);
// 退款task
redisUtil.lPush(Constants.ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER, storeOrder.getId());
}
return Boolean.TRUE;
});
if(!execute){
boolean updateOrder = updateById(storeOrder);
if(!updateOrder){
storeOrderStatusService.saveRefund(request.getOrderId(), request.getAmount(), "失败");
throw new CrmebException("订单更新失败");
}
// // 小程序订阅消息 退款成功
// String storeNameAndCarNumString = orderUtils.getStoreNameAndCarNumString(storeOrder.getId());
// WechatSendMessageForReFundEd forReFundEd = new WechatSendMessageForReFundEd(
// "退款成功",storeNameAndCarNumString,request.getAmount()+"",DateUtil.nowDateTimeStr(),"退款金额已到余额中",
// storeOrder.getOrderId(),storeOrder.getId()+"",storeOrder.getCreateTime()+"",storeOrder.getRefundPrice()+"",
// storeNameAndCarNumString,storeOrder.getRefundReason(),"CRMEB",storeOrder.getRefundReasonWapExplain(),
// "暂无"
// );
// wechatSendMessageForMinService.sendReFundEdMessage(forReFundEd, userService.getUserIdException());
//退款成功
storeOrderStatusService.saveRefund(request.getOrderId(), request.getAmount(), null);
return execute;
//佣金
subtractBill(request, Constants.USER_BILL_CATEGORY_MONEY,
Constants.USER_BILL_TYPE_BROKERAGE, Constants.USER_BILL_CATEGORY_BROKERAGE_PRICE);
//积分
subtractBill(request, Constants.USER_BILL_CATEGORY_INTEGRAL,
Constants.USER_BILL_TYPE_GAIN, Constants.USER_BILL_CATEGORY_INTEGRAL);
// 回滚库存 后续操作放入redis
redisUtil.lPush(Constants.ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER, storeOrder.getId());
// 小程序订阅消息 退款成功
String storeNameAndCarNumString = orderUtils.getStoreNameAndCarNumString(storeOrder.getId());
WechatSendMessageForReFundEd forReFundEd = new WechatSendMessageForReFundEd(
"退款成功",storeNameAndCarNumString,request.getAmount()+"",DateUtil.nowDateTimeStr(),"退款金额已到余额中",
storeOrder.getOrderId(),storeOrder.getId()+"",storeOrder.getCreateTime()+"",storeOrder.getRefundPrice()+"",
storeNameAndCarNumString,storeOrder.getRefundReason(),"CRMEB",storeOrder.getRefundReasonWapExplain(),
"暂无"
);
wechatSendMessageForMinService.sendReFundEdMessage(forReFundEd, userService.getUserIdException());
return true;
}
/** 订单详情
@@ -1435,7 +1450,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
* 校验快递发货参数
*/
private void validateExpressSend(StoreOrderSendRequest request) {
if (request.getExpressRecordType().equals(1)) {
if (request.getExpressRecordType().equals("1")) {
if (StrUtil.isBlank(request.getExpressNumber())) throw new CrmebException("请填写快递单号");
return;
}