Browse Source

修改支付机构sql

hym 3 years ago
parent
commit
136a060567

+ 8 - 1
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/config/FeignConfig.java

@@ -22,7 +22,14 @@ public class FeignConfig implements RequestInterceptor {
         if(attributes != null){
             HttpServletRequest request = attributes.getRequest();
             if(request != null){
-                requestTemplate.header(HttpHeaders.AUTHORIZATION, request.getHeader(HttpHeaders.AUTHORIZATION));
+                if(request.getHeader(HttpHeaders.AUTHORIZATION)!=null){
+                    requestTemplate.header(HttpHeaders.AUTHORIZATION, request.getHeader(HttpHeaders.AUTHORIZATION));
+                }else {
+                    String token= (String) request.getAttribute("accessToken");
+                    token="Bearer "+token;
+                    requestTemplate.header(HttpHeaders.AUTHORIZATION, token );
+                }
+
             }
         }
     }

+ 4 - 1
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/controller/assistant/InstallPlanController.java

@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.util.Enumeration;
 
 /**
  * Created by ZJY on 2021-01-13 11:30
@@ -28,9 +29,11 @@ public class InstallPlanController {
     @GetMapping("/plan/downTemplate")
     @ApiOperation(value = "计划模板下载", notes = "计划模板下载")
     public void planDownTemplate(
-            @ApiParam(value = "token", required = true) @RequestParam(required = true) String token,
+            @ApiParam(value = "access_token", required = true) @RequestParam(required = true) String access_token,
             HttpServletRequest request, HttpServletResponse response
     ) {
+
+        request.setAttribute("accessToken",access_token);
         installPlanService.planDownTemplate(response);
 
     }

+ 2 - 1
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/controller/pay/archives/PayBaseCustomerandmeterrelaController.java

@@ -212,9 +212,10 @@ public class PayBaseCustomerandmeterrelaController {
     @GetMapping("/downTemplate")
     @ApiOperation(value = "计费系统-下载批量开户Execl模板", notes = "计费系统-下载批量开户Execl模板")
     public void downTemplate(
-            @ApiParam(value = "token", required = true) @RequestParam(required = true) String token,
+            @ApiParam(value = "access_token", required = true) @RequestParam(required = true) String access_token,
             HttpServletRequest request, HttpServletResponse response) {
         //模板下载
+        request.setAttribute("accessToken",access_token);
         payBaseCustomerandmeterrelaService.downTemplate(response);
     }
 

+ 33 - 49
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/excel/resolver/InstallPlanResolverExcelTemplate.java

@@ -51,7 +51,7 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
 
 
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     protected void cycleExcel(){
         log.info("begin InstallPlanResolverExcelTemplate");
         try {
@@ -59,7 +59,7 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
-        String executeSheetName = "装计划模板";
+        String executeSheetName = "装计划模板";
         //InstallListDTO dto = new InstallListDTO();
         //dto.setSiteId(record.getSiteId());
         //dto.setInstallTime(LocalDateTime.now());
@@ -74,12 +74,14 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
             }
             invalidTemplate = true;
             // 1,处理表头,解析客户、小区、户数
-            Cell comapnyNameCell =  hssfSheet.getRow(0).getCell(4);
-            Cell departmentNameCell =  hssfSheet.getRow(1).getCell(4);
-            Cell communityNameCell =  hssfSheet.getRow(2).getCell(4);
-            Cell numberCell = hssfSheet.getRow(3).getCell(4);// 安装数字,只处理指定安装户数的数据
-            Cell installGroupNameCell =  hssfSheet.getRow(4).getCell(4);
-            Cell phoneCell =  hssfSheet.getRow(5).getCell(4);
+            Cell planCell=hssfSheet.getRow(1).getCell(3);
+            Cell comapnyNameCell =  hssfSheet.getRow(2).getCell(3);
+            Cell communityNameCell =  hssfSheet.getRow(3).getCell(3);
+            Cell productCell =  hssfSheet.getRow(4).getCell(3);
+            Cell numberCell=hssfSheet.getRow(5).getCell(3);
+            Cell installGroupNameCell =  hssfSheet.getRow(6).getCell(3);
+
+            Cell phoneCell =  hssfSheet.getRow(7).getCell(3);
             comapnyNameCell.setCellType(CellType.STRING);
             installGroupNameCell.setCellType(CellType.STRING);
             phoneCell.setCellType(CellType.STRING);
@@ -105,26 +107,10 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
                 messageContent.append(ResultStatus.COMMUNITY_IS_NOT_EXISTED.getMessage());
                 continue;
             }
-            Integer departId=null;
-            String departName = departmentNameCell.getStringCellValue().trim();
-            if(!StringUtils.equals("", departName)) {
-                orgDto.setOrgName(departName);
-                departId = syncDataClient.getOrgId(orgDto);
-            }
-            Community community = communityDtos.get(0);
-
-
-
-            numberCell.setCellType(CellType.NUMERIC);
 
-            int number = ((Double)numberCell.getNumericCellValue()).intValue();
-            if(number < 0 || number > 5000) {
-                messageContent.append("导入失败,");
-                messageContent.append(ResultStatus.NUMBER_IS_OUT_RANGE.getMessage());
-                continue;
-            }
+            Community community = communityDtos.get(0);
 
-            log.info("info = {},{},{},{},{}",companyName,community.getName(),number,installGroupNameCell.getStringCellValue(),phoneCell.getStringCellValue());
+            log.info("info = {},{},{},{}",companyName,community.getName(),installGroupNameCell.getStringCellValue(),phoneCell.getStringCellValue());
 
             Integer enableUnit = 0;
             Integer buildingNum = 0;
@@ -136,13 +122,18 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
 
             InstallPlanInputDTO installPlanInput = new InstallPlanInputDTO();
             installPlanInput.setCompanyOrgId(orgId);
-            installPlanInput.setDeptOrgId(departId);
+            numberCell.setCellType(CellType.NUMERIC);
+
+            int number = ((Double)numberCell.getNumericCellValue()).intValue();
+
             installPlanInput.setInstallPlanDataList(new ArrayList<>());
             installPlanInput.setTenantId(record.getLoginUser().getTenantId());
             installPlanInput.setPreInstallNumber(number); //报装客户数
             installPlanInput.setCommunityId(community.getId());
+            String[] deviceType  = StringUtils.split(productCell.getStringCellValue(),"/");
+            Integer productId = syncDataClient.getProductId(deviceType[1], deviceType[2]);
             // 2,处理明细行数据
-            for (int rowNum = 9; rowNum < 9+number ; rowNum++) {
+            for (int rowNum = 10; rowNum <=number+10 ; rowNum++) {
                 Row row = hssfSheet.getRow(rowNum);
                 if (row != null) {
 
@@ -150,18 +141,18 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
                     Cell unitCell = row.getCell(1);
                     Cell floorCell = row.getCell(2);
                     Cell doorNoCell = row.getCell(3);
-                    Cell deviceTypeCell = row.getCell(4);
-                    Cell fileNoCell = row.getCell(5);
-                    Cell userNameCell = row.getCell(6);
-                    Cell userPhoneCell = row.getCell(7);
-                    Cell idCardCell = row.getCell(8);
-                    Cell remarkCell = row.getCell(9);
+
+                    Cell fileNoCell = row.getCell(4);
+                    Cell userNameCell = row.getCell(5);
+                    Cell userPhoneCell = row.getCell(6);
+                    Cell idCardCell = row.getCell(7);
+                    Cell remarkCell = row.getCell(8);
 
                     buildingCell.setCellType(CellType.STRING);
                     unitCell.setCellType(CellType.STRING);
                     floorCell.setCellType(CellType.STRING);
                     doorNoCell.setCellType(CellType.STRING);
-                    deviceTypeCell.setCellType(CellType.STRING);
+
                     fileNoCell.setCellType(CellType.STRING);
                     userNameCell.setCellType(CellType.STRING);
                     userPhoneCell.setCellType(CellType.STRING);
@@ -170,15 +161,15 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
 
                     if (StringUtils.equals("", buildingCell.getStringCellValue().trim()) &&
                             StringUtils.equals("", floorCell.getStringCellValue().trim()) &&
-                            StringUtils.equals("", doorNoCell.getStringCellValue()) &&
-                            StringUtils.equals("", deviceTypeCell.getStringCellValue().trim())
+                            StringUtils.equals("", doorNoCell.getStringCellValue())
+
                     ) {
                         continue;
                     }
 
                     log.info("Row info = building={},unit={},floor={},doorNo={},deviceType={}",buildingCell.getStringCellValue(),unitCell.getStringCellValue(),floorCell.getStringCellValue(),
-                            doorNoCell.getStringCellValue(),deviceTypeCell.getStringCellValue());
-                    //deviceTypeSet.add(deviceTypeCell.getStringCellValue().trim());
+                            doorNoCell.getStringCellValue(),productCell.getStringCellValue());
+
 
 
                     installPlanInput.setCustomerId(customerId);
@@ -191,17 +182,10 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
                     installPlanInput.setCommunityName(communityNameCell.getStringCellValue());//小区
 
                     //设备类型
-                    String str = deviceTypeCell.getStringCellValue().trim();
-                    String[] deviceType  = StringUtils.split(str,"/");
+
+
                     List<Integer> devieTypeId = new ArrayList();
-                    List<DeviceTypeDto> deviceTypeDtos = deviceMapper.findDeivceType();
-                    for(int i=0;i<deviceTypeDtos.size();i++){
-                        if (deviceTypeDtos.get(i).getEquipmentType().equals(deviceType[1])
-                                && deviceTypeDtos.get(i).getModel().equals(deviceType[2])){
-                            devieTypeId.add(deviceTypeDtos.get(i).getId());
-                            break;
-                        }
-                    }
+                    devieTypeId.add(productId);
                     installPlanInput.setDeviceTypeIds(devieTypeId);
 
                     //地址

+ 1 - 1
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/pay/archives/impl/PayBaseCustomerandmeterrelaServiceImpl.java

@@ -1201,7 +1201,7 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
                 return msg;
             }
         }
-        forceCancel(customerId,metercode);
+
         return msg;
     }
 

BIN
zoniot-pay/zoniot-pay-web/src/main/resources/excel/installPlanTemplate.xlsx


+ 3 - 0
zoniot-rmcp/zoniot-rmcp-api/src/main/java/com/zcxk/rmcp/api/feign/SyncDataClient.java

@@ -48,4 +48,7 @@ public interface SyncDataClient {
     @GetMapping("/common/getProductLists")
     @ApiOperation(value = "获取产品列表")
     List<ProductVo> getProductLists();
+    @GetMapping("/common/getProductId")
+    Integer getProductId(@RequestParam("productName") String productName,
+                                @RequestParam("productModel")String productModel);
 }

+ 1 - 1
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/config/ResourceServerConfig.java

@@ -23,7 +23,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
             .antMatchers("/swagger-ui.html","/webjars/**", "/swagger-resources/**",
                     "/file/**","/meter/read/record/list/sync/data","/import/downloadFailFile",
                    "/v2/**","/syncData/**","/meter/read/record/querySettlementWaterConsumption"
-                    ,"/meter/read/record/queryDeviceMeterReadRecordWithCondtion")
+                    ,"/meter/read/record/queryDeviceMeterReadRecordWithCondtion","/common/getProductId")
             .permitAll() //配置不需要身份认证的请求路径
             .anyRequest().authenticated() //其他所有访问路径都需要身份认证
             .and()

+ 9 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/CommonController.java

@@ -7,6 +7,7 @@ import com.zcxk.rmcp.api.vo.OrgTreeVo;
 import com.zcxk.rmcp.api.vo.ProductCategoryVo;
 import com.zcxk.rmcp.core.dao.AreaMapper;
 import com.zcxk.rmcp.core.entity.Org;
+import com.zcxk.rmcp.core.entity.Product;
 import com.zcxk.rmcp.web.service.OrgService;
 import com.zcxk.rmcp.web.service.ProductService;
 import com.zcxk.rmcp.web.util.TreeUtil;
@@ -80,5 +81,13 @@ public class CommonController {
         List<ProductCategoryVo> list = productService.getCategoryList();
         return AjaxMessage.success(list);
     }
+    @GetMapping("getProductId")
+    @ApiOperation(value = "获取产品id")
+    public Integer getProductId(@RequestParam("productName") String productName,
+                                @RequestParam("productModel")String productModel) {
+        Product product = productService.getByName(productName, productModel);
+        return product.getId();
+    }
+
 
 }