lyhzzz 1 rok temu
rodzic
commit
6a6832f04b

+ 96 - 0
src/main/java/com/fdkankan/task/controller/TbBuildingController.java

@@ -0,0 +1,96 @@
+package com.fdkankan.task.controller;
+
+import com.mybatisflex.core.paginate.Page;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.fdkankan.task.entity.TbBuilding;
+import com.fdkankan.task.service.TbBuildingService;
+import org.springframework.web.bind.annotation.RestController;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ *  控制层。
+ *
+ * @author Admin
+ * @since 2023-12-02
+ */
+@RestController
+@RequestMapping("/tbBuilding")
+public class TbBuildingController {
+
+    @Autowired
+    private TbBuildingService tbBuildingService;
+
+    /**
+     * 添加。
+     *
+     * @param tbBuilding 
+     * @return {@code true} 添加成功,{@code false} 添加失败
+     */
+    @PostMapping("save")
+    public boolean save(@RequestBody TbBuilding tbBuilding) {
+        return tbBuildingService.save(tbBuilding);
+    }
+
+    /**
+     * 根据主键删除。
+     *
+     * @param id 主键
+     * @return {@code true} 删除成功,{@code false} 删除失败
+     */
+    @DeleteMapping("remove/{id}")
+    public boolean remove(@PathVariable Serializable id) {
+        return tbBuildingService.removeById(id);
+    }
+
+    /**
+     * 根据主键更新。
+     *
+     * @param tbBuilding 
+     * @return {@code true} 更新成功,{@code false} 更新失败
+     */
+    @PutMapping("update")
+    public boolean update(@RequestBody TbBuilding tbBuilding) {
+        return tbBuildingService.updateById(tbBuilding);
+    }
+
+    /**
+     * 查询所有。
+     *
+     * @return 所有数据
+     */
+    @GetMapping("list")
+    public List<TbBuilding> list() {
+        return tbBuildingService.list();
+    }
+
+    /**
+     * 根据主键获取详细信息。
+     *
+     * @param id 主键
+     * @return 详情
+     */
+    @GetMapping("getInfo/{id}")
+    public TbBuilding getInfo(@PathVariable Serializable id) {
+        return tbBuildingService.getById(id);
+    }
+
+    /**
+     * 分页查询。
+     *
+     * @param page 分页对象
+     * @return 分页对象
+     */
+    @GetMapping("page")
+    public Page<TbBuilding> page(Page<TbBuilding> page) {
+        return tbBuildingService.page(page);
+    }
+
+}

+ 96 - 0
src/main/java/com/fdkankan/task/controller/TbHouseController.java

@@ -0,0 +1,96 @@
+package com.fdkankan.task.controller;
+
+import com.mybatisflex.core.paginate.Page;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.fdkankan.task.entity.TbHouse;
+import com.fdkankan.task.service.TbHouseService;
+import org.springframework.web.bind.annotation.RestController;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ *  控制层。
+ *
+ * @author Admin
+ * @since 2023-12-02
+ */
+@RestController
+@RequestMapping("/tbHouse")
+public class TbHouseController {
+
+    @Autowired
+    private TbHouseService tbHouseService;
+
+    /**
+     * 添加。
+     *
+     * @param tbHouse 
+     * @return {@code true} 添加成功,{@code false} 添加失败
+     */
+    @PostMapping("save")
+    public boolean save(@RequestBody TbHouse tbHouse) {
+        return tbHouseService.save(tbHouse);
+    }
+
+    /**
+     * 根据主键删除。
+     *
+     * @param id 主键
+     * @return {@code true} 删除成功,{@code false} 删除失败
+     */
+    @DeleteMapping("remove/{id}")
+    public boolean remove(@PathVariable Serializable id) {
+        return tbHouseService.removeById(id);
+    }
+
+    /**
+     * 根据主键更新。
+     *
+     * @param tbHouse 
+     * @return {@code true} 更新成功,{@code false} 更新失败
+     */
+    @PutMapping("update")
+    public boolean update(@RequestBody TbHouse tbHouse) {
+        return tbHouseService.updateById(tbHouse);
+    }
+
+    /**
+     * 查询所有。
+     *
+     * @return 所有数据
+     */
+    @GetMapping("list")
+    public List<TbHouse> list() {
+        return tbHouseService.list();
+    }
+
+    /**
+     * 根据主键获取详细信息。
+     *
+     * @param id 主键
+     * @return 详情
+     */
+    @GetMapping("getInfo/{id}")
+    public TbHouse getInfo(@PathVariable Serializable id) {
+        return tbHouseService.getById(id);
+    }
+
+    /**
+     * 分页查询。
+     *
+     * @param page 分页对象
+     * @return 分页对象
+     */
+    @GetMapping("page")
+    public Page<TbHouse> page(Page<TbHouse> page) {
+        return tbHouseService.page(page);
+    }
+
+}

+ 99 - 0
src/main/java/com/fdkankan/task/entity/TbBuilding.java

@@ -0,0 +1,99 @@
+package com.fdkankan.task.entity;
+
+import com.mybatisflex.annotation.Id;
+import com.mybatisflex.annotation.KeyType;
+import com.mybatisflex.annotation.Table;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ *  实体类。
+ *
+ * @author Admin
+ * @since 2023-12-02
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@Table(value = "tb_building",dataSource = "new-zfb")
+public class TbBuilding implements Serializable {
+
+    @Id(keyType = KeyType.Auto)
+    private Long id;
+
+    /**
+     * 楼盘名称
+     */
+    private String name;
+
+    /**
+     * 建筑面积
+     */
+    private String coveredArea;
+
+    /**
+     * 使用面积
+     */
+    private String utilizationArea;
+
+    /**
+     * 挂牌时间
+     */
+    private String sellTime;
+
+    /**
+     * 楼盘描述
+     */
+    private String introduce;
+
+    /**
+     * 省
+     */
+    private String province;
+
+    /**
+     * 市
+     */
+    private String city;
+
+    /**
+     * 地区
+     */
+    private String district;
+
+    /**
+     * 经度
+     */
+    private String longitude;
+
+    /**
+     * 纬度
+     */
+    private String latitude;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+
+    /**
+     * 修改人
+     */
+    private String updateUser;
+
+}

+ 154 - 0
src/main/java/com/fdkankan/task/entity/TbHouse.java

@@ -0,0 +1,154 @@
+package com.fdkankan.task.entity;
+
+import com.mybatisflex.annotation.Id;
+import com.mybatisflex.annotation.KeyType;
+import com.mybatisflex.annotation.Table;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ *  实体类。
+ *
+ * @author Admin
+ * @since 2023-12-02
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@Table(value = "tb_house",dataSource = "new-zfb")
+public class TbHouse implements Serializable {
+
+    @Id(keyType = KeyType.Auto)
+    private Long id;
+
+    /**
+     * 标题描述
+     */
+    private String title;
+
+    /**
+     * 楼盘id
+     */
+    private Long buildingId;
+
+    /**
+     * 栋号
+     */
+    private Integer buildingNum;
+
+    /**
+     * 单元号
+     */
+    private Integer unitNum;
+
+    /**
+     * 房号
+     */
+    private Integer roomNum;
+
+    /**
+     * 建筑面积
+     */
+    private String coveredArea;
+
+    /**
+     * 使用面积
+     */
+    private String utilizationArea;
+
+    /**
+     * 单价
+     */
+    private String price;
+
+    /**
+     * 总价
+     */
+    private String total;
+
+    /**
+     * 房屋朝向
+     */
+    private String orientation;
+
+    /**
+     * 房间数
+     */
+    private Integer houseNum;
+
+    /**
+     * 客厅数
+     */
+    private Integer parlourNum;
+
+    /**
+     * 卫生间数
+     */
+    private Integer toiletNum;
+
+    /**
+     * 楼层
+     */
+    private Integer floor;
+
+    /**
+     * 是否有电梯
+     */
+    private Boolean elevator;
+
+    /**
+     * 用途
+     */
+    private String purpose;
+
+    /**
+     * 权属,如:商品房,公寓
+     */
+    private String power;
+
+    /**
+     * 状态,0:启用,1:停用
+     */
+    private Integer state;
+
+    /**
+     * 类型,0:装修,1:新房,2:二手房,3:公寓,4:民俗
+     */
+    private Integer type;
+
+    /**
+     * 装修情况
+     */
+    private String decorate;
+
+    /**
+     * 挂牌时间
+     */
+    private Date sellTime;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+
+    /**
+     * 修改人
+     */
+    private String updateUser;
+
+}

+ 6 - 6
src/main/java/com/fdkankan/task/generate/AutoGenerate.java

@@ -24,17 +24,17 @@ public class AutoGenerate {
 //        dataSource.setJdbcUrl("jdbc:mysql://120.24.144.164:3306/4dkankan_v4_sale?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true");
 //        dataSource.setUsername("root");
 //        dataSource.setPassword("4Dage@4Dage#@168");
-//        dataSource.setJdbcUrl("jdbc:mysql://120.24.202.7:3306/zhi_house?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true");
-//        dataSource.setUsername("root");
-//        dataSource.setPassword("zfb@20210727%");
-        dataSource.setJdbcUrl("jdbc:mysql://47.112.166.173:3306/zhi_house?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true");
+        dataSource.setJdbcUrl("jdbc:mysql://120.24.202.7:3306/zhi_house?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true");
         dataSource.setUsername("root");
-        dataSource.setPassword("4dkankan4dage");
+        dataSource.setPassword("zfb@20210727%");
+//        dataSource.setJdbcUrl("jdbc:mysql://47.112.166.173:3306/zhi_house?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true");
+//        dataSource.setUsername("root");
+//        dataSource.setPassword("4dkankan4dage");
 
         //创建配置内容,两种风格都可以。
 
         GlobalConfig globalConfig = createGlobalConfigUseStyle1("com.fdkankan.task",new String[]{
-                "tb_camera_instance",
+                "tb_building","tb_house"
         });
         //GlobalConfig globalConfig = createGlobalConfigUseStyle2();
 

+ 62 - 10
src/main/java/com/fdkankan/task/jobhandler/zfb/ZfbXxlJob.java

@@ -4,14 +4,10 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.dingtalk.DingTalkSendUtils;
-import com.fdkankan.task.entity.Repair;
-import com.fdkankan.task.entity.TbCameraInstance;
-import com.fdkankan.task.entity.TbSceneNum;
+import com.fdkankan.task.entity.*;
 import com.fdkankan.task.jobhandler.sale.SaleXxlJobUtil;
 import com.fdkankan.task.jobhandler.util.Utils;
-import com.fdkankan.task.mapper.RepairMapper;
-import com.fdkankan.task.mapper.TbCameraInstanceMapper;
-import com.fdkankan.task.mapper.TbSceneNumMapper;
+import com.fdkankan.task.mapper.*;
 import com.mybatisflex.annotation.UseDataSource;
 import com.mybatisflex.core.datasource.DataSourceKey;
 import com.mybatisflex.core.query.QueryWrapper;
@@ -23,10 +19,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
 
 /**
  * XxlJob开发示例(Bean模式)
@@ -156,4 +149,63 @@ public class ZfbXxlJob {
         }
 
     }
+
+    @Autowired
+    TbBuildingMapper tbBuildingMapper;
+    @Autowired
+    TbHouseMapper tbHouseMapper;
+
+
+    @XxlJob("updateBuild")
+    @UseDataSource("new-zfb")
+    public void updateBuild(){
+        String taskId = UUID.randomUUID().toString().replace("-", "");
+        logger.info("newZfbGenNewCode---------------start,taskId:{}",taskId);
+        try {
+            HashMap<String,TbBuilding> buildMap = new HashMap<>();
+            List<TbBuilding> tbBuildings = tbBuildingMapper.selectAll();
+            List<TbBuilding> DelLit = new ArrayList<>();
+            for (TbBuilding tbBuilding : tbBuildings) {
+                String key = tbBuilding.getName()+","+tbBuilding.getCity()+","+tbBuilding.getDistrict();
+                if(buildMap.get(key) == null){
+                    buildMap.put(tbBuilding.getName()+","+tbBuilding.getCity()+","+tbBuilding.getDistrict(),tbBuilding);
+                }else {
+                    QueryWrapper queryWrapper = QueryWrapper.create()
+                            .where("building_id =" +tbBuilding.getId());
+                    List<TbHouse> tbHouses = tbHouseMapper.selectListByQuery(queryWrapper);
+                    for (TbHouse tbHouse : tbHouses) {
+                        tbHouse.setBuildingId(buildMap.get(key).getId());
+                        tbHouseMapper.update(tbHouse);
+                    }
+                    DelLit.add(tbBuilding);
+                }
+            }
+            for (TbBuilding buildId : DelLit) {
+
+                tbBuildingMapper.delete(buildId);
+            }
+
+        }catch (Exception e){
+            logger.info("newZfbGenNewCode-error,taskId:{},{}",taskId,e);
+        }finally {
+            logger.info("zfbGenOldCode---------------end,taskId::{}",taskId);
+        }
+
+    }
+
+    public static void main(String[] args) {
+        JSONArray jsonArray = new JSONArray();
+        String userName = "13967143520";
+        String[] res = {
+                "THETAYP41148397.OSC",
+                "THETAYP41133486.OSC"
+        };
+        for (String re : res) {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("childName",re);
+            jsonObject.put("userName",userName);
+            jsonArray.add(jsonObject);
+        }
+        System.out.println(jsonArray);
+    }
 }

+ 14 - 0
src/main/java/com/fdkankan/task/mapper/TbBuildingMapper.java

@@ -0,0 +1,14 @@
+package com.fdkankan.task.mapper;
+
+import com.mybatisflex.core.BaseMapper;
+import com.fdkankan.task.entity.TbBuilding;
+
+/**
+ *  映射层。
+ *
+ * @author Admin
+ * @since 2023-12-02
+ */
+public interface TbBuildingMapper extends BaseMapper<TbBuilding> {
+
+}

+ 14 - 0
src/main/java/com/fdkankan/task/mapper/TbHouseMapper.java

@@ -0,0 +1,14 @@
+package com.fdkankan.task.mapper;
+
+import com.mybatisflex.core.BaseMapper;
+import com.fdkankan.task.entity.TbHouse;
+
+/**
+ *  映射层。
+ *
+ * @author Admin
+ * @since 2023-12-02
+ */
+public interface TbHouseMapper extends BaseMapper<TbHouse> {
+
+}

+ 14 - 0
src/main/java/com/fdkankan/task/service/TbBuildingService.java

@@ -0,0 +1,14 @@
+package com.fdkankan.task.service;
+
+import com.mybatisflex.core.service.IService;
+import com.fdkankan.task.entity.TbBuilding;
+
+/**
+ *  服务层。
+ *
+ * @author Admin
+ * @since 2023-12-02
+ */
+public interface TbBuildingService extends IService<TbBuilding> {
+
+}

+ 14 - 0
src/main/java/com/fdkankan/task/service/TbHouseService.java

@@ -0,0 +1,14 @@
+package com.fdkankan.task.service;
+
+import com.mybatisflex.core.service.IService;
+import com.fdkankan.task.entity.TbHouse;
+
+/**
+ *  服务层。
+ *
+ * @author Admin
+ * @since 2023-12-02
+ */
+public interface TbHouseService extends IService<TbHouse> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/task/service/impl/TbBuildingServiceImpl.java

@@ -0,0 +1,18 @@
+package com.fdkankan.task.service.impl;
+
+import com.mybatisflex.spring.service.impl.ServiceImpl;
+import com.fdkankan.task.entity.TbBuilding;
+import com.fdkankan.task.mapper.TbBuildingMapper;
+import com.fdkankan.task.service.TbBuildingService;
+import org.springframework.stereotype.Service;
+
+/**
+ *  服务层实现。
+ *
+ * @author Admin
+ * @since 2023-12-02
+ */
+@Service
+public class TbBuildingServiceImpl extends ServiceImpl<TbBuildingMapper, TbBuilding> implements TbBuildingService {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/task/service/impl/TbHouseServiceImpl.java

@@ -0,0 +1,18 @@
+package com.fdkankan.task.service.impl;
+
+import com.mybatisflex.spring.service.impl.ServiceImpl;
+import com.fdkankan.task.entity.TbHouse;
+import com.fdkankan.task.mapper.TbHouseMapper;
+import com.fdkankan.task.service.TbHouseService;
+import org.springframework.stereotype.Service;
+
+/**
+ *  服务层实现。
+ *
+ * @author Admin
+ * @since 2023-12-02
+ */
+@Service
+public class TbHouseServiceImpl extends ServiceImpl<TbHouseMapper, TbHouse> implements TbHouseService {
+
+}

+ 7 - 0
src/test/java/com/fdkankan/task/TaskTestApplication.java

@@ -1,7 +1,11 @@
 package com.fdkankan.task;
 
 import com.fdkankan.task.entity.Repair;
+import com.fdkankan.task.entity.TbBuilding;
+import com.fdkankan.task.entity.TbHouse;
 import com.fdkankan.task.mapper.RepairMapper;
+import com.fdkankan.task.mapper.TbBuildingMapper;
+import com.fdkankan.task.mapper.TbHouseMapper;
 import com.fdkankan.task.service.RepairService;
 import com.mybatisflex.core.query.QueryWrapper;
 import org.junit.jupiter.api.Test;
@@ -11,7 +15,10 @@ import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.test.context.SpringBootTest;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.UUID;
 
 @SpringBootTest
 public class TaskTestApplication {