|
@@ -681,144 +681,7 @@ public class PayController {
|
|
}
|
|
}
|
|
calculateIntegral.setReceivableAmt(new BigDecimal(infoMap.get("receivableAmt").toString()));
|
|
calculateIntegral.setReceivableAmt(new BigDecimal(infoMap.get("receivableAmt").toString()));
|
|
//计算积分并推送
|
|
//计算积分并推送
|
|
- this.calculateIntegralAndPushIntegral(calculateIntegral);
|
|
|
|
-
|
|
|
|
- //客户积分
|
|
|
|
-// IntegralRule integralRule =new IntegralRule();
|
|
|
|
-// integralRule.setStationId(Integer.valueOf(infoMap.get("stationId").toString()));
|
|
|
|
-// if(infoMap.containsKey("orderType") && infoMap.get("orderType").toString().equals("1")){
|
|
|
|
-// integralRule.setOilName(infoMap.get("oilName").toString());
|
|
|
|
-// integralRule.setOilType(infoMap.get("orderType").toString());
|
|
|
|
-// }else if(infoMap.containsKey("orderType") && infoMap.get("orderType").toString().equals("2")){
|
|
|
|
-// integralRule.setOilType(infoMap.get("orderType").toString());
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// //获取该油站的积分规则
|
|
|
|
-// integralRule.setEmptyDate(new Date());
|
|
|
|
-// List<IntegralRule> rule = integralRuleService.getIntegralRule(integralRule);
|
|
|
|
-// logger.info("当前油站油品的积分规则:" + rule);
|
|
|
|
-// if(rule !=null && rule.size() > 0 && rule.get(0).getEmptyDate().compareTo(new Date()) ==1){
|
|
|
|
-// CustomerPoints customerPoints = new CustomerPoints(); //客户积分实体表
|
|
|
|
-// CustomerPointsRecord customerPointsRecord = new CustomerPointsRecord(); //客户积分记录实体表
|
|
|
|
-// if(infoMap.containsKey("unionId")){
|
|
|
|
-// customerPoints.setUnionId(infoMap.get("unionId").toString());
|
|
|
|
-// customerPointsRecord.setUnionId(infoMap.get("unionId").toString());
|
|
|
|
-// }
|
|
|
|
-// customerPoints.setCustomerName(infoMap.get("consumer").toString());
|
|
|
|
-// customerPoints.setMobilePhone(infoMap.get("mobilePhone").toString()); //存入手机号
|
|
|
|
-// customerPoints.setStationName(infoMap.get("stationName").toString());
|
|
|
|
-// customerPoints.setStationId(Integer.valueOf(infoMap.get("stationId").toString()));
|
|
|
|
-//
|
|
|
|
-// customerPointsRecord.setCustomerName(infoMap.get("consumer").toString()); //客户名称
|
|
|
|
-// customerPointsRecord.setRecordType("+"); // "+"表示增加积分
|
|
|
|
-// customerPointsRecord.setStationId(Integer.valueOf(infoMap.get("stationId").toString()));
|
|
|
|
-// customerPointsRecord.setStationName(infoMap.get("stationName").toString());
|
|
|
|
-// customerPointsRecord.setCreateTime(new Date());
|
|
|
|
-// //获取该用户积分信息
|
|
|
|
-// CustomerPoints customerPointsInfo = customerPointsService.getCustomerPointsInfo(customerPoints);
|
|
|
|
-// if(customerPointsInfo !=null){
|
|
|
|
-// //String ruleType = rule.get(0).getRuleType(); //获取积分规则类型
|
|
|
|
-// String[] datePicker={}; //积分比例时间
|
|
|
|
-// if(rule.get(0).getDatePicker() != null && rule.get(0).getDatePicker() !=""){
|
|
|
|
-// if(rule.get(0).getDatePicker().contains(",")){
|
|
|
|
-// datePicker = rule.get(0).getDatePicker().split(",");
|
|
|
|
-// }else {
|
|
|
|
-// datePicker= new String[1];
|
|
|
|
-// datePicker[0] = rule.get(0).getDatePicker();
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// String currentTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间
|
|
|
|
-// List<IntegralRuleDetail> integralRuleDetailList = rule.get(0).getIntegralRuleDetailList(); //积分规则详细计算信息
|
|
|
|
-// if(integralRuleDetailList !=null && integralRuleDetailList.size() > 0){
|
|
|
|
-// BigDecimal realAmt = new BigDecimal(infoMap.get("amt").toString()); //本次消费实收金额
|
|
|
|
-// BigDecimal receivableAmt = new BigDecimal(infoMap.get("receivableAmt").toString()); //本次消费实收金额
|
|
|
|
-// BigDecimal orderLiters = null; //本次加油升数
|
|
|
|
-// if(infoMap.containsKey("orderType") && infoMap.get("orderType").toString().equals("1")){
|
|
|
|
-// orderLiters = new BigDecimal(infoMap.get("orderLiters").toString()); //本次加油升数
|
|
|
|
-// }
|
|
|
|
-// //循环规则明细
|
|
|
|
-// for(IntegralRuleDetail integralRuleDetail : integralRuleDetailList){
|
|
|
|
-// if(integralRuleDetail.getOilType().equals("1")){ //油品
|
|
|
|
-// //规则类型
|
|
|
|
-// logger.info("当前生成积分类型:油品");
|
|
|
|
-// String ruleType = integralRuleDetail.getRuleType();
|
|
|
|
-// logger.info("当前油品规则类型ruleType: " + ruleType);
|
|
|
|
-// if(ruleType !=null && ruleType.equals("1") && realAmt.compareTo(integralRuleDetail.getRuleTerms()) ==1 || realAmt.compareTo(integralRuleDetail.getRuleTerms()) ==0){
|
|
|
|
-// //以实收金额为准时
|
|
|
|
-// logger.info("以实收金额为准时");
|
|
|
|
-// if(discountPlanType == "1" && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){
|
|
|
|
-// //计算积分并取整
|
|
|
|
-// logger.info("油站使用等级");
|
|
|
|
-// countIntegral (realAmt, integralRuleDetail, datePicker, currentTime, rule, customerPoints, customerPointsRecord, customerPointsInfo);
|
|
|
|
-// break;
|
|
|
|
-// }else {
|
|
|
|
-// //计算积分并取整
|
|
|
|
-// logger.info("油站没有使用等级");
|
|
|
|
-// countIntegral (realAmt, integralRuleDetail, datePicker, currentTime, rule, customerPoints, customerPointsRecord, customerPointsInfo);
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-// }else if(ruleType !=null && ruleType.equals("2") && receivableAmt.compareTo(integralRuleDetail.getRuleTerms()) ==1 || receivableAmt.compareTo(integralRuleDetail.getRuleTerms()) ==0){
|
|
|
|
-// //应收金额为准时
|
|
|
|
-// logger.info("应收金额为准");
|
|
|
|
-// if(discountPlanType == "1" && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){
|
|
|
|
-// //计算积分并取整
|
|
|
|
-// logger.info("油站使用等级");
|
|
|
|
-// countIntegral (receivableAmt, integralRuleDetail, datePicker, currentTime, rule, customerPoints, customerPointsRecord, customerPointsInfo);
|
|
|
|
-// break;
|
|
|
|
-// }else {
|
|
|
|
-// //计算积分并取整
|
|
|
|
-// logger.info("油站没有使用等级");
|
|
|
|
-// countIntegral (receivableAmt, integralRuleDetail, datePicker, currentTime, rule, customerPoints, customerPointsRecord, customerPointsInfo);
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// }else if(ruleType !=null && ruleType.equals("3") && orderLiters.compareTo(integralRuleDetail.getRuleTerms()) ==1 || orderLiters.compareTo(integralRuleDetail.getRuleTerms()) ==0){
|
|
|
|
-// //加油升数为准时
|
|
|
|
-// logger.info("加油升数为准");
|
|
|
|
-// if(discountPlanType == "1" && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){
|
|
|
|
-// //计算积分并取整
|
|
|
|
-// logger.info("油站使用等级");
|
|
|
|
-// countIntegral (orderLiters, integralRuleDetail, datePicker, currentTime, rule, customerPoints, customerPointsRecord, customerPointsInfo);
|
|
|
|
-// break;
|
|
|
|
-// }else {
|
|
|
|
-// //计算积分并取整
|
|
|
|
-// logger.info("油站没有使用等级");
|
|
|
|
-// countIntegral (orderLiters, integralRuleDetail, datePicker, currentTime, rule, customerPoints, customerPointsRecord, customerPointsInfo);
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-// }else {
|
|
|
|
-// customerPoints.setPoints(customerPointsInfo.getPoints());
|
|
|
|
-// customerPoints.setAccumulatePoints(customerPointsInfo.getPoints());
|
|
|
|
-// customerPointsRecord.setIntegral(0);
|
|
|
|
-// }
|
|
|
|
-// }else if(integralRuleDetail.getOilType().equals("2")){ //非油品
|
|
|
|
-// logger.info("当前生成积分类型:非油品");
|
|
|
|
-// //计算积分并取整
|
|
|
|
-// countIntegral (realAmt, integralRuleDetail, datePicker, currentTime, rule, customerPoints, customerPointsRecord, customerPointsInfo);
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// logger.info("客户积分customerPoints:"+ customerPoints);
|
|
|
|
-// logger.info("客户积分记录customerPointsRecord:"+ customerPointsRecord);
|
|
|
|
-// //更新客户余额积分
|
|
|
|
-// customerPointsService.updateCustomerPointsInfo(customerPoints);
|
|
|
|
-// //插入客户积分记录表
|
|
|
|
-// customerPointsRecordService.insertCustomerPointsRecordInfo(customerPointsRecord);
|
|
|
|
-// //客户公众号积分增加通知
|
|
|
|
-// //customerPoints.getBlogOpenId()
|
|
|
|
-// //weiXinPushIntegralInfo(infoMap.get("stationId").toString(), infoMap.get("consumer").toString(), customerPointsRecord.getIntegral().toString(), customerPoints.getPoints().toString(), customerPoints.getBlogOpenId());
|
|
|
|
-// CustomerPoints m = new CustomerPoints();
|
|
|
|
-// m.setUnionId(customerPoints.getUnionId());
|
|
|
|
-// CustomerPoints cus = customerPointsService.getCustomerPointsInfo(m);
|
|
|
|
-// if(cus.getBlogOpenId() !=null){
|
|
|
|
-// //公众号积分消息推送
|
|
|
|
-// this.weiXinPushIntegralInfo(cus.getStationId().toString(), cus.getCustomerName(), customerPointsRecord.getIntegral().toString(), cus.getPoints().toString(), cus.getBlogOpenId());
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
|
|
+ this.calculateIntegralAndPushIntegral(calculateIntegral, customerManage);
|
|
///========================================================================================================================================================//
|
|
///========================================================================================================================================================//
|
|
//打印机打印小票
|
|
//打印机打印小票
|
|
String content1;
|
|
String content1;
|
|
@@ -979,63 +842,15 @@ public class PayController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //计算积分并赋值
|
|
|
|
-// public void countIntegral (BigDecimal b1, IntegralRuleDetail integralRuleDetail,
|
|
|
|
-// String[] datePicker, String currentTime, List<IntegralRule> rule,
|
|
|
|
-// CustomerPoints customerPoints, CustomerPointsRecord customerPointsRecord, CustomerPoints customerPointsInfo){
|
|
|
|
-// BigDecimal integral = b1.divide(integralRuleDetail.getSaleAmt(), 0).multiply(integralRuleDetail.getIntegral()).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
-// logger.info("该用户本次消费获取积分值:"+integral.toString());
|
|
|
|
-// //设置积分多倍时间时
|
|
|
|
-// logger.info("积分双倍时间:" +datePicker);
|
|
|
|
-// if(datePicker !=null){
|
|
|
|
-// for(String str: datePicker){
|
|
|
|
-// if (str.contains(currentTime) && rule.get(0).getIntegralProportion() !=null ){
|
|
|
|
-// integral=integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// customerPoints.setPoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
-// customerPoints.setAccumulatePoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
-// customerPointsRecord.setIntegral(Integer.valueOf(integral.toString()));
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * 微信公众号消息推送
|
|
|
|
- * @param stationId 油站ID
|
|
|
|
- * @param consumer 用户昵称
|
|
|
|
- * @param customerPointsRecordIntegral 用户积分记录
|
|
|
|
- * @param customerPointsIntegral 用户当前还剩余的积分
|
|
|
|
- */
|
|
|
|
-// public void weiXinPushIntegralInfo (String stationId, String consumer, String customerPointsRecordIntegral, String customerPointsIntegral, String openId){
|
|
|
|
-// //客户公众号积分增加通知
|
|
|
|
-// String gzhAppId ="";
|
|
|
|
-// String gzhAppSecret ="";
|
|
|
|
-// String stationName = ""; //油站名称
|
|
|
|
-// Map<String, String> m = stationService.getStationAppIdAndAppSecret(Integer.valueOf(stationId));
|
|
|
|
-// if(m !=null && m.containsKey("stationName") && m.containsKey("gzhAppId") && m.containsKey("gzhAppSecret")){
|
|
|
|
-// stationName = m.get("stationName");
|
|
|
|
-// gzhAppId = m.get("gzhAppId");
|
|
|
|
-// gzhAppSecret = m.get("gzhAppSecret");
|
|
|
|
-// }
|
|
|
|
-// List<WxMpTemplateData> wxMpTemplate = new ArrayList<>();
|
|
|
|
-// wxMpTemplate.add(new WxMpTemplateData("first","尊敬的"+consumer+",您好:\n" + "您在"+stationName+"的积分最新交易信息如下"));
|
|
|
|
-// wxMpTemplate.add(new WxMpTemplateData("time", new SimpleDateFormat("yyyy年MM月dd日HH时mm分").format(new Date())));
|
|
|
|
-// wxMpTemplate.add(new WxMpTemplateData("type", "增加"));
|
|
|
|
-// wxMpTemplate.add(new WxMpTemplateData("Point", customerPointsRecordIntegral));
|
|
|
|
-// wxMpTemplate.add(new WxMpTemplateData("From", stationName));
|
|
|
|
-// wxMpTemplate.add(new WxMpTemplateData("remark",
|
|
|
|
-// "截止至" + new SimpleDateFormat(" yyyy年MM月dd日HH时mm分").format(new Date())+",您在"+stationName+"的可用积分为 "+customerPointsIntegral+" 分"));
|
|
|
|
-// String templateId = "G9tN--a3tGM5BN3otqZr73b4ErQCYWISSgyshbTqLYc"; //积分兑换成功通知模板
|
|
|
|
-// //wxPushUtil.push(gzhAppId, gzhAppSecret, templateId, customerPoints.getBlogOpenId(), wxMpTemplate);
|
|
|
|
-// wxPushUtil.push(gzhAppId, gzhAppSecret, templateId, openId, wxMpTemplate); //oJR5R6r4EJhaORFcPap70r_mtFZo
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 计算消费生成积分
|
|
* 计算消费生成积分
|
|
|
|
+ * 注释: 1.判断油站配置的优惠类型
|
|
|
|
+ * 2.如果是等级直降则存在等级取对应等级的积分规则,否则按照其他优惠方式
|
|
*/
|
|
*/
|
|
- public void calculateIntegralAndPushIntegral(CalculateIntegral calculateIntegral){
|
|
|
|
|
|
+ public void calculateIntegralAndPushIntegral(CalculateIntegral calculateIntegral, CustomerManage customerManage){
|
|
int integral =0;
|
|
int integral =0;
|
|
|
|
+ //获取该油站的优惠方式
|
|
|
|
+ String discountPlanType = stationService.getStationDiscountWay(calculateIntegral.getStationId().toString());
|
|
IntegralRule integralRule = new IntegralRule();
|
|
IntegralRule integralRule = new IntegralRule();
|
|
integralRule.setStationId(calculateIntegral.getStationId());
|
|
integralRule.setStationId(calculateIntegral.getStationId());
|
|
integralRule.setEmptyDate(new Date());
|
|
integralRule.setEmptyDate(new Date());
|
|
@@ -1044,84 +859,187 @@ public class PayController {
|
|
//获取该油站的积分规则
|
|
//获取该油站的积分规则
|
|
List<IntegralRule> integralRuleList = integralRuleService.getIntegralRule(integralRule);
|
|
List<IntegralRule> integralRuleList = integralRuleService.getIntegralRule(integralRule);
|
|
if(integralRuleList !=null && integralRuleList.size() >0){
|
|
if(integralRuleList !=null && integralRuleList.size() >0){
|
|
|
|
+ logger.info("该油站积分规则信息:" + integralRuleList.toString());
|
|
List<IntegralRuleDetail> integralRuleDetailList = integralRuleList.get(0).getIntegralRuleDetailList();
|
|
List<IntegralRuleDetail> integralRuleDetailList = integralRuleList.get(0).getIntegralRuleDetailList();
|
|
- String currentTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间
|
|
|
|
- String datePicker=null; //活动时间
|
|
|
|
- String[] datePickerArray ={};
|
|
|
|
|
|
+ String currentTime = null; //当前时间
|
|
|
|
+ String datePickerTime=null; //活动时间
|
|
|
|
+ String[] datePickerTimeArray ={};
|
|
String integralActivity = integralRuleList.get(0).getIntegralActivity();
|
|
String integralActivity = integralRuleList.get(0).getIntegralActivity();
|
|
String integralProportion =null;
|
|
String integralProportion =null;
|
|
if(integralActivity.equals("1")){
|
|
if(integralActivity.equals("1")){
|
|
- datePicker = integralRuleList.get(0).getDatePicker();
|
|
|
|
|
|
+ datePickerTime = integralRuleList.get(0).getDatePickerTime();
|
|
integralProportion = integralRuleList.get(0).getIntegralProportion();
|
|
integralProportion = integralRuleList.get(0).getIntegralProportion();
|
|
- if(datePicker.contains(",")){
|
|
|
|
- datePickerArray = datePicker.split(",");
|
|
|
|
|
|
+ if(datePickerTime.contains(",")){
|
|
|
|
+ datePickerTimeArray = datePickerTime.split(",");
|
|
}else {
|
|
}else {
|
|
- datePickerArray= new String[1];
|
|
|
|
- datePickerArray[0] = datePicker;
|
|
|
|
|
|
+ datePickerTimeArray= new String[1];
|
|
|
|
+ datePickerTimeArray[0] = datePickerTime;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(integralRuleDetailList !=null && integralRuleDetailList.size() >0){
|
|
if(integralRuleDetailList !=null && integralRuleDetailList.size() >0){
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
+ calendar.setTime(new Date()); //获取当前时间
|
|
for (IntegralRuleDetail integralRuleDetail : integralRuleDetailList){
|
|
for (IntegralRuleDetail integralRuleDetail : integralRuleDetailList){
|
|
if(integralRuleDetail.getOilType().equals("1")){ //油品
|
|
if(integralRuleDetail.getOilType().equals("1")){ //油品
|
|
if (integralRuleDetail.getRuleType().equals("1")){ //按照实收金额
|
|
if (integralRuleDetail.getRuleType().equals("1")){ //按照实收金额
|
|
if(calculateIntegral.getAmt().compareTo(integralRuleDetail.getRuleTerms()) == 1 || calculateIntegral.getAmt().compareTo(integralRuleDetail.getRuleTerms()) == 0){
|
|
if(calculateIntegral.getAmt().compareTo(integralRuleDetail.getRuleTerms()) == 1 || calculateIntegral.getAmt().compareTo(integralRuleDetail.getRuleTerms()) == 0){
|
|
- BigDecimal divide = calculateIntegral.getAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
- BigDecimal multiply = divide.multiply(integralRuleDetail.getIntegral());
|
|
|
|
- if(integralActivity.equals("1") && datePickerArray !=null && integralProportion !=null){
|
|
|
|
- for (String s : datePickerArray){
|
|
|
|
- if(s.contains(currentTime)){
|
|
|
|
|
|
+ BigDecimal divide = null;
|
|
|
|
+ BigDecimal multiply = null;
|
|
|
|
+ //判断油站配置的优惠类型
|
|
|
|
+ if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){ //等级直降
|
|
|
|
+ divide = calculateIntegral.getAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
+ multiply = divide.multiply(integralRuleDetail.getIntegral());
|
|
|
|
+ }else {
|
|
|
|
+ divide = calculateIntegral.getAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
+ multiply = divide.multiply(integralRuleDetail.getIntegral());
|
|
|
|
+ }
|
|
|
|
+ if(integralActivity.equals("1") && datePickerTimeArray !=null && integralProportion !=null){
|
|
|
|
+ String datePicker = integralRuleList.get(0).getDatePicker();
|
|
|
|
+ switch (datePicker){
|
|
|
|
+ case "1": // 1.按周来
|
|
|
|
+ int day_Week = calendar.get(Calendar.DAY_OF_WEEK);
|
|
|
|
+ day_Week= day_Week-1; //减一原因:数据库存的下标从零开始
|
|
|
|
+ currentTime = String.valueOf(day_Week);
|
|
|
|
+ break;
|
|
|
|
+ case "2": // 2.每月的多少号
|
|
|
|
+ int day_month = calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
|
+ day_month = day_month-1; //减一原因:数据库存的下标从零开始
|
|
|
|
+ currentTime = String.valueOf(day_month); //当前时间
|
|
|
|
+ break;
|
|
|
|
+ case "3": // 3.固定日期
|
|
|
|
+ currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ for (String s : datePickerTimeArray){
|
|
|
|
+ if(s.equals(currentTime)){
|
|
multiply = multiply.multiply(new BigDecimal(integralProportion));
|
|
multiply = multiply.multiply(new BigDecimal(integralProportion));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
integral =multiply.intValue();
|
|
integral =multiply.intValue();
|
|
|
|
+ logger.info("本次客户所得积分:" + integral);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}else if (integralRuleDetail.getRuleType().equals("2")){ //按应收金额
|
|
}else if (integralRuleDetail.getRuleType().equals("2")){ //按应收金额
|
|
if(calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==0){
|
|
if(calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==0){
|
|
- BigDecimal divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
- BigDecimal multiply = divide.multiply(integralRuleDetail.getIntegral());
|
|
|
|
- if(integralActivity.equals("1") && datePickerArray !=null && integralProportion !=null){
|
|
|
|
- for (String s : datePickerArray){
|
|
|
|
- if(s.contains(currentTime)){
|
|
|
|
|
|
+ BigDecimal divide = null;
|
|
|
|
+ BigDecimal multiply = null;
|
|
|
|
+ //判断油站配置的优惠类型
|
|
|
|
+ if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){ //等级直降
|
|
|
|
+ divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
+ multiply = divide.multiply(integralRuleDetail.getIntegral());
|
|
|
|
+ }else {
|
|
|
|
+ divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
+ multiply = divide.multiply(integralRuleDetail.getIntegral());
|
|
|
|
+ }
|
|
|
|
+ if(integralActivity.equals("1") && datePickerTimeArray !=null && integralProportion !=null){
|
|
|
|
+ String datePicker = integralRuleList.get(0).getDatePicker();
|
|
|
|
+ switch (datePicker){
|
|
|
|
+ case "1": // 1.按周来
|
|
|
|
+ int day_Week = calendar.get(Calendar.DAY_OF_WEEK);
|
|
|
|
+ day_Week= day_Week-1; //减一原因:数据库存的下标从零开始
|
|
|
|
+ currentTime = String.valueOf(day_Week);
|
|
|
|
+ break;
|
|
|
|
+ case "2": // 2.每月的 多少号
|
|
|
|
+ int day_month = calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
|
+ day_month = day_month-1; //减一原因:数据库存的下标从零开始
|
|
|
|
+ currentTime = String.valueOf(day_month); //当前时间
|
|
|
|
+ break;
|
|
|
|
+ case "3": // 3.固定日期
|
|
|
|
+ currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ for (String s : datePickerTimeArray){
|
|
|
|
+ if(s.equals(currentTime)){
|
|
multiply = multiply.multiply(new BigDecimal(integralProportion));
|
|
multiply = multiply.multiply(new BigDecimal(integralProportion));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
integral = multiply.intValue();
|
|
integral = multiply.intValue();
|
|
|
|
+ logger.info("本次客户所得积分:" + integral);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}else if (integralRuleDetail.getRuleType().equals("3")){ //按照加油升数
|
|
}else if (integralRuleDetail.getRuleType().equals("3")){ //按照加油升数
|
|
if(calculateIntegral.getOilLiters().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getOilLiters().compareTo(integralRuleDetail.getRuleTerms()) ==0){
|
|
if(calculateIntegral.getOilLiters().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getOilLiters().compareTo(integralRuleDetail.getRuleTerms()) ==0){
|
|
- BigDecimal divide = calculateIntegral.getOilLiters().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
- BigDecimal multiply = divide.multiply(integralRuleDetail.getIntegral());
|
|
|
|
- if(integralActivity.equals("1") && datePickerArray !=null && integralProportion !=null){
|
|
|
|
- for (String s : datePickerArray){
|
|
|
|
- if(s.contains(currentTime)){
|
|
|
|
|
|
+ BigDecimal divide = null;
|
|
|
|
+ BigDecimal multiply = null;
|
|
|
|
+ //判断油站配置的优惠类型
|
|
|
|
+ if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){ //等级直降
|
|
|
|
+ divide = calculateIntegral.getOilLiters().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
+ multiply = divide.multiply(integralRuleDetail.getIntegral());
|
|
|
|
+ }else {
|
|
|
|
+ divide = calculateIntegral.getOilLiters().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
+ multiply = divide.multiply(integralRuleDetail.getIntegral());
|
|
|
|
+ }
|
|
|
|
+ if(integralActivity.equals("1") && datePickerTimeArray !=null && integralProportion !=null){
|
|
|
|
+ String datePicker = integralRuleList.get(0).getDatePicker();
|
|
|
|
+ switch (datePicker){
|
|
|
|
+ case "1": // 1.按周来
|
|
|
|
+ int day_Week = calendar.get(Calendar.DAY_OF_WEEK);
|
|
|
|
+ day_Week= day_Week-1; //减一原因:数据库存的下标从零开始
|
|
|
|
+ currentTime = String.valueOf(day_Week);
|
|
|
|
+ break;
|
|
|
|
+ case "2": // 2.每月的 多少号
|
|
|
|
+ int day_month = calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
|
+ day_month = day_month-1; //减一原因:数据库存的下标从零开始
|
|
|
|
+ currentTime = String.valueOf(day_month); //当前时间
|
|
|
|
+ break;
|
|
|
|
+ case "3": // 3.固定日期
|
|
|
|
+ currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ for (String s : datePickerTimeArray){
|
|
|
|
+ if(s.equals(currentTime)){
|
|
multiply = multiply.multiply(new BigDecimal(integralProportion));
|
|
multiply = multiply.multiply(new BigDecimal(integralProportion));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
integral =multiply.intValue();
|
|
integral =multiply.intValue();
|
|
|
|
+ logger.info("本次客户所得积分:" + integral);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else if (integralRuleDetail.getOilType().equals("2")){ //非油品
|
|
}else if (integralRuleDetail.getOilType().equals("2")){ //非油品
|
|
if (calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==0){
|
|
if (calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==1 || calculateIntegral.getReceivableAmt().compareTo(integralRuleDetail.getRuleTerms()) ==0){
|
|
- BigDecimal divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
- BigDecimal multiply = divide.multiply(integralRuleDetail.getIntegral());
|
|
|
|
- if(integralActivity.equals("1") && datePickerArray !=null && integralProportion !=null){
|
|
|
|
- for (String s : datePickerArray){
|
|
|
|
- if(s.contains(currentTime)){
|
|
|
|
|
|
+ BigDecimal divide = null;
|
|
|
|
+ BigDecimal multiply = null;
|
|
|
|
+ //判断油站配置的优惠类型
|
|
|
|
+ if(discountPlanType.equals("1") && integralRuleDetail.getGread() !=null && customerManage.getGrade().equals(integralRuleDetail.getGread())){ //等级直降
|
|
|
|
+ divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
+ multiply = divide.multiply(integralRuleDetail.getIntegral());
|
|
|
|
+ }else {
|
|
|
|
+ divide = calculateIntegral.getReceivableAmt().divide(integralRuleDetail.getSaleAmt(), 0, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
+ multiply = divide.multiply(integralRuleDetail.getIntegral());
|
|
|
|
+ }
|
|
|
|
+ if(integralActivity.equals("1") && datePickerTimeArray !=null && integralProportion !=null){
|
|
|
|
+ String datePicker = integralRuleList.get(0).getDatePicker(); //获取日期类型
|
|
|
|
+ switch (datePicker){
|
|
|
|
+ case "1": // 1.按周来
|
|
|
|
+ int day_Week = calendar.get(Calendar.DAY_OF_WEEK);
|
|
|
|
+ day_Week= day_Week-1; //减一原因:数据库存的下标从零开始
|
|
|
|
+ currentTime = String.valueOf(day_Week);
|
|
|
|
+ break;
|
|
|
|
+ case "2": // 2.每月的 多少号
|
|
|
|
+ int day_month = calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
|
+ day_month = day_month-1; //减一原因:数据库存的下标从零开始
|
|
|
|
+ currentTime = String.valueOf(day_month); //当前时间
|
|
|
|
+ break;
|
|
|
|
+ case "3": // 3.固定日期
|
|
|
|
+ currentTime =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); //当前时间
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ for (String s : datePickerTimeArray){
|
|
|
|
+ if(s.equals(currentTime)){
|
|
multiply = multiply.multiply(new BigDecimal(integralProportion));
|
|
multiply = multiply.multiply(new BigDecimal(integralProportion));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
integral = multiply.intValue();
|
|
integral = multiply.intValue();
|
|
|
|
+ logger.info("本次客户所得积分:" + integral);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|