36 changed files with 1182 additions and 424 deletions
@ -0,0 +1,51 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import lombok.Data; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
@Data |
||||
|
public class IcPropertyManagementFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
public interface DeleteGroup extends CustomerClientShowGroup { |
||||
|
} |
||||
|
|
||||
|
@NotBlank(message = "物业id不能为空", groups = { UpdateGroup.class,DeleteGroup.class}) |
||||
|
private String id; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 物业名称 |
||||
|
*/ |
||||
|
@NotBlank(message = "物业名称不能为空", groups = {AddGroup.class, UpdateGroup.class}) |
||||
|
@Length(max=10,message = "物业名称不能超过100个字", groups = {AddGroup.class, UpdateGroup.class}) |
||||
|
private String name; |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @Description 网格列表信息 |
||||
|
* @ClassName GridListInfoResultDTO |
||||
|
* @Author wangc |
||||
|
* @date 2020.04.23 14:21 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IcPropertyManagementResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String propertyId; |
||||
|
|
||||
|
private String propertyName; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,88 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.annotation.LoginUser; |
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.dto.form.IcPropertyManagementFormDTO; |
||||
|
import com.epmet.dto.result.IcPropertyManagementResultDTO; |
||||
|
import com.epmet.service.IcPropertyManagementService; |
||||
|
import com.epmet.service.PropertyManagementService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 物业表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-10-25 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("propertymanagement") |
||||
|
public class PropertyManagementController { |
||||
|
|
||||
|
@Autowired |
||||
|
private IcPropertyManagementService icPropertyManagementService; |
||||
|
|
||||
|
@Autowired |
||||
|
private PropertyManagementService propertyManagementService; |
||||
|
|
||||
|
|
||||
|
@PostMapping("list") |
||||
|
public Result<List<IcPropertyManagementResultDTO>> list(){ |
||||
|
return new Result<List<IcPropertyManagementResultDTO>>().ok(propertyManagementService.getList()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@PostMapping("add") |
||||
|
public Result add(@LoginUser TokenDto tokenDTO, @RequestBody IcPropertyManagementFormDTO formDTO){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(formDTO, AddGroup.class); |
||||
|
propertyManagementService.add(formDTO); |
||||
|
return new Result().ok("保存成功"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@PostMapping("update") |
||||
|
public Result update(@LoginUser TokenDto tokenDTO, @RequestBody IcPropertyManagementFormDTO formDTO){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); |
||||
|
propertyManagementService.update(formDTO); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("delete") |
||||
|
public Result delete(@LoginUser TokenDto tokenDTO, @RequestBody IcPropertyManagementFormDTO formDTO){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(formDTO, IcPropertyManagementFormDTO.DeleteGroup.class); |
||||
|
propertyManagementService.delete(formDTO); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.dto.IcPropertyManagementDTO; |
||||
|
import com.epmet.dto.form.IcPropertyManagementFormDTO; |
||||
|
import com.epmet.dto.result.IcPropertyManagementResultDTO; |
||||
|
import com.epmet.entity.IcPropertyManagementEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 物业表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-10-25 |
||||
|
*/ |
||||
|
public interface PropertyManagementService { |
||||
|
|
||||
|
List<IcPropertyManagementResultDTO> getList(); |
||||
|
|
||||
|
void add(IcPropertyManagementFormDTO formDTO); |
||||
|
|
||||
|
void update(IcPropertyManagementFormDTO formDTO); |
||||
|
void delete(IcPropertyManagementFormDTO formDTO); |
||||
|
} |
@ -0,0 +1,67 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.epmet.commons.tools.exception.RenException; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.dao.IcNeighborHoodPropertyDao; |
||||
|
import com.epmet.dao.IcPropertyManagementDao; |
||||
|
import com.epmet.dto.form.IcPropertyManagementFormDTO; |
||||
|
import com.epmet.dto.result.IcPropertyManagementResultDTO; |
||||
|
import com.epmet.entity.IcNeighborHoodPropertyEntity; |
||||
|
import com.epmet.entity.IcPropertyManagementEntity; |
||||
|
import com.epmet.service.PropertyManagementService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class PropertyManagementServiceImpl implements PropertyManagementService { |
||||
|
|
||||
|
@Resource |
||||
|
private IcPropertyManagementDao icPropertyManagementDao; |
||||
|
@Resource |
||||
|
private IcNeighborHoodPropertyDao icNeighborHoodPropertyDao; |
||||
|
|
||||
|
@Override |
||||
|
public List<IcPropertyManagementResultDTO> getList() { |
||||
|
List<IcPropertyManagementEntity> propertyManagementEntityList = icPropertyManagementDao.selectList(null); |
||||
|
List<IcPropertyManagementResultDTO> list = new ArrayList<>(); |
||||
|
propertyManagementEntityList.forEach(item->{ |
||||
|
IcPropertyManagementResultDTO propertyManagementResultDTO = new IcPropertyManagementResultDTO(); |
||||
|
propertyManagementResultDTO.setPropertyId(item.getId()); |
||||
|
propertyManagementResultDTO.setPropertyName(item.getName()); |
||||
|
list.add(propertyManagementResultDTO); |
||||
|
}); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void add(IcPropertyManagementFormDTO formDTO) { |
||||
|
IcPropertyManagementEntity icPropertyManagementEntity = ConvertUtils.sourceToTarget(formDTO, IcPropertyManagementEntity.class); |
||||
|
icPropertyManagementDao.insert(icPropertyManagementEntity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(IcPropertyManagementFormDTO formDTO) { |
||||
|
IcPropertyManagementEntity icPropertyManagementEntity = ConvertUtils.sourceToTarget(formDTO, IcPropertyManagementEntity.class); |
||||
|
icPropertyManagementDao.updateById(icPropertyManagementEntity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(IcPropertyManagementFormDTO formDTO) { |
||||
|
List<IcNeighborHoodPropertyEntity> list = icNeighborHoodPropertyDao.selectList(new QueryWrapper<IcNeighborHoodPropertyEntity>().lambda().eq(IcNeighborHoodPropertyEntity::getPropertyId, formDTO.getId())); |
||||
|
if(!CollectionUtils.isEmpty(list)){ |
||||
|
throw new RenException("物业存在与小区关联,无法删除"); |
||||
|
} |
||||
|
icPropertyManagementDao.deleteById(formDTO.getId()); |
||||
|
} |
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package com.epmet.util; |
||||
|
|
||||
|
import cn.afterturn.easypoi.handler.inter.IExcelDataModel; |
||||
|
import cn.afterturn.easypoi.handler.inter.IExcelModel; |
||||
|
|
||||
|
public class ExcelVerifyInfo implements IExcelModel, IExcelDataModel { |
||||
|
|
||||
|
private String errorMsg; |
||||
|
|
||||
|
private int rowNum; |
||||
|
|
||||
|
@Override |
||||
|
public Integer getRowNum() { |
||||
|
return rowNum; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void setRowNum(Integer rowNum) { |
||||
|
this.rowNum = rowNum; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getErrorMsg() { |
||||
|
return errorMsg; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void setErrorMsg(String errorMsg) { |
||||
|
this.errorMsg = errorMsg; |
||||
|
} |
||||
|
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue