完成订单业绩、积分统计
This commit is contained in:
parent
d1d3a0606f
commit
775cfa0552
|
@ -516,7 +516,7 @@ public class AppArtificerController {
|
||||||
@Login
|
@Login
|
||||||
@PostMapping("/updateArtificerTripWay")
|
@PostMapping("/updateArtificerTripWay")
|
||||||
@ApiOperation("修改技师出行方式")
|
@ApiOperation("修改技师出行方式")
|
||||||
public Result updateArtificerTripWay(@RequestAttribute Long userId,Integer tripWay,Integer tripWayNum){
|
public Result updateArtificerTripWay(@RequestAttribute Long userId,Integer tripWay,BigDecimal tripWayNum){
|
||||||
Artificer artificer = artificerService.selectArtificerByUserId(userId);
|
Artificer artificer = artificerService.selectArtificerByUserId(userId);
|
||||||
artificer.setTripWay(tripWay);
|
artificer.setTripWay(tripWay);
|
||||||
artificer.setTripWayNum(tripWayNum);
|
artificer.setTripWayNum(tripWayNum);
|
||||||
|
|
|
@ -109,8 +109,7 @@ public class Artificer implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 免费公里数
|
* 免费公里数
|
||||||
*/
|
*/
|
||||||
private Integer tripWayNum;
|
private BigDecimal tripWayNum;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 信用分
|
* 信用分
|
||||||
|
|
|
@ -111,7 +111,6 @@ public class Orders implements Serializable {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private BigDecimal priceTotal;
|
private BigDecimal priceTotal;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务费用
|
* 服务费用
|
||||||
*/
|
*/
|
||||||
|
@ -571,6 +570,9 @@ public class Orders implements Serializable {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Long classifyId;
|
private Long classifyId;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Long addClassifyId;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String artificerPhone;
|
private String artificerPhone;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,9 @@ import com.sqx.modules.artificer.dao.OrdersDao;
|
||||||
import com.sqx.modules.artificer.entity.*;
|
import com.sqx.modules.artificer.entity.*;
|
||||||
import com.sqx.modules.artificer.service.*;
|
import com.sqx.modules.artificer.service.*;
|
||||||
import com.sqx.modules.bl.artificer.dao.ArtificerIntegralStatisticsDao;
|
import com.sqx.modules.bl.artificer.dao.ArtificerIntegralStatisticsDao;
|
||||||
|
import com.sqx.modules.bl.artificer.entity.AchievementIntegral;
|
||||||
import com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics;
|
import com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics;
|
||||||
|
import com.sqx.modules.bl.artificer.service.AchievementIntegralService;
|
||||||
import com.sqx.modules.bl.commission.fxy.entity.FxyApply;
|
import com.sqx.modules.bl.commission.fxy.entity.FxyApply;
|
||||||
import com.sqx.modules.bl.commission.fxy.entity.FxyConfig;
|
import com.sqx.modules.bl.commission.fxy.entity.FxyConfig;
|
||||||
import com.sqx.modules.bl.commission.fxy.service.FxyApplyService;
|
import com.sqx.modules.bl.commission.fxy.service.FxyApplyService;
|
||||||
|
@ -180,6 +182,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||||
private JjrConfigLevelService jjrConfigServiceLevel;
|
private JjrConfigLevelService jjrConfigServiceLevel;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ArtificerIntegralStatisticsDao artificerIntegralStatisticsDao;
|
private ArtificerIntegralStatisticsDao artificerIntegralStatisticsDao;
|
||||||
|
@Autowired
|
||||||
|
AchievementIntegralService achievementIntegralService;
|
||||||
|
|
||||||
|
|
||||||
private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true);
|
private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true);
|
||||||
|
@ -6822,6 +6826,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||||
oldOrders.setArtificerRate(orders.getArtificerRate());
|
oldOrders.setArtificerRate(orders.getArtificerRate());
|
||||||
accomplishOldOrders(oldOrders,type,jsFwcn,jsPjtag,jsTsbz);
|
accomplishOldOrders(oldOrders,type,jsFwcn,jsPjtag,jsTsbz);
|
||||||
}
|
}
|
||||||
|
//计算业绩、积分
|
||||||
|
statisticsAchievementIntegral(ordersId);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -7089,11 +7095,43 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||||
//统计业绩积分
|
//统计业绩积分
|
||||||
public void statisticsAchievementIntegral(Long ordersId){
|
public void statisticsAchievementIntegral(Long ordersId){
|
||||||
Orders orders = baseMapper.getOrdersMoneyById(ordersId);
|
Orders orders = baseMapper.getOrdersMoneyById(ordersId);
|
||||||
|
BigDecimal xmbsD = BigDecimal.ZERO;
|
||||||
String xmbs = commonInfoService.findOne(463).getValue();
|
String xmbs = commonInfoService.findOne(463).getValue();
|
||||||
|
if(xmbs!=null && !xmbs.equals("")){
|
||||||
|
xmbsD = new BigDecimal(xmbs);
|
||||||
|
}
|
||||||
|
BigDecimal jzbsD = BigDecimal.ZERO;
|
||||||
String jzbs = commonInfoService.findOne(464).getValue();
|
String jzbs = commonInfoService.findOne(464).getValue();
|
||||||
|
if(jzbs!=null && !jzbs.equals("")){
|
||||||
|
jzbsD = new BigDecimal(jzbs);
|
||||||
|
}
|
||||||
|
BigDecimal priceTotal = orders.getPrice();//项目业绩
|
||||||
|
if(priceTotal == null){
|
||||||
|
priceTotal = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
BigDecimal addPriceTotal = orders.getAddPrice();//加钟业绩
|
||||||
|
if(addPriceTotal == null){
|
||||||
|
addPriceTotal = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
Long classifyId = orders.getClassifyId();//项目类型
|
||||||
|
BigDecimal xmjf = BigDecimal.ZERO;
|
||||||
|
if(classifyId != null){
|
||||||
|
AchievementIntegral achievementIntegral = achievementIntegralService.getOne(new QueryWrapper<AchievementIntegral>().eq("classify_id",classifyId));
|
||||||
|
BigDecimal achievement = achievementIntegral.getAchievement();
|
||||||
|
BigDecimal integral = achievementIntegral.getIntegral();
|
||||||
|
xmjf = priceTotal.multiply(xmbsD).divide(achievement).multiply(integral).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
}
|
||||||
|
Long addClassifyId = orders.getAddClassifyId();//加钟项目类型
|
||||||
|
BigDecimal jzjf = BigDecimal.ZERO;
|
||||||
|
if(addClassifyId != null){
|
||||||
|
AchievementIntegral achievementIntegral = achievementIntegralService.getOne(new QueryWrapper<AchievementIntegral>().eq("classify_id",addClassifyId));
|
||||||
|
BigDecimal achievement = achievementIntegral.getAchievement();
|
||||||
|
BigDecimal integral = achievementIntegral.getIntegral();
|
||||||
|
jzjf = addPriceTotal.multiply(jzbsD).divide(achievement).multiply(integral).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
}
|
||||||
|
|
||||||
QueryWrapper<ArtificerIntegralStatistics> delWrapper = new QueryWrapper<ArtificerIntegralStatistics>();
|
QueryWrapper<ArtificerIntegralStatistics> delWrapper = new QueryWrapper<ArtificerIntegralStatistics>();
|
||||||
delWrapper.le("orders_no",orders.getOrdersNo());
|
delWrapper.eq("orders_no",orders.getOrdersNo());
|
||||||
artificerIntegralStatisticsDao.delete(delWrapper);
|
artificerIntegralStatisticsDao.delete(delWrapper);
|
||||||
|
|
||||||
Artificer artificer = artificerDao.selectById(orders.getArtificerId());
|
Artificer artificer = artificerDao.selectById(orders.getArtificerId());
|
||||||
|
@ -7102,9 +7140,9 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||||
artificerIntegralStatistics.setArtificerName(artificer.getArtificerName());
|
artificerIntegralStatistics.setArtificerName(artificer.getArtificerName());
|
||||||
artificerIntegralStatistics.setClassify(3);
|
artificerIntegralStatistics.setClassify(3);
|
||||||
artificerIntegralStatistics.setType(1);
|
artificerIntegralStatistics.setType(1);
|
||||||
// artificerIntegralStatistics.setAchievement();//业绩
|
artificerIntegralStatistics.setAchievement(priceTotal.add(addPriceTotal));//业绩
|
||||||
// artificerIntegralStatistics.setIncome();//收益
|
artificerIntegralStatistics.setIncome(orders.getArtificerMoneyTotal());//收益
|
||||||
// artificerIntegralStatistics.setIntegral();//积分
|
artificerIntegralStatistics.setIntegral(xmjf.add(jzjf));//积分
|
||||||
artificerIntegralStatistics.setOrdersNo(orders.getOrdersNo());
|
artificerIntegralStatistics.setOrdersNo(orders.getOrdersNo());
|
||||||
artificerIntegralStatistics.setCreateTime(orders.getEndTimes());
|
artificerIntegralStatistics.setCreateTime(orders.getEndTimes());
|
||||||
artificerIntegralStatisticsDao.insert(artificerIntegralStatistics);
|
artificerIntegralStatisticsDao.insert(artificerIntegralStatistics);
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class AppDictController {
|
||||||
@ApiOperation("项目分类列表")
|
@ApiOperation("项目分类列表")
|
||||||
public Result list(String type,String remark){
|
public Result list(String type,String remark){
|
||||||
SysDictEntity sysDictEntity = sysDictService.getOne(new QueryWrapper<SysDictEntity>().eq("type", type));
|
SysDictEntity sysDictEntity = sysDictService.getOne(new QueryWrapper<SysDictEntity>().eq("type", type));
|
||||||
List<SysDictEntity> sysDictEntityList = sysDictService.list(new QueryWrapper<SysDictEntity>().eq("status",1).eq( "parent_id", sysDictEntity.getId()).eq(remark!=null&&!remark.equals(""),"remark", remark).orderByDesc("order_num"));
|
List<SysDictEntity> sysDictEntityList = sysDictService.list(new QueryWrapper<SysDictEntity>().eq("status",1).eq( "parent_id", sysDictEntity.getId()).eq(remark!=null&&!remark.equals(""),"remark", remark).orderByAsc("order_num"));
|
||||||
return Result.success().put("data", sysDictEntityList);
|
return Result.success().put("data", sysDictEntityList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,28 +207,29 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
||||||
Artificer artificerInfo = artificerService.getById(artificerId);
|
Artificer artificerInfo = artificerService.getById(artificerId);
|
||||||
|
|
||||||
Integer cxfs = artificerInfo.getTripWay();//1公交 2出租 3免费
|
Integer cxfs = artificerInfo.getTripWay();//1公交 2出租 3免费
|
||||||
Integer mfgls = artificerInfo.getTripWayNum();//免费公里数
|
BigDecimal mfgls = artificerInfo.getTripWayNum();//免费公里数
|
||||||
if(cxfs==null){
|
if(cxfs==null){
|
||||||
cxfs = 3;
|
cxfs = 3;
|
||||||
}
|
}
|
||||||
if(mfgls==null){
|
if(mfgls==null){
|
||||||
mfgls = 0;
|
mfgls = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
Integer travelType = cxfs;//先默认免费
|
Integer travelType = cxfs;//先默认免费
|
||||||
|
|
||||||
BigDecimal freeKilometers = new BigDecimal(mfgls);//
|
BigDecimal freeKilometers = mfgls;
|
||||||
String longitude = artificerInfo.getLongitude();
|
String longitude = artificerInfo.getLongitude();
|
||||||
String latitude = artificerInfo.getLatitude();
|
String latitude = artificerInfo.getLatitude();
|
||||||
return calcTravelPrice(travelType, freeKilometers, longitude, latitude, toLongitude, toLatitude,serveTime);
|
return calcTravelPrice(travelType, freeKilometers, longitude, latitude, toLongitude, toLatitude,serveTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TravelPriceVo calcTravelPrice(Long artificerId, String toLongitude, String toLatitude, String serveTime, Integer tripWay){
|
public TravelPriceVo calcTravelPrice(Long artificerId, String toLongitude, String toLatitude, String serveTime, Integer tripWay){
|
||||||
Artificer artificerInfo = artificerService.getById(artificerId);
|
Artificer artificerInfo = artificerService.getById(artificerId);
|
||||||
Integer mfgls = artificerInfo.getTripWayNum();//免费公里数
|
BigDecimal mfgls = artificerInfo.getTripWayNum();//免费公里数
|
||||||
if(mfgls == null){
|
if(mfgls == null){
|
||||||
mfgls = 0;
|
mfgls = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
BigDecimal freeKilometers = new BigDecimal(mfgls);
|
BigDecimal freeKilometers = mfgls;
|
||||||
String longitude = artificerInfo.getLongitude();
|
String longitude = artificerInfo.getLongitude();
|
||||||
String latitude = artificerInfo.getLatitude();
|
String latitude = artificerInfo.getLatitude();
|
||||||
return calcTravelPrice(tripWay, freeKilometers, longitude, latitude, toLongitude, toLatitude,serveTime);
|
return calcTravelPrice(tripWay, freeKilometers, longitude, latitude, toLongitude, toLatitude,serveTime);
|
||||||
|
|
|
@ -2037,9 +2037,45 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getOrdersMoneyById" resultType="com.sqx.modules.artificer.entity.Orders">
|
<select id="getOrdersMoneyById" resultType="com.sqx.modules.artificer.entity.Orders">
|
||||||
select o.*
|
select
|
||||||
|
(case when o.status = 4
|
||||||
|
then o.artificer_money + ifnull(o.add_artificer_money,0)
|
||||||
|
else o.artificer_money + ifnull(o.add_artificer_money,0) + ifnull(o2.artificer_money,0) +
|
||||||
|
ifnull(o2.add_artificer_money,0) + ifnull(o3.artificer_money,0) + ifnull(o3.add_artificer_money,0)
|
||||||
|
end) as artificer_money_total,
|
||||||
|
(
|
||||||
|
o.price,m.classify_id,
|
||||||
|
ifnull(o.add_price,0) as add_price,bl.classify_id as add_classify_id
|
||||||
from orders o
|
from orders o
|
||||||
where old_orders_id = #{ordersId}
|
left join orders o2 on o.old_orders_id = o2.orders_id and o2.status != 4
|
||||||
|
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
|
||||||
|
left join massage_type m on m.massage_type_id = o.massage_type_id
|
||||||
|
LEFT JOIN massage_type bl ON bl.massage_type_id = o.add_massage_type_id
|
||||||
|
where o.orders_id = #{ordersId}
|
||||||
|
and o.old_orders_id is not null
|
||||||
|
and o.status in (3,5)
|
||||||
|
union all
|
||||||
|
select
|
||||||
|
o.artificer_money + ifnull(o.add_artificer_money,0) as artificer_money_total,
|
||||||
|
o.price,m.classify_id,
|
||||||
|
ifnull(o.add_price,0) as add_price,bl.classify_id as add_classify_id
|
||||||
|
from orders o
|
||||||
|
left join massage_type m on m.massage_type_id = o.massage_type_id
|
||||||
|
LEFT JOIN massage_type bl ON bl.massage_type_id = o.add_massage_type_id
|
||||||
|
where o.orders_id = #{ordersId}
|
||||||
|
and o.parent_id = 0
|
||||||
|
and o.old_orders_id is null
|
||||||
|
and o.orders_id not in (
|
||||||
|
select orders_id from orders
|
||||||
|
where old_orders_id is not null
|
||||||
|
and status != 4
|
||||||
|
)
|
||||||
|
and o.orders_id not in (
|
||||||
|
select old_orders_id from orders
|
||||||
|
where old_orders_id is not null
|
||||||
|
and status != 4
|
||||||
|
)
|
||||||
|
and o.status in (3,5)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue