Quellcode durchsuchen

第三方登录

hym vor 4 Jahren
Ursprung
Commit
5a7d4a26fa

+ 6 - 1
smart-city-platform/src/main/java/com/bz/smart_city/commom/security/WebSecurityConfig.java

@@ -7,6 +7,7 @@ import com.bz.smart_city.commom.security.assistant.openid.OpenidSecurityConfig;
 import com.bz.smart_city.commom.security.integration.IntegrationSecurityConfig;
 import com.bz.smart_city.commom.security.mobile.MobileLoginUserDetailService;
 import com.bz.smart_city.commom.security.mobile.MobileSecurityConfig;
+import com.bz.smart_city.commom.security.platform.PlatformSecurityConfig;
 import com.bz.smart_city.commom.security.smsCode.SmsCodeCheckUserFilter;
 import com.bz.smart_city.commom.security.smsCode.SmsCodeSecurityConfig;
 import com.bz.smart_city.commom.security.validate.ValidateCodeCheckFilter;
@@ -80,6 +81,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
     private IntegrationSecurityConfig integrationSecurityConfig;
     @Autowired
     private AppSecurityConfig appSecurityConfig;
+    @Autowired
+    private PlatformSecurityConfig platformSecurityConfig;
 
     @Bean
     public PasswordEncoder passwordEncoder() {
@@ -154,7 +157,9 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .and()
                 .apply(integrationSecurityConfig)
                 .and()
-                .apply(appSecurityConfig);
+                .apply(appSecurityConfig)
+                .and().apply(platformSecurityConfig)
+        ;
 
     }
 

+ 7 - 4
smart-city-platform/src/main/java/com/bz/smart_city/controller/PlatformApiController.java

@@ -28,7 +28,7 @@ public class PlatformApiController {
     private PlatformAapiService platformAapiService;
     @Autowired
     KafkaTemplate<String, Object> kafkaTemplate;
-    @Value("${billing.valveStatus.receiving}")
+    @Value("sc_accept_valve_state_topic66666")
     private String billingValveStatusReceiving;
     @PostMapping ("/updateMeterNo")
     @ApiOperation(value = "同步档案号")
@@ -70,8 +70,11 @@ public class PlatformApiController {
     @GetMapping  ("/testKafka")
     public void testKafka(String meterNo,String meterStatus){
         Map<String,Object> valveMessage=new HashMap<>();
-        valveMessage.put("meterNo",meterNo);
-        valveMessage.put("meterStatus",meterStatus);
-        kafkaTemplate.send(billingValveStatusReceiving, JSONUtils.obj2json(valveMessage));
+
+        valveMessage.put("active","prd");
+        valveMessage.put("customerId",60);
+        valveMessage.put("meterNo","200203717");
+        valveMessage.put("valve","0");
+        //kafkaTemplate.send(billingValveStatusReceiving, JSONUtils.obj2json(valveMessage));
     }
 }

+ 8 - 0
smart-city-platform/src/main/java/com/bz/smart_city/controller/UserController.java

@@ -275,4 +275,12 @@ public class UserController {
         userService.bindOpenId(openId);
         return new AjaxMessage(ResultStatus.OK);
     }
+    @PostMapping("bindUniqId")
+    @ApiOperation(value = "绑定一体化id")
+    public AjaxMessage bindUniqId(
+            @ApiParam(value = "uniqId", required = true) @RequestParam(required = true) String uniqId
+    ) {
+        userService.bindUniqId(uniqId);
+        return new AjaxMessage(ResultStatus.OK);
+    }
 }

+ 1 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/UserMapper.java

@@ -73,5 +73,6 @@ public interface UserMapper {
 
     User findUserByName(@Param("name") String  name,@Param("sitId") BigInteger sitId);
 
+    User findUserByUniqId(String uniqId);
 }
 

+ 2 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/User.java

@@ -54,6 +54,8 @@ public class User implements Serializable {
 
     @ApiModelProperty("微信openid")
     private String openid;
+    @ApiModelProperty("一体化平台id")
+    private String uniqid;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "创建时间", position = 50, hidden = true)

+ 2 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/UserService.java

@@ -121,4 +121,6 @@ public interface UserService {
     void addIntegrationUser(String username, String mobilePhone);
 
     void delectIntegrationUser(String mobilePhone);
+
+    void bindUniqId(String uniqId);
 }

+ 13 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/UserServiceImpl.java

@@ -714,4 +714,17 @@ public class UserServiceImpl implements UserService {
             int result = userExtendInfoMapper.update(obj);
         }
     }
+
+    @Override
+    public void bindUniqId(String uniqId) {
+        LoginUser loginUser = UserUtil.getCurrentUser();
+
+        User user = userMapper.findUserByUniqId(uniqId);
+        if (user == null) {
+            User userUpdate = new User();
+            userUpdate.setId(loginUser.getId());
+            userUpdate.setUniqid(uniqId);
+            this.update(userUpdate);
+        }
+    }
 }

+ 1 - 1
smart-city-platform/src/main/resources/application-dev.properties

@@ -181,4 +181,4 @@ sync.customer.wuhan.id=136
 #spring.data.mongodb.uri=mongodb://114.135.61.188:17017/meter-reading-database
 spring.data.mongodb.uri=mongodb://water:zcxk100@114.135.61.189:27071/meter-reading-database?authSource=meter-reading-database
 logging.level.org.springframework.data.mongodb.core=DEBUG
-account_userInfo_url=http://114.135.61.188:58084/api/pay/getAccountInfoByMetercode
+account_userInfo_url=http://114.135.61.188:58084/api/pay/getAccountInfoByMetercode

+ 4 - 0
smart-city-platform/src/main/resources/mapper/UserMapper.xml

@@ -355,6 +355,7 @@
                 <if test="user.updateDate != null"> update_date = #{user.updateDate,jdbcType=TIMESTAMP},</if>
                 <if test="user.updateBy != null"> update_by = #{user.updateBy,jdbcType=VARCHAR},</if>
                 <if test="user.openid != null"> openid = #{user.openid,jdbcType=VARCHAR}</if>
+                <if test="user.uniqid != null"> uniq_id = #{user.uniqid,jdbcType=VARCHAR}</if>
         </set>
 		WHERE id = #{user.id,jdbcType=INTEGER}
     </update>
@@ -523,6 +524,9 @@
     inner join sc_user scuser on scsuser.user_id= scuser.id
     where scsuser.site_id=#{sitId} and scuser.name=#{name} limit 1
   </select>
+    <select id="findUserByUniqId" resultType="com.bz.smart_city.entity.User">
+        SELECT * FROM sc_user WHERE status != 0 and uniq_id = #{uniqId}
+    </select>
 
 
 </mapper>