Kaynağa Gözat

运营管理小区公众号配置功能

wuxw 1 yıl önce
ebeveyn
işleme
b0dc3d8901
16 değiştirilmiş dosya ile 645 ekleme ve 18 silme
  1. 9 0
      java110-bean/src/main/java/com/java110/dto/machine/MachineTypeDto.java
  2. 18 0
      java110-bean/src/main/java/com/java110/dto/wechat/SmallWeChatDto.java
  3. 15 0
      java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml
  4. 4 0
      java110-interface/src/main/java/com/java110/intf/report/IReportCommunityInnerServiceSMO.java
  5. 110 0
      service-common/src/main/java/com/java110/common/cmd/equipmentAccount/ListAdminEquipmentAccountCmd.java
  6. 3 0
      service-common/src/main/java/com/java110/common/cmd/machineType/ListMachineTypeCmd.java
  7. 155 0
      service-report/src/main/java/com/java110/report/cmd/community/QueryCommunityMachineTypeTreeCmd.java
  8. 2 0
      service-report/src/main/java/com/java110/report/dao/IReportCommunityServiceDao.java
  9. 12 3
      service-report/src/main/java/com/java110/report/dao/impl/ReportCommunityServiceDaoImpl.java
  10. 11 0
      service-report/src/main/java/com/java110/report/smo/impl/ReportCommunityInnerServiceSMOImpl.java
  11. 130 0
      service-store/src/main/java/com/java110/store/cmd/smallWechat/ListAdminSmallWeChatsCmd.java
  12. 0 14
      service-store/src/main/java/com/java110/store/cmd/smallWechat/ListSmallWeChatsCmd.java
  13. 95 0
      service-store/src/main/java/com/java110/store/cmd/smallWechat/SaveAdminSmallWechatCmd.java
  14. 1 1
      service-store/src/main/java/com/java110/store/cmd/smallWechat/SaveSmallWechatCmd.java
  15. 79 0
      service-store/src/main/java/com/java110/store/cmd/smallWechat/UpdateAdminSmallWechatCmd.java
  16. 1 0
      service-store/src/main/java/com/java110/store/cmd/smallWechat/UpdateSmallWechatCmd.java

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/machine/MachineTypeDto.java

@@ -20,6 +20,7 @@ public class MachineTypeDto extends PageDto implements Serializable {
     private String parentTypeId;
     private String machineTypeCd;
     private String communityId;
+    private String communityName;
     private String isEnable;
     private String machineTypeCode;
     private String unit;
@@ -145,4 +146,12 @@ public class MachineTypeDto extends PageDto implements Serializable {
     public void setWarrantyDeadline(String warrantyDeadline) {
         this.warrantyDeadline = warrantyDeadline;
     }
+
+    public String getCommunityName() {
+        return communityName;
+    }
+
+    public void setCommunityName(String communityName) {
+        this.communityName = communityName;
+    }
 }

+ 18 - 0
java110-bean/src/main/java/com/java110/dto/wechat/SmallWeChatDto.java

@@ -31,6 +31,8 @@ public class SmallWeChatDto extends PageDto implements Serializable {
     private String appSecret;
     private String name;
     private String objId;
+    private String communityId;
+    private String communityName;
     private String wechatId;
     private String weChatId;
     private String payPassword;
@@ -205,4 +207,20 @@ public class SmallWeChatDto extends PageDto implements Serializable {
     public void setMchName(String mchName) {
         this.mchName = mchName;
     }
+
+    public String getCommunityId() {
+        return communityId;
+    }
+
+    public void setCommunityId(String communityId) {
+        this.communityId = communityId;
+    }
+
+    public String getCommunityName() {
+        return communityName;
+    }
+
+    public void setCommunityName(String communityName) {
+        this.communityName = communityName;
+    }
 }

+ 15 - 0
java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml

@@ -361,6 +361,21 @@
         order by ip.create_time desc
     </select>
 
+    <select id="queryCommunityMachineTypeTree" parameterType="Map" resultType="Map">
+        select s.community_id communityId,s.name communityName,t.type_id typeId,t.parent_type_id parentTypeId,t.machine_type_name machineTypeName
+        from machine_type t
+        left join s_community s on t.community_id = s.community_id and s.status_cd = '0'
+        where t.status_cd = '0'
+        and s.status_cd = '0'
+        <if test="communityIds !=null ">
+            and s.community_id in
+            <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        order by t.seq
+    </select>
+
 
     <select id="queryHisOwnerCarCount" parameterType="Map" resultType="Map">
         select count(1) count

+ 4 - 0
java110-interface/src/main/java/com/java110/intf/report/IReportCommunityInnerServiceSMO.java

@@ -4,6 +4,7 @@ import com.java110.config.feign.FeignConfiguration;
 import com.java110.dto.fee.FeeConfigDto;
 import com.java110.dto.floor.FloorDto;
 import com.java110.dto.inspection.InspectionPlanDto;
+import com.java110.dto.machine.MachineTypeDto;
 import com.java110.dto.parking.ParkingAreaDto;
 import com.java110.dto.repair.RepairSettingDto;
 import com.java110.dto.room.RoomDto;
@@ -121,4 +122,7 @@ public interface IReportCommunityInnerServiceSMO {
 
     @RequestMapping(value = "/queryCommunityFloorTree", method = RequestMethod.POST)
     List<FloorDto> queryCommunityFloorTree(@RequestBody FloorDto floorDto);
+
+    @RequestMapping(value = "/queryCommunityMachineTypeTree", method = RequestMethod.POST)
+    List<MachineTypeDto> queryCommunityMachineTypeTree(@RequestBody MachineTypeDto machineTypeDto);
 }

+ 110 - 0
service-common/src/main/java/com/java110/common/cmd/equipmentAccount/ListAdminEquipmentAccountCmd.java

@@ -0,0 +1,110 @@
+/*
+ * 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.common.cmd.equipmentAccount;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.machine.EquipmentAccountDto;
+import com.java110.dto.machine.MachineTypeDto;
+import com.java110.intf.common.IEquipmentAccountV1InnerServiceSMO;
+import com.java110.intf.common.IMachineTypeV1InnerServiceSMO;
+import com.java110.utils.cache.UrlCache;
+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;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * 类表述:查询
+ * 服务编码:equipmentAccount.listEquipmentAccount
+ * 请求路劲:/app/equipmentAccount.ListEquipmentAccount
+ * add by 吴学文 at 2022-09-10 20:37:25 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 = "equipmentAccount.listAdminEquipmentAccount")
+public class ListAdminEquipmentAccountCmd extends Cmd {
+
+    private static Logger logger = LoggerFactory.getLogger(ListAdminEquipmentAccountCmd.class);
+    @Autowired
+    private IEquipmentAccountV1InnerServiceSMO equipmentAccountV1InnerServiceSMOImpl;
+
+    @Autowired
+    private IMachineTypeV1InnerServiceSMO machineTypeV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+        super.validateAdmin(cmdDataFlowContext);
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        EquipmentAccountDto equipmentAccountDto = BeanConvertUtil.covertBean(reqJson, EquipmentAccountDto.class);
+
+        int count = equipmentAccountV1InnerServiceSMOImpl.queryEquipmentAccountsCount(equipmentAccountDto);
+
+        List<EquipmentAccountDto> equipmentAccountDtos = null;
+        String ownerUrl = UrlCache.getOwnerUrl();
+
+
+        if (count > 0) {
+            equipmentAccountDtos = equipmentAccountV1InnerServiceSMOImpl.queryEquipmentAccounts(equipmentAccountDto);
+            MachineTypeDto machineTypeDto = new MachineTypeDto();
+            machineTypeDto.setPage(1);
+            machineTypeDto.setRow(100);
+            machineTypeDto.setCommunityId(equipmentAccountDto.getCommunityId());
+            machineTypeDto.setTypeId(equipmentAccountDto.getTypeId());
+            List<MachineTypeDto> machineTypeDtos = machineTypeV1InnerServiceSMOImpl.queryMachineTypes(machineTypeDto);
+            for (EquipmentAccountDto equ : equipmentAccountDtos) {
+                for (MachineTypeDto typeDto : machineTypeDtos) {
+                    if (typeDto.getTypeId().equals(equ.getTypeId())) {
+                        equ.setMachineTypeName(typeDto.getMachineTypeName());
+                        continue;
+                    }
+                }
+
+                ownerUrl += ("/#/pages/machine/machine?machineId=" + equ.getMachineId() + "&communityId=" + equ.getCommunityId());
+                equ.setUrl(ownerUrl);
+            }
+
+
+        } else {
+            equipmentAccountDtos = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, equipmentAccountDtos);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        cmdDataFlowContext.setResponseEntity(responseEntity);
+    }
+}

+ 3 - 0
service-common/src/main/java/com/java110/common/cmd/machineType/ListMachineTypeCmd.java

@@ -22,6 +22,7 @@ import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.intf.common.IMachineTypeV1InnerServiceSMO;
 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;
@@ -56,6 +57,8 @@ public class ListMachineTypeCmd extends Cmd {
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         super.validatePageInfo(reqJson);
+        Assert.hasKeyAndValue(reqJson,"communityId","未包含小区ID");
+        super.validateProperty(cmdDataFlowContext);
     }
 
     @Override

+ 155 - 0
service-report/src/main/java/com/java110/report/cmd/community/QueryCommunityMachineTypeTreeCmd.java

@@ -0,0 +1,155 @@
+package com.java110.report.cmd.community;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.floor.FloorDto;
+import com.java110.dto.machine.MachineTypeDto;
+import com.java110.dto.org.OrgDto;
+import com.java110.dto.unit.UnitDto;
+import com.java110.intf.report.IReportCommunityInnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.ListUtil;
+import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.text.ParseException;
+import java.util.List;
+
+/**
+ * 查询小区设备类型树
+ */
+@Java110Cmd(serviceCode = "community.queryCommunityMachineTypeTree")
+public class QueryCommunityMachineTypeTreeCmd extends Cmd {
+
+    @Autowired
+    private IReportCommunityInnerServiceSMO reportCommunityInnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        super.validateAdmin(context);
+
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+
+        List<MachineTypeDto> machineTypeDtos = null;
+
+        MachineTypeDto machineTypeDto = new MachineTypeDto();
+
+        machineTypeDtos = reportCommunityInnerServiceSMOImpl.queryCommunityMachineTypeTree(machineTypeDto);
+        JSONArray communitys = new JSONArray();
+        if (ListUtil.isNull(machineTypeDtos)) {
+            context.setResponseEntity(ResultVo.createResponseEntity(communitys));
+            return;
+        }
+
+        JSONObject communityInfo = null;
+        for (MachineTypeDto tmpMachineTypeDto : machineTypeDtos) {
+            if (!hasInCommunity(tmpMachineTypeDto, communitys)) {
+                communityInfo = new JSONObject();
+                communityInfo.put("id", "c_" + tmpMachineTypeDto.getCommunityId());
+                communityInfo.put("communityId", tmpMachineTypeDto.getCommunityId());
+                communityInfo.put("text", tmpMachineTypeDto.getCommunityName());
+                communityInfo.put("icon", "/img/org.png");
+                communityInfo.put("children", new JSONArray());
+                communitys.add(communityInfo);
+            }
+        }
+
+        if(ListUtil.isNull(communitys)){
+            context.setResponseEntity(ResultVo.createResponseEntity(communitys));
+            return;
+        }
+        for(int cIndex = 0 ;cIndex < communitys.size();cIndex++){
+            communityInfo = communitys.getJSONObject(cIndex);
+            findOneMachineType(communityInfo, machineTypeDtos);
+
+        }
+        context.setResponseEntity(ResultVo.createResponseEntity(communitys));
+    }
+
+    private void findOneMachineType(JSONObject communityInfo, List<MachineTypeDto> machineTypeDtos) {
+        JSONArray childs = communityInfo.getJSONArray("children");
+        JSONObject child = null;
+        for (MachineTypeDto tmpMachineTypeDto : machineTypeDtos) {
+            if(!communityInfo.getString("communityId").equals(tmpMachineTypeDto.getCommunityId())){
+                continue;
+            }
+            if (StringUtil.isEmpty(tmpMachineTypeDto.getParentTypeId())) {
+                child = new JSONObject();
+                child.put("id", "m_" + tmpMachineTypeDto.getTypeId());
+                child.put("typeId", tmpMachineTypeDto.getTypeId());
+                child.put("communityId", communityInfo.getString("communityId"));
+                child.put("text", tmpMachineTypeDto.getMachineTypeName());
+                child.put("icon", "/img/org.png");
+                childs.add(child);
+            }
+        }
+        for(int cIndex = 0 ;cIndex < childs.size();cIndex++){
+            child = childs.getJSONObject(cIndex);
+            findChilds(child, machineTypeDtos);
+
+        }
+
+    }
+
+
+    private void findChilds(JSONObject parentChild, List<MachineTypeDto> machineTypeDtos) {
+
+        JSONArray childs = new JSONArray();
+        JSONObject child = null;
+        for (MachineTypeDto machineTypeDto : machineTypeDtos) {
+            if (parentChild.getString("typeId").equals(machineTypeDto.getTypeId())) { // 他自己跳过
+                continue;
+            }
+            if(StringUtil.isEmpty(machineTypeDto.getParentTypeId())){
+                continue;
+            }
+            if (machineTypeDto.getParentTypeId().equals(parentChild.getString("typeId"))) {//二级
+                child = new JSONObject();
+                child.put("id", "m_" + machineTypeDto.getTypeId());
+                child.put("typeId", machineTypeDto.getTypeId());
+                child.put("communityId", parentChild.getString("communityId"));
+                child.put("text", machineTypeDto.getMachineTypeName());
+                child.put("icon", "/img/org.png");
+                childs.add(child);
+            }
+        }
+
+        if (ListUtil.isNull(childs)) {
+            return;
+        }
+
+        parentChild.put("children",childs);
+
+        for(int orgIndex = 0 ;orgIndex < childs.size();orgIndex++){
+            child = childs.getJSONObject(orgIndex);
+            findChilds(child, machineTypeDtos);
+
+        }
+    }
+
+
+    private boolean hasInCommunity(MachineTypeDto tmpMachineTypeDto, JSONArray communitys) {
+        JSONObject community = null;
+        for (int cIndex = 0; cIndex < communitys.size(); cIndex++) {
+            community = communitys.getJSONObject(cIndex);
+            if (!community.containsKey("communityId")) {
+                continue;
+            }
+            if (StringUtil.isEmpty(community.getString("communityId"))) {
+                continue;
+            }
+            if (community.getString("communityId").equals(tmpMachineTypeDto.getCommunityId())) {
+                return true;
+            }
+        }
+        return false;
+    }
+}

+ 2 - 0
service-report/src/main/java/com/java110/report/dao/IReportCommunityServiceDao.java

@@ -122,4 +122,6 @@ public interface IReportCommunityServiceDao {
     List<Map> queryCommunityInspectionTree(Map info);
 
     List<Map> queryCommunityFloorTree(Map info);
+
+    List<Map> queryCommunityMachineTypeTree(Map info);
 }

+ 12 - 3
service-report/src/main/java/com/java110/report/dao/impl/ReportCommunityServiceDaoImpl.java

@@ -173,16 +173,25 @@ public class ReportCommunityServiceDaoImpl extends BaseServiceDao implements IRe
         return infos;
     }
 
+    @Override
+    public List<Map> queryCommunityMachineTypeTree(Map info) {
+        logger.debug("查询 queryCommunityMachineTypeTree 信息 入参 info : {}", JSONObject.toJSONString(info));
+
+        List<Map> infos = sqlSessionTemplate.selectList("reportCommunityServiceDaoImpl.queryCommunityMachineTypeTree", info);
+
+        return infos;
+    }
+
     @Override
     public int queryHisOwnerCarCount(Map info) {
         logger.debug("查询车辆管理数据 入参 info : {}", info);
 
-        List<Map> businessOwnerCarInfos = sqlSessionTemplate.selectList("reportCommunityServiceDaoImpl.queryHisOwnerCarCount", info);
-        if (businessOwnerCarInfos.size() < 1) {
+        List<Map> infos = sqlSessionTemplate.selectList("reportCommunityServiceDaoImpl.queryHisOwnerCarCount", info);
+        if (infos.size() < 1) {
             return 0;
         }
 
-        return Integer.parseInt(businessOwnerCarInfos.get(0).get("count").toString());
+        return Integer.parseInt(infos.get(0).get("count").toString());
     }
 
     @Override

+ 11 - 0
service-report/src/main/java/com/java110/report/smo/impl/ReportCommunityInnerServiceSMOImpl.java

@@ -6,6 +6,7 @@ import com.java110.dto.PageDto;
 import com.java110.dto.fee.FeeConfigDto;
 import com.java110.dto.floor.FloorDto;
 import com.java110.dto.inspection.InspectionPlanDto;
+import com.java110.dto.machine.MachineTypeDto;
 import com.java110.dto.parking.ParkingAreaDto;
 import com.java110.dto.repair.RepairSettingDto;
 import com.java110.dto.room.RoomDto;
@@ -123,6 +124,16 @@ public class ReportCommunityInnerServiceSMOImpl extends BaseServiceSMO implement
         return floorDtos;
     }
 
+    @Override
+    public List<MachineTypeDto> queryCommunityMachineTypeTree(@RequestBody MachineTypeDto machineTypeDto) {
+        //校验是否传了 分页信息
+        List<MachineTypeDto> machineTypeDtos = BeanConvertUtil.covertBeanList(
+                reportCommunityServiceDaoImpl.queryCommunityMachineTypeTree(BeanConvertUtil.beanCovertMap(machineTypeDto)),
+                MachineTypeDto.class);
+
+        return machineTypeDtos;
+    }
+
     @Override
     public int queryHisOwnerCarCount(@RequestBody OwnerCarDto ownerCarDto) {
         return reportCommunityServiceDaoImpl.queryHisOwnerCarCount(BeanConvertUtil.beanCovertMap(ownerCarDto));

+ 130 - 0
service-store/src/main/java/com/java110/store/cmd/smallWechat/ListAdminSmallWeChatsCmd.java

@@ -0,0 +1,130 @@
+/*
+ * 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.store.cmd.smallWechat;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.community.CommunityDto;
+import com.java110.dto.repair.RepairDto;
+import com.java110.dto.wechat.SmallWeChatDto;
+import com.java110.intf.community.ICommunityV1InnerServiceSMO;
+import com.java110.intf.store.ISmallWechatV1InnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.ListUtil;
+import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
+import com.java110.vo.api.smallWeChat.ApiSmallWeChatDataVo;
+import com.java110.vo.api.smallWeChat.ApiSmallWeChatVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * 类表述:查询
+ * 服务编码:smallWechat.listSmallWechat
+ * 请求路劲:/app/smallWechat.ListSmallWechat
+ * add by 吴学文 at 2022-05-25 10:46:07 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 = "smallWeChat.listAdminSmallWeChats")
+public class ListAdminSmallWeChatsCmd extends Cmd {
+
+    private static Logger logger = LoggerFactory.getLogger(ListAdminSmallWeChatsCmd.class);
+    @Autowired
+    private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl;
+
+    @Autowired
+    private ICommunityV1InnerServiceSMO communityV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+        super.validateAdmin(cmdDataFlowContext);
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        SmallWeChatDto smallWeChatDto = BeanConvertUtil.covertBean(reqJson, SmallWeChatDto.class);
+        smallWeChatDto.setObjType(SmallWeChatDto.OBJ_TYPE_COMMUNITY);
+        if (StringUtil.jsonHasKayAndValue(reqJson, "communityId")) {
+            smallWeChatDto.setObjId(reqJson.getString("communityId"));
+        }
+        //smallWeChatDto.setWeChatType(reqJson.getString("wechatType"));
+        int count = smallWechatV1InnerServiceSMOImpl.querySmallWechatsCount(smallWeChatDto);
+        List<SmallWeChatDto> smallWeChats = null;
+        if (count > 0) {
+            smallWeChats = BeanConvertUtil.covertBeanList(smallWechatV1InnerServiceSMOImpl.querySmallWechats(smallWeChatDto), SmallWeChatDto.class);
+            //freshSecure(smallWeChats, appId);
+        } else {
+            smallWeChats = new ArrayList<>();
+        }
+
+        refreshCommunityName(smallWeChats);
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, smallWeChats);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        cmdDataFlowContext.setResponseEntity(responseEntity);
+    }
+
+    private void refreshCommunityName(List<SmallWeChatDto> smallWeChats) {
+
+        if(ListUtil.isNull(smallWeChats)){
+            return;
+        }
+
+        List<String> communityIds = new ArrayList<>();
+        for (SmallWeChatDto smallWeChatDto : smallWeChats) {
+            smallWeChatDto.setCommunityId(smallWeChatDto.getObjId());
+            communityIds.add(smallWeChatDto.getObjId());
+        }
+
+        if(ListUtil.isNull(communityIds)){
+            return ;
+        }
+        CommunityDto communityDto = new CommunityDto();
+        communityDto.setCommunityIds(communityIds.toArray(new String[communityIds.size()]));
+        List<CommunityDto> communityDtos = communityV1InnerServiceSMOImpl.queryCommunitys(communityDto);
+        if(ListUtil.isNull(communityDtos)){
+            return;
+        }
+        for (SmallWeChatDto smallWeChatDto : smallWeChats) {
+            for (CommunityDto tCommunityDto : communityDtos) {
+                if (!smallWeChatDto.getObjId().equals(tCommunityDto.getCommunityId())) {
+                    continue;
+                }
+                smallWeChatDto.setCommunityName(tCommunityDto.getName());
+            }
+        }
+    }
+
+
+}

+ 0 - 14
service-store/src/main/java/com/java110/store/cmd/smallWechat/ListSmallWeChatsCmd.java

@@ -89,18 +89,4 @@ public class ListSmallWeChatsCmd extends Cmd {
         cmdDataFlowContext.setResponseEntity(responseEntity);
     }
 
-    private void freshSecure(List<ApiSmallWeChatDataVo> smallWeChats, String appId) {
-//        if (OWNER_APP.equals(appId)) {
-//            return;
-//        }
-
-        for (ApiSmallWeChatDataVo apiSmallWeChatDataVo : smallWeChats) {
-            apiSmallWeChatDataVo.setwId(WechatFactory.getWId(apiSmallWeChatDataVo.getAppId()));
-            if (AppDto.WEB_APP_ID.equals(appId) || AppDto.WECHAT_MALL_APP_ID.equals(appId)) {
-                apiSmallWeChatDataVo.setAppSecret("");
-                apiSmallWeChatDataVo.setPayPassword("");
-            }
-
-        }
-    }
 }

+ 95 - 0
service-store/src/main/java/com/java110/store/cmd/smallWechat/SaveAdminSmallWechatCmd.java

@@ -0,0 +1,95 @@
+/*
+ * 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.store.cmd.smallWechat;
+
+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.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.app.AppDto;
+import com.java110.dto.wechat.SmallWeChatDto;
+import com.java110.dto.wechat.SmallWechatAttrDto;
+import com.java110.intf.store.ISmallWechatAttrV1InnerServiceSMO;
+import com.java110.intf.store.ISmallWechatV1InnerServiceSMO;
+import com.java110.po.wechat.SmallWechatAttrPo;
+import com.java110.po.wechat.SmallWechatPo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * 类表述:保存
+ * 服务编码:smallWechat.saveSmallWechat
+ * 请求路劲:/app/smallWechat.SaveSmallWechat
+ * add by 吴学文 at 2022-05-25 10:46:07 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 = "smallWeChat.saveAdminSmallWeChat")
+public class SaveAdminSmallWechatCmd extends Cmd {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveAdminSmallWechatCmd.class);
+
+    public static final String CODE_PREFIX_ID = "10";
+
+    @Autowired
+    private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl;
+
+    @Autowired
+    private ISmallWechatAttrV1InnerServiceSMO smallWechatAttrV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        super.validateAdmin(cmdDataFlowContext);
+        Assert.hasKeyAndValue(reqJson, "name", "请求报文中未包含name");
+        Assert.hasKeyAndValue(reqJson, "appId", "请求报文中未包含appId");
+        Assert.hasKeyAndValue(reqJson, "appSecret", "请求报文中未包含appSecret");
+        Assert.hasKeyAndValue(reqJson, "objId", "请求报文中未包含objId(小区id)");
+        Assert.hasKeyAndValue(reqJson, "weChatType", "请求报文中未包含类型");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        String wechatId = GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_weChatId);
+        SmallWechatPo smallWechatPo = BeanConvertUtil.covertBean(reqJson, SmallWechatPo.class);
+        smallWechatPo.setWechatId(wechatId);
+        smallWechatPo.setObjType(SmallWeChatDto.OBJ_TYPE_COMMUNITY);
+        smallWechatPo.setMchId("1");
+        smallWechatPo.setMchName("1");
+        smallWechatPo.setPayPassword("1");
+        smallWechatPo.setWechatType(reqJson.getString("weChatType"));
+        int flag = smallWechatV1InnerServiceSMOImpl.saveSmallWechat(smallWechatPo);
+
+        if (flag < 1) {
+            throw new CmdException("保存数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 1 - 1
service-store/src/main/java/com/java110/store/cmd/smallWechat/SaveSmallWechatCmd.java

@@ -69,7 +69,7 @@ public class SaveSmallWechatCmd extends Cmd {
         Assert.hasKeyAndValue(reqJson, "payPassword", "请求报文中未包含payPassword");
         Assert.hasKeyAndValue(reqJson, "objId", "请求报文中未包含objId(小区id)");
         Assert.hasKeyAndValue(reqJson, "weChatType", "请求报文中未包含类型");
-
+        super.validateProperty(cmdDataFlowContext);
     }
 
     @Override

+ 79 - 0
service-store/src/main/java/com/java110/store/cmd/smallWechat/UpdateAdminSmallWechatCmd.java

@@ -0,0 +1,79 @@
+/*
+ * 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.store.cmd.smallWechat;
+
+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.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.intf.store.ISmallWechatV1InnerServiceSMO;
+import com.java110.po.wechat.SmallWechatPo;
+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;
+
+
+/**
+ * 类表述:更新
+ * 服务编码:smallWechat.updateSmallWechat
+ * 请求路劲:/app/smallWechat.UpdateSmallWechat
+ * add by 吴学文 at 2022-05-25 10:46:07 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 = "smallWeChat.updateAdminSmallWeChat")
+public class UpdateAdminSmallWechatCmd extends Cmd {
+
+  private static Logger logger = LoggerFactory.getLogger(UpdateAdminSmallWechatCmd.class);
+
+
+    @Autowired
+    private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        super.validateAdmin(cmdDataFlowContext);
+        Assert.hasKeyAndValue(reqJson, "wechatId", "wechatId不能为空");
+        Assert.hasKeyAndValue(reqJson, "name", "请求报文中未包含name");
+        Assert.hasKeyAndValue(reqJson, "appId", "请求报文中未包含appId");
+        Assert.hasKeyAndValue(reqJson, "appSecret", "请求报文中未包含appSecret");
+//        Assert.hasKeyAndValue(reqJson, "payPassword", "请求报文中未包含payPassword");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+       SmallWechatPo smallWechatPo = BeanConvertUtil.covertBean(reqJson, SmallWechatPo.class);
+       smallWechatPo.setWechatType(reqJson.getString("weChatType"));
+        int flag = smallWechatV1InnerServiceSMOImpl.updateSmallWechat(smallWechatPo);
+
+        if (flag < 1) {
+            throw new CmdException("更新数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 1 - 0
service-store/src/main/java/com/java110/store/cmd/smallWechat/UpdateSmallWechatCmd.java

@@ -53,6 +53,7 @@ public class UpdateSmallWechatCmd extends Cmd {
 
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        super.validateProperty(cmdDataFlowContext);
         Assert.hasKeyAndValue(reqJson, "wechatId", "wechatId不能为空");
         Assert.hasKeyAndValue(reqJson, "name", "请求报文中未包含name");
         Assert.hasKeyAndValue(reqJson, "appId", "请求报文中未包含appId");