| @@ -192,7 +192,7 @@ public class WxShopController extends BaseController { | |||||
| @ApiOperation("导入") | @ApiOperation("导入") | ||||
| @PostMapping(value = "/importShop", consumes = "multipart/*") | @PostMapping(value = "/importShop", consumes = "multipart/*") | ||||
| public void importShop(@RequestParam("poiFile") MultipartFile mFile,HttpServletRequest request, HttpServletResponse response) { | |||||
| public void importShop(@RequestParam("file") MultipartFile mFile,HttpServletRequest request, HttpServletResponse response) { | |||||
| File lFile = handlerImportFile(mFile,"wxshop"); | File lFile = handlerImportFile(mFile,"wxshop"); | ||||
| wxShopService.importShop(getTenantInfo(), lFile,request, response); | wxShopService.importShop(getTenantInfo(), lFile,request, response); | ||||
| } | } | ||||
| @@ -108,5 +108,8 @@ public class WxEnergyMeter extends TenantEntity { | |||||
| private Integer hasShop; | private Integer hasShop; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String aliseName; | private String aliseName; | ||||
| @TableField(exist = false) | |||||
| private Long parentMeterId; | |||||
| @TableField(exist = false) | |||||
| private List<Long> notInIds; | |||||
| } | } | ||||
| @@ -149,7 +149,7 @@ public class WxShop extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租金单位", name = "rentUnit") | @io.swagger.annotations.ApiModelProperty(value = "租金单位", name = "rentUnit") | ||||
| private Integer rentUnit; | private Integer rentUnit; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "租金单位", name = "rentUnit") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "公摊系数", name = "pulicRate") | |||||
| private String pulicRate; | private String pulicRate; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "树里面的类型", name = "treeType") | @io.swagger.annotations.ApiModelProperty(value = "树里面的类型", name = "treeType") | ||||
| @@ -50,7 +50,7 @@ public class WxShopVo extends WxShop { | |||||
| @Excel(name="计租面积",width = 20,orderNum = "13") | @Excel(name="计租面积",width = 20,orderNum = "13") | ||||
| private String operationArea; | private String operationArea; | ||||
| @io.swagger.annotations.ApiModelProperty(value="计租面积",name="publicRate") | |||||
| @io.swagger.annotations.ApiModelProperty(value="计租面积",name="pulicRate") | |||||
| @Excel(name="公摊系数",width = 20,orderNum = "14") | @Excel(name="公摊系数",width = 20,orderNum = "14") | ||||
| private String publicRate; | |||||
| private String pulicRate; | |||||
| } | } | ||||
| @@ -16,6 +16,8 @@ public interface WxEnergyMeterChildMapper extends CommonMapper<WxEnergyMeterChil | |||||
| List<Long> findChildMeterIdList(WxEnergyMeterChild wxBillRent); | List<Long> findChildMeterIdList(WxEnergyMeterChild wxBillRent); | ||||
| List<Long> findParentMeterIdList(WxEnergyMeterChild wxBillRent); | |||||
| void deleteByCondition(WxEnergyMeterChild wxBillRent); | void deleteByCondition(WxEnergyMeterChild wxBillRent); | ||||
| } | } | ||||
| @@ -200,6 +200,7 @@ public class WxEnergyHelper { | |||||
| mrq.setMeterIds(childmids); | mrq.setMeterIds(childmids); | ||||
| mrq.setStartTime(time.getStartTime()); | mrq.setStartTime(time.getStartTime()); | ||||
| mrq.setEndTime(time.getEndTime()); | mrq.setEndTime(time.getEndTime()); | ||||
| mrq.setIsConfirm(EnumYesOrNo.YES.getCode()); | |||||
| BigDecimal totalNumber = wxEnergyMeterReadingMapper.findNumberSum(mrq); | BigDecimal totalNumber = wxEnergyMeterReadingMapper.findNumberSum(mrq); | ||||
| if (null == totalNumber || totalNumber.compareTo(new BigDecimal(0)) <= 0 ) { | if (null == totalNumber || totalNumber.compareTo(new BigDecimal(0)) <= 0 ) { | ||||
| totalNumber = new BigDecimal(0); | totalNumber = new BigDecimal(0); | ||||
| @@ -223,6 +224,7 @@ public class WxEnergyHelper { | |||||
| mrq.setMeterIds(userMeterList); | mrq.setMeterIds(userMeterList); | ||||
| mrq.setStartTime(time.getStartTime()); | mrq.setStartTime(time.getStartTime()); | ||||
| mrq.setEndTime(time.getEndTime()); | mrq.setEndTime(time.getEndTime()); | ||||
| mrq.setIsConfirm(EnumYesOrNo.YES.getCode()); | |||||
| BigDecimal totalNumber = wxEnergyMeterReadingMapper.findNumberSum(mrq); | BigDecimal totalNumber = wxEnergyMeterReadingMapper.findNumberSum(mrq); | ||||
| if (null == totalNumber || totalNumber.compareTo(new BigDecimal(0)) <= 0 ) { | if (null == totalNumber || totalNumber.compareTo(new BigDecimal(0)) <= 0 ) { | ||||
| return "0"; | return "0"; | ||||
| @@ -117,6 +117,15 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||||
| record.setIds(aliseIdList); | record.setIds(aliseIdList); | ||||
| } | } | ||||
| } | } | ||||
| if (null != record.getParentMeterId()) { | |||||
| WxEnergyMeterChild mcq = new WxEnergyMeterChild(); | |||||
| mcq.updateTenantInfo(record); | |||||
| mcq.setParentMeterId(record.getParentMeterId()); | |||||
| List<Long> notinIds = wxEnergyMeterChildMapper.findChildMeterIdList(mcq); | |||||
| if (null != notinIds && notinIds.size() > 0 ) { | |||||
| record.setNotInIds(notinIds); | |||||
| } | |||||
| } | |||||
| PageInfo<WxEnergyMeter> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyMeterMapper.findList(record)); | PageInfo<WxEnergyMeter> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyMeterMapper.findList(record)); | ||||
| return page; | return page; | ||||
| } | } | ||||
| @@ -9,20 +9,28 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.MerchantPoiT; | |||||
| import com.iformall.domain.vo.MerchantPoiTNew; | |||||
| import com.iformall.domain.vo.WxNotRentShopVo; | import com.iformall.domain.vo.WxNotRentShopVo; | ||||
| import com.iformall.domain.vo.WxShopVo; | import com.iformall.domain.vo.WxShopVo; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxMerchantMapper; | import com.iformall.mapper.WxMerchantMapper; | ||||
| import com.iformall.mapper.WxMerchantShopMapper; | import com.iformall.mapper.WxMerchantShopMapper; | ||||
| import com.iformall.mapper.WxRentContractMapper; | import com.iformall.mapper.WxRentContractMapper; | ||||
| import com.iformall.mapper.WxShopMapper; | import com.iformall.mapper.WxShopMapper; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import cn.afterturn.easypoi.excel.ExcelImportUtil; | |||||
| import cn.afterturn.easypoi.excel.entity.ImportParams; | import cn.afterturn.easypoi.excel.entity.ImportParams; | ||||
| import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; | |||||
| import cn.afterturn.easypoi.handler.impl.ExcelDataHandlerDefaultImpl; | |||||
| import cn.afterturn.easypoi.handler.inter.IExcelDataHandler; | |||||
| import org.apache.commons.beanutils.BeanUtils; | import org.apache.commons.beanutils.BeanUtils; | ||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.apache.shiro.session.UnknownSessionException; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -288,7 +296,6 @@ public class WxShopServiceImpl implements WxShopService { | |||||
| BeanUtils.copyProperties(vo, shop); | BeanUtils.copyProperties(vo, shop); | ||||
| vo.setBuildingName(buildingMap.get(vo.getBuilding())); | vo.setBuildingName(buildingMap.get(vo.getBuilding())); | ||||
| vo.setFloorName(floorMap.get(vo.getFloor())); | vo.setFloorName(floorMap.get(vo.getFloor())); | ||||
| vo.setPublicRate(shop.getPulicRate()); | |||||
| Long merchangId = shopMerchantIdMap.get(vo.getId()); | Long merchangId = shopMerchantIdMap.get(vo.getId()); | ||||
| if (null != merchangId) { | if (null != merchangId) { | ||||
| WxMerchant merchant = merchantMap.get(merchangId); | WxMerchant merchant = merchantMap.get(merchangId); | ||||
| @@ -577,7 +584,69 @@ public class WxShopServiceImpl implements WxShopService { | |||||
| ImportParams params = new ImportParams(); | ImportParams params = new ImportParams(); | ||||
| // 需要验证 | // 需要验证 | ||||
| String[] needFields = new String[]{"ID", "公摊系数"}; | String[] needFields = new String[]{"ID", "公摊系数"}; | ||||
| String[] allFields = new String[] {"ID","楼座","楼层"}; | |||||
| String[] allFields = new String[] {"ID","楼座","楼层","租赁商户","负责人电话","负责人","品牌","经营业态","计租面积","公摊系数"}; | |||||
| ExcelImportResult<WxShopVo> datalist = handleImportFile(file,WxShopVo.class,allFields,needFields,new ExcelHandler()); | |||||
| if (null == datalist) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"解析模版失败,请检查模版格式"); | |||||
| } | |||||
| List<WxShopVo> successList = datalist.getList(); | |||||
| if(null != successList && successList.size() > 0 ) { | |||||
| try { | |||||
| successList.parallelStream().forEach(shopBase -> { | |||||
| try { | |||||
| Long shopId = shopBase.getId(); | |||||
| if (null != shopId) { | |||||
| WxShop s = new WxShop(); | |||||
| s.updateTenantInfo(tenantEntity); | |||||
| s.setId(shopId); | |||||
| s.setPulicRate(shopBase.getPulicRate()); | |||||
| wxShopMapper.updateById(s); | |||||
| } | |||||
| } catch (UnknownSessionException ue) { | |||||
| logger.error("session :"+ue.getMessage()); | |||||
| } | |||||
| }); | |||||
| } catch (Exception e) { | |||||
| logger.error("更新地理信息失败:"+e.getMessage(),e); | |||||
| } | |||||
| } | |||||
| } | |||||
| private class ExcelHandler extends ExcelDataHandlerDefaultImpl<MerchantPoiTNew> { | |||||
| @Override | |||||
| public Object importHandler(MerchantPoiTNew obj, String name, Object value) { | |||||
| if (value == null) { | |||||
| value = ""; | |||||
| } | |||||
| return super.importHandler(obj, name, value); | |||||
| } | |||||
| } | |||||
| private ExcelImportResult handleImportFile(File file,Class dataClazz,String[] importFields,String[] needFields,IExcelDataHandler handler) { | |||||
| ImportParams params = new ImportParams(); | |||||
| // 需要验证 | |||||
| params.setImportFields(importFields); | |||||
| handler.setNeedHandlerFields(needFields); | |||||
| params.setNeedVerify(true); | |||||
| ExcelImportResult<MerchantPoiT> datalist = null; | |||||
| try { | |||||
| datalist = ExcelImportUtil.importExcelMore(file, dataClazz, params); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage(),e); | |||||
| // 删除缓存文件 | |||||
| file.delete(); | |||||
| return null; | |||||
| } | |||||
| // 删除缓存文件 | |||||
| file.delete(); | |||||
| if(datalist == null) { | |||||
| logger.error("导入模板失败: 模板数据解析失败"); | |||||
| return null; | |||||
| } | |||||
| return datalist; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -54,6 +54,12 @@ | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="findParentMeterIdList" parameterType="com.iformall.domain.po.WxEnergyMeterChild" resultType="Long"> | |||||
| select distinct parent_meter_id | |||||
| from wx_energy_meter_child | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <delete id = "deleteByCondition" parameterType="com.iformall.domain.po.WxEnergyMeterChild" > | <delete id = "deleteByCondition" parameterType="com.iformall.domain.po.WxEnergyMeterChild" > | ||||
| delete from wx_energy_meter_child where `tenant_id` = #{tenantId} and `parent_meter_id` = #{parentMeterId} and `child_meter_id` = #{childMeterId} | delete from wx_energy_meter_child where `tenant_id` = #{tenantId} and `parent_meter_id` = #{parentMeterId} and `child_meter_id` = #{childMeterId} | ||||
| </delete> | </delete> | ||||
| @@ -36,6 +36,12 @@ | |||||
| <if test=" null != name and '' != name ">and name like concat('%', #{name},'%')</if> | <if test=" null != name and '' != name ">and name like concat('%', #{name},'%')</if> | ||||
| <if test=" null != isRealMeter ">and `physics_type` in (1,2) </if> | <if test=" null != isRealMeter ">and `physics_type` in (1,2) </if> | ||||
| <if test=" null != hasFee ">and `has_fee` = #{hasFee}</if> | <if test=" null != hasFee ">and `has_fee` = #{hasFee}</if> | ||||
| <if test=" null != notInIds "> | |||||
| and id not in | |||||
| <foreach collection="notInIds" index="index" item="nidItem" open="(" separator="," close=")"> | |||||
| #{nidItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != physicsTypeList "> | <if test=" null != physicsTypeList "> | ||||
| and physics_type in | and physics_type in | ||||
| <foreach collection="physicsTypeList" index="index" item="ptidItem" open="(" separator="," close=")"> | <foreach collection="physicsTypeList" index="index" item="ptidItem" open="(" separator="," close=")"> | ||||