pom.xml
@@ -126,6 +126,13 @@ <version>1.1.6</version> </dependency> <!-- https://mvnrepository.com/artifact/com.alibaba/fastjson --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.74</version> </dependency> <!-- https://mvnrepository.com/artifact/net.coobird/thumbnailator --> <dependency> <groupId>net.coobird</groupId> src/main/kotlin/cn/flightfeather/supervision/domain/entity/UserInfoWx.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,160 @@ package cn.flightfeather.supervision.domain.entity; import javax.persistence.*; @Table(name = "sm_t_userinfo_wx") public class UserInfoWx { @Column(name = "UI_GUID") private String uiGuid; @Id @Column(name = "UI_Open_Id") private String uiOpenId; @Column(name = "UI_Nick_Name") private String uiNickName; @Column(name = "UI_Gender") private String uiGender; @Column(name = "UI_Country") private String uiCountry; @Column(name = "UI_Province") private String uiProvince; @Column(name = "UI_City") private String uiCity; @Column(name = "UI_Avatar_Url") private String uiAvatarUrl; @Column(name = "UI_UnionId") private String uiUnionid; /** * @return UI_GUID */ public String getUiGuid() { return uiGuid; } /** * @param uiGuid */ public void setUiGuid(String uiGuid) { this.uiGuid = uiGuid == null ? null : uiGuid.trim(); } /** * @return UI_Open_Id */ public String getUiOpenId() { return uiOpenId; } /** * @param uiOpenId */ public void setUiOpenId(String uiOpenId) { this.uiOpenId = uiOpenId == null ? null : uiOpenId.trim(); } /** * @return UI_Nick_Name */ public String getUiNickName() { return uiNickName; } /** * @param uiNickName */ public void setUiNickName(String uiNickName) { this.uiNickName = uiNickName == null ? null : uiNickName.trim(); } /** * @return UI_Gender */ public String getUiGender() { return uiGender; } /** * @param uiGender */ public void setUiGender(String uiGender) { this.uiGender = uiGender == null ? null : uiGender.trim(); } /** * @return UI_Country */ public String getUiCountry() { return uiCountry; } /** * @param uiCountry */ public void setUiCountry(String uiCountry) { this.uiCountry = uiCountry == null ? null : uiCountry.trim(); } /** * @return UI_Province */ public String getUiProvince() { return uiProvince; } /** * @param uiProvince */ public void setUiProvince(String uiProvince) { this.uiProvince = uiProvince == null ? null : uiProvince.trim(); } /** * @return UI_City */ public String getUiCity() { return uiCity; } /** * @param uiCity */ public void setUiCity(String uiCity) { this.uiCity = uiCity == null ? null : uiCity.trim(); } /** * @return UI_Avatar_Url */ public String getUiAvatarUrl() { return uiAvatarUrl; } /** * @param uiAvatarUrl */ public void setUiAvatarUrl(String uiAvatarUrl) { this.uiAvatarUrl = uiAvatarUrl == null ? null : uiAvatarUrl.trim(); } /** * @return UI_UnionId */ public String getUiUnionid() { return uiUnionid; } /** * @param uiUnionid */ public void setUiUnionid(String uiUnionid) { this.uiUnionid = uiUnionid == null ? null : uiUnionid.trim(); } } src/main/kotlin/cn/flightfeather/supervision/domain/enumeration/EnElementSubType.kt
@@ -72,7 +72,7 @@ return if (value.toInt() == 99) { subTypes[index].last() } else { subTypes[index][value.toInt()] subTypes[index][value.toInt() - 1] } } } src/main/kotlin/cn/flightfeather/supervision/domain/mapper/UserInfoWxMapper.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,8 @@ package cn.flightfeather.supervision.domain.mapper import cn.flightfeather.supervision.domain.entity.UserInfoWx import cn.flightfeather.supervision.domain.util.MyMapper import org.apache.ibatis.annotations.Mapper @Mapper interface UserInfoWxMapper : MyMapper<UserInfoWx> src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LawServiceImpl.kt
@@ -99,4 +99,11 @@ condition.isForeign, condition.category, condition.keywords, condition.isOpen, condition.isUsing, condition.count, condition.sceneTypeId) } override fun getSeries(userId: String, seriesId: String): List<LawsRegulations> { return lawsRegulationsMapper.selectByExample(Example(LawsRegulations::class.java).apply { createCriteria().andEqualTo("lrExtension2", seriesId) orderBy("lrExtension3") }) } } src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/OnLineQuestionServiceImpl.kt
@@ -137,7 +137,7 @@ fileIndustry = IndustryType.getNameByValue(it.mfFileIndustry) itemType = EnElementType.getNameByValue(it.mfEpItemType) itemSubType = EnElementSubType.getNameByValue(it.mfEpItemSubtype) itemSubType = EnElementSubType.getSubType(it.mfEpItemType, it.mfEpItemSubtype) fileUrl = it.mfFileUrl val keyList = it.mfKeywordLv1.split("ã") for (i in keyList.indices) { @@ -247,7 +247,7 @@ // fileIndustry = IndustryType.getNameByValue(it.mfFileIndustry) itemType = EnElementType.getNameByValue(it.cqKind) itemSubType = EnElementSubType.getNameByValue(it.cqSubkind) itemSubType = EnElementSubType.getSubType(it.cqKind, it.cqSubkind) // fileUrl = it.mfFileUrl // val keyList = it.mfKeywordLv1.split("ã") // for (i in keyList.indices) { @@ -258,6 +258,10 @@ // } // } time = it.cqCreateTime punish = it.cqIsPunish illegal = it.cqIsIllegal shotSpot = it.cqIsShotspot supervise = it.cqIsSupervise }) } response.success = true @@ -296,7 +300,7 @@ // fileIndustry = IndustryType.getNameByValue(it.mfFileIndustry) itemType = EnElementType.getNameByValue(it.ecEpItemType) itemSubType = EnElementSubType.getNameByValue(it.ecEpItemSubtype) itemSubType = EnElementSubType.getSubType(it.ecEpItemType, it.ecEpItemSubtype) imgUrl = it.ecAppendixUrl?.split(";")?.get(0) time = it.ecCreateTime @@ -339,7 +343,7 @@ mfMgtLevel = ManageLevelType.getNameByValue(it.mfMgtLevel) mfFileType = ConsultFileType.getNameByValue(it.mfFileType) mfEpItemType = EnElementType.getNameByValue(it.mfEpItemType) mfEpItemSubtype = EnElementSubType.getNameByValue(it.mfEpItemSubtype) mfEpItemSubtype = EnElementSubType.getSubType(it.mfEpItemType, it.mfEpItemSubtype) mfSaveType = FileSaveType.getNameByValue(it.mfSaveType) } result.add(vo) @@ -356,7 +360,7 @@ mfMgtLevel = ManageLevelType.getNameByValue(it.mfMgtLevel) mfFileType = ConsultFileType.getNameByValue(it.mfFileType) mfEpItemType = EnElementType.getNameByValue(it.mfEpItemType) mfEpItemSubtype = EnElementSubType.getNameByValue(it.mfEpItemSubtype) mfEpItemSubtype = EnElementSubType.getSubType(it.mfEpItemType, it.mfEpItemSubtype) mfSaveType = FileSaveType.getNameByValue(it.mfSaveType) } } @@ -390,7 +394,7 @@ BeanUtils.copyProperties(it, vo) vo.apply { cqKind = EnElementType.getNameByValue(it.cqKind) cqSubkind = EnElementSubType.getNameByValue(it.cqSubkind) cqSubkind = EnElementSubType.getSubType(it.cqKind, it.cqSubkind) } if (answers.isNotEmpty()) { @@ -427,7 +431,7 @@ typeId = ConsultResultType.TYPE4.value typeName = ConsultResultType.TYPE4.des itemType = EnElementType.getNameByValue(it.cqKind) itemSubType = EnElementSubType.getNameByValue(it.cqSubkind) itemSubType = EnElementSubType.getSubType(it.cqKind, it.cqSubkind) time = it.cqCreateTime }) @@ -435,7 +439,7 @@ // BeanUtils.copyProperties(it, vo) // vo.apply { // cqKind = EnElementType.getNameByValue(it.cqKind) // cqSubkind = EnElementSubType.getNameByValue(it.cqSubkind) // cqSubkind = EnElementSubType.getSubType(it.ecEpItemType, it.cqSubkind) // } // // if (answers.isNotEmpty()) { @@ -453,7 +457,7 @@ BeanUtils.copyProperties(it, result) result.apply { cqKind = EnElementType.getNameByValue(it.cqKind) cqSubkind = EnElementSubType.getNameByValue(it.cqSubkind) cqSubkind = EnElementSubType.getSubType(it.cqKind, it.cqSubkind) } } @@ -481,7 +485,7 @@ BeanUtils.copyProperties(it, vo) vo.apply { ecEpItemType = EnElementType.getNameByValue(it.ecEpItemType) ecEpItemSubtype = EnElementSubType.getNameByValue(it.ecEpItemSubtype) ecEpItemSubtype = EnElementSubType.getSubType(it.ecEpItemType, it.ecEpItemSubtype) ecType = EnforceCaseType.getNameByValue(it.ecType) } result.add(vo) @@ -495,7 +499,7 @@ BeanUtils.copyProperties(it, result) result.apply { ecEpItemType = EnElementType.getNameByValue(it.ecEpItemType) ecEpItemSubtype = EnElementSubType.getNameByValue(it.ecEpItemSubtype) ecEpItemSubtype = EnElementSubType.getSubType(it.ecEpItemType, it.ecEpItemSubtype) ecType = EnforceCaseType.getNameByValue(it.ecType) } } src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/UserinfoServiceImpl.kt
@@ -1,14 +1,18 @@ package cn.flightfeather.supervision.lightshare.service.Impl import cn.flightfeather.supervision.common.net.WXHttpService import cn.flightfeather.supervision.domain.entity.BaseInfo import cn.flightfeather.supervision.domain.entity.Company import cn.flightfeather.supervision.domain.entity.UserInfoWx import cn.flightfeather.supervision.domain.entity.Userinfo import cn.flightfeather.supervision.domain.enumeration.SceneType import cn.flightfeather.supervision.domain.enumeration.UserType import cn.flightfeather.supervision.domain.mapper.* import cn.flightfeather.supervision.infrastructure.utils.FileUtil import cn.flightfeather.supervision.infrastructure.utils.UUIDGenerator import cn.flightfeather.supervision.lightshare.service.UserinfoService import cn.flightfeather.supervision.lightshare.vo.* import com.alibaba.fastjson.JSONObject import com.github.pagehelper.PageHelper import org.springframework.beans.BeanUtils import org.springframework.stereotype.Service @@ -25,7 +29,7 @@ val companyMapper: CompanyMapper, val restaurantBaseInfoMapper: RestaurantBaseInfoMapper, val vehicleBaseInfoMapper: VehicleBaseInfoMapper, val userMapMapper: UserMapMapper val userMapMapper: UserMapMapper, ) : UserinfoService { //æ ¹æ®userinfoæ¡ä»¶æ¥è¯¢ src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/WxUserServiceImpl.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,88 @@ package cn.flightfeather.supervision.lightshare.service.Impl import cn.flightfeather.supervision.common.net.WXHttpService import cn.flightfeather.supervision.domain.entity.UserInfoWx import cn.flightfeather.supervision.domain.entity.Userinfo import cn.flightfeather.supervision.domain.entity.Version import cn.flightfeather.supervision.domain.enumeration.UserType import cn.flightfeather.supervision.domain.mapper.UserInfoWxMapper import cn.flightfeather.supervision.domain.mapper.UserinfoMapper import cn.flightfeather.supervision.domain.mapper.VersionMapper import cn.flightfeather.supervision.infrastructure.utils.FileUtil import cn.flightfeather.supervision.infrastructure.utils.UUIDGenerator import cn.flightfeather.supervision.lightshare.service.VersionService import cn.flightfeather.supervision.lightshare.service.WxUserService import cn.flightfeather.supervision.lightshare.vo.AccessTokenPW import cn.flightfeather.supervision.lightshare.vo.AccessTokenWX import cn.flightfeather.supervision.lightshare.vo.BaseResponse import cn.flightfeather.supervision.lightshare.vo.VersionVo import com.alibaba.fastjson.JSONObject import org.springframework.stereotype.Service import org.springframework.web.multipart.MultipartFile import tk.mybatis.mapper.entity.Example @Service class WxUserServiceImpl(val userinfoMapper: UserinfoMapper, val userInfoWxMapper: UserInfoWxMapper): WxUserService { override fun loginWx(accessTokenWX: AccessTokenWX): BaseResponse<Userinfo> { accessTokenWX.code ?: return BaseResponse(false, "ç»å½åè¯ä¸è½ä¸ºç©º") val res = WXHttpService.code2Session(accessTokenWX.code!!) // return BaseResponse(false) if (res.success) { val json = JSONObject.parseObject(res.m.responseBodyAsString) if (json["errcode"] == 0 || json["errcode"] == null) { val openid = json["openid"] as String val unionid = json["unionid"] as String val user = userInfoWxMapper.selectByPrimaryKey(openid) return if (user.uiOpenId == null) { val newUserWx = UserInfoWx().apply { // uiGuid = UUIDGenerator.generate16ShortUUID() uiOpenId = openid uiNickName = accessTokenWX.nickName uiGender uiCountry uiProvince uiCity uiAvatarUrl = accessTokenWX.avatarUrl uiUnionid = unionid } // val newUser = Userinfo().apply { // guid = newUserWx.uiGuid // headIconUrl = newUserWx.uiAvatarUrl // acountname // realname = newUserWx.uiNickName // password // usertypeid = UserType.Enterprise.value.toByte() // usertype = UserType.Enterprise.des // isenable = true // wechatid = newUserWx.uiOpenId // } var r = userInfoWxMapper.insert(newUserWx) // r += userinfoMapper.insert(newUser) return if (r == 1) { BaseResponse(true, "å¾®ä¿¡ç¨æ·æ³¨åæå") } else { BaseResponse(false, "å¾®ä¿¡ç¨æ·æ³¨å失败") } } else { if (user.uiGuid != null) { val userinfo = userinfoMapper.selectByPrimaryKey(user.uiGuid) BaseResponse(true, "å¾®ä¿¡ç¨æ·ç»å½æå", data = userinfo) } else { BaseResponse(true, "å¾®ä¿¡ç¨æ·æªç»å®ä¼ä¸") } } } else { return BaseResponse(false, "请æ±å¤±è´¥ï¼errcode=${json["errcode"]}") } } else { return BaseResponse(false, "请æ±å¤±è´¥, æ æ³è®¿é®å¾®ä¿¡æ¥å£") } } override fun loginPw(accessTokenPW: AccessTokenPW): BaseResponse<Userinfo> { TODO("Not yet implemented") } } src/main/kotlin/cn/flightfeather/supervision/lightshare/service/LawService.kt
@@ -15,4 +15,6 @@ fun getLawsRegulations(condition: LawsRegulationsCondition, page: Int, per_page: Int, response: HttpServletResponse): List<LawsRegulations> fun getLawsRegulationsWithEachType(condition: LawsRegulationsCondition): List<LawsRegulations> fun getSeries(userId: String, seriesId: String): List<LawsRegulations> } src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt
@@ -20,6 +20,7 @@ fun login(loginRequestVo: LoginRequestVo): AccessToken fun register(loginRequestVo: LoginRequestVo): AccessToken fun register2(loginRequestVo: LoginRequestVo): AccessToken src/main/kotlin/cn/flightfeather/supervision/lightshare/service/WxUserService.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,16 @@ package cn.flightfeather.supervision.lightshare.service import cn.flightfeather.supervision.domain.entity.Userinfo import cn.flightfeather.supervision.lightshare.vo.AccessTokenPW import cn.flightfeather.supervision.lightshare.vo.AccessTokenWX import cn.flightfeather.supervision.lightshare.vo.BaseResponse interface WxUserService { /** * å¾®ä¿¡ç¨æ·æ³¨ååç»å½ */ fun loginWx(accessTokenWX: AccessTokenWX): BaseResponse<Userinfo> fun loginPw(accessTokenPW: AccessTokenPW): BaseResponse<Userinfo> } src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AccessTokenPW.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,12 @@ package cn.flightfeather.supervision.lightshare.vo import com.fasterxml.jackson.annotation.JsonInclude /** * å¾®ä¿¡ç¨æ·å¯ç ç»å½ä¿¡æ¯ */ class AccessTokenPW : AccessTokenWX() { var userName: String? = null var password: String? = null } src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AccessTokenWX.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,19 @@ package cn.flightfeather.supervision.lightshare.vo import com.fasterxml.jackson.annotation.JsonInclude /** * å¾®ä¿¡ç¨æ·ä¸é®ç»å½ç»å½ä¿¡æ¯ */ open class AccessTokenWX { //ç¨æ·ç»å½åè¯ var code: String? = null //ä¸å 嫿æä¿¡æ¯çåå§æ°æ®å符串ï¼ç¨äºè®¡ç®ç¾å var rawData: String? = null var signature: String? = null var encryptedData: String? = null var iv: String? = null var nickName: String? = null var avatarUrl: String? = null } src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ConsultResultCaseVo.kt
@@ -11,16 +11,16 @@ var provinceName: String? = null var cityName: String? = null var occurDate: String? = null //æ¯å¦è®¾è®¡è¡æ¿å¤ç½ //æ¯å¦æ¶åè¡æ¿å¤ç½ var punish: Boolean = false //æ¯å¦è®¾è®¡è¡æ¿æç //æ¯å¦æ¶åè¡æ¿æç var detained: Boolean = false //æ¯å¦è®¾è®¡åäºè´£ä»» //æ¯å¦æ¶ååäºè´£ä»» var illegal: Boolean = false //æ¯å¦è®¾è®¡ç¯ä¿çç¹ //æ¯å¦æ¶åç¯ä¿çç¹ var shotSpot: Boolean = false //æ¯å¦è®¾è®¡ç£å¯è¦ç¹ //æ¯å¦æ¶åç£å¯è¦ç¹ var supervise: Boolean = false //æ¯å¦è®¾è®¡è¡æ¿å¤ç½è½»å¾®è¿æ³ //æ¯å¦æ¶åè¡æ¿å¤ç½è½»å¾®è¿æ³ var minor: Boolean = false } src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ConsultResultQAVo.kt
@@ -9,5 +9,12 @@ */ class ConsultResultQAVo : ConsultResultVo() { // val answer: String? = null //æ¯å¦æ¶åè¡æ¿å¤ç½ var punish: Boolean = false //æ¯å¦æ¶ååäºè´£ä»» var illegal: Boolean = false //æ¯å¦æ¶åç¯ä¿çç¹ var shotSpot: Boolean = false //æ¯å¦æ¶åç£å¯è¦ç¹ var supervise: Boolean = false } src/main/kotlin/cn/flightfeather/supervision/lightshare/web/LawController.kt
@@ -43,4 +43,11 @@ @ApiParam(value = "ç¨æ·id") @PathVariable userId: String, @ApiParam(value = "æ¥æ¾æ¡ä»¶") @RequestBody condition: LawsRegulationsCondition ) = lawService.getLawsRegulationsWithEachType(condition) @ApiOperation(value = "æ¥è¯¢èµæºæå¨ç³»å") @PostMapping("/series") fun getSeries( @ApiParam(value = "ç¨æ·id") @RequestParam userId: String, @ApiParam(value = "æ¥æ¾æ¡ä»¶") @RequestParam(value = "seriesId") seriesId: String, ) = lawService.getSeries(userId, seriesId) } src/main/kotlin/cn/flightfeather/supervision/lightshare/web/WxUserController.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,23 @@ package cn.flightfeather.supervision.lightshare.web import cn.flightfeather.supervision.lightshare.service.WxUserService import cn.flightfeather.supervision.lightshare.vo.AccessTokenWX import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation import io.swagger.annotations.ApiParam 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 @Api(tags = ["å¾®ä¿¡ç¨æ·ä¿¡æ¯APIæ¥å£"]) @RestController @RequestMapping("/wxuser") class WxUserController(val wxUserService: WxUserService) { @ApiOperation(value = "ç»å½") @PostMapping("/loginWx") fun loginWx( @ApiParam("ç»å½ä¿¡æ¯") @RequestBody accessTokenWX: AccessTokenWX ) = wxUserService.loginWx(accessTokenWX) } src/main/resources/generator/generatorConfig.xml
@@ -90,7 +90,9 @@ <!-- selectByExampleQueryId="false"/>--> <!-- <table tableName="epk_t_settinganswer" domainObjectName="SettingAnswer" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"--> <!-- selectByExampleQueryId="false"/>--> <table tableName="epk_t_enforcecase" domainObjectName="EnforceCase" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" <!-- <table tableName="epk_t_enforcecase" domainObjectName="EnforceCase" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"--> <!-- selectByExampleQueryId="false"/>--> <table tableName="sm_t_userinfo_wx" domainObjectName="UserInfoWx" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/> </context> </generatorConfiguration> src/main/resources/mapper/UserInfoWxMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,25 @@ <?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="cn.flightfeather.supervision.domain.mapper.UserInfoWxMapper" > <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.entity.UserInfoWx" > <!-- WARNING - @mbg.generated --> <id column="UI_Open_Id" property="uiOpenId" jdbcType="VARCHAR" /> <result column="UI_GUID" property="uiGuid" jdbcType="VARCHAR" /> <result column="UI_Nick_Name" property="uiNickName" jdbcType="VARCHAR" /> <result column="UI_Gender" property="uiGender" jdbcType="VARCHAR" /> <result column="UI_Country" property="uiCountry" jdbcType="VARCHAR" /> <result column="UI_Province" property="uiProvince" jdbcType="VARCHAR" /> <result column="UI_City" property="uiCity" jdbcType="VARCHAR" /> <result column="UI_Avatar_Url" property="uiAvatarUrl" jdbcType="VARCHAR" /> <result column="UI_UnionId" property="uiUnionid" jdbcType="VARCHAR" /> </resultMap> <sql id="Base_Column_List" > <!-- WARNING - @mbg.generated --> UI_GUID, UI_Open_Id, UI_Nick_Name, UI_Gender, UI_Country, UI_Province, UI_City, UI_Avatar_Url, UI_UnionId </sql> </mapper>