xiachuang há 1 ano atrás
pai
commit
73875e7c5e

+ 1 - 0
pom.xml

@@ -925,6 +925,7 @@
         </dependency>
     </dependencies>
 	<build>
+		<finalName>${project.artifactId}</finalName>
 		<defaultGoal>install</defaultGoal>
 		<plugins>
 			<plugin>

+ 3 - 5
src/main/java/com/palmnest/dao/airconditioner/impl/AirConditionerAddTimeOrderHistoryDaoImpl.java

@@ -2,7 +2,6 @@ package com.palmnest.dao.airconditioner.impl;
 
 import com.palmnest.dao.airconditioner.AirConditionerAddTimeOrderHistoryDao;
 import com.palmnest.dao.hibernate.GenericDaoHibernate;
-import com.palmnest.model.airconditioner.AirConditionerAddTimeOrderExtend;
 import com.palmnest.model.airconditioner.AirConditionerAddTimeOrderHistory;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Repository;
@@ -13,7 +12,7 @@ import java.util.List;
  * @author xc
  * @since 2023/8/9 20:08
  */
-@Repository
+@Repository("airConditionerAddTimeOrderHistoryDao")
 public class AirConditionerAddTimeOrderHistoryDaoImpl extends GenericDaoHibernate<AirConditionerAddTimeOrderHistory, Long> implements AirConditionerAddTimeOrderHistoryDao {
 
     private static final Logger logger = Logger.getLogger(AirConditionerAddTimeOrderHistoryDaoImpl.class);
@@ -23,9 +22,8 @@ public class AirConditionerAddTimeOrderHistoryDaoImpl extends GenericDaoHibernat
 
     @Override
     public List<AirConditionerAddTimeOrderHistory> getByOrderNo(String orderNo) {
-        String sql = "select * from tb_airconditioner_addtime_order_history" + "\n" +
-                " where order_no = '" + orderNo + "'";
+        String sql = "select * from tb_airconditioner_addtime_order_history where order_no = ?";
         logger.info("根据空调加时订单获取历史记录 sql: " + sql);
-        return getSession().createSQLQuery(sql).addEntity(AirConditionerAddTimeOrderExtend.class).list();
+        return getSession().createSQLQuery(sql).setString(0, orderNo).list();
     }
 }

+ 3 - 4
src/main/java/com/palmnest/dao/airconditioner/impl/ConditionerAddTimeOrderExtendDaoImpl.java

@@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository;
  * @author xc
  * @since 2023/8/9 09:42
  */
-@Repository
+@Repository("conditionerAddTimeOrderExtendDao")
 public class ConditionerAddTimeOrderExtendDaoImpl extends GenericDaoHibernate<AirConditionerAddTimeOrderExtend, Long> implements ConditionerAddTimeOrderExtendDao {
     private final Logger logger = Logger.getLogger(ConditionerAddTimeOrderExtendDaoImpl.class);
     public ConditionerAddTimeOrderExtendDaoImpl() {
@@ -19,9 +19,8 @@ public class ConditionerAddTimeOrderExtendDaoImpl extends GenericDaoHibernate<Ai
 
     @Override
     public AirConditionerAddTimeOrderExtend getByOrderNo(String orderNo) {
-        String sql = "select * from tb_airconditioner_addtime_order_extend" + "\n" +
-                " where code = '" + orderNo + "'";
+        String sql = "select * from tb_airconditioner_addtime_order_extend where code = ?";
         logger.info("根据空调加时订单获取扩展信息 sql: " + sql);
-        return (AirConditionerAddTimeOrderExtend) getSession().createSQLQuery(sql).addEntity(AirConditionerAddTimeOrderExtend.class).uniqueResult();
+        return (AirConditionerAddTimeOrderExtend) getSession().createSQLQuery(sql).setString(0, orderNo).uniqueResult();
     }
 }

+ 7 - 0
src/main/java/com/palmnest/service/estateserve/airconditioner/ConditionerAddTimeOrderExtendManager.java

@@ -1,12 +1,19 @@
 package com.palmnest.service.estateserve.airconditioner;
 
 import com.palmnest.model.airconditioner.AirConditionerAddTimeOrderExtend;
+import com.palmnest.model.airconditioner.AirConditionerAddTimeOrderHistory;
 import com.palmnest.service.GenericManager;
 
+import java.util.List;
+
 /**
  * @author xc
  * @since 2023/8/8 16:21
  */
 public interface ConditionerAddTimeOrderExtendManager extends GenericManager<AirConditionerAddTimeOrderExtend, Long> {
     AirConditionerAddTimeOrderExtend getByOrderNo(String orderNo);
+
+    void saveHistory(AirConditionerAddTimeOrderHistory build);
+
+    List<AirConditionerAddTimeOrderHistory> getHistoryListByOrderNo(String code);
 }

+ 26 - 1
src/main/java/com/palmnest/service/estateserve/airconditioner/impl/ConditionerAddTimeOrderExtendManagerImpl.java

@@ -1,23 +1,48 @@
 package com.palmnest.service.estateserve.airconditioner.impl;
 
+import com.palmnest.dao.airconditioner.AirConditionerAddTimeOrderHistoryDao;
 import com.palmnest.dao.airconditioner.ConditionerAddTimeOrderExtendDao;
 import com.palmnest.model.airconditioner.AirConditionerAddTimeOrderExtend;
+import com.palmnest.model.airconditioner.AirConditionerAddTimeOrderHistory;
 import com.palmnest.service.estateserve.airconditioner.ConditionerAddTimeOrderExtendManager;
 import com.palmnest.service.impl.GenericManagerImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * @author xc
  * @since 2023/8/9 09:39
  */
 @Service
 public class ConditionerAddTimeOrderExtendManagerImpl extends GenericManagerImpl<AirConditionerAddTimeOrderExtend, Long> implements ConditionerAddTimeOrderExtendManager {
-    @Autowired
     private ConditionerAddTimeOrderExtendDao conditionerAddTimeOrderExtendDao;
+    private AirConditionerAddTimeOrderHistoryDao airConditionerAddTimeOrderHistoryDao;
+
+
+    @Autowired
+    public void setConditionerAddTimeOrderExtendDao(ConditionerAddTimeOrderExtendDao conditionerAddTimeOrderExtendDao) {
+        this.conditionerAddTimeOrderExtendDao = conditionerAddTimeOrderExtendDao;
+    }
+
+    @Autowired
+    public void setAirConditionerAddTimeOrderHistoryDao(AirConditionerAddTimeOrderHistoryDao airConditionerAddTimeOrderHistoryDao) {
+        this.airConditionerAddTimeOrderHistoryDao = airConditionerAddTimeOrderHistoryDao;
+    }
 
     @Override
     public AirConditionerAddTimeOrderExtend getByOrderNo(String orderNo) {
         return conditionerAddTimeOrderExtendDao.getByOrderNo(orderNo);
     }
+
+    @Override
+    public void saveHistory(AirConditionerAddTimeOrderHistory build) {
+        airConditionerAddTimeOrderHistoryDao.save(build);
+    }
+
+    @Override
+    public List<AirConditionerAddTimeOrderHistory> getHistoryListByOrderNo(String code) {
+        return airConditionerAddTimeOrderHistoryDao.getByOrderNo(code);
+    }
 }

+ 2 - 5
src/main/java/com/palmnest/service/estateserve/airconditioner/impl/ConditionerAddTimeServiceImpl.java

@@ -12,7 +12,6 @@ import com.palmnest.application.dto.WechatMessageDto;
 import com.palmnest.application.dto.WxMessageConfigVo;
 import com.palmnest.application.dto.input.*;
 import com.palmnest.application.dto.output.*;
-import com.palmnest.dao.airconditioner.AirConditionerAddTimeOrderHistoryDao;
 import com.palmnest.dao.estateserve.EnterprisePermissionDao;
 import com.palmnest.model.*;
 import com.palmnest.model.airconditioner.*;
@@ -93,8 +92,6 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
     private EnterprisePermissionDao enterprisePermissionDao;
     @Autowired
     private ConditionerAddTimeOrderExtendManager conditionerAddTimeOrderExtendManager;
-    @Autowired
-    private AirConditionerAddTimeOrderHistoryDao airConditionerAddTimeOrderHistoryDao;
 
 
     MathContext mc = new MathContext(2, RoundingMode.HALF_UP);
@@ -2764,7 +2761,7 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
         airConditionerAddTime.setModificationDisabled(order.getModificationDisabled());// 是否关闭修改功能
 
         // 保存修改记录
-        airConditionerAddTimeOrderHistoryDao.save(
+        conditionerAddTimeOrderExtendManager.saveHistory(
                 AirConditionerAddTimeOrderHistory.builder()
                 .orderNo(airConditionerAddTime.getCode())// 订单号
                 .beforeUpdate(history)// 更新前
@@ -2788,7 +2785,7 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
     @Override
     public AirConditionerAddTimeOutWebVO assembleOrderHistory(AirConditionerAddTimeOutDto dto) {
         String code = dto.getCode();// 订单号
-        List<AirConditionerAddTimeOrderHistory> list = airConditionerAddTimeOrderHistoryDao.getByOrderNo(code);
+        List<AirConditionerAddTimeOrderHistory> list = conditionerAddTimeOrderExtendManager.getHistoryListByOrderNo(code);
 
         List<AirConditionerAddTimeHistoryVO> history = new ArrayList<>();