Przeglądaj źródła

sz 流水信息创建等功能

xiao547607 5 lat temu
rodzic
commit
fdc39a164b

+ 9 - 4
src/main/java/com/jpsoft/epay/modules/base/controller/RechargeRecordController.java

@@ -244,8 +244,7 @@ public class RechargeRecordController {
         MessageResult<RechargeRecord> msgResult = new MessageResult<>();
         try {
 
-
-            ElectricClientInfo clientInfo = electricClientInfoService.findOneByRoomId(rechargeRecord.getRoomId());
+            ElectricClientInfo clientInfo = electricClientInfoService.get(rechargeRecord.getClientId());
 
             if(clientInfo==null){
                 throw new Exception("该房间没有绑定电表!");
@@ -327,12 +326,17 @@ public class RechargeRecordController {
 
     @ApiOperation(value="线下充值前查询房间信息")
     @GetMapping("queryRoomMessage/{clientId}")
-    public MessageResult<Map<String,Object>> queryRoomMessage(@PathVariable("clientId") String clientId,@RequestAttribute String subject){
+    public MessageResult<Map<String,Object>> queryRoomMessage(@PathVariable("clientId") String clientId,@RequestAttribute String subject) throws Exception {
         MessageResult<Map<String,Object>> msgResult = new MessageResult<>();
 
         ElectricClientInfo clientInfo = electricClientInfoService.getRoomMessage(clientId);        //充值类型
-        Map<String,Object> resultMaps = new HashMap();
 
+        if (clientInfo==null){
+            throw new Exception("该房间绑定电表!");
+        }
+
+        Map<String,Object> resultMaps = new HashMap();
+        resultMaps.put("roomId",clientInfo.getRoomId());
         resultMaps.put("useTypeN",clientInfo.getRoomUseTypeN());//中文翻译
         resultMaps.put("useTypeV",clientInfo.getRoomUseTypeV());//值
 
@@ -369,4 +373,5 @@ public class RechargeRecordController {
         return msgResult;
     }
 
+
 }

+ 5 - 3
src/main/java/com/jpsoft/epay/modules/base/dao/RechargeRecordDAO.java

@@ -1,10 +1,11 @@
 package com.jpsoft.epay.modules.base.dao;
 
-import java.util.List;
-import org.springframework.stereotype.Repository;
 import com.jpsoft.epay.modules.base.entity.RechargeRecord;
-import java.util.Map;
 import com.jpsoft.epay.modules.common.dto.Sort;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
 
 @Repository
 public interface RechargeRecordDAO {
@@ -13,6 +14,7 @@ public interface RechargeRecordDAO {
 	int exist(String id);
 	RechargeRecord get(String id);
 	int delete(String id);
+	RechargeRecord getBySerialNum(String erialNum);
 	List<RechargeRecord> list();
 	List<RechargeRecord> search(Map<String, Object> searchParams, List<Sort> sortList);
 }

+ 5 - 3
src/main/java/com/jpsoft/epay/modules/base/service/RechargeRecordService.java

@@ -1,17 +1,19 @@
 package com.jpsoft.epay.modules.base.service;
 
-import java.util.List;
-import java.util.Map;
-import com.jpsoft.epay.modules.base.entity.RechargeRecord;
 import com.github.pagehelper.Page;
+import com.jpsoft.epay.modules.base.entity.RechargeRecord;
 import com.jpsoft.epay.modules.common.dto.Sort;
 
+import java.util.List;
+import java.util.Map;
+
 public interface RechargeRecordService {
 	RechargeRecord get(String id);
 	boolean exist(String id);
 	int insert(RechargeRecord model);
 	int update(RechargeRecord model);
 	int delete(String id);
+	RechargeRecord getBySerialNum(String erialNum);
 	List<RechargeRecord> list();
 	Page<RechargeRecord> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, List<Sort> sortList);
 }

+ 6 - 1
src/main/java/com/jpsoft/epay/modules/base/service/impl/RechargeRecordServiceImpl.java

@@ -52,7 +52,12 @@ public class RechargeRecordServiceImpl implements RechargeRecordService {
 		
 		return count > 0 ? true : false;
 	}
-	
+
+	@Override
+	public RechargeRecord getBySerialNum(String erialNum){
+		return rechargeRecordDAO.getBySerialNum(erialNum);
+	}
+
 	@Override
 	public List<RechargeRecord> list() {
 		// TODO Auto-generated method stub

+ 33 - 10
src/main/java/com/jpsoft/epay/modules/business/controller/MobileApiController.java

@@ -1,18 +1,12 @@
 package com.jpsoft.epay.modules.business.controller;
 
-import com.jpsoft.epay.modules.base.entity.ElectricClientInfo;
-import com.jpsoft.epay.modules.base.entity.ElectricMeterInfo;
+import com.jpsoft.epay.modules.base.entity.RechargeRecord;
 import com.jpsoft.epay.modules.base.entity.RoomInfo;
-import com.jpsoft.epay.modules.base.entity.TerminalInfo;
-import com.jpsoft.epay.modules.base.service.ElectricClientInfoService;
-import com.jpsoft.epay.modules.base.service.ElectricMeterInfoService;
+import com.jpsoft.epay.modules.base.service.RechargeRecordService;
 import com.jpsoft.epay.modules.base.service.RoomInfoService;
-import com.jpsoft.epay.modules.base.service.TerminalInfoService;
 import com.jpsoft.epay.modules.business.service.RechargeService;
 import com.jpsoft.epay.modules.common.dto.MessageResult;
-import com.jpsoft.epay.modules.communication.server.ChannelWrapper;
 import com.jpsoft.epay.modules.communication.server.protocol.MeterReceivePacket;
-import com.jpsoft.epay.modules.communication.server.protocol.MeterSendPacket;
 import com.jpsoft.epay.modules.sys.entity.DataDictionary;
 import com.jpsoft.epay.modules.sys.service.DataDictionaryService;
 import io.swagger.annotations.ApiImplicitParam;
@@ -20,9 +14,10 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -38,6 +33,10 @@ public class MobileApiController {
     @Autowired
     private RechargeService rechargeService;
 
+    @Autowired
+    private RechargeRecordService rechargeRecordService;
+
+
     @Autowired
     private DataDictionaryService dataDictionaryService;
 
@@ -130,4 +129,28 @@ public class MobileApiController {
 
         return msgResult;
     }
+
+    @GetMapping(value="queryRecordDetail")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="serialNum",value="交易流水号",dataType="string",paramType = "query")
+    })
+    public MessageResult<RechargeRecord> queryRecordDetail(String serialNum) {
+        MessageResult<RechargeRecord> msgResult = new MessageResult<>();
+
+        try {
+            Map<String,Object> map = new HashMap<>();
+            RechargeRecord rechargeRecord = rechargeRecordService.getBySerialNum(serialNum);
+
+            msgResult.setData(rechargeRecord);
+            msgResult.setResult(true);
+        } catch (Exception e) {
+            msgResult.setResult(false);
+            msgResult.setCode(500);
+            msgResult.setMessage(e.getMessage());
+
+            log.error(e.getMessage(),e);
+        }
+
+        return msgResult;
+    }
 }

+ 4 - 0
src/main/resources/mapper/base/RechargeRecord.xml

@@ -151,4 +151,8 @@
 	        ${sort.name} ${sort.order}
 	 	</foreach>
 	</select>
+
+	<select id="getBySerialNum" resultMap="RechargeRecordMap">
+		select * from base_recharge_record where serial_number=#{serialNum} and del_flag=0 limit 1
+	</select>
 </mapper>