hym 4 gadi atpakaļ
vecāks
revīzija
176f4179bb

+ 4 - 1
src/main/java/com/zoniot/ccrc/security/openid/OpenidLoginAuthenticationFilter.java

@@ -2,6 +2,7 @@ package com.zoniot.ccrc.security.openid;
 
 
 import com.zoniot.ccrc.service.WechatService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.AuthenticationServiceException;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.AuthenticationException;
@@ -22,6 +23,8 @@ public class OpenidLoginAuthenticationFilter extends AbstractAuthenticationProce
     private String codeParameter = SPRING_SECURITY_FORM_CODE_KEY;
     private String customerParameter = SPRING_SECURITY_FORM_CUSTOMER_KEY;
     private boolean postOnly = true;
+    @Autowired
+    private WechatService wechatService;
 
     // ~ Constructors
     // ===================================================================================================
@@ -48,7 +51,7 @@ public class OpenidLoginAuthenticationFilter extends AbstractAuthenticationProce
             code = "";
         }
 
-        String openid = WechatService.getOpenid(code,customerId);
+        String openid = wechatService.getOpenid(code,customerId);
 
 
         OpenidLoginAuthenticationToken authRequest = new OpenidLoginAuthenticationToken(openid);

+ 8 - 5
src/main/java/com/zoniot/ccrc/service/WechatService.java

@@ -7,6 +7,7 @@ import com.zoniot.ccrc.commom.utils.HttpRequest;
 import lombok.extern.slf4j.Slf4j;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
 import org.bouncycastle.util.encoders.Base64;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.crypto.BadPaddingException;
@@ -30,10 +31,12 @@ public class WechatService {
 
 
     //水查查小程序
-    private static final String APP_SECRET="0a407af075cf95028a2855d714515d46";
-    private static final String APP_ID = "wx27f831675081e293";
+    @Value("${wechat.mp.app-secret}")
+    private    String APP_SECRET;
+    @Value("${wechat.mp.appid}")
+    private    String APP_ID ;
 
-    public static   String getSessionkey(String code) {
+    public    String getSessionkey(String code) {
         JSONObject oppidObj=getWechatAuthInfo(code);
         Integer errcode = (Integer) oppidObj.get("errcode");
         if(errcode == null){
@@ -46,7 +49,7 @@ public class WechatService {
         }
 
     }
-    private static  JSONObject getWechatAuthInfo(String code){
+    private   JSONObject getWechatAuthInfo(String code){
         String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + APP_ID + "&secret="
                 + APP_SECRET + "&js_code=" + code + "&grant_type=authorization_code";
         String reusult = null;
@@ -59,7 +62,7 @@ public class WechatService {
         JSONObject oppidObj = JSONObject.parseObject(reusult);
         return oppidObj;
     }
-    public static String getOpenid(String code,String customerId) {
+    public  String getOpenid(String code,String customerId) {
         JSONObject oppidObj=getWechatAuthInfo(code);
         Integer errcode = (Integer) oppidObj.get("errcode");
         if(errcode == null){

+ 3 - 3
src/main/java/com/zoniot/ccrc/service/impl/OrganizationServiceImpl.java

@@ -101,7 +101,7 @@ public class OrganizationServiceImpl implements OrganizationService {
     private void updateOrgCommunity(Organization organization){
         List<Integer>communityIds=organization.getCommunityId();
         if(communityIds!=null&&communityIds.size()>0){
-            List<CommunityOrg>communityOrgs=new ArrayList<>();
+           /* List<CommunityOrg>communityOrgs=new ArrayList<>();
             communityIds.forEach(id->{
                 CommunityOrg communityOrg=new CommunityOrg();
                 communityOrg.setCommunityId(id);
@@ -111,9 +111,9 @@ public class OrganizationServiceImpl implements OrganizationService {
                 communityOrg.setCreateDate(new Date());
                 communityOrgs.add(communityOrg);
             });
-            communityOrgMapper.batchInsert(communityOrgs);
+            communityOrgMapper.batchInsert(communityOrgs);*/
             //communityOrgMapper.updateCommutityRelations(organization.getCommunityId(),organization.getId());
-            //organizationMapper.updateCommutity(organization.getCommunityId(),organization.getId());
+            organizationMapper.updateCommutity(organization.getCommunityId(),organization.getId());
         }
     }
     @Override

+ 22 - 15
src/main/resources/application-sit.properties

@@ -1,56 +1,59 @@
-server.port=8091
-#10.0.0.159
-server.servlet.context-path=/rmcp
+server.port=8099
+server.servlet.context-path=/api
+
+project.path=./log
 
-project.path=/opt/sit/rmcp
 #日志配置
 logging.level.root=info
 logging.path=${project.path}/logs
 
 spring.thymeleaf.prefix=classpath:/templates/
 spring.datasource.driver-class-name=com.mysql.jdbc.Driver
-#使用druid数据源
 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
-spring.datasource.url=jdbc:mysql://10.0.0.161:3306/rmcp?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false
-#spring.datasource.url=jdbc:mysql://114.135.61.188:23305/smart_city?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+spring.datasource.url=jdbc:mysql://114.135.61.188:33306/ccrc?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
 spring.datasource.username=root
 spring.datasource.password=100Zone@123
 spring.datasource.druid.initial-size=5
 spring.datasource.druid.min-idle=5
-spring.datasource.druid.max-active=100
+spring.datasource.druid.max-active=20
 spring.datasource.druid.max-wait=60000
 spring.datasource.druid.time-between-eviction-runs-millis=60000
 spring.datasource.druid.min-evictable-idle-time-millis=300000
 spring.datasource.druid.validation-query=SELECT 1
 spring.datasource.druid.test-while-idle=true
 spring.datasource.druid.test-on-borrow=true
-spring.datasource.druid.test-on-return=true
+spring.datasource.druid.test-on-return=false
 spring.datasource.druid.pool-prepared-statements=true
 spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
 spring.datasource.druid.filters=stat,wall
 spring.datasource.druid.connection-properties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
 
 # mybatis_config
-mybatis.mapper-locations=classpath*:mapper/*.xml,classpath*:mapper/pay/*.xml
-mybatis.type-aliases-package=com.bz.smart_city.entity
+mybatis.mapper-locations=classpath*:mapper/*.xml
+mybatis.type-aliases-package=com.zoniot.ccrc.entity
 mybatis.configuration.map-underscore-to-camel-case=true
 mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
 mybatis.configuration.use-column-label=true
-
+spring.data.mongodb.uri=mongodb://114.135.61.188:17017/meter-reading-database
 spring.jackson.time-zone=GMT+8
 #spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
 #spring.jackson.joda-date-time-format: yyyy-MM-dd HH:mm:ss
 
 # redis
-spring.redis.host=10.0.0.161
-spring.redis.port=6379
+#spring.redis.host=127.0.0.1
+spring.redis.host=114.135.61.188
+spring.redis.port=26379
 spring.redis.password=zoniot
+#spring.redis.port=6379
+#spring.redis.password=100Zone@123
 spring.redis.database=3
+
 spring.redis.timeout=10000ms
 spring.redis.jedis.pool.max-active=8
 spring.redis.jedis.pool.max-idle=8
 spring.redis.jedis.pool.max-wait=-1ms
 spring.redis.jedis.pool.min-idle=2
+ 
 
 
 jwt.secret=smartCity123
@@ -58,9 +61,10 @@ jwt.expiration=36000
 jwt.header=Authorization
 jwt.tokenHead=Bearer 
 
+
 spring.servlet.multipart.max-file-size=100MB
 spring.servlet.multipart.max-request-size=100MB
-spring.servlet.multipart.location=${project.path}/data
+spring.servlet.multipart.location=${project.path}/files
 files.path=${project.path}/data
 
 #物联网url
@@ -96,3 +100,6 @@ wechat.oa.appid=wx6b2ce547cd593413
 #小程序水查查服务
 wechat.mp.appid=wx27f831675081e293
 wechat.mp.app-secret=a01d7f75f15e1a6b7fa28a317f97ef1b
+
+
+

+ 10 - 14
src/main/resources/mapper/CommunityMapper.xml

@@ -408,16 +408,16 @@
         left join sc_area sa1 on sa1.id = sc.province
         left join sc_area sa2 on sa2.id = sc.city
         left join sc_area sa3 on sa3.id = sc.region
-        left join sc_community_org sco on sc.id=sco.community_id
-        left join sc_organization so on sco.org_id=so.id
-        where sc.status = 1 and sco.status=1
+
+        left join sc_organization so on sc.org_id=so.id
+        where sc.status = 1
         <if test="siteId != null"> and sc.site_id = #{siteId} </if>
         <if test="customerId != null"> and sc.customer_id = #{customerId} </if>
         <if test="communityName != null and communityName != ''"> and sc.name like concat('%',#{communityName} ,'%')</if>
         <if test="province != null"> and sc.province = #{province}</if>
         <if test="city != null"> and sc.city = #{city}</if>
         <if test="region != null"> and sc.region = #{region}</if>
-        <if test="orgId != null"> and sco.org_id = #{orgId}</if>
+        <if test="orgId != null"> and sc.org_id = #{orgId}</if>
         order by sc.date_create desc
     </select>
     <select id="findByNameUnique" resultType="java.lang.Integer">
@@ -482,20 +482,16 @@
         order by sc.date_create desc
     </select>
     <select id="getOrgCommunity" resultType="com.zoniot.ccrc.entity.Community">
-        select a.* from sc_community a left join sc_community_org b
-        on a.id=b.community_id
+
+        select * from sc_community
         <where>
-            a.customer_id in (select id from sc_customer where site_id=#{siteId})
             <if test="orgId!=null">
-                and b.org_id=#{orgId}
+                and org_id=#{orgId}
             </if>
             <if test="orgId==null">
-                and a.region=#{areaId}
-                and not exists(
-                select 1 from sc_community_org sco where sco.community_id = a.id and sco.`STATUS` = 1
-                and sco.site_id=#{siteId}
-                    )
-
+                and org_id is null
+                and region=#{areaId}
+                and site_id=#{siteId}
             </if>
         </where>
     </select>

+ 4 - 7
src/main/resources/mapper/GridManagementMapper.xml

@@ -41,9 +41,7 @@
          e.name orgName,b.file_no
         from sc_grid_management a join sc_device b on a.device_id=b.id
         join sc_building c on b.building_id=c.id join sc_community d on c.community_id =d.id
-        left join sc_community_org sco on sco.community_id=d.id
-
-        left join sc_organization e on sco.org_id=e.id
+        left join sc_organization e on d.org_id=e.id
         <where>
              a.status=1
             <if test="id != null">
@@ -218,13 +216,12 @@
         order by ssu.create_date desc
     </select>
     <select id="getCommutityByOrg" resultType="com.zoniot.ccrc.entity.Community">
-        select * from sc_community a join sc_community_org b
-        on a.id=b.community_id
-        where  b.org_id in
+        select * from sc_community a
+        where  a.org_id in
         <foreach collection="ids" item="id" open="(" separator="," close=")">
             #{id}
         </foreach>
-             and b.status=1
+             and a.status=1
     </select>
     <select id="getBuildingByCommutity" resultType="com.zoniot.ccrc.entity.Building">
         select * from sc_building where community_id=#{commutityId} and status=1

+ 1 - 1
src/main/resources/mapper/OrganizationMapper.xml

@@ -182,7 +182,7 @@
         </foreach>
     </update>
     <delete id="deleteCommutityRations">
-        update sc_community_org set status=0 where org_id=#{id}
+        update sc_community set org_id=null where org_id=#{id}
     </delete>
 
     <select id="findList" resultType="com.zoniot.ccrc.dto.OrganizationDto">