From 8dad19de4603ba31baa1434a77465cd78b908fe3 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期四, 26 九月 2024 18:52:55 +0800 Subject: [PATCH] 2024-09-26 朱宝民 导入农户接口,巡检部分功能 --- pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application-database.yml | 3 pipIrr-platform/pipIrr-global/src/main/resources/application-database-test.yml | 4 pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/PipIrrAppApplication.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/InspectCtrl.java | 86 ++++++++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientTempMapper.xml | 125 ++++++++++++ pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/resources/application.yml | 4 pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/dto/Inspects.java | 48 ++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeClientTemp.java | 62 ++++++ pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/InspectSv.java | 25 ++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientTemp/ClientTempSv.java | 31 +++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientTempMapper.java | 36 +++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoOp/OpeTrackMapper.java | 9 pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeTrackMapper.xml | 9 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientTemp/ClientTempCtrl.java | 117 +++++++++++ 14 files changed, 554 insertions(+), 7 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoOp/OpeTrackMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoOp/OpeTrackMapper.java index 8e639bf..492a918 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoOp/OpeTrackMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoOp/OpeTrackMapper.java @@ -4,6 +4,8 @@ import com.dy.pipIrrGlobal.pojoOp.OpeTrack; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * @author ZhuBaoMin * @date 2024-09-24 10:08 @@ -24,4 +26,11 @@ int updateByPrimaryKeySelective(OpeTrack record); int updateByPrimaryKey(OpeTrack record); + + /** + * 鎵归噺娣诲姞宸℃杞ㄨ抗 + * @param list + * @return + */ + int insertTracks(List<OpeTrack> list); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientTempMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientTempMapper.java new file mode 100644 index 0000000..bf7ff9b --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientTempMapper.java @@ -0,0 +1,36 @@ +package com.dy.pipIrrGlobal.daoSe; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoSe.SeClientTemp; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @author ZhuBaoMin + * @date 2024-09-26 14:57 + * @LastEditTime 2024-09-26 14:57 + * @Description + */ + +@Mapper +public interface SeClientTempMapper extends BaseMapper<SeClientTemp> { + int deleteByPrimaryKey(Integer id); + + int insert(SeClientTemp record); + + int insertSelective(SeClientTemp record); + + SeClientTemp selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(SeClientTemp record); + + int updateByPrimaryKey(SeClientTemp record); + + /** + * 鏍规嵁闀囧悕鑾峰彇鍐滄埛 + * @param townName + * @return + */ + List<SeClientTemp> getClientsByTownName(String townName ); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeClientTemp.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeClientTemp.java new file mode 100644 index 0000000..110024e --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeClientTemp.java @@ -0,0 +1,62 @@ +package com.dy.pipIrrGlobal.pojoSe; + +/** + * @author ZhuBaoMin + * @date 2024-09-26 14:57 + * @LastEditTime 2024-09-26 14:57 + * @Description + */ + +import com.baomidou.mybatisplus.annotation.TableName; +import com.dy.common.po.BaseEntity; +import lombok.*; + +/** + * 鍐滄埛涓存椂琛� + */ + +@TableName(value = "se_client_temp", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class SeClientTemp implements BaseEntity { + public static final long serialVersionUID = 202409261459001L; + + /** + * 涓婚敭 + */ + private Integer id; + + /** + * 闀� + */ + private String town; + + /** + * 鏉� + */ + private String village; + + /** + * 濮撳悕 + */ + private String name; + + /** + * 韬唤璇佸彿 + */ + private String idcard; + + /** + * 鎵嬫満鍙� + */ + private String phone; + + /** + * 琛楅亾鍙婇棬鐗屽彿 + */ + private String address; + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-database-test.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-database-test.yml index 742d541..4e972d0 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-database-test.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-database-test.yml @@ -6,8 +6,8 @@ type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver # url: jdbc:mysql://192.168.40.166:3306/pipIrr_test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull - url: jdbc:mysql://8.130.130.233:3306/pipIrr_test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull -# url: jdbc:mysql://127.0.0.1:3306/pipIrr_test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull +# url: jdbc:mysql://8.130.130.233:3306/pipIrr_test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull + url: jdbc:mysql://127.0.0.1:3306/pipIrr_test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull username: root password: dysql,;.abc!@# druid: diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeTrackMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeTrackMapper.xml index fc9cd24..ebb150d 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeTrackMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeTrackMapper.xml @@ -99,4 +99,13 @@ locate_time = #{locateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} </update> + + <!--鎵归噺娣诲姞宸℃杞ㄨ抗--> + <insert id="insertTracks"> + INSERT INTO ope_track (id, inspect_id, lng, lat, locate_time) + VALUES + <foreach collection="list" item="item" index="index" separator=","> + (#{item.id}, #{item.inspectId}, #{item.lng}, #{item.lat}, #{item.locateTime}) + </foreach> + </insert> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientTempMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientTempMapper.xml new file mode 100644 index 0000000..29cacef --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientTempMapper.xml @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.dy.pipIrrGlobal.daoSe.SeClientTempMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeClientTemp"> + <!--@mbg.generated--> + <!--@Table se_client_temp--> + <id column="id" jdbcType="INTEGER" property="id" /> + <result column="town" jdbcType="VARCHAR" property="town" /> + <result column="village" jdbcType="VARCHAR" property="village" /> + <result column="name" jdbcType="VARCHAR" property="name" /> + <result column="idCard" jdbcType="VARCHAR" property="idcard" /> + <result column="phone" jdbcType="VARCHAR" property="phone" /> + <result column="address" jdbcType="VARCHAR" property="address" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, town, village, `name`, idCard, phone, address + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from se_client_temp + where id = #{id,jdbcType=INTEGER} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> + <!--@mbg.generated--> + delete from se_client_temp + where id = #{id,jdbcType=INTEGER} + </delete> + <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientTemp" useGeneratedKeys="true"> + <!--@mbg.generated--> + insert into se_client_temp (town, village, `name`, + idCard, phone, address + ) + values (#{town,jdbcType=VARCHAR}, #{village,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, + #{idcard,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR} + ) + </insert> + <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientTemp" useGeneratedKeys="true"> + <!--@mbg.generated--> + insert into se_client_temp + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="town != null"> + town, + </if> + <if test="village != null"> + village, + </if> + <if test="name != null"> + `name`, + </if> + <if test="idcard != null"> + idCard, + </if> + <if test="phone != null"> + phone, + </if> + <if test="address != null"> + address, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="town != null"> + #{town,jdbcType=VARCHAR}, + </if> + <if test="village != null"> + #{village,jdbcType=VARCHAR}, + </if> + <if test="name != null"> + #{name,jdbcType=VARCHAR}, + </if> + <if test="idcard != null"> + #{idcard,jdbcType=VARCHAR}, + </if> + <if test="phone != null"> + #{phone,jdbcType=VARCHAR}, + </if> + <if test="address != null"> + #{address,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientTemp"> + <!--@mbg.generated--> + update se_client_temp + <set> + <if test="town != null"> + town = #{town,jdbcType=VARCHAR}, + </if> + <if test="village != null"> + village = #{village,jdbcType=VARCHAR}, + </if> + <if test="name != null"> + `name` = #{name,jdbcType=VARCHAR}, + </if> + <if test="idcard != null"> + idCard = #{idcard,jdbcType=VARCHAR}, + </if> + <if test="phone != null"> + phone = #{phone,jdbcType=VARCHAR}, + </if> + <if test="address != null"> + address = #{address,jdbcType=VARCHAR}, + </if> + </set> + where id = #{id,jdbcType=INTEGER} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientTemp"> + <!--@mbg.generated--> + update se_client_temp + set town = #{town,jdbcType=VARCHAR}, + village = #{village,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + idCard = #{idcard,jdbcType=VARCHAR}, + phone = #{phone,jdbcType=VARCHAR}, + address = #{address,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + </update> + + <!--鏍规嵁闀囧悕鑾峰彇鍐滄埛--> + <select id="getClientsByTownName" resultType="com.dy.pipIrrGlobal.pojoSe.SeClientTemp"> + SELECT * FROM se_client_temp WHERE town = #{townName} + </select> +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application-database.yml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application-database.yml index 00cbff3..94c49fc 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application-database.yml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application-database.yml @@ -3,9 +3,8 @@ datasource: #閰嶇疆鏁版嵁婧� type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.cj.jdbc.Driver -# url: jdbc:mysql://8.130.130.233:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull -# url: jdbc:mysql://127.0.0.1:3306/pipIrr_test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull +# url: jdbc:mysql://8.130.130.233:3306/pipIrr_test?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull username: root password: dysql,;.abc!@# druid: diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/PipIrrAppApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/PipIrrAppApplication.java index 9d551cb..3ed996b 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/PipIrrAppApplication.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/PipIrrAppApplication.java @@ -18,7 +18,7 @@ }) } ) -@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoRm", "com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa"}) +@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoOp", "com.dy.pipIrrGlobal.daoBa"}) public class PipIrrAppApplication { public static void main(String[] args) { diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/InspectCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/InspectCtrl.java index d71764c..26e4ca5 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/InspectCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/InspectCtrl.java @@ -1,9 +1,26 @@ package com.dy.pipIrrApp.inspect; +import com.dy.common.aop.SsoAop; +import com.dy.common.util.IDLongGenerator; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.pipIrrApp.inspect.dto.Inspects; +import com.dy.pipIrrGlobal.pojoOp.OpeInspect; +import com.dy.pipIrrGlobal.pojoOp.OpeTrack; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; +import java.util.List; +import java.util.Objects; /** * @author ZhuBaoMin @@ -19,4 +36,73 @@ @Autowired private InspectSv inspectSv; + private final IDLongGenerator idLongGenerator; + + public InspectCtrl(IDLongGenerator idLongGenerator) { + this.idLongGenerator = idLongGenerator; + } + + /** + * 娣诲姞宸℃杞ㄨ抗 + * @param list_Inspects 宸℃瀵硅薄鏁扮粍 + * @param bindingResult + * @return + */ + @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) + @Transactional(rollbackFor = Exception.class) + @SsoAop() + public BaseResponse<Boolean> save(@RequestBody @Valid List<Inspects> list_Inspects, BindingResult bindingResult){ + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + + if(list_Inspects != null && list_Inspects.size() > 0) { + for (int i = 0; i < list_Inspects.size(); i++) { + Inspects inspects = list_Inspects.get(i); + + Long inspectorId = inspects.getInspectorId(); + Long inspectId = inspects.getInspectId(); + Date startTime = inspects.getStartTime(); + Date stopTime = inspects.getStopTime(); + List<OpeTrack> tracks = inspects.getTracks(); + + if(tracks == null || tracks.size() == 0) { + return BaseResponseUtils.buildErrorMsg("鏃犲贰妫�杞ㄨ抗"); + } + + if(inspectId == null || inspectId.equals(0)) { + // 璇ュ贰妫�鏈笂浼犺繃璁板綍 + + // 娣诲姞宸℃璁板綍 + OpeInspect opeInspect = new OpeInspect(); + opeInspect.setInspectorId(inspects.getInspectorId()); + if(startTime != null) { + opeInspect.setStartTime(startTime); + } + if(stopTime != null) { + opeInspect.setStopTime(stopTime); + } + inspectId = inspectSv.addInspect(opeInspect); + if(inspectId == null) { + return BaseResponseUtils.buildErrorMsg("宸℃璁板綍娣诲姞澶辫触"); + } + + for (int j = 0; j < tracks.size(); j++) { + tracks.get(j).setId(idLongGenerator.generate()); + tracks.get(j).setInspectId(inspectId); + } + Integer rec = inspectSv.insertTracks(tracks); + if(rec == null || rec == 0) { + return BaseResponseUtils.buildErrorMsg("宸℃杞ㄨ抗娣诲姞澶辫触"); + } + }else { + // 璇ュ贰妫�宸蹭笂浼犺繃璁板綍锛岀画浼� + + } + } + return BaseResponseUtils.buildSuccess() ; + } + return BaseResponseUtils.buildErrorMsg("鎮ㄦ彁浜ょ殑宸℃杞ㄨ抗涓虹┖"); + } + } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/InspectSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/InspectSv.java index 9b5f884..20893a0 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/InspectSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/InspectSv.java @@ -2,9 +2,13 @@ import com.dy.pipIrrGlobal.daoOp.OpeInspectMapper; import com.dy.pipIrrGlobal.daoOp.OpeTrackMapper; +import com.dy.pipIrrGlobal.pojoOp.OpeInspect; +import com.dy.pipIrrGlobal.pojoOp.OpeTrack; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.util.List; /** * @author ZhuBaoMin @@ -21,4 +25,25 @@ @Autowired private OpeTrackMapper opeTrackMapper; + + /** + * 娣诲姞宸℃璁板綍 + * @param po + * @return + */ + public Long addInspect(OpeInspect po) { + opeInspectMapper.insert(po); + return po.getId(); + } + + /** + * 鎵归噺娣诲姞宸℃杞ㄨ抗 + * @param list + * @return + */ + public Integer insertTracks(List<OpeTrack> list) { + return opeTrackMapper.insertTracks(list); + } + + } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/dto/Inspects.java b/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/dto/Inspects.java new file mode 100644 index 0000000..4fbcb6c --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/java/com/dy/pipIrrApp/inspect/dto/Inspects.java @@ -0,0 +1,48 @@ +package com.dy.pipIrrApp.inspect.dto; + +import com.dy.pipIrrGlobal.pojoOp.OpeTrack; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * @author ZhuBaoMin + * @date 2024-09-24 15:17 + * @LastEditTime 2024-09-24 15:17 + * @Description 宸℃瀵硅薄 + */ + +@Data +public class Inspects { + public static final long serialVersionUID = 202409241517001L; + + /** + * 宸℃鍛業D + */ + @NotNull(message = "宸℃鍛樹笉鑳戒负绌�") + private Long inspectorId; + + /** + * 宸℃ID锛岃娆″贰妫�宸叉彁浜よ繃璁板綍鏃舵湁鍊硷紝涓昏鐢ㄤ簬鍚庣画鎵撶偣銆� + */ + private Long inspectId; + + /** + * 寮�濮嬪贰妫�鏃堕棿 + */ + private Date startTime; + + /** + * 缁撴潫宸℃鏃堕棿 + */ + private Date stopTime; + + /** + * 宸℃杞ㄨ抗 + */ + @NotEmpty(message = "宸℃杞ㄨ抗涓嶈兘涓虹┖") + private List<OpeTrack> tracks; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/resources/application.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/resources/application.yml index addc58c..6785052 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/resources/application.yml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/resources/application.yml @@ -3,8 +3,8 @@ include: global, database, database-ym, database-pj, database-test user: defaultTrueRandomFalsePassword: true #true:閲囩敤榛樿瀵嗙爜锛宖alse:绯荤粺浜х敓闅忔満瀵嗙爜 - defaultPassword: "abc_123" -# defaultPassword: "admin" +# defaultPassword: "abc_123" + defaultPassword: "admin" #actutor鐨剋eb绔彛 management: diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientTemp/ClientTempCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientTemp/ClientTempCtrl.java new file mode 100644 index 0000000..d59cac8 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientTemp/ClientTempCtrl.java @@ -0,0 +1,117 @@ +package com.dy.pipIrrSell.clientTemp; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.dy.common.aop.SsoAop; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.pipIrrGlobal.pojoSe.SeClient; +import com.dy.pipIrrGlobal.pojoSe.SeClientTemp; +import com.dy.pipIrrSell.client.ClientSv; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; +import java.util.List; + +/** + * @author ZhuBaoMin + * @date 2024-09-26 15:03 + * @LastEditTime 2024-09-26 15:03 + * @Description + */ + +@Slf4j +@RestController +@RequestMapping(path = "client_temp") +@RequiredArgsConstructor +public class ClientTempCtrl { + private final ClientTempSv clientTempSv; + private final ClientSv clientSv; + + /** + * 瀵煎叆鍐滄埛 + * @param townName + * @return + */ + @PostMapping(path = "import") + @Transactional(rollbackFor = Exception.class) + @SsoAop() + public BaseResponse<Boolean> importClient(String townName){ + List<SeClientTemp> list_client = clientTempSv.getClientsByTownName(townName); + if(list_client != null && list_client.size() > 0) { + JSONArray array_Clients = (JSONArray) JSON.toJSON(list_client); + for (int i = 0; i < array_Clients.size(); i++) { + JSONObject job_client = array_Clients.getJSONObject(i); + String town = job_client.getString("town"); + String village = job_client.getString("village"); + String name = job_client.getString("name"); + String idCard = job_client.getString("idcard"); + String phone = job_client.getString("phone"); + if(phone != null && phone.length() > 11) { + phone = phone.substring(0,11); + } + String address = job_client.getString("address"); + + if(town.trim().equals("鍏冮┈闀�6鍙�")) { + SeClient client = new SeClient(); + //client.setCountyid(28L); + //client.setTownid(101L); + //client.setVillageid(6L); + client.setCountyid(2024090516595200202L); + client.setTownid(2024090517240900002L); + client.setVillageid(2024090517284400002L); + client.setBlockid(2024090517155600002L); + client.setDivideid(2024090517323800007L); + client.setName(name); + client.setClientnum("28101006" + String.format("%04d", i+1)); + client.setDistrictnum(532328101006L); + client.setDistricttitle("鍏冭皨鍘垮厓椹晣娓呭拰绀惧尯灞呮皯濮斿憳浼�"); + client.setPhone(phone); + client.setIdcard(idCard); + client.setTypeid(2024090516595201402L); + client.setAddress(address); + client.setOperator (2024090516595200302L); + client.setOperatedt(new Date()); + client.setDisabled((byte)0); + client.setDeleted((byte)0); + + Integer rec = clientSv.addClient(client); + } else if(town.trim().equals("鑰佸煄涔�2鍙�")) { + SeClient client = new SeClient(); + //client.setCountyid(28L); + //client.setTownid(202L); + //client.setVillageid(204L); + client.setCountyid(2024090516595200202L); + client.setTownid(2024090517252600002L); + client.setVillageid(2024090517294000002L); + client.setBlockid(2024090517155600002L); + client.setDivideid(2024090517355700007L); + client.setName(name); + client.setClientnum("28202204" + String.format("%04d", i)); + client.setDistrictnum(532328202204L); + client.setDistricttitle("鍏冭皨鍘胯�佸煄涔℃尐灏忔潙姘戝鍛樹細"); + client.setPhone(phone); + client.setIdcard(idCard); + client.setTypeid(2024090516595201402L); + client.setAddress(address); + client.setOperator (2024090516595200302L); + client.setOperatedt(new Date()); + client.setDisabled((byte)0); + client.setDeleted((byte)0); + + Integer rec = clientSv.addClient(client); + } + + System.out.println("-----------------------------: " + i); + } + + } + return BaseResponseUtils.buildSuccess(); + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientTemp/ClientTempSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientTemp/ClientTempSv.java new file mode 100644 index 0000000..3e64c9c --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientTemp/ClientTempSv.java @@ -0,0 +1,31 @@ +package com.dy.pipIrrSell.clientTemp; + +import com.dy.pipIrrGlobal.daoSe.SeClientMapper; +import com.dy.pipIrrGlobal.daoSe.SeClientTempMapper; +import com.dy.pipIrrGlobal.pojoSe.SeClientTemp; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author ZhuBaoMin + * @date 2024-09-26 15:03 + * @LastEditTime 2024-09-26 15:03 + * @Description + */ + +@Slf4j +@Service +public class ClientTempSv { + @Autowired + private SeClientTempMapper seClientTempMapper; + + @Autowired + private SeClientMapper seClientMapper; + + public List<SeClientTemp> getClientsByTownName(String townName ) { + return seClientTempMapper.getClientsByTownName(townName); + } +} -- Gitblit v1.8.0