package cn.com.goldenwater.dcproj.service.impl.other; import cn.com.goldenwater.dcproj.dao.AttOtherBaseDao; import cn.com.goldenwater.dcproj.dao.BisInspAllObjDao; import cn.com.goldenwater.dcproj.dao.BisInspFscRgstrDao; import cn.com.goldenwater.dcproj.dao.BisInspOtherRgstrDao; import cn.com.goldenwater.dcproj.dto.AttOtherBaseDtos; import cn.com.goldenwater.dcproj.model.AttOtherBase; import cn.com.goldenwater.dcproj.model.BisInspAllObj; import cn.com.goldenwater.dcproj.model.BisInspOtherRgstr; import cn.com.goldenwater.dcproj.param.AttOtherBaseParam; import cn.com.goldenwater.dcproj.service.AttOtherBaseService; import cn.com.goldenwater.core.service.AbstractCrudService; 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 java.util.Date; import java.util.List; /** * @author lune * @date 2019-7-19 */ @Service @Transactional(rollbackFor = Exception.class) public class AttOtherBaseServiceImpl extends AbstractCrudService implements AttOtherBaseService { @Autowired private AttOtherBaseDao attOtherBaseDao; @Autowired private BisInspOtherRgstrDao bisInspOtherRgstrDao; @Autowired private BisInspAllObjDao bisInspAllObjDao; public AttOtherBaseServiceImpl(AttOtherBaseDao attOtherBaseDao) { super(attOtherBaseDao); this.attOtherBaseDao = attOtherBaseDao; } @Override public int insertList(AttOtherBaseDtos dtos) { for (AttOtherBase base : dtos.getBaseList()) { base.setId(UuidUtil.uuid()); attOtherBaseDao.insert(base); } return 1; } @Override public PageInfo getBasePageInfoNotInFsc(AttOtherBaseParam attOtherBaseParam) { PageHelper.startPage(attOtherBaseParam); List list = attOtherBaseDao.getBasePageInfoNotInFsc(attOtherBaseParam); PageInfo pageInfo = new PageInfo<>(list); return pageInfo; } @Override public int updateOtherBase(AttOtherBase attOtherBase) { if (StringUtils.isNotBlank(attOtherBase.getRgstrId())) { BisInspAllObj obj = bisInspAllObjDao.get(attOtherBase.getId()); if (obj != null) { obj.setNm(attOtherBase.getName()); bisInspAllObjDao.update(obj); } BisInspOtherRgstr rgstr = bisInspOtherRgstrDao.get(attOtherBase.getRgstrId()); if (rgstr != null) { rgstr.setName(attOtherBase.getName()); rgstr.setAdCode(attOtherBase.getAdCode()); rgstr.setAdmOrg(attOtherBase.getAdmOrg()); rgstr.setCenterX(attOtherBase.getCenterX()); rgstr.setCenterY(attOtherBase.getCenterY()); rgstr.setType(attOtherBase.getType()); rgstr.setLocation(attOtherBase.getLocation()); rgstr.setUpTm(new Date()); bisInspOtherRgstrDao.updateOtherRgstr(rgstr); } } return attOtherBaseDao.updateOtherBase(attOtherBase); } }