| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Domaincatalog |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.DomaincatalogMapper |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.common.utils.UUIDGenerator |
| | | import cn.flightfeather.supervision.domain.ds1.entity.* |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.* |
| | | import cn.flightfeather.supervision.lightshare.service.DomaincatalogService |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import cn.flightfeather.supervision.lightshare.vo.DomaincatalogVo |
| | | import org.springframework.beans.BeanUtils |
| | | import org.springframework.stereotype.Service |
| | | import org.springframework.transaction.annotation.Transactional |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.util.* |
| | | |
| | | @Service |
| | | class DomaincatalogServiceImpl(val domaincatalogMapper: DomaincatalogMapper) : DomaincatalogService { |
| | | class DomaincatalogServiceImpl( |
| | | private val domaincatalogMapper: DomaincatalogMapper, |
| | | private val problemtypeMapper: ProblemtypeMapper, |
| | | private val changeAdviceMapper: ChangeAdviceMapper, |
| | | private val evaluationruleMapper: EvaluationruleMapper, |
| | | private val evaluationsubruleMapper: EvaluationsubruleMapper, |
| | | ) : DomaincatalogService { |
| | | //根据name查询 |
| | | override fun findOneByName(name: String): Domaincatalog? { |
| | | val domaincatalog = Domaincatalog() |
| | |
| | | override fun update(domaincatalog: Domaincatalog): Int = domaincatalogMapper.updateByPrimaryKey(domaincatalog) |
| | | |
| | | override fun delete(id: String): Int = domaincatalogMapper.deleteByPrimaryKey(id) |
| | | |
| | | @Transactional |
| | | override fun quickConfiguration( |
| | | target: Constant.SceneType, |
| | | targetArea: AreaVo, |
| | | source: Constant.SceneType, |
| | | sourceArea: AreaVo, |
| | | ): Boolean { |
| | | //1. 问题类型和整改建议 |
| | | val adviceList = changeAdviceMapper.selectByExample(Example(ChangeAdvice::class.java).apply { |
| | | createCriteria().andEqualTo("adExtension1", sourceArea.districtname) |
| | | .andEqualTo("adExtension2", source.text) |
| | | }) |
| | | problemtypeMapper.selectByExample(Example(Problemtype::class.java).apply { |
| | | createCriteria().andEqualTo("scensetypeid", source.value.toByte()) |
| | | .andEqualTo("districtname", sourceArea.districtname) |
| | | }).forEach { |
| | | val newProblemGuid = UUIDGenerator.generate16ShortUUID() |
| | | adviceList.find { ad -> ad.adProblemtypeguid == it.guid }?.let { ad -> |
| | | ad.adGuid = UUIDGenerator.generate16ShortUUID() |
| | | ad.adProblemtypeguid = newProblemGuid |
| | | ad.adCreatedate = Date() |
| | | ad.adUpdatedate = Date() |
| | | ad.adExtension1 = targetArea.districtname |
| | | ad.adExtension2 = target.text |
| | | changeAdviceMapper.insert(ad) |
| | | } |
| | | |
| | | it.guid = newProblemGuid |
| | | it.scensetypeid = target.value.toByte() |
| | | it.scensetype = target.text |
| | | it.createdate = Date() |
| | | it.updatedate = Date() |
| | | it.provincecode = targetArea.provincecode |
| | | it.provincename = targetArea.provincename |
| | | it.citycode = targetArea.citycode |
| | | it.cityname = targetArea.cityname |
| | | it.districtcode = targetArea.districtcode |
| | | it.districtname = targetArea.districtname |
| | | |
| | | problemtypeMapper.insert(it) |
| | | } |
| | | |
| | | return true |
| | | |
| | | //2. 问题位置(默认工地,可不修改) |
| | | //3. 自评规则表 |
| | | // evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply { |
| | | // createCriteria().andEqualTo("tasktypeid", 99) |
| | | // .andEqualTo("scensetypeid", source.value) |
| | | // and(createCriteria().orEqualTo("provincecode", sourceArea.provincecode).orIsNull("provincecode")) |
| | | // and(createCriteria().orEqualTo("citycode", sourceArea.citycode).orIsNull("citycode")) |
| | | // and(createCriteria().orEqualTo("districtcode", sourceArea.districtcode).orIsNull("districtcode")) |
| | | // and(createCriteria().orEqualTo("towncode", sourceArea.towncode).orIsNull("towncode")) |
| | | // }).takeIf { it.isNotEmpty() }?.get(0).let {sourceRule -> |
| | | // if (sourceRule != null) { |
| | | // evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule::class.java).apply { |
| | | // createCriteria().andEqualTo("", sourceRule) |
| | | // }) |
| | | // } |
| | | // } |
| | | } |
| | | } |