| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- package cn.com.goldenwater.dcproj.service.impl.vill;
- import cn.com.goldenwater.core.service.AbstractCrudService;
- import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
- import cn.com.goldenwater.dcproj.constValue.SplitValue;
- import cn.com.goldenwater.dcproj.dao.*;
- import cn.com.goldenwater.dcproj.dto.BisInspVillRgstrDto;
- import cn.com.goldenwater.dcproj.model.*;
- import cn.com.goldenwater.dcproj.param.*;
- import cn.com.goldenwater.dcproj.service.BisInspObjStrategy;
- import cn.com.goldenwater.dcproj.service.BisInspVillRgstrService;
- import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
- import cn.com.goldenwater.dcproj.utils.DateUtils;
- import cn.com.goldenwater.id.util.UuidUtil;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- 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 javax.servlet.http.HttpServletResponse;
- import java.util.ArrayList;
- import java.util.List;
- /**
- * @author lune
- * @date 2019-2-18
- */
- @Service
- @Transactional
- public class BisInspVillRgstrServiceImpl extends AbstractCrudService<BisInspVillRgstr, BisInspVillRgstrParam> implements BisInspVillRgstrService,BisInspObjStrategy {
- @Autowired
- private BisInspVillRgstrDao bisInspVillRgstrDao;
- @Autowired
- AttCwsBaseDao attCwsBaseDao;
- @Autowired
- private BisInspVlgdrinkProjManageDao bisInspVlgdrinkProjManageDao;
- @Autowired
- private BisInspProSourceProtectDao bisInspProSourceProtectDao;
- @Autowired
- private BisInspSecsurveyVlgDao bisInspSecsurveyVlgDao;
- @Autowired
- private BisInspVlgdrinkFacOperDao bisInspVlgdrinkFacOperDao;
- @Autowired
- private BisInspWateruserInfoDao bisInspWateruserInfoDao;
- @Autowired
- private BisInspManageResponsibilityDao bisInspManageResponsibilityDao;
- @Autowired
- private BisInspAllObjDao bisInspAllObjDao;
- @Autowired
- private BisInspPblmDao bisInspPblmDao;
- public BisInspVillRgstrServiceImpl(BisInspVillRgstrDao bisInspVillRgstrDao) {
- super(bisInspVillRgstrDao);
- this.bisInspVillRgstrDao = bisInspVillRgstrDao;
- }
- @Override
- public void insertObj(BisInspAllObj bisInspAllObj,String persId) {
- BisInspVillRgstr bisInspVillRgstr = new BisInspVillRgstr();
- String uuid1 = UuidUtil.uuid();
- String now = DateUtils.getTodayYMDHMS();
- bisInspVillRgstr.setIntm(now);
- bisInspVillRgstr.setRecPersId(persId);
- bisInspVillRgstr.setUptm(now);
- bisInspVillRgstr.setEngId(uuid1);
- bisInspVillRgstr.setOrgId(bisInspAllObj.getOrgId());
- bisInspVillRgstr.setObjId(bisInspAllObj.getObjId());
- bisInspVillRgstr.setRegsNm(bisInspAllObj.getNm());
- bisInspVillRgstrDao.insert(bisInspVillRgstr);
- }
- @Override
- public String getType() {
- return BisInspEnum.VILL.getValue();
- }
- @Override
- public void cleanObjData(String objId) {
- BisInspVillRgstrParam bisInspVillRgstrParam = new BisInspVillRgstrParam();
- bisInspVillRgstrParam.setObjId(objId);
- List<BisInspVillRgstr> list = this.bisInspVillRgstrDao.findList(bisInspVillRgstrParam);
- if (list.size() > 0) {
- String id = list.get(0).getEngId();
- BisInspPblmParam bisInspPblmParam = new BisInspPblmParam();
- bisInspPblmParam.setRegid(id);
- bisInspPblmParam.setObjType(BisInspEnum.VILL.getValue());
- this.bisInspPblmDao.deleteBy(bisInspPblmParam);//删除问题
- BisInspVlgdrinkProjManageParam bisInspVlgdrinkProjManageParam = new BisInspVlgdrinkProjManageParam();
- bisInspVlgdrinkProjManageParam.setEngId(id);
- this.bisInspVlgdrinkProjManageDao.deleteBy(bisInspVlgdrinkProjManageParam);//删除农村饮水工程运行管理情况表
- BisInspProSourceProtectParam bisInspProSourceProtectParam = new BisInspProSourceProtectParam();
- bisInspProSourceProtectParam.setEngId(id);
- this.bisInspProSourceProtectDao.deleteBy(bisInspProSourceProtectParam);//删除千人以上供水工程水源地保护登记表
- BisInspSecsurveyVlgParam bisInspSecsurveyVlgParam = new BisInspSecsurveyVlgParam();
- bisInspSecsurveyVlgParam.setEngId(id);
- this.bisInspSecsurveyVlgDao.deleteBy(bisInspSecsurveyVlgParam);//删除暗访调研行政村登记表
- BisInspVlgdrinkFacOperParam bisInspVlgdrinkFacOperParam = new BisInspVlgdrinkFacOperParam();
- bisInspVlgdrinkFacOperParam.setEngId(id);
- this.bisInspVlgdrinkFacOperDao.deleteBy(bisInspVlgdrinkFacOperParam);//删除村内农村饮水工程设施运行维护情况表
- BisInspWateruserInfoParam bisInspWateruserInfoParam = new BisInspWateruserInfoParam();
- bisInspWateruserInfoParam.setEngId(id);
- this.bisInspWateruserInfoDao.deleteBy(bisInspWateruserInfoParam);//删除农村饮水用水户登记表
- BisInspManageResponsibilityParam bisInspManageResponsibilityParam = new BisInspManageResponsibilityParam();
- bisInspManageResponsibilityParam.setEngId(id);
- this.bisInspManageResponsibilityDao.deleteBy(bisInspManageResponsibilityParam);
- BisInspVillRgstr bisInspVillRgstr = this.bisInspVillRgstrDao.get(id);
- this.bisInspVillRgstrDao.delete(id);//删除登记表
- if (bisInspVillRgstr != null) {
- BisInspAllObjParam bisInspAllObjParam = new BisInspAllObjParam();
- bisInspAllObjParam.setObjId(objId);
- this.bisInspAllObjDao.deleteBy(bisInspAllObjParam);//删除督查对象
- }
- }
- }
- @Override
- public PageInfo findObjPageByType(TypeParam typeParam, HttpServletResponse response) {
- return this.findPageByType(typeParam);
- }
- @Override
- public Object findObjListByType(TypeParam typeParam) {
- return this.findListByType(typeParam);
- }
- @Override
- public String add(BisInspVillRgstr bisInspVillRgstr) throws Exception {
- String uuid = UuidUtil.uuid();
- String now = DateUtils.getTodayYMDHMS();
- bisInspVillRgstr.setIntm(now);
- bisInspVillRgstr.setUptm(now);
- if (StringUtils.isBlank(bisInspVillRgstr.getEngId())) {
- bisInspVillRgstr.setEngId(uuid);
- } else {
- uuid = bisInspVillRgstr.getEngId();
- }
- this.insert(bisInspVillRgstr);
- return uuid;
- }
- @Override
- public String modify(BisInspVillRgstr bisInspVillRgstr) throws Exception {
- String now = DateUtils.getTodayYMDHMS();
- bisInspVillRgstr.setUptm(now);
- int ret = bisInspVillRgstrDao.update(bisInspVillRgstr);
- return ret + "";
- }
- @Override
- public PageInfo<BisInspVillRgstr> queryListByPage(BisInspVillRgstrParam p) throws Exception {
- PageHelper.startPage(p.getPageNum(), p.getPageSize());
- List<BisInspVillRgstr> list = bisInspVillRgstrDao.findList(p);
- return new PageInfo<BisInspVillRgstr>(list);
- }
- @Override
- public List<BisInspVillRgstr> queryList(BisInspVillRgstrParam p) throws Exception {
- List<BisInspVillRgstr> list = bisInspVillRgstrDao.findList(p);
- return list;
- }
- @Override
- public List<BisInspVillRgstr> findListByPersId(String persId,String orgId) throws Exception {
- List<BisInspVillRgstr> list = bisInspVillRgstrDao.findListByPersId(persId,orgId);
- return list;
- }
- @Override
- public PageInfo<BisInspVillRgstrDto> findPageByType(TypeParam typeParam) {
- if (StringUtils.isNotBlank(typeParam.getAdCode())) {
- typeParam.setAdCode(String.valueOf(AdLevelUtil.SubAd(typeParam.getAdCode()).get(SplitValue.SUBAD)));
- }
- PageHelper.startPage(typeParam);
- List<BisInspVillRgstrDto> list = bisInspVillRgstrDao.findPageByType(typeParam);
- for (BisInspVillRgstrDto dto : list) {
- if (!"0".equals(dto.getWtdstState())) {
- SumVillNUm villNUm = bisInspVillRgstrDao.sumVillNum(dto.getEngId());
- dto.setVillNum(villNUm.getTcNum());
- dto.setCwsNum(villNUm.getProNum());
- dto.setSurNum(villNUm.getSurNum());
- }
- }
- PageInfo<BisInspVillRgstrDto> pageInfo = new PageInfo(list);
- return pageInfo;
- }
- @Override
- public List<BisInspVillRgstrDto> findListByType(TypeParam typeParam) {
- List<BisInspVillRgstrDto> list = bisInspVillRgstrDao.findPageByType(typeParam);
- if (list == null) {
- return new ArrayList<>();
- }
- return list;
- }
- @Override
- public List<BisInspVillRgstrDto> findTree(TypeParam typeParam) {
- List<BisInspVillRgstrDto> list = bisInspVillRgstrDao.findTree(typeParam);
- if (list == null) {
- return new ArrayList<>();
- }
- return list;
- }
- @Override
- public String getEngId(String objId, String persId) throws Exception {
- String engId = "";
- BisInspVillRgstrParam p = new BisInspVillRgstrParam();
- p.setObjId(objId);
- BisInspVillRgstr str = bisInspVillRgstrDao.getBy(p);
- if (str == null) {
- BisInspVillRgstr vill = new BisInspVillRgstr();
- vill.setObjId(objId);
- if (StringUtils.isNotBlank(persId)) {
- vill.setRecPersId(persId);
- } else {
- vill.setRecPersId("SYSTEM");
- }
- engId = add(vill);
- } else {
- engId = str.getEngId();
- }
- return engId;
- }
- @Override
- public int insert(BisInspVillRgstr b) {
- int ret = 1;
- BisInspVillRgstrParam bisInspVillRgstrParam = new BisInspVillRgstrParam();
- bisInspVillRgstrParam.setObjId(b.getObjId());
- List<BisInspVillRgstr> list = bisInspVillRgstrDao.findList(bisInspVillRgstrParam);
- if (list == null || list.size() == 0) {
- ret = bisInspVillRgstrDao.insert(b);
- }
- return ret;
- }
- }
|