|
|
|
|
@@ -4,6 +4,8 @@ import cn.hutool.core.date.DateTime;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
|
|
@@ -298,10 +300,10 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|
|
|
|
wrapper.selectAs(TpClientStaff::getName,CustomerOrderVo::getCname);
|
|
|
|
|
}else {
|
|
|
|
|
if (loginUser.getIdentity() == 3 || loginUser.getIdentity() == 1){
|
|
|
|
|
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getRemark,TpOrder::getType,TpOrder::getAddTime,TpOrder::getNum,TpOrder::getJsRemark,TpOrder::getPrice,TpOrder::getPayState,TpOrder::getPayPrice,TpOrder::getEndPrice,TpOrder::getKfpay,TpOrder::getState,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getIsCd,TpOrder::getDtTime,TpOrder::getSid,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree,TpOrder::getCoupon,TpOrder::getJcsOrderId);
|
|
|
|
|
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getRemark,TpOrder::getType,TpOrder::getAddTime,TpOrder::getNum,TpOrder::getJsRemark,TpOrder::getPrice,TpOrder::getPayState,TpOrder::getPayPrice,TpOrder::getEndPrice,TpOrder::getKfpay,TpOrder::getState,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getIsCd,TpOrder::getDtTime,TpOrder::getSid,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree,TpOrder::getByFour,TpOrder::getSatisfiedTime,TpOrder::getCoupon,TpOrder::getJcsOrderId,TpOrder::getBreach);
|
|
|
|
|
wrapper.selectAs(TpClientStaff::getName,CustomerOrderVo::getCname);
|
|
|
|
|
}else {
|
|
|
|
|
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getRemark,TpOrder::getType,TpOrder::getAddTime,TpOrder::getNum,TpOrder::getJsRemark,TpOrder::getPrice,TpOrder::getPayState,TpOrder::getPayPrice,TpOrder::getEndPrice,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getIsCd,TpOrder::getState,TpOrder::getDtTime,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree,TpOrder::getCoupon,TpOrder::getJcsOrderId);
|
|
|
|
|
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getRemark,TpOrder::getType,TpOrder::getAddTime,TpOrder::getNum,TpOrder::getJsRemark,TpOrder::getPrice,TpOrder::getPayState,TpOrder::getPayPrice,TpOrder::getEndPrice,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getIsCd,TpOrder::getState,TpOrder::getDtTime,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree,TpOrder::getByFour,TpOrder::getSatisfiedTime,TpOrder::getCoupon,TpOrder::getJcsOrderId,TpOrder::getBreach);
|
|
|
|
|
wrapper.selectAs(TpClientStaff::getName,CustomerOrderVo::getCname);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -315,8 +317,13 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|
|
|
|
.leftJoin(SysUser.class,"b",SysUser::getUserId,TpOrder::getBid)
|
|
|
|
|
.leftJoin(TpClient.class,TpClient::getId,TpOrder::getKid)
|
|
|
|
|
.leftJoin(TpClientStaff.class,TpClientStaff::getId,TpOrder::getSkid)
|
|
|
|
|
.leftJoin(TpWechat.class,TpWechat::getId,TpOrder::getWid)
|
|
|
|
|
.orderByDesc(TpOrder::getId);
|
|
|
|
|
.leftJoin(TpWechat.class,TpWechat::getId,TpOrder::getWid);
|
|
|
|
|
|
|
|
|
|
if (bo.getByTwo() != null){
|
|
|
|
|
wrapper.orderByDesc(TpOrder::getByFour);
|
|
|
|
|
}else{
|
|
|
|
|
wrapper .orderByDesc(TpOrder::getId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//分页查询 (需要启用 mybatis plus 分页插件)
|
|
|
|
|
IPage<CustomerOrderVo> listPage = baseMapper.selectJoinPage(new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize()), CustomerOrderVo.class, wrapper);
|
|
|
|
|
@@ -344,7 +351,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|
|
|
|
if(LoginHelper.isSuperAdmin()){
|
|
|
|
|
wrapper.selectAll(TpOrder.class);
|
|
|
|
|
}else {
|
|
|
|
|
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getType,TpOrder::getNum,TpOrder::getAddTime,TpOrder::getRemark,TpOrder::getJsRemark,TpOrder::getPayState,TpOrder::getJsPrice,TpOrder::getJsPayPrice,TpOrder::getState,TpOrder::getDtTime,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree,TpOrder::getCoupon,TpOrder::getJcsOrderId);
|
|
|
|
|
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getType,TpOrder::getNum,TpOrder::getAddTime,TpOrder::getRemark,TpOrder::getJsRemark,TpOrder::getPayState,TpOrder::getJsPrice,TpOrder::getJsPayPrice,TpOrder::getState,TpOrder::getDtTime,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree,TpOrder::getByFour,TpOrder::getSatisfiedTime,TpOrder::getCoupon,TpOrder::getJcsOrderId,TpOrder::getBreach);
|
|
|
|
|
}
|
|
|
|
|
wrapper.selectAs("s.nick_name",SkillOrderVo::getSname)
|
|
|
|
|
.selectAs("f.nick_name",SkillOrderVo::getFname)
|
|
|
|
|
@@ -354,8 +361,13 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|
|
|
|
.leftJoin(SysUser.class,"f",SysUser::getUserId,TpOrder::getFid)
|
|
|
|
|
.leftJoin(SysUser.class,"b",SysUser::getUserId,TpOrder::getBid)
|
|
|
|
|
.leftJoin(TpClient.class,TpClient::getId,TpOrder::getKid)
|
|
|
|
|
.isNotNull(TpOrder::getBid)
|
|
|
|
|
.orderByDesc(TpOrder::getId);
|
|
|
|
|
.isNotNull(TpOrder::getBid);
|
|
|
|
|
|
|
|
|
|
if (bo.getByTwo() != null){
|
|
|
|
|
wrapper.orderByDesc(TpOrder::getByFour);
|
|
|
|
|
}else{
|
|
|
|
|
wrapper .orderByDesc(TpOrder::getId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//分页查询 (需要启用 mybatis plus 分页插件)
|
|
|
|
|
IPage<SkillOrderVo> listPage = baseMapper.selectJoinPage(new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize()), SkillOrderVo.class, wrapper);
|
|
|
|
|
@@ -430,8 +442,16 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|
|
|
|
}
|
|
|
|
|
lqw.eq(bo.getStyle() != null, TpOrder::getStyle, bo.getStyle());
|
|
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getByOne()), TpOrder::getByOne, bo.getByOne());
|
|
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getByTwo()), TpOrder::getByTwo, bo.getByTwo());
|
|
|
|
|
if(StringUtils.isNotBlank(bo.getByTwo())){
|
|
|
|
|
if("4".equals(bo.getByTwo())){
|
|
|
|
|
lqw.in(TpOrder::getByTwo,2,3);
|
|
|
|
|
}else{
|
|
|
|
|
lqw.eq(TpOrder::getByTwo, bo.getByTwo());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// lqw.in(StringUtils.isNotBlank(bo.getByTwo()), TpOrder::getByTwo, bo.getByTwo());
|
|
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getByThree()), TpOrder::getByThree, bo.getByThree());
|
|
|
|
|
lqw.eq(bo.getByFour() != null, TpOrder::getByFour, bo.getByFour());
|
|
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getSpace()), TpOrder::getSpace, bo.getSpace());
|
|
|
|
|
lqw.eq(bo.getQuality() != null, TpOrder::getQuality, bo.getQuality());
|
|
|
|
|
lqw.eq(bo.getType() != null, TpOrder::getType, bo.getType());
|
|
|
|
|
@@ -533,8 +553,16 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|
|
|
|
lqw.eq(bo.getStyle() != null, TpOrder::getStyle, bo.getStyle());
|
|
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getSpace()), TpOrder::getSpace, bo.getSpace());
|
|
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getByOne()), TpOrder::getByOne, bo.getByOne());
|
|
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getByTwo()), TpOrder::getByTwo, bo.getByTwo());
|
|
|
|
|
if(StringUtils.isNotBlank(bo.getByTwo())){
|
|
|
|
|
if("4".equals(bo.getByTwo())){
|
|
|
|
|
lqw.in(TpOrder::getByTwo,2,3);
|
|
|
|
|
}else{
|
|
|
|
|
lqw.eq(TpOrder::getByTwo, bo.getByTwo());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// lqw.like(StringUtils.isNotBlank(bo.getByTwo()), TpOrder::getByTwo, bo.getByTwo());
|
|
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getByThree()), TpOrder::getByThree, bo.getByThree());
|
|
|
|
|
lqw.eq(bo.getByFour() != null, TpOrder::getByFour, bo.getByFour());
|
|
|
|
|
lqw.eq(bo.getQuality() != null, TpOrder::getQuality, bo.getQuality());
|
|
|
|
|
lqw.eq(bo.getType() != null, TpOrder::getType, bo.getType());
|
|
|
|
|
lqw.eq(bo.getState() != null, TpOrder::getState, bo.getState());
|
|
|
|
|
@@ -643,6 +671,64 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|
|
|
|
return baseMapper.updateById(update) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 扣除违约金
|
|
|
|
|
*
|
|
|
|
|
* @param bo
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int breach(TpOrderBo bo) {
|
|
|
|
|
TpOrder order = baseMapper.selectById(bo.getId());
|
|
|
|
|
if(order.getPayState() == 1){
|
|
|
|
|
throw new ServiceException("该订单未支付,不可扣除违约金");
|
|
|
|
|
}
|
|
|
|
|
BigDecimal jsPayPrice = getJsPayPrice(order.getPrice(),order.getPayPrice(),order.getPrice().subtract(order.getGjPrice()).subtract(order.getCdPrice()));
|
|
|
|
|
// order.setJsPayPrice(getJsPay(jsPayPrice.subtract(bo.getBreach())));
|
|
|
|
|
boolean res = saveOrderRecord(order.getId(),"扣除违约金","订单:"+order.getOrderId()+" 修改成功",1,bo.getRecord());
|
|
|
|
|
if(!res){
|
|
|
|
|
throw new ServiceException("订单修改失败");
|
|
|
|
|
}
|
|
|
|
|
// TpOrder update = new TpOrder();
|
|
|
|
|
// update.setId(order.getId());
|
|
|
|
|
// update.setBreach(getJsPay(jsPayPrice.subtract(bo.getBreach())));
|
|
|
|
|
|
|
|
|
|
LambdaUpdateWrapper<TpOrder> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
|
|
updateWrapper.eq(TpOrder::getId, order.getId())
|
|
|
|
|
.set(TpOrder::getBreach, bo.getBreach())
|
|
|
|
|
.set(TpOrder::getJsPayPrice, getJsPay(jsPayPrice.subtract(bo.getBreach())));
|
|
|
|
|
return baseMapper.update(null, updateWrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 满意度接口
|
|
|
|
|
*
|
|
|
|
|
* @param bo
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int satisfied(TpOrderBo bo) {
|
|
|
|
|
TpOrder order = baseMapper.selectById(bo.getId());
|
|
|
|
|
if(order.getPayState() == 1){
|
|
|
|
|
throw new ServiceException("该订单未支付,不可修改满意度");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询满意度ID最大ID
|
|
|
|
|
TpOrder maxOrder = baseMapper.selectOne(new LambdaQueryWrapper<TpOrder>().select(TpOrder::getByFour).orderByDesc(TpOrder::getByFour).last("limit 1"));
|
|
|
|
|
|
|
|
|
|
if(maxOrder != null && maxOrder.getByFour() != 0){
|
|
|
|
|
bo.setByFour(maxOrder.getByFour() + 1);
|
|
|
|
|
} else {
|
|
|
|
|
bo.setByFour(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LambdaUpdateWrapper<TpOrder> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
|
|
updateWrapper.eq(TpOrder::getId, order.getId())
|
|
|
|
|
.set(TpOrder::getByTwo, bo.getByTwo())
|
|
|
|
|
.set(TpOrder::getByThree, bo.getByThree())
|
|
|
|
|
.set(TpOrder::getByFour, bo.getByFour())
|
|
|
|
|
.set(TpOrder::getSatisfiedTime, new Date());
|
|
|
|
|
return baseMapper.update(null, updateWrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验并批量删除订单管理信息
|
|
|
|
|
*
|
|
|
|
|
@@ -708,6 +794,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|
|
|
|
public int orderCancelAssign(Long orderId) {
|
|
|
|
|
TpOrder order = baseMapper.selectById(orderId);
|
|
|
|
|
order.setBid(null);
|
|
|
|
|
order.setBreach(null);
|
|
|
|
|
boolean res = saveOrderRecord(order.getId(),"取消指派","订单:"+order.getOrderId()+" 取消指派",1,null);
|
|
|
|
|
if(!res){
|
|
|
|
|
throw new ServiceException("订单取消指派失败");
|
|
|
|
|
@@ -819,7 +906,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|
|
|
|
order.setGpay(getGjPayPrice(order.getPrice(),newPayPrice.add(order.getCoupon()),order.getGjPrice()));
|
|
|
|
|
}
|
|
|
|
|
BigDecimal jsPayPrice = getJsPayPrice(order.getPrice(),newPayPrice,order.getPrice().subtract(order.getGjPrice()).subtract(order.getCdPrice()));
|
|
|
|
|
order.setJsPayPrice(getJsPay(jsPayPrice));
|
|
|
|
|
order.setJsPayPrice(getJsPay(jsPayPrice.subtract(order.getBreach())));
|
|
|
|
|
order.setState(2);
|
|
|
|
|
order.setPayPrice(newPayPrice);
|
|
|
|
|
BigDecimal endPrice = order.getPrice().subtract(newPayPrice.add(order.getCoupon()));
|
|
|
|
|
@@ -1001,7 +1088,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|
|
|
|
order.setJsPrice(order.getPrice().subtract(order.getCdPrice()).subtract(price));
|
|
|
|
|
order.setGpay(getGjPayPrice(order.getPrice(),order.getPayPrice().add(order.getCoupon()),price));
|
|
|
|
|
BigDecimal jsPayPrice = getJsPayPrice(order.getPrice(),order.getPayPrice(),order.getPrice().subtract(order.getCdPrice()).subtract(price));
|
|
|
|
|
order.setJsPayPrice(getJsPay(jsPayPrice));
|
|
|
|
|
order.setJsPayPrice(getJsPay(jsPayPrice.subtract(order.getBreach())));
|
|
|
|
|
}else{
|
|
|
|
|
order.setGjPrice(price);
|
|
|
|
|
order.setJsPrice(order.getPrice().subtract(order.getCdPrice()).subtract(price));
|
|
|
|
|
|