| | |
| | | import cn.gistack.sm.jcsb.service.IDangerReportService; |
| | | import cn.gistack.sm.jcsb.vo.DangerReportVO; |
| | | import cn.gistack.sm.jcsb.vo.StatisticsVO; |
| | | import cn.gistack.sm.sjztmd.entity.AttResBase; |
| | | import cn.gistack.sm.sjztmd.service.IAttResBaseService; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | @Autowired |
| | | private IPwdClient pwdClient; |
| | | @Autowired |
| | | private IAttResBaseService attResBaseService; |
| | | |
| | | @Override |
| | | public List<DangerReportVO> getAll(DangerReport dangerReport) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public boolean saveUp(DangerReport dangerReport) { |
| | | this.save(dangerReport); |
| | | // 填充加密内容 |
| | | DangerReportSUPO dangerReportSUPO = BeanUtil.copy(dangerReport, DangerReportSUPO.class); |
| | | |
| | | // 获取水库名称 |
| | | AttResBase attResBase = attResBaseService.getDetailByCode(dangerReport.getReservoirId()); |
| | | dangerReportSUPO.setReservoirName(attResBase.getName()); |
| | | |
| | | String message = JSONObject.toJSONString(dangerReportSUPO); |
| | | R<CBCResultDTO> cbcResultDTOR = pwdClient.getCBCMacEncipher(message); |
| | | if (cbcResultDTOR.getCode() != 200) { |
| | |
| | | String maced = cbcResultDTOR.getData().getMaced(); |
| | | String keyIndex = cbcResultDTOR.getData().getKeyIndex(); |
| | | String sm4iv = cbcResultDTOR.getData().getSm4IV(); |
| | | DangerReport ympo = new DangerReport(); |
| | | ympo.setId(dangerReport.getId()); |
| | | ympo.setMaced(maced); |
| | | ympo.setKeyindexs(keyIndex); |
| | | ympo.setSm4iv(sm4iv); |
| | | dangerReport.setMaced(maced); |
| | | dangerReport.setKeyindexs(keyIndex); |
| | | dangerReport.setSm4iv(sm4iv); |
| | | R<ResultDTO> resultDTOR = pwdClient.getEncrypt(sm4iv, keyIndex, message); |
| | | if (resultDTOR.getCode() != 200) { |
| | | return false; |
| | | } |
| | | ympo.setEncdata(resultDTOR.getData().getData()); |
| | | dangerReport.setEncdata(resultDTOR.getData().getData()); |
| | | |
| | | return this.updateById(ympo); |
| | | return this.save(dangerReport); |
| | | } |
| | | |
| | | } |