Commit ac37690f authored by 谢希宇's avatar 谢希宇

init aidea products by 20200922

parent d65c82f6
......@@ -3,27 +3,27 @@
<mapper namespace="com.cftech.consultsheet.dao.ConsultSheetMapper">
<resultMap id="resultMap" type="com.cftech.consultsheet.model.ConsultSheet">
<id column="id" property="id"/>
<result column="consult_id" property="consultId"/>
<result column="user_name" property="userName"/>
<result column="number_id" property="numberId"/>
<result column="benebit_id" property="benebitId"/>
<result column="sex" property="sex"/>
<result column="iphone" property="iPhone"/>
<result column="past_records" property="pastRecords"/>
<result column="prescription" property="Prescription"/>
<result column="doctor_id" property="doctorId"/>
<result column="customer_id" property="customerId"/>
<result column="illness" property="illness"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="description" property="description"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
</resultMap>
<id column="id" property="id"/>
<result column="consult_id" property="consultId"/>
<result column="user_name" property="userName"/>
<result column="number_id" property="numberId"/>
<result column="benebit_id" property="benebitId"/>
<result column="sex" property="sex"/>
<result column="iphone" property="iPhone"/>
<result column="past_records" property="pastRecords"/>
<result column="prescription" property="Prescription"/>
<result column="doctor_id" property="doctorId"/>
<result column="customer_id" property="customerId"/>
<result column="illness" property="illness"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="description" property="description"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
</resultMap>
<sql id="sqlWhere">
<if test="conds!=null">
......@@ -75,7 +75,7 @@
update_by
</sql>
<insert id="save" parameterType="com.cftech.consultsheet.model.ConsultSheet" useGeneratedKeys="true"
keyProperty="id">
insert into t_aidea_consult_sheet
......@@ -84,28 +84,28 @@
)
values
(
#{id, jdbcType=BIGINT},
#{id, jdbcType=BIGINT},
#{consultId, jdbcType=BIGINT},
#{userName, jdbcType=VARCHAR},
#{numberId, jdbcType=VARCHAR},
now(),
#{sex, jdbcType=BIGINT},
#{iPhone, jdbcType=VARCHAR},
#{pastRecords, jdbcType=VARCHAR},
#{Prescription, jdbcType=VARCHAR},
#{doctorId, jdbcType=BIGINT},
#{customerId, jdbcType=BIGINT},
#{illness, jdbcType=BIGINT},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
#{consultId, jdbcType=BIGINT},
#{userName, jdbcType=VARCHAR},
#{numberId, jdbcType=VARCHAR},
now(),
#{sex, jdbcType=BIGINT},
#{iPhone, jdbcType=VARCHAR},
#{pastRecords, jdbcType=VARCHAR},
#{Prescription, jdbcType=VARCHAR},
#{doctorId, jdbcType=BIGINT},
#{customerId, jdbcType=BIGINT},
#{illness, jdbcType=BIGINT},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
</insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
......@@ -116,82 +116,82 @@
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_aidea_consult_sheet
<include refid="sqlWhere"/>
SELECT COUNT(1) FROM t_aidea_consult_sheet
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_consult_sheet
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_consult_sheet
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<update id="update" parameterType="com.cftech.consultsheet.model.ConsultSheet">
update t_aidea_consult_sheet
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="consultId != null">
consult_id = #{consultId, jdbcType=BIGINT},
</if>
<if test="userName != null">
user_name = #{userName, jdbcType=VARCHAR},
</if>
<if test="numberId != null">
number_id = #{numberId, jdbcType=VARCHAR},
</if>
<if test="benebitId != null">
benebit_id = #{benebitId, jdbcType=TIMESTAMP},
</if>
<if test="sex != null">
sex = #{sex, jdbcType=BIGINT},
</if>
<if test="iPhone != null">
i_phone = #{iPhone, jdbcType=VARCHAR},
</if>
<if test="pastRecords != null">
past_records = #{pastRecords, jdbcType=VARCHAR},
</if>
<if test="Prescription != null">
prescription = #{Prescription, jdbcType=VARCHAR},
</if>
<if test="doctorId != null">
doctor_id = #{doctorId, jdbcType=BIGINT},
</if>
<if test="customerId != null">
customer_id = #{customerId, jdbcType=BIGINT},
</if>
<if test="illness != null">
illness = #{illness, jdbcType=BIGINT},
</if>
<if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if test="description != null">
description = #{description, jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
<if test="consultId != null">
consult_id = #{consultId, jdbcType=BIGINT},
</if>
<if test="userName != null">
user_name = #{userName, jdbcType=VARCHAR},
</if>
<if test="numberId != null">
number_id = #{numberId, jdbcType=VARCHAR},
</if>
<if test="benebitId != null">
benebit_id = #{benebitId, jdbcType=TIMESTAMP},
</if>
<if test="sex != null">
sex = #{sex, jdbcType=BIGINT},
</if>
<if test="iPhone != null">
i_phone = #{iPhone, jdbcType=VARCHAR},
</if>
<if test="pastRecords != null">
past_records = #{pastRecords, jdbcType=VARCHAR},
</if>
<if test="Prescription != null">
prescription = #{Prescription, jdbcType=VARCHAR},
</if>
<if test="doctorId != null">
doctor_id = #{doctorId, jdbcType=BIGINT},
</if>
<if test="customerId != null">
customer_id = #{customerId, jdbcType=BIGINT},
</if>
<if test="illness != null">
illness = #{illness, jdbcType=BIGINT},
</if>
<if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if test="description != null">
description = #{description, jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
......
<?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="com.cftech.consultSheet.dao.ConsultSheetMapper">
<mapper namespace="com.cftech.consultsheet.dao.ConsultSheetMapper">
<resultMap id="resultMap" type="com.cftech.consultSheet.model.ConsultSheet">
<id column="id" property="id"/>
<result column="consult_id" property="consultId"/>
<result column="user_name" property="userName"/>
<result column="number_id" property="numberId"/>
<result column="benebit_id" property="benebitId"/>
<result column="sex" property="sex"/>
<result column="iphone" property="iPhone"/>
<result column="past_records" property="pastRecords"/>
<result column="prescription" property="Prescription"/>
<result column="doctor_id" property="doctorId"/>
<result column="customer_id" property="customerId"/>
<result column="illness" property="illness"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="description" property="description"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
</resultMap>
<resultMap id="resultMap" type="com.cftech.consultsheet.model.ConsultSheet">
<id column="id" property="id"/>
<result column="consult_id" property="consultId"/>
<result column="user_name" property="userName"/>
<result column="number_id" property="numberId"/>
<result column="benebit_id" property="benebitId"/>
<result column="sex" property="sex"/>
<result column="iphone" property="iPhone"/>
<result column="past_records" property="pastRecords"/>
<result column="prescription" property="Prescription"/>
<result column="doctor_id" property="doctorId"/>
<result column="customer_id" property="customerId"/>
<result column="illness" property="illness"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="description" property="description"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
</resultMap>
<sql id="sqlWhere">
<if test="conds!=null">
......@@ -75,8 +75,8 @@
update_by
</sql>
<insert id="save" parameterType="com.cftech.consultSheet.model.ConsultSheet" useGeneratedKeys="true"
<insert id="save" parameterType="com.cftech.consultsheet.model.ConsultSheet" useGeneratedKeys="true"
keyProperty="id">
insert into t_aidea_consult_sheet
(
......@@ -84,28 +84,28 @@
)
values
(
#{id, jdbcType=BIGINT},
#{id, jdbcType=BIGINT},
#{consultId, jdbcType=BIGINT},
#{userName, jdbcType=VARCHAR},
#{numberId, jdbcType=VARCHAR},
now(),
#{sex, jdbcType=BIGINT},
#{iPhone, jdbcType=VARCHAR},
#{pastRecords, jdbcType=VARCHAR},
#{Prescription, jdbcType=VARCHAR},
#{doctorId, jdbcType=BIGINT},
#{customerId, jdbcType=BIGINT},
#{illness, jdbcType=BIGINT},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
#{consultId, jdbcType=BIGINT},
#{userName, jdbcType=VARCHAR},
#{numberId, jdbcType=VARCHAR},
now(),
#{sex, jdbcType=BIGINT},
#{iPhone, jdbcType=VARCHAR},
#{pastRecords, jdbcType=VARCHAR},
#{Prescription, jdbcType=VARCHAR},
#{doctorId, jdbcType=BIGINT},
#{customerId, jdbcType=BIGINT},
#{illness, jdbcType=BIGINT},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
</insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
......@@ -116,82 +116,82 @@
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_aidea_consult_sheet
<include refid="sqlWhere"/>
SELECT COUNT(1) FROM t_aidea_consult_sheet
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_consult_sheet
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_consult_sheet
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<update id="update" parameterType="com.cftech.consultSheet.model.ConsultSheet">
<update id="update" parameterType="com.cftech.consultsheet.model.ConsultSheet">
update t_aidea_consult_sheet
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="consultId != null">
consult_id = #{consultId, jdbcType=BIGINT},
</if>
<if test="userName != null">
user_name = #{userName, jdbcType=VARCHAR},
</if>
<if test="numberId != null">
number_id = #{numberId, jdbcType=VARCHAR},
</if>
<if test="benebitId != null">
benebit_id = #{benebitId, jdbcType=TIMESTAMP},
</if>
<if test="sex != null">
sex = #{sex, jdbcType=BIGINT},
</if>
<if test="iPhone != null">
i_phone = #{iPhone, jdbcType=VARCHAR},
</if>
<if test="pastRecords != null">
past_records = #{pastRecords, jdbcType=VARCHAR},
</if>
<if test="Prescription != null">
prescription = #{Prescription, jdbcType=VARCHAR},
</if>
<if test="doctorId != null">
doctor_id = #{doctorId, jdbcType=BIGINT},
</if>
<if test="customerId != null">
customer_id = #{customerId, jdbcType=BIGINT},
</if>
<if test="illness != null">
illness = #{illness, jdbcType=BIGINT},
</if>
<if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if test="description != null">
description = #{description, jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
<if test="consultId != null">
consult_id = #{consultId, jdbcType=BIGINT},
</if>
<if test="userName != null">
user_name = #{userName, jdbcType=VARCHAR},
</if>
<if test="numberId != null">
number_id = #{numberId, jdbcType=VARCHAR},
</if>
<if test="benebitId != null">
benebit_id = #{benebitId, jdbcType=TIMESTAMP},
</if>
<if test="sex != null">
sex = #{sex, jdbcType=BIGINT},
</if>
<if test="iPhone != null">
i_phone = #{iPhone, jdbcType=VARCHAR},
</if>
<if test="pastRecords != null">
past_records = #{pastRecords, jdbcType=VARCHAR},
</if>
<if test="Prescription != null">
prescription = #{Prescription, jdbcType=VARCHAR},
</if>
<if test="doctorId != null">
doctor_id = #{doctorId, jdbcType=BIGINT},
</if>
<if test="customerId != null">
customer_id = #{customerId, jdbcType=BIGINT},
</if>
<if test="illness != null">
illness = #{illness, jdbcType=BIGINT},
</if>
<if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if test="description != null">
description = #{description, jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
......
......@@ -39,8 +39,8 @@ WOEK_TEMPLATE_MESSAGE=8m-_tt_EqoQO-wsE6_JLJdn3nO15_hgUp9mLTujz5RU
userfiles.imgdir=E:\\fileResource
#\u56FE\u7247\u8BBF\u95EE\u5730\u5740
IMAGEURL=/schaeffler/mobile/qybase/showPic?picFileName={PICFILENAME}
ROOT_ORG_NAME=\u4E1C\u660C\u96C6\u56E2
ROOT_ORG_NAME=\u827E\u8FEA\u836F\u4E1A
IMAGEURL=/aidea/mobile/qybase/showPic?picFileName={PICFILENAME}
ROOT_PAPERCATEGORY_NAME=\u95EE\u5377\u7C7B\u578B
ROOT_QUESTIONSCATEGORY_NAME=\u95EE\u9898\u7C7B\u522B
ROOT_MATERIALCATEGORY_NAME=\u7D20\u6750\u7C7B\u522B
......@@ -106,7 +106,7 @@ orderDeliverGoodsTemplateId=TH3I5prFYPC54M14zFJfgN4gvjx8SpJayctIHmzThwg
#\u670D\u52A1\u5B8C\u6210\u901A\u77E5
serverEndTemplateId=7L1KIroXNxejxotFTzll-dVLdo1xbmqoiAo7UmDKWcc
PRODUCT_CLASSIFY_FATHER_NAME=Ʒ
PRODUCT_CLASSIFY_FATHER_NAME=\uFFFD\uFFFD\u01B7\uFFFD\uFFFD\uFFFD\uFFFD
#\u54C1\u724C\u7533\u8BF7\u6D88\u606F\u6A21\u677F
brandApplyCommTemplateId=82ByH2tkWI1-jlYiWr_-CIihWsgjrvLdFvuO771FwBo
......
......@@ -21,7 +21,7 @@
*/
//var URL = base + '/ueditor-min-1.4.3/';
//var URL = 'plugins/ueditor-min-1.4.3/';
var URL = '/schaeffler/assets/adminlte/plugins/ueditor-min-1.4.3/';
var URL = '/aidea/assets/adminlte/plugins/ueditor-min-1.4.3/';
/**
* 配置项主体。注意,此处所有涉及到路径的配置别遗漏URL变量。
......
......@@ -18,7 +18,7 @@ public class OKHttpUtils {
static OkHttpClient client;
static {
OkHttpClient.Builder builder = new OkHttpClient.Builder();
OkHttpClient.Builder builder = new OkHttpClient.Builder();
Dispatcher dispatcher = new Dispatcher();
dispatcher.setMaxRequests(100);
dispatcher.setMaxRequestsPerHost(50);
......
......@@ -242,6 +242,9 @@
#if($cosconfig.cosType == "qiniu")
<option value="$cosconfig.id">七牛</option>
#end
#if($cosconfig.cosType == "local")
<option value="$cosconfig.id">本地</option>
#end
#end
</select>
</div>
......
......@@ -238,6 +238,12 @@
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-classify-module-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<!--<dependency>
<groupId>com.cftech</groupId>
<artifactId>fours-job-module</artifactId>
......
......@@ -38,7 +38,7 @@
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>schaeffler</param-value>
<param-value>aidea</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
......
......@@ -112,19 +112,19 @@
maxlength="50" placeholder="组织名称" required="required"
value="$!{data.orgName}">
</div>
<div class="form-group form-md-line-input">
<label>组织分类</label>
<div class="input-group">
<input type="text" id="orgtypeId" name="orgtypeId" value="$!{data.orgtypeId}"
class="form-control" style="display: none">
<input type="text" id="orgtypeName" name="orgtypeName" value="$!{orgtypeName}"
class="form-control" disabled>
<span class="input-group-btn">
<button type="button" id="orgtypeSelect"
class="btn btn-info btn-flat">选择</button>
</span>
</div>
</div>
<!--<div class="form-group form-md-line-input">-->
<!--<label>组织分类</label>-->
<!--<div class="input-group">-->
<!--<input type="text" id="orgtypeId" name="orgtypeId" value="$!{data.orgtypeId}"-->
<!--class="form-control" style="display: none">-->
<!--<input type="text" id="orgtypeName" name="orgtypeName" value="$!{orgtypeName}"-->
<!--class="form-control" disabled>-->
<!--<span class="input-group-btn">-->
<!--<button type="button" id="orgtypeSelect"-->
<!--class="btn btn-info btn-flat">选择</button>-->
<!--</span>-->
<!--</div>-->
<!--</div>-->
<!--<div class="checkbox">-->
<!--<label>-->
<!--<input type="checkbox" id="isAdminUnit" name="isAdminUnit"-->
......
......@@ -105,7 +105,7 @@ public class OrgUnitController {
//提交编辑页面(新增、修改)
@RequiresPermissions(value = PermissionSign.ORGUNIT_EDIT)
@RequestMapping(value = "/formData",method = {RequestMethod.POST})
@RequestMapping(value = "/formData")
@ResponseBody
public JSONObject formData(OrgUnit orgUnit, Model model, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
......@@ -123,20 +123,20 @@ public class OrgUnitController {
orgUnit.setParentIds("0," + orgUnit.getId() + ",");
}
// 2017-10-27 取消同步企业号,组织功能
// if (StringUtils.isEmpty(orgUnit.getWxorgId())) {
// int wxorgid = qyOrgUtil.create(orgUnit, parentOrgUnit);
// if (wxorgid == -1) {
// log.error("同步微信端出错," + orgUnit.toString());
// } else {
// orgUnit.setWxorgId("" + wxorgid);
//
// }
// } else {
// if (!qyOrgUtil.update(orgUnit)) {
// log.error("同步微信端出错," + orgUnit.toString());
// }
// }
//同步至企业号
if (StringUtils.isEmpty(orgUnit.getWxorgId())) {
int wxorgid = qyOrgUtil.create(orgUnit, parentOrgUnit);
if (wxorgid == -1) {
log.error("同步微信端出错," + orgUnit.toString());
} else {
orgUnit.setWxorgId("" + wxorgid);
}
} else {
if (!qyOrgUtil.update(orgUnit)) {
log.error("同步微信端出错," + orgUnit.toString());
}
}
orgUnitService.updateCache(orgUnit);
rtnJson.put("errorNo", 0);
......@@ -157,14 +157,13 @@ public class OrgUnitController {
orgUnit.setUpdateBy(UserUtils.getUser().getId());
orgUnitService.saveCache(orgUnit);
// 2017-10-27 取消同步企业号,组织功能
// int wxorgid = qyOrgUtil.create(orgUnit, parentOrgUnit);
// if (wxorgid == -1 || wxorgid == 0) {
// rtnJson.put("errorNo", 1);
// throw new Exception("同步微信端出错");
// } else {
// orgUnit.setWxorgId("" + wxorgid);
// }
int wxorgid = qyOrgUtil.create(orgUnit, parentOrgUnit);
if (wxorgid == -1 || wxorgid == 0) {
rtnJson.put("errorNo", 1);
throw new Exception("同步微信端出错");
} else {
orgUnit.setWxorgId("" + wxorgid);
}
orgUnit.setParentIds(orgUnit.getParentIds() + orgUnit.getId() + ",");
orgUnitService.updateCache(orgUnit);
......
......@@ -23,183 +23,185 @@ import java.util.concurrent.TimeUnit;
/**
* 企业号 ACCESS TOKEN 管理
* @author Neil
*
* @author Neil
*/
@Slf4j
@Component
public class QyTokenUtil {
@Autowired
private MpAccountsService accountService;
@Autowired
private RedisTemplate<String, String> redisTemplate;
// @Autowired
// private WebHttpInterface webHttpInterface;
private RedisTemplate<String, String> getConfig() {
StringRedisSerializer stringSerializer = new StringRedisSerializer();
redisTemplate.setKeySerializer(stringSerializer);
//redisTemplate.setValueSerializer(stringSerializer);
redisTemplate.setHashKeySerializer(stringSerializer);
redisTemplate.setHashValueSerializer(stringSerializer);
return redisTemplate;
}
/**
*
* 通过企业号corpid刷新最新的token,并返回
* @return
*/
public String getToken(Long accountId)//更新token
{
MpAccountsEntity accountsEntity = searchAccountsById(accountId);
if (accountsEntity == null) {
return null;
}
// accesstoken的key
String key = "CORPID_" + accountsEntity.getAppid();
// jstoken的key
String jskey = "CORPIDJS_" + accountsEntity.getAppid();
if (getConfig().hasKey(key)) {
return getConfig().opsForValue().get(key);
}
// 请求企业号认证信息
String url = WxApiConstants.TOKEN_GET.replace("CORPID", accountsEntity.getAppid())
.replace("SECRECT", accountsEntity.getSecret());
// String retStr = OKHttpUtils.getJSON(url);
// JSONObject retObj = JSON.parseObject(retStr);
// String token = retObj.getString("access_token");// 缓存token至redis
String token = "1";// webHttpInterface.getValue(url,"access_token");
getConfig().opsForValue().set(key, token);
getConfig().expire(key, 6000, TimeUnit.SECONDS);
// 继续缓存jsticket
url = WxApiConstants.JSAPI_TICKET_GET.replace("ACCESS_TOKEN", token);
// retStr = OKHttpUtils.getJSON(url);
// retObj = JSON.parseObject(retStr);
// String jsTicket = retObj.getString("ticket");
String jsTicket = "1";// webHttpInterface.getValue(url,"ticket");
// 缓存token至redis
getConfig().opsForValue().set(jskey, jsTicket);
getConfig().expire(jskey, 6000, TimeUnit.SECONDS);
return token;
}
public String getToken(MpAccountsEntity accountsEntity)//更新token
{
if (accountsEntity == null) {
return null;
}
// accesstoken的key
String key = "CORPID_" + accountsEntity.getAppid();
// jstoken的key
String jskey = "CORPIDJS_" + accountsEntity.getAppid();
if (getConfig().hasKey(key)) {
return getConfig().opsForValue().get(key);
}
// 请求企业号认证信息
String url = WxApiConstants.TOKEN_GET.replace("CORPID", accountsEntity.getAppid())
.replace("SECRECT", accountsEntity.getSecret());
try {
String retStr = OKHttpUtils.getJSON(url);
JSONObject retObj = JSON.parseObject(retStr);
String token = retObj.getString("access_token");// 缓存token至redis
getConfig().opsForValue().set(key, token);
getConfig().expire(key, 6000, TimeUnit.SECONDS);
// 继续缓存jsticket
url = WxApiConstants.JSAPI_TICKET_GET.replace("ACCESS_TOKEN", token);
retStr = OKHttpUtils.getJSON(url);
retObj = JSON.parseObject(retStr);
String jsTicket = retObj.getString("ticket");
// 缓存token至redis
getConfig().opsForValue().set(jskey, jsTicket);
getConfig().expire(jskey, 6000, TimeUnit.SECONDS);
return token;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public String getJSTicket(Long accountId) {
MpAccountsEntity accountsEntity = searchAccountsById(accountId);
// jstoken的key
String jskey = "CORPIDJS_" + accountsEntity.getAppid();
return getConfig().opsForValue().get(jskey);
}
public String getJSTicket(MpAccountsEntity accountsEntity) {
// jstoken的key
String jskey = "CORPIDJS_" + accountsEntity.getAppid();
return getConfig().opsForValue().get(jskey);
}
/**
* 通过主键ID,获取公众号实体
*/
public MpAccountsEntity searchAccountsById(Long id){
MpAccountsEntity accountsEntity = accountService.getDetail(id);
return accountsEntity;
}
/**
* 通过appid,获取公众号实体
*/
public MpAccountsEntity searchAccounts(String appid){
MpAccountsEntity accountsEntity = accountService.getMpAccountsAppid(appid);
return accountsEntity;
}
/**
* 做SHA-1签名
*
* @param jsapiTicket
* @param noncestr
* @param timestamp
* @param url
* @return
*/
public static String sign(String jsapiTicket, String noncestr, String timestamp, String url) {
StringBuffer sb = new StringBuffer();
sb.append("jsapi_ticket=");
sb.append(jsapiTicket);
sb.append("&");
sb.append("noncestr=");
sb.append(noncestr);
sb.append("&");
sb.append("timestamp=");
sb.append(timestamp);
sb.append("&");
sb.append("url=");
sb.append(url);
try {
MessageDigest crypt = MessageDigest.getInstance("SHA-1");
crypt.reset();
crypt.update(sb.toString().getBytes("UTF-8"));
return byteToHex(crypt.digest());
} catch (NoSuchAlgorithmException e) {
log.error("QyTokenUtil sign error: {}", e.getMessage());
return "";
} catch (UnsupportedEncodingException e) {
log.error("QyTokenUtil sign error: {}", e.getMessage());
return "";
}
}
private static String byteToHex(final byte[] hash) {
Formatter formatter = new Formatter();
for (byte b : hash) {
formatter.format("%02x", b);
}
String result = formatter.toString();
formatter.close();
return result;
}
@Autowired
private MpAccountsService accountService;
@Autowired
private RedisTemplate<String, String> redisTemplate;
private RedisTemplate<String, String> getConfig() {
StringRedisSerializer stringSerializer = new StringRedisSerializer();
redisTemplate.setKeySerializer(stringSerializer);
//redisTemplate.setValueSerializer(stringSerializer);
redisTemplate.setHashKeySerializer(stringSerializer);
redisTemplate.setHashValueSerializer(stringSerializer);
return redisTemplate;
}
/**
* 通过企业号corpid刷新最新的token,并返回
*
* @return
*/
public String getToken(Long accountId)//更新token
{
MpAccountsEntity accountsEntity = searchAccountsById(accountId);
if (accountsEntity == null) {
return null;
}
// accesstoken的key
String key = "CORPID_" + accountsEntity.getAppid();
// jstoken的key
String jskey = "CORPIDJS_" + accountsEntity.getAppid();
if (getConfig().hasKey(key)) {
return getConfig().opsForValue().get(key);
}
String token = null;
try {
// 请求企业号认证信息
String url = WxApiConstants.TOKEN_GET.replace("CORPID", accountsEntity.getAppid())
.replace("SECRECT", accountsEntity.getSecret());
String retStr = OKHttpUtils.getJSON(url);
JSONObject retObj = JSON.parseObject(retStr);
token = retObj.getString("access_token");// 缓存token至redis
getConfig().opsForValue().set(key, token);
getConfig().expire(key, 6000, TimeUnit.SECONDS);
// 继续缓存jsticket
url = WxApiConstants.JSAPI_TICKET_GET.replace("ACCESS_TOKEN", token);
retStr = OKHttpUtils.getJSON(url);
retObj = JSON.parseObject(retStr);
String jsTicket = retObj.getString("ticket");
// 缓存token至redis
getConfig().opsForValue().set(jskey, jsTicket);
getConfig().expire(jskey, 6000, TimeUnit.SECONDS);
} catch (IOException e) {
e.printStackTrace();
}
return token;
}
public String getToken(MpAccountsEntity accountsEntity)//更新token
{
if (accountsEntity == null) {
return null;
}
// accesstoken的key
String key = "CORPID_" + accountsEntity.getAppid();
// jstoken的key
String jskey = "CORPIDJS_" + accountsEntity.getAppid();
if (getConfig().hasKey(key)) {
return getConfig().opsForValue().get(key);
}
// 请求企业号认证信息
String url = WxApiConstants.TOKEN_GET.replace("CORPID", accountsEntity.getAppid())
.replace("SECRECT", accountsEntity.getSecret());
try {
String retStr = OKHttpUtils.getJSON(url);
JSONObject retObj = JSON.parseObject(retStr);
String token = retObj.getString("access_token");// 缓存token至redis
getConfig().opsForValue().set(key, token);
getConfig().expire(key, 6000, TimeUnit.SECONDS);
// 继续缓存jsticket
url = WxApiConstants.JSAPI_TICKET_GET.replace("ACCESS_TOKEN", token);
retStr = OKHttpUtils.getJSON(url);
retObj = JSON.parseObject(retStr);
String jsTicket = retObj.getString("ticket");
// 缓存token至redis
getConfig().opsForValue().set(jskey, jsTicket);
getConfig().expire(jskey, 6000, TimeUnit.SECONDS);
return token;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public String getJSTicket(Long accountId) {
MpAccountsEntity accountsEntity = searchAccountsById(accountId);
// jstoken的key
String jskey = "CORPIDJS_" + accountsEntity.getAppid();
return getConfig().opsForValue().get(jskey);
}
public String getJSTicket(MpAccountsEntity accountsEntity) {
// jstoken的key
String jskey = "CORPIDJS_" + accountsEntity.getAppid();
return getConfig().opsForValue().get(jskey);
}
/**
* 通过主键ID,获取公众号实体
*/
public MpAccountsEntity searchAccountsById(Long id) {
MpAccountsEntity accountsEntity = accountService.getDetail(id);
return accountsEntity;
}
/**
* 通过appid,获取公众号实体
*/
public MpAccountsEntity searchAccounts(String appid) {
MpAccountsEntity accountsEntity = accountService.getMpAccountsAppid(appid);
return accountsEntity;
}
/**
* 做SHA-1签名
*
* @param jsapiTicket
* @param noncestr
* @param timestamp
* @param url
* @return
*/
public static String sign(String jsapiTicket, String noncestr, String timestamp, String url) {
StringBuffer sb = new StringBuffer();
sb.append("jsapi_ticket=");
sb.append(jsapiTicket);
sb.append("&");
sb.append("noncestr=");
sb.append(noncestr);
sb.append("&");
sb.append("timestamp=");
sb.append(timestamp);
sb.append("&");
sb.append("url=");
sb.append(url);
try {
MessageDigest crypt = MessageDigest.getInstance("SHA-1");
crypt.reset();
crypt.update(sb.toString().getBytes("UTF-8"));
return byteToHex(crypt.digest());
} catch (NoSuchAlgorithmException e) {
log.error("QyTokenUtil sign error: {}", e.getMessage());
return "";
} catch (UnsupportedEncodingException e) {
log.error("QyTokenUtil sign error: {}", e.getMessage());
return "";
}
}
private static String byteToHex(final byte[] hash) {
Formatter formatter = new Formatter();
for (byte b : hash) {
formatter.format("%02x", b);
}
String result = formatter.toString();
formatter.close();
return result;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment