From c70b92da60c0d00625da5fc2369b475e69e0b88e Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期四, 22 八月 2024 11:36:41 +0800 Subject: [PATCH] 1、完善代码和application.yml配置文件,去掉不用的引入文件; 2、init-config.xml配置中增加属性 enable,相应解析类也增加了解析与判断; 3、凡是有Server的应用,加载资源方式改为用springboot的工具类加载; 4、通信协议相关的扫描注解功能实现改为采用reflections-0.10.2,以实现可以在jar包情况下能够扫描类(.class)注解。 --- pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/dbSv/DbSv.java | 200 ++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 154 insertions(+), 46 deletions(-) diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/dbSv/DbSv.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/dbSv/DbSv.java index a83efff..4c6687c 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/dbSv/DbSv.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/dbSv/DbSv.java @@ -1,18 +1,17 @@ package com.dy.rtuMw.server.rtuData.dbSv; import com.dy.common.util.NumUtil; -import com.dy.common.webUtil.BaseResponseUtils; -import com.dy.pipIrrGlobal.daoBa.BaClientMapper; import com.dy.pipIrrGlobal.daoPr.PrControllerMapper; import com.dy.pipIrrGlobal.daoPr.PrControllerTrampMapper; import com.dy.pipIrrGlobal.daoRm.*; import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; -import com.dy.pipIrrGlobal.pojoBa.BaClient; import com.dy.pipIrrGlobal.pojoPr.PrController; import com.dy.pipIrrGlobal.pojoPr.PrControllerTramp; import com.dy.pipIrrGlobal.pojoRm.*; import com.dy.pipIrrGlobal.pojoSe.SeClient; +import com.dy.pipIrrGlobal.pojoSe.SeClientCard; +import com.dy.pipIrrGlobal.voSe.VoCardInfo1; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -30,9 +29,9 @@ @Service() public class DbSv { @Autowired - private SeClientCardMapper seClientCardMapperDao;//鍐滄埛姘村崱DAO + private SeClientCardMapper seClientCardDao;//鍐滄埛姘村崱DAO @Autowired - private SeVirtualCardMapper seVirtualCardMapper;//鍐滄埛铏氭嫙姘村崱DAO + private SeVirtualCardMapper seVirtualCardDao ;//铏氭嫙鍗$浉鍏矰AO @Autowired private PrControllerTrampMapper prControllerTrampMapperDao;//娴佹氮鎺у埗鍣―AO @Autowired @@ -50,17 +49,19 @@ @Autowired private RmWorkReportHistoryMapper rmWorkReportHistoryMapperDao ;//鎺у埗鍣ㄥ巻鍙插伐浣滄姤鏁版嵁DAO @Autowired - private RmIntakeAmountDayLastMapper rmIntakeAmountDayLastMapperDao ;//鍙栨按鍙e彇姘村拰婕忔崯缁熻鏈�鏂版暟鎹瓺AO + private RmIntakeAmountDayLastMapper rmIntakeAmountDayLastMapperDao ;//鍙栨按鍙e彇姘寸粺璁℃渶鏂版暟鎹瓺AO @Autowired private RmIntakeAmountDayMapper rmIntakeAmountDayMapperDao ;//鍙栨按鍙e彇姘村拰婕忔崯缁熻DAO @Autowired - private RmLossLastMapper rmLossLastMapperDao ;//鎺у埗鍣ㄦ紡鎹熸按閲忕粺璁℃渶鏂版暟鎹瓺AO + private RmClientAmountDayLastMapper rmClientAmountDayLastMapperDao ;//鍐滄埛鏃ョ敤姘撮噺缁熻鏈�鏂版暟鎹瓺AO @Autowired - private RmLossHistoryMapper rmLossHistoryMapperDao ;//鎺у埗鍣ㄦ紡鎹熸按閲忕粺璁″巻鍙叉暟鎹瓺AO + private RmClientAmountDayMapper rmClientAmountDayMapperDao ;//鍐滄埛鏃ョ敤姘撮噺缁熻鏁版嵁DAO + @Autowired + private RmLossDayLastMapper rmLossLastMapperDao ;//鎺у埗鍣ㄦ紡鎹熸按閲忕粺璁℃渶鏂版暟鎹瓺AO + @Autowired + private RmLossDayMapper rmLossHistoryMapperDao ;//鎺у埗鍣ㄦ紡鎹熸按閲忕粺璁″巻鍙叉暟鎹瓺AO @Autowired private RmCommandHistoryMapper rmCommandHistoryDao ;//杩滅▼鍛戒护鏃ュ織鐩稿叧 - @Autowired - private SeVirtualCardMapper seVirtualCardDao ;//铏氭嫙鍗$浉鍏� @Autowired private RmTimingReportHistoryMapper rmTimingReportHistoryDao; // 瀹氱偣涓婃姤鍘嗗彶鏁版嵁DAO @@ -71,6 +72,7 @@ private RmOnHourReportHistoryMapper rmOnHourReportHistoryDao; // 鏁寸偣涓婃姤鍘嗗彶鏁版嵁DAO @Autowired private RmOnHourReportLastMapper rmOnHourReportLastDao; // 鏁寸偣涓婃姤鏈�鏂版暟鎹瓺AO + //@Autowired //@Lazy @@ -92,7 +94,7 @@ SeClient vo = null ; if(NumUtil.isPlusIntNumber(icCardNo)){ Long icCardNoLong = Long.parseLong(icCardNo) ; - Map<String, Object> map = seClientCardMapperDao.getClientIdAndNameByCardAddrAndCardNo(icCardAddr, icCardNoLong) ; + Map<String, Object> map = seClientCardDao.getClientIdAndNameByCardAddrAndCardNo(icCardAddr, icCardNoLong) ; if(map != null && map.size() > 0) { vo = new SeClient() ; vo.setId(Long.parseLong(map.get("clientId").toString())); @@ -110,7 +112,7 @@ SeClient vo = null ; if(NumUtil.isPlusIntNumber(icCardNo)){ Long icCardNoLong = Long.parseLong(icCardNo) ; - Map<String, Object> map = seVirtualCardMapper.getClientIdAndNameByVsCardNo(icCardNoLong) ; + Map<String, Object> map = seVirtualCardDao.getClientIdAndNameByVsCardNo(icCardNoLong) ; if(map != null && map.size() > 0) { vo = new SeClient() ; vo.setId(Long.parseLong(map.get("clientId").toString())); @@ -417,7 +419,7 @@ // //////////////////////////////////////////////// /** - * 寰楀埌鎺у埗鍣ㄦ紡鎹熸按閲忕粺璁℃渶鏂拌褰� + * 寰楀埌鏈�鏂拌褰� * @param intakeId * @return */ @@ -429,7 +431,7 @@ return null ; } /** - * 淇濆瓨鎺у埗鍣ㄦ紡鎹熸按閲忕粺璁℃渶鏂拌褰� + * 淇濆瓨鏈�鏂拌褰� * @param po */ @Transactional(rollbackFor = Exception.class) @@ -437,7 +439,7 @@ this.rmIntakeAmountDayLastMapperDao.insert(po) ; } /** - * 淇濆瓨鎺у埗鍣ㄦ紡鎹熸按閲忕粺璁℃渶鏂拌褰� + * 淇濆瓨璁板綍 * @param po */ @Transactional(rollbackFor = Exception.class) @@ -445,15 +447,15 @@ this.rmIntakeAmountDayMapperDao.insert(po) ; } /** - * 淇濆瓨鎺у埗鍣ㄦ紡鎹熸按閲忕粺璁℃渶鏂拌褰� + * 淇濆瓨鏈�鏂拌褰� * @param po */ @Transactional(rollbackFor = Exception.class) - public void updateRmIntakeAmountLast(RmIntakeAmountDay po){ - this.rmIntakeAmountDayMapperDao.updateByPrimaryKey(po) ; + public void updateRmIntakeAmountLast(RmIntakeAmountDayLast po){ + this.rmIntakeAmountDayLastMapperDao.updateByPrimaryKey(po) ; } /** - * 淇濆瓨鎺у埗鍣ㄦ紡鎹熸按閲忕粺璁℃渶鏂拌褰� + * 淇濆瓨鍘嗗彶璁板綍 * @param po */ @Transactional(rollbackFor = Exception.class) @@ -462,7 +464,7 @@ } /** - * 寰楀埌鎺у埗鍣ㄦ紡鎹熸按閲忕粺璁″巻鍙茶褰曚腑鐨勬渶鏂拌褰� + * 寰楀埌绗﹀悎鏉′欢鐨勫巻鍙茶褰� * @param id * @return */ @@ -470,32 +472,80 @@ return rmIntakeAmountDayMapperDao.selectByPrimaryKey(id) ; } + ///////////////////////////////////////////////// + // + // 鍐滄埛鏃ョ敤姘撮噺鍙婅姳璐圭粺璁″姛鑳� + // + //////////////////////////////////////////////// + /** + * 寰楀埌鏈�鏂拌褰� + * @param clientId + * @return + */ + public RmClientAmountDayLast getRmClientAmountLast(Long clientId){ + List<RmClientAmountDayLast> list = rmClientAmountDayLastMapperDao.selectByClientId(clientId) ; + if(list != null && list.size() > 0){ + return list.get(0) ; + } + return null ; + } + /** + * 淇濆瓨鏈�鏂拌褰� + * @param po + */ + @Transactional(rollbackFor = Exception.class) + public void saveRmClientAmountLast(RmClientAmountDayLast po){ + this.rmClientAmountDayLastMapperDao.insert(po) ; + } + /** + * 淇濆瓨璁板綍 + * @param po + */ + @Transactional(rollbackFor = Exception.class) + public void saveRmClientAmountDay(RmClientAmountDay po){ + this.rmClientAmountDayMapperDao.insert(po) ; + } + /** + * 鏇存柊鏈�鏂拌褰� + * @param po + */ + @Transactional(rollbackFor = Exception.class) + public void updateRmClientAmountLast(RmClientAmountDayLast po){ + this.rmClientAmountDayLastMapperDao.updateByPrimaryKey(po) ; + } + /** + * 鏇存柊璁板綍 + * @param po + */ + @Transactional(rollbackFor = Exception.class) + public void updateRmClientAmountDay(RmClientAmountDay po){ + this.rmClientAmountDayMapperDao.updateByPrimaryKey(po) ; + } /** - * 寰楀埌鎺у埗鍣ㄦ紡鎹熸按閲忕粺璁℃渶鏂拌褰� + * 寰楀埌绗﹀悎鏉′欢鐨勫巻鍙茶褰� + * @param id + * @return + */ + public RmClientAmountDay getRmClientAmountDay(Long id){ + return rmClientAmountDayMapperDao.selectByPrimaryKey(id) ; + } + + + /** + * 寰楀埌绗﹀悎鏉′欢鐨勫巻鍙茶褰� + * @param clientId * @param dt * @return */ - public RmIntakeAmountDay getRmIntakeAmountLastByDate(Date dt){ - List<RmIntakeAmountDay> list = rmIntakeAmountDayMapperDao.selectByDate(dt) ; + public RmClientAmountDay getRmClientAmountByClientAndDate(Long clientId, Date dt){ + List<RmClientAmountDay> list = rmClientAmountDayMapperDao.selectByClientAndDate(clientId, dt) ; if(list != null && list.size() > 0){ return list.get(0) ; } return null ; } - /** - * 寰楀埌鎺у埗鍣ㄦ紡鎹熸按閲忕粺璁″巻鍙茶褰曚腑鐨勬煇鏃ヨ褰� - * @param dt - * @return - */ - public RmIntakeAmountDay getRmIntakeAmountDayByDate(Date dt){ - List<RmIntakeAmountDay> list = rmIntakeAmountDayMapperDao.selectByDate(dt) ; - if(list != null && list.size() > 0){ - return list.get(0) ; - } - return null ; - } ///////////////////////////////////////////////// // @@ -507,8 +557,8 @@ * @param intakeId * @return */ - public RmLossLast getRmLossLast(Long intakeId){ - List<RmLossLast> list = rmLossLastMapperDao.selectByIntakeId(intakeId) ; + public RmLossDayLast getRmLossLast(Long intakeId){ + List<RmLossDayLast> list = rmLossLastMapperDao.selectByIntakeId(intakeId) ; if(list != null && list.size() > 0){ return list.get(0) ; } @@ -519,7 +569,7 @@ * @param po */ @Transactional(rollbackFor = Exception.class) - public void saveRmLossLast(RmLossLast po){ + public void saveRmLossLast(RmLossDayLast po){ this.rmLossLastMapperDao.insert(po) ; } /** @@ -527,7 +577,7 @@ * @param po */ @Transactional(rollbackFor = Exception.class) - public void saveRmLossHistory(RmLossHistory po){ + public void saveRmLossHistory(RmLossDay po){ this.rmLossHistoryMapperDao.insert(po) ; } /** @@ -535,7 +585,7 @@ * @param po */ @Transactional(rollbackFor = Exception.class) - public void updateRmLossLast(RmLossLast po){ + public void updateRmLossLast(RmLossDayLast po){ this.rmLossLastMapperDao.updateByPrimaryKey(po) ; } /** @@ -543,7 +593,7 @@ * @param po */ @Transactional(rollbackFor = Exception.class) - public void updateRmLossHistory(RmLossHistory po){ + public void updateRmLossHistory(RmLossDay po){ this.rmLossHistoryMapperDao.updateByPrimaryKey(po) ; } @@ -552,7 +602,7 @@ * @param id * @return */ - public RmLossHistory getRmLossHistory(Long id){ + public RmLossDay getRmLossHistory(Long id){ return rmLossHistoryMapperDao.selectByPrimaryKey(id) ; } @@ -562,8 +612,8 @@ * @param dt * @return */ - public RmLossLast getRmLossLastByDate(Date dt){ - List<RmLossLast> list = rmLossLastMapperDao.selectByDate(dt) ; + public RmLossDayLast getRmLossLastByDate(Date dt){ + List<RmLossDayLast> list = rmLossLastMapperDao.selectByDate(dt) ; if(list != null && list.size() > 0){ return list.get(0) ; } @@ -575,12 +625,69 @@ * @param dt * @return */ - public RmLossHistory getRmLossHistoryByDate(Date dt){ - List<RmLossHistory> list = rmLossHistoryMapperDao.selectByDate(dt) ; + public RmLossDay getRmLossHistoryByDate(Date dt){ + List<RmLossDay> list = rmLossHistoryMapperDao.selectByDate(dt) ; if(list != null && list.size() > 0){ return list.get(0) ; } return null ; + } + + ////////////////////////////////////////////////////// + // + // IC鍗$浉鍏� + // + ////////////////////////////////////////////////////// + /** + * 寰楀埌鍐滄埛鍗� + * @param cardAddr + * @param cardNo + * @return + */ + public VoCardInfo1 getIcCard(String cardAddr, String cardNo){ + if(NumUtil.isPlusIntNumber(cardNo)){ + Long icCardNoLong = Long.parseLong(cardNo) ; + List<VoCardInfo1> list = seClientCardDao.getCardsByAddrAndNum(cardAddr, icCardNoLong) ; + if(list != null && list.size() > 0){ + return list.get(0) ; + } + } + return null ; + } + /** + * 寰楀埌鍐滄埛铏氭嫙鍗� + * @param cardNo + * @return + */ + public VoCardInfo1 getVirIcCard(String cardNo){ + if(NumUtil.isPlusIntNumber(cardNo)){ + Long icCardNoLong = Long.parseLong(cardNo) ; + List<VoCardInfo1> list = seVirtualCardDao.getCardsByNum(icCardNoLong) ; + if(list != null && list.size() > 0){ + return list.get(0) ; + } + } + return null ; + } + + /** + * 鏇存柊瀹炰綋鍗″墿浣欓噾棰� + * @param id + * @param remainMoney + */ + @Transactional(rollbackFor = Exception.class) + public void updateIcCardRemainMoney(Long id , Double remainMoney){ + seClientCardDao.updateMoney(id,remainMoney); + } + + /** + * 鏇存柊铏氭嫙鍗″墿浣欓噾棰� + * @param id + * @param remainMoney + */ + @Transactional(rollbackFor = Exception.class) + public void updateVirIcCardRemainMoney(Long id , Double remainMoney){ + seVirtualCardDao.updateMoney(id,remainMoney); } ////////////////////////////////////////////////////// @@ -591,6 +698,7 @@ public RmCommandHistory getCommandLog(String commandId){ return rmCommandHistoryDao.selectByPrimaryKey(Long.parseLong(commandId)) ; } + @Transactional(rollbackFor = Exception.class) public void updateCommandLog(RmCommandHistory po){ rmCommandHistoryDao.updateByPrimaryKey(po) ; } -- Gitblit v1.8.0