增加 机构的折扣,去掉用户第一次充电活动
This commit is contained in:
parent
0ef600d5f8
commit
b0cfc2104c
@ -365,6 +365,12 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
|
|||||||
if (bindCardInfo.getCardType() != 1) {
|
if (bindCardInfo.getCardType() != 1) {
|
||||||
R.fail("该卡不是联网卡");
|
R.fail("该卡不是联网卡");
|
||||||
}
|
}
|
||||||
|
if (bindCardInfo.getUserType() !=null || "".equals(bindCardInfo.getUserType())) {
|
||||||
|
R.fail("请选择绑定的用户类型");
|
||||||
|
}
|
||||||
|
if (bindCardInfo.getUserAccount() !=null || "".equals(bindCardInfo.getUserAccount())) {
|
||||||
|
R.fail("请选择绑定的用户");
|
||||||
|
}
|
||||||
//build an association
|
//build an association
|
||||||
XhpcIcCardInfo xhpcIcCardInfo = new XhpcIcCardInfo();
|
XhpcIcCardInfo xhpcIcCardInfo = new XhpcIcCardInfo();
|
||||||
SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
||||||
|
|||||||
@ -42,4 +42,12 @@ public interface UserTypeService {
|
|||||||
@GetMapping("/common/insertUserBalance")
|
@GetMapping("/common/insertUserBalance")
|
||||||
R insertUserBalance(@RequestParam(value = "money")BigDecimal money, @RequestParam(value = "userId")Long userId, @RequestParam(value = "userType")Integer userType, @RequestParam(value = "tenantId")String tenantId, @RequestParam(value = "type")Integer type, @RequestParam(value = "status")Integer status, @RequestParam(value = "remark")String remark,@RequestParam(value = "moneyOrderId")Long moneyOrderId);
|
R insertUserBalance(@RequestParam(value = "money")BigDecimal money, @RequestParam(value = "userId")Long userId, @RequestParam(value = "userType")Integer userType, @RequestParam(value = "tenantId")String tenantId, @RequestParam(value = "type")Integer type, @RequestParam(value = "status")Integer status, @RequestParam(value = "remark")String remark,@RequestParam(value = "moneyOrderId")Long moneyOrderId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取该机构的折扣比例
|
||||||
|
*/
|
||||||
|
@GetMapping("/common/getMechanismDiscount")
|
||||||
|
R getMechanismDiscount(@RequestParam(value = "userId")Long userId, @RequestParam(value = "userType")Integer userType, @RequestParam(value = "tenantId")String tenantId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,11 @@ public class UserTypeFallbackFactory implements FallbackFactory<UserTypeService>
|
|||||||
public R insertUserBalance(BigDecimal money,Long userId, Integer userType, String tenantId, Integer type,Integer status,String remark,Long moneyOrderId) {
|
public R insertUserBalance(BigDecimal money,Long userId, Integer userType, String tenantId, Integer type,Integer status,String remark,Long moneyOrderId) {
|
||||||
return R.fail("添加用户金额信息失败:" + cause.getMessage());
|
return R.fail("添加用户金额信息失败:" + cause.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R getMechanismDiscount(Long userId, Integer userType, String tenantId) {
|
||||||
|
return R.fail("机构信息获取失败:" + cause.getMessage());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -363,7 +363,7 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
|||||||
try {
|
try {
|
||||||
Map<String, Object> byId = xhpcHistoryOrderMapper.getById(historyOrderId);
|
Map<String, Object> byId = xhpcHistoryOrderMapper.getById(historyOrderId);
|
||||||
if (byId != null) {
|
if (byId != null) {
|
||||||
byId.putAll(getRateTime(byId.get("serialNumber").toString(), byId.get("actPrice").toString()));
|
byId.putAll(getRateTime(byId.get("serialNumber").toString(), byId.get("totalPrice").toString()));
|
||||||
}
|
}
|
||||||
return AjaxResult.success(byId);
|
return AjaxResult.success(byId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -775,7 +775,7 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
|||||||
/**
|
/**
|
||||||
* 历史信息费率时段
|
* 历史信息费率时段
|
||||||
*/
|
*/
|
||||||
private Map<String, Object> getRateTime(String serialNumber, String actPrice) {
|
private Map<String, Object> getRateTime(String serialNumber, String totalPrice) {
|
||||||
|
|
||||||
BigDecimal powerPriceTotal = new BigDecimal(0);
|
BigDecimal powerPriceTotal = new BigDecimal(0);
|
||||||
BigDecimal servicePriceTotal = new BigDecimal(0);
|
BigDecimal servicePriceTotal = new BigDecimal(0);
|
||||||
@ -790,32 +790,32 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
|||||||
//1时间没有跨天
|
//1时间没有跨天
|
||||||
long betweenDay = DateUtil.between(startTime2, updateTime2, DateUnit.DAY);
|
long betweenDay = DateUtil.between(startTime2, updateTime2, DateUnit.DAY);
|
||||||
if (betweenDay == 0) {
|
if (betweenDay == 0) {
|
||||||
return getBigDecimal(actPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime2, updateTime2, chargingDegree, list);
|
return getBigDecimal(totalPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime2, updateTime2, chargingDegree, list);
|
||||||
} else {
|
} else {
|
||||||
//跨天
|
//跨天
|
||||||
Date updateTime = DateUtil.endOfDay(startTime2);
|
Date updateTime = DateUtil.endOfDay(startTime2);
|
||||||
Map<String, Object> map1 = getBigDecimal(actPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime2, updateTime, chargingDegree, list);
|
Map<String, Object> map1 = getBigDecimal(totalPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime2, updateTime, chargingDegree, list);
|
||||||
//获取
|
//获取
|
||||||
BigDecimal powerPriceTotal1 = new BigDecimal(map1.get("powerPriceTotal").toString());
|
BigDecimal powerPriceTotal1 = new BigDecimal(map1.get("powerPriceTotal").toString());
|
||||||
BigDecimal servicePriceTotal1 = new BigDecimal(map1.get("servicePriceTotal").toString());
|
BigDecimal servicePriceTotal1 = new BigDecimal(map1.get("servicePriceTotal").toString());
|
||||||
//明天
|
//明天
|
||||||
DateTime tomorrow = DateUtil.offsetDay(startTime2, 1);
|
DateTime tomorrow = DateUtil.offsetDay(startTime2, 1);
|
||||||
Date startTime3 = DateUtil.beginOfDay(tomorrow);
|
Date startTime3 = DateUtil.beginOfDay(tomorrow);
|
||||||
Map<String, Object> map2 = getBigDecimal(actPrice, powerPriceTotal1, servicePriceTotal1, chargeOrder, rateModelId, startTime3, updateTime2, chargingDegree, list);
|
Map<String, Object> map2 = getBigDecimal(totalPrice, powerPriceTotal1, servicePriceTotal1, chargeOrder, rateModelId, startTime3, updateTime2, chargingDegree, list);
|
||||||
return map2;
|
return map2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getBigDecimal(String actPrice, BigDecimal powerPriceTotal, BigDecimal servicePriceTotal, XhpcChargeOrder chargeOrder, Long rateModelId, Date startTime2, Date updateTime2, BigDecimal chargingDegree, List<Map<String, Object>> list) {
|
private Map<String, Object> getBigDecimal(String totalPrice, BigDecimal powerPriceTotal, BigDecimal servicePriceTotal, XhpcChargeOrder chargeOrder, Long rateModelId, Date startTime2, Date updateTime2, BigDecimal chargingDegree, List<Map<String, Object>> list) {
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
if(chargingDegree.compareTo(new BigDecimal(0))==0){
|
if(chargingDegree.compareTo(new BigDecimal(0))==0){
|
||||||
Map<String, Object> map1 = new HashMap<>();
|
Map<String, Object> map1 = new HashMap<>();
|
||||||
map1.put("time", 0);
|
map1.put("time", 0);
|
||||||
map1.put("powerPrice", actPrice);
|
map1.put("powerPrice", totalPrice);
|
||||||
map1.put("servicePrice", 0);
|
map1.put("servicePrice", 0);
|
||||||
map1.put("chargingDegree", chargeOrder.getChargingDegree());
|
map1.put("chargingDegree", chargeOrder.getChargingDegree());
|
||||||
map1.put("actPrice", actPrice);
|
map1.put("actPrice", totalPrice);
|
||||||
list.add(map1);
|
list.add(map1);
|
||||||
map.put("list", list);//数据列表
|
map.put("list", list);//数据列表
|
||||||
return map;
|
return map;
|
||||||
@ -827,10 +827,10 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
|||||||
if(decimal.compareTo(new BigDecimal(0))==0){
|
if(decimal.compareTo(new BigDecimal(0))==0){
|
||||||
Map<String, Object> map1 = new HashMap<>();
|
Map<String, Object> map1 = new HashMap<>();
|
||||||
map1.put("time", 0);
|
map1.put("time", 0);
|
||||||
map1.put("powerPrice", actPrice);
|
map1.put("powerPrice", totalPrice);
|
||||||
map1.put("servicePrice", 0);
|
map1.put("servicePrice", 0);
|
||||||
map1.put("chargingDegree", chargeOrder.getChargingDegree());
|
map1.put("chargingDegree", chargeOrder.getChargingDegree());
|
||||||
map1.put("actPrice", actPrice);
|
map1.put("actPrice", totalPrice);
|
||||||
list.add(map1);
|
list.add(map1);
|
||||||
map.put("list", list);//数据列表
|
map.put("list", list);//数据列表
|
||||||
return map;
|
return map;
|
||||||
@ -853,7 +853,7 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
|||||||
map1.put("powerPrice", powerFee);
|
map1.put("powerPrice", powerFee);
|
||||||
map1.put("servicePrice", servicePrice);
|
map1.put("servicePrice", servicePrice);
|
||||||
map1.put("chargingDegree", chargeOrder.getChargingDegree());
|
map1.put("chargingDegree", chargeOrder.getChargingDegree());
|
||||||
map1.put("actPrice", actPrice);
|
map1.put("actPrice", totalPrice);
|
||||||
list.add(map1);
|
list.add(map1);
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < reatTimeList.size(); i++) {
|
for (int i = 0; i < reatTimeList.size(); i++) {
|
||||||
|
|||||||
@ -443,39 +443,92 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
if ( !UserTypeUtil.INTERNET_TYPE.equals(source)) {
|
if ( !UserTypeUtil.INTERNET_TYPE.equals(source)) {
|
||||||
//用户第几次充电
|
//用户第几次充电
|
||||||
int count = xhpcChargeOrderService.getCount(userId,null,source,xhpcChargeOrder.getTenantId());
|
// int count = xhpcChargeOrderService.getCount(userId,null,source,xhpcChargeOrder.getTenantId());
|
||||||
if (count == 0) {
|
// if (count == 0) {
|
||||||
//活动折扣
|
// //活动折扣
|
||||||
Map<String, Object> promotion = xhpcChargeOrderService.getPromotion();
|
// Map<String, Object> promotion = xhpcChargeOrderService.getPromotion();
|
||||||
if (promotion != null && promotion.get("state") != null && promotion.get("discount") != null) {
|
// if (promotion != null && promotion.get("state") != null && promotion.get("discount") != null) {
|
||||||
//state 1.总金额 2.电费 3.服务费 discount 折扣率
|
// //state 1.总金额 2.电费 3.服务费 discount 折扣率
|
||||||
String state = promotion.get("state").toString();
|
// String state = promotion.get("state").toString();
|
||||||
BigDecimal discount =new BigDecimal(promotion.get("discount").toString()).divide(new BigDecimal(100));
|
// BigDecimal discount =new BigDecimal(promotion.get("discount").toString()).divide(new BigDecimal(100));
|
||||||
|
//
|
||||||
|
// if(discount.compareTo(new BigDecimal(0))==1){
|
||||||
|
// if("1".equals(state) || "2".equals(state) || "3".equals(state)){
|
||||||
|
// //折扣的钱
|
||||||
|
// promotionDiscount=money.multiply(discount).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
// //剩余的总金额
|
||||||
|
// actPrice = money.subtract(promotionDiscount);
|
||||||
|
//
|
||||||
|
// BigDecimal decimal1 = surplusPowerPrice.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
// BigDecimal decimal2 = surplusServicePrice.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
// if("1".equals(state)){
|
||||||
|
// //总金额
|
||||||
|
// actPrice =actPrice.subtract(decimal1.add(decimal2));
|
||||||
|
// //折扣的钱
|
||||||
|
// promotionDiscount = decimal1.add(decimal2);
|
||||||
|
// surplusPowerPrice = surplusPowerPrice.subtract(decimal1);
|
||||||
|
// surplusServicePrice= surplusServicePrice.subtract(decimal2);
|
||||||
|
// }else if("2".equals(state)){
|
||||||
|
// //电费
|
||||||
|
// surplusPowerPrice=surplusPowerPrice.subtract(decimal1);
|
||||||
|
// }else{
|
||||||
|
// //服务费
|
||||||
|
// surplusServicePrice =surplusServicePrice.subtract(decimal2);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if(UserTypeUtil.COMMUNIT_TYPE.equals(source) || UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
|
||||||
|
//折扣(机构用户),没有活动时计算
|
||||||
|
R mechanismDiscount = userTypeService.getMechanismDiscount(userId, source, xhpcChargeOrder.getTenantId());
|
||||||
|
if(mechanismDiscount !=null && mechanismDiscount.getData() !=null) {
|
||||||
|
Map<String, Object> userDiscount = (Map<String, Object>) mechanismDiscount.getData();
|
||||||
|
if (userDiscount != null && userDiscount.get("commissionType") != null && userDiscount.get("servicePreferential") != null) {
|
||||||
|
String commissionType = userDiscount.get("commissionType").toString();
|
||||||
|
BigDecimal servicePreferential =new BigDecimal(userDiscount.get("servicePreferential").toString()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
|
||||||
if(discount.compareTo(new BigDecimal(0))==1){
|
if(servicePreferential.compareTo(new BigDecimal(0))==1){
|
||||||
if("1".equals(state) || "2".equals(state) || "3".equals(state)){
|
if("0".equals(commissionType) || "1".equals(commissionType) || "2".equals(commissionType)){
|
||||||
//折扣的钱
|
BigDecimal decimal1 = surplusPowerPrice.multiply(servicePreferential).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
promotionDiscount=money.multiply(discount).setScale(2,BigDecimal.ROUND_HALF_UP);
|
BigDecimal decimal2 = surplusServicePrice.multiply(servicePreferential).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
//剩余的总金额
|
if("0".equals(commissionType)){
|
||||||
actPrice = money.subtract(promotionDiscount);
|
//总金额
|
||||||
|
actPrice =actPrice.subtract(decimal1.add(decimal2));
|
||||||
BigDecimal decimal1 = surplusPowerPrice.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP);
|
//折扣的钱
|
||||||
BigDecimal decimal2 = surplusServicePrice.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP);
|
promotionDiscount = decimal1.add(decimal2);
|
||||||
if("1".equals(state)){
|
surplusPowerPrice = surplusPowerPrice.subtract(decimal1);
|
||||||
//总金额
|
surplusServicePrice= surplusServicePrice.subtract(decimal2);
|
||||||
actPrice =actPrice.subtract(decimal1.add(decimal2));
|
}else if("1".equals(commissionType)){
|
||||||
//折扣的钱
|
//服务费
|
||||||
promotionDiscount = decimal1.add(decimal2);
|
if(surplusServicePrice.compareTo(decimal2) > -1){
|
||||||
surplusPowerPrice = surplusPowerPrice.subtract(decimal1);
|
surplusServicePrice =surplusServicePrice.subtract(decimal2);
|
||||||
surplusServicePrice= surplusServicePrice.subtract(decimal2);
|
actPrice =actPrice.subtract(decimal2);
|
||||||
}else if("2".equals(state)){
|
}else{
|
||||||
//电费
|
promotionDiscount = surplusServicePrice;
|
||||||
surplusPowerPrice=surplusPowerPrice.subtract(decimal1);
|
actPrice =actPrice.subtract(surplusServicePrice);
|
||||||
}else{
|
surplusServicePrice =new BigDecimal(0);
|
||||||
//服务费
|
}
|
||||||
surplusServicePrice =surplusServicePrice.subtract(decimal2);
|
}else{
|
||||||
|
//电量抽成
|
||||||
|
BigDecimal chargingDegree = xhpcChargeOrder.getChargingDegree();
|
||||||
|
//电量的钱
|
||||||
|
promotionDiscount = chargingDegree.multiply(new BigDecimal(userDiscount.get("servicePreferential").toString())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
logger.info("=============电量优惠==="+promotionDiscount);
|
||||||
|
logger.info("=============服务费==="+surplusServicePrice);
|
||||||
|
//当电量的折扣大于服务费时,电量==服务费
|
||||||
|
if(surplusServicePrice.compareTo(promotionDiscount)>-1){
|
||||||
|
surplusServicePrice= surplusServicePrice.subtract(promotionDiscount);
|
||||||
|
actPrice =actPrice.subtract(promotionDiscount);
|
||||||
|
}else{
|
||||||
|
promotionDiscount = surplusServicePrice;
|
||||||
|
actPrice =actPrice.subtract(surplusServicePrice);
|
||||||
|
surplusServicePrice =new BigDecimal(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -574,6 +574,9 @@
|
|||||||
ho.act_power_price as actPowerPrice,
|
ho.act_power_price as actPowerPrice,
|
||||||
co.charging_time as chargingTime,
|
co.charging_time as chargingTime,
|
||||||
co.charging_degree as chargingDegree,
|
co.charging_degree as chargingDegree,
|
||||||
|
ho.total_price as totalPrice,
|
||||||
|
ho.power_price_total as powerPriceTotal,
|
||||||
|
ho.promotion_discount as promotionDiscount,
|
||||||
DATE_FORMAT(ho.start_time,'%m月%d日') as daysOne,
|
DATE_FORMAT(ho.start_time,'%m月%d日') as daysOne,
|
||||||
DATE_FORMAT(ho.start_time,'%H:%i:%s') as timeOne,
|
DATE_FORMAT(ho.start_time,'%H:%i:%s') as timeOne,
|
||||||
DATE_FORMAT(ho.end_time,'%m月%d日') as daysTwo,
|
DATE_FORMAT(ho.end_time,'%m月%d日') as daysTwo,
|
||||||
|
|||||||
@ -68,4 +68,20 @@ public class XhpcCommonController extends BaseController {
|
|||||||
return xhpcCommonService.insertUserBalance(money,userId,userType,tenantId,type,status,remark,moneyOrderId);
|
return xhpcCommonService.insertUserBalance(money,userId,userType,tenantId,type,status,remark,moneyOrderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取该机构的折扣比例
|
||||||
|
* @param userId 充值用户
|
||||||
|
* @param userType 用户类型
|
||||||
|
* @param tenantId 租户id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/getMechanismDiscount")
|
||||||
|
public AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId) {
|
||||||
|
|
||||||
|
return xhpcCommonService.getMechanismDiscount(userId,userType,tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,4 +103,10 @@ public interface XhpcCommunityMapper {
|
|||||||
* 社区人员状态改变
|
* 社区人员状态改变
|
||||||
*/
|
*/
|
||||||
void updateCommunityPersonnelStatus(@Param("communityPersonnelId")Long communityPersonnelId,@Param("status")Integer status);
|
void updateCommunityPersonnelStatus(@Param("communityPersonnelId")Long communityPersonnelId,@Param("status")Integer status);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id获取社区组
|
||||||
|
*/
|
||||||
|
Map<String, Object> getCommunityPersonnelUserId(@Param("userId")Long userId,@Param("tenantId")String tenantId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -102,4 +102,9 @@ public interface XhpcCustomersMapper {
|
|||||||
* 社区人员状态改变
|
* 社区人员状态改变
|
||||||
*/
|
*/
|
||||||
void updateCustomersPersonnelStatus(@Param("customersPersonnelId")Long customersPersonnelId,@Param("status")Integer status);
|
void updateCustomersPersonnelStatus(@Param("customersPersonnelId")Long customersPersonnelId,@Param("status")Integer status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id获取大客户组
|
||||||
|
*/
|
||||||
|
Map<String, Object> getCustomersPersonnelUserId(@Param("userId")Long userId,@Param("tenantId")String tenantId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,4 +28,14 @@ public interface IXhpcCommonService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult insertUserBalance(BigDecimal money, Long userId, Integer userType, String tenantId, Integer type,Integer status,String remark,Long moneyOrderId);
|
AjaxResult insertUserBalance(BigDecimal money, Long userId, Integer userType, String tenantId, Integer type,Integer status,String remark,Long moneyOrderId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取该机构的折扣比例
|
||||||
|
* @param userId 充值用户
|
||||||
|
* @param userType 用户类型
|
||||||
|
* @param tenantId 租户id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -104,4 +104,8 @@ public interface IXhpcCommunityService {
|
|||||||
*/
|
*/
|
||||||
AjaxResult addRecharge(XhpcCommunityPersonnel xhpcCommunityPersonnel);
|
AjaxResult addRecharge(XhpcCommunityPersonnel xhpcCommunityPersonnel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id获取社区组
|
||||||
|
*/
|
||||||
|
Map<String, Object> getCommunityPersonnelUserId(Long userId,String tenantId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,4 +96,9 @@ public interface IXhpcCustomersService {
|
|||||||
* 社区人员状态改变
|
* 社区人员状态改变
|
||||||
*/
|
*/
|
||||||
void updateCustomersPersonnelStatus(XhpcCustomersPersonnel xhpcCustomersPersonnel);
|
void updateCustomersPersonnelStatus(XhpcCustomersPersonnel xhpcCustomersPersonnel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id获取大客户组
|
||||||
|
*/
|
||||||
|
Map<String, Object> getCustomersPersonnelUserId(Long userId,String tenantId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,4 +79,23 @@ public class XhpcCommonServiceImpl implements IXhpcCommonService {
|
|||||||
}
|
}
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取该机构的折扣比例
|
||||||
|
*
|
||||||
|
* @param userId 充值用户
|
||||||
|
* @param userType 用户类型
|
||||||
|
* @param tenantId 租户id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId) {
|
||||||
|
if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
|
||||||
|
return AjaxResult.success(xhpcCommunityService.getCommunityPersonnelUserId(userId, tenantId));
|
||||||
|
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(userType)){
|
||||||
|
return AjaxResult.success(xhpcCustomersService.getCustomersPersonnelUserId(userId, tenantId));
|
||||||
|
}else{
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -307,6 +307,17 @@ public class XhpcCommunityServiceImpl extends BaseService implements IXhpcCommun
|
|||||||
return AjaxResult.error("充值金额必需大于0");
|
return AjaxResult.error("充值金额必需大于0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id获取社区组
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @param tenantId
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getCommunityPersonnelUserId(Long userId, String tenantId) {
|
||||||
|
return xhpcCommunityMapper.getCommunityPersonnelUserId(userId, tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
public R judgeXhpcCommunity(XhpcCommunity xhpcCommunity){
|
public R judgeXhpcCommunity(XhpcCommunity xhpcCommunity){
|
||||||
|
|
||||||
if(xhpcCommunity.getName()==null || "".equals(xhpcCommunity.getName())){
|
if(xhpcCommunity.getName()==null || "".equals(xhpcCommunity.getName())){
|
||||||
|
|||||||
@ -289,6 +289,17 @@ public class XhpcCustomersServiceImpl extends BaseService implements IXhpcCustom
|
|||||||
xhpcCustomersMapper.updateCustomersPersonnelStatus(xhpcCustomersPersonnel.getCustomersPersonnelId(),xhpcCustomersPersonnel.getStatus());
|
xhpcCustomersMapper.updateCustomersPersonnelStatus(xhpcCustomersPersonnel.getCustomersPersonnelId(),xhpcCustomersPersonnel.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id获取大客户组
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @param tenantId
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getCustomersPersonnelUserId(Long userId, String tenantId) {
|
||||||
|
return xhpcCustomersMapper.getCustomersPersonnelUserId(userId, tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
public R judgeXhpcCustomers(XhpcCustomers xhpcCustomers){
|
public R judgeXhpcCustomers(XhpcCustomers xhpcCustomers){
|
||||||
|
|
||||||
if(xhpcCustomers.getName()==null || "".equals(xhpcCustomers.getName())){
|
if(xhpcCustomers.getName()==null || "".equals(xhpcCustomers.getName())){
|
||||||
|
|||||||
@ -455,4 +455,11 @@
|
|||||||
update xhpc_community_personnel set status=#{status} where community_personnel_id=#{communityPersonnelId}
|
update xhpc_community_personnel set status=#{status} where community_personnel_id=#{communityPersonnelId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="getCommunityPersonnelUserId" resultType="map">
|
||||||
|
select
|
||||||
|
commission_type commissionType,
|
||||||
|
service_preferential servicePreferential
|
||||||
|
from xhpc_community
|
||||||
|
where community_id = (select community_id from xhpc_community_personnel where community_personnel_id=#{userId} and tenant_id=#{tenantId} and del_flag =0)
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -451,4 +451,12 @@
|
|||||||
<update id="updateCustomersPersonnelStatus">
|
<update id="updateCustomersPersonnelStatus">
|
||||||
update xhpc_customers_personnel set status=#{status} where customers_personnel_id=#{customersPersonnelId}
|
update xhpc_customers_personnel set status=#{status} where customers_personnel_id=#{customersPersonnelId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="getCustomersPersonnelUserId" resultType="map">
|
||||||
|
select
|
||||||
|
commission_type commissionType,
|
||||||
|
service_preferential servicePreferential
|
||||||
|
from xhpc_customers
|
||||||
|
where customers_id = (select customers_id from xhpc_customers_personnel where customers_personnel_id=#{userId} and tenant_id=#{tenantId} and del_flag =0)
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user