Browse Source

优化代码

java110 4 years ago
parent
commit
e9e9d2d2e0

+ 83 - 0
java110-bean/src/main/java/com/java110/dto/ownerCarOpenUser/OwnerCarOpenUserDto.java

@@ -0,0 +1,83 @@
+package com.java110.dto.ownerCarOpenUser;
+
+import com.java110.dto.PageDto;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @ClassName FloorDto
+ * @Description 车辆微信关系数据层封装
+ * @Author wuxw
+ * @Date 2019/4/24 8:52
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+public class OwnerCarOpenUserDto extends PageDto implements Serializable {
+
+    private String openId;
+private String nickname;
+private String headimgurl;
+private String carNum;
+private String openUserId;
+private String openType;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getOpenId() {
+        return openId;
+    }
+public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+public String getNickname() {
+        return nickname;
+    }
+public void setNickname(String nickname) {
+        this.nickname = nickname;
+    }
+public String getHeadimgurl() {
+        return headimgurl;
+    }
+public void setHeadimgurl(String headimgurl) {
+        this.headimgurl = headimgurl;
+    }
+public String getCarNum() {
+        return carNum;
+    }
+public void setCarNum(String carNum) {
+        this.carNum = carNum;
+    }
+public String getOpenUserId() {
+        return openUserId;
+    }
+public void setOpenUserId(String openUserId) {
+        this.openUserId = openUserId;
+    }
+public String getOpenType() {
+        return openType;
+    }
+public void setOpenType(String openType) {
+        this.openType = openType;
+    }
+
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+}

+ 82 - 0
java110-bean/src/main/java/com/java110/po/ownerCarOpenUser/OwnerCarOpenUserPo.java

@@ -0,0 +1,82 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.po.ownerCarOpenUser;
+
+import java.io.Serializable;
+import java.util.Date;
+/**
+ * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
+ * add by 吴学文 at 2021-10-17 00:47:27 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+public class OwnerCarOpenUserPo implements Serializable {
+
+    private String openId;
+private String nickname;
+private String headimgurl;
+private String carNum;
+private String statusCd = "0";
+private String openUserId;
+private String openType;
+public String getOpenId() {
+        return openId;
+    }
+public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+public String getNickname() {
+        return nickname;
+    }
+public void setNickname(String nickname) {
+        this.nickname = nickname;
+    }
+public String getHeadimgurl() {
+        return headimgurl;
+    }
+public void setHeadimgurl(String headimgurl) {
+        this.headimgurl = headimgurl;
+    }
+public String getCarNum() {
+        return carNum;
+    }
+public void setCarNum(String carNum) {
+        this.carNum = carNum;
+    }
+public String getStatusCd() {
+        return statusCd;
+    }
+public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+public String getOpenUserId() {
+        return openUserId;
+    }
+public void setOpenUserId(String openUserId) {
+        this.openUserId = openUserId;
+    }
+public String getOpenType() {
+        return openType;
+    }
+public void setOpenType(String openType) {
+        this.openType = openType;
+    }
+
+
+
+}

+ 115 - 0
java110-db/src/main/resources/mapper/user/OwnerCarOpenUserV1ServiceDaoImplMapper.xml

@@ -0,0 +1,115 @@
+<?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="ownerCarOpenUserV1ServiceDaoImpl">
+
+
+
+
+
+    <!-- 保存车辆微信关系信息 add by wuxw 2018-07-03 -->
+    <insert id="saveOwnerCarOpenUserInfo" parameterType="Map">
+        insert into owner_car_open_user(
+open_id,nickname,headimgurl,car_num,open_user_id,open_type
+) values (
+#{openId},#{nickname},#{headimgurl},#{carNum},#{openUserId},#{openType}
+)
+    </insert>
+
+
+
+    <!-- 查询车辆微信关系信息 add by wuxw 2018-07-03 -->
+    <select id="getOwnerCarOpenUserInfo" parameterType="Map" resultType="Map">
+        select  t.open_id,t.open_id openId,t.nickname,t.headimgurl,t.car_num,t.car_num carNum,t.status_cd,t.status_cd statusCd,t.open_user_id,t.open_user_id openUserId,t.open_type,t.open_type openType 
+from owner_car_open_user t 
+where 1 =1 
+<if test="openId !=null and openId != ''">
+   and t.open_id= #{openId}
+</if> 
+<if test="nickname !=null and nickname != ''">
+   and t.nickname= #{nickname}
+</if> 
+<if test="headimgurl !=null and headimgurl != ''">
+   and t.headimgurl= #{headimgurl}
+</if> 
+<if test="carNum !=null and carNum != ''">
+   and t.car_num= #{carNum}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="openUserId !=null and openUserId != ''">
+   and t.open_user_id= #{openUserId}
+</if> 
+<if test="openType !=null and openType != ''">
+   and t.open_type= #{openType}
+</if> 
+order by t.create_time desc
+<if test="page != -1 and page != null ">
+   limit #{page}, #{row}
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改车辆微信关系信息 add by wuxw 2018-07-03 -->
+    <update id="updateOwnerCarOpenUserInfo" parameterType="Map">
+        update  owner_car_open_user t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="openId !=null and openId != ''">
+, t.open_id= #{openId}
+</if> 
+<if test="nickname !=null and nickname != ''">
+, t.nickname= #{nickname}
+</if> 
+<if test="headimgurl !=null and headimgurl != ''">
+, t.headimgurl= #{headimgurl}
+</if> 
+<if test="carNum !=null and carNum != ''">
+, t.car_num= #{carNum}
+</if> 
+<if test="openType !=null and openType != ''">
+, t.open_type= #{openType}
+</if> 
+ where 1=1 <if test="openUserId !=null and openUserId != ''">
+and t.open_user_id= #{openUserId}
+</if> 
+
+    </update>
+
+    <!-- 查询车辆微信关系数量 add by wuxw 2018-07-03 -->
+     <select id="queryOwnerCarOpenUsersCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from owner_car_open_user t 
+where 1 =1 
+<if test="openId !=null and openId != ''">
+   and t.open_id= #{openId}
+</if> 
+<if test="nickname !=null and nickname != ''">
+   and t.nickname= #{nickname}
+</if> 
+<if test="headimgurl !=null and headimgurl != ''">
+   and t.headimgurl= #{headimgurl}
+</if> 
+<if test="carNum !=null and carNum != ''">
+   and t.car_num= #{carNum}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="openUserId !=null and openUserId != ''">
+   and t.open_user_id= #{openUserId}
+</if> 
+<if test="openType !=null and openType != ''">
+   and t.open_type= #{openType}
+</if> 
+
+
+     </select>
+
+</mapper>

+ 16 - 12
java110-generator/src/main/java/com/java110/code/TableToJson.java

@@ -7,21 +7,25 @@ import com.java110.utils.util.StringUtil;
 public class TableToJson {
 
     //show create table c_orders  用这个语句获取
-    public static final String createTableSql = "CREATE TABLE `machine_type` (\n" +
-            "  `type_id` varchar(30) NOT NULL COMMENT '设备类型ID',\n" +
-            "  `machine_type_cd` varchar(30) NOT NULL COMMENT '设备大类 详情看t_dict',\n" +
-            "  `machine_type_name` varchar(30) NOT NULL COMMENT '设备类型名称',\n" +
+    public static final String createTableSql = "CREATE TABLE `owner_car_open_user` (\n" +
+            "  `open_user_id` varchar(30) NOT NULL COMMENT 'app用户ID',\n" +
+            "  `open_id` varchar(128) NOT NULL COMMENT '微信或支付宝开放ID',\n" +
+            "  `car_num` varchar(32) NOT NULL COMMENT '车牌号',\n" +
+            "  `open_type` varchar(12) NOT NULL DEFAULT 'WECHAT' COMMENT '微信WECHAT 支付宝 ALI',\n" +
+            "  `nickname` varchar(255) DEFAULT NULL COMMENT '昵称',\n" +
+            "  `headimgurl` varchar(255) DEFAULT NULL COMMENT '微信头像',\n" +
             "  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n" +
-            "  `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效',\n" +
-            "  KEY `idx_bm_machine_id` (`type_id`) USING BTREE\n";
+            "  `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,0, 在用 1失效',\n" +
+            "  PRIMARY KEY (`open_user_id`)\n" +
+            ")";
 
     public static void main(String[] args) {
-        String desc = "老人类型";
-        String id = "typeId";
-        String name = "govOldPersonType";
-        String shareName = "cust"; //生成到那个服务下
-        String shareColumn = "ca_id";
-        String shareParam = "caId";
+        String desc = "车辆微信关系";
+        String id = "openUserId";
+        String name = "ownerCarOpenUser";
+        String shareName = "user"; //生成到那个服务下
+        String shareColumn = "open_user_id";
+        String shareParam = "openUserId";
 
         //业务名称 desc 业务编码名称生成后类名 name 主键 id  需要放到那个服务 shareName
         String newSql = createTableSql.substring(createTableSql.indexOf("(") + 1, createTableSql.lastIndexOf(")"));

+ 33 - 0
java110-generator/src/main/resources/newBack/template_1.json

@@ -0,0 +1,33 @@
+{
+  "param": {
+    "openId": "open_id",
+    "nickname": "nickname",
+    "headimgurl": "headimgurl",
+    "carNum": "car_num",
+    "statusCd": "status_cd",
+    "openUserId": "open_user_id",
+    "openType": "open_type"
+  },
+  "name": "ownerCarOpenUser",
+  "shareColumn": "open_user_id",
+  "id": "openUserId",
+  "shareName": "user",
+  "autoMove": true,
+  "required": [
+    {
+      "msg": "微信或支付宝开放ID不能为空",
+      "code": "openId"
+    },
+    {
+      "msg": "车牌号不能为空",
+      "code": "carNum"
+    },
+    {
+      "msg": "微信WECHAT不能为空",
+      "code": "openType"
+    }
+  ],
+  "desc": "车辆微信关系",
+  "shareParam": "openUserId",
+  "tableName": "owner_car_open_user"
+}

+ 68 - 0
java110-interface/src/main/java/com/java110/intf/user/IOwnerCarOpenUserV1InnerServiceSMO.java

@@ -0,0 +1,68 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.intf.user;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.ownerCarOpenUser.OwnerCarOpenUserDto;
+import com.java110.po.ownerCarOpenUser.OwnerCarOpenUserPo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+/**
+ * 类表述: 服务之前调用的接口类,不对外提供接口能力 只用于接口建调用
+ * add by 吴学文 at 2021-10-17 00:47:27 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@FeignClient(name = "user-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/ownerCarOpenUserV1Api")
+public interface IOwnerCarOpenUserV1InnerServiceSMO {
+
+
+    @RequestMapping(value = "/saveOwnerCarOpenUser", method = RequestMethod.POST)
+    public int saveOwnerCarOpenUser(@RequestBody  OwnerCarOpenUserPo ownerCarOpenUserPo);
+
+    @RequestMapping(value = "/updateOwnerCarOpenUser", method = RequestMethod.POST)
+    public int updateOwnerCarOpenUser(@RequestBody  OwnerCarOpenUserPo ownerCarOpenUserPo);
+
+    @RequestMapping(value = "/deleteOwnerCarOpenUser", method = RequestMethod.POST)
+    public int deleteOwnerCarOpenUser(@RequestBody  OwnerCarOpenUserPo ownerCarOpenUserPo);
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param ownerCarOpenUserDto 数据对象分享
+     * @return OwnerCarOpenUserDto 对象数据
+     */
+    @RequestMapping(value = "/queryOwnerCarOpenUsers", method = RequestMethod.POST)
+    List<OwnerCarOpenUserDto> queryOwnerCarOpenUsers(@RequestBody OwnerCarOpenUserDto ownerCarOpenUserDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param ownerCarOpenUserDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryOwnerCarOpenUsersCount", method = RequestMethod.POST)
+    int queryOwnerCarOpenUsersCount(@RequestBody OwnerCarOpenUserDto ownerCarOpenUserDto);
+}

+ 71 - 0
service-user/src/main/java/com/java110/user/cmd/ownerCarOpenUser/DeleteOwnerCarOpenUserCmd.java

@@ -0,0 +1,71 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.cmd.ownerCarOpenUser;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.AbstractServiceCmdListener;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.intf.user.IOwnerCarOpenUserV1InnerServiceSMO;
+import com.java110.po.ownerCarOpenUser.OwnerCarOpenUserPo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * 类表述:删除
+ * 服务编码:ownerCarOpenUser.deleteOwnerCarOpenUser
+ * 请求路劲:/app/ownerCarOpenUser.DeleteOwnerCarOpenUser
+ * add by 吴学文 at 2021-10-17 00:47:27 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "ownerCarOpenUser.deleteOwnerCarOpenUser")
+public class DeleteOwnerCarOpenUserCmd extends AbstractServiceCmdListener {
+    private static Logger logger = LoggerFactory.getLogger(DeleteOwnerCarOpenUserCmd.class);
+
+    @Autowired
+    private IOwnerCarOpenUserV1InnerServiceSMO ownerCarOpenUserV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "openUserId", "openUserId不能为空");
+        Assert.hasKeyAndValue(reqJson, "openUserId", "openUserId不能为空");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        OwnerCarOpenUserPo ownerCarOpenUserPo = BeanConvertUtil.covertBean(reqJson, OwnerCarOpenUserPo.class);
+        int flag = ownerCarOpenUserV1InnerServiceSMOImpl.deleteOwnerCarOpenUser(ownerCarOpenUserPo);
+
+        if (flag < 1) {
+            throw new CmdException("删除数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 84 - 0
service-user/src/main/java/com/java110/user/cmd/ownerCarOpenUser/ListOwnerCarOpenUserCmd.java

@@ -0,0 +1,84 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.cmd.ownerCarOpenUser;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.AbstractServiceCmdListener;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.intf.user.IOwnerCarOpenUserV1InnerServiceSMO;
+import com.java110.po.ownerCarOpenUser.OwnerCarOpenUserPo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.java110.dto.ownerCarOpenUser.OwnerCarOpenUserDto;
+import java.util.List;
+import java.util.ArrayList;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.HttpStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * 类表述:查询
+ * 服务编码:ownerCarOpenUser.listOwnerCarOpenUser
+ * 请求路劲:/app/ownerCarOpenUser.ListOwnerCarOpenUser
+ * add by 吴学文 at 2021-10-17 00:47:27 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "ownerCarOpenUser.listOwnerCarOpenUser")
+public class ListOwnerCarOpenUserCmd extends AbstractServiceCmdListener {
+
+  private static Logger logger = LoggerFactory.getLogger(ListOwnerCarOpenUserCmd.class);
+    @Autowired
+    private IOwnerCarOpenUserV1InnerServiceSMO ownerCarOpenUserV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+           OwnerCarOpenUserDto ownerCarOpenUserDto = BeanConvertUtil.covertBean(reqJson, OwnerCarOpenUserDto.class);
+
+           int count = ownerCarOpenUserV1InnerServiceSMOImpl.queryOwnerCarOpenUsersCount(ownerCarOpenUserDto);
+
+           List<OwnerCarOpenUserDto> ownerCarOpenUserDtos = null;
+
+           if (count > 0) {
+               ownerCarOpenUserDtos = ownerCarOpenUserV1InnerServiceSMOImpl.queryOwnerCarOpenUsers(ownerCarOpenUserDto);
+           } else {
+               ownerCarOpenUserDtos = new ArrayList<>();
+           }
+
+           ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, ownerCarOpenUserDtos);
+
+           ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+           cmdDataFlowContext.setResponseEntity(responseEntity);
+    }
+}

+ 77 - 0
service-user/src/main/java/com/java110/user/cmd/ownerCarOpenUser/SaveOwnerCarOpenUserCmd.java

@@ -0,0 +1,77 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.cmd.ownerCarOpenUser;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.AbstractServiceCmdListener;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.intf.user.IOwnerCarOpenUserV1InnerServiceSMO;
+import com.java110.po.ownerCarOpenUser.OwnerCarOpenUserPo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 类表述:保存
+ * 服务编码:ownerCarOpenUser.saveOwnerCarOpenUser
+ * 请求路劲:/app/ownerCarOpenUser.SaveOwnerCarOpenUser
+ * add by 吴学文 at 2021-10-17 00:47:27 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "ownerCarOpenUser.saveOwnerCarOpenUser")
+public class SaveOwnerCarOpenUserCmd extends AbstractServiceCmdListener {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveOwnerCarOpenUserCmd.class);
+
+    public static final String CODE_PREFIX_ID = "10";
+
+    @Autowired
+    private IOwnerCarOpenUserV1InnerServiceSMO ownerCarOpenUserV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "openId", "请求报文中未包含openId");
+Assert.hasKeyAndValue(reqJson, "carNum", "请求报文中未包含carNum");
+Assert.hasKeyAndValue(reqJson, "openType", "请求报文中未包含openType");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+       OwnerCarOpenUserPo ownerCarOpenUserPo = BeanConvertUtil.covertBean(reqJson, OwnerCarOpenUserPo.class);
+        ownerCarOpenUserPo.setOpenUserId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+        int flag = ownerCarOpenUserV1InnerServiceSMOImpl.saveOwnerCarOpenUser(ownerCarOpenUserPo);
+
+        if (flag < 1) {
+            throw new CmdException("保存数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 74 - 0
service-user/src/main/java/com/java110/user/cmd/ownerCarOpenUser/UpdateOwnerCarOpenUserCmd.java

@@ -0,0 +1,74 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.cmd.ownerCarOpenUser;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.AbstractServiceCmdListener;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.intf.user.IOwnerCarOpenUserV1InnerServiceSMO;
+import com.java110.po.ownerCarOpenUser.OwnerCarOpenUserPo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+/**
+ * 类表述:更新
+ * 服务编码:ownerCarOpenUser.updateOwnerCarOpenUser
+ * 请求路劲:/app/ownerCarOpenUser.UpdateOwnerCarOpenUser
+ * add by 吴学文 at 2021-10-17 00:47:27 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "ownerCarOpenUser.updateOwnerCarOpenUser")
+public class UpdateOwnerCarOpenUserCmd extends AbstractServiceCmdListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateOwnerCarOpenUserCmd.class);
+
+
+    @Autowired
+    private IOwnerCarOpenUserV1InnerServiceSMO ownerCarOpenUserV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "openUserId", "openUserId不能为空");
+        Assert.hasKeyAndValue(reqJson, "openUserId", "openUserId不能为空");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        OwnerCarOpenUserPo ownerCarOpenUserPo = BeanConvertUtil.covertBean(reqJson, OwnerCarOpenUserPo.class);
+        int flag = ownerCarOpenUserV1InnerServiceSMOImpl.updateOwnerCarOpenUser(ownerCarOpenUserPo);
+
+        if (flag < 1) {
+            throw new CmdException("更新数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 77 - 0
service-user/src/main/java/com/java110/user/dao/IOwnerCarOpenUserV1ServiceDao.java

@@ -0,0 +1,77 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.dao;
+
+
+import com.java110.utils.exception.DAOException;
+import com.java110.entity.merchant.BoMerchant;
+import com.java110.entity.merchant.BoMerchantAttr;
+import com.java110.entity.merchant.Merchant;
+import com.java110.entity.merchant.MerchantAttr;
+
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 类表述:
+ * add by 吴学文 at 2021-10-17 00:47:27 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+public interface IOwnerCarOpenUserV1ServiceDao {
+
+
+    /**
+     * 保存 车辆微信关系信息
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    int saveOwnerCarOpenUserInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询车辆微信关系信息(instance过程)
+     * 根据bId 查询车辆微信关系信息
+     * @param info bId 信息
+     * @return 车辆微信关系信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getOwnerCarOpenUserInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改车辆微信关系信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    int updateOwnerCarOpenUserInfo(Map info) throws DAOException;
+
+
+    /**
+     * 查询车辆微信关系总数
+     *
+     * @param info 车辆微信关系信息
+     * @return 车辆微信关系数量
+     */
+    int queryOwnerCarOpenUsersCount(Map info);
+
+}

+ 112 - 0
service-user/src/main/java/com/java110/user/dao/impl/OwnerCarOpenUserV1ServiceDaoImpl.java

@@ -0,0 +1,112 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.user.dao.IOwnerCarOpenUserV1ServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 类表述:
+ * add by 吴学文 at 2021-10-17 00:47:27 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Service("ownerCarOpenUserV1ServiceDaoImpl")
+public class OwnerCarOpenUserV1ServiceDaoImpl extends BaseServiceDao implements IOwnerCarOpenUserV1ServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(OwnerCarOpenUserV1ServiceDaoImpl.class);
+
+
+
+
+
+    /**
+     * 保存车辆微信关系信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int saveOwnerCarOpenUserInfo(Map info) throws DAOException {
+        logger.debug("保存 saveOwnerCarOpenUserInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("ownerCarOpenUserV1ServiceDaoImpl.saveOwnerCarOpenUserInfo",info);
+
+        return saveFlag;
+    }
+
+
+    /**
+     * 查询车辆微信关系信息(instance)
+     * @param info bId 信息
+     * @return List<Map>
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getOwnerCarOpenUserInfo(Map info) throws DAOException {
+        logger.debug("查询 getOwnerCarOpenUserInfo 入参 info : {}",info);
+
+        List<Map> businessOwnerCarOpenUserInfos = sqlSessionTemplate.selectList("ownerCarOpenUserV1ServiceDaoImpl.getOwnerCarOpenUserInfo",info);
+
+        return businessOwnerCarOpenUserInfos;
+    }
+
+
+    /**
+     * 修改车辆微信关系信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int updateOwnerCarOpenUserInfo(Map info) throws DAOException {
+        logger.debug("修改 updateOwnerCarOpenUserInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("ownerCarOpenUserV1ServiceDaoImpl.updateOwnerCarOpenUserInfo",info);
+
+        return saveFlag;
+    }
+
+     /**
+     * 查询车辆微信关系数量
+     * @param info 车辆微信关系信息
+     * @return 车辆微信关系数量
+     */
+    @Override
+    public int queryOwnerCarOpenUsersCount(Map info) {
+        logger.debug("查询 queryOwnerCarOpenUsersCount 入参 info : {}",info);
+
+        List<Map> businessOwnerCarOpenUserInfos = sqlSessionTemplate.selectList("ownerCarOpenUserV1ServiceDaoImpl.queryOwnerCarOpenUsersCount", info);
+        if (businessOwnerCarOpenUserInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessOwnerCarOpenUserInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 89 - 0
service-user/src/main/java/com/java110/user/smo/impl/OwnerCarOpenUserV1InnerServiceSMOImpl.java

@@ -0,0 +1,89 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.smo.impl;
+
+
+import com.java110.user.dao.IOwnerCarOpenUserV1ServiceDao;
+import com.java110.intf.user.IOwnerCarOpenUserV1InnerServiceSMO;
+import com.java110.dto.ownerCarOpenUser.OwnerCarOpenUserDto;
+import com.java110.po.ownerCarOpenUser.OwnerCarOpenUserPo;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.dto.user.UserDto;
+import com.java110.dto.PageDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 类表述: 服务之前调用的接口实现类,不对外提供接口能力 只用于接口建调用
+ * add by 吴学文 at 2021-10-17 00:47:27 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@RestController
+public class OwnerCarOpenUserV1InnerServiceSMOImpl extends BaseServiceSMO implements IOwnerCarOpenUserV1InnerServiceSMO {
+
+    @Autowired
+    private IOwnerCarOpenUserV1ServiceDao ownerCarOpenUserV1ServiceDaoImpl;
+
+
+    @Override
+    public int saveOwnerCarOpenUser(@RequestBody  OwnerCarOpenUserPo ownerCarOpenUserPo) {
+        int saveFlag = ownerCarOpenUserV1ServiceDaoImpl.saveOwnerCarOpenUserInfo(BeanConvertUtil.beanCovertMap(ownerCarOpenUserPo));
+        return saveFlag;
+    }
+
+     @Override
+    public int updateOwnerCarOpenUser(@RequestBody  OwnerCarOpenUserPo ownerCarOpenUserPo) {
+        int saveFlag = ownerCarOpenUserV1ServiceDaoImpl.updateOwnerCarOpenUserInfo(BeanConvertUtil.beanCovertMap(ownerCarOpenUserPo));
+        return saveFlag;
+    }
+
+     @Override
+    public int deleteOwnerCarOpenUser(@RequestBody  OwnerCarOpenUserPo ownerCarOpenUserPo) {
+       ownerCarOpenUserPo.setStatusCd("1");
+       int saveFlag = ownerCarOpenUserV1ServiceDaoImpl.updateOwnerCarOpenUserInfo(BeanConvertUtil.beanCovertMap(ownerCarOpenUserPo));
+       return saveFlag;
+    }
+
+    @Override
+    public List<OwnerCarOpenUserDto> queryOwnerCarOpenUsers(@RequestBody  OwnerCarOpenUserDto ownerCarOpenUserDto) {
+
+        //校验是否传了 分页信息
+
+        int page = ownerCarOpenUserDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            ownerCarOpenUserDto.setPage((page - 1) * ownerCarOpenUserDto.getRow());
+        }
+
+        List<OwnerCarOpenUserDto> ownerCarOpenUsers = BeanConvertUtil.covertBeanList(ownerCarOpenUserV1ServiceDaoImpl.getOwnerCarOpenUserInfo(BeanConvertUtil.beanCovertMap(ownerCarOpenUserDto)), OwnerCarOpenUserDto.class);
+
+        return ownerCarOpenUsers;
+    }
+
+
+    @Override
+    public int queryOwnerCarOpenUsersCount(@RequestBody OwnerCarOpenUserDto ownerCarOpenUserDto) {
+        return ownerCarOpenUserV1ServiceDaoImpl.queryOwnerCarOpenUsersCount(BeanConvertUtil.beanCovertMap(ownerCarOpenUserDto));    }
+
+}