| | |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.hx.gitee</groupId> |
| | | <artifactId>phi_platform_model</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
New file |
| | |
| | | package com.hx.phip.dao.mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import com.hx.mybatisTool.SqlSentence; |
| | | import com.hx.phip.model.ApplyParameter; |
| | | |
| | | public interface ApplyParameterMapper { |
| | | /**新增,返回主键*/ |
| | | int insert(ApplyParameter applyParameter); |
| | | /**查询条数*/ |
| | | int selectCount(SqlSentence sqlSentence); |
| | | /**查询条数*/ |
| | | int selectCountSql(SqlSentence sqlSentence); |
| | | /**查询列表,返回实体类的List*/ |
| | | List<ApplyParameter> selectList(SqlSentence sqlSentence); |
| | | /**查询列表,返回Map的List*/ |
| | | List<Map<String,Object>> selectListMap(SqlSentence sqlSentence); |
| | | /**查询,返回单个实体*/ |
| | | ApplyParameter selectOne(SqlSentence sqlSentence); |
| | | /**查询,返回单个map*/ |
| | | Map<String,Object> selectOneMap(SqlSentence sqlSentence); |
| | | /**查询,返回实体类没有大数据的*/ |
| | | ApplyParameter selectOneByKey(Object object); |
| | | /**查询,返回实体类有大数据的*/ |
| | | ApplyParameter selectOneByKeyBlob(Object object); |
| | | /**更新,返回更新数量*/ |
| | | int updateWhere(SqlSentence sqlSentence); |
| | | /**更新,返回更新数量*/ |
| | | int updateAll(ApplyParameter applyParameter); |
| | | /**删除,返回删除数量*/ |
| | | int deleteWhere(SqlSentence sqlSentence); |
| | | /**删除,返回删除数量*/ |
| | | int deleteById(Object object); |
| | | } |
New file |
| | |
| | | package com.hx.phip.dao.mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import com.hx.mybatisTool.SqlSentence; |
| | | import com.hx.phiappt.model.Shop; |
| | | |
| | | public interface ShopMapper { |
| | | /**新增,返回主键*/ |
| | | int insert(Shop shop); |
| | | /**查询条数*/ |
| | | int selectCount(SqlSentence sqlSentence); |
| | | /**查询条数*/ |
| | | int selectCountSql(SqlSentence sqlSentence); |
| | | /**查询列表,返回实体类的List*/ |
| | | List<Shop> selectList(SqlSentence sqlSentence); |
| | | /**查询列表,返回Map的List*/ |
| | | List<Map<String,Object>> selectListMap(SqlSentence sqlSentence); |
| | | /**查询,返回单个实体*/ |
| | | Shop selectOne(SqlSentence sqlSentence); |
| | | /**查询,返回单个map*/ |
| | | Map<String,Object> selectOneMap(SqlSentence sqlSentence); |
| | | /**查询,返回实体类没有大数据的*/ |
| | | Shop selectOneByKey(Object object); |
| | | /**查询,返回实体类有大数据的*/ |
| | | Shop selectOneByKeyBlob(Object object); |
| | | /**更新,返回更新数量*/ |
| | | int updateWhere(SqlSentence sqlSentence); |
| | | /**更新,返回更新数量*/ |
| | | int updateAll(Shop shop); |
| | | /**删除,返回删除数量*/ |
| | | int deleteWhere(SqlSentence sqlSentence); |
| | | /**删除,返回删除数量*/ |
| | | int deleteById(Object object); |
| | | } |
| | |
| | | |
| | | /**小程序/企业登录code*/ |
| | | private String code; |
| | | /**企业id*/ |
| | | private String corpId; |
| | | /**小程序appid*/ |
| | | private String mpId; |
| | | |
| | | public String getCode() { |
| | | return code; |
| | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getCorpId() { |
| | | return corpId; |
| | | } |
| | | |
| | | public void setCorpId(String corpId) { |
| | | this.corpId = corpId; |
| | | } |
| | | |
| | | public String getMpId() { |
| | | return mpId; |
| | | } |
| | | |
| | | public void setMpId(String mpId) { |
| | | this.mpId = mpId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hx.phip.tool; |
| | | |
| | | import com.hx.common.service.CommonService; |
| | | import com.hx.mybatisTool.SqlSentence; |
| | | import com.hx.phip.dao.mapper.ApplyParameterMapper; |
| | | import com.hx.phip.model.ApplyParameter; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /**获取应用数据参数*/ |
| | | public class ApplyParameterTool { |
| | | |
| | | public static ApplyParameter getApplyParameter(String corpId, String mpAppId, CommonService commonService){ |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | | Map<String,Object> values = new HashMap<>(); |
| | | |
| | | values.put("isDel",ApplyParameter.NO); |
| | | values.put("corpId",corpId); |
| | | values.put("mpAppId",mpAppId); |
| | | sqlSentence.sqlSentence("SELECT * FROM pla_apply_parameter WHERE isDel = #{m.isDel} AND corpId = #{m.corpId} AND mpAppId = #{m.mpAppId} ",values); |
| | | ApplyParameter spplyParameter = commonService.selectOne(ApplyParameterMapper.class,sqlSentence); |
| | | return spplyParameter; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | <?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"> |
| | | <!-- namespace:该mapper.xml映射文件的 唯一标识 --> |
| | | <mapper namespace="com.hx.phip.dao.mapper.ApplyParameterMapper"> |
| | | |
| | | <!-- 整个实体类修改,表字段=实体类字段--> |
| | | <sql id="Update_Column_All"> |
| | | <trim prefixOverrides=","> |
| | | ,corpId = #{corpId},applySecretKey = #{applySecretKey},mpAppId = #{mpAppId},mpSecretKey = #{mpSecretKey},isDel = #{isDel},createTime = #{createTime} |
| | | </trim> |
| | | </sql> |
| | | |
| | | <!-- 后续通过 namespace.id--> |
| | | <!--parameterType:输入参数的类型 |
| | | resultType:查询返回结果值的类型 ,返回类型 --> |
| | | <insert id="insert" parameterType="com.hx.phip.model.ApplyParameter"> |
| | | <selectKey keyProperty="id" resultType="String" order="BEFORE"> |
| | | select replace(uuid(),'-','') from dual |
| | | </selectKey> |
| | | insert into pla_apply_parameter (id,corpId,applySecretKey,mpAppId,mpSecretKey,isDel,createTime) values (#{id},#{corpId},#{applySecretKey},#{mpAppId},#{mpSecretKey},#{isDel},#{createTime}) |
| | | </insert> |
| | | |
| | | <select id="selectList" resultType="com.hx.phip.model.ApplyParameter" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectListMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectOne" resultType="com.hx.phip.model.ApplyParameter" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectOneMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectCount" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | select |
| | | COUNT(*) |
| | | from pla_apply_parameter |
| | | WHERE ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectCountSql" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectOneByKey" resultType="com.hx.phip.model.ApplyParameter" parameterType="java.lang.Object" > |
| | | select |
| | | id,corpId,applySecretKey,mpAppId,mpSecretKey,isDel,createTime |
| | | from pla_apply_parameter |
| | | WHERE id = #{value} |
| | | </select> |
| | | |
| | | <select id="selectOneByKeyBlob" resultType="com.hx.phip.model.ApplyParameter" parameterType="java.lang.Object" > |
| | | select |
| | | id,corpId,applySecretKey,mpAppId,mpSecretKey,isDel,createTime |
| | | from pla_apply_parameter |
| | | WHERE id = #{value} |
| | | </select> |
| | | |
| | | <update id="updateWhere" parameterType="com.hx.mybatisTool.SqlSentence"> |
| | | update |
| | | pla_apply_parameter |
| | | SET ${sqlSentence} |
| | | </update> |
| | | |
| | | <update id="updateAll" parameterType="com.hx.phip.model.ApplyParameter"> |
| | | update pla_apply_parameter |
| | | SET <include refid="Update_Column_All"/> |
| | | WHERE id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteWhere" parameterType="com.hx.mybatisTool.SqlSentence"> |
| | | delete from pla_apply_parameter WHERE ${sqlSentence} |
| | | </delete> |
| | | |
| | | <delete id="deleteById" parameterType="java.lang.Object"> |
| | | delete from pla_apply_parameter WHERE id = #{value} |
| | | </delete> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?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"> |
| | | <!-- namespace:该mapper.xml映射文件的 唯一标识 --> |
| | | <mapper namespace="com.hx.phip.dao.mapper.ShopMapper"> |
| | | |
| | | <!-- 整个实体类修改,表字段=实体类字段--> |
| | | <sql id="Update_Column_All"> |
| | | <trim prefixOverrides=","> |
| | | ,name = #{name},corpMpDepId = #{corpMpDepId},maxAppNum = #{maxAppNum},maxSwitchNum = #{maxSwitchNum},isUp = #{isUp},workTime = #{workTime},province = #{province},city = #{city},area = #{area},addr = #{addr},colorStr = #{colorStr},doctorRelaxTime = #{doctorRelaxTime},carWay = #{carWay},subWay = #{subWay},apiId = #{apiId},isDel = #{isDel},createTime = #{createTime} |
| | | </trim> |
| | | </sql> |
| | | |
| | | <!-- 后续通过 namespace.id--> |
| | | <!--parameterType:输入参数的类型 |
| | | resultType:查询返回结果值的类型 ,返回类型 --> |
| | | <insert id="insert" parameterType="com.hx.phiappt.model.Shop"> |
| | | <selectKey keyProperty="id" resultType="String" order="BEFORE"> |
| | | select replace(uuid(),'-','') from dual |
| | | </selectKey> |
| | | insert into shop (id,name,corpMpDepId,maxAppNum,maxSwitchNum,isUp,workTime,province,city,area,addr,colorStr,doctorRelaxTime,carWay,subWay,apiId,isDel,createTime) values (#{id},#{name},#{corpMpDepId},#{maxAppNum},#{maxSwitchNum},#{isUp},#{workTime},#{province},#{city},#{area},#{addr},#{colorStr},#{doctorRelaxTime},#{carWay},#{subWay},#{apiId},#{isDel},#{createTime}) |
| | | </insert> |
| | | |
| | | <select id="selectList" resultType="com.hx.phiappt.model.Shop" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectListMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectOne" resultType="com.hx.phiappt.model.Shop" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectOneMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectCount" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | select |
| | | COUNT(*) |
| | | from shop |
| | | WHERE ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectCountSql" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectOneByKey" resultType="com.hx.phiappt.model.Shop" parameterType="java.lang.Object" > |
| | | select |
| | | id,name,corpMpDepId,maxAppNum,maxSwitchNum,isUp,workTime,province,city,area,addr,colorStr,doctorRelaxTime,carWay,subWay,apiId,isDel,createTime |
| | | from shop |
| | | WHERE id = #{value} |
| | | </select> |
| | | |
| | | <select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.Shop" parameterType="java.lang.Object" > |
| | | select |
| | | id,name,corpMpDepId,maxAppNum,maxSwitchNum,isUp,workTime,province,city,area,addr,colorStr,doctorRelaxTime,carWay,subWay,apiId,isDel,createTime |
| | | from shop |
| | | WHERE id = #{value} |
| | | </select> |
| | | |
| | | <update id="updateWhere" parameterType="com.hx.mybatisTool.SqlSentence"> |
| | | update |
| | | shop |
| | | SET ${sqlSentence} |
| | | </update> |
| | | |
| | | <update id="updateAll" parameterType="com.hx.phiappt.model.Shop"> |
| | | update shop |
| | | SET <include refid="Update_Column_All"/> |
| | | WHERE id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteWhere" parameterType="com.hx.mybatisTool.SqlSentence"> |
| | | delete from shop WHERE ${sqlSentence} |
| | | </delete> |
| | | |
| | | <delete id="deleteById" parameterType="java.lang.Object"> |
| | | delete from shop WHERE id = #{value} |
| | | </delete> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <groupId>com.hx.gitee</groupId> |
| | | <artifactId>phi_platform_model</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <packaging>jar</packaging> |
| | | |
| | | <parent> |
| | | <groupId>com.hx</groupId> |
| | | <artifactId>phi_platform</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | |
| | | <dependencies> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.ulisesbocchio</groupId> |
| | | <artifactId>jasypt-spring-boot-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.hx.gitee</groupId> |
| | | <artifactId>hx-common</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.hx.gitee</groupId> |
| | | <artifactId>phi_common</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <!-- <finalName>cases_common</finalName>--> |
| | | <resources> |
| | | <resource> |
| | | <directory>src/main/java</directory> |
| | | <includes> |
| | | <include>**/*.xml</include> |
| | | </includes> |
| | | <filtering>false</filtering> |
| | | </resource> |
| | | <resource> |
| | | <directory>src/main/resources</directory> |
| | | <includes> |
| | | <include>**/*.xml</include> |
| | | </includes> |
| | | </resource> |
| | | </resources> |
| | | |
| | | </build> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.hx.phip.model; |
| | | |
| | | import com.gitee.sunchenbin.mybatis.actable.annotation.Column; |
| | | import com.gitee.sunchenbin.mybatis.actable.annotation.Table; |
| | | import com.gitee.sunchenbin.mybatis.actable.annotation.Unique; |
| | | import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant; |
| | | import com.hx.phiappt.model.BaseEntity; |
| | | |
| | | /** |
| | | * 应用数据 |
| | | */ |
| | | @Table(name = "pla_apply_parameter") |
| | | public class ApplyParameter extends BaseEntity { |
| | | |
| | | @Column(comment = "企业微信id", length = 64, type = MySqlTypeConstant.VARCHAR) |
| | | private String corpId; |
| | | |
| | | @Column(comment = "企业微信应用秘钥(AES加密)", length = 255, type = MySqlTypeConstant.VARCHAR) |
| | | private String applySecretKey; |
| | | |
| | | @Column(comment = "小程序appId", length = 64, type = MySqlTypeConstant.VARCHAR) |
| | | private String mpAppId; |
| | | @Column(comment = "小程序秘钥(AES加密)", length = 255, type = MySqlTypeConstant.VARCHAR) |
| | | private String mpSecretKey; |
| | | |
| | | public ApplyParameter() { |
| | | } |
| | | |
| | | public String getCorpId() { |
| | | return corpId; |
| | | } |
| | | |
| | | public void setCorpId(String corpId) { |
| | | this.corpId = corpId; |
| | | } |
| | | |
| | | public String getApplySecretKey() { |
| | | return applySecretKey; |
| | | } |
| | | |
| | | public void setApplySecretKey(String applySecretKey) { |
| | | this.applySecretKey = applySecretKey; |
| | | } |
| | | |
| | | public String getMpAppId() { |
| | | return mpAppId; |
| | | } |
| | | |
| | | public void setMpAppId(String mpAppId) { |
| | | this.mpAppId = mpAppId; |
| | | } |
| | | |
| | | public String getMpSecretKey() { |
| | | return mpSecretKey; |
| | | } |
| | | |
| | | public void setMpSecretKey(String mpSecretKey) { |
| | | this.mpSecretKey = mpSecretKey; |
| | | } |
| | | } |
| | |
| | | |
| | | <dependency> |
| | | <groupId>com.hx.gitee</groupId> |
| | | <artifactId>phi_platform_model</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.hx.gitee</groupId> |
| | | <artifactId>phi_common</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | |
| | | import com.hx.auto.GeneratorUtil; |
| | | import com.hx.auto.common.UrlData; |
| | | import com.hx.phiappt.model.*; |
| | | import com.hx.phip.model.ApplyParameter; |
| | | |
| | | /** |
| | | * 自动生成工具 |
| | |
| | | //生成全部的xml和mapper |
| | | //GeneratorUtil.generatorXmlAndMapper("com.hx.medical.model",urlData); |
| | | |
| | | Class<?> clas = SystemParameter.class; |
| | | Class<?> clas = Shop.class; |
| | | //dao |
| | | GeneratorUtil.generatorDao(clas,urlData); |
| | | //mapper |
| | |
| | | |
| | | public class Rsa { |
| | | public static void main(String[] args) { |
| | | |
| | | System.out.println("AES:"+AesUtil.aesEncryp("8d6899f042059a83531c6cfed9a6b38f")); |
| | | |
| | | |
| | | //配置文件数据加密 |
| | | BasicTextEncryptor encryptor = new BasicTextEncryptor(); |
| | | encryptor.setPassword(AesUtil.SECRET); |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.hx.common.BaseController; |
| | | import com.hx.mybatisTool.SqlSentence; |
| | | import com.hx.phiappt.model.Employee; |
| | | import com.hx.phiappt.model.EmployeeRole; |
| | | import com.hx.phiappt.model.EmployeeRoleAdminAuthority; |
| | | import com.hx.phiappt.model.SysAdminAuthority; |
| | | import com.hx.phiappt.model.*; |
| | | import com.hx.phip.common.corp.mp.WeiXinCorpMpUtil; |
| | | import com.hx.phip.config.WxParameter; |
| | | import com.hx.phip.dao.mapper.EmployeeMapper; |
| | | import com.hx.phip.dao.mapper.EmployeeRoleMapper; |
| | | import com.hx.phip.dao.mapper.EmployeeRoleTypeMapper; |
| | | import com.hx.phip.dao.mapper.SysAdminAuthorityMapper; |
| | | import com.hx.phip.dao.mapper.*; |
| | | import com.hx.phip.entity.EmployeeQrLogin; |
| | | import com.hx.phip.entity.EmployeeRoleLogin; |
| | | import com.hx.phip.model.ApplyParameter; |
| | | import com.hx.phip.tool.ApplyParameterTool; |
| | | import com.hx.redis.RedisUtil; |
| | | import com.hx.util.AesUtil; |
| | | import com.hx.util.HttpServletRequestUtil; |
| | | import com.hx.util.JwtTool; |
| | | import com.hx.util.StringUtils; |
| | |
| | | import com.platform.util.corp.PersonnelTool; |
| | | import com.platform.util.corp.entity.PersonnelQr; |
| | | import org.apache.catalina.servlet4preview.http.HttpServletRequest; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | @RequestMapping("/employee") |
| | | public class EmployeeLoginController extends BaseController { |
| | | |
| | | |
| | | @Resource |
| | | private WxParameter wxParameter; |
| | | //log4j日志 |
| | | private static Logger logger = LoggerFactory.getLogger(EmployeeLoginController.class.getName()); |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(employeeQrLogin.getCode())) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"first code is required"); |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"code is required"); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(employeeQrLogin.getCorpId())) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"corpId is required"); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(employeeQrLogin.getMpId())) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"mpId is required"); |
| | | } |
| | | |
| | | //获取应用数据 |
| | | ApplyParameter applyParameter = ApplyParameterTool.getApplyParameter(employeeQrLogin.getCorpId(),employeeQrLogin.getMpId(),commonService); |
| | | if(applyParameter == null){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS,"corpId or mpId is error"); |
| | | } |
| | | |
| | | // 解析code |
| | | String accessToken = WeiXinCorpMpUtil.getApplicationAccessToken(commonService, wxParameter.getCorpId(), wxParameter.getHelperApplySecret()); |
| | | String accessToken = WeiXinCorpMpUtil.getApplicationAccessToken(commonService,applyParameter.getCorpId(), AesUtil.aesDecryp(applyParameter.getApplySecretKey())); |
| | | if(StringUtils.isEmpty(accessToken)){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_SYSTEM,"服务错误"+ SystemCode.ERROR_GET_CORP_TOKEN); |
| | | } |
| | | |
| | | //net.sf.json.JSONObject json = WeiXinCorpMpUtil.getLoginUserInfo(accessToken, employeeQrLogin.getCode()); |
| | | PersonnelQr personnelQr = PersonnelTool.qrLoginInfo(accessToken,employeeQrLogin.getCode()); |
| | | |
| | | logger.info("扫码登录:"+personnelQr.toString()); |
| | | |
| | | if(personnelQr == null){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS,"人员信息不存在"); |
| | |
| | | |
| | | values.clear(); |
| | | values.put("employeeId",employee.getId()); |
| | | sqlSentence.setSqlSentence(" select ert.id,ert.name,ert.uniqueStr from employee_role o JOIN employee_role_type ert ON isDel = 0" + |
| | | " AND ert.id = o.roleTypeId where o.employeeId = #{m.employeeId} AND o.isDel = #{m.isDel}"); |
| | | values.put("isDel",EmployeeRole.NO); |
| | | sqlSentence.setSqlSentence(" select ert.id,ert.name,ert.uniqueStr,s.name AS shopName from employee_role o JOIN employee_role_type ert ON ert.isDel = 0" + |
| | | " AND ert.id = o.roleTypeId LEFT JOIN shop s ON s.id = o.shopId WHERE o.employeeId = #{m.employeeId} AND o.isDel = #{m.isDel}"); |
| | | List<Map<String,Object>> roleList = commonService.selectListMap(EmployeeRoleTypeMapper.class,sqlSentence); |
| | | |
| | | Map<String,Object> data = new HashMap<>(); |
| | |
| | | data.put("gender", employee.getGender()); |
| | | data.put("loginToken", JwtTool.createJWT(employee.getId(), null, ttlMillis)); |
| | | |
| | | if (redisUtil.hasKey(userId)){ |
| | | redisUtil.expire(userId,ttlMillis); |
| | | if (redisUtil.hasKey(employee.getId())){ |
| | | redisUtil.expire(employee.getId(),ttlMillis); |
| | | }else { |
| | | redisUtil.set(userId,data,ttlMillis); |
| | | redisUtil.set(employee.getId(),data,ttlMillis); |
| | | } |
| | | return PlatformResult.success(data); |
| | | } |
| | | |
| | | /**企业员工-网页登录 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/login/webpage",method = RequestMethod.POST) |
| | | public PlatformResult loginWebpage(HttpServletRequest request) { |
| | |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(employeeQrLogin.getCode())) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"first code is required"); |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"code is required"); |
| | | } |
| | | |
| | | String accessToken = WeiXinCorpMpUtil.getApplicationAccessToken(commonService, wxParameter.getCorpId(), wxParameter.getHelperApplySecret()); |
| | | if (StringUtils.isEmpty(employeeQrLogin.getCorpId())) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"corpId is required"); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(employeeQrLogin.getMpId())) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"mpId is required"); |
| | | } |
| | | |
| | | //获取应用数据 |
| | | ApplyParameter applyParameter = ApplyParameterTool.getApplyParameter(employeeQrLogin.getCorpId(),employeeQrLogin.getMpId(),commonService); |
| | | if(applyParameter == null){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS,"corpId or mpId is error"); |
| | | } |
| | | |
| | | String accessToken = WeiXinCorpMpUtil.getApplicationAccessToken(commonService,applyParameter.getCorpId(),AesUtil.aesDecryp(applyParameter.getApplySecretKey())); |
| | | |
| | | //获取userId |
| | | net.sf.json.JSONObject oauthObj = com.hx.mp.util.CorpMpUtil.code2Session(accessToken,employeeQrLogin.getCode()); |
| | | //String errcode = oauthObj.optString("errcode", "");// 有错误的时候才有 |
| | | // String corpId = oauthObj.optString("corpid", "");// 有错误的时候才有 |
| | | String userId = oauthObj.optString("userid", ""); |
| | | // String sessionKey = oauthObj.optString("session_key"); |
| | | |
| | | logger.info("网页登录:"+oauthObj.toString()); |
| | | |
| | | if (StringUtils.isEmpty(userId)) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS,"人员没有权限登录"); |
| | |
| | | |
| | | values.clear(); |
| | | values.put("employeeId",employee.getId()); |
| | | sqlSentence.setSqlSentence(" select ert.id,ert.name,ert.uniqueStr from employee_role o JOIN employee_role_type ert ON isDel = 0" + |
| | | " AND ert.id = o.roleTypeId where o.employeeId = #{m.employeeId} AND o.isDel = #{m.isDel}"); |
| | | values.put("isDel",EmployeeRole.NO); |
| | | sqlSentence.setSqlSentence(" select ert.id,ert.name,ert.uniqueStr,s.name AS shopName from employee_role o JOIN employee_role_type ert ON ert.isDel = 0" + |
| | | " AND ert.id = o.roleTypeId LEFT JOIN shop s ON s.id = o.shopId WHERE o.employeeId = #{m.employeeId} AND o.isDel = #{m.isDel}"); |
| | | List<Map<String,Object>> roleList = commonService.selectListMap(EmployeeRoleTypeMapper.class,sqlSentence); |
| | | |
| | | Map<String,Object> data = new HashMap<>(); |
| | |
| | | data.put("gender", employee.getGender()); |
| | | data.put("loginToken", JwtTool.createJWT(employee.getId(), null, ttlMillis)); |
| | | |
| | | if (redisUtil.hasKey(userId)){ |
| | | redisUtil.expire(userId,ttlMillis); |
| | | if (redisUtil.hasKey(employee.getId())){ |
| | | redisUtil.expire(employee.getId(),ttlMillis); |
| | | }else { |
| | | redisUtil.set(userId,data,ttlMillis); |
| | | redisUtil.set(employee.getId(),data,ttlMillis); |
| | | } |
| | | return PlatformResult.success(data); |
| | | } |
| | |
| | | data.put("roleName", employeeRole.getRoleName()); |
| | | data.put("authList", arrAuth); |
| | | |
| | | Shop shop = commonService.selectOneByKey(ShopMapper.class,employeeRole.getShopId()); |
| | | if(shop != null){ |
| | | data.put("shopName", shop.getName()); |
| | | } |
| | | |
| | | if (redisUtil.hasKey(employeeRole.getRoleTypeId())){ |
| | | redisUtil.expire(employeeRole.getRoleTypeId(),ttlMillis); |
| | | }else { |
| | |
| | | |
| | | #mysql\u81EA\u52A8\u5EFA\u8868 |
| | | mybatis.table.auto=update |
| | | mybatis.model.pack= |
| | | mybatis.model.pack= com.hx.phip.model |
| | | mybatis.database.type=mysql |
| | | |
| | | #\u8BBE\u7F6E\u65F6\u95F4\u683C\u5F0F |
| | |
| | | |
| | | #mysql\u81EA\u52A8\u5EFA\u8868 |
| | | mybatis.table.auto = update |
| | | mybatis.model.pack = |
| | | mybatis.model.pack = com.hx.phip.model |
| | | mybatis.database.type = mysql |
| | | |
| | | #\u8BBE\u7F6E\u65F6\u95F4\u683C\u5F0F |
| | |
| | | |
| | | <modules> |
| | | <module>phi_platform_common</module> |
| | | <module>phi_platform_model</module> |
| | | <module>phi_platform_user</module> |
| | | </modules> |
| | | |