| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | import java.util.Date; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import com.panzhihua.service_community.dao.ComMngRealCompanyDAO; |
| | | import com.panzhihua.service_community.model.dos.ComMngRealCompanyDO; |
| | | import com.panzhihua.service_community.service.ComMngRealCompanyService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @description: 实有单位 |
| | |
| | | * @date: 2021/3/19 11:55 |
| | | */ |
| | | @Service |
| | | public class ComMngRealCompanyServiceImpl extends ServiceImpl<ComMngRealCompanyDAO, ComMngRealCompanyDO> implements ComMngRealCompanyService { |
| | | public class ComMngRealCompanyServiceImpl extends ServiceImpl<ComMngRealCompanyDAO, ComMngRealCompanyDO> |
| | | implements ComMngRealCompanyService { |
| | | |
| | | @Resource |
| | | private ComMngRealCompanyDAO comMngRealCompanyDAO; |
| | |
| | | } |
| | | page.setSize(pageSize); |
| | | page.setCurrent(pageNum); |
| | | IPage<ComMngRealCompanyVO> iPage = comMngRealCompanyDAO.pageQueryComMngRealCompany(page, pageComMngRealCompanyDTO); |
| | | IPage<ComMngRealCompanyVO> iPage = |
| | | comMngRealCompanyDAO.pageQueryComMngRealCompany(page, pageComMngRealCompanyDTO); |
| | | return R.ok(iPage); |
| | | } |
| | | |
| | | @Override |
| | | public R saveComMngRealCompany(ComMngRealCompanyVO comMngRealCompanyVO) { |
| | | if (null != comMngRealCompanyVO.getId() && comMngRealCompanyVO.getId() != 0) { |
| | | //修改 |
| | | // 修改 |
| | | ComMngRealCompanyDO comMngRealCompanyDO = comMngRealCompanyDAO.selectById(comMngRealCompanyVO.getId()); |
| | | if (null == comMngRealCompanyDO) { |
| | | return R.fail("该单位不存在"); |
| | | } |
| | | ComMngRealCompanyDO checkCreditCode = comMngRealCompanyDAO.selectOne(new QueryWrapper<ComMngRealCompanyDO>().lambda().eq(ComMngRealCompanyDO::getCreditCode, comMngRealCompanyVO.getCreditCode())); |
| | | ComMngRealCompanyDO checkCreditCode = comMngRealCompanyDAO.selectOne(new QueryWrapper<ComMngRealCompanyDO>() |
| | | .lambda().eq(ComMngRealCompanyDO::getCreditCode, comMngRealCompanyVO.getCreditCode())); |
| | | if (null != checkCreditCode && comMngRealCompanyDO.getId() != checkCreditCode.getId()) { |
| | | return R.fail("该单位已存在,信用代码重复"); |
| | | } |
| | |
| | | return R.ok(); |
| | | } |
| | | } else { |
| | | //新增 |
| | | Integer count = comMngRealCompanyDAO.selectCount(new QueryWrapper<ComMngRealCompanyDO>().lambda().eq(ComMngRealCompanyDO::getCreditCode, comMngRealCompanyVO.getCreditCode())); |
| | | // 新增 |
| | | Integer count = comMngRealCompanyDAO.selectCount(new QueryWrapper<ComMngRealCompanyDO>().lambda() |
| | | .eq(ComMngRealCompanyDO::getCreditCode, comMngRealCompanyVO.getCreditCode())); |
| | | if (count > 0) { |
| | | return R.fail("该单位已存在,信用代码重复"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public R listSaveMngRealCompanyExcelVO(List<ComMngRealCompanyExcelVO> list, Long communityId) { |
| | | List<ComMngRealCompanyDO> dbComMngRealCompany = comMngRealCompanyDAO.selectList(new QueryWrapper<ComMngRealCompanyDO>().lambda()); |
| | | List<ComMngRealCompanyDO> dbComMngRealCompany = |
| | | comMngRealCompanyDAO.selectList(new QueryWrapper<ComMngRealCompanyDO>().lambda()); |
| | | List<ComMngRealCompanyDO> comMngRealCompanyDOS = new ArrayList<>(); |
| | | list.forEach(l -> { |
| | | ComMngRealCompanyDO realCompany = dbComMngRealCompany.stream().filter(db -> db.getCreditCode().equals(l.getCreditCode())).findFirst().orElse(null); |
| | | ComMngRealCompanyDO realCompany = dbComMngRealCompany.stream() |
| | | .filter(db -> db.getCreditCode().equals(l.getCreditCode())).findFirst().orElse(null); |
| | | if (realCompany == null) { |
| | | ComMngRealCompanyDO comMngRealCompanyDO = new ComMngRealCompanyDO(); |
| | | BeanUtils.copyProperties(l, comMngRealCompanyDO); |
| | | comMngRealCompanyDO.setCommunityId(communityId); |
| | | comMngRealCompanyDOS.add(comMngRealCompanyDO); |
| | | }else{ |
| | | } else { |
| | | BeanUtils.copyProperties(l, realCompany); |
| | | realCompany.setCommunityId(communityId); |
| | | comMngRealCompanyDOS.add(realCompany); |
| | |
| | | |
| | | @Override |
| | | public R belongsComMngRealCompany(ComMngRealCompanyBelongsDTO comMngRealCompanyBelongsDTO) { |
| | | ComMngRealCompanyBelongsVO comMngRealCompanyBelongsVO = comMngRealCompanyDAO.queryComMngRealCompanyBelongs(comMngRealCompanyBelongsDTO); |
| | | ComMngRealCompanyBelongsVO comMngRealCompanyBelongsVO = |
| | | comMngRealCompanyDAO.queryComMngRealCompanyBelongs(comMngRealCompanyBelongsDTO); |
| | | return R.ok(comMngRealCompanyBelongsVO); |
| | | } |
| | | |