一号通平台功能优化

This commit is contained in:
337031187
2021-01-13 12:30:38 +08:00
parent 34e23e9a53
commit 3b8397e4b1
13 changed files with 265 additions and 284 deletions

View File

@@ -23,7 +23,7 @@
<div class="title">订单信息</div> <div class="title">订单信息</div>
<div class="acea-row"> <div class="acea-row">
<div class="description-term">订单编号{{orderDatalist.orderId}}</div> <div class="description-term">订单编号{{orderDatalist.orderId}}</div>
<div class="description-term" style="color: red">订单状态{{orderDatalist.status | orderStatusFilter}}</div> <div class="description-term" style="color: red">订单状态{{orderDatalist.statusStr.value}}</div>
<div class="description-term">商品总数{{orderDatalist.totalNum}}</div> <div class="description-term">商品总数{{orderDatalist.totalNum}}</div>
<div class="description-term">商品总价{{orderDatalist.totalPrice}}</div> <div class="description-term">商品总价{{orderDatalist.totalPrice}}</div>
<div class="description-term">交付邮费{{orderDatalist.payPostage}}</div> <div class="description-term">交付邮费{{orderDatalist.payPostage}}</div>
@@ -102,50 +102,50 @@
</template> </template>
<script> <script>
import { orderDetailApi, getLogisticsInfoApi } from '@/api/order' import { orderDetailApi, getLogisticsInfoApi } from '@/api/order'
export default { export default {
name: 'OrderDetail', name: 'OrderDetail',
props: { props: {
orderId: { orderId: {
type: Number, type: Number,
default: 0 default: 0
} }
},
data() {
return {
reverse: true,
dialogVisible: false,
orderDatalist: null,
loading: false,
modal2: false,
result: []
}
},
mounted() {
},
methods: {
openLogistics () {
this.getOrderData()
this.modal2 = true;
}, },
// 获取订单物流信息 data() {
getOrderData () { return {
getLogisticsInfoApi({id:this.orderId}).then(async res => { reverse: true,
this.result = res.result; dialogVisible: false,
}) orderDatalist: null,
loading: false,
modal2: false,
result: []
}
}, },
getDetail(id) { mounted() {
this.loading = true },
orderDetailApi({id: id}).then(res => { methods: {
this.orderDatalist = res openLogistics () {
this.loading = false this.getOrderData()
}).catch(() => { this.modal2 = true;
this.orderDatalist = null },
this.loading = false // 获取订单物流信息
}) getOrderData () {
getLogisticsInfoApi({id:this.orderId}).then(async res => {
this.result = res.list;
})
},
getDetail(id) {
this.loading = true
orderDetailApi({id: id}).then(res => {
this.orderDatalist = res
this.loading = false
}).catch(() => {
this.orderDatalist = null
this.loading = false
})
}
} }
} }
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -40,7 +40,7 @@
sortable sortable
/> />
<el-table-column <el-table-column
label="状态" label="是否显示"
min-width="100" min-width="100"
> >
<template slot-scope="scope"> <template slot-scope="scope">
@@ -61,11 +61,13 @@
label="操作" label="操作"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="bindEdit(scope.row)">编辑</el-button> <el-button v-if="scope.row.net" type="text" size="small" @click="bindEdit(scope.row)">收件网点名称编辑</el-button>
<el-button v-else-if="scope.row.partnerId" type="text" size="small" @click="bindEdit(scope.row)">月结账号编辑</el-button>
<el-button v-else type="text" size="small" @click="bindEdit(scope.row)">编辑</el-button>
<!--<el-button type="text" size="small" @click="bindDelete(scope.row)">删除</el-button>--> <!--<el-button type="text" size="small" @click="bindDelete(scope.row)">删除</el-button>-->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>`
<div class="block-pagination"> <div class="block-pagination">
<el-pagination <el-pagination
:page-sizes="[20, 40, 60, 80]" :page-sizes="[20, 40, 60, 80]"
@@ -97,10 +99,10 @@
<el-form-item label="排序" prop="sort"> <el-form-item label="排序" prop="sort">
<el-input-number v-model="formData.sort" :min="0" :max="9999" label="排序"></el-input-number> <el-input-number v-model="formData.sort" :min="0" :max="9999" label="排序"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="是否启用" prop="isShow"> <el-form-item label="是否启用" prop="status">
<el-radio-group v-model="formData.isShow"> <el-radio-group v-model="formData.status">
<el-radio :label="false">隐藏</el-radio> <el-radio :label="false">关闭</el-radio>
<el-radio :label="true">启用</el-radio> <el-radio :label="true">开启</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -113,144 +115,143 @@
</template> </template>
<script> <script>
import parser from '@/components/FormGenerator/components/parser/Parser' import parser from '@/components/FormGenerator/components/parser/Parser'
import * as systemFormConfigApi from '@/api/systemFormConfig.js' import * as systemFormConfigApi from '@/api/systemFormConfig.js'
import * as logistics from '@/api/logistics.js' import * as logistics from '@/api/logistics.js'
import * as constants from '@/utils/constants.js' export default {
export default { name: 'CompanyList',
name: 'CompanyList', components: { parser },
components: { parser }, data() {
data() { return {
return { constants:this.$constants,
constants, // 表单
// 表单 formConf: { fields: [] },
formConf: { fields: [] }, form: {
form: { keywords: ''
keywords: '' },
}, tableData: {},
tableData: {}, page: 1,
page: 1, limit: 20,
limit: 20, loading: false,
loading: false, dialogVisible: false,
dialogVisible: false, fromType: 'add',
fromType: 'add', formData: {
formData: { status: false
isShow: false },
}, isCreate: 0,
isCreate: 0, formShow: false,
formShow: false, editId: 0,
editId: 0, rules: {
rules: { sort: [
sort: [ { required: true, message: '请输入排序', trigger: 'blur' },
{ required: true, message: '请输入排序', trigger: 'blur' }, ],
], account: [
account: [ { required: true, message: '请输入月结账号', trigger: 'blur' },
{ required: true, message: '请输入月结账号', trigger: 'blur' }, ],
], password: [
password: [ { required: true, message: '请输入月结密码', trigger: 'blur' },
{ required: true, message: '请输入月结密码', trigger: 'blur' }, ],
], netName: [
netName: [ { required: true, message: '请输入网点名称', trigger: 'blur' },
{ required: true, message: '请输入网点名称', trigger: 'blur' }, ]
] }
} }
} },
}, created() {
created() {
this.getExpressList()
},
methods: {
handlerSearch() {
this.page = 1
this.getExpressList() this.getExpressList()
}, },
// 获取物流公司列表 methods: {
getExpressList() { handlerSearch() {
this.loading = true
logistics.expressList({
page: this.page,
limit: this.limit,
keywords: this.form.keywords
}).then(res => {
this.loading = false
this.tableData = res
}).catch(()=>{
this.loading = false
})
},
// 物流开关
bindStatus(item) {
logistics.expressUpdateShow({
account: item.account,
code: item.code,
id: item.id,
isShow: item.isShow,
name: item.name,
sort: item.sort
}).then(res => {
this.$message.success('操作成功')
this.getExpressList()
}).catch(() => {
item.isShow = !item.isShow
})
},
// 分页
pageChange(e) {
this.page = e
this.getExpressList()
},
handleSizeChange(e) {
this.limit = e
this.getExpressList()
},
// 添加物流公司
addExpress() {
logistics.expressSyncApi().then(data => {
this.page = 1 this.page = 1
this.getExpressList() this.getExpressList()
}) },
}, // 获取物流公司列表
// 删除物流公司 getExpressList() {
bindDelete(item) { this.loading = true
this.$modalSure().then(() => { logistics.expressList({
logistics.expressDelete({ id: item.id }).then(res => { page: this.page,
this.$message.success('删除成功') limit: this.limit,
keywords: this.form.keywords
}).then(res => {
this.loading = false
this.tableData = res
}).catch(()=>{
this.loading = false
})
},
// 物流开关
bindStatus(item) {
logistics.expressUpdateShow({
account: item.account,
code: item.code,
id: item.id,
isShow: item.isShow,
name: item.name,
sort: item.sort
}).then(res => {
this.$message.success('操作成功')
this.getExpressList()
}).catch(() => {
item.isShow = !item.isShow
})
},
// 分页
pageChange(e) {
this.page = e
this.getExpressList()
},
handleSizeChange(e) {
this.limit = e
this.getExpressList()
},
// 添加物流公司
addExpress() {
logistics.expressSyncApi().then(data => {
this.page = 1
this.getExpressList() this.getExpressList()
}) })
}) },
}, // 删除物流公司
// 表单提交 bindDelete(item) {
submit(formName) { this.$modalSure().then(() => {
this.$refs[formName].validate((valid) => { logistics.expressDelete({ id: item.id }).then(res => {
if (valid) { this.$message.success('删除成功')
logistics.expressUpdate(this.formData).then(res => {
this.$message.success('操作成功')
this.handleClose()
this.getExpressList() this.getExpressList()
}) })
} else { })
return false; },
} // 表单提交
}); submit(formName) {
}, this.$refs[formName].validate((valid) => {
// 关闭模态框 if (valid) {
handleClose(done) { logistics.expressUpdate(this.formData).then(res => {
this.formShow = false this.$message.success('操作成功')
// this.formData = {} this.handleClose()
this.formConf.fields = [] this.getExpressList()
this.dialogVisible = false })
this.isCreate = 0 } else {
}, return false;
// 编辑 }
bindEdit(item) { });
this.dialogVisible = true },
this.editId = item.id // 关闭模态框
logistics.expressInfo({ id: item.id }).then(res => { handleClose(done) {
this.formData = res this.formShow = false
}) // this.formData = {}
this.formConf.fields = []
this.dialogVisible = false
this.isCreate = 0
},
// 编辑
bindEdit(item) {
this.dialogVisible = true
this.editId = item.id
logistics.expressInfo({ id: item.id }).then(res => {
this.formData = res
})
}
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -36,6 +36,5 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
public class CrmebApplication{ public class CrmebApplication{
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(CrmebApplication.class, 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){ public CommonResult<Express> info(@RequestParam(value = "id") Integer id){
Express express = expressService.getById(id); Express express = expressService.getById(id);
return CommonResult.success(express); return CommonResult.success(express);
} }
/** /**
* 查询全部物流公司 * 查询全部物流公司
*/ */
@ApiOperation(value = "查询全部物流公司") @ApiOperation(value = "查询全部物流公司")
@RequestMapping(value = "/all", method = RequestMethod.GET) @RequestMapping(value = "/all", method = RequestMethod.GET)
public CommonResult<List<Express>> all() { @ApiImplicitParam(name="type", value="类型normal-普通elec-电子面单")
return CommonResult.success(expressService.findAll()); 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)); return CommonResult.success(expressService.template(com));
} }
} }

View File

@@ -11,8 +11,8 @@ import com.zbkj.crmeb.express.request.ExpressUpdateShowRequest;
import java.util.List; import java.util.List;
/** /**
* ExpressService 接口 * ExpressService 接口
* +---------------------------------------------------------------------- * +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ] * | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +---------------------------------------------------------------------- * +----------------------------------------------------------------------
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved. * | 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> * | Author: CRMEB Team <admin@crmeb.com>
* +---------------------------------------------------------------------- * +----------------------------------------------------------------------
*/ */
public interface ExpressService extends IService<Express> { public interface ExpressService extends IService<Express> {
/** /**
* 列表 * 列表
* @param request 搜索条件 * @param request 搜索条件
* @param pageParamRequest 分页类参数 * @param pageParamRequest 分页类参数
* @author Mr.Zhang * @author Mr.Zhang
* @since 2020-04-17 * @since 2020-04-17
* @return List<Express> * @return List<Express>
*/ */
List<Express> getList(ExpressSearchRequest request, PageParamRequest pageParamRequest); List<Express> getList(ExpressSearchRequest request, PageParamRequest pageParamRequest);
Express info(Integer id); 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> * | Author: CRMEB Team <admin@crmeb.com>
* +---------------------------------------------------------------------- * +----------------------------------------------------------------------
*/ */
@Service @Service
public class ExpressServiceImpl extends ServiceImpl<ExpressDao, Express> implements ExpressService { 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 @Override
public List<Express> findAll() { public List<Express> findAll(String type) {
LambdaQueryWrapper<Express> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Express> lqw = new LambdaQueryWrapper<>();
lqw.eq(Express::getIsShow, true); 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); lqw.orderByDesc(Express::getSort, Express::getId);
return dao.selectList(lqw); return dao.selectList(lqw);
} }
@@ -268,4 +271,3 @@ public class ExpressServiceImpl extends ServiceImpl<ExpressDao, Express> impleme
public static String st = "mnc7Yay0RsvF70LWX7i6k"; public static String st = "mnc7Yay0RsvF70LWX7i6k";
public static String sk = "¥bugJEjOmF01hxGr~qj5"; public static String sk = "¥bugJEjOmF01hxGr~qj5";
} }

View File

@@ -26,8 +26,8 @@ import java.util.concurrent.TimeUnit;
/** /**
* ExpressServiceImpl 接口实现 * ExpressServiceImpl 接口实现
* +---------------------------------------------------------------------- * +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ] * | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +---------------------------------------------------------------------- * +----------------------------------------------------------------------
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved. * | 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> * | Author: CRMEB Team <admin@crmeb.com>
* +---------------------------------------------------------------------- * +----------------------------------------------------------------------
*/ */
@Data @Data
@Service @Service
public class LogisticsServiceImpl implements LogisticService { public class LogisticsServiceImpl implements LogisticService {
@@ -119,38 +119,14 @@ public class LogisticsServiceImpl implements LogisticService {
resultVo.setNumber(queryVo.getNum()); resultVo.setNumber(queryVo.getNum());
resultVo.setExpName(queryVo.getCom()); resultVo.setExpName(queryVo.getCom());
resultVo.setIsSign(queryVo.getIscheck()); resultVo.setIsSign(queryVo.getIscheck());
switch (queryVo.getStatus()) { resultVo.setDeliveryStatus(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());
if (CollUtil.isNotEmpty(queryVo.getContent())) { if (CollUtil.isNotEmpty(queryVo.getContent())) {
List<LogisticsResultListVo> list = CollUtil.newArrayList(); List<LogisticsResultListVo> list = CollUtil.newArrayList();
queryVo.getContent().forEach(i -> { queryVo.getContent().forEach(i -> {
LogisticsResultListVo listVo = new LogisticsResultListVo(); LogisticsResultListVo listVo = new LogisticsResultListVo();
listVo.setTime(i.getTime()); listVo.setTime(i.getTime());
listVo.setStatus(i.getContext()); listVo.setStatus(i.getStatus());
list.add(listVo); list.add(listVo);
}); });
resultVo.setList(list); resultVo.setList(list);
@@ -166,7 +142,7 @@ public class LogisticsServiceImpl implements LogisticService {
private JSONObject getCache() { private JSONObject getCache() {
Object data = redisUtil.get(getRedisKey() + getExpressNo()); Object data = redisUtil.get(getRedisKey() + getExpressNo());
if(null != data){ if(null != data){
return JSONObject.parseObject(data.toString()); return JSONObject.parseObject(data.toString());
} }
return null; 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.CommonPage;
import com.common.CommonResult; import com.common.CommonResult;
import com.common.PageParamRequest;
import com.constants.Constants;
import com.zbkj.crmeb.express.model.Express; 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.express.service.ExpressService;
import com.zbkj.crmeb.system.service.SystemCityService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -45,9 +41,8 @@ public class ExpressController {
@ApiOperation(value = "列表") @ApiOperation(value = "列表")
@RequestMapping(value = "/logistics", method = RequestMethod.GET) @RequestMapping(value = "/logistics", method = RequestMethod.GET)
public CommonResult<CommonPage<Express>> register(){ 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 = "是否签收") @ApiModelProperty(value = "是否签收")
private String ischeck; 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; private String status;
@ApiModelProperty(value = "物流公司") @ApiModelProperty(value = "物流公司")

View File

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

View File

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

View File

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

View File

@@ -760,19 +760,18 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
/** 退款 /** 退款
* @param request StoreOrderRefundRequest 退款参数 * @param request StoreOrderRefundRequest 退款参数
* @author Mr.Zhang
* @since 2020-06-10
* @return boolean * @return boolean
* 这里只处理订单状态
* 余额支付需要把余额给用户加回去
* 其余处理放入redis中处理
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public boolean refund(StoreOrderRefundRequest request) { public boolean refund(StoreOrderRefundRequest request) {
StoreOrder storeOrder = getById(request.getOrderId()); 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.getPaid()){throw new CrmebException("未支付无法退款");}
if(storeOrder.getRefundPrice().add(request.getAmount()).compareTo(storeOrder.getPayPrice()) > 0) { if(storeOrder.getRefundPrice().add(request.getAmount()).compareTo(storeOrder.getPayPrice()) > 0){throw new CrmebException("退款金额大于支付金额,请修改退款金额");}
throw new CrmebException("退款金额大于支付金额,请修改退款金额");
}
//用户 //用户
User user = userService.getById(storeOrder.getUid()); User user = userService.getById(storeOrder.getUid());
@@ -786,45 +785,61 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
throw new CrmebException("微信申请退款失败!"); 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()); storeOrder.setRefundPrice(request.getAmount());
boolean updateOrder = updateById(storeOrder);
Boolean execute = transactionTemplate.execute(e -> { if(!updateOrder){
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){
storeOrderStatusService.saveRefund(request.getOrderId(), request.getAmount(), "失败"); storeOrderStatusService.saveRefund(request.getOrderId(), request.getAmount(), "失败");
throw new CrmebException("订单更新失败"); throw new CrmebException("订单更新失败");
} }
// // 小程序订阅消息 退款成功 //退款成功
// String storeNameAndCarNumString = orderUtils.getStoreNameAndCarNumString(storeOrder.getId()); storeOrderStatusService.saveRefund(request.getOrderId(), request.getAmount(), null);
// 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 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) { private void validateExpressSend(StoreOrderSendRequest request) {
if (request.getExpressRecordType().equals(1)) { if (request.getExpressRecordType().equals("1")) {
if (StrUtil.isBlank(request.getExpressNumber())) throw new CrmebException("请填写快递单号"); if (StrUtil.isBlank(request.getExpressNumber())) throw new CrmebException("请填写快递单号");
return; return;
} }