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

Aidea product update by Strive Date 2020-10-23

parent 50664c26
......@@ -214,7 +214,7 @@
"mData": "drugsCode"
},
{
"mData": "productName"
"mData": "drugsName"
},
{
"mData": "price"
......@@ -262,7 +262,7 @@
}
},{
"aTargets": [3],
"mData": "productName",
"mData": "drugsName",
"mRender": function (a, b, c, d) {
return a;
......
......@@ -7,7 +7,7 @@
<result column="order_id" property="orderId"/>
<result column="order_code" property="orderCode"/>
<result column="drugs_id" property="drugsId"/>
<result column="drugs_num" property="drugsNum"/>
<result column="drugs_name" property="drugsName"/>
<result column="openid" property="openid"/>
<result column="price" property="price"/>
<result column="amount" property="amount"/>
......@@ -72,7 +72,7 @@
d.description,
d.create_by,
d.update_by,
p.drugs_name
d.drugs_name
</sql>
......@@ -117,7 +117,6 @@
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_order_details d
LEFT JOIN t_aidea_product p ON p.id = d.drugs_id
<include refid="sqlWhere"/>
</select>
......@@ -126,8 +125,9 @@
SELECT
<include refid="sqlColumns"/>
FROM t_order_details d
LEFT JOIN t_aidea_product p ON p.id = d.drugs_id
LEFT JOIN t_order o ON o.id = d.order_id
<include refid="sqlWhere"/>
<if test="userId!=null"> AND (o.service_id = ${userId} OR o.clerk_id = ${userId} OR o.doctor_id = ${userId}) </if>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
......
package com.cftech.orderdetail.service;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.orderdetail.model.OrderDetails;
import com.cftech.core.generic.GenericService;
import java.util.List;
/**
* 订单管理Service
*
......@@ -11,4 +16,13 @@ import com.cftech.core.generic.GenericService;
public interface OrderDetailsService extends GenericService<OrderDetails> {
/**
* 通过客服、药师、订单员获取列表
* @param userId
* @param conds
* @param sort
* @param iDisplayStart
* @param iDisplayLength
*/
List<OrderDetails> fetchSearchByPageByUser(String userId, Conds conds, Sort sort, int iDisplayStart, int iDisplayLength);
}
package com.cftech.orderdetail.service.impl;
import com.cftech.core.sql.Sort;
import com.cftech.core.util.StringUtils;
import com.cftech.orderdetail.model.OrderDetails;
import com.cftech.orderdetail.dao.OrderDetailsMapper;
import com.cftech.orderdetail.service.OrderDetailsService;
......@@ -10,6 +12,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 订单管理ServiceImpl
*
......@@ -28,4 +34,16 @@ public GenericDao<OrderDetails> getGenericMapper() {
return orderDetailsMapper;
}
@Override
public List<OrderDetails> fetchSearchByPageByUser(String userId, Conds conds, Sort sort, int page, int pageSize) {
Map<String, Object> params = new HashMap<String, Object>();
if (!StringUtils.equals(userId, "1")) {
params.put("userId", userId);
}
params.put("conds", conds);
params.put("offset", page > 0 ? page : 0);
params.put("limit", pageSize > 0 ? pageSize : 0);
params.put("sort", sort);
return getGenericMapper().fetchSearchByPage(params);
}
}
\ No newline at end of file
......@@ -11,11 +11,11 @@ import com.cftech.core.util.Constants;
import com.cftech.sys.security.PermissionSign;
import com.cftech.sys.security.UserUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
......@@ -103,14 +103,21 @@ public class OrderDetailsController {
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, OrderDetails orderDetails, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
String userId = String.valueOf(UserUtils.getUser().getId());
Conds conds = new Conds();
conds.equal("d.del_flag", Constants.DEL_FLAG_0);
conds.equal("d.accounts_id", accountsId);
conds.like("d.order_code",orderDetails.getOrderCode());
conds.like("d.drugs_code",orderDetails.getDrugsCode());
if (StringUtils.isNoneBlank(orderDetails.getDrugsCode()))
conds.like("d.drugs_code", orderDetails.getDrugsCode());
if (StringUtils.isNoneBlank(orderDetails.getOrderCode()))
conds.like("d.order_code", orderDetails.getOrderCode());
Sort sort = new Sort("d.create_time", OrderType.DESC);
List<OrderDetails> list = orderDetailsService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
List<OrderDetails> list = orderDetailsService.fetchSearchByPageByUser(userId, conds, sort, iDisplayStart, iDisplayLength);
Integer counts = orderDetailsService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
......
......@@ -213,7 +213,7 @@
},{
"mData":"productNumber"
},{
"mData":"productName"
"mData":""
},{
"mData":"productImg"
},{
......
......@@ -91,7 +91,11 @@
<table id="table" class="table table-bordered table-striped">
<thead>
<tr>
<td hidden="true">Id</td><th>创建时间</th>
<td hidden="true">Id</td>
<th>物流单编码</th>
<th>顺丰运单号</th>
<th>会员名称</th>
<th>联系人</th>
<th>操作</th>
</tr>
</thead>
......@@ -188,6 +192,18 @@
{
"mData": "id"
},
{
"mData": "number"
},
{
"mData": "waybillNo"
},
{
"mData": "memberName"
},
{
"mData": "contact"
},
{
"mData": "createTime"
},
......@@ -201,7 +217,7 @@
},
{
"aTargets": [1],
"aTargets": [5],
"mData": "createTime",
"mRender": function (a, b, c, d) {
return '<a href="#springUrl("/a/waybill/form?id=' + c.id + '")" data-id="' + c.id + '" data-action="view">' + formatDates(a, "yyyy-MM-dd HH:mm:ss");
......
......@@ -6,7 +6,7 @@
<id column="id" property="id"/>
<result column="consult_id" property="consultId"/>
<result column="order_id" property="orderId"/>
<result column="numbetr" property="numbetr"/>
<result column="number" property="number"/>
<result column="member_id" property="memberId"/>
<result column="open_id" property="openId"/>
<result column="storage_manage" property="storageManage"/>
......@@ -66,7 +66,40 @@
id,
consult_id,
order_id,
numbetr,
number,
member_id,
open_id,
storage_manage,
waybill_no,
language,
monthly_card,
express_type_id,
temperature_range,
AES_DECRYPT(contact, 'aideakey') contact,
AES_DECRYPT(mobile, 'aideakey') mobile,
AES_DECRYPT(province, 'aideakey') province,
AES_DECRYPT(city, 'aideakey') city,
AES_DECRYPT(county, 'aideakey') county,
AES_DECRYPT(address, 'aideakey') address,
address_id,
send_express_date,
accept_express_date,
waybill_remark,
accounts_id,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by
</sql>
<sql id="insertSqlColumns">
id,
consult_id,
order_id,
number,
member_id,
open_id,
storage_manage,
......@@ -79,7 +112,7 @@
mobile,
province,
city,
AES_DECRYPT(county, 'aideakey'),
county,
address,
address_id,
send_express_date,
......@@ -98,16 +131,16 @@
<insert id="save" parameterType="com.cftech.waybill.model.Waybill" useGeneratedKeys="true"
keyProperty="id">
insert into t_mp_waybill
insert into t_aidea_waybill
(
<include refid="sqlColumns"/>
<include refid="insertSqlColumns"/>
)
values
(
#{id, jdbcType=BIGINT},
#{consultId, jdbcType=BIGINT},
#{orderId, jdbcType=BIGINT},
#{numbetr, jdbcType=VARCHAR},
#{number, jdbcType=VARCHAR},
#{memberId, jdbcType=VARCHAR},
#{openId, jdbcType=VARCHAR},
#{storageManage, jdbcType=VARCHAR},
......@@ -116,12 +149,12 @@
#{monthlyCard, jdbcType=VARCHAR},
#{expressTypeId, jdbcType=VARCHAR},
#{temperatureRange, jdbcType=VARCHAR},
#{contact, jdbcType=VARCHAR},
#{mobile, jdbcType=VARCHAR},
#{province, jdbcType=VARCHAR},
#{city, jdbcType=VARCHAR},
#{county, jdbcType=VARCHAR},
AES_ENCRYPT(#{county, jdbcType=BINARY}, 'aideakey') ,
AES_ENCRYPT(#{contact, jdbcType=BINARY}, 'aideakey'),
AES_ENCRYPT(#{mobile, jdbcType=BINARY}, 'aideakey'),
AES_ENCRYPT(#{province, jdbcType=BINARY}, 'aideakey'),
AES_ENCRYPT(#{city, jdbcType=BINARY}, 'aideakey'),
AES_ENCRYPT(#{county, jdbcType=BINARY}, 'aideakey'),
AES_ENCRYPT(#{address, jdbcType=BINARY}, 'aideakey'),
#{addressId, jdbcType=VARCHAR},
now(),
now(),
......@@ -140,27 +173,65 @@
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_mp_waybill t
FROM t_aidea_waybill t
WHERE t.id=#{id}
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_mp_waybill
SELECT COUNT(1) FROM t_aidea_waybill
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
<select id="fetchSearchByPage" parameterType="java.util.Map" resultType="com.cftech.waybill.model.Waybill">
SELECT
<include refid="sqlColumns"/>
FROM t_mp_waybill
t.id,
t.consult_id consultId,
t.order_id orderId,
t.number,
t.member_id memberId,
t.open_id openId,
t.storage_manage storageManage,
t.waybill_no waybillNo,
t.language,
t.monthly_card monthlyCard,
t.express_type_id expressTypeId,
t.temperature_range temperatureRange,
AES_DECRYPT(t.contact, 'aideakey') contact,
AES_DECRYPT(t.mobile, 'aideakey') mobile,
AES_DECRYPT(t.province, 'aideakey') province,
AES_DECRYPT(t.city, 'aideakey') city,
AES_DECRYPT(t.county, 'aideakey') county,
AES_DECRYPT(t.address, 'aideakey') address,
t.address_id addressId,
t.send_express_date sendExpressDate,
t.accept_express_date acceptExpressDate,
t.waybill_remark waybillRemark,
t.accounts_id accountsId,
t.del_flag delFlag,
t.status,
t.create_time createTime,
t.update_time updateTime,
t.description,
t.create_by,
t.update_by,
o.number orderCode,
od.drugs_num drugsNum,
od.drugs_name drugsName,
od.drugs_code drugsCode,
od.price,
AES_DECRYPT(m.name, 'aideakey') memberName
FROM t_aidea_waybill t
LEFT JOIN t_order o ON t.order_id = o.id
LEFT JOIN t_order_details od ON o.id = order_id
LEFT JOIN wx_mp_member m ON t.member_id = m.id
<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.waybill.model.Waybill">
update t_mp_waybill
update t_aidea_waybill
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
......@@ -171,8 +242,8 @@
<if test="orderId != null">
order_id = #{orderId, jdbcType=BIGINT},
</if>
<if test="numbetr != null">
numbetr = #{numbetr, jdbcType=VARCHAR},
<if test="number != null">
number = #{number, jdbcType=VARCHAR},
</if>
<if test="memberId != null">
member_id = #{memberId, jdbcType=VARCHAR},
......@@ -199,22 +270,22 @@
temperature_range = #{temperatureRange, jdbcType=VARCHAR},
</if>
<if test="contact != null">
contact = #{contact, jdbcType=VARCHAR},
contact = AES_ENCRYPT(#{contact, jdbcType=BINARY}, 'aideakey'),
</if>
<if test="mobile != null">
mobile = #{mobile, jdbcType=VARCHAR},
mobile = AES_ENCRYPT(#{mobile, jdbcType=BINARY}, 'aideakey'),
</if>
<if test="province != null">
province = #{province, jdbcType=VARCHAR},
province = AES_ENCRYPT(#{province, jdbcType=BINARY}, 'aideakey'),
</if>
<if test="city != null">
city = #{city, jdbcType=VARCHAR},
city = AES_ENCRYPT(#{city, jdbcType=BINARY}, 'aideakey'),
</if>
<if test="county != null">
county = #{county, jdbcType=VARCHAR},
county = AES_ENCRYPT(#{county, jdbcType=BINARY}, 'aideakey'),
</if>
<if test="address != null">
address = #{address, jdbcType=VARCHAR},
address = AES_ENCRYPT(#{address, jdbcType=BINARY}, 'aideakey'),
</if>
<if test="addressId != null">
address_id = #{addressId, jdbcType=VARCHAR},
......@@ -254,6 +325,6 @@
</update>
<update id="delete" parameterType="java.lang.Long">
update t_mp_waybill set del_flag=1 where id=#{id,jdbcType=BIGINT}
update t_aidea_waybill set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
......@@ -25,7 +25,7 @@ public class Waybill implements Serializable {
private Long orderId;
/* 物流单编码 */
@ExportConfig(value = "物流单编码", width = 100, showLevel = 1)
private String numbetr;
private String number;
/* 会员Id */
@ExportConfig(value = "会员Id", width = 100, showLevel = 1)
private String memberId;
......@@ -97,6 +97,16 @@ public class Waybill implements Serializable {
/* 更新人 */
private Long updateBy;
/**
* 非数据库字段
*/
private String orderCode;
private String drugsNum;
private String drugsName;
private String drugsCode;
private String price;
private String memberName;
public Waybill() {
this.delFlag = false;
this.status = "0";
......
......@@ -47,11 +47,11 @@ public class ExpressOrderInfoUtils {
//业务需要增加
waybill.put("isReturnQRCode", "1");//是否返回用来推送业务的二维码 1:返回 0:不返回
waybill.put("specialDeliveryTypeCode", "1");//特殊派送类型代码 1:身份验证
waybill.put("specialDeliveryValue", "12345678");//特殊派件具体表述 证件类型:证件后8位如:1:09296231(1 表示身份证,暂不支持其他证件)
waybill.put("isReturnSignBackRoutelabel", "1");//是否返回签回单路由标签: 默认0, 1:返回路由标签,0:不返回
waybill.put("isReturnRoutelabel", "1");//是否返回路由标签: 默认0, 1:返回路由标签, 0:不返回
waybill.put("podModelAddress", "url");//签单返回范本地址
//waybill.put("specialDeliveryTypeCode", "1");//特殊派送类型代码 1:身份验证
//waybill.put("specialDeliveryValue", "12345678");//特殊派件具体表述 证件类型:证件后8位如:1:09296231(1 表示身份证,暂不支持其他证件)
//waybill.put("isReturnSignBackRoutelabel", "0");//是否返回签回单路由标签: 默认0, 1:返回路由标签,0:不返回
waybill.put("isReturnRoutelabel", "0");//是否返回路由标签: 默认0, 1:返回路由标签, 0:不返回
//waybill.put("podModelAddress", "url");//签单返回范本地址
//特殊需求药品,需冷冻、冷藏
if (StringUtils.isNoneBlank(waybillObj.getExpressTypeId())) {
......
......@@ -15,13 +15,20 @@ import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.util.EntityUtils;
import javax.net.ssl.SSLContext;
import java.io.*;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -41,7 +48,8 @@ public class FqHttpUtils {
/**
* 顺丰合作伙伴Id
*/
private static final String partnerId = SystemConfig.p.getProperty("sf.partnerID");
//private static final String partnerId = SystemConfig.p.getProperty("sf.partnerID");
private static final String partnerId = "XXYZ";
private static Map<String, String> headers = new HashMap<>();
......@@ -168,15 +176,12 @@ public class FqHttpUtils {
}
public static CloseableHttpEntity sendHttpPost(String url, List<BasicNameValuePair> content) {
if (!url.contains("/")) {
return null;
}
String dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
//构建HttpClient实例
CloseableHttpClient httpclient = null;
CloseableHttpClient httpClient = null;
CloseableHttpResponse httpResponse = null;
try {
httpclient =HttpClients.createDefault();
SSLContext sslContext = SSLContextBuilder.create().useProtocol(SSLConnectionSocketFactory.SSL).loadTrustMaterial((x, y) -> true).build();
httpClient = HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).setSSLContext(sslContext).setSSLHostnameVerifier((x, y) -> true).build();
//指定POST请求
HttpPost httpPost = new HttpPost(url);
httpPost.setConfig(requestConfig);
......@@ -196,23 +201,35 @@ public class FqHttpUtils {
//发送请求
httpPost.setEntity(request);
httpResponse = httpclient.execute(httpPost);
httpResponse = httpClient.execute(httpPost);
//读取响应
HttpEntity entity = httpResponse.getEntity();
if (entity != null) {
String result = EntityUtils.toString(entity, CHARACTER_CODE_UTF8);
System.out.println(result);
log.info(result);
return new CloseableHttpEntity(httpResponse.getStatusLine().getStatusCode(), result == null? null:JSONObject.parseObject(result));
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
log.error("API HTTP POST UnsupportedEncodingException 请求异常 url={" + url + "}; error = " +e.getMessage() );
} catch (IOException e) {
e.printStackTrace();
log.error("API HTTP POST IOException 请求异常 url={" + url + "}; error = " +e.getMessage() );
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
log.error("API HTTP POST NoSuchAlgorithmException 请求异常 url={" + url + "}; error = " +e.getMessage() );
} catch (KeyStoreException e) {
e.printStackTrace();
log.error("API HTTP POST KeyStoreException 请求异常 url={" + url + "}; error = " +e.getMessage() );
} catch (KeyManagementException e) {
e.printStackTrace();
log.error("API HTTP POST KeyManagementException 请求异常 url={" + url + "}; error = " +e.getMessage() );
} finally {
if (httpclient != null) {
if (httpClient != null) {
try {
httpclient.close();
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
......
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