Commit 4d746cf2 authored by 谢希宇's avatar 谢希宇

Aidea product update by Strive Date 2020-10-14

parent 76ab3098
...@@ -120,13 +120,13 @@ public class MobileOilController { ...@@ -120,13 +120,13 @@ public class MobileOilController {
record.setType("0"); record.setType("0");
record.setDescription("机油大转盘"); record.setDescription("机油大转盘");
String oilSum="0"; String oilSum="0";
if(StringUtils.isNotBlank(member.getOilSum())){ // if(StringUtils.isNotBlank(member.getOilSum())){
oilSum=member.getOilSum(); // oilSum=member.getOilSum();
} // }
BigDecimal a = new BigDecimal(oilSum); // BigDecimal a = new BigDecimal(oilSum);
BigDecimal b = new BigDecimal(obj.getString("amount")); // BigDecimal b = new BigDecimal(obj.getString("amount"));
BigDecimal c = a.add(b); // BigDecimal c = a.add(b);
member.setOilSum(c.toString()); // member.setOilSum(c.toString());
oilRecordService.saveTran(record,member); oilRecordService.saveTran(record,member);
} }
} }
......
...@@ -17,6 +17,15 @@ ...@@ -17,6 +17,15 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>order-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>member-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -2,38 +2,57 @@ package com.cftech.consultsheet.service.impl; ...@@ -2,38 +2,57 @@ package com.cftech.consultsheet.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.base.org.model.Qyuser;
import com.cftech.base.org.service.QyuserService;
import com.cftech.consultsheet.dao.ConsultSheetMapper; import com.cftech.consultsheet.dao.ConsultSheetMapper;
import com.cftech.consultsheet.model.ConsultSheet; import com.cftech.consultsheet.model.ConsultSheet;
import com.cftech.consultsheet.service.ConsultSheetService; import com.cftech.consultsheet.service.ConsultSheetService;
import com.cftech.core.generic.GenericDao; import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl; import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.scope.OrderType;
import com.cftech.core.sql.Conds; import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort; import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants;
import com.cftech.core.util.StringUtils;
import com.cftech.member.model.Member;
import com.cftech.member.service.MemberService;
import com.cftech.order.service.OrderService;
import com.cftech.sys.model.User;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* 咨询单ServiceImpl * 咨询单ServiceImpl
* *
* @author Licc * @author Licc
* @date: 2020-09-22 12:06 * @date: 2020-09-22 12:06
*/ */
@Service("consultSheetService") @Service("consultSheetService")
public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> implements ConsultSheetService { public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> implements ConsultSheetService {
@Autowired @Autowired
@Qualifier("consultSheetMapper") @Qualifier("consultSheetMapper")
private ConsultSheetMapper consultSheetMapper; private ConsultSheetMapper consultSheetMapper;
@Override @Autowired
public GenericDao<ConsultSheet> getGenericMapper() { private OrderService orderService;
return consultSheetMapper;
} @Autowired
private MemberService memberService;
@Autowired
private QyuserService qyuserService;
@Override
public GenericDao<ConsultSheet> getGenericMapper() {
return consultSheetMapper;
}
@Override @Override
...@@ -43,16 +62,18 @@ return consultSheetMapper; ...@@ -43,16 +62,18 @@ return consultSheetMapper;
params.put("offset", page > 0 ? page : 0); params.put("offset", page > 0 ? page : 0);
params.put("limit", pageSize > 0 ? pageSize : 0); params.put("limit", pageSize > 0 ? pageSize : 0);
params.put("sort", sort); params.put("sort", sort);
params.put("id",id); params.put("id", id);
return consultSheetMapper.fetchSearchByPage(params); return consultSheetMapper.fetchSearchByPage(params);
} }
@Transactional
@Override @Override
public JSONObject pollingConsultSheet(ConsultSheet consultSheet) { public JSONObject pollingConsultSheet(ConsultSheet consultSheet) {
JSONObject retObj = new JSONObject(); JSONObject retObj = new JSONObject();
try { try {
if (consultSheetMapper.save(consultSheet) > 0) {
memberProcess(consultSheet.getOpenId(), consultSheet);
}
retObj.put("errerNo", 0); retObj.put("errerNo", 0);
retObj.put("data", 0); retObj.put("data", 0);
} catch (Exception e) { } catch (Exception e) {
...@@ -63,4 +84,100 @@ return consultSheetMapper; ...@@ -63,4 +84,100 @@ return consultSheetMapper;
} }
return retObj; return retObj;
} }
/**
* 咨询单分配流程
* 复购/首次分配
* @return
*/
private boolean memberProcess(String openid, ConsultSheet consultSheet) {
//1、查询用户是否复购
Conds conds = new Conds();
conds.equal("o.del_flag", Constants.DEL_FLAG_0);
conds.equal("o.openid", openid);
conds.in("o.status", new String[]{"2", "3", "4"});//2 待发货,3:待收货 4:待付款
int count = orderService.count(conds);
if (count > 0) { //复购
Conds memberConds = new Conds();
memberConds.equal("del_flag", Constants.DEL_FLAG_0);
memberConds.equal("open_id", openid);
Member member = memberService.fetchSearchByConds(conds);
String customerId = member.getCustomerId();
Conds userConds = new Conds();
userConds.equal("t.del_flag", Constants.DEL_FLAG_0);
userConds.equal("t.id", customerId);
Qyuser user = qyuserService.fetchSearchByConds(userConds);
if (user.getPeakVal() > 0) {//客服峰值大于0
consultSheet.setCustomerId(user.getId());
} else {//普通轮询
firstCustomerProcess(consultSheet);
}
String doctorId = member.getDoctorId();
userConds.equal("t.id", doctorId);
user = qyuserService.fetchSearchByConds(userConds);
if (user.getPeakVal() > 0) {//药师峰值大于0
consultSheet.setDoctorId(user.getId());
} else {//普通轮询
firstCustomerProcess(consultSheet);
}
} else {//首次购买
firstCustomerProcess(consultSheet);
}
return consultSheetMapper.update(consultSheet) > 0;
}
/**
* 咨询单首次购买流程
* @return
*/
private boolean firstCustomerProcess(ConsultSheet consultSheet) {
Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.user_type", "0");
conds.greatEqual("t.peak_val", 0);
Sort sort = new Sort("t.assigned", OrderType.ASC);
List<Qyuser> users = qyuserService.fetchSearchByPage(conds, sort, 0, 0);
if (users.size() == 1) {
consultSheet.setCustomerId(users.get(0).getId());
} else if (users.size() > 1) {
//当前分配
for (Qyuser user: users) {
if (user.getPeakVal() < user.getAssigned()) {
consultSheet.setCustomerId(user.getId());
//增加分配人数
user.setAssigned(user.getAssigned() + 1);
qyuserService.updateAssigned(user);
break;
}
}
//峰值已满
if (consultSheet.getCustomerId() == null) {
Conds unconds = new Conds();
unconds.equal("t.del_flag", Constants.DEL_FLAG_0);
unconds.equal("t.user_type", "0");
unconds.greatEqual("t.peak_val", 0);
Sort unsort = new Sort("t.un_assigned", OrderType.ASC);
users = qyuserService.fetchSearchByPage(conds, unsort, 0, 0);
if (users.size() > 0) {
Qyuser user = users.get(0);
consultSheet.setCustomerId(user.getId());
//增加分配人数
user.setAssigned(user.getAssigned() + 1);
qyuserService.updateAssigned(user);
} else {
consultSheet.setDescription("未有对应的咨询单处理人员");
}
}
} else {
consultSheet.setDescription("未有对应的咨询单处理人员");
}
return true;
}
} }
\ No newline at end of file
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<result column="create_by" property="createBy"/> <result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/> <result column="update_by" property="updateBy"/>
<result column="confirm" property="confirm"/> <result column="confirm" property="confirm"/>
<result column="drugs_num" property="drugsNum"/> <result column="drugs_num" property="drugsNum"/>
<result column="product_number" property="productNumber"/> <result column="product_number" property="productNumber"/>
<result column="product_name" property="productName"/> <result column="product_name" property="productName"/>
<result column="address" property="address"/> <result column="address" property="address"/>
...@@ -73,7 +73,6 @@ ...@@ -73,7 +73,6 @@
</resultMap> </resultMap>
<sql id="sqlWhere"> <sql id="sqlWhere">
<if test="conds!=null"> <if test="conds!=null">
<trim prefix="WHERE" prefixOverrides="AND|OR"> <trim prefix="WHERE" prefixOverrides="AND|OR">
...@@ -226,14 +225,14 @@ ...@@ -226,14 +225,14 @@
<include refid="sqlColumnProduct"/> <include refid="sqlColumnProduct"/>
from from
t_order_details d t_order_details d
LEFT JOIN t_order o ON d.order_id =o.id LEFT JOIN t_order o ON d.order_id =o.id
LEFT JOIN t_aidea_product t ON d.drugs_id = t.id LEFT JOIN t_aidea_product t ON d.drugs_id = t.id
WHERE WHERE
d.order_id =#{id} d.order_id =#{id}
</select> </select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer"> <select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM (select count(1) from t_order o SELECT COUNT(1) FROM (select count(1) from t_order o
LEFT JOIN t_shipping_address s ON o.address_id = s.id LEFT JOIN t_shipping_address s ON o.address_id = s.id
LEFT JOIN t_order_details d ON o.id = d.order_id LEFT JOIN t_order_details d ON o.id = d.order_id
LEFT JOIN t_aidea_product t ON d.drugs_id = t.id LEFT JOIN t_aidea_product t ON d.drugs_id = t.id
...@@ -241,7 +240,7 @@ ...@@ -241,7 +240,7 @@
LEFT JOIN area b ON s.city_id = b.areaid LEFT JOIN area b ON s.city_id = b.areaid
LEFT JOIN area c ON s.area_id = c.areaid LEFT JOIN area c ON s.area_id = c.areaid
<include refid="sqlWhere"/> <include refid="sqlWhere"/>
GROUP BY o.id GROUP BY o.id
) b ) b
</select> </select>
...@@ -249,7 +248,7 @@ ...@@ -249,7 +248,7 @@
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMapList"> <select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMapList">
SELECT SELECT
<include refid="sqlColumns"/> <include refid="sqlColumns"/>
FROM t_order o FROM t_order o
LEFT JOIN t_shipping_address s ON o.address_id = s.id LEFT JOIN t_shipping_address s ON o.address_id = s.id
LEFT JOIN t_order_details d ON o.id = d.order_id LEFT JOIN t_order_details d ON o.id = d.order_id
LEFT JOIN t_aidea_product t ON d.drugs_id = t.id LEFT JOIN t_aidea_product t ON d.drugs_id = t.id
...@@ -259,7 +258,7 @@ ...@@ -259,7 +258,7 @@
LEFT JOIN t_qyuser q ON o.service_id = q.id AND o.doctor_id = q.id LEFT JOIN t_qyuser q ON o.service_id = q.id AND o.doctor_id = q.id
LEFT JOIN `user` u ON u.userid = q.id LEFT JOIN `user` u ON u.userid = q.id
<include refid="sqlWhere"/> <include refid="sqlWhere"/>
<if test="id!=null"> ${id} = b.id </if> <if test="id!=null">${id} = b.id</if>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if> <if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if> <if test="limit>0">limit #{offset},#{limit}</if>
</select> </select>
...@@ -401,11 +400,11 @@ ...@@ -401,11 +400,11 @@
<update id="updateOrder" parameterType="java.util.Map"> <update id="updateOrder" parameterType="java.util.Map">
update t_order update t_order
<set> <set>
<if test="orderAmount!=null" > <if test="orderAmount!=null">
order_amount = #{orderAmount} order_amount = #{orderAmount}
</if> </if>
</set> </set>
where id= #{id} where id= #{id}
</update> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
maxlength="200" placeholder="生日" maxlength="200" placeholder="生日"
> >
</div> </div>
<div class="form-group form-md-line-input" id="other"> <div class="form-group form-md-line-input" id="email">
</div> </div>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<result column="phone" property="phone"/> <result column="phone" property="phone"/>
<result column="imageurl" property="imageurl"/> <result column="imageurl" property="imageurl"/>
<result column="cardid" property="cardid"/> <result column="cardid" property="cardid"/>
<result column="other" property="other"/> <result column="email" property="email"/>
<result column="member_id" property="memberId"/> <result column="member_id" property="memberId"/>
<result column="accounts_id" property="accountsId"/> <result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
...@@ -25,11 +25,11 @@ ...@@ -25,11 +25,11 @@
<result column="level" property="level"/> <result column="level" property="level"/>
<result column="area" property="area"/> <result column="area" property="area"/>
<result column="fanss_store_id" property="fanssStoreId"/> <result column="fanss_store_id" property="fanssStoreId"/>
<result column="oilSum" property="oilSum"/> <result column="doctor_id" property="doctorId"/>
<result column="invitcode" property="invitcode"/> <result column="invitcode" property="invitcode"/>
<result column="compan" property="compan"/> <result column="compan" property="compan"/>
<result column="position" property="position"/> <result column="position" property="position"/>
<result column="member_uid" property="member_uid"/> <result column="customer_id" property="customerId"/>
</resultMap> </resultMap>
<resultMap id="resultMapDto" type="com.cftech.member.model.MemberDto"> <resultMap id="resultMapDto" type="com.cftech.member.model.MemberDto">
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
phone, phone,
imageurl, imageurl,
cardid, cardid,
other, email,
member_id, member_id,
accounts_id, accounts_id,
del_flag, del_flag,
...@@ -102,10 +102,10 @@ ...@@ -102,10 +102,10 @@
level, level,
area, area,
fanss_store_id, fanss_store_id,
oilSum, doctor_id,
invitcode, invitcode,
compan, compan,
member_uid customer_id
</sql> </sql>
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
#{phone, jdbcType=VARCHAR}, #{phone, jdbcType=VARCHAR},
#{imageurl, jdbcType=VARCHAR}, #{imageurl, jdbcType=VARCHAR},
#{cardid, jdbcType=VARCHAR}, #{cardid, jdbcType=VARCHAR},
#{other, jdbcType=CLOB}, #{email, jdbcType=VARCHAR},
#{memberId, jdbcType=VARCHAR}, #{memberId, jdbcType=VARCHAR},
#{accountsId, jdbcType=BIGINT}, #{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT}, #{delFlag, jdbcType=TINYINT},
...@@ -142,10 +142,10 @@ ...@@ -142,10 +142,10 @@
#{level,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR},
#{area,jdbcType=VARCHAR}, #{area,jdbcType=VARCHAR},
#{fanssStoreId,jdbcType=BIGINT}, #{fanssStoreId,jdbcType=BIGINT},
#{oilSum,jdbcType=VARCHAR}, #{doctorId,jdbcType=VARCHAR},
#{invitcode,jdbcType=VARCHAR}, #{invitcode,jdbcType=VARCHAR},
#{compan,jdbcType=VARCHAR}, #{compan,jdbcType=VARCHAR},
#{member_uid} #{customer_id, jdbc=VARCHAR}
) )
</insert> </insert>
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
t.phone, t.phone,
t.imageurl, t.imageurl,
t.cardid, t.cardid,
t.other, t.email,
t.member_id, t.member_id,
t.accounts_id, t.accounts_id,
t.del_flag, t.del_flag,
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
offline.sex, offline.sex,
t.level, t.level,
t.area, t.area,
t.fanss_store_id,oilSum, t.fanss_store_id,t.doctor_id,
t.invitcode,t.compan, t.invitcode,t.compan,
offline.name memberName, offline.name memberName,
offline.phone memberPhone, offline.phone memberPhone,
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
member.invitcode, member.invitcode,
member.compan, member.compan,
member.sex, member.sex,
member.member_uid member.customer_id
FROM FROM
wx_mp_member member wx_mp_member member
<include refid="sqlWhere"/> <include refid="sqlWhere"/>
...@@ -259,8 +259,8 @@ ...@@ -259,8 +259,8 @@
<if test="cardid != null"> <if test="cardid != null">
cardid = #{cardid, jdbcType=VARCHAR}, cardid = #{cardid, jdbcType=VARCHAR},
</if> </if>
<if test="other != null"> <if test="email != null">
other = #{other, jdbcType=CLOB}, email = #{email, jdbcType=VARCHAR},
</if> </if>
<if test="memberId != null"> <if test="memberId != null">
member_id = #{memberId, jdbcType=VARCHAR}, member_id = #{memberId, jdbcType=VARCHAR},
...@@ -310,8 +310,8 @@ ...@@ -310,8 +310,8 @@
<if test="fanssStoreId != null"> <if test="fanssStoreId != null">
fanss_store_id = #{fanssStoreId, jdbcType=VARCHAR}, fanss_store_id = #{fanssStoreId, jdbcType=VARCHAR},
</if> </if>
<if test="oilSum != null"> <if test="doctorId != null">
oilSum = #{oilSum, jdbcType=VARCHAR} doctor_id = #{doctorId, jdbcType=VARCHAR}
</if> </if>
<if test="invitcode != null"> <if test="invitcode != null">
invitcode = #{invitcode, jdbcType=VARCHAR} invitcode = #{invitcode, jdbcType=VARCHAR}
...@@ -351,7 +351,7 @@ ...@@ -351,7 +351,7 @@
<include refid="sqlWhere"/> <include refid="sqlWhere"/>
</select> </select>
<select id="memberFormation" parameterType="java.lang.Long" resultType="com.cftech.member.model.MemberVO"> <select id="memberFormation" parameterType="java.lang.Long" resultType="com.cftech.member.model.MemberVO">
SELECT CONCAT(surname,`name`) AS memberName,sex,birthday,imageurl,other AS mailbox,phone SELECT CONCAT(surname,`name`) AS memberName,sex,birthday,imageurl,email AS mailbox,phone
FROM wx_mp_member WHERE id= #{id} FROM wx_mp_member WHERE id= #{id}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -64,6 +64,7 @@ public class Member implements Serializable { ...@@ -64,6 +64,7 @@ public class Member implements Serializable {
/*微信openID*/ /*微信openID*/
//@ExportConfig(value = "openId", width = 100) //@ExportConfig(value = "openId", width = 100)
private String openId; private String openId;
private String position; private String position;
/** /**
...@@ -83,8 +84,8 @@ public class Member implements Serializable { ...@@ -83,8 +84,8 @@ public class Member implements Serializable {
private String area; private String area;
/* 其他信息 */ /* 其他信息 */
//@ExportConfig(value = "完善信息", width = 100) @ExportConfig(value = "Email", width = 100)
private String other; private String email;
/**绑定的门店*/ /**绑定的门店*/
private String storeid; private String storeid;
...@@ -94,10 +95,8 @@ public class Member implements Serializable { ...@@ -94,10 +95,8 @@ public class Member implements Serializable {
* */ * */
private Long fanssStoreId; private Long fanssStoreId;
/**
* 机油总数
*/
protected String oilSum;
/** /**
*会员卡名字 *会员卡名字
...@@ -116,45 +115,31 @@ public class Member implements Serializable { ...@@ -116,45 +115,31 @@ public class Member implements Serializable {
/** /**
* 会员邀请码 * 会员邀请码
*/ */
@ExportConfig(value = "邀请码", width = 100,showLevel =1 )
private String invitcode; private String invitcode;
private String compan;
/** /**
* 公司名称 * 所属客服id
*/ */
@ExportConfig(value = "公司名称", width = 100) //private String member_uid;
private String compan; private String customerId;
/**
* 所属药师id
*/
//private String oilSum;
private String doctorId;
/**
* 会员来源: 1:普通关注 2:医师二维码 3:客服二维码 4:医生二维码 5:组织二维码
*/
private String source;
//人员唯一识别号
private String member_uid;
// public void setCardid(String cardid) {
// if(StringUtils.isNotBlank(cardid)){
// int sexNumber = 0;
// String temStr="";
// if(cardid.length()==18){//二代身份证
// sexNumber= Integer.valueOf(cardid.substring(cardid.length()-2,cardid.length()-1));
// temStr = cardid.substring(6, 14);
// temStr = temStr.substring(0, 4) + "-" + temStr.substring(4, 6) + "-" + temStr.substring(6);
// }else if(cardid.length()==15){//老式一代身份证
// sexNumber= Integer.valueOf(cardid.substring(cardid.length()-1));
// temStr = cardid.substring(6, 12);
// temStr = "19" + temStr;
// temStr = temStr.substring(0, 4) + "-" + temStr.substring(4, 6) + "-" + temStr.substring(6);
// }
// if(sexNumber%2==0){
// this.sex="女";
// }else{
// this.sex="男";
// }
// this.birthday=temStr;
// }
//this.cardid = cardid;
// }
......
...@@ -138,7 +138,7 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem ...@@ -138,7 +138,7 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem
List<Workshop> list = workshopService.selectworkshop(conds,sort,0,0); List<Workshop> list = workshopService.selectworkshop(conds,sort,0,0);
if(list!=null&&list.size()>0){ if(list!=null&&list.size()>0){
for(Workshop workshop : list){ for(Workshop workshop : list){
workshop.setMember_uid(member.getMember_uid()); //workshop.setMember_uid(member.getMember_uid());
workshopService.update(workshop); workshopService.update(workshop);
} }
} }
......
...@@ -226,9 +226,9 @@ public class MemberController { ...@@ -226,9 +226,9 @@ public class MemberController {
if(workshop!=null){ if(workshop!=null){
Member member = new Member(); Member member = new Member();
member.setStatus("1"); member.setStatus("1");
member.setOilSum("0"); //member.setOilSum("0");
member.setNumber(codingruleUtils.getNumber(accountsId, Member.class.getName())); member.setNumber(codingruleUtils.getNumber(accountsId, Member.class.getName()));
member.setMember_uid(UUID.randomUUID().toString()); //member.setMember_uid(UUID.randomUUID().toString());
member.setSurname(workshop.getSurname()); member.setSurname(workshop.getSurname());
member.setName(workshop.getFirst_name()); member.setName(workshop.getFirst_name());
member.setPhone(workshop.getPhone()); member.setPhone(workshop.getPhone());
...@@ -237,7 +237,7 @@ public class MemberController { ...@@ -237,7 +237,7 @@ public class MemberController {
member.setInvitcode(code); member.setInvitcode(code);
member.setAccountsId(accountsId); member.setAccountsId(accountsId);
memberService.save(member); memberService.save(member);
workshop.setMember_uid(member.getMember_uid()); //workshop.setMember_uid(member.getMember_uid());
workshop.setStatus("1"); workshop.setStatus("1");
workshopService.update(workshop); workshopService.update(workshop);
}else{ }else{
......
...@@ -97,7 +97,7 @@ public class MobileWxJsController { ...@@ -97,7 +97,7 @@ public class MobileWxJsController {
memberConds.equal("accounts_id", mpAccount.getId()); memberConds.equal("accounts_id", mpAccount.getId());
Member member = memberService.fetchSearchByConds(memberConds); Member member = memberService.fetchSearchByConds(memberConds);
if(member!=null){ //已注册 if(member!=null){ //已注册
rtnJson.put("memberUid",member.getMember_uid()); //rtnJson.put("memberUid",member.getMember_uid());
}else{//用户未注册 }else{//用户未注册
rtnJson.put("memberUid",""); rtnJson.put("memberUid","");
rtnJson.put("errorCode", 1); rtnJson.put("errorCode", 1);
......
...@@ -79,6 +79,28 @@ ...@@ -79,6 +79,28 @@
</div> </div>
</div> </div>
<!-- 设置峰值弹出窗 -->
<div id="peakButtom" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">设置峰值</h4>
</div>
<!-- dialog body -->
<div class="modal-body">
<input type="number" class="form-control select2" id="peakVal" name="peakVal" placeholder="请输入一个正整数"></input>
<input type="hidden" id="peakId">
</div>
<div style="text-align: center;padding-bottom: 20px;">
<button style="width: 100px;" type="button" class="btn btn-primary" onclick="submitPeakVal()">确定</button>
<button style="width: 100px;" type="button" class="btn btn-default" data-dismiss="modal" aria-label="Close">取消</button>
</div>
<!-- dialog buttons -->
</div>
</div>
</div>
<!-- Main content --> <!-- Main content -->
<section class="content"> <section class="content">
...@@ -239,7 +261,7 @@ ...@@ -239,7 +261,7 @@
+ minute + ":" + second; + minute + ":" + second;
} }
if($("#logText").html()!=null && $("#logText").html()!="" &&$("#logText").html()!="${text}"){ if($("#logText").html()!=null && $("#logText").html()!="" && $("#logText").html()!="${text}"){
$("#myModal").modal('show'); $("#myModal").modal('show');
} }
...@@ -350,20 +372,19 @@ ...@@ -350,20 +372,19 @@
"mRender": function (a, b, c, d) {//a表示id对应的值,c表示当前记录行对象 "mRender": function (a, b, c, d) {//a表示id对应的值,c表示当前记录行对象
var html = '#if($shiro.hasPermission("sys:qyuser:edit"))';// var html = '#if($shiro.hasPermission("sys:qyuser:edit"))';//
var html = '<div class="btn-group">\n' + var html = '<div class="btn-group">\n' +
' <button type="button" class="btn btn-success btn-flat">操作</button>\n' + '<button type="button" class="btn btn-success btn-flat">操作</button>\n' +
' <button type="button" class="btn btn-success btn-flat dropdown-toggle" data-toggle="dropdown">\n' + '<button type="button" class="btn btn-success btn-flat dropdown-toggle" data-toggle="dropdown">\n' +
' <span class="caret"></span>\n' + '<span class="caret"></span>\n' +
' <span class="sr-only">Toggle Dropdown</span>\n' + '<span class="sr-only">Toggle Dropdown</span>\n' +
' </button>\n' + '</button>\n' +
' <ul class="dropdown-menu" role="menu">\n'; '<ul class="dropdown-menu" role="menu">\n';
html += "<li><a href=#springUrl('/a/qyuser/form?id=" + a +"') >修改</a></li>"; html += "<li><a href=#springUrl('/a/qyuser/form?id=" + a +"') >修改</a></li>";
if (c.userType == '0' || c.userType == '1' || c.userType == '2') { if (c.userType == '0' || c.userType == '1' || c.userType == '2') {
html += "<li><a href='javascript:bindQrCode(" + a + ", "+ c.userType +")' >绑定二维码</a></li>"; html += "<li><a href='javascript:bindQrCode(" + a + ", "+ c.userType +")' >绑定二维码</a></li>";
html += "<li><a href='javascript:peakVal(" + a + ")' >设置患者分配峰值</a></li>"; if (c.qrcode != null)
html += "<li><a href='javascript:unBindQrCode(" + a + ", "+ c.userType +")' >取消绑定二维码</a></li>";
html += "<li><a href='javascript:peakVal(" + a + ")' data-target='#foo'>设置患者分配峰值</a></li>";
} }
if (c.qrcode != null)
html += "<li><a href='javascript:unBindQrCode(" + a + ", "+ c.userType +")' >取消绑定二维码</a></li>";
html += '<li><a href="javascript:removeData(' + a + ')" >删除</a></li>#end'; html += '<li><a href="javascript:removeData(' + a + ')" >删除</a></li>#end';
html+= '</ul></div>'; html+= '</ul></div>';
return html; return html;
...@@ -429,9 +450,14 @@ ...@@ -429,9 +450,14 @@
} }
function peakVal(id) { function peakVal(id) {
var setPeakValUrl = "#springUrl('/a/qyuser/unBindQrcode?type="+type+"')"; $("#peakButtom").modal('show');
$("#peakId").val(id);
}
function submitPeakVal() {
var setPeakValUrl = "#springUrl('/a/qyuser/setPeakVal')";
Cfapp.confirm({ Cfapp.confirm({
message: "确定要解除二维码绑定吗", message: "确认提交峰值?",
btnoktext: "确定", btnoktext: "确定",
btncanceltext: "取消", btncanceltext: "取消",
success: function () { success: function () {
...@@ -439,7 +465,7 @@ ...@@ -439,7 +465,7 @@
"type": "post", "type": "post",
"url": setPeakValUrl, "url": setPeakValUrl,
"dataType": "json", "dataType": "json",
"data": {userId: id,_csrf_header:csrfheader.value,_csrf:csrftoken.value}, //以json格式传递 "data": {id: $("#peakId").val(), peakVal: $("#peakVal").val(), _csrf_header:csrfheader.value, _csrf:csrftoken.value}, //以json格式传递
"success": function (data) { "success": function (data) {
if (data.errorNo == 0) { if (data.errorNo == 0) {
Cfapp.alert({ Cfapp.alert({
...@@ -461,8 +487,7 @@ ...@@ -461,8 +487,7 @@
}); });
}, },
cancel: function () { cancel: function () {
$(".modal-backdrop").fadeOut(); $("#peakButtom").modal('hide');
} }
}) })
} }
......
...@@ -66,4 +66,17 @@ public interface QyuserMapper extends GenericDao<Qyuser> { ...@@ -66,4 +66,17 @@ public interface QyuserMapper extends GenericDao<Qyuser> {
List<Qyuser> getLogInfo(Map<String, Object> params); List<Qyuser> getLogInfo(Map<String, Object> params);
/**
* 获取轮询的人员(药师、医生)且通过峰值排序
* @return
*/
List<Qyuser> fetchPollingData(String type);
/**
* 更新未超过峰值/超过峰值,分配咨询单数量
* @param user
* @return
*/
boolean updateAssigned(Qyuser user);
} }
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
<result column="update_by" property="updateBy" /> <result column="update_by" property="updateBy" />
<result column="user_type" property="userType" /> <result column="user_type" property="userType" />
<result column="peak_val" property="peakVal" /> <result column="peak_val" property="peakVal" />
<result column="assigned" property="assigned"/>
<result column="un_assigned" property="unAssigned"/>
</resultMap> </resultMap>
<resultMap id="resultMapVO" type="com.cftech.base.org.model.vo.QyuserVO"> <resultMap id="resultMapVO" type="com.cftech.base.org.model.vo.QyuserVO">
...@@ -79,13 +81,13 @@ ...@@ -79,13 +81,13 @@
<sql id="sqlColumns"> <sql id="sqlColumns">
id, name, qrcode, avatar, mobile, email, role, wxno, gender, accounts_id, id, name, qrcode, avatar, mobile, email, role, wxno, gender, accounts_id,
position_id, store_id, store_name, wxuser_id, org_id, tag_ids, status, create_time, position_id, store_id, store_name, wxuser_id, org_id, tag_ids, status, create_time,
update_time, description, del_flag, create_by, update_by update_time, description, del_flag, create_by, update_by, user_type, peak_val, assigned, un_assigned
</sql> </sql>
<sql id="sqlColumnsT"> <sql id="sqlColumnsT">
t.id, t.name, t.qrcode, t.avatar, t.mobile, t.email,t.role, t.wxno, t.gender, t.accounts_id, t.id, t.name, t.qrcode, t.avatar, t.mobile, t.email,t.role, t.wxno, t.gender, t.accounts_id,
t.position_id, t.store_id, t.store_name, t.wxuser_id, t.org_id, t.tag_ids, t.status, t.create_time, t.position_id, t.store_id, t.store_name, t.wxuser_id, t.org_id, t.tag_ids, t.status, t.create_time,
t.update_time, t.description, t.del_flag, t.create_by, t.update_by t.update_time, t.description, t.del_flag, t.create_by, t.update_by, user_type, peak_val, assigned, un_assigned
</sql> </sql>
<insert id="save" parameterType="com.cftech.base.org.model.Qyuser" <insert id="save" parameterType="com.cftech.base.org.model.Qyuser"
...@@ -98,7 +100,7 @@ ...@@ -98,7 +100,7 @@
wxuser_id, org_id, tag_ids, wxuser_id, org_id, tag_ids,
status, create_time, update_time, status, create_time, update_time,
description, del_flag, create_by, description, del_flag, create_by,
update_by, user_type update_by, user_type, peak_val, assigned, un_assigned
) )
values values
( (
...@@ -115,7 +117,7 @@ ...@@ -115,7 +117,7 @@
#{status, #{status,
jdbcType=VARCHAR}, now(), now(), #{description, jdbcType=VARCHAR}, jdbcType=VARCHAR}, now(), now(), #{description, jdbcType=VARCHAR},
#{delFlag, jdbcType=TINYINT}, #{createBy, jdbcType=BIGINT}, #{delFlag, jdbcType=TINYINT}, #{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}, #{userType, jdbcType=VARCHAR} #{updateBy, jdbcType=BIGINT}, #{userType, jdbcType=VARCHAR}, #{peakVal, jdbcType=BIGINT}, #{assigned, jdbcType=BIGINT}, #{unAssigned, jdbcType=BIGINT}
) )
</insert> </insert>
...@@ -123,7 +125,7 @@ ...@@ -123,7 +125,7 @@
SELECT SELECT
t.id, t.name, t.qrcode, t.avatar, t.mobile, t.email, t.role, t.wxno, t.gender, t.accounts_id, t.id, t.name, t.qrcode, t.avatar, t.mobile, t.email, t.role, t.wxno, t.gender, t.accounts_id,
t.store_id, t.store_name, t.wxuser_id, t.org_id, t.tag_ids, t.status, t.create_time, t.store_id, t.store_name, t.wxuser_id, t.org_id, t.tag_ids, t.status, t.create_time,
t.update_time, t.description, t.del_flag, t.create_by, t.update_by,u.username loginName t.update_time, t.description, t.del_flag, t.create_by, t.update_by,u.username loginName, t.user_type, t.peak_val, t.assigned, t.un_assigned
FROM t_qyuser t FROM t_qyuser t
left join user u on u.userid=t.id left join user u on u.userid=t.id
WHERE t.id=#{id} WHERE t.id=#{id}
...@@ -144,7 +146,7 @@ ...@@ -144,7 +146,7 @@
SELECT SELECT
t.id, t.name, t.qrcode, t.avatar, t.mobile, t.email, t.role, t.wxno, t.gender, t.accounts_id, t.id, t.name, t.qrcode, t.avatar, t.mobile, t.email, t.role, t.wxno, t.gender, t.accounts_id,
t.store_id, t.store_name, t.wxuser_id, t.org_id, t.tag_ids, t.status, t.create_time, t.store_id, t.store_name, t.wxuser_id, t.org_id, t.tag_ids, t.status, t.create_time,
t.update_time, t.description, t.del_flag, t.create_by, t.update_by,u.username loginName t.update_time, t.description, t.del_flag, t.create_by, t.update_by,u.username loginName, t.user_type, t.peak_val, t.assigned, t.un_assigned
FROM t_qyuser t FROM t_qyuser t
left join t_orgunit o on o.id = t.org_id left join t_orgunit o on o.id = t.org_id
left join user u on u.userid=t.id left join user u on u.userid=t.id
...@@ -228,6 +230,18 @@ ...@@ -228,6 +230,18 @@
<if test="updateBy != null"> <if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT}, update_by = #{updateBy, jdbcType=BIGINT},
</if> </if>
<if test="userType != null">
user_type = #{userType, jdbcType=VARCHAR},
</if>
<if test="peakVal != null">
peak_val = #{peakval, jdbcType=BIGINT},
</if>
<if test="assigned != null">
assigned = #{assigned, jdbcType=BIGINT},
</if>
<if test="unAssigned != null">
un_assigned = #{unAssigned, jdbcType=BIGINT},
</if>
</set> </set>
where id=#{id,jdbcType=BIGINT} where id=#{id,jdbcType=BIGINT}
</update> </update>
...@@ -245,7 +259,7 @@ ...@@ -245,7 +259,7 @@
t.name name, t.mobile mobile, t.wxno wxno, t.email email,t.description, t.name name, t.mobile mobile, t.wxno wxno, t.email email,t.description,
t.wxuser_id t.wxuser_id
wxuser_id, wxuser_id,
u.username loginName, t.user_type, t.gender, qrcode.ticket qrcode u.username loginName, t.user_type, t.gender, qrcode.ticket qrcode, t.user_type, t.peak_val, t.assigned, t.un_assigned
FROM t_qyuser t FROM t_qyuser t
left join t_orgunit o on o.id = t.org_id left join t_orgunit o on o.id = t.org_id
left join user u on u.userid = t.id left join user u on u.userid = t.id
...@@ -339,6 +353,18 @@ ...@@ -339,6 +353,18 @@
<if test="updateBy != null"> <if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT}, update_by = #{updateBy, jdbcType=BIGINT},
</if> </if>
<if test="userType != null">
user_type = #{userType, jdbcType=VARCHAR},
</if>
<if test="peakVal != null">
peak_val = #{peakval, jdbcType=BIGINT},
</if>
<if test="assigned != null">
assigned = #{assigned, jdbcType=BIGINT},
</if>
<if test="unAssigned != null">
un_assigned = #{unAssigned, jdbcType=BIGINT},
</if>
</set> </set>
<include refid="sqlWhere" /> <include refid="sqlWhere" />
</update> </update>
...@@ -457,15 +483,33 @@ ...@@ -457,15 +483,33 @@
</foreach> </foreach>
</update> </update>
<select id="getLogInfo" parameterType="java.util.Map" resultMap="resultMap"> <select id="getLogInfo" parameterType="java.util.Map" resultMap="resultMap">
select b.id,b.name,b.store_id, b.role,c.name store_name,b.qrcode from user a INNER JOIN t_qyuser b on b.id = a.userid select b.id,b.name,b.store_id, b.role,c.name store_name,b.qrcode from user a INNER JOIN t_qyuser b on b.id = a.userid
INNER JOIN t_dc_store c on c.id = b.store_id INNER JOIN t_dc_store c on c.id = b.store_id
where a.id = #{id} and a.delflag = '0' where a.id = #{id} and a.delflag = '0'
</select> </select>
<!-- 获取轮询的人员(药师、医生)且通过峰值排序 -->
<select id="fetchPollingData" parameterType="java.lang.String" resultMap="resultMap">
SELECT t.* FROM t_qyuser t
<if test="type=0">t.user_type = '0'</if>
<if test="type=1">t.user_type = '1'</if>
ORDER BY t.peak_val DESC
</select>
<update id="updateAssigned" parameterType="com.cftech.base.org.model.Qyuser">
update t_qyuser
<set>
<if test="peakVal != null">
peak_val = #{peakVal, jdbcType=BIGINT},
</if>
<if test="assigned != null">
assigned = #{assigned, jdbcType=BIGINT},
</if>
<if test="unAssigned != null">
un_assigned = #{unAssigned, jdbcType=BIGINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -141,7 +141,11 @@ public class Qyuser implements Serializable { ...@@ -141,7 +141,11 @@ public class Qyuser implements Serializable {
*/ */
private String userType; private String userType;
private String peakVal; private Long peakVal;
private Long assigned;
private Long unAssigned;
public Qyuser() { public Qyuser() {
......
...@@ -97,4 +97,15 @@ public interface QyuserService extends GenericService<Qyuser> { ...@@ -97,4 +97,15 @@ public interface QyuserService extends GenericService<Qyuser> {
List<Qyuser> getLogInfo(Map<String, Object> params); List<Qyuser> getLogInfo(Map<String, Object> params);
/**
* 获取轮询的人员(药师、医生)且通过峰值排序
*/
List<Qyuser> fetchPollingData(String type);
/**
* 更新未超过峰值/超过峰值,分配咨询单数量
* @param user
*/
boolean updateAssigned(Qyuser user);
} }
...@@ -138,4 +138,15 @@ public class QyuserServiceImpl extends GenericServiceImpl<Qyuser> implements Qyu ...@@ -138,4 +138,15 @@ public class QyuserServiceImpl extends GenericServiceImpl<Qyuser> implements Qyu
{ {
return qyuserMapper.getLogInfo(params); return qyuserMapper.getLogInfo(params);
} }
@Override
public List<Qyuser> fetchPollingData(String type) {
//判断是否为复购
return qyuserMapper.fetchPollingData(type);
}
@Override
public boolean updateAssigned(Qyuser user) {
return qyuserMapper.updateAssigned(user);
}
} }
package com.cftech.core.util; package com.cftech.base.org.utils;
import com.alibaba.fastjson.JSONArray;
import com.cftech.base.org.model.Qyuser;
import com.cftech.base.org.service.QyuserService;
import com.cftech.core.sql.Conds;
import com.cftech.core.util.Constants;
import com.cftech.core.util.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
/** /**
* redis 缓存类 * redis 缓存类
* Created by 16444 on 2020/10/19. * Created by 16444 on 2020/10/19.
...@@ -17,6 +25,9 @@ public class RedisCacheUtils { ...@@ -17,6 +25,9 @@ public class RedisCacheUtils {
@Autowired @Autowired
private RedisTemplate<String, String> redisTemplates; private RedisTemplate<String, String> redisTemplates;
@Autowired
private QyuserService qyuserService;
private RedisTemplate<String, String> getConfig() { private RedisTemplate<String, String> getConfig() {
StringRedisSerializer strSerializer = new StringRedisSerializer(); StringRedisSerializer strSerializer = new StringRedisSerializer();
redisTemplates.setKeySerializer(strSerializer); redisTemplates.setKeySerializer(strSerializer);
...@@ -37,7 +48,22 @@ public class RedisCacheUtils { ...@@ -37,7 +48,22 @@ public class RedisCacheUtils {
return ""; return "";
} }
public String findPollingDoctor() { public String findPollingDoctor(String accountsId) {
JSONArray doctors = null;
String doctorKey = "DOCTOR_QUEUE_" + accountsId;
if (getConfig().hasKey(doctorKey)) {
String userStr = getConfig().opsForValue().get(doctorKey).toString();
if (StringUtils.isBlank(userStr)) {
List<Qyuser> users = qyuserService.fetchPollingData("1");
StringBuffer ids = new StringBuffer();
users.stream().forEach(user -> ids.append(user.getId()+",") );
}
//doctors = JSONArray.parseArray(userArr);
}
return ""; return "";
} }
......
package com.cftech.workshop.activ.web; package com.cftech.workshop.activ.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.LongArraySerializer;
import com.cftech.base.codingrule.utils.CodingruleUtils; import com.cftech.base.codingrule.utils.CodingruleUtils;
import com.cftech.core.util.SystemConfig; import com.cftech.core.util.SystemConfig;
import com.cftech.workshop.activ.model.Activ; import com.cftech.workshop.activ.model.Activ;
......
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