| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- package cn.com.goldenwater.dcproj.service.impl.vill;
- import cn.com.goldenwater.core.exception.BaseException;
- import cn.com.goldenwater.dcproj.dao.*;
- import cn.com.goldenwater.dcproj.dto.BisInspSecsurveyVlgDcdxDto;
- import cn.com.goldenwater.dcproj.dto.BisInspSecsurveyVlgDto;
- import cn.com.goldenwater.dcproj.dto.VillRgstrDto;
- import cn.com.goldenwater.dcproj.model.*;
- import cn.com.goldenwater.dcproj.param.*;
- import cn.com.goldenwater.dcproj.service.BisInspSecsurveyVlgService;
- import cn.com.goldenwater.core.service.AbstractCrudService;
- import com.github.pagehelper.PageHelper;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import com.github.pagehelper.PageInfo;
- import java.util.List;
- import cn.com.goldenwater.id.util.UuidUtil;
- import java.util.Date;
- import cn.com.goldenwater.dcproj.utils.DateUtils;
- /**
- * @author zhengdafei
- * @date 2019-2-19
- */
- @Service
- @Transactional
- public class BisInspSecsurveyVlgServiceImpl extends AbstractCrudService<BisInspSecsurveyVlg, BisInspSecsurveyVlgParam> implements BisInspSecsurveyVlgService {
- @Autowired
- private BisInspSecsurveyVlgDao bisInspSecsurveyVlgDao;
- @Autowired
- private BisInspVlgdrinkFacOperDao bisInspVlgdrinkFacOperDao;
- @Autowired
- private BisInspWateruserInfoDao bisInspWateruserInfoDao;
- @Autowired
- private BisInspVillRgstrDao bisInspVillRgstrDao;
- public BisInspSecsurveyVlgServiceImpl(BisInspSecsurveyVlgDao bisInspSecsurveyVlgDao) {
- super(bisInspSecsurveyVlgDao);
- this.bisInspSecsurveyVlgDao = bisInspSecsurveyVlgDao;
- }
- @Override
- public String add(BisInspSecsurveyVlg p) throws Exception {
- String uuid = UuidUtil.uuid();
- String now = DateUtils.getTodayYMDHMS();
- p.setCreateTime(now);
- p.setUpdateTime(now);
- p.setVillId(uuid);
- BisInspSecsurveyVlgParam bp = new BisInspSecsurveyVlgParam();
- bp.setEngId(p.getEngId());
- bp.setVillageCode(p.getVillageCode());
- BisInspSecsurveyVlg vlg = bisInspSecsurveyVlgDao.getBy(bp);
- if (vlg != null) {
- throw new Exception("520");
- }
- bisInspSecsurveyVlgDao.insert(p);
- BisInspVillRgstr rp = new BisInspVillRgstr();
- rp.setEngId(p.getEngId());
- rp.setState("1");
- bisInspVillRgstrDao.update(rp);
- return uuid;
- }
- @Override
- public int modify(BisInspSecsurveyVlg p) throws Exception {
- String now = DateUtils.getTodayYMDHMS();
- p.setUpdateTime(now);
- int ret = bisInspSecsurveyVlgDao.update(p);
- return ret;
- }
- @Override
- public PageInfo<BisInspSecsurveyVlg> queryListByPage(BisInspSecsurveyVlgParam p) throws Exception {
- PageHelper.startPage(p.getPageNum(), p.getPageSize());
- List<BisInspSecsurveyVlg> list = bisInspSecsurveyVlgDao.findList(p);
- return new PageInfo<BisInspSecsurveyVlg>(list);
- }
- @Override
- public List<BisInspSecsurveyVlg> queryList(BisInspSecsurveyVlgParam p) throws Exception {
- List<BisInspSecsurveyVlg> list = bisInspSecsurveyVlgDao.findList(p);
- return list;
- }
- @Override
- public BisInspSecsurveyVlgDto getOne(BisInspSecsurveyVlgParam p) throws Exception {
- BisInspSecsurveyVlgDto dto = new BisInspSecsurveyVlgDto();
- BisInspSecsurveyVlg vlg = bisInspSecsurveyVlgDao.getBy(p);
- if (vlg != null) {
- dto.setAdNm(vlg.getAdNm());
- dto.setCreateTime(vlg.getCreateTime());
- dto.setCwsStatus(vlg.getStatus());
- dto.setEngId(vlg.getEngId());
- dto.setIsCenwtSupply(vlg.getIsCenwtSupply());
- dto.setIsFluexc(vlg.getIsFluexc());
- dto.setIsMtarea(vlg.getIsMtarea());
- dto.setRecPers2(vlg.getRecPers2());
- dto.setIsPoverty(vlg.getIsPoverty());
- dto.setUpdateTime(vlg.getUpdateTime());
- dto.setVillId(vlg.getVillId());
- dto.setRecPersId(vlg.getRecPersId());
- dto.setRecPersTel(vlg.getRecPersTel());
- dto.setVillageCode(vlg.getVillageCode());
- dto.setVisitDate(vlg.getVisitDate());
- dto.setWatersupplyPer(vlg.getWatersupplyPer());
- dto.setWasPoverty(vlg.getWasPoverty());
- BisInspVlgdrinkFacOperParam op = new BisInspVlgdrinkFacOperParam();
- op.setEngId(vlg.getEngId());
- op.setAdCode(p.getVillageCode());
- BisInspVlgdrinkFacOper fac = bisInspVlgdrinkFacOperDao.getBy(op);
- if (fac != null) {
- dto.setCwsStatus("1");
- } else {
- dto.setCwsStatus("0");
- }
- BisInspWateruserInfoParam ip = new BisInspWateruserInfoParam();
- ip.setEngId(vlg.getEngId());
- ip.setVillageCode(p.getVillageCode());
- List<BisInspWateruserInfo> infoList = bisInspWateruserInfoDao.findList(ip);
- if (infoList != null && infoList.size() > 0) {
- dto.setUserStatus("1");
- } else {
- dto.setUserStatus("0");
- }
- }
- return dto;
- }
- /**
- * 获取最新数据
- */
- @Override
- public BisInspSecsurveyVlgDto getNearOne(BisInspSecsurveyVlgParam p) throws Exception {
- BisInspSecsurveyVlgDto dto = new BisInspSecsurveyVlgDto();
- BisInspSecsurveyVlg vlg = new BisInspSecsurveyVlg();
- List<BisInspSecsurveyVlg> vlgDaoList = bisInspSecsurveyVlgDao.findList(p);//取最新数据
- if (vlgDaoList != null && !vlgDaoList.isEmpty()) {
- vlg = vlgDaoList.get(0);
- if (vlg != null) {
- dto.setAdNm(vlg.getAdNm());
- dto.setCreateTime(vlg.getCreateTime());
- dto.setCwsStatus(vlg.getStatus());
- dto.setEngId(vlg.getEngId());
- dto.setIsCenwtSupply(vlg.getIsCenwtSupply());
- dto.setIsFluexc(vlg.getIsFluexc());
- dto.setIsMtarea(vlg.getIsMtarea());
- dto.setRecPers2(vlg.getRecPers2());
- dto.setIsPoverty(vlg.getIsPoverty());
- dto.setUpdateTime(vlg.getUpdateTime());
- dto.setVillId(vlg.getVillId());
- dto.setRecPersId(vlg.getRecPersId());
- dto.setRecPersTel(vlg.getRecPersTel());
- dto.setVillageCode(vlg.getVillageCode());
- dto.setVisitDate(vlg.getVisitDate());
- dto.setWatersupplyPer(vlg.getWatersupplyPer());
- dto.setWasPoverty(vlg.getWasPoverty());
- BisInspVlgdrinkFacOperParam op = new BisInspVlgdrinkFacOperParam();
- op.setEngId(vlg.getEngId());
- op.setAdCode(p.getVillageCode());
- List<BisInspVlgdrinkFacOper> fac = bisInspVlgdrinkFacOperDao.findList(op);
- if (fac != null && !fac.isEmpty()) {
- dto.setCwsStatus("1");
- } else {
- dto.setCwsStatus("0");
- }
- BisInspWateruserInfoParam ip = new BisInspWateruserInfoParam();
- ip.setEngId(vlg.getEngId());
- ip.setVillageCode(p.getVillageCode());
- List<BisInspWateruserInfo> info = bisInspWateruserInfoDao.findList(ip);
- if (info != null && !info.isEmpty()) {
- dto.setUserStatus("1");
- } else {
- dto.setUserStatus("0");
- }
- }
- }
- dto = dto;
- return dto;
- }
- @Override
- public List<BisInspSecsurveyVlg> getListByCodeAndPerId(VillRgstrDto villRgstrDto) {
- return this.bisInspSecsurveyVlgDao.getListByCodeAndPerId(villRgstrDto);
- }
- @Override
- public PageInfo<BisInspSecsurveyVlg> getPageByCodeAndPerId(VillRgstrDto villRgstrDto) {
- PageHelper.startPage(villRgstrDto.getPageNum(), villRgstrDto.getPageSize());
- List<BisInspSecsurveyVlg> list = bisInspSecsurveyVlgDao.getListByCodeAndPerId(villRgstrDto);
- return new PageInfo<BisInspSecsurveyVlg>(list);
- }
- @Override
- public PageInfo<BisInspSecsurveyVlgDcdxDto> getPageByNodeId(GetVillPageByNodeIdParam p) throws Exception {
- PageHelper.startPage(p.getPageNum(), p.getPageSize());
- List<BisInspSecsurveyVlgDcdxDto> list = bisInspSecsurveyVlgDao.getPageByNodeId(p);
- return new PageInfo<BisInspSecsurveyVlgDcdxDto>(list);
- }
- }
|