| @@ -64,8 +64,6 @@ public class WxEnergyFeesShop extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private List<Long> shopIds; | |||
| @TableField(exist = false) | |||
| private List<Long> calcuteIds; | |||
| @TableField(exist = false) | |||
| private String feesName; | |||
| @TableField(exist = false) | |||
| private String feesIdsStr; | |||
| @@ -118,6 +118,8 @@ public class WxEnergyMeterReading extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private List<Long> shopIds; | |||
| @TableField(exist = false) | |||
| private List<Long> meterIds; | |||
| @TableField(exist = false) | |||
| private String shopIdsStr; | |||
| @TableField(exist = false) | |||
| private Long timeId; | |||
| @@ -4,6 +4,8 @@ import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxEnergyMeterReading; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.math.BigDecimal; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -16,4 +18,6 @@ public interface WxEnergyMeterReadingMapper extends CommonMapper<WxEnergyMeterRe | |||
| WxEnergyMeterReading selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| void setIsDel(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("isDel")Integer isDel); | |||
| BigDecimal findNumberSum(WxEnergyMeterReading wxBillRent); | |||
| } | |||
| @@ -55,6 +55,8 @@ public interface WxMallBuildingService { | |||
| void deleteById(Long id); | |||
| ResultData getBuildingList(TenantEntity tenantEntity); | |||
| List<WxMallBuilding> getBuildingList1(TenantEntity tenantEntity); | |||
| ResultData getBuildingFloorList(WxMallBuilding wxMallBuilding,MallUserInfo mallUser); | |||
| @@ -45,6 +45,8 @@ public interface WxMallFloorService { | |||
| ResultData getFloorList(TenantEntity tenantEntity, Long buildingId); | |||
| List<WxMallFloor> getBudingFloorList(TenantEntity tenantEntity, Long buildingId); | |||
| List<Long> getFloorIdList(WxMallFloor record); | |||
| void deleteByBuildingId(Long buildingId); | |||
| @@ -1,54 +1,187 @@ | |||
| package com.iformall.service.helper; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.context.annotation.Lazy; | |||
| import org.springframework.stereotype.Service; | |||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||
| import com.iformall.domain.po.WxEnergyFeesShop; | |||
| import com.iformall.domain.po.WxEnergyFeesTime; | |||
| import com.iformall.domain.po.WxEnergyMeter; | |||
| import com.iformall.domain.po.WxEnergyMeterReading; | |||
| import com.iformall.domain.po.WxMallBuilding; | |||
| import com.iformall.domain.po.WxMallFloor; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.mapper.WxEnergyMeterReadingMapper; | |||
| import com.iformall.service.WxMallBuildingService; | |||
| import com.iformall.service.WxMallFloorService; | |||
| import com.iformall.utils.FormulaParser; | |||
| import com.iformall.utils.PlaceholderExtractorWithPrefixAndSuffix; | |||
| @Service | |||
| public class WxEnergyHelper { | |||
| @Autowired | |||
| WxEnergyMeterReadingMapper wxEnergyMeterReadingMapper; | |||
| @Lazy | |||
| @Autowired | |||
| private WxMallBuildingService wxMallBuildingService; | |||
| @Lazy | |||
| @Autowired | |||
| WxMallFloorService wxMallFloorService; | |||
| public static List<Map<String,String>> generateCalcuteComponent() { | |||
| public List<Map<String,String>> generateCalcuteComponent(TenantEntity tenantEntity) { | |||
| //公共表,公摊总表,当前楼栋面积,当前楼层面积,总面积,店铺公摊系数 | |||
| List<Map<String,String>> retList = new ArrayList<Map<String,String>>(); | |||
| Map<String,String> currentBuildingArea = new HashMap<String,String>(); | |||
| currentBuildingArea.put("name", "店铺所属楼栋总计租面积"); | |||
| currentBuildingArea.put("value", "{#currentBuildingArea#}"); | |||
| retList.add(currentBuildingArea); | |||
| Map<String,String> currentFloorArea = new HashMap<String,String>(); | |||
| currentFloorArea.put("name", "店铺所属楼层总计租面积"); | |||
| currentFloorArea.put("value", "{#currentFloorArea#}"); | |||
| retList.add(currentFloorArea); | |||
| Map<String,String> totalArea = new HashMap<String,String>(); | |||
| totalArea.put("name", "商场总计租面积"); | |||
| totalArea.put("value", "{#totalArea#}"); | |||
| retList.add(totalArea); | |||
| List<WxMallBuilding> buildingList = wxMallBuildingService.getBuildingList1(tenantEntity); | |||
| if (null != buildingList && buildingList.size() > 0 ) { | |||
| for (int i = 0 ; i < buildingList.size(); i++) { | |||
| WxMallBuilding mb = buildingList.get(i); | |||
| addComponent(retList, "楼栋("+mb.getBuildingName()+")面积", "{#buildingArea_"+mb.getId()+"#}"); | |||
| List<WxMallFloor> floorList = wxMallFloorService.getBudingFloorList(tenantEntity, mb.getId()); | |||
| if (null != floorList && floorList.size() > 0 ) { | |||
| for (int j = 0 ; j < floorList.size(); j++ ) { | |||
| WxMallFloor floor = floorList.get(j); | |||
| addComponent(retList, "楼层("+mb.getBuildingName()+floor.getFloorName()+")面积", "{#floorArea_"+floor.getId()+"#}"); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| addComponent(retList, "商场总计租面积", "{#totalArea#}"); | |||
| addComponent(retList, "店铺公摊系数", "{#shopPublicRax#}"); | |||
| return retList; | |||
| } | |||
| private void addComponent(List<Map<String,String>> retList, String name, String value) { | |||
| Map<String,String> calcuteRax = new HashMap<String,String>(); | |||
| calcuteRax.put("name", "公摊系数"); | |||
| calcuteRax.put("value", "{#calcuteRax#}"); | |||
| calcuteRax.put("name", name); | |||
| calcuteRax.put("value", value); | |||
| retList.add(calcuteRax); | |||
| return retList; | |||
| } | |||
| public static Map<String,String> generateMeterComponent(WxEnergyMeter meter) { | |||
| public Map<String,String> generateMeterComponent(WxEnergyMeter meter) { | |||
| Map<String,String> m = new HashMap<String,String>(); | |||
| m.put("name", meter.getName()); | |||
| m.put("value", "{#meter_"+meter.getId()+"#}"); | |||
| return m; | |||
| } | |||
| public static String calcuteMoney(StringBuffer sb,WxEnergyFeesTime time,List<WxEnergyMeter> meterList,WxEnergyFeesShop shopfee) { | |||
| return "0"; | |||
| private String replaceFormulaData(String formula,BigDecimal totalArea,WxShop shop,Map<Long,BigDecimal> buildingAreaMap, | |||
| Map<Long,WxMallFloor> floorMap,Map<Long,BigDecimal> meterNumberMap) { | |||
| if (StringUtils.isBlank(formula)) { | |||
| return null; | |||
| } | |||
| List<String> buildingAreaList = PlaceholderExtractorWithPrefixAndSuffix.extractPlaceholders(formula, "#buildingArea_", "#"); | |||
| List<String> floorAreaList = PlaceholderExtractorWithPrefixAndSuffix.extractPlaceholders(formula, "#floorArea_", "#"); | |||
| List<String> meterList = PlaceholderExtractorWithPrefixAndSuffix.extractPlaceholders(formula, "#meter_", "#"); | |||
| if (null != buildingAreaMap && null != buildingAreaList && buildingAreaList.size() > 0 ) { | |||
| for (int i = 0 ; i < buildingAreaList.size(); i ++) { | |||
| String buildArea = buildingAreaList.get(i); | |||
| String[] bs = buildArea.split("_"); | |||
| if (null != bs && bs.length > 1) { | |||
| BigDecimal buildingArea = buildingAreaMap.get(Long.parseLong(bs[1])); | |||
| if (null != buildingArea) { | |||
| formula = formula.replaceAll("{#buildingArea_"+Long.parseLong(bs[1])+"#}", buildingArea.toPlainString()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| if (null != floorMap && null != floorAreaList && floorAreaList.size() > 0 ) { | |||
| for (int i = 0 ; i < floorAreaList.size(); i ++) { | |||
| String floorArea = floorAreaList.get(i); | |||
| String[] bs = floorArea.split("_"); | |||
| if (null != bs && bs.length > 1) { | |||
| WxMallFloor floor = floorMap.get(Long.parseLong(bs[1])); | |||
| if (null != floor && null != floor.getOperatingArea()) { | |||
| formula = formula.replaceAll("{#floorArea_"+Long.parseLong(bs[1])+"#}", floor.getOperatingArea().toPlainString()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| if (null != meterNumberMap && null != meterList && meterList.size() > 0 ) { | |||
| for (int i = 0 ; i < meterList.size(); i ++) { | |||
| String meter = meterList.get(i); | |||
| String[] bs = meter.split("_"); | |||
| if (null != bs && bs.length > 1) { | |||
| BigDecimal mu = meterNumberMap.get(Long.parseLong(bs[1])); | |||
| if (null != mu ) { | |||
| formula = formula.replaceAll("{#meter_"+Long.parseLong(bs[1])+"#}", mu.toPlainString()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| formula = formula.replaceAll("{#totalArea#}", totalArea.toPlainString()); | |||
| formula = formula.replaceAll("{#shopPublicRax#}", shop.getBuildArea()); | |||
| return formula; | |||
| } | |||
| /** | |||
| * 计算金额 | |||
| * 1. 如果是用户表: | |||
| * 根据店铺所有表的总度数 * 科目单价计算费用 | |||
| * | |||
| * 2. 如果是公摊: | |||
| * 根据科目公式进行计算。 | |||
| * | |||
| * @param sb | |||
| * @param time | |||
| * @param meterList | |||
| * @param shopfee | |||
| * @return | |||
| */ | |||
| public String calcuteMoney(StringBuffer sb,BigDecimal totalArea,WxShop shop,WxEnergyFeesTime time,List<WxEnergyMeter> meterList,WxEnergyFeesShop shopfee, | |||
| Map<Long,BigDecimal> buildingAreaMap,Map<Long,WxMallFloor> floorMap,Map<Long,BigDecimal> meterNumberMap) { | |||
| if (StringUtils.isBlank(shopfee.getPrice())) { | |||
| return "0"; | |||
| } | |||
| if (shopfee.getIsPublic() == EnumYesOrNo.YES.getCode()) { | |||
| //替代占位符为真实数据 | |||
| // | |||
| String formula = replaceFormulaData(shopfee.getFormula(),totalArea,shop,buildingAreaMap,floorMap,meterNumberMap); | |||
| if (null != formula) { | |||
| return new BigDecimal(FormulaParser.evaluate(formula)).setScale(2,BigDecimal.ROUND_HALF_UP).toPlainString(); | |||
| } | |||
| return "0"; | |||
| }else { | |||
| if (null == meterList || meterList.size() <= 0 ) { | |||
| return "0"; | |||
| } | |||
| List<Long> meterIdList = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < meterList.size(); i++) { | |||
| WxEnergyMeter meter = meterList.get(i); | |||
| meterIdList.add(meter.getId()); | |||
| } | |||
| //根据表,区间的开始日期,结束日期来查询抄表数据。 | |||
| WxEnergyMeterReading mrq = new WxEnergyMeterReading(); | |||
| mrq.updateTenantInfo(shopfee); | |||
| mrq.setMeterIds(meterIdList); | |||
| BigDecimal totalNumber = wxEnergyMeterReadingMapper.findNumberSum(mrq); | |||
| if (null == totalNumber || totalNumber.compareTo(new BigDecimal(0)) <= 0 ) { | |||
| return "0"; | |||
| } | |||
| sb.append("表总度数"+totalNumber.toPlainString()+",单价:"+shopfee.getPrice()); | |||
| return totalNumber.multiply(new BigDecimal(shopfee.getPrice())).setScale(2,BigDecimal.ROUND_HALF_UP).toPlainString(); | |||
| } | |||
| } | |||
| public void testCalcute(String formula) { | |||
| } | |||
| } | |||
| @@ -75,6 +75,8 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| WxEnergyReadingCalcuteMapper wxEnergyReadingCalcuteMapper; | |||
| @Autowired | |||
| WxEnergyReadingCalcuteResultMapper wxEnergyReadingCalcuteResultMapper; | |||
| @Autowired | |||
| WxEnergyHelper wxEnergyHelper; | |||
| @Lazy | |||
| @Autowired | |||
| @@ -531,7 +533,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| @Override | |||
| public List<Map<String,String>> getFeesCalcuteComponentList(WxEnergyFeesShop record) { | |||
| List<Map<String,String>> retList = WxEnergyHelper.generateCalcuteComponent(); | |||
| List<Map<String,String>> retList = wxEnergyHelper.generateCalcuteComponent(record); | |||
| //公共表,公摊总表,当前楼栋面积,当前楼层面积,总面积,店铺公摊系数 | |||
| WxEnergyMeter mq = new WxEnergyMeter(); | |||
| mq.updateTenantInfo(record); | |||
| @@ -543,7 +545,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| if (null != page && null != page.getList() ) { | |||
| for (int i = 0 ; i < page.getList().size() ; i ++) { | |||
| WxEnergyMeter meter = page.getList().get(i); | |||
| retList.add(WxEnergyHelper.generateMeterComponent(meter)); | |||
| retList.add(wxEnergyHelper.generateMeterComponent(meter)); | |||
| } | |||
| } | |||
| return retList; | |||
| @@ -557,21 +559,19 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| WxEnergyFees fees = this.getFeesById(record.getFeesId(),record.getTenantId()); | |||
| for (int i = 0 ; i < record.getShopIds().size(); i ++) { | |||
| Long shopId = record.getShopIds().get(i); | |||
| for (int j = 0 ; j < record.getCalcuteIds().size(); j ++) { | |||
| Long calcuteId = record.getCalcuteIds().get(j); | |||
| WxEnergyFeesShop msf = new WxEnergyFeesShop(); | |||
| msf.updateTenantInfo(record); | |||
| msf.setId(idWorker.nextId()); | |||
| msf.setCreateTime(date); | |||
| msf.setUpdateTime(date); | |||
| msf.setShopId(shopId); | |||
| msf.setIsPublic(fees.getIsPublic()); | |||
| msf.setFeesId(fees.getId()); | |||
| msf.setPrice(fees.getPrice()); | |||
| msf.setFormula(record.getFormula()); | |||
| msf.setFormulaContent(record.getFormulaContent()); | |||
| wxEnergyFeesShopMapper.insert(msf); | |||
| } | |||
| WxEnergyFeesShop msf = new WxEnergyFeesShop(); | |||
| msf.updateTenantInfo(record); | |||
| msf.setId(idWorker.nextId()); | |||
| msf.setCreateTime(date); | |||
| msf.setUpdateTime(date); | |||
| msf.setShopId(shopId); | |||
| msf.setIsPublic(fees.getIsPublic()); | |||
| msf.setFeesId(fees.getId()); | |||
| msf.setPrice(fees.getPrice()); | |||
| msf.setFormulaContent(record.getFormulaContent()); | |||
| msf.setFormula(record.getFormula()); | |||
| wxEnergyHelper.testCalcute(record.getFormula()); | |||
| wxEnergyFeesShopMapper.insert(msf); | |||
| } | |||
| } | |||
| @@ -593,9 +593,11 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreateTime(date); | |||
| record.setUpdateTime(date); | |||
| wxEnergyHelper.testCalcute(record.getFormula()); | |||
| wxEnergyFeesShopMapper.insert(record); | |||
| }else { | |||
| record.setUpdateTime(date); | |||
| wxEnergyHelper.testCalcute(record.getFormula()); | |||
| wxEnergyFeesShopMapper.updateById(record); | |||
| } | |||
| } | |||
| @@ -899,9 +901,22 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| public void generateCalcuteResult(WxEnergyFees fees,WxEnergyReadingCalcute record,List<Long> shopIds,EnumEnergyMeterPhysicsType type) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| WxShop shq = new WxShop(); | |||
| shq.updateTenantInfo(record); | |||
| shq.setIds(shopIds); | |||
| Map<Long, WxShop> shopMap = wxShopService.findShopMap(shq); | |||
| //TODO 总共面积 | |||
| BigDecimal totalArea = null; | |||
| //TODO 楼栋的面积 | |||
| Map<Long,BigDecimal> buildingAreaMap = null; | |||
| //TODO 楼层 | |||
| Map<Long,WxMallFloor> floorMap = null; | |||
| //TODO 公摊总表的读数 | |||
| Map<Long,BigDecimal> meterNumberMap = null; | |||
| List<WxEnergyReadingCalcuteResult> resultList = new ArrayList<WxEnergyReadingCalcuteResult>(); | |||
| for (int i = 0 ; i < shopIds.size(); i ++) { | |||
| Long shopId= shopIds.get(i); | |||
| WxShop shop = shopMap.get(shopId); | |||
| //根据店铺,所属年月去查询时间区间.根据店铺,时间区间去查对应的抄表数据,根据表来计算总和 | |||
| WxEnergyFeesTimeShop sq = new WxEnergyFeesTimeShop(); | |||
| sq.updateTenantInfo(record); | |||
| @@ -953,14 +968,10 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| cs.setFeesId(shopfee.getFeesId()); | |||
| cs.setFeesShopId(shopfee.getId()); | |||
| StringBuffer sb = new StringBuffer(); | |||
| cs.setMoney(WxEnergyHelper.calcuteMoney(sb,time, meterList, shopfee)); | |||
| cs.setMoney(wxEnergyHelper.calcuteMoney(sb,totalArea,shop,time, meterList, shopfee,buildingAreaMap,floorMap,meterNumberMap)); | |||
| cs.setPeriod(record.getPeriod()); | |||
| cs.setMoney(sb.toString()); | |||
| resultList.add(cs); | |||
| //查询每一个表的抄表数据,求和 | |||
| for (int k = 0 ; k < meterList.size() ; k++) { | |||
| } | |||
| } | |||
| } | |||
| if (resultList.size() > 0 ) { | |||
| @@ -113,10 +113,15 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| @Override | |||
| public ResultData getBuildingList(TenantEntity tenantEntity) { | |||
| return new ResultData(getBuildingList1(tenantEntity)); | |||
| } | |||
| @Override | |||
| public List<WxMallBuilding> getBuildingList1(TenantEntity tenantEntity) { | |||
| WxMallBuilding wxMallBuilding = new WxMallBuilding(); | |||
| wxMallBuilding.updateTenantInfo(tenantEntity); | |||
| List<WxMallBuilding> list = wxMallBuildingMapper.findList(wxMallBuilding); | |||
| return new ResultData(list); | |||
| return list; | |||
| } | |||
| @Override | |||
| @@ -70,6 +70,15 @@ public class WxMallFloorServiceImpl implements WxMallFloorService { | |||
| return new ResultData(list); | |||
| } | |||
| @Override | |||
| public List<WxMallFloor> getBudingFloorList(TenantEntity tenantEntity, Long buildingId) { | |||
| WxMallFloor wxMallFloor = new WxMallFloor(); | |||
| wxMallFloor.updateTenantInfo(tenantEntity); | |||
| wxMallFloor.setBuildingId(buildingId); | |||
| List<WxMallFloor> list = wxMallFloorMapper.findList(wxMallFloor); | |||
| return list; | |||
| } | |||
| @Override | |||
| public List<Long> getFloorIdList(WxMallFloor record) { | |||
| return wxMallFloorMapper.getFloorIds(record); | |||
| @@ -0,0 +1,76 @@ | |||
| package com.iformall.utils; | |||
| import java.util.Stack; | |||
| public class FormulaParser { | |||
| public static double evaluate(String formula) { | |||
| Stack<Double> values = new Stack<>(); | |||
| Stack<Character> operators = new Stack<>(); | |||
| for (int i = 0; i < formula.length(); i++) { | |||
| char c = formula.charAt(i); | |||
| if (Character.isDigit(c) || c == '.') { | |||
| StringBuilder numBuilder = new StringBuilder(); | |||
| while (i < formula.length() && (Character.isDigit(formula.charAt(i)) || formula.charAt(i) == '.')) { | |||
| numBuilder.append(formula.charAt(i)); | |||
| i++; | |||
| } | |||
| i--; | |||
| values.push(Double.parseDouble(numBuilder.toString())); | |||
| } else if (c == '(') { | |||
| operators.push(c); | |||
| } else if (c == ')') { | |||
| while (operators.peek()!= '(') { | |||
| performOperation(values, operators); | |||
| } | |||
| operators.pop(); | |||
| } else if (c == '+' || c == '-') { | |||
| while (!operators.isEmpty() && (operators.peek() == '*' || operators.peek() == '/')) { | |||
| performOperation(values, operators); | |||
| } | |||
| operators.push(c); | |||
| } else if (c == '*' || c == '/') { | |||
| operators.push(c); | |||
| } | |||
| } | |||
| while (!operators.isEmpty()) { | |||
| performOperation(values, operators); | |||
| } | |||
| return values.pop(); | |||
| } | |||
| public static void performOperation(Stack<Double> values, Stack<Character> operators) { | |||
| double num2 = values.pop(); | |||
| double num1 = values.pop(); | |||
| char op = operators.pop(); | |||
| switch (op) { | |||
| case '+': | |||
| values.push(num1 + num2); | |||
| break; | |||
| case '-': | |||
| values.push(num1 - num2); | |||
| break; | |||
| case '*': | |||
| values.push(num1 * num2); | |||
| break; | |||
| case '/': | |||
| if (num2!= 0) { | |||
| values.push(num1 / num2); | |||
| } else { | |||
| throw new ArithmeticException("除数不能为 0"); | |||
| } | |||
| break; | |||
| } | |||
| } | |||
| public static void main(String[] args) { | |||
| String formula = "((2 + 3.2) * 4.1 / 3 - 5.6/2) / 2"; | |||
| double result = evaluate(formula); | |||
| System.out.println("结果: " + result); | |||
| } | |||
| } | |||
| @@ -0,0 +1,32 @@ | |||
| package com.iformall.utils; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.regex.Matcher; | |||
| import java.util.regex.Pattern; | |||
| public class PlaceholderExtractorWithPrefixAndSuffix { | |||
| public static List<String> extractPlaceholders(String text, String prefix, String suffix) { | |||
| List<String> placeholders = new ArrayList<>(); | |||
| String pattern = "\\{" + prefix + "[^}]*" + suffix + "\\}"; | |||
| Pattern regex = Pattern.compile(pattern); | |||
| Matcher matcher = regex.matcher(text); | |||
| while (matcher.find()) { | |||
| placeholders.add(matcher.group()); | |||
| } | |||
| return placeholders; | |||
| } | |||
| public static void main(String[] args) { | |||
| String text = "This is a {prefix_value_suffix} and another {prefix_another_suffix}."; | |||
| String prefix = "prefix"; | |||
| String suffix = "_suffix"; | |||
| List<String> extractedPlaceholders = extractPlaceholders(text, prefix, suffix); | |||
| for (String placeholder : extractedPlaceholders) { | |||
| System.out.println(placeholder); | |||
| } | |||
| } | |||
| } | |||
| @@ -49,6 +49,12 @@ | |||
| <if test=" null != meterName and '' != meterName ">and meter_name like concat('%', #{meterName},'%')</if> | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != createByName and '' != createByName ">and create_by_name like concat('%', #{createByName},'%')</if> | |||
| <if test=" null != meterIds "> | |||
| and meter_id in | |||
| <foreach collection="meterIds" index="index" item="midItem" open="(" separator="," close=")"> | |||
| #{midItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != shopIds "> | |||
| and shop_id in | |||
| <foreach collection="shopIds" index="index" item="sidItem" open="(" separator="," close=")"> | |||
| @@ -80,6 +86,12 @@ | |||
| <update id = "setIsDel" parameterType="HashMap"> | |||
| update wx_energy_meter_reading set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId} | |||
| </update> | |||
| <select id="findNumberSum" parameterType="com.iformall.domain.po.WxEnergyMeterReading" resultType="decimal"> | |||
| select sum(CAST(ifnull(cur_number,'0') AS DECIMAL(20,4)) - CAST(ifnull(pre_number,'0') AS DECIMAL(20,4))) total_number | |||
| from wx_energy_meter_reading | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||