| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- package cn.com.goldenwater.dcproj.service.impl;
- import cn.com.goldenwater.core.service.AbstractCrudService;
- import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
- import cn.com.goldenwater.dcproj.constValue.CommonLabel;
- import cn.com.goldenwater.dcproj.constValue.SplitValue;
- import cn.com.goldenwater.dcproj.dao.*;
- import cn.com.goldenwater.dcproj.dto.BisInspWrwxRgstrDto;
- import cn.com.goldenwater.dcproj.model.*;
- import cn.com.goldenwater.dcproj.param.*;
- import cn.com.goldenwater.dcproj.service.*;
- import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
- 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.BeanUtils;
- 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.Date;
- import java.util.List;
- /**
- * @author lhc
- * @date 2020-9-23
- */
- @Service
- @Transactional
- public class BisInspWrwxRgstrServiceImpl extends AbstractCrudService<BisInspWrwxRgstr, BisInspWrwxRgstrParam> implements BisInspWrwxRgstrService, BisInspObjStrategy {
- @Autowired
- private BisInspWrwxRgstrDao bisInspWrwxRgstrDao;
- @Autowired
- private AttAdBaseDao attAdBaseDao;
- @Autowired
- private BisInspWrwxRgstrSvwtcService bisInspWrwxRgstrSvwtcService;
- @Autowired
- private BisInspWrwxRgstrWgService bisInspWrwxRgstrWgService;
- @Autowired
- private BisInspWrwxRgstrWtupService bisInspWrwxRgstrWtupService;
- @Autowired
- private BisInspWrwxRgstrWtutService bisInspWrwxRgstrWtutService;
- @Autowired
- private BisInspPblmDao bisInspPblmDao;
- @Autowired
- private BisInspAllObjDao bisInspAllObjDao;
- public BisInspWrwxRgstrServiceImpl(BisInspWrwxRgstrDao bisInspWrwxRgstrDao) {
- super(bisInspWrwxRgstrDao);
- this.bisInspWrwxRgstrDao = bisInspWrwxRgstrDao;
- }
- @Override
- public int insert(BisInspWrwxRgstr bisInspWrwxRgstr) {
- // 生成uuid
- String uuid = UuidUtil.uuid();
- bisInspWrwxRgstr.setId(uuid);
- bisInspWrwxRgstr.setIntm(new Date());
- bisInspWrwxRgstr.setUptm(new Date());
- bisInspWrwxRgstr.setDataStat("0");
- return this.bisInspWrwxRgstrDao.insert(bisInspWrwxRgstr);
- }
- @Override
- public int update(BisInspWrwxRgstr bisInspWrwxRgstr) {
- bisInspWrwxRgstr.setUptm(new Date());
- return this.bisInspWrwxRgstrDao.update(bisInspWrwxRgstr);
- }
- @Override
- public int delete(String id) {
- return this.bisInspWrwxRgstrDao.delete(id);
- }
- @Override
- public void insertObj(BisInspAllObj bisInspAllObj, String persId) {
- BisInspWrwxRgstr b = new BisInspWrwxRgstr();
- AttAdBase base = attAdBaseDao.get(bisInspAllObj.getCode());
- BeanUtils.copyProperties(base, b);
- // 统一字段 rgstrId, objId
- b.setId(UuidUtil.uuid());
- b.setObjId(bisInspAllObj.getObjId());
- // 日期
- Date d = new Date();
- b.setIntm(d);
- b.setUptm(d);
- // 数据状态 默认为 0
- b.setDataStat(CommonLabel.INIT_DATA);
- // 督查状态(0:未督查;1:督查中;2:已督查)
- b.setState(CommonLabel.INIT_DATA);
- // 子表状态(0:未督查;1:督查中;2:已督查)
- b.setSvwtcState(CommonLabel.INIT_DATA);
- b.setWgState(CommonLabel.INIT_DATA);
- b.setWtupState(CommonLabel.INIT_DATA);
- b.setWtutState(CommonLabel.INIT_DATA);
- // 创建人
- b.setPersId(persId);
- /* 添加 登记表 */
- this.bisInspWrwxRgstrDao.insert(b);
- /* 添加 子表 */
- BisInspWrwxRgstrSvwtc bisInspWrwxRgstrSvwtc = new BisInspWrwxRgstrSvwtc();
- bisInspWrwxRgstrSvwtc.setRgstrId(b.getId());
- bisInspWrwxRgstrSvwtcService.insert(bisInspWrwxRgstrSvwtc);
- BisInspWrwxRgstrWg bisInspWrwxRgstrWg = new BisInspWrwxRgstrWg();
- bisInspWrwxRgstrWg.setRgstrId(b.getId());
- bisInspWrwxRgstrWgService.insert(bisInspWrwxRgstrWg);
- BisInspWrwxRgstrWtup bisInspWrwxRgstrWtup = new BisInspWrwxRgstrWtup();
- bisInspWrwxRgstrWtup.setRgstrId(b.getId());
- bisInspWrwxRgstrWtupService.insert(bisInspWrwxRgstrWtup);
- BisInspWrwxRgstrWtut bisInspWrwxRgstrWtut = new BisInspWrwxRgstrWtut();
- bisInspWrwxRgstrWtut.setRgstrId(b.getId());
- bisInspWrwxRgstrWtutService.insert(bisInspWrwxRgstrWtut);
- }
- @Override
- public String getType() {
- return BisInspEnum.WRWX.getValue();
- }
- @Override
- public void cleanObjData(String objId) {
- BisInspWrwxRgstrParam rgstrParam = new BisInspWrwxRgstrParam();
- rgstrParam.setObjId(objId);
- List<BisInspWrwxRgstr> list = this.bisInspWrwxRgstrDao.findList(rgstrParam);
- if (list.size() > 0) {
- String id = list.get(0).getId();
- // 删除子表
- BisInspWrwxRgstrSvwtcParam svwtcParam = new BisInspWrwxRgstrSvwtcParam();
- svwtcParam.setRgstrId(id);
- bisInspWrwxRgstrSvwtcService.deleteBy(svwtcParam);
- BisInspWrwxRgstrWtutParam wtutParam = new BisInspWrwxRgstrWtutParam();
- wtutParam.setRgstrId(id);
- bisInspWrwxRgstrWtutService.deleteBy(wtutParam);
- BisInspWrwxRgstrWgParam wgParam = new BisInspWrwxRgstrWgParam();
- wgParam.setRgstrId(id);
- bisInspWrwxRgstrWgService.deleteBy(wgParam);
- BisInspWrwxRgstrWtupParam wtupParam = new BisInspWrwxRgstrWtupParam();
- wtupParam.setRgstrId(id);
- bisInspWrwxRgstrWtupService.deleteBy(wtupParam);
- // 删除登记表
- this.bisInspWrwxRgstrDao.delete(id);
- }
- // 删除问题
- BisInspPblmParam bisInspPblmParam = new BisInspPblmParam();
- bisInspPblmParam.setObjId(objId);
- bisInspPblmParam.setObjType(getType());
- bisInspPblmDao.deleteBy(bisInspPblmParam);
- // 删除对象名录表
- BisInspAllObjParam bisInspAllObjParam = new BisInspAllObjParam();
- bisInspAllObjParam.setObjId(objId);
- bisInspAllObjDao.deleteBy(bisInspAllObjParam);
- }
- @Override
- public PageInfo<BisInspWrwxRgstrDto> findObjPageByType(TypeParam typeParam, HttpServletResponse response) {
- if (StringUtils.isNotBlank(typeParam.getAdCode())) {
- typeParam.setAdCode(String.valueOf(AdLevelUtil.SubAd(typeParam.getAdCode()).get(SplitValue.SUBAD)));
- }
- PageHelper.startPage(typeParam);
- List<BisInspWrwxRgstrDto> list = this.bisInspWrwxRgstrDao.findPageList(typeParam);
- return (PageInfo<BisInspWrwxRgstrDto>) new PageInfo(list);
- }
- @Override
- public Object findObjListByType(TypeParam typeParam) {
- return this.bisInspWrwxRgstrDao.findPageList(typeParam);
- }
- }
|