LAPTOP-FO2T5SIU\35838 6 months ago
parent
commit
1a29d1d618

+ 36 - 35
pro-base/src/main/java/com/idea/buildManage/service/MnpBuildingService.java

@@ -247,30 +247,31 @@ public class MnpBuildingService implements BaseService<MnpBuilding, MnpBuildingE
         record.setId(id);
         int result = insertWithoutId(record);
 
-//        try {
-//            JSONObject json = new JSONObject();
-//            json.put("srcsystemid", id);
-//            json.put("code", id);
-//            json.put("name", record.getBuildNum());
-//            json.put("pk_org", InvoiceUtil.pk_org);
-//            json.put("pk_defdoclist", InvoiceUtil.pk_defdoclist_build);
-//            // 给nc推送载体数据
-//            String resultJson = InvoiceUtil.defdocAdd(json);
-//            JSONObject jsonObject = JSONObject.parseObject(resultJson);
-//            String success = jsonObject.getString("success");
-//            if (success.equals("true")) {
-//                JSONObject data = jsonObject.getJSONObject("data");
-//                String code = data.getString("code");
-//                String ncid = data.getString("ncid");
-//                MnpBuilding model = new MnpBuilding();
-//                model.setId(id);
-//                model.setNcid(ncid);
-//                model.setNcCode(code);
-//                updateByPrimaryKeySelective(model);
-//            }
-//        } catch (Exception e) {
-//            log.error("推送载体失败", e);
-//        }
+        try {
+            JSONObject json = new JSONObject();
+            json.put("srcsystemid", id);
+            json.put("code", id);
+            json.put("name", record.getBuildNum());
+            json.put("pk_org", InvoiceUtil.pk_org);
+            json.put("pk_defdoclist", InvoiceUtil.pk_defdoclist_build);
+            log.info("推送载体详情:{}", json.toJSONString());
+            // 给nc推送载体数据
+            String resultJson = InvoiceUtil.defdocAdd(json);
+            JSONObject jsonObject = JSONObject.parseObject(resultJson);
+            String success = jsonObject.getString("success");
+            if (success.equals("true")) {
+                JSONObject data = jsonObject.getJSONObject("data");
+                String code = data.getString("code");
+                String ncid = data.getString("ncid");
+                MnpBuilding model = new MnpBuilding();
+                model.setId(id);
+                model.setNcid(ncid);
+                model.setNcCode(code);
+                updateByPrimaryKeySelective(model);
+            }
+        } catch (Exception e) {
+            log.error("推送载体失败", e);
+        }
 
         return result;
     }
@@ -279,17 +280,17 @@ public class MnpBuildingService implements BaseService<MnpBuilding, MnpBuildingE
 
         int result = updateByPrimaryKeySelective(model);
 
-//        try {
-//            MnpBuilding building = selectByPrimaryKey(model.getId());
-//            JSONObject json = new JSONObject();
-//            json.put("ncid", building.getNcid());
-//            json.put("code", building.getNcCode());
-//            json.put("name", building.getBuildNum());
-//            // 给nc推送修改载体数据
-//            InvoiceUtil.defdocUpdate(json);
-//        }catch (Exception e){
-//            log.error("推送修改载体失败",e);
-//        }
+        try {
+            MnpBuilding building = selectByPrimaryKey(model.getId());
+            JSONObject json = new JSONObject();
+            json.put("ncid", building.getNcid());
+            json.put("code", building.getNcCode());
+            json.put("name", building.getBuildNum());
+            // 给nc推送修改载体数据
+            InvoiceUtil.defdocUpdate(json);
+        }catch (Exception e){
+            log.error("推送修改载体失败",e);
+        }
 
         return result;
     }

+ 41 - 40
pro-base/src/main/java/com/idea/buildManage/service/ParkRoomService.java

@@ -159,17 +159,18 @@ public class ParkRoomService implements BaseService<ParkRoom, ParkRoomExample> {
 
         model.setUpdatedAt(new Date());
         model.setUpdatedId(ShiroUtils.getUserId());
-//        try {
-//            ParkRoom parkRoom = selectByPrimaryKey(model.getId());
-//            JSONObject json = new JSONObject();
-//            json.put("ncid", parkRoom.getNcid());
-//            json.put("code", parkRoom.getNcCode());
-//            json.put("name", parkRoom.getRoomNo());
-//            // 给nc推送修改载体数据
-//            InvoiceUtil.defdocUpdate(json);
-//        }catch (Exception e){
-//            log.error("推送修改房间失败",e);
-//        }
+        try {
+            ParkRoom parkRoom = selectByPrimaryKey(model.getId());
+            JSONObject json = new JSONObject();
+            json.put("ncid", parkRoom.getNcid());
+            json.put("code", parkRoom.getNcCode());
+            json.put("name", parkRoom.getRoomNo());
+            log.info("推送房间修改详情:{}", json.toJSONString());
+            // 给nc推送修改载体数据
+            InvoiceUtil.defdocUpdate(json);
+        }catch (Exception e){
+            log.error("推送修改房间失败",e);
+        }
         return updateByPrimaryKeySelective(model);
     }
 
@@ -302,35 +303,35 @@ public class ParkRoomService implements BaseService<ParkRoom, ParkRoomExample> {
         record.setOrderNum(orderNum);
         int result = insertWithoutId(record);
 
-//        try {
-//            ParkInfo parkInfo = parkInfoService.selectByPrimaryKey(record.getGroupId());
-//            ParkFloorDisc parkFloorDisc = floorDiscService.selectByPrimaryKey(record.getDiscId());
-//            MnpBuilding mnpBuilding = buildingService.selectByPrimaryKey(record.getBuildId());
-//            String name = parkInfo.getGroupName() + "-" + parkFloorDisc.getName() + "-" + mnpBuilding.getBuildNum()
-//                    + "-" + record.getRoomNo();
-//            JSONObject json = new JSONObject();
-//            json.put("srcsystemid", id);
-//            json.put("code", id);
-//            json.put("name", name);
-//            json.put("pk_org", InvoiceUtil.pk_org);
-//            json.put("pk_defdoclist", InvoiceUtil.pk_defdoclist_room);
-//            // 给nc推送房间数据
-//            String resultJson = InvoiceUtil.defdocAdd(json);
-//            JSONObject jsonObject = JSONObject.parseObject(resultJson);
-//            String success = jsonObject.getString("success");
-//            if (success.equals("true")) {
-//                JSONObject data = jsonObject.getJSONObject("data");
-//                String code = data.getString("code");
-//                String ncid = data.getString("ncid");
-//                ParkRoom model = new ParkRoom();
-//                model.setId(id);
-//                model.setNcid(ncid);
-//                model.setNcCode(code);
-//                updateByPrimaryKeySelective(model);
-//            }
-//        } catch (Exception e) {
-//            log.error("推送房间失败", e);
-//        }
+        try {
+            ParkInfo parkInfo = parkInfoService.selectByPrimaryKey(record.getGroupId());
+            ParkFloorDisc parkFloorDisc = floorDiscService.selectByPrimaryKey(record.getDiscId());
+            MnpBuilding mnpBuilding = buildingService.selectByPrimaryKey(record.getBuildId());
+            String name = parkInfo.getGroupName() + "-" + parkFloorDisc.getName() + "-" + mnpBuilding.getBuildNum()
+                    + "-" + record.getRoomNo();
+            JSONObject json = new JSONObject();
+            json.put("srcsystemid", id);
+            json.put("code", id);
+            json.put("name", name);
+            json.put("pk_org", InvoiceUtil.pk_org);
+            json.put("pk_defdoclist", InvoiceUtil.pk_defdoclist_room);
+            // 给nc推送房间数据
+            String resultJson = InvoiceUtil.defdocAdd(json);
+            JSONObject jsonObject = JSONObject.parseObject(resultJson);
+            String success = jsonObject.getString("success");
+            if (success.equals("true")) {
+                JSONObject data = jsonObject.getJSONObject("data");
+                String code = data.getString("code");
+                String ncid = data.getString("ncid");
+                ParkRoom model = new ParkRoom();
+                model.setId(id);
+                model.setNcid(ncid);
+                model.setNcCode(code);
+                updateByPrimaryKeySelective(model);
+            }
+        } catch (Exception e) {
+            log.error("推送房间失败", e);
+        }
         return result;
 
     }

+ 53 - 51
pro-base/src/main/java/com/idea/customerManagement/service/CustomerManagementService.java

@@ -220,40 +220,41 @@ public class CustomerManagementService implements BaseService<CustomerManagement
         model.setCreatedId(userId);
         int result = insertWithOutId(model);
 
-//        try {
-//            // 给nc推送客户数据
-//            JSONObject json = new JSONObject();
-//            json.put("srcsystemid", id);
-//            json.put("name", builder.toString());
-//            json.put("pk_custclass", "02"); //客户基本分类 ,,(默认是02),必选,01内部客户,02外部客户
-//            json.put("custprop", "0");//财务组织客户类型,必选,默认0
-//            json.put("taxpayerid",identityCardBuilder.toString() ); //统一社会信用代码,必选
-//            String resultJson = InvoiceUtil.customerAdd(json);
-//            JSONObject jsonObject = JSONObject.parseObject(resultJson);
-//            String success = jsonObject.getString("success");
-//            if (success.equals("true")) {
-//                JSONObject data = jsonObject.getJSONObject("data");
-//                String code = data.getString("code");
-//                String ncid = data.getString("ncid");
-//                CustomerManagement record = new CustomerManagement();
-//                record.setId(id);
-//                record.setNcid(ncid);
-//                record.setNcCode(code);
-//                updateByPrimaryKeySelective(record);
-//            }
-//        }catch (Exception e){
-//            log.error("推送客户失败",e);
-//        }
-//
-//        try {
-//            // 客户分配
-//            JSONObject json = new JSONObject();
-//            json.put("pk_org", InvoiceUtil.pk_org);
-//            json.put("ncid", identityCardBuilder.toString());
-//            InvoiceUtil.customerAssign(json);
-//        }catch (Exception e){
-//            log.error("客户分配失败",e);
-//        }
+        try {
+            // 给nc推送客户数据
+            JSONObject json = new JSONObject();
+            json.put("srcsystemid", id);
+            json.put("name", builder.toString());
+            json.put("pk_custclass", "02"); //客户基本分类 ,,(默认是02),必选,01内部客户,02外部客户
+            json.put("custprop", "0");//财务组织客户类型,必选,默认0
+            json.put("taxpayerid",identityCardBuilder.toString() ); //统一社会信用代码,必选
+            log.info("推送客户详情:{}", json.toJSONString());
+            String resultJson = InvoiceUtil.customerAdd(json);
+            JSONObject jsonObject = JSONObject.parseObject(resultJson);
+            String success = jsonObject.getString("success");
+            if (success.equals("true")) {
+                JSONObject data = jsonObject.getJSONObject("data");
+                String code = data.getString("code");
+                String ncid = data.getString("ncid");
+                CustomerManagement record = new CustomerManagement();
+                record.setId(id);
+                record.setNcid(ncid);
+                record.setNcCode(code);
+                updateByPrimaryKeySelective(record);
+            }
+        }catch (Exception e){
+            log.error("推送客户失败",e);
+        }
+
+        try {
+            // 客户分配
+            JSONObject json = new JSONObject();
+            json.put("pk_org", InvoiceUtil.pk_org);
+            json.put("ncid", identityCardBuilder.toString());
+            InvoiceUtil.customerAssign(json);
+        }catch (Exception e){
+            log.error("客户分配失败",e);
+        }
 
         return result;
 
@@ -319,23 +320,24 @@ public class CustomerManagementService implements BaseService<CustomerManagement
 
         int result = updateByPrimaryKeySelective(model);
 
-//        try {
-//
-//            // 修改客户数据
-//            JSONObject json = new JSONObject();
-//            json.put("ncid", oldCustomer.getBuyerIdentityCard());// 客户统一信用代码,必选
-//            json.put("name", builder.toString());
-//            json.put("pk_custclass", "02"); //客户基本分类 ,,(默认是02),必选,01内部客户,02外部客户
-//            json.put("custprop", "0");//财务组织客户类型,必选,默认0
-//            json.put("taxpayerid", identityCardBuilder.toString()); //统一社会信用代码,必选
-//            String resultJson = InvoiceUtil.customerUpdate(json);
-//            JSONObject jsonObject = JSONObject.parseObject(resultJson);
-//            String success = jsonObject.getString("success");
-//            if (success.equals("true")) {
-//            }
-//        }catch (Exception e){
-//            log.error("修改客户失败",e);
-//        }
+        try {
+
+            // 修改客户数据
+            JSONObject json = new JSONObject();
+            json.put("ncid", oldCustomer.getBuyerIdentityCard());// 客户统一信用代码,必选
+            json.put("name", builder.toString());
+            json.put("pk_custclass", "02"); //客户基本分类 ,,(默认是02),必选,01内部客户,02外部客户
+            json.put("custprop", "0");//财务组织客户类型,必选,默认0
+            json.put("taxpayerid", identityCardBuilder.toString()); //统一社会信用代码,必选
+            log.info("推送客户修改详情:{}", json.toJSONString());
+            String resultJson = InvoiceUtil.customerUpdate(json);
+            JSONObject jsonObject = JSONObject.parseObject(resultJson);
+            String success = jsonObject.getString("success");
+            if (success.equals("true")) {
+            }
+        }catch (Exception e){
+            log.error("修改客户失败",e);
+        }
 
         return result;
 

+ 31 - 5
pro-base/src/main/java/com/idea/invoice/util/InvoiceUtil.java

@@ -18,23 +18,45 @@ import java.util.List;
 @Slf4j
 public class InvoiceUtil {
 
+    /**
+     * 测试 凭证信息
+     */
+//    public static final String ip = "10.1.2.51";
+//
+//    public static final String port = "9999";
+//
+//    public static final String biz_center = "CJJT";
+//
+//    public static final String client_id = "ajbzf";
+//
+//    public static final String client_secret = "c7ac88aa8be64197be9b";
+//
+//    public static final String pubKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApX9UZNt0EbdHBRGnR3SpgiP+1BEZf+1DpbYoJ0kJJuba7ZBhH+WDjSlRpEPA0FOFRyE0OvIMK5yIaodLRfeEgDyz+Jv5dnOBdS2gJqeVV/ugm5nk7TGAM/65PeFQxua3QgFeTJjZU/lGCHHl5oKRFgmB9/kumuryydKpOOkeT2fYjzoG8feuIhDoOGfR4y5sjTUFH4nN8VCE/zXylVEbj2hMeJSDzdESAy3+Ui64smCv6ZsLVgsWXhhLFsLWzkbh7/pElnoK3qhr6MVeAIokd7bS+Hp+6S5s10jwjPkd+POX/qQSHP1MmVngLlD7P0caxjQaH3+w8KsLQoydeUARVQIDAQAB";
+//
+//    public static final String username = "ajbzf";
+//
+//    public static final String password = "1234qwer!";
 
+    /**
+     * 正式凭证信息
+      */
     public static final String ip = "10.1.2.51";
 
-    public static final String port = "9999";
+    public static final String port = "9998";
 
     public static final String biz_center = "CJJT";
 
-    public static final String client_id = "ajbzf";
+    public static final String client_id = "cjajbzf";
 
     public static final String client_secret = "c7ac88aa8be64197be9b";
 
     public static final String pubKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApX9UZNt0EbdHBRGnR3SpgiP+1BEZf+1DpbYoJ0kJJuba7ZBhH+WDjSlRpEPA0FOFRyE0OvIMK5yIaodLRfeEgDyz+Jv5dnOBdS2gJqeVV/ugm5nk7TGAM/65PeFQxua3QgFeTJjZU/lGCHHl5oKRFgmB9/kumuryydKpOOkeT2fYjzoG8feuIhDoOGfR4y5sjTUFH4nN8VCE/zXylVEbj2hMeJSDzdESAy3+Ui64smCv6ZsLVgsWXhhLFsLWzkbh7/pElnoK3qhr6MVeAIokd7bS+Hp+6S5s10jwjPkd+POX/qQSHP1MmVngLlD7P0caxjQaH3+w8KsLQoydeUARVQIDAQAB";
 
-    public static final String username = "ajbzf";
+    public static final String username = "cjajbzf";
 
     public static final String password = "1234qwer!";
 
+
     /**
      * 组织编码
      */
@@ -50,6 +72,11 @@ public class InvoiceUtil {
 
     public static void main(String[] args) throws Exception {
 
+        APICurUtils util = new APICurUtils();
+        String token = InvoiceUtil.getToken(util);
+        System.out.println("token====>" + token);
+
+
 //        JSONObject json = new JSONObject();
 //        json.put("ncid", "1001211000000003WHWX");
 //        json.put("code", "d12eba8719d14f40b260f70e9393614c");
@@ -97,7 +124,6 @@ public class InvoiceUtil {
     public static String getToken(APICurUtils util) throws Exception {
         util.init(ip, port, biz_center, client_id, client_secret, pubKey, username, password);
         String token = util.getToken();
-
         return token;
     }
 
@@ -111,7 +137,7 @@ public class InvoiceUtil {
         String token = InvoiceUtil.getToken(util);
         util.setApiUrl("nccloud/api/wxyy/uapbd/defdoc/add");
         String result = util.getAPIRetrun(token, json.toJSONString());
-        log.info("楼栋或房间新增:{}", result);
+        log.info("楼栋或房间新增结果:{}", result);
         return result;
     }
 

+ 1 - 1
pro-base/src/main/resources/mybatis/transactionRecord/TransactionRecord.xml

@@ -51,7 +51,7 @@
 
     <select id="listByDate" resultType="com.idea.paymentManagement.model.PayLog">
         select * from pay_log where date_format(pay_time,'%Y-%m-%d') >= #{startDate}
-                                and #{endDate} &lt;= date_format(pay_time,'%Y-%m-%d')
+                                and date_format(pay_time,'%Y-%m-%d') &lt;= #{endDate}
         and ifnull(nc_submit_status,0) = 0
     </select>