Commit 606f0129 authored by 谢希宇's avatar 谢希宇

Aidea product update by Strive Date 2020-10-30

parent bf78c180
......@@ -370,7 +370,7 @@
return;
}
var aadata = {
consultId: consultid,
consultId: $('#id').val(),
status: "2",
description: reason
};
......@@ -419,7 +419,7 @@
btncanceltext: "取消",
success: function () {
var dataJSON = {
"consultId": $("#consultId").val(),
"consultId": $("#id").val(),
"status": "1"
};
$.getJSON("#springUrl('/a/consultSheet/updateStatus')", dataJSON, function (returnobj) {
......
......@@ -157,7 +157,7 @@
<include refid="sqlColumns"/>
FROM t_aidea_consult_sheet a
LEFT JOIN t_qyuser b ON b.id = a.doctor_id
LEFT JOIN t_qyuser c ON c.id = a.customer_id
LEFT JOIN t_qyuser c ON c.id = a.service_id
WHERE a.id=#{id}
</select>
......
......@@ -51,6 +51,8 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
@Autowired
private CodingruleUtils codingruleUtils;
static final String [] arr = new String[] {"0", "1"};
@Override
public GenericDao<ConsultSheet> getGenericMapper() {
return consultSheetMapper;
......@@ -84,13 +86,11 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
public JSONObject pollingConsultSheet(ConsultSheet consultSheet) {
JSONObject retObj = new JSONObject();
try {
//consultSheet.setNumberId(codingruleUtils.getNumber(consultSheet.getAccountsId(), ConsultSheet.class.getName()));
consultSheet.setConsultId(codingruleUtils.getNumber(consultSheet.getAccountsId(), ConsultSheet.class.getName()));
if (consultSheetMapper.save(consultSheet) > 0) {
memberProcess(consultSheet.getOpenId(), consultSheet);
retObj.put("errerNo", 0);
retObj.put("errerMsg", "咨询单提交成功,请等待药师审核");
//memberProcess(consultSheet.getOpenId(), consultSheet);
} else {
retObj.put("errrNo", 1);
retObj.put("errorMsg", "咨询单保存失败");
......@@ -153,48 +153,72 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
* @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.setServiceId(users.get(0).getId());
} else if (users.size() > 1) {
//当前分配
for (Qyuser user: users) {
if (user.getPeakVal() < user.getAssigned()) {
consultSheet.setServiceId(user.getId());
//增加分配人数
user.setAssigned(user.getAssigned() + 1);
qyuserService.updateAssigned(user);
break;
first:for (int i=0, y=arr.length; i<y; i++) {
Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.user_type", arr[i]);//0:客服; 1:药师
conds.greatThan("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) {
if (arr[i].equals("0")) {
consultSheet.setServiceId(users.get(0).getId());
} else {
consultSheet.setDoctorId(users.get(0).getId());
}
}
//峰值已满
if (consultSheet.getServiceId() == 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.setServiceId(user.getId());
//增加分配人数
user.setAssigned(user.getAssigned() + 1);
qyuserService.updateAssigned(user);
} else {
consultSheet.setDescription("未有对应的咨询单处理人员");
if(users.get(0).getPeakVal() > users.get(0).getAssigned()) {//峰值未满
users.get(0).setAssigned(users.get(0).getAssigned() + 1);
qyuserService.updateAssigned(users.get(0));
} else {//峰值已满
users.get(0).setUnAssigned(users.get(0).getAssigned() + 1);
qyuserService.updateAssigned(users.get(0));
}
} else if (users.size() > 1) {
//当前分配
second: for (Qyuser user: users) {
if (user.getPeakVal() > user.getAssigned()) {//峰值未满
if (arr[i].equals("0")) {
consultSheet.setServiceId(user.getId());
} else {
consultSheet.setDoctorId(user.getId());
}
//增加分配人数
user.setAssigned(user.getAssigned() + 1);
qyuserService.updateAssigned(user);
break first;
}
}
//峰值已满
if (consultSheet.getServiceId() == null) {
Conds unconds = new Conds();
unconds.equal("t.del_flag", Constants.DEL_FLAG_0);
unconds.equal("t.user_type", arr[i]);
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);
if (arr[i].equals("0")) {
consultSheet.setServiceId(user.getId());
} else {
consultSheet.setDoctorId(user.getId());
}
//增加分配人数
user.setUnAssigned(user.getAssigned() + 1);
qyuserService.updateAssigned(user);
} else {
consultSheet.setDescription(arr[i].equals("0")? "客服": "药师" +"未有对应的咨询单处理人员");
}
}
} else {
consultSheet.setDescription(arr[i].equals("0")? "客服": "药师"+ "未有对应的咨询单处理人员");
}
} else {
consultSheet.setDescription("未有对应的咨询单处理人员");
}
return true;
}
......
......@@ -184,6 +184,7 @@ public class ConsultSheetController {
if (!StringUtils.isEmpty(consultId) && !StringUtils.isEmpty(status) ) {
Integer integer = consultSheetService.updateStatus(consultId, status);
if (integer>0){
//生成空订单
Order order = new Order();
order.setNumber(codingruleUtils.getNumber(consultSheet.getAccountsId(), Order.class.getName()));
......@@ -192,7 +193,6 @@ public class ConsultSheetController {
order.setServiceId(consultSheet.getServiceId());
order.setDoctorId(consultSheet.getDoctorId());
orderService.save(order);
//获取默认地址
Conds adsConds = new Conds();
......@@ -203,8 +203,11 @@ public class ConsultSheetController {
if (address != null) {
order.setAddressId(address.getId());
}
//order.setAddress(address.getProvinceName() + address.getCityName() + address.getCountyName() + address.getAddress());
orderService.save(order);
//反写咨询单
consultSheet.setOrderId(order.getId());
consultSheetService.update(consultSheet);
//发送审核通过模板消息
......
......@@ -12,7 +12,7 @@
<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="service_id" property="serviceId"/>
<result column="illness" property="illness"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
......@@ -68,7 +68,7 @@
a.past_records,
a.prescription,
a.doctor_id,
a.customer_id,
a.service_id,
a.illness,
a.accounts_id,
a.del_flag,
......@@ -103,7 +103,7 @@
past_records,
prescription,
doctor_id,
customer_id,
service_id,
illness,
accounts_id,
del_flag,
......@@ -132,7 +132,7 @@
#{pastRecords, jdbcType=VARCHAR},
#{prescription, jdbcType=VARCHAR},
#{doctorId, jdbcType=BIGINT},
#{customerId, jdbcType=BIGINT},
#{serviceId, jdbcType=BIGINT},
#{illness, jdbcType=BIGINT},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
......@@ -157,14 +157,14 @@
<include refid="sqlColumns"/>
FROM t_aidea_consult_sheet a
LEFT JOIN t_qyuser b ON b.id = a.doctor_id
LEFT JOIN t_qyuser c ON c.id = a.customer_id
LEFT JOIN t_qyuser c ON c.id = a.service_id
WHERE a.id=#{id}
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_aidea_consult_sheet a
LEFT JOIN t_qyuser b ON b.id = a.doctor_id
LEFT JOIN t_qyuser c ON c.id = a.customer_id
LEFT JOIN t_qyuser c ON c.id = a.service_id
LEFT JOIN `user` u ON u.userid = b.id
<include refid="sqlWhere"/>
......@@ -175,9 +175,9 @@
<include refid="sqlColumns"/>
FROM t_aidea_consult_sheet a
LEFT JOIN t_qyuser b ON b.id = a.doctor_id
LEFT JOIN t_qyuser c ON c.id = a.customer_id
LEFT JOIN t_qyuser c ON c.id = a.service_id
<include refid="sqlWhere"/>
<if test="id!=null">and (a.doctor_id = ${id} or a.customer_id =${id} )</if>
<if test="id!=null">and (a.doctor_id = ${id} or a.service_id =${id} )</if>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
......@@ -213,8 +213,8 @@
<if test="doctorId != null">
doctor_id = #{doctorId, jdbcType=BIGINT},
</if>
<if test="customerId != null">
customer_id = #{customerId, jdbcType=BIGINT},
<if test="serviceId != null">
service_id = #{serviceId, jdbcType=BIGINT},
</if>
<if test="illness != null">
illness = #{illness, jdbcType=BIGINT},
......@@ -279,7 +279,7 @@
description = #{description}
</if>
</set>
where consult_id = #{consultId}
where id = #{consultId}
</update>
<update id="updateStatus">
......@@ -290,7 +290,7 @@
</if>
</set>
where consult_id = #{consultId}
where id = #{consultId}
</update>
......
......@@ -122,31 +122,31 @@
</sql>
<sql id="sqlColumnFrom">
o.id,
o.consult_id AS consultId,
o.number,
o.pay_amount AS payAmount,
o.order_amount AS orderAmount,
o.pay_status AS payStatus,
o.order_cancel AS orderCancel,
o.trade_no AS tradeNo,
o.description,
o.STATUS,
o.create_time AS createTime,
o.confirm,
o.courier_number AS courierNumber,
CONCAT( a.areaname, b.areaname, c.areaname, s.address ) AS address
o.id,
o.consult_id AS consultId,
o.number,
o.pay_amount AS payAmount,
o.order_amount AS orderAmount,
o.pay_status AS payStatus,
o.order_cancel AS orderCancel,
o.trade_no AS tradeNo,
o.description,
o.STATUS,
o.create_time AS createTime,
o.confirm,
o.courier_number AS courierNumber,
CONCAT( a.areaname, b.areaname, c.areaname, s.address ) AS address
</sql>
<sql id="sqlColumnProduct">
d.id,
d.order_id,
t.product_number AS productNumber,
t.product_name AS productName,
t.id AS productId,
d.drugs_num AS drugsNum,
d.price,
d.amount
d.id,
d.order_id,
t.product_number AS productNumber,
t.product_name AS productName,
t.id AS productId,
d.drugs_num AS drugsNum,
d.price,
d.amount
</sql>
<sql id="Column">
......@@ -166,33 +166,33 @@
keyProperty="id">
insert into t_order
(
`id`,
`number`,
`openid`,
`pay_status`,
`pay_amount`,
`order_amount`,
`total_amount`,
`pay_time`,
`trade_no`,
`courier_number`,
`confirm`,
`order_cancel`,
`remarks`,
`accounts_id`,
`del_flag`,
`status`,
`create_time`,
`update_time`,
`description`,
`create_by`,
`update_by`,
`consult_id`,
`address_id`,
`member_id`,
`service_id`,
`doctor_id`,
`clerk_id`
id,
number,
openid,
pay_status,
pay_amount,
order_amount,
total_amount,
pay_time,
trade_no,
courier_number,
confirm,
order_cancel,
remarks,
accounts_id,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by,
consult_id,
address_id,
member_id,
service_id,
doctor_id,
clerk_id
)
values
(
......@@ -385,15 +385,19 @@
<update id="delete" parameterType="java.lang.Long">
update t_order set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
<select id="fetchProduct" resultType="com.cftech.order.model.ProductDto" parameterType="java.util.Map">
SELECT * FROM t_aidea_product WHERE id = #{productId} AND accounts_id=#{accountsId}
</select>
<delete id="updateDetill" parameterType="java.util.Map">
delete from t_order_details where order_id = #{id}
</delete>
<update id="updateDetill" parameterType="java.util.Map">
update t_order_details set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
<select id="fetcheDeta" parameterType="java.util.Map" resultType="java.lang.Integer">
select * from t_order_details where order_id =#{id} and accounts_id=#{accountsId} and drugs_id =#{productId}
</select>
<insert id="saveDetill" parameterType="com.cftech.order.model.OrderDetailDto">
insert into t_order_details
(
......@@ -412,9 +416,11 @@
#{accountsId}
)
</insert>
<select id="fetchOrder" resultType="com.cftech.order.model.Order" parameterType="java.lang.Long">
select * from t_order where id= #{id}
</select>
<update id="updateOrder" parameterType="java.util.Map">
update t_order
<set>
......
......@@ -90,7 +90,7 @@
<!-- dialog body -->
<div class="modal-body">
<input type="number" class="form-control select2" id="peakVal" name="peakVal" placeholder="请输入一个正整数"></input>
<input type="number" class="form-control select2" id="peakVal" name="peakVal" oninput="if(value<=0)value=0" onchange="updateCount(this)" placeholder="请输入一个正整数"></input>
<input type="hidden" id="peakId">
</div>
<div style="text-align: center;padding-bottom: 20px;">
......@@ -183,9 +183,7 @@
<th>手机号</th>
<th>邮箱</th>
<th>职位</th>
<!--<th>所属门店</th>-->
<!--<th>所属部门</th>-->
<!--<th>粉丝关注数</th>-->
<th>峰值</th>
<th>操作</th>
</tr>
</thead>
......@@ -321,6 +319,8 @@
"mData": "email"
},{
"mData": "userType"
},{
"mData": "peakVal"
},/* {
"mData": "storeName"
},{
......@@ -367,7 +367,7 @@
return "<font color='blue'>" +postion + "</font>";
}
},{
"aTargets": [7],
"aTargets": [8],
"mData": "id",
"mRender": function (a, b, c, d) {//a表示id对应的值,c表示当前记录行对象
var html = '#if($shiro.hasPermission("sys:qyuser:edit"))';//
......@@ -472,7 +472,7 @@
message: "设置成功",
btntext: "确定",
success: function () {
$("#example2").dataTable().fnClearTable();
location.href = "#springUrl('/a/qyuser/list')";
}
})
} else {
......
......@@ -234,7 +234,7 @@
user_type = #{userType, jdbcType=VARCHAR},
</if>
<if test="peakVal != null">
peak_val = #{peakval, jdbcType=BIGINT},
peak_val = #{peakVal, jdbcType=BIGINT},
</if>
<if test="assigned != null">
assigned = #{assigned, jdbcType=BIGINT},
......@@ -357,7 +357,7 @@
user_type = #{userType, jdbcType=VARCHAR},
</if>
<if test="peakVal != null">
peak_val = #{peakval, jdbcType=BIGINT},
peak_val = #{peakVal, jdbcType=BIGINT},
</if>
<if test="assigned != null">
assigned = #{assigned, jdbcType=BIGINT},
......
......@@ -65,7 +65,7 @@ public class Qyuser implements Serializable {
/**
* 微信号
*/
// @ExportConfig(value = "微信号", width = 100)
// @ExportConfig(value = "微信号", width = 100)
private String wxno;
/**
......@@ -141,8 +141,14 @@ public class Qyuser implements Serializable {
*/
private String userType;
/**
* 峰值
*/
private Long peakVal;
/**
* 药师医生已分配咨询单数量(峰值未满)
*/
private Long assigned;
private Long unAssigned;
......@@ -150,6 +156,8 @@ public class Qyuser implements Serializable {
public Qyuser() {
this.delFlag = false;
this.peakVal = 0L;
this.assigned = 0L;
this.unAssigned = 0L;
}
}
\ No newline at end of file
......@@ -685,6 +685,7 @@ public class QyuserController {
/**
* 设置对应、客服、药师峰值
*
* @return
*/
@RequiresPermissions(value = PermissionSign.QYUSER_EDIT)
......
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