Commit 8bab67be authored by 谢希宇's avatar 谢希宇

fix:修改bug,增加收费功能;

parent 936c375e
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<result column="address_id" property="addressId"></result> <result column="address_id" property="addressId"></result>
<result column="audit_time" property="auditTime"></result> <result column="audit_time" property="auditTime"></result>
<result column="followup_hospital" property="followupHospital"></result> <result column="followup_hospital" property="followupHospital"></result>
<result column="pre_id" property="preId"></result>
</resultMap> </resultMap>
<sql id="sqlWhere"> <sql id="sqlWhere">
...@@ -92,7 +93,8 @@ ...@@ -92,7 +93,8 @@
a.audit_time auditTime, a.audit_time auditTime,
b.`name` pharmaName, b.`name` pharmaName,
c.`name` customerName, c.`name` customerName,
a.followup_hospital followupHospital a.followup_hospital followupHospital,
a.pre_id preId
</sql> </sql>
<sql id="sqlCol"> <sql id="sqlCol">
...@@ -113,7 +115,8 @@ ...@@ -113,7 +115,8 @@
consult_id consultId, consult_id consultId,
status, status,
drugs_id drugsId, drugs_id drugsId,
address_id addressId address_id addressId,
pre_id preId
</sql> </sql>
<insert id="save" parameterType="com.cftech.consultsheet.model.ConsultSheet" useGeneratedKeys="true" <insert id="save" parameterType="com.cftech.consultsheet.model.ConsultSheet" useGeneratedKeys="true"
...@@ -147,7 +150,8 @@ ...@@ -147,7 +150,8 @@
member_id, member_id,
order_id, order_id,
address_id, address_id,
audit_time audit_time,
pre_id
) )
values values
( (
...@@ -178,13 +182,18 @@ ...@@ -178,13 +182,18 @@
#{memberId, jdbcType=BIGINT}, #{memberId, jdbcType=BIGINT},
#{orderId, jdbcType=BIGINT}, #{orderId, jdbcType=BIGINT},
#{addressId, jdbcType=VARCHAR}, #{addressId, jdbcType=VARCHAR},
#{auditTime, jdbcType=TIMESTAMP} #{auditTime, jdbcType=TIMESTAMP},
#{preId, jdbcType=BIGINT}
) )
</insert> </insert>
<select id="fetchById" parameterType="java.lang.Long" resultType="com.cftech.consultsheet.model.ConsultSheet"> <select id="fetchById" parameterType="java.lang.Long" resultType="com.cftech.consultsheet.model.ConsultSheet">
SELECT SELECT
<include refid="sqlColumns"/>, d.name pharmacist, e.org_name hospital, f.store fansAlias, f.nickname nickName, <include refid="sqlColumns"/>,
d.name pharmacist,
e.org_name hospital,
f.store fansAlias,
f.nickname nickName,
m.status isThree, m.status isThree,
m.invitcode randomNo, m.invitcode randomNo,
ou.org_name firstHospital ou.org_name firstHospital
...@@ -354,6 +363,9 @@ ...@@ -354,6 +363,9 @@
<if test="followupHospital != null"> <if test="followupHospital != null">
followup_hospital = #{followupHospital, jdbcType=VARCHAR}, followup_hospital = #{followupHospital, jdbcType=VARCHAR},
</if> </if>
<if test="preId != null">
pre_id = #{preId, jdbcType=VARCHAR},
</if>
</set> </set>
where id=#{id,jdbcType=BIGINT} where id=#{id,jdbcType=BIGINT}
</update> </update>
......
...@@ -74,6 +74,8 @@ public class ConsultSheet extends UserSheet implements Serializable { ...@@ -74,6 +74,8 @@ public class ConsultSheet extends UserSheet implements Serializable {
private Long orderId; private Long orderId;
/* 随访医院 */ /* 随访医院 */
private String followupHospital; private String followupHospital;
/* 所属处方单Id */
private Long preId;
/** /**
* 审核时间 * 审核时间
......
...@@ -74,7 +74,7 @@ public interface ConsultSheetService extends GenericService<ConsultSheet> { ...@@ -74,7 +74,7 @@ public interface ConsultSheetService extends GenericService<ConsultSheet> {
* 咨询单消息推送 * 咨询单消息推送
* @param consultSheet * @param consultSheet
*/ */
void sendQyWechatMassage(ConsultSheet consultSheet); void sendQyWechatMassage(ConsultSheet consultSheet) throws Exception;
/** /**
* 通过咨询单/订单编码获取对应客服信息 * 通过咨询单/订单编码获取对应客服信息
......
...@@ -208,7 +208,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -208,7 +208,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
* *
* @return * @return
*/ */
private boolean memberProcess(String openid, ConsultSheet consultSheet) { private boolean memberProcess(String openid, ConsultSheet consultSheet) throws Exception {
//1、查询用户是否复购 //1、查询用户是否复购
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("o.del_flag", Constants.DEL_FLAG_0); conds.equal("o.del_flag", Constants.DEL_FLAG_0);
...@@ -259,10 +259,9 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -259,10 +259,9 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
* *
* @return * @return
*/ */
private boolean firstCustomerProcess(ConsultSheet consultSheet) { private boolean firstCustomerProcess(ConsultSheet consultSheet) throws Exception {
first: first:
for (int i = 0, y = arr.length; i < y; i++) { for (int i = 0, y = arr.length; i < y; i++) {
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0); conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.user_type", arr[i]);//1:药师; 2:客服 conds.equal("t.user_type", arr[i]);//1:药师; 2:客服
...@@ -340,7 +339,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im ...@@ -340,7 +339,7 @@ public class ConsultSheetServiceImpl extends GenericServiceImpl<ConsultSheet> im
/** /**
* 推送企业微信消息 * 推送企业微信消息
*/ */
public void sendQyWechatMassage(ConsultSheet consultSheet) { public void sendQyWechatMassage(ConsultSheet consultSheet) throws Exception {
Long accounts = Long.parseLong(SystemConfig.p.getProperty("QY_SEND_APPID")); Long accounts = Long.parseLong(SystemConfig.p.getProperty("QY_SEND_APPID"));
MpAccountsEntity accountsEntity = mpAccountsService.getDetail(accounts); MpAccountsEntity accountsEntity = mpAccountsService.getDetail(accounts);
Long agenId = Long.parseLong(accountsEntity.getAgentId()); Long agenId = Long.parseLong(accountsEntity.getAgentId());
......
...@@ -55,12 +55,4 @@ public class MobileConsultSheetController { ...@@ -55,12 +55,4 @@ public class MobileConsultSheetController {
public JSONObject byBillFindCustomerService(@RequestParam String billCode) { public JSONObject byBillFindCustomerService(@RequestParam String billCode) {
return consultSheetService.byBillFindCustomerService(billCode); return consultSheetService.byBillFindCustomerService(billCode);
} }
@RequestMapping(value = "/test",
method = {RequestMethod.POST},
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void test(Long id) {
ConsultSheet consultSheet = consultSheetService.fetchById(id);
consultSheetService.sendQyWechatMassage(consultSheet);
}
} }
...@@ -3,8 +3,8 @@ package com.cftech.hospital.util; ...@@ -3,8 +3,8 @@ package com.cftech.hospital.util;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.core.util.StringUtils; import com.cftech.core.util.StringUtils;
import com.cftech.core.util.SystemConfig; import com.cftech.core.util.SystemConfig;
import com.cftech.order.pay.HashKit;
import com.cftech.waybill.utils.CloseableHttpEntity; import com.cftech.waybill.utils.CloseableHttpEntity;
import com.cftech.wechat.pay.HashKit;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.ClientProtocolException; import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.config.RequestConfig; import org.apache.http.client.config.RequestConfig;
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
#{tofrom, jdbcType=VARCHAR}, #{tofrom, jdbcType=VARCHAR},
#{tolist, jdbcType=VARCHAR}, #{tolist, jdbcType=VARCHAR},
#{roomid, jdbcType=VARCHAR}, #{roomid, jdbcType=VARCHAR},
#{msgtime, jdbcType=DATETIME}, #{msgtime, jdbcType=TIMESTAMP},
#{msgType, jdbcType=VARCHAR}, #{msgType, jdbcType=VARCHAR},
#{content, jdbcType=VARCHAR}, #{content, jdbcType=VARCHAR},
#{mediaPath, jdbcType=VARCHAR}, #{mediaPath, jdbcType=VARCHAR},
......
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
<artifactId>order-module</artifactId> <artifactId>order-module</artifactId>
<dependencies> <dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>wechat-pay-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>com.cftech</groupId> <groupId>com.cftech</groupId>
<artifactId>order-detail-module</artifactId> <artifactId>order-detail-module</artifactId>
...@@ -48,5 +53,11 @@ ...@@ -48,5 +53,11 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>prescription-module</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
<result column="order_time" property="orderTime"/> <result column="order_time" property="orderTime"/>
<result column="remind_type" property="remindType"/> <result column="remind_type" property="remindType"/>
<result column="pay_type" property="payType"/> <result column="pay_type" property="payType"/>
<result column="cash_fee" property="cashFee"/>
</resultMap> </resultMap>
<sql id="sqlWhere"> <sql id="sqlWhere">
...@@ -94,7 +95,8 @@ ...@@ -94,7 +95,8 @@
m.`name` memberName, m.`name` memberName,
CONVERT ( AES_DECRYPT( m.phone, 'aideakey' ) USING UTF8 ) memberPhone, CONVERT ( AES_DECRYPT( m.phone, 'aideakey' ) USING UTF8 ) memberPhone,
a.address, a.address,
a.pay_type a.pay_type,
a.cash_fee
</sql> </sql>
<sql id="Column"> <sql id="Column">
...@@ -147,7 +149,8 @@ ...@@ -147,7 +149,8 @@
order_time, order_time,
cancel_time, cancel_time,
remind_type, remind_type,
pay_type pay_type,
cash_fee
) )
values values
( (
...@@ -182,7 +185,8 @@ ...@@ -182,7 +185,8 @@
#{orderTime, jdbcType=TIMESTAMP}, #{orderTime, jdbcType=TIMESTAMP},
#{cancelTime, jdbcType=TIMESTAMP}, #{cancelTime, jdbcType=TIMESTAMP},
#{remindType, jdbcType=VARCHAR}, #{remindType, jdbcType=VARCHAR},
#{payType, jdbcType=VARCHAR} #{payType, jdbcType=VARCHAR},
#{cashFee, jdbcType=DECIMAL}
) )
</insert> </insert>
<update id="deleteAll" > <update id="deleteAll" >
...@@ -213,6 +217,7 @@ ...@@ -213,6 +217,7 @@
DATE_FORMAT(aw.create_time, '%Y-%m-%d %H:%i:%s') sendExpressDateStr, DATE_FORMAT(aw.create_time, '%Y-%m-%d %H:%i:%s') sendExpressDateStr,
DATE_FORMAT(aw.accept_express_date, '%Y-%m-%d %H:%i:%s') acceptExpressDateStr, DATE_FORMAT(aw.accept_express_date, '%Y-%m-%d %H:%i:%s') acceptExpressDateStr,
o.pay_time payTime, o.pay_time payTime,
o.cash_fee cashFee,
qyu.name storageManageName qyu.name storageManageName
from from
t_order o t_order o
...@@ -313,6 +318,7 @@ ...@@ -313,6 +318,7 @@
o.remind_type remindType, o.remind_type remindType,
o.remarks, o.remarks,
o.accounts_id accountsId, o.accounts_id accountsId,
o.cash_fee cashFee,
t.id as productId, t.id as productId,
GROUP_CONCAT(t.product_number SEPARATOR ',') productNumber, GROUP_CONCAT(t.product_number SEPARATOR ',') productNumber,
GROUP_CONCAT(t.common_name SEPARATOR ',') productName, GROUP_CONCAT(t.common_name SEPARATOR ',') productName,
...@@ -477,6 +483,9 @@ ...@@ -477,6 +483,9 @@
<if test="payType != null"> <if test="payType != null">
pay_type = #{payType, jdbcType=VARCHAR}, pay_type = #{payType, jdbcType=VARCHAR},
</if> </if>
<if test="cashFee != null">
cash_fee = #{cashFee, jdbcType=DECIMAL},
</if>
</set> </set>
where id=#{id,jdbcType=BIGINT} where id=#{id,jdbcType=BIGINT}
</update> </update>
......
...@@ -29,9 +29,11 @@ public class Order extends OrderDetail implements Serializable { ...@@ -29,9 +29,11 @@ public class Order extends OrderDetail implements Serializable {
/* 付款回调详情 */ /* 付款回调详情 */
@ExportConfig(value = "付款回调详情", width = 100, showLevel = 1) @ExportConfig(value = "付款回调详情", width = 100, showLevel = 1)
private String payStatus; private String payStatus;
/* 付款金额 */ /* 付款金额(微信付款总金额) */
@ExportConfig(value = "付款金额", width = 100, showLevel = 1) @ExportConfig(value = "付款金额", width = 100, showLevel = 1)
private Double payAmount; private Double payAmount;
/* 付款现金金额(微信付款现金部分) */
private Double cashFee;
/* 订单金额 */ /* 订单金额 */
@ExportConfig(value = "订单金额", width = 100, showLevel = 1) @ExportConfig(value = "订单金额", width = 100, showLevel = 1)
private Double orderAmount; private Double orderAmount;
...@@ -149,6 +151,8 @@ public class Order extends OrderDetail implements Serializable { ...@@ -149,6 +151,8 @@ public class Order extends OrderDetail implements Serializable {
private boolean isFirst; private boolean isFirst;
/** /**
* 搜索字段 * 搜索字段
*/ */
......
...@@ -94,20 +94,12 @@ public interface OrderService extends GenericService<Order> { ...@@ -94,20 +94,12 @@ public interface OrderService extends GenericService<Order> {
Integer updateRemindType(Long id, String option); Integer updateRemindType(Long id, String option);
/** /**
* 回调微信支付状态 * 获取路由信息
* @param request
* @return
*/
String callBackPayStatus(HttpServletRequest request);
/**
* 获取移动端jsapi支付参数
* @param orderId
* @param openId
* @param appId * @param appId
* @param orderCode
* @return * @return
*/ */
String findOrderPayParams(String orderId, String openId, String appId, String prepayId); JSONObject findRouteDetails(String appId, String orderCode);
/** /**
* 发送微信消息 * 发送微信消息
...@@ -117,16 +109,31 @@ public interface OrderService extends GenericService<Order> { ...@@ -117,16 +109,31 @@ public interface OrderService extends GenericService<Order> {
boolean sendQyWechatMassage(Long id, String msgType); boolean sendQyWechatMassage(Long id, String msgType);
/** /**
* 获取路由信息 * 获取等待提醒的订单发送客服跟进提醒消息
* @param appId
* @param orderCode
* @return * @return
*/ */
JSONObject findRouteDetails(String appId, String orderCode); List<Map<String, String>> findWaitRemindOrders(Long number);
/** /**
* 获取等待提醒的订单发送客服跟进提醒消息 * 回调微信支付信息
* @param request
* @return * @return
*/ */
List<Map<String, String>> findWaitRemindOrders(Long number); String wechatPayCallback(HttpServletRequest request);
/**
* 回调微信退款信息
* @param request
* @return
*/
String wechatRefundCallback(HttpServletRequest request);
/**
* 获取移动端jsapi支付参数
* @param openId
* @param appId
* @return
*/
String findOrderPayParams(String openId, String appId, String prepayId);
} }
...@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONArray; ...@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.accounts.model.MpAccountsEntity; import com.cftech.accounts.model.MpAccountsEntity;
import com.cftech.accounts.service.MpAccountsService; import com.cftech.accounts.service.MpAccountsService;
import com.cftech.authentication.service.AuthenticationService;
import com.cftech.base.codingrule.utils.CodingruleUtils; import com.cftech.base.codingrule.utils.CodingruleUtils;
import com.cftech.base.org.api.QyMsgUtil; import com.cftech.base.org.api.QyMsgUtil;
import com.cftech.base.org.model.Qyuser; import com.cftech.base.org.model.Qyuser;
...@@ -27,7 +26,6 @@ import com.cftech.mp.fans.model.MpFanssEntity; ...@@ -27,7 +26,6 @@ import com.cftech.mp.fans.model.MpFanssEntity;
import com.cftech.mp.fans.service.MpFanssService; import com.cftech.mp.fans.service.MpFanssService;
import com.cftech.order.model.*; import com.cftech.order.model.*;
import com.cftech.order.dao.OrderMapper; import com.cftech.order.dao.OrderMapper;
import com.cftech.order.pay.WechatPayUtils;
import com.cftech.order.service.OrderService; import com.cftech.order.service.OrderService;
import com.cftech.core.generic.GenericDao; import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl; import com.cftech.core.generic.GenericServiceImpl;
...@@ -36,8 +34,11 @@ import com.cftech.core.sql.Conds; ...@@ -36,8 +34,11 @@ import com.cftech.core.sql.Conds;
import com.cftech.order.utils.InvoiceUtil; import com.cftech.order.utils.InvoiceUtil;
import com.cftech.orderdetail.dao.OrderDetailsMapper; import com.cftech.orderdetail.dao.OrderDetailsMapper;
import com.cftech.orderdetail.service.OrderDetailsService; import com.cftech.orderdetail.service.OrderDetailsService;
import com.cftech.prescription.model.Prescription;
import com.cftech.prescription.service.PrescriptionService;
import com.cftech.product.model.Product; import com.cftech.product.model.Product;
import com.cftech.product.service.ProductService; import com.cftech.product.service.ProductService;
import com.cftech.wechat.pay.WechatPayUtils;
import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn;
import javafx.scene.control.TreeTableColumn; import javafx.scene.control.TreeTableColumn;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -101,6 +102,9 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order ...@@ -101,6 +102,9 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order
@Autowired @Autowired
private ProductService productService; private ProductService productService;
@Autowired
private PrescriptionService prescriptionService;
@Override @Override
public GenericDao<Order> getGenericMapper() { public GenericDao<Order> getGenericMapper() {
return orderMapper; return orderMapper;
...@@ -248,8 +252,9 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order ...@@ -248,8 +252,9 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order
rtnJson.put("errorMsg", "确认成功!"); rtnJson.put("errorMsg", "确认成功!");
return rtnJson; return rtnJson;
} }
} else {//获取商户号订单内容 } else {//生成商户号订单,获取商户号订单内容
JSONObject mchObj = WechatPayUtils.genenatePay(order); BigDecimal amount = new BigDecimal(order.getOrderAmount());
JSONObject mchObj = WechatPayUtils.generatePay(order.getOpenid(), order.getNumber(), amount);
if (mchObj != null) { if (mchObj != null) {
order.setStatus("1"); order.setStatus("1");
order.setOrderTime(new Date()); order.setOrderTime(new Date());
...@@ -604,40 +609,44 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order ...@@ -604,40 +609,44 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order
/** /**
* 微信支付回调事件 * 微信支付回调事件
*
* @param request * @param request
* @return * @return
*/ */
@Transactional @Transactional
@Override @Override
public String callBackPayStatus(HttpServletRequest request) { public String wechatPayCallback(HttpServletRequest request) {
try { try {
TreeMap<String, String> map = WechatPayUtils.parseXml(request); TreeMap<String, String> map = WechatPayUtils.parseXml(request);
String result = JSONUtils.toJSONString(map); String result = JSONUtils.toJSONString(map);
log.info("callBackPayStatus 支付详情 =" + result); log.info("wechatPayCallback 支付详情 =" + result);
if (StringUtils.equals(map.get("return_code"), "SUCCESS") && StringUtils.equals(map.get("result_code"), "SUCCESS")) { if (StringUtils.equals(map.get("return_code"), "SUCCESS") && StringUtils.equals(map.get("result_code"), "SUCCESS")) {
String appid = map.get("appid"); String appid = map.get("appid");
String mch_id = map.get("mch_id"); String mch_id = map.get("mch_id");
String out_trade_no = map.get("out_trade_no");//订单编码 String out_trade_no = map.get("out_trade_no");//订单编码
String transaction_id = map.get("transaction_id");//微信订单支付号 String transaction_id = map.get("transaction_id");//微信订单支付号
String time_end = map.get("time_end");//订单完成时间 String time_end = map.get("time_end");//订单完成时间
Date date = DateFormatUtils.formatDate(time_end, "yyyyMMddHHmmss");
if (StringUtils.equals(appid, SystemConfig.p.getProperty("WX_MP_SERVER_APPID")) && StringUtils.equals(mch_id, SystemConfig.p.getProperty("mch.mch_id"))) { if (StringUtils.equals(appid, SystemConfig.p.getProperty("WX_MP_SERVER_APPID")) && StringUtils.equals(mch_id, SystemConfig.p.getProperty("mch.mch_id"))) {
Conds orderConds = new Conds(); Conds orderConds = new Conds();
orderConds.equal("o.del_flag", Constants.DEL_FLAG_0); orderConds.equal("o.del_flag", Constants.DEL_FLAG_0);
orderConds.equal("o.number", out_trade_no); orderConds.equal("o.number", out_trade_no);
Order order = this.fetchSearchByConds(orderConds); Order order = this.fetchSearchByConds(orderConds);
//付款时间 //付款时间
if (order != null) { if (order != null) {
order.setPayStatus(result); order.setPayStatus(result);
order.setStatus("2");//待发货 order.setStatus("2");//待发货
order.setTradeNo(transaction_id); order.setTradeNo(transaction_id);
//现金支付总金额 //支付总金额
if (StringUtils.isNoneBlank(map.get("total_fee"))) { if (StringUtils.isNoneBlank(map.get("total_fee"))) {
order.setPayAmount(Double.parseDouble(map.get("total_fee"))); order.setPayAmount(Double.parseDouble(map.get("total_fee")));
} }
//现金支付总金额
if (StringUtils.isNoneBlank(map.get("cash_fee"))) {
order.setCashFee(Double.parseDouble(map.get("cash_fee")));
}
//支付完成时间 //支付完成时间
if (StringUtils.isNoneBlank(time_end)) { if (StringUtils.isNoneBlank(time_end)) {
Date date = DateFormatUtils.formatDate(time_end, "yyyyMMddHHmmss");
order.setPayTime(date); order.setPayTime(date);
} }
if (orderMapper.update(order) > 0) { if (orderMapper.update(order) > 0) {
...@@ -650,24 +659,69 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order ...@@ -650,24 +659,69 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order
return WechatPayUtils.retSucXml; return WechatPayUtils.retSucXml;
} }
} else { } else {
log.info("callBackPayStatus 支付回调失败!订单不存在 orderNumber=" + transaction_id); Conds preConds = new Conds();
preConds.equal("t.del_flag", Constants.DEL_FLAG_0);
preConds.equal("t.number", out_trade_no);
Prescription prescription = prescriptionService.fetchSearchByConds(preConds);
if (prescription != null) {
prescription.setPayStatus("1");//已支付
prescription.setTradeNo(transaction_id);
prescription.setPayAmount(new BigDecimal(map.get("total_fee")));
prescription.setCashFee(new BigDecimal(map.get("cash_fee")));
prescription.setPayTime(date);
prescription.setPayRemark(result);
if (prescriptionService.update(prescription)) {
return WechatPayUtils.retSucXml;
}
}
log.info("wechatPayCallback 支付回调失败!单据不存在=" + out_trade_no);
} }
} else { } else {
log.info("callBackPayStatus 支付回调失败!appid/mchid返回失败"); log.info("wechatPayCallback 支付回调失败!appid/mchid返回失败");
} }
} else { } else {
log.info("callBackPayStatus 支付回调失败!接口返回失败"); log.info("wechatPayCallback 支付回调失败!接口返回失败");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("callBackPayStatus 支付回调失败! message = " + e.getMessage()); log.error("wechatPayCallback 支付回调失败! message = " + e.getMessage());
return WechatPayUtils.retFailXml; return WechatPayUtils.retFailXml;
} }
return WechatPayUtils.retFailXml; return WechatPayUtils.retFailXml;
} }
/**
* 微信退款回调事件
* @param request
* @return
*/
@Transactional
@Override @Override
public String findOrderPayParams(String orderId, String openId, String appId, String prepayId) { public String wechatRefundCallback(HttpServletRequest request) {
try {
TreeMap<String, String> map = WechatPayUtils.parseXml(request);
String result = JSONUtils.toJSONString(map);
log.info("wechatRefundCallback 退款详情 =" + result);
if (StringUtils.equals(map.get("return_code"), "SUCCESS")) {
String appid = map.get("appid");
String mch_id = map.get("mch_id");
String nonce_str = map.get("nonce_str");
String req_info = map.get("req_info");//退款信息(加密)
log.info("退款信息解密="+ req_info);
} else {
log.info("wechatRefundCallback 退款回调失败!接口返回失败");
}
} catch (Exception e) {
e.printStackTrace();
log.error("wechatRefundCallback 退款回调失败! message = " + e.getMessage());
return WechatPayUtils.retFailXml;
}
return WechatPayUtils.retFailXml;
}
@Override
public String findOrderPayParams(String openId, String appId, String prepayId) {
JSONObject retObj = new JSONObject(); JSONObject retObj = new JSONObject();
try { try {
...@@ -678,18 +732,6 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order ...@@ -678,18 +732,6 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order
return retObj.toString(); return retObj.toString();
} }
//获取待付款订单
Conds orderConds = new Conds();
orderConds.equal("o.del_flag", Constants.DEL_FLAG_0);
orderConds.equal("o.status", "1");
orderConds.equal("o.id", orderId);
Order order = this.fetchSearchByConds(orderConds);
if (order == null) {
retObj.put("errorNo", 1);
retObj.put("errorMsg", "订单信息获取失败!");
return retObj.toString();
}
MpFanssEntity fanssEntity = mpFanssService.getWxUser(openId); MpFanssEntity fanssEntity = mpFanssService.getWxUser(openId);
if (fanssEntity == null) { if (fanssEntity == null) {
retObj.put("errorNo", 1); retObj.put("errorNo", 1);
...@@ -700,7 +742,7 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order ...@@ -700,7 +742,7 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order
JSONObject payParams = new JSONObject(); JSONObject payParams = new JSONObject();
payParams.put("appId", mpAccountsEntity.getAppid()); payParams.put("appId", mpAccountsEntity.getAppid());
payParams.put("timeStamp", Long.toString(System.currentTimeMillis() / 1000)); payParams.put("timeStamp", Long.toString(System.currentTimeMillis() / 1000));
payParams.put("nonceStr", UUID.randomUUID().toString().replaceAll("-", "")); payParams.put("nonceStr", WechatPayUtils.generateRandomNumber());
payParams.put("package", "prepay_id=" + prepayId); payParams.put("package", "prepay_id=" + prepayId);
payParams.put("signType", "MD5"); payParams.put("signType", "MD5");
......
package com.cftech.order.web; package com.cftech.order.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.core.sql.Conds;
import com.cftech.core.util.Constants;
import com.cftech.invoice.model.InvoiceDto; import com.cftech.invoice.model.InvoiceDto;
import com.cftech.order.model.Order;
import com.cftech.order.model.OrderMobileDto; import com.cftech.order.model.OrderMobileDto;
import com.cftech.order.service.OrderService; import com.cftech.order.service.OrderService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -13,7 +10,6 @@ import org.springframework.http.MediaType; ...@@ -13,7 +10,6 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List;
/** /**
* @author :licc * @author :licc
...@@ -77,41 +73,49 @@ public class MobileOrderController { ...@@ -77,41 +73,49 @@ public class MobileOrderController {
} }
/** /**
* 订单回调方法 * 获取路由信息
* @param appId
* @param orderCode
* @return
*/
@RequestMapping(value = "/findRouteDetails", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject findRouteDetails(@RequestParam String appId,
@RequestParam String orderCode) {
return orderService.findRouteDetails(appId, orderCode);
}
/**
* 微信订单支付回调
* @return
*/
@RequestMapping(value = "/wechatPayCallback", method = {RequestMethod.POST, RequestMethod.GET})
public String wechatPayCallback(HttpServletRequest request) {
log.info(" wechatCallback 已触发微信付款回调!");
return orderService.wechatPayCallback(request);
}
/**
* 微信订单退款回调
* @return * @return
*/ */
@RequestMapping(value = "/wechatCallback", method = {RequestMethod.POST, RequestMethod.GET}) @RequestMapping(value = "/wechatRefundCallback", method = {RequestMethod.POST, RequestMethod.GET})
public String wechatCallback(HttpServletRequest request) { public String wechatRefundCallback(HttpServletRequest request) {
log.info(" wechatCallback 已触发微信付款回调!"); log.info(" wechatCallback 已触发微信付款回调!");
return orderService.callBackPayStatus(request); return orderService.wechatRefundCallback(request);
} }
/** /**
* 获取微信付款加密参数 * 获取微信付款加密参数
* @param orderId
* @param openId * @param openId
* @param appId * @param appId
* @param prepayId * @param prepayId
* @return * @return
*/ */
@RequestMapping(value = "/findOrderPayParams", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/findOrderPayParams", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public String findOrderPayParams(@RequestParam String orderId, public String findOrderPayParams(@RequestParam String openId,
@RequestParam String openId,
@RequestParam String appId, @RequestParam String appId,
@RequestParam String prepayId) { @RequestParam String prepayId) {
return orderService.findOrderPayParams(orderId, openId, appId, prepayId); return orderService.findOrderPayParams(openId, appId, prepayId);
}
/**
* 获取路由信息
* @param appId
* @param orderCode
* @return
*/
@RequestMapping(value = "/findRouteDetails", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject findRouteDetails(@RequestParam String appId,
@RequestParam String orderCode) {
return orderService.findRouteDetails(appId, orderCode);
} }
} }
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<artifactId>aidea-modules</artifactId> <artifactId>aidea-modules</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
<module>wechat-pay-module</module>
<module>consult-module</module> <module>consult-module</module>
<module>consult-module-web</module> <module>consult-module-web</module>
<module>product-classify-module</module> <module>product-classify-module</module>
......
...@@ -26,5 +26,4 @@ ...@@ -26,5 +26,4 @@
<finalName>prescription-module-web</finalName> <finalName>prescription-module-web</finalName>
</build> </build>
</project> </project>
\ No newline at end of file
...@@ -56,12 +56,12 @@ ...@@ -56,12 +56,12 @@
<section class="content-header"> <section class="content-header">
<h1> <h1>
处方单列表管理 处方单收费设置管理
<small>处方单列表</small> <small>处方单收费设置</small>
</h1> </h1>
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li> <li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">处方单列表</a></li> <li><a class="active">处方单收费设置</a></li>
</ol> </ol>
</section> </section>
...@@ -77,26 +77,26 @@ ...@@ -77,26 +77,26 @@
<div class="box-body"> <div class="box-body">
<div class="form-group form-md-line-input col-md-12"> <div class="form-group form-md-line-input col-md-12">
<label>是否开启支付</label> <label>是否开启支付</label>
<select name="takeType" class="form-control pull-right"> <select name="isPay" class="form-control pull-right">
<option label="关闭" value="0">关闭</option> <option label="关闭" value="0">关闭</option>
<option label="开启" value="" #if($data.isPay == '1') selected #end>开启</option> <option label="开启" value="1" #if($data.isPay == '1') selected #end>开启</option>
</select> </select>
</div> </div>
<div class="form-group form-md-line-input col-md-12"> <div class="form-group form-md-line-input col-md-12">
<label>支付类型</label> <label>支付类型</label>
<select name="takeType" class="form-control pull-right"> <select name="isThirdPhase" class="form-control pull-right">
<option label="全部" value="0">全部</option> <option label="全部" value="0">全部</option>
<option label="三期" value="1" #if($data.isPay == '1') selected #end>三期</option> <option label="三期" value="1" #if($data.isThirdPhase == '1') selected #end>三期</option>
<option label="非三期" value="1" #if($data.isPay == '2') selected #end>非三期</option> <option label="非三期" value="2" #if($data.isThirdPhase == '2') selected #end>非三期</option>
</select> </select>
</div> </div>
<div class="form-group form-md-line-input col-md-12"> <div class="form-group form-md-line-input col-md-12">
<label>支付金额</label> <label>支付金额</label>
<input name="listHtml" class="form-control" type="number" <input name="amount" class="form-control" type="number"
onkeyup="this.value=this.value.replace(/[^\d\.\d{0,2}]/g,'')" onkeyup="this.value=this.value.replace(/[^\d\.\d{0,2}]/g,'')"
value="1"/> value="${data.amount}"/>
</div> </div>
</div> </div>
...@@ -203,12 +203,10 @@ ...@@ -203,12 +203,10 @@
initFormCtrl(); initFormCtrl();
} }
return { return {
//main function to initiate the module //main function to initiate the module
init: function () { init: function () {
initForm(); initForm();
} }
}; };
}(); }();
</script> </script>
......
...@@ -60,12 +60,12 @@ ...@@ -60,12 +60,12 @@
<section class="content-header"> <section class="content-header">
<h1> <h1>
处方单列表管理 处方单收费设置管理
<small>处方单列表</small> <small>处方单收费设置列表</small>
</h1> </h1>
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i>首页</a></li> <li><a><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">处方单列表管理列表</a></li> <li><a class="active">处方单收费设置管理列表</a></li>
</ol> </ol>
</section> </section>
...@@ -78,7 +78,8 @@ ...@@ -78,7 +78,8 @@
<div class="box-header"> <div class="box-header">
<form id="seachTableForm" action="#springUrl('/a/deploy/list')" method="get"> <form id="seachTableForm" action="#springUrl('/a/deploy/list')" method="get">
<div class="col-xs-5"> <div class="col-xs-5">
<a href="#springUrl('/a/deploy/form')" class="btn btn-primary">新增</a> <span style="font-size: 18px;">温馨提示:</span><span style="color:red;font-size: 18px;">请于晚上10点之后调整对应配置</span>
<!-- <a href="#springUrl('/a/deploy/form')" class="btn btn-primary">新增</a>-->
</div> </div>
</form> </form>
</div><!-- /.box-header --> </div><!-- /.box-header -->
...@@ -91,8 +92,6 @@ ...@@ -91,8 +92,6 @@
<th>支付状态</th> <th>支付状态</th>
<th>支付人员类型</th> <th>支付人员类型</th>
<th>支付金额</th> <th>支付金额</th>
<!-- <th>是否检测</th>-->
<th>名称</th>
<th>创建时间</th> <th>创建时间</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
...@@ -200,7 +199,7 @@ ...@@ -200,7 +199,7 @@
"mData": "isThirdPhase" "mData": "isThirdPhase"
}, },
{ {
"mData": "isExamination" "mData": "amount"
}, },
{ {
"mData": "createTime" "mData": "createTime"
...@@ -220,20 +219,38 @@ ...@@ -220,20 +219,38 @@
{ {
"aTargets": [2], "aTargets": [2],
"mData": "isPay", "mData": "isPay",
"mRender": function (a, b, c, d) {
if (a == '0') {
return "关闭";
} else if (a == '1') {
return "开启";
}
return '';
}
}, },
{ {
"aTargets": [3], "aTargets": [3],
"mData": "isThirdPhase", "mData": "isThirdPhase",
"mRender": function (a, b, c, d) {
if (a == '0') {
return "全部";
} else if (a == '1') {
return "三期";
} else if (a == '2') {
return "非三期";
}
return '';
}
}, },
{ {
"aTargets": [4], "aTargets": [5],
"mData": "createTime", "mData": "createTime",
"mRender": function (a, b, c, d) { "mRender": function (a, b, c, d) {
return formatDates(a, "yyyy-MM-dd HH:mm:ss"); return formatDates(a, "yyyy-MM-dd HH:mm:ss");
} }
}, },
{ {
"aTargets": [5], "aTargets": [6],
"mData": "id", "mData": "id",
"mRender": function (a, b, c, d) { "mRender": function (a, b, c, d) {
return '<a href="#springUrl("/a/deploy/form?id=' + c.id + '")" data-id="' + c.id + '" data-action="view">修改</a>'; return '<a href="#springUrl("/a/deploy/form?id=' + c.id + '")" data-id="' + c.id + '" data-action="view">修改</a>';
......
...@@ -78,11 +78,13 @@ ...@@ -78,11 +78,13 @@
<div class="box-header"> <div class="box-header">
<form id="seachTableForm" action="#springUrl('/a/prescription/list')" method="get"> <form id="seachTableForm" action="#springUrl('/a/prescription/list')" method="get">
<div class="col-xs-5"> <div class="col-xs-5">
<div class="col-xs-2">
<input type="text" class="form-control"
name="number" placeholder="处方编码">
</div>
<button type="button" class="search btn btn-primary">搜索</button> <button type="button" class="search btn btn-primary">搜索</button>
#if($shiro.hasPermission("qy:prescription:edit")) #if($shiro.hasPermission("qy:prescription:edit"))
<a href="#springUrl('/a/prescription/form')" class="btn btn-primary">新增</a>
<!-- <a href="#springUrl('/a/prescription/exportExcel')" class="btn btn-primary">导出</a>--> <!-- <a href="#springUrl('/a/prescription/exportExcel')" class="btn btn-primary">导出</a>-->
<!-- <a onclick="importExcel();" class="btn btn-primary">导入</a>-->
#end #end
</div> </div>
</form> </form>
...@@ -94,14 +96,15 @@ ...@@ -94,14 +96,15 @@
<td hidden="true">Id</td> <td hidden="true">Id</td>
<th>处方编号</th> <th>处方编号</th>
<th>咨询单编号</th> <th>咨询单编号</th>
<th>药店编号</th>
<th>医院名称</th> <th>医院名称</th>
<th>药店名称</th> <th>药店名称</th>
<th>用户姓名</th> <th>姓名</th>
<th>用户手机号码</th> <th>手机号码</th>
<th>医生开方状态</th> <th>openId</th>
<th>本次处方开方时间</th> <th>开方状态</th>
<th>处方状态</th> <th>开方时间</th>
<th>支付编码</th>
<th>付款状态</th>
<th>付费金额</th> <th>付费金额</th>
<th>付费时间</th> <th>付费时间</th>
<th>操作</th> <th>操作</th>
...@@ -148,6 +151,8 @@ ...@@ -148,6 +151,8 @@
<!-- AdminLTE for demo purposes --> <!-- AdminLTE for demo purposes -->
<script src="common/js/cfapp.js"></script> <script src="common/js/cfapp.js"></script>
<script> <script>
var csrf = '${_csrf.token}';
var csrf_header = '${_csrf.headerName}';
function formatDates(now) { function formatDates(now) {
var now = new Date(now); var now = new Date(now);
var year = now.getFullYear(); var year = now.getFullYear();
...@@ -206,9 +211,6 @@ ...@@ -206,9 +211,6 @@
{ {
"mData": "consultNo" "mData": "consultNo"
}, },
{
"mData": "storeId"
},
{ {
"mData": "hospitalName" "mData": "hospitalName"
}, },
...@@ -221,6 +223,9 @@ ...@@ -221,6 +223,9 @@
{ {
"mData": "custPhone" "mData": "custPhone"
}, },
{
"mData": "openid"
},
{ {
"mData": "docStatus" "mData": "docStatus"
}, },
...@@ -228,13 +233,16 @@ ...@@ -228,13 +233,16 @@
"mData": "createTime" "mData": "createTime"
}, },
{ {
"mData": "status" "mData": "prepayId"
},
{
"mData": "payStatus"
}, },
{ {
"mData": "paymentPrice" "mData": "payAmount"
}, },
{ {
"mData": "paymentDate" "mData": "payTime"
}, },
{ {
"mData": "id" "mData": "id"
...@@ -253,6 +261,8 @@ ...@@ -253,6 +261,8 @@
return '未审核'; return '未审核';
} else if (a == '2') { } else if (a == '2') {
return '审核拒绝'; return '审核拒绝';
} else {
return "";
} }
} }
}, },
...@@ -261,27 +271,54 @@ ...@@ -261,27 +271,54 @@
"mData": "createTime", "mData": "createTime",
"mRender": function (a, b, c, d) { "mRender": function (a, b, c, d) {
return formatDates(a, "yyyy-MM-dd HH:mm:ss"); return formatDates(a, "yyyy-MM-dd HH:mm:ss");
}
},
{
"aTargets": [10],
"mData": "prepayId",
"mRender": function (a, b, c, d) {
if(a != null && a != '') {
return a;
} else {
return '无需支付';
}
} }
}, },
{ // set default column settings { // set default column settings
'targets': [10], 'targets': [11],
"mData": "payStatus",
"mRender": function (a, b, c, d) { "mRender": function (a, b, c, d) {
if (a == '0') { if (a == '0') {
return '未审核'; return '未支付';
} else if (a == '1') { } else if (a == '1') {
return '审核通过'; return '已支付';
} else if (a == '2') { } else if (a == '2') {
return '审核拒绝'; return '已退款'
} else {
return "";
} }
} }
}, },
{ {
"aTargets": [13], "aTargets": [13],
"mData": "payTime",
"mRender": function (a, b, c, d) {
if (a != null) {
return formatDates(a, "yyyy-MM-dd HH:mm:ss");
} else {
return "";
}
}
},
{
"aTargets": [14],
"mData": "id", "mData": "id",
"mRender": function (a, b, c, d) { "mRender": function (a, b, c, d) {
var html = ''; var html = '';
html += '<a href="#springUrl("/a/prescription/form?id=' + a + '")" class="btn green">查看</a>'; html += '<a href="#springUrl("/a/prescription/form?id=' + a + '")" class="btn green">查看</a>';
if (c.payStatus == '1' && c.description != '1') {//已支付且 单据不为待确认
html += '<a onclick="refund(`' + a + '`)" class="btn green">退款</a>';
}
return html; return html;
} }
} }
...@@ -307,21 +344,22 @@ ...@@ -307,21 +344,22 @@
Cfapp.init(); Cfapp.init();
function removeData(data) { function refund(data) {
Cfapp.confirm({ Cfapp.confirm({
message: "确定要删除吗", message: "确定要退款吗",
btnoktext: "确定", btnoktext: "确定",
btncanceltext: "取消", btncanceltext: "取消",
success: function () { success: function () {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "#springUrl('/a/prescription/delete')", url: "#springUrl('/a/prescription/refund')",
data: {id: data}, data: {id: data,_csrf: csrf,
_csrf_header: csrf_header,},
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
if (data.errorNo == 0) { if (data.errorNo == 0) {
Cfapp.alert({ Cfapp.alert({
message: "删除成功", message: "退款成功",
btntext: "确定", btntext: "确定",
success: function () { success: function () {
location.href = "#springUrl('/a/prescription/list')"; location.href = "#springUrl('/a/prescription/list')";
......
...@@ -10,4 +10,13 @@ ...@@ -10,4 +10,13 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>prescription-module</artifactId> <artifactId>prescription-module</artifactId>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>wechat-pay-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project> </project>
\ No newline at end of file
...@@ -7,6 +7,7 @@ import java.util.List; ...@@ -7,6 +7,7 @@ import java.util.List;
@Data @Data
public class FbusiDetail implements Serializable { public class FbusiDetail implements Serializable {
private String id; private String id;
private String storeId; private String storeId;
private String hospitalName; private String hospitalName;
...@@ -33,5 +34,4 @@ public class FbusiDetail implements Serializable { ...@@ -33,5 +34,4 @@ public class FbusiDetail implements Serializable {
private List<FbusiDrug> drugs; private List<FbusiDrug> drugs;
private List<FbusiDrug> drugList; private List<FbusiDrug> drugList;
} }
...@@ -6,6 +6,7 @@ import java.io.Serializable; ...@@ -6,6 +6,7 @@ import java.io.Serializable;
@Data @Data
public class FbusiDrug implements Serializable { public class FbusiDrug implements Serializable {
private String drugId; private String drugId;
private String drugName; private String drugName;
private String drugCompany; private String drugCompany;
......
...@@ -119,8 +119,7 @@ public class CdfortisServiceImpl implements CdfortisService { ...@@ -119,8 +119,7 @@ public class CdfortisServiceImpl implements CdfortisService {
urlParam.put("token", cdfortisTokenUtil.getToken()); urlParam.put("token", cdfortisTokenUtil.getToken());
urlParam.put("orderId", orderId); urlParam.put("orderId", orderId);
// 请求获取数据 // 请求获取数据
String data = CdfortisResponseUtil.request(getFbusiInfoByOrderIdUrl, CdfortisConstant.METHOD_GET, urlParam, String data = CdfortisResponseUtil.request(getFbusiInfoByOrderIdUrl, CdfortisConstant.METHOD_GET, urlParam,null, null);
null, null);
if (StringUtils.isEmpty(data)) { if (StringUtils.isEmpty(data)) {
return null; return null;
} }
......
...@@ -2,6 +2,7 @@ package com.cftech.deploy.dao; ...@@ -2,6 +2,7 @@ package com.cftech.deploy.dao;
import com.cftech.deploy.model.Deploy; import com.cftech.deploy.model.Deploy;
import com.cftech.core.generic.GenericDao; import com.cftech.core.generic.GenericDao;
import org.apache.ibatis.annotations.Param;
/** /**
* 处方单列表Mapper * 处方单列表Mapper
...@@ -11,4 +12,9 @@ import com.cftech.core.generic.GenericDao; ...@@ -11,4 +12,9 @@ import com.cftech.core.generic.GenericDao;
*/ */
public interface DeployMapper extends GenericDao<Deploy> { public interface DeployMapper extends GenericDao<Deploy> {
/**
* 是否三期患者
* @return
*/
Integer byOpenidFindEmployeeIsPhase(@Param("openid") String openid);
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<result column="name" property="name"/> <result column="name" property="name"/>
<result column="is_pay" property="isPay"/> <result column="is_pay" property="isPay"/>
<result column="is_third_phase" property="isThirdPhase"/> <result column="is_third_phase" property="isThirdPhase"/>
<result column="amount" property="amount"/>
<result column="is_examination" property="isExamination"/> <result column="is_examination" property="isExamination"/>
<result column="number" property="number"/> <result column="number" property="number"/>
<result column="accounts_id" property="accountsId"/> <result column="accounts_id" property="accountsId"/>
...@@ -52,6 +53,7 @@ ...@@ -52,6 +53,7 @@
name, name,
is_pay, is_pay,
is_third_phase, is_third_phase,
amount,
is_examination, is_examination,
number, number,
accounts_id, accounts_id,
...@@ -77,6 +79,7 @@ ...@@ -77,6 +79,7 @@
#{name, jdbcType=VARCHAR}, #{name, jdbcType=VARCHAR},
#{isPay, jdbcType=VARCHAR}, #{isPay, jdbcType=VARCHAR},
#{isThirdPhase, jdbcType=VARCHAR}, #{isThirdPhase, jdbcType=VARCHAR},
#{amount, jdbcType=DECIMAL},
#{isExamination, jdbcType=VARCHAR}, #{isExamination, jdbcType=VARCHAR},
#{number, jdbcType=VARCHAR}, #{number, jdbcType=VARCHAR},
#{accountsId, jdbcType=BIGINT}, #{accountsId, jdbcType=BIGINT},
...@@ -100,7 +103,6 @@ ...@@ -100,7 +103,6 @@
<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 t_aidea_platform_config SELECT COUNT(1) FROM t_aidea_platform_config
<include refid="sqlWhere"/> <include refid="sqlWhere"/>
</select> </select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap"> <select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
...@@ -127,6 +129,9 @@ ...@@ -127,6 +129,9 @@
<if test="isThirdPhase != null"> <if test="isThirdPhase != null">
is_third_phase = #{isThirdPhase, jdbcType=VARCHAR}, is_third_phase = #{isThirdPhase, jdbcType=VARCHAR},
</if> </if>
<if test="amount != null">
amount = #{amount, jdbcType=DECIMAL},
</if>
<if test="isExamination != null"> <if test="isExamination != null">
is_examination = #{isExamination, jdbcType=VARCHAR}, is_examination = #{isExamination, jdbcType=VARCHAR},
</if> </if>
...@@ -163,4 +168,9 @@ ...@@ -163,4 +168,9 @@
set del_flag=1 set del_flag=1
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="byOpenidFindEmployeeIsPhase" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT COUNT(1) FROM wx_mp_member
WHERE status = '1' AND del_flag = '0' AND open_id = #{openid, jdbcType=VARCHAR}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.cftech.core.poi.ExportConfig; ...@@ -4,6 +4,7 @@ import com.cftech.core.poi.ExportConfig;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
...@@ -17,35 +18,65 @@ public class Deploy implements Serializable { ...@@ -17,35 +18,65 @@ public class Deploy implements Serializable {
/* 主键id */ /* 主键id */
private Long id; private Long id;
/* 名称 */ /* 名称 */
@ExportConfig(value = "名称", width = 100, showLevel = 1) @ExportConfig(value = "名称", width = 100, showLevel = 1)
private String name; private String name;
/* 是否支付 */
@ExportConfig(value = "是否支付", width = 100, showLevel = 1) /**
* 是否开启支付
* 0:关闭; 1:开启
*/
@ExportConfig(value = "是否开启支付", width = 100, showLevel = 1)
private String isPay; private String isPay;
/* 是否三期 */
@ExportConfig(value = "是否三期", width = 100, showLevel = 1)
/**
* 患者类型
* 0:全部; 1:三期; 2:非三期
*/
@ExportConfig(value = "患者类型", width = 100, showLevel = 1)
private String isThirdPhase; private String isThirdPhase;
/**
* 付款金额
*/
@ExportConfig(value = "付款金额", width = 100, showLevel = 1)
private BigDecimal amount;
/* 是否检测 */ /* 是否检测 */
@ExportConfig(value = "是否检测", width = 100, showLevel = 1) @ExportConfig(value = "是否检测", width = 100, showLevel = 1)
private String isExamination; private String isExamination;
/* 编码 */ /* 编码 */
@ExportConfig(value = "编码", width = 100, showLevel = 1) @ExportConfig(value = "编码", width = 100, showLevel = 1)
private String number; private String number;
/* 所属的账号 */ /* 所属的账号 */
private Long accountsId; private Long accountsId;
/* 删除标识 */ /* 删除标识 */
private boolean delFlag; private boolean delFlag;
/* 状态 */ /* 状态 */
private String status; private String status;
/* 创建时间 */ /* 创建时间 */
private Date createTime; private Date createTime;
/* 更新时间 */ /* 更新时间 */
private Date updateTime; private Date updateTime;
/* 备注 */ /* 备注 */
private String description; private String description;
/* 创建人 */ /* 创建人 */
private Long createBy; private Long createBy;
/* 更新人 */ /* 更新人 */
private Long updateBy; private Long updateBy;
......
...@@ -18,5 +18,18 @@ public interface DeployService extends GenericService<Deploy> { ...@@ -18,5 +18,18 @@ public interface DeployService extends GenericService<Deploy> {
* @param openId * @param openId
* @return * @return
*/ */
JSONObject findDeloyEntity(String appId, String openId); JSONObject findDeployEntity(String appId, String openId);
/**
* 获取系统配置实体
* @return
*/
Deploy findEntity();
/**
* 查询是否三期客户
* @param openid
* @return
*/
boolean byOpenidFindEmployeeIsPhase(String openid);
} }
...@@ -31,12 +31,12 @@ public class DeployServiceImpl extends GenericServiceImpl<Deploy> implements Dep ...@@ -31,12 +31,12 @@ public class DeployServiceImpl extends GenericServiceImpl<Deploy> implements Dep
} }
@Override @Override
public JSONObject findDeloyEntity(String appId, String openId) { public JSONObject findDeployEntity(String appId, String openId) {
JSONObject retObj = new JSONObject(); JSONObject retObj = new JSONObject();
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("del_flag", Constants.DEL_FLAG_0); conds.equal("del_flag", Constants.DEL_FLAG_0);
Deploy deploy = this.fetchSearchByConds(conds); Deploy deploy = this.fetchSearchByConds(conds);
if (deploy == null) { if (deploy != null) {
retObj.put("errorNo", 0); retObj.put("errorNo", 0);
retObj.put("data", deploy); retObj.put("data", deploy);
} else { } else {
...@@ -45,4 +45,19 @@ public class DeployServiceImpl extends GenericServiceImpl<Deploy> implements Dep ...@@ -45,4 +45,19 @@ public class DeployServiceImpl extends GenericServiceImpl<Deploy> implements Dep
} }
return retObj; return retObj;
} }
@Override
public Deploy findEntity() {
Conds conds = new Conds();
conds.equal("del_flag", Constants.DEL_FLAG_0);
Deploy deploy = this.fetchSearchByConds(conds);
return deploy;
}
@Override
public boolean byOpenidFindEmployeeIsPhase(String openid) {
Integer integer = deployMapper.byOpenidFindEmployeeIsPhase(openid);
return integer.intValue() > 0;
}
} }
\ No newline at end of file
...@@ -20,9 +20,9 @@ public class MobileDeployController { ...@@ -20,9 +20,9 @@ public class MobileDeployController {
* @param openId * @param openId
* @return * @return
*/ */
@RequestMapping(value = "findDeloyEntity", method = { RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "findDeployEntity", method = { RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject findDeloyEntity(@RequestParam String appId, public JSONObject findDeployEntity(@RequestParam String appId,
@RequestParam String openId) { @RequestParam String openId) {
return deployService.findDeloyEntity(appId, openId); return deployService.findDeployEntity(appId, openId);
} }
} }
...@@ -33,6 +33,19 @@ ...@@ -33,6 +33,19 @@
<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="openid" property="openid"/> <result column="openid" property="openid"/>
<result column="prepay_id" property="prepayId"/>
<result column="trade_no" property="tradeNo"/>
<result column="pay_status" property="payStatus"/>
<result column="pay_amount" property="payAmount"/>
<result column="cash_fee" property="cashFee"/>
<result column="pay_time" property="payTime"/>
<result column="pay_remark" property="payRemark"/>
<result column="consultNo" property="consultNo"/>
<result column="refund_id" property="refundId"/>
<result column="refund_no" property="refundNo"/>
<result column="refund_case_fee" property="refundCaseFee"/>
<result column="refund_time" property="refundTime"/>
<result column="refund_remark" property="refundRemark"/>
</resultMap> </resultMap>
<sql id="sqlWhere"> <sql id="sqlWhere">
...@@ -92,7 +105,19 @@ ...@@ -92,7 +105,19 @@
description, description,
create_by, create_by,
update_by, update_by,
openid openid,
prepay_id,
trade_no,
pay_status,
pay_amount,
cash_fee,
pay_time,
pay_remark,
refund_id,
refund_no,
refund_case_fee,
refund_time,
refund_remark
</sql> </sql>
<sql id="listColumns"> <sql id="listColumns">
...@@ -125,12 +150,23 @@ ...@@ -125,12 +150,23 @@
t.description, t.description,
t.create_by, t.create_by,
t.update_by, t.update_by,
t.openid t.openid,
t.prepay_id,
t.trade_no,
t.pay_status,
t.pay_amount,
t.cash_fee,
t.pay_time,
t.pay_remark,
t.refund_id,
t.refund_no,
t.refund_case_fee,
t.refund_time,
t.refund_remark
</sql> </sql>
<insert id="save" parameterType="com.cftech.prescription.model.Prescription" useGeneratedKeys="true" <insert id="save" parameterType="com.cftech.prescription.model.Prescription" useGeneratedKeys="true" keyProperty="id">
keyProperty="id">
insert into t_aidea_prescription insert into t_aidea_prescription
( (
<include refid="sqlColumns"/> <include refid="sqlColumns"/>
...@@ -166,13 +202,25 @@ ...@@ -166,13 +202,25 @@
#{description, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT}, #{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}, #{updateBy, jdbcType=BIGINT},
#{openid, jdbcType=VARCHAR} #{openid, jdbcType=VARCHAR},
#{prepayId, jdbcType=VARCHAR},
#{tradeNo, jdbcType=VARCHAR},
#{payStatus, jdbcType=VARCHAR},
#{payAmount, jdbcType=DECIMAL},
#{cashFee, jdbcType=DECIMAL},
#{payTime, jdbcType=TIMESTAMP},
#{payRemark, jdbcType=VARCHAR},
#{refundId, jdbcType=VARCHAR},
#{refundNo, jdbcType=VARCHAR},
#{refundCaseFee, jdbcType=DECIMAL},
#{refundTime, jdbcType=TIMESTAMP},
#{refundRemark, jdbcType=VARCHAR}
) )
</insert> </insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap"> <select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT SELECT
<include refid="sqlColumns"/> <include refid="listColumns"/>
FROM t_aidea_prescription t FROM t_aidea_prescription t
WHERE t.id=#{id} WHERE t.id=#{id}
</select> </select>
...@@ -185,8 +233,9 @@ ...@@ -185,8 +233,9 @@
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap"> <select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT SELECT
<include refid="listColumns"/> <include refid="listColumns"/>, c.consult_id consultNo
FROM t_aidea_prescription t FROM t_aidea_prescription t
LEFT JOIN t_aidea_consult_sheet c ON t.id = c.pre_id AND c.del_flag = '0'
<include refid="sqlWhere"/> <include refid="sqlWhere"/>
<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>
...@@ -282,6 +331,42 @@ ...@@ -282,6 +331,42 @@
<if test="openid != null"> <if test="openid != null">
openid = #{openid, jdbcType=BIGINT}, openid = #{openid, jdbcType=BIGINT},
</if> </if>
<if test="prepayId != null">
prepay_Id = #{prepayId, jdbcType=VARCHAR},
</if>
<if test="tradeNo != null">
trade_no = #{tradeNo, jdbcType=VARCHAR},
</if>
<if test="payStatus != null">
pay_status = #{payStatus, jdbcType=VARCHAR},
</if>
<if test="payAmount != null">
pay_amount = #{payAmount, jdbcType=DECIMAL},
</if>
<if test="cashFee != null">
cash_fee = #{cashFee, jdbcType=DECIMAL},
</if>
<if test="payTime != null">
pay_time = #{payTime, jdbcType=TIMESTAMP},
</if>
<if test="payRemark != null">
pay_remark = #{payRemark, jdbcType=VARCHAR},
</if>
<if test="refundId != null">
refund_id = #{refundId, jdbcType=VARCHAR},
</if>
<if test="refundNo != null">
refund_no = #{refundNo, jdbcType=VARCHAR},
</if>
<if test="refundCaseFee != null">
refund_case_fee = #{refundCaseFee, jdbcType=DECIMAL},
</if>
<if test="refundTime != null">
refund_time = #{refundTime, jdbcType=TIMESTAMP},
</if>
<if test="refundRemark != null">
refund_remark = #{refundRemark, jdbcType=VARCHAR},
</if>
</set> </set>
where id=#{id,jdbcType=BIGINT} where id=#{id,jdbcType=BIGINT}
</update> </update>
...@@ -384,7 +469,43 @@ ...@@ -384,7 +469,43 @@
<if test="openid != null"> <if test="openid != null">
openid = #{openid, jdbcType=BIGINT}, openid = #{openid, jdbcType=BIGINT},
</if> </if>
<if test="prepayId != null">
prepay_Id = #{prepayId, jdbcType=VARCHAR},
</if>
<if test="tradeNo != null">
trade_no = #{tradeNo, jdbcType=VARCHAR},
</if>
<if test="payStatus != null">
pay_status = #{payStatus, jdbcType=VARCHAR},
</if>
<if test="payAmount != null">
pay_amount = #{payAmount, jdbcType=DECIMAL},
</if>
<if test="cashFee != null">
cash_fee = #{cashFee, jdbcType=DECIMAL},
</if>
<if test="payTime != null">
pay_time = #{payTime, jdbcType=TIMESTAMP},
</if>
<if test="payRemark != null">
pay_remark = #{payRemark, jdbcType=VARCHAR},
</if>
<if test="refundId != null">
refund_id = #{refundId, jdbcType=VARCHAR},
</if>
<if test="refundNo != null">
refund_no = #{refundNo, jdbcType=VARCHAR},
</if>
<if test="refundCaseFee != null">
refund_case_fee = #{refundCaseFee, jdbcType=DECIMAL},
</if>
<if test="refundTime != null">
refund_time = #{refundTime, jdbcType=TIMESTAMP},
</if>
<if test="refundRemark != null">
refund_remark = #{refundRemark, jdbcType=VARCHAR},
</if>
</set> </set>
where number = #{number,jdbcType=VARCHAR} WHERE number = #{number,jdbcType=VARCHAR}
</update> </update>
</mapper> </mapper>
\ No newline at end of file
package com.cftech.prescription.job;
import com.cftech.accounts.model.SysJob;
import com.cftech.accounts.service.JobService;
import com.cftech.core.sql.Conds;
import com.cftech.core.util.Constants;
import com.cftech.core.util.SpringContextHolder;
import com.cftech.core.util.SystemConfig;
import com.cftech.prescription.model.Prescription;
import com.cftech.prescription.service.PrescriptionService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.text.SimpleDateFormat;
import java.util.List;
@Slf4j
public class SynPrescriptBillJob implements Job {
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
boolean isCluster = Boolean.valueOf(SystemConfig.p.getProperty("quartz.isCluster"));
if (!isCluster) {
return;
}
executePrescript();
//获得明细数据
JobDataMap jobInfo = context.getJobDetail().getJobDataMap();
String id = jobInfo.get("uid") == null ? "" : jobInfo.getString("uid");//这个也是ID主键
log.info("任务ID:" + id);
//执行更新操作
if (context.getNextFireTime() != null) {
log.info("同步更新处方单任务:下次执行时间=====" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(context.getNextFireTime()) + "==============");
} else {
JobService jobService = SpringContextHolder.getBean(JobService.class);
SysJob sysJob = new SysJob();
sysJob.setJobuid(id);
sysJob.setStatus("0");
jobService.updateStatus(sysJob);
log.info("同步更新处方单任务,已执行完成!");
}
}
private void executePrescript() {
try {
PrescriptionService prescriptionService = SpringContextHolder.getBean(PrescriptionService.class);
Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.description", "1");//提交状态 为返回
//conds.equal("DATE_FORMAT(t.create_time ,'%Y-%m-%d')", DateUtils.getDate());//获取当天
List<Prescription> prescriptionList = prescriptionService.fetchSearchByPage(conds, null, 0, 0);
for (Prescription prescript: prescriptionList) {
prescriptionService.findPreScriptionByOrderId(prescript.getNumber());
}
} catch (Exception e) {
log.error("同步更新处方单任务执行失败,{}" + e.getMessage());
e.printStackTrace();
}
}
}
package com.cftech.prescription.job;
import com.alibaba.fastjson.JSONObject;
import com.cftech.accounts.model.MpAccountsEntity;
import com.cftech.accounts.model.SysJob;
import com.cftech.accounts.service.JobService;
import com.cftech.accounts.service.MpAccountsService;
import com.cftech.base.codingrule.utils.CodingruleUtils;
import com.cftech.core.sql.Conds;
import com.cftech.core.util.Constants;
import com.cftech.core.util.SpringContextHolder;
import com.cftech.core.util.SystemConfig;
import com.cftech.prescription.model.Prescription;
import com.cftech.prescription.service.PrescriptionService;
import com.cftech.wechat.pay.WechatPay;
import com.cftech.wechat.pay.WechatPayUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Slf4j
public class SynPrescriptRefundJob implements Job {
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
boolean isCluster = Boolean.valueOf(SystemConfig.p.getProperty("quartz.isCluster"));
if (!isCluster) {
return;
}
executeRefund();
//获得明细数据
JobDataMap jobInfo = context.getJobDetail().getJobDataMap();
String id = jobInfo.get("uid") == null ? "" : jobInfo.getString("uid");//这个也是ID主键
log.info("任务ID:" + id);
//执行更新操作
if (context.getNextFireTime() != null) {
log.info("同步更新处方单任务:下次执行时间=====" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(context.getNextFireTime()) + "==============");
} else {
JobService jobService = SpringContextHolder.getBean(JobService.class);
SysJob sysJob = new SysJob();
sysJob.setJobuid(id);
sysJob.setStatus("0");
jobService.updateStatus(sysJob);
log.info("同步更新处方单任务,已执行完成!");
}
}
private void executeRefund() {
PrescriptionService prescriptionService = SpringContextHolder.getBean(PrescriptionService.class);
MpAccountsService accountsService = SpringContextHolder.getBean(MpAccountsService.class);
CodingruleUtils codingruleUtils = SpringContextHolder.getBean(CodingruleUtils.class);
Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.pay_status", "1");//已支付
conds.in("t.description", new String[]{"0", "2"});//0: 临时状态 2:返回状态
MpAccountsEntity accountsEntity = accountsService.getMpAccountsAppid(SystemConfig.p.getProperty("WX_MP_SERVER_APPID"));
List<Prescription> prescriptionList = prescriptionService.fetchSearchByPage(conds, null, 0, 0);
for (Prescription prescript: prescriptionList) {
if (StringUtils.equals(prescript.getDocStatus(), "0")) {//单据已审核通过
continue;
}
String refundNumber = codingruleUtils.getNumber(accountsEntity.getId(), WechatPay.class.getName());
JSONObject result = WechatPayUtils.generateRefund(prescript.getNumber(), refundNumber, prescript.getCashFee(), null);
if (result != null && result.containsKey("refund_id")) {
prescript.setPayStatus("2");//已退款
prescript.setRefundId(result.getString("refund_id"));
prescript.setRefundNo(result.getString("out_refund_no"));
prescript.setRefundCaseFee(result.getBigDecimal("refund_fee"));
prescript.setRefundTime(new Date());
prescript.setRefundRemark(result.toString());
prescriptionService.update(prescript);
}
}
}
}
...@@ -99,18 +99,82 @@ public class Prescription implements Serializable { ...@@ -99,18 +99,82 @@ public class Prescription implements Serializable {
private Long createBy; private Long createBy;
/* 更新人 */ /* 更新人 */
private Long updateBy; private Long updateBy;
/**
* 付款字段
*/
/* 微信订单id */
private String prepayId;
/* 交易单号 */
private String tradeNo;
/* 支付状态 */
private String payStatus;
/* 付款金额 */
private BigDecimal payAmount;
/* 付款金额现金部分 */
private BigDecimal cashFee;
/* 付款时间 */
private Date payTime;
/* 付款回调描述 */
private String payRemark;
private String refundId;
private String refundNo;
private BigDecimal refundCaseFee;
private Date refundTime;
private String refundRemark;
/** /**
* 展示字段 * 展示字段
*/ */
private String consultNo; private String consultNo;
private BigDecimal paymentPrice;
private String paymentDate;
public Prescription() { public Prescription() {
this.delFlag = false; this.delFlag = false;
this.status = "0"; this.status = "0";
} }
@Override
public String toString() {
return "Prescription{" +
"id=" + id +
", number='" + number + '\'' +
", openid='" + openid + '\'' +
", minProgramNo='" + minProgramNo + '\'' +
", storeId='" + storeId + '\'' +
", hospitalName='" + hospitalName + '\'' +
", storeName='" + storeName + '\'' +
", custName='" + custName + '\'' +
", weight='" + weight + '\'' +
", custSex='" + custSex + '\'' +
", custPhone='" + custPhone + '\'' +
", symptom='" + symptom + '\'' +
", syptmFlag='" + syptmFlag + '\'' +
", doctorName='" + doctorName + '\'' +
", doctorDpmtName='" + doctorDpmtName + '\'' +
", docStatus='" + docStatus + '\'' +
", docResult='" + docResult + '\'' +
", pharmName='" + pharmName + '\'' +
", pharmStatus='" + pharmStatus + '\'' +
", result='" + result + '\'' +
", guoms='" + guoms + '\'' +
", age='" + age + '\'' +
", presUrl='" + presUrl + '\'' +
", accountsId=" + accountsId +
", delFlag=" + delFlag +
", status='" + status + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
", description='" + description + '\'' +
", createBy=" + createBy +
", updateBy=" + updateBy +
", prepayId='" + prepayId + '\'' +
", tradeNo='" + tradeNo + '\'' +
", payStatus='" + payStatus + '\'' +
", payAmount=" + payAmount +
", payTime=" + payTime +
", payRemark='" + payRemark + '\'' +
", consultNo='" + consultNo + '\'' +
'}';
}
} }
\ No newline at end of file
...@@ -74,4 +74,11 @@ public interface PrescriptionService extends GenericService<Prescription> { ...@@ -74,4 +74,11 @@ public interface PrescriptionService extends GenericService<Prescription> {
* @throws Exception * @throws Exception
*/ */
Prescription findPreScriptionByOrderId(String orderId) throws Exception; Prescription findPreScriptionByOrderId(String orderId) throws Exception;
/**
* 退款
* @param id
* @return
*/
boolean refund(String id);
} }
...@@ -12,6 +12,8 @@ import com.cftech.core.sql.Sort; ...@@ -12,6 +12,8 @@ import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants; import com.cftech.core.util.Constants;
import com.cftech.core.util.DateUtils; import com.cftech.core.util.DateUtils;
import com.cftech.core.util.SystemConfig; import com.cftech.core.util.SystemConfig;
import com.cftech.deploy.model.Deploy;
import com.cftech.deploy.service.DeployService;
import com.cftech.predrugs.model.PreDrugs; import com.cftech.predrugs.model.PreDrugs;
import com.cftech.predrugs.service.PreDrugsService; import com.cftech.predrugs.service.PreDrugsService;
import com.cftech.prescription.model.Prescription; import com.cftech.prescription.model.Prescription;
...@@ -20,7 +22,10 @@ import com.cftech.prescription.service.PrescriptionService; ...@@ -20,7 +22,10 @@ import com.cftech.prescription.service.PrescriptionService;
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.sql.Conds; import com.cftech.core.sql.Conds;
import com.cftech.wechat.pay.WechatPay;
import com.cftech.wechat.pay.WechatPayUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -28,8 +33,8 @@ import org.springframework.beans.factory.annotation.Qualifier;; ...@@ -28,8 +33,8 @@ import org.springframework.beans.factory.annotation.Qualifier;;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import org.springframework.util.StringUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -60,11 +65,38 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -60,11 +65,38 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
@Autowired @Autowired
PreDrugsService preDrugsService; PreDrugsService preDrugsService;
@Autowired
DeployService deployService;
@Override @Override
public GenericDao<Prescription> getGenericMapper() { public GenericDao<Prescription> getGenericMapper() {
return prescriptionMapper; return prescriptionMapper;
} }
@Override
public boolean refund(String id) {
try {
MpAccountsEntity accountsEntity = accountsService.getMpAccountsAppid(SystemConfig.p.getProperty("WX_MP_SERVER_APPID"));
String refundNumber = codingruleUtils.getNumber(accountsEntity.getId(), WechatPay.class.getName());
Prescription prescription = this.fetchById(id);
JSONObject result = WechatPayUtils.generateRefund(prescription.getNumber(), refundNumber, prescription.getCashFee(), null);
if (result != null && result.containsKey("refund_id")) {
prescription.setPayStatus("2");//已退款
prescription.setRefundId(result.getString("refund_id"));
prescription.setRefundNo(result.getString("out_refund_no"));
prescription.setRefundCaseFee(result.getBigDecimal("refund_fee"));
prescription.setRefundTime(new Date());
prescription.setRefundRemark(result.toString());
this.update(prescription);
return true;
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
return false;
}
@Override @Override
public JSONObject generatePre(String appId, String openId) { public JSONObject generatePre(String appId, String openId) {
JSONObject retObj = new JSONObject(); JSONObject retObj = new JSONObject();
...@@ -76,7 +108,7 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -76,7 +108,7 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
//获取当前用户当天开取的处方单 //获取当前用户当天开取的处方单
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("t.description", 0);//临时 conds.equal("t.description", 0);//临时处方
conds.equal("DATE_FORMAT(t.create_time ,'%Y-%m-%d')", DateUtils.getDate()); conds.equal("DATE_FORMAT(t.create_time ,'%Y-%m-%d')", DateUtils.getDate());
conds.equal("t.openid", openId); conds.equal("t.openid", openId);
Prescription prescription = this.fetchSearchByConds(conds); Prescription prescription = this.fetchSearchByConds(conds);
...@@ -86,6 +118,7 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -86,6 +118,7 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
data.put("productNo", params.get("productNumber")); data.put("productNo", params.get("productNumber"));
data.put("unit", params.get("unit")); data.put("unit", params.get("unit"));
data.put("storeNo", storeNo); data.put("storeNo", storeNo);
data.put("prepayId", prescription.getPrepayId());
retObj.put("errorNo", 0); retObj.put("errorNo", 0);
retObj.put("data", data); retObj.put("data", data);
...@@ -100,6 +133,18 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -100,6 +133,18 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
prescription.setDescription("0"); prescription.setDescription("0");
if (this.save(prescription)) { if (this.save(prescription)) {
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
log.info("处方单申请订单号:prescription={}" + prescription.toString());
JSONObject result = generatePrescriptPayBill(prescription);
if (result != null && result.containsKey("prepay_id")) {
prescription.setPrepayId(result.getString("prepay_id"));
this.update(prescription);
data.put("prepayId", result.getString("prepay_id"));
} else {
data.put("prepayId", null);
}
data.put("prescriptionNo", number); data.put("prescriptionNo", number);
data.put("productNo", params.get("productNumber")); data.put("productNo", params.get("productNumber"));
data.put("unit", params.get("unit")); data.put("unit", params.get("unit"));
...@@ -112,13 +157,38 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -112,13 +157,38 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
} }
} catch (Exception e) { } catch (Exception e) {
retObj.put("errorNo", 1); retObj.put("errorNo", 1);
retObj.put("errorMsg", "生成处方单接口失败"); retObj.put("errorMsg", "生成处方单接口失败!");
log.error("生成处方单接口失败:{}", e.getMessage()); log.error("生成处方单接口失败:{}", e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
return retObj; return retObj;
} }
/**
* 是否生成支付单据
* @param prescription
*/
private JSONObject generatePrescriptPayBill(Prescription prescription) {
JSONObject jsonObject = null;
//是否付款实体
Deploy deploy = deployService.findEntity();
//支付 ispay==1 开启支付
if (deploy != null && StringUtils.equals(deploy.getIsPay(), "1") && deploy.getAmount().compareTo(new BigDecimal(0)) == 1) {
if (StringUtils.equals(deploy.getIsThirdPhase(), "0")) {//全部人员支付
jsonObject = WechatPayUtils.generatePay(prescription.getOpenid(), prescription.getNumber(), deploy.getAmount());
} else {
//获取人员是否为三期客户
boolean result = deployService.byOpenidFindEmployeeIsPhase(prescription.getOpenid());
if (result && StringUtils.equals(deploy.getIsThirdPhase(), "1")) {//三期客户支付
jsonObject = WechatPayUtils.generatePay(prescription.getOpenid(), prescription.getNumber(), deploy.getAmount());
} else if (!result && StringUtils.equals(deploy.getIsThirdPhase(), "2")) {//非三期客户支付
jsonObject = WechatPayUtils.generatePay(prescription.getOpenid(), prescription.getNumber(), deploy.getAmount());
}
}
}
return jsonObject;
}
@Override @Override
public JSONObject updatePrescription(String appId, String openId, String number) { public JSONObject updatePrescription(String appId, String openId, String number) {
JSONObject retObj = new JSONObject(); JSONObject retObj = new JSONObject();
...@@ -167,9 +237,14 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -167,9 +237,14 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
retObj.put("data", prescription); retObj.put("data", prescription);
} else { } else {
prescription = this.findPreScriptionByOrderId(prescription.getNumber()); prescription = this.findPreScriptionByOrderId(prescription.getNumber());
if (prescription == null) {
retObj.put("errorNo", 1);
retObj.put("errorMsg", "暂无单据");
} else {
retObj.put("errorNo", 0); retObj.put("errorNo", 0);
retObj.put("data", prescription); retObj.put("data", prescription);
} }
}
} catch (Exception e) { } catch (Exception e) {
retObj.put("errorNo", 1); retObj.put("errorNo", 1);
e.printStackTrace(); e.printStackTrace();
...@@ -267,11 +342,14 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -267,11 +342,14 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
return handlePrescription(fbusiDetail, orderId); return handlePrescription(fbusiDetail, orderId);
} }
//@NotNull
@NotNull
private Prescription handlePrescription(FbusiDetail fbusiDetail, String number) throws Exception { private Prescription handlePrescription(FbusiDetail fbusiDetail, String number) throws Exception {
if (fbusiDetail == null) { if (fbusiDetail == null) {
throw new Exception("找不到对应的处方数据(暂无数据)"); Prescription prescription = new Prescription();
prescription.setNumber(number);//通过编码更新
prescription.setDescription("2");//已返回
prescriptionMapper.updateByNumber(prescription);
return null;
} }
//更新 //更新
Prescription prescription = new Prescription(); Prescription prescription = new Prescription();
......
...@@ -8,14 +8,13 @@ import com.cftech.core.scope.OrderType; ...@@ -8,14 +8,13 @@ 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.Constants;
import com.cftech.sys.security.PermissionSign;
import com.cftech.sys.security.UserUtils; import com.cftech.sys.security.UserUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -104,7 +103,10 @@ public class PrescriptionController { ...@@ -104,7 +103,10 @@ public class PrescriptionController {
Long accountsId = UserUtils.getmpaccounts(request); Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0); conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.description", "2"); conds.in("t.description", new String[] {"1", "2"});//1、提交状态 2、返回状态
if (StringUtils.isNotBlank(prescription.getNumber())) {
conds.like("t.number", prescription.getNumber());
}
Sort sort = new Sort("t.create_time", OrderType.DESC); Sort sort = new Sort("t.create_time", OrderType.DESC);
List<Prescription> list = prescriptionService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength); List<Prescription> list = prescriptionService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
...@@ -131,6 +133,24 @@ public class PrescriptionController { ...@@ -131,6 +133,24 @@ public class PrescriptionController {
return rtnJosn; return rtnJosn;
} }
//删除数据
@RequiresPermissions(value = PRESCRIPTION_EDIT)
@RequestMapping("/refund")
@ResponseBody
public JSONObject refund(String id) {
JSONObject rtnJosn = new JSONObject();
try {
if (prescriptionService.refund(id)) {
rtnJosn.put("errorNo", 0);
} else {
rtnJosn.put("errorNo", 1);
}
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel") @RequestMapping("/exportExcel")
@RequiresPermissions(value = PRESCRIPTION_VIEW) @RequiresPermissions(value = PRESCRIPTION_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response) { public void exportExcel(HttpServletRequest request, HttpServletResponse response) {
......
...@@ -18,17 +18,17 @@ ...@@ -18,17 +18,17 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.cftech</groupId> <groupId>com.cftech</groupId>
<artifactId>product-classify-module</artifactId> <artifactId>product-detail-module</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.cftech</groupId> <groupId>com.cftech</groupId>
<artifactId>product-into-wareroom-module</artifactId> <artifactId>product-classify-module</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.cftech</groupId> <groupId>com.cftech</groupId>
<artifactId>product-detail-module</artifactId> <artifactId>product-into-wareroom-module</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
...@@ -39,5 +39,4 @@ ...@@ -39,5 +39,4 @@
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -51,10 +51,10 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P ...@@ -51,10 +51,10 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P
private ProductMapper productMapper; private ProductMapper productMapper;
@Autowired @Autowired
private ProductIntoWareroomMapper productIntoWareroomMapper; private ProductDetailMapper productDetailMapper;
@Autowired @Autowired
private ProductDetailMapper productDetailMapper; private ProductIntoWareroomMapper productIntoWareroomMapper;
@Autowired @Autowired
private CodingruleUtils codingruleUtils; private CodingruleUtils codingruleUtils;
...@@ -143,7 +143,6 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P ...@@ -143,7 +143,6 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P
System.out.println(Product.class.getName()); System.out.println(Product.class.getName());
// 2、 生成入库单 // 2、 生成入库单
ProductIntoWareroom productIntoWareroom = new ProductIntoWareroom(); ProductIntoWareroom productIntoWareroom = new ProductIntoWareroom();
productIntoWareroom.setAccountsId(product.getAccountsId()); productIntoWareroom.setAccountsId(product.getAccountsId());
...@@ -175,8 +174,6 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P ...@@ -175,8 +174,6 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P
productDetailMapper.save(productDetail); productDetailMapper.save(productDetail);
} }
} }
return true; return true;
} }
......
...@@ -151,19 +151,16 @@ ...@@ -151,19 +151,16 @@
<th style="width: 50px">大区</th> <th style="width: 50px">大区</th>
<th style="width: 50px">省份</th> <th style="width: 50px">省份</th>
<th style="width: 50px">城市</th> <th style="width: 50px">城市</th>
<th style="width: 65px">医院</th> <th style="width: 65px">扫码医院</th>
<th style="width: 60px">销售代表</th> <th style="width: 60px">销售代表</th>
<th style="width: 50px">科室</th> <th style="width: 65px">入组医院</th>
<th style="width: 60px">医生姓名</th>
<th style="width: 60px">医生职称</th>
<th style="width: 50px">性别</th>
<th style="width: 80px">医生手机号</th>
<th style="width: 60px">处方医院</th> <th style="width: 60px">处方医院</th>
<th style="width: 60px">处方医生</th> <th style="width: 60px">处方医生</th>
<th style="width: 80px">咨询单编码</th> <th style="width: 80px">咨询单编码</th>
<th style="width: 120px">需求清单编码</th> <th style="width: 120px">需求清单编码</th>
<th style="width: 60px">用户姓名</th> <th style="width: 60px">用户姓名</th>
<th style="width: 80px">用户手机号</th> <th style="width: 80px">用户手机号</th>
<th style="width: 80px">患者类型</th>
<th style="width: 60px">产品名称</th> <th style="width: 60px">产品名称</th>
<th style="width: 60px">购买数量</th> <th style="width: 60px">购买数量</th>
<th style="width: 60px">付款时间</th> <th style="width: 60px">付款时间</th>
...@@ -285,18 +282,6 @@ ...@@ -285,18 +282,6 @@
{ {
"mData": "department" "mData": "department"
}, },
{
"mData": "doctorName"
},
{
"mData": "doctorTitle"
},
{
"mData": "sex"
},
{
"mData": "doctorPhone"
},
{ {
"mData": "cfHospital" "mData": "cfHospital"
}, },
...@@ -315,6 +300,9 @@ ...@@ -315,6 +300,9 @@
{ {
"mData": "phone" "mData": "phone"
}, },
{
"mData": "isThree"
},
{ {
"mData": "productName" "mData": "productName"
}, },
...@@ -337,7 +325,7 @@ ...@@ -337,7 +325,7 @@
}, },
{ {
"aTargets": [19], "aTargets": [16],
"mData": "fkTime", "mData": "fkTime",
"mRender": function (a, b, c, d) { "mRender": function (a, b, c, d) {
if (a == '' || a == null) { if (a == '' || a == null) {
...@@ -348,7 +336,7 @@ ...@@ -348,7 +336,7 @@
} }
}, },
{ {
"aTargets": [20], "aTargets": [17],
"mData": "fhTime", "mData": "fhTime",
"mRender": function (a, b, c, d) { "mRender": function (a, b, c, d) {
if (a == '' || a == null) { if (a == '' || a == null) {
...@@ -359,7 +347,7 @@ ...@@ -359,7 +347,7 @@
} }
}, },
{ {
"aTargets": [21], "aTargets": [18],
"mData": "sjTime", "mData": "sjTime",
"mRender": function (a, b, c, d) { "mRender": function (a, b, c, d) {
if (a == '' || a == null) { if (a == '' || a == null) {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<result column="order_number" property="orderNumber"/> <result column="order_number" property="orderNumber"/>
<result column="user_name" property="userName"/> <result column="user_name" property="userName"/>
<result column="phone" property="phone"/> <result column="phone" property="phone"/>
<result column="is_three" property="isThree"/>
<result column="product_name" property="productName"/> <result column="product_name" property="productName"/>
<result column="drugs_num" property="drugsNum"/> <result column="drugs_num" property="drugsNum"/>
<result column="fk_time" property="fkTime"/> <result column="fk_time" property="fkTime"/>
...@@ -49,6 +50,8 @@ ...@@ -49,6 +50,8 @@
<result column="fhTime" property="fhTime"/> <result column="fhTime" property="fhTime"/>
<result column="sjTime" property="sjTime"/> <result column="sjTime" property="sjTime"/>
<result column="openId" property="openId"/> <result column="openId" property="openId"/>
<result column="department" property="department"/>
<result column="isThree" property="isThree"/>
</resultMap> </resultMap>
<resultMap id="resultMapCodeInfo" type="com.cftech.report.model.ReportCode"> <resultMap id="resultMapCodeInfo" type="com.cftech.report.model.ReportCode">
...@@ -114,6 +117,7 @@ ...@@ -114,6 +117,7 @@
order_number, order_number,
user_name, user_name,
phone, phone,
is_three,
product_name, product_name,
drugs_num, drugs_num,
fk_time, fk_time,
...@@ -155,6 +159,7 @@ ...@@ -155,6 +159,7 @@
#{orderNumber, jdbcType=VARCHAR}, #{orderNumber, jdbcType=VARCHAR},
#{userName, jdbcType=VARCHAR}, #{userName, jdbcType=VARCHAR},
#{phone, jdbcType=VARCHAR}, #{phone, jdbcType=VARCHAR},
#{isThree, jdbcType=VARCHAR},
#{productName, jdbcType=VARCHAR}, #{productName, jdbcType=VARCHAR},
#{drugsNum, jdbcType=VARCHAR}, #{drugsNum, jdbcType=VARCHAR},
#{fkTime , jdbcType=TIMESTAMP}, #{fkTime , jdbcType=TIMESTAMP},
...@@ -247,6 +252,9 @@ ...@@ -247,6 +252,9 @@
<if test="phone != null"> <if test="phone != null">
phone = #{phone, jdbcType=VARCHAR}, phone = #{phone, jdbcType=VARCHAR},
</if> </if>
<if test="isThree != null">
is_three = #{isThree, jdbcType=VARCHAR},
</if>
<if test="productName != null"> <if test="productName != null">
product_name = #{productName, jdbcType=VARCHAR}, product_name = #{productName, jdbcType=VARCHAR},
</if> </if>
...@@ -292,7 +300,7 @@ ...@@ -292,7 +300,7 @@
</update> </update>
<!--查询报表人员信息--> <!--查询报表人员信息-->
<select id="selectReportPeopleInfo" resultMap="resultMapPeopleInfo" parameterType="java.util.Map"> <select id="selectReportPeopleInfo" parameterType="java.util.Map" resultMap="resultMapPeopleInfo">
SELECT SELECT
product.common_name productName, product.common_name productName,
detail.drugs_num drugsNum, detail.drugs_num drugsNum,
...@@ -305,15 +313,17 @@ ...@@ -305,15 +313,17 @@
ord.pay_time fkTime, ord.pay_time fkTime,
waybill.send_express_date fhTime, waybill.send_express_date fhTime,
waybill.accept_express_date sjTime, waybill.accept_express_date sjTime,
ord.openid openId ord.openid openId,
org.org_name department,
memb.status isThree
FROM FROM
t_order_details detail t_order_details detail
LEFT JOIN t_aidea_product product ON product.id = detail.drugs_id AND product.del_flag = 0 LEFT JOIN t_aidea_product product ON product.id = detail.drugs_id AND product.del_flag = 0
LEFT JOIN t_order ord ON ord.id = detail.order_id LEFT JOIN t_order ord ON ord.id = detail.order_id
LEFT JOIN t_aidea_consult_sheet consult ON consult.order_id = ord.id LEFT JOIN t_aidea_consult_sheet consult ON consult.order_id = ord.id
LEFT JOIN t_qyuser qyuser ON qyuser.id = consult.past_records LEFT JOIN t_aidea_waybill waybill ON waybill.order_id = ord.id
LEFT JOIN t_orgunit org1 ON org1.id = consult.allergy LEFT JOIN wx_mp_member memb ON memb.open_id = consult.open_id AND memb.del_flag = 0
LEFT JOIN t_aidea_waybill waybill ON waybill.order_id = org1.id LEFT JOIN t_orgunit org ON memb.storeid = org.id AND org.del_flag = 0 AND org.is_three_phase = 1
<include refid="sqlWhere"/> <include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if> <if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
</select> </select>
......
...@@ -45,8 +45,7 @@ public class ReportJob implements Job { ...@@ -45,8 +45,7 @@ public class ReportJob implements Job {
private static String REGION_LONG_ID = SystemConfig.p.getProperty("REGION_LONG_ID"); private static String REGION_LONG_ID = SystemConfig.p.getProperty("REGION_LONG_ID");
@Override @Override
public void execute(JobExecutionContext context) throws JobExecutionException { public void execute(JobExecutionContext context) throws JobExecutionException {boolean isCluster = Boolean.valueOf(SystemConfig.p.getProperty("quartz.isCluster"));
boolean isCluster = Boolean.valueOf(SystemConfig.p.getProperty("quartz.isCluster"));
if (!isCluster) { if (!isCluster) {
return; return;
} }
...@@ -79,6 +78,8 @@ public class ReportJob implements Job { ...@@ -79,6 +78,8 @@ public class ReportJob implements Job {
report.setConsultNumber(reportPeopleInfo.getConsultNumber()); report.setConsultNumber(reportPeopleInfo.getConsultNumber());
report.setUserName(reportPeopleInfo.getUserName()); report.setUserName(reportPeopleInfo.getUserName());
report.setPhone(reportPeopleInfo.getPhone()); report.setPhone(reportPeopleInfo.getPhone());
report.setDepartment(reportPeopleInfo.getDepartment());
report.setIsThree(StringUtils.equals(reportPeopleInfo.getIsThree(), "1") ? "三期":"");
report.setCfDoctor(reportPeopleInfo.getCfDoctor()); report.setCfDoctor(reportPeopleInfo.getCfDoctor());
report.setCfHospital(reportPeopleInfo.getCfHospital()); report.setCfHospital(reportPeopleInfo.getCfHospital());
report.setFkTime(reportPeopleInfo.getFkTime()); report.setFkTime(reportPeopleInfo.getFkTime());
...@@ -178,9 +179,9 @@ public class ReportJob implements Job { ...@@ -178,9 +179,9 @@ public class ReportJob implements Job {
report.setSalesRepresent(sb.toString()); report.setSalesRepresent(sb.toString());
} }
break; break;
case 8://科室 // case 8://科室
report.setDepartment(item.getOrgName()); // report.setDepartment(item.getOrgName());
break; // break;
} }
}); });
} }
......
...@@ -26,27 +26,15 @@ public class Report implements Serializable { ...@@ -26,27 +26,15 @@ public class Report implements Serializable {
/* 城市 */ /* 城市 */
@ExportConfig(value = "城市", width = 100, showLevel = 1) @ExportConfig(value = "城市", width = 100, showLevel = 1)
private String city; private String city;
/* 医院 */
@ExportConfig(value = "扫码医院", width = 100, showLevel = 1)
private String hospital;
/* 销售代表 */ /* 销售代表 */
@ExportConfig(value = "销售代表", width = 100, showLevel = 1) @ExportConfig(value = "销售代表", width = 100, showLevel = 1)
private String salesRepresent; private String salesRepresent;
/* 医院 */
@ExportConfig(value = "医院", width = 100, showLevel = 1)
private String hospital;
/* 科室 */ /* 科室 */
@ExportConfig(value = "科室", width = 100, showLevel = 1) @ExportConfig(value = "入组医院", width = 100, showLevel = 1)
private String department; private String department;
/* 医生姓名 */
@ExportConfig(value = "医生姓名", width = 100, showLevel = 1)
private String doctorName;
/* 医生职称 */
@ExportConfig(value = "医生职称", width = 100, showLevel = 1)
private String doctorTitle;
/* 性别 */
@ExportConfig(value = "性别", width = 100, showLevel = 1)
private String sex;
/* 医生手机号码 */
@ExportConfig(value = "医生手机号码", width = 100, showLevel = 1)
private String doctorPhone;
/* 处方医院 */ /* 处方医院 */
@ExportConfig(value = "处方医院", width = 100, showLevel = 1) @ExportConfig(value = "处方医院", width = 100, showLevel = 1)
private String cfHospital; private String cfHospital;
...@@ -66,6 +54,9 @@ public class Report implements Serializable { ...@@ -66,6 +54,9 @@ public class Report implements Serializable {
@ExportConfig(value = "用户手机号码", width = 100, showLevel = 1) @ExportConfig(value = "用户手机号码", width = 100, showLevel = 1)
private String phone; private String phone;
/* 产品名称 */ /* 产品名称 */
@ExportConfig(value = "患者类型", width = 100, showLevel = 1)
private String isThree;
/* 产品名称 */
@ExportConfig(value = "产品名称", width = 100, showLevel = 1) @ExportConfig(value = "产品名称", width = 100, showLevel = 1)
private String productName; private String productName;
/* 购买数量 */ /* 购买数量 */
...@@ -80,6 +71,7 @@ public class Report implements Serializable { ...@@ -80,6 +71,7 @@ public class Report implements Serializable {
/* 收件时间 */ /* 收件时间 */
@ExportConfig(value = "收件时间", width = 100, showLevel = 1, dateFormat = "yyyy-MM-dd HH:mm") @ExportConfig(value = "收件时间", width = 100, showLevel = 1, dateFormat = "yyyy-MM-dd HH:mm")
private Date sjTime; private Date sjTime;
/* 所属的账号 */ /* 所属的账号 */
private Long accountsId; private Long accountsId;
/* 删除标识 */ /* 删除标识 */
...@@ -101,6 +93,16 @@ public class Report implements Serializable { ...@@ -101,6 +93,16 @@ public class Report implements Serializable {
*/ */
private String openId; private String openId;
/* 医生姓名 */
private String doctorName;
/* 医生职称 */
private String doctorTitle;
/* 性别 */
private String sex;
/* 医生手机号码 */
private String doctorPhone;
public Report() { public Report() {
this.delFlag = false; this.delFlag = false;
this.status = "0"; this.status = "0";
......
...@@ -60,4 +60,14 @@ public class ReportPeopleInfo { ...@@ -60,4 +60,14 @@ public class ReportPeopleInfo {
*/ */
private String openId; private String openId;
/**
* 入组医院
*/
private String department;
/**
* 1:三期患者 反之不是
*/
private String isThree;
} }
...@@ -105,7 +105,7 @@ public class ReportController { ...@@ -105,7 +105,7 @@ public class ReportController {
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("del_flag", Constants.DEL_FLAG_0); conds.equal("del_flag", Constants.DEL_FLAG_0);
//conds.equal("accounts_id", accountsId); //conds.equal("accounts_id", accountsId);
Sort sort = new Sort("create_time", OrderType.DESC); Sort sort = new Sort("order_number", OrderType.DESC);
if(!StringUtils.isEmpty(report.getRegion())){ if(!StringUtils.isEmpty(report.getRegion())){
conds.like("region",report.getRegion()); conds.like("region",report.getRegion());
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wechat-pay-module</artifactId>
</project>
\ No newline at end of file
package com.cftech.order.pay; package com.cftech.wechat.pay;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.SecureRandom; import java.security.SecureRandom;
......
package com.cftech.order.pay; package com.cftech.wechat.pay;
import java.security.MessageDigest; import java.security.MessageDigest;
......
package com.cftech.order.pay; package com.cftech.wechat.pay;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.core.util.StringUtils; import com.cftech.core.util.StringUtils;
import com.cftech.core.util.SystemConfig; import com.cftech.core.util.SystemConfig;
import com.cftech.order.model.Order;
import com.cftech.order.service.OrderService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.StringEntity; import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.DocumentException; import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper; import org.dom4j.DocumentHelper;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.io.SAXReader; import org.dom4j.io.SAXReader;
import org.mp.api.core.common.util.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import javax.net.ssl.SSLContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal;
import java.security.*;
import java.security.cert.CertificateException;
import java.util.*; import java.util.*;
/** /**
...@@ -36,17 +42,144 @@ public class WechatPayUtils { ...@@ -36,17 +42,144 @@ public class WechatPayUtils {
public static String retFailXml = "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[SYSTEMERROR]]></return_msg></xml>"; public static String retFailXml = "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[SYSTEMERROR]]></return_msg></xml>";
@Autowired public static String WECHAT_PAY_URL = SystemConfig.p.getProperty("mch.pay_url");
private MessageUtil messageUtil;
public static String WECHAT_REFUND_URL = SystemConfig.p.getProperty("msh.refund_url");
public static String CERT_PATH = SystemConfig.p.getProperty("mch.cert_path");
@Autowired public static String CERT_SECERT = SystemConfig.p.getProperty("mch.mch_id");
private OrderService orderService;
/**
* 生成微信支付订单
* @param openid
* @param number
* @param amount
* @return
*/
public static JSONObject generatePay(String openid, String number, BigDecimal amount) {
SortedMap<String, String> params = generateMap(openid, number, amount);
String sign = getSign(params, true);
params.put("sign", sign);
String xmlObj = parseXML(params);
log.info("商户号支付请求参数 :" + xmlObj + "===========end");
try {
String result = sendPost(HttpClients.createDefault(), WECHAT_PAY_URL, xmlObj);
log.info("商户号支付订单 :" + result + "===========end");
return xmlToStr(result);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
/**
* 生成微信退款订单
* @param number
* @param refundNumber
* @param amount
* @param refundDesc
* @return
*/
public static JSONObject generateRefund(String number, String refundNumber, BigDecimal amount, String refundDesc) {
SortedMap<String, String> params = generateRefundMap(number, refundNumber, amount, refundDesc);
String sign = getSign(params, true);
params.put("sign", sign);
String xmlObj = parseXML(params);
log.info("商户号退款请求参数 :" + xmlObj + "===========end");
try {
String result = sendSSLPost(WECHAT_REFUND_URL, xmlObj);
log.info("商户号退款订单 :" + result + "===========end");
return xmlToRefundStr(result);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private static String sendSSLPost(String refundUrl, String xmlObj) {
String result = null;
CloseableHttpClient httpClient = null;
HttpPost httpPost = null;
CloseableHttpResponse response = null;
try {
// 拼接证书的路径
KeyStore keyStore = KeyStore.getInstance("PKCS12");
// 加载本地的证书进行https加密传输
FileInputStream in = null;
try{
in = new FileInputStream(new File(CERT_PATH));
keyStore.load(in, CERT_SECERT.toCharArray()); // 加载证书密码,默认为商户ID
} catch (CertificateException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} finally {
in.close();
}
// Trust own CA and all self-signed certs
SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, CERT_SECERT.toCharArray()).build();
// Allow TLSv1 protocol only
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, new String[] {"TLSv1"},
null, SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
httpClient = HttpClients.custom().setSSLSocketFactory(sslsf).build();
// 根据默认超时限制初始化requestConfig
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(10000).setConnectTimeout(30000).build();
httpPost = new HttpPost(refundUrl);
// 得指明使用UTF-8编码,否则到API服务器XML的中文不能被成功识别
StringEntity postEntity = new StringEntity(xmlObj, "UTF-8");
httpPost.addHeader("Content-Type", "text/xml");
httpPost.setEntity(postEntity);
httpPost.setConfig(requestConfig);
// 设置请求器的配置
log.info(xmlObj);
response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
result = EntityUtils.toString(entity, "UTF-8");
} catch (KeyStoreException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
e.printStackTrace();
} catch (UnrecoverableKeyException e) {
e.printStackTrace();
} finally {
if (response != null) {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (httpPost != null) {
httpPost.abort();
}
if (httpClient != null) {
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return result;
}
/** /**
* 生成随机数 * 生成随机数
* @return * @return
*/ */
private static String generateRandomNumber() { public static String generateRandomNumber() {
return UUID.randomUUID().toString().replace("-", ""); return UUID.randomUUID().toString().replace("-", "");
} }
...@@ -82,56 +215,63 @@ public class WechatPayUtils { ...@@ -82,56 +215,63 @@ public class WechatPayUtils {
} }
/** /**
* 封装参数且排序 * 付款参数封装、排序
* @param order * @param openid 微信人员标识
* @param randomStr * @param number 数量
* @param amount 金额
* @return * @return
*/ */
public static SortedMap<String, String> generateOrderMap(Order order, String randomStr) { public static SortedMap<String, String> generateMap(String openid, String number, BigDecimal amount) {
BigDecimal total = amount.multiply(new BigDecimal(100)).setScale(0);//计算成分为单位,不保留小数
SortedMap<String, String> params = new TreeMap<>(); SortedMap<String, String> params = new TreeMap<>();
params.put("appid", SystemConfig.p.getProperty("WX_MP_SERVER_APPID")); params.put("appid", SystemConfig.p.getProperty("WX_MP_SERVER_APPID"));
params.put("mch_id", SystemConfig.p.getProperty("mch.mch_id")); params.put("mch_id", SystemConfig.p.getProperty("mch.mch_id"));
params.put("nonce_str", randomStr); params.put("nonce_str", generateRandomNumber());
params.put("body", SystemConfig.p.getProperty("mch.title")); params.put("body", SystemConfig.p.getProperty("mch.title"));
params.put("out_trade_no", order.getNumber()); params.put("out_trade_no", number);
Double total = order.getOrderAmount() * 100; params.put("total_fee", String.valueOf(total));
params.put("total_fee", String.valueOf(total.intValue()));
params.put("spbill_create_ip", SystemConfig.p.getProperty("mch.spbill_id")); params.put("spbill_create_ip", SystemConfig.p.getProperty("mch.spbill_id"));
params.put("notify_url", SystemConfig.p.getProperty("mch.notify_url")); params.put("notify_url", SystemConfig.p.getProperty("mch.notify_url"));
params.put("trade_type", "JSAPI"); params.put("trade_type", "JSAPI");
params.put("openid", order.getOpenid()); params.put("openid", openid);
return params; return params;
} }
public static JSONObject genenatePay(Order order) { /**
String randomStr = generateRandomNumber(); * 退款参数封装、排序
SortedMap<String, String> params = generateOrderMap(order, randomStr); * @param number 订单编码
* @param refundNumber 退款编码
String sign = getSign(params, true); * @param amount 金额
params.put("sign", sign); * @param refundDesc 退款备注
String xmlObj = parseXML(params); * @return
*/
log.info("商户号请求参数="+xmlObj + "===========end"); public static SortedMap<String, String> generateRefundMap(String number, String refundNumber, BigDecimal amount, String refundDesc) {
try { SortedMap<String, String> params = new TreeMap<>();
String result = sendPost(HttpClients.createDefault(), "https://api.mch.weixin.qq.com/pay/unifiedorder", xmlObj); params.put("appid", SystemConfig.p.getProperty("WX_MP_SERVER_APPID"));
log.info("商户号订单:" + result + "===========end"); params.put("mch_id", SystemConfig.p.getProperty("mch.mch_id"));
return xmlToStr(result); params.put("nonce_str", generateRandomNumber());
} catch (IOException e) { params.put("out_trade_no", number);
e.printStackTrace(); params.put("out_refund_no", refundNumber);
params.put("total_fee", String.valueOf(amount.setScale(0)));
params.put("refund_fee", String.valueOf(amount.setScale(0)));
if (StringUtils.isBlank(refundDesc)) {
params.put("refund_desc", refundDesc);
} }
return null; params.put("notify_url", SystemConfig.p.getProperty("mch.refund_notify_url"));
return params;
} }
public static String sendPost(CloseableHttpClient httpclient, String url, String xmlObj) throws IOException { public static String sendPost(CloseableHttpClient httpClient, String url, String xmlObj) throws IOException {
String result; String result;
HttpPost httpPost = new HttpPost(url); HttpPost httpPost = new HttpPost(url);
// 得指明使用UTF-8编码,否则到API服务器XML的中文不能被成功识别 // 得指明使用UTF-8编码,否则到API服务器XML的中文不能被成功识别
StringEntity postEntity = new StringEntity(xmlObj, "UTF-8"); StringEntity postEntity = new StringEntity(xmlObj, "UTF-8");
httpPost.addHeader("Content-Type", "text/xml"); httpPost.addHeader("Content-Type", "text/xml");
httpPost.setEntity(postEntity); httpPost.setEntity(postEntity);
// 设置请求器的配置
log.info(xmlObj); log.info(xmlObj);
try { try {
CloseableHttpResponse response = httpclient.execute(httpPost); CloseableHttpResponse response = httpClient.execute(httpPost);
try { try {
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
result = EntityUtils.toString(entity, "UTF-8"); result = EntityUtils.toString(entity, "UTF-8");
...@@ -139,28 +279,11 @@ public class WechatPayUtils { ...@@ -139,28 +279,11 @@ public class WechatPayUtils {
response.close(); response.close();
} }
} finally { } finally {
httpclient.close(); httpClient.close();
} }
return result; return result;
} }
public static String parseXML(Map<String, String> parameters) {
StringBuffer sb = new StringBuffer();
sb.append("<xml>");
Set es = parameters.entrySet();
Iterator it = es.iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
String k = (String) entry.getKey();
String v = (String) entry.getValue();
if (null != v && !"".equals(v) && !"appkey".equals(k)) {
sb.append("<" + k + ">" + parameters.get(k) + "</" + k + ">\n");
}
}
sb.append("</xml>");
return sb.toString();
}
public static JSONObject xmlToStr(String str) { public static JSONObject xmlToStr(String str) {
JSONObject retObj = new JSONObject(); JSONObject retObj = new JSONObject();
try { try {
...@@ -183,12 +306,52 @@ public class WechatPayUtils { ...@@ -183,12 +306,52 @@ public class WechatPayUtils {
return null; return null;
} }
public static JSONObject xmlToRefundStr(String str) {
JSONObject retObj = new JSONObject();
try {
Document doc = DocumentHelper.parseText(str);
Element rootElt = doc.getRootElement();
String result_code = rootElt.elementTextTrim("result_code");
String return_code = rootElt.elementTextTrim("return_code");
if (StringUtils.equals(result_code, "SUCCESS") && StringUtils.equals(return_code, "SUCCESS")) {
String refund_id = rootElt.elementTextTrim("refund_id");
String out_refund_no = rootElt.elementTextTrim("out_refund_no");
String refund_fee = rootElt.elementTextTrim("refund_fee");
retObj.put("refund_id", refund_id);
retObj.put("out_refund_no", out_refund_no);
retObj.put("refund_fee", refund_fee);
return retObj;
}
} catch (DocumentException e) {
e.printStackTrace();
}
return null;
}
public static String parseXML(Map<String, String> parameters) {
StringBuffer sb = new StringBuffer();
sb.append("<xml>");
Set es = parameters.entrySet();
Iterator it = es.iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
String k = (String) entry.getKey();
String v = (String) entry.getValue();
if (null != v && !"".equals(v) && !"appkey".equals(k)) {
sb.append("<" + k + ">" + parameters.get(k) + "</" + k + ">\n");
}
}
sb.append("</xml>");
return sb.toString();
}
public static TreeMap<String, String> parseXml(HttpServletRequest request) throws Exception { public static TreeMap<String, String> parseXml(HttpServletRequest request) throws Exception {
//将解析结果存储在HashMap中 //将解析结果存储在HashMap中
TreeMap<String, String> map = new TreeMap<>(); TreeMap<String, String> map = new TreeMap<>();
// 从request中取得输入流 // 从request中取得输入流
InputStream inputStream = request.getInputStream(); InputStream inputStream = request.getInputStream();
System.out.println(inputStream.toString());
// 读取输入流 // 读取输入流
SAXReader reader = new SAXReader(); SAXReader reader = new SAXReader();
Document document = reader.read(inputStream); Document document = reader.read(inputStream);
......
package com.cftech.wechat.pay;
import lombok.extern.slf4j.Slf4j;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.Security;
import java.util.Base64;
/**
* 暂时废弃
*/
@Slf4j
public class WechatRefundDescryptUtils {
private static final String ALGORITHM = "AES";
/**
* 加解密算法/工作模式/填充方式
*/
private static final String ALGORITHM_MODE_PADDING = "AES/ECB/PKCS7Padding";
// public static String decryptData(String base64Data, String lowMad5Key) throws Exception {
// SecretKeySpec key = new SecretKeySpec(lowMad5Key.getBytes(), ALGORITHM);
// Security.addProvider(new BouncyCastleProvider());
// Cipher cipher = Cipher.getInstance(ALGORITHM_MODE_PADDING);
// cipher.init(Cipher.DECRYPT_MODE, key);
// Base64.Decoder decoder = Base64.getDecoder();
// String newData = new String(decoder.decode(base64Data), "ISO-8859-1");
// return new String(cipher.doFinal(newData.getBytes("ISO-8859-1")), "utf-8");
// }
//
// public static String MD5(String data) throws Exception {
// MessageDigest md = MessageDigest.getInstance("MD5");
// byte[] array = md.digest(data.getBytes("UTF-8"));
// StringBuilder sb = new StringBuilder();
// byte[] var4 = array;
// int var5 = array.length;
// for (int var6 = 0; var6 < var5; ++var6) {
// byte item = var4[var6];
// sb.append(Integer.toHexString(item & 255 | 256).substring(1, 3));
// }
// return sb.toString().toUpperCase();
// }
/**
* req_info解密后的示例:
* <root>
* <out_refund_no><![CDATA[131811191610442717309]]></out_refund_no>
* <out_trade_no><![CDATA[71106718111915575302817]]></out_trade_no>
* <refund_account><![CDATA[REFUND_SOURCE_RECHARGE_FUNDS]]></refund_account>
* <refund_fee><![CDATA[3960]]></refund_fee>
* <refund_id><![CDATA[50000408942018111907145868882]]></refund_id>
* <refund_recv_accout><![CDATA[支付用户零钱]]></refund_recv_accout>
* <refund_request_source><![CDATA[API]]></refund_request_source>
* <refund_status><![CDATA[SUCCESS]]></refund_status>
* <settlement_refund_fee><![CDATA[3960]]></settlement_refund_fee>
* <settlement_total_fee><![CDATA[3960]]></settlement_total_fee>
* <success_time><![CDATA[2018-11-19 16:24:13]]></success_time>
* <total_fee><![CDATA[3960]]></total_fee>
* <transaction_id><![CDATA[4200000215201811190261405420]]></transaction_id>
* </root>
* @param args
* @throws Exception
*
* Base64.Decoder decoder = Base64.getDecoder();
* String newData = new String(decoder.decode(base64Data), "ISO-8859-1");
* return new String(cipher.doFinal(newData.getBytes("ISO-8859-1")), "utf-8")
* ————————————————
* 版权声明:本文为CSDN博主「sugarit」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
* 原文链接:https://blog.csdn.net/Charles_lxx/article/details/105427815
*/
//示例:不可以直接用,已经把KEY值修改,需要根据实际进行操作
public static void main(String[] args) throws Exception {
String reqInfo = "cbRfjwOKrLQCOjAU0v1Ac6cDJQhK6349ngVplZHLe010obV59BJ75z05eUzG+Um3Zk9WxNO6jtk60bBDkMLmf4dZk41wSbyx/GiNNcRp3g0GdUMjGjhlyJgMAKiLbmVwcPEQnOoikcCbwGd0VmOdWcTk67kDlE4ssYW6pgBXp5bSBVotuar2Wxi0z20HGgsz7dcIVELP9+JfGwuiVV9xkhO8sPbEO4SIO2qhkRQ0QzbDYgn9gU1Iprzv6wGxFh+Bm/lJWuiBGwhFCT2fq1xEF1nDPEyW3LOWq4daCegXpvTXoXLZp9Xp6zcdxiDCsLgj8yj+q7ZNmVNt1vTUR94ZQAI1UAtCqK+1dI89DZdbifU7o0fVm/9WQqjcOIo4WemUJU7WfCsyHXBVvx8lZezoQc5ZGZOqTEZJCVKV6OF5iqvlNnZJ1byPg7BfHZnmbIjdETFMIOkq3oPicshnNlVZ9g08DvesDZzG/KJzI8NBMFfXNMjSJyuemsZ/0jFJRtKDOWoCQetWox+mORa5BPrMwvibTLkPZL0okvnyrJgFwGtE4BFTdnN/+cfuUISXMTbeZv6UjRJwD9y8B+wi4wTSUC1QXjlZEkV+RgBNnJD/n13NWUK1nlrwev/RHLsgjoMSYnF0mYec8g1BCyW0POcp4iEDaRVMrjQnACyyeMncSxA+KawdoFEOqMuAITv3B0Q9iZOTpI7yqnpquWiphXMuKovJgLp4vnPqerMMthTeaQ/rfVVO/U6Z4K/heTZKT2Y0y7kQP2GS+r/N5Qvu+J0sihJ8opoZ0AJ7ktwGrzcmkIq/DCCtAfgdAT8x3rtSXA4f8pb7WqFssdGRqgzMZR1jlcz3LD5+Du+BWK5QmyCeynywd9b6s7oYdyU0aI75LrT5EBOtEHAMGi2rmwb1X2wlEd3g4gCr2l1EEA4dUTdhsqynG0w64VHWJkvJgTOdmzMPWYksLu463qcy6dN44WuNBG0aw7uEQQIUXeRhDEwCBQVmzXNLzwQ6wHv6O9j7yvkvZll3SuGw7bbsfdSdAfQkJkLCj/MHuEKUauiV0mQS/2M=";
String mchkey = "4bcd5546d65f4d88bf1ba549436e0e9f";
//String ab = decryptData(a, MD5("4bcd5546d65f4d88bf1ba549436e0e9f").toLowerCase());
String result = "";
Base64.Decoder decoder = Base64.getDecoder();
byte[] base64ByteArr = decoder.decode(reqInfo);
String key = getMD5(mchkey).toLowerCase();
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(), "AES");
//Security.addProvider(new BouncyCastleProvider());
try {
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding");
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
result = new String(cipher.doFinal(base64ByteArr));
System.out.println("解密结果:{}" + result);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
}
Document doc = DocumentHelper.parseText(result);
Element rootElt = doc.getRootElement();
String result_code = rootElt.elementTextTrim("out_trade_no");
String return_code = rootElt.elementTextTrim("out_refund_no");
System.out.println(result);
System.out.println(result_code + "=====" + return_code);
}
public static String getMD5(String str) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
String result = MD5(str, md);
return result;
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return "";
}
}
public static String MD5(String strSrc, MessageDigest md) {
byte[] bt = strSrc.getBytes();
md.update(bt);
String strDes = bytes2Hex(md.digest());
return strDes;
}
public static String bytes2Hex(byte[] bts) {
StringBuffer des = new StringBuffer();
String tmp = null;
for (int i = 0; i < bts.length; i++) {
tmp = (Integer.toHexString(bts[i] & 0xFF));
if (tmp.length() == 1) {
des.append("0");
}
des.append(tmp);
}
return des.toString();
}
}
...@@ -80,13 +80,13 @@ LOG_URL=http://www.michang-tech.com.cn:6989/log/addlog ...@@ -80,13 +80,13 @@ LOG_URL=http://www.michang-tech.com.cn:6989/log/addlog
#\u6821\u9A8C\u5151\u6362\u5BC6\u7801KEY #\u6821\u9A8C\u5151\u6362\u5BC6\u7801KEY
MEMBER_PASSWORD_KEY=DONGCHANGINT9527; MEMBER_PASSWORD_KEY=DONGCHANGINT9527;
list.refreshtoken=true list.refreshtoken=true
jwt.domain=localhost jwt.domain=pd.shxrtech.com
#\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD #\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD
jwt.duration=86400000 jwt.duration=86400000
#\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u03AAtrue #\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u03AAtrue
security.secure=false security.secure=false
#\u662F\u5426\u96C6\u7FA4 master\u4E3Atrue #\u662F\u5426\u96C6\u7FA4 master\u4E3Atrue
quartz.isCluster=false quartz.isCluster=true
#\u987A\u4E30\u7269\u6D41\u914D\u7F6E\u4FE1\u606F\u53C2\u6570 #\u987A\u4E30\u7269\u6D41\u914D\u7F6E\u4FE1\u606F\u53C2\u6570
#\u987A\u4E30\u5BA2\u6237\u7F16\u7801 #\u987A\u4E30\u5BA2\u6237\u7F16\u7801
...@@ -128,8 +128,18 @@ mch.mch_id=1604243615 ...@@ -128,8 +128,18 @@ mch.mch_id=1604243615
mch.spbill_id=47.103.35.182 mch.spbill_id=47.103.35.182
#\u5546\u6237\u53F7\u5BC6\u94A5 #\u5546\u6237\u53F7\u5BC6\u94A5
mch.secret_key=4bcd5546d65f4d88bf1ba549436e0e9f mch.secret_key=4bcd5546d65f4d88bf1ba549436e0e9f
#\u5546\u6237\u53F7\u652F\u4ED8\u63A5\u53E3
mch.pay_url=https://api.mch.weixin.qq.com/pay/unifiedorder
#\u5546\u6237\u53F7\u9000\u6B3E\u63A5\u53E3
msh.refund_url=https://api.mch.weixin.qq.com/secapi/pay/refund
#\u5546\u6237\u53F7\u4ED8\u6B3E\u6210\u529F\u56DE\u8C03url #\u5546\u6237\u53F7\u4ED8\u6B3E\u6210\u529F\u56DE\u8C03url
mch.notify_url=https://pd.shxrtech.com/aidea/mobile/auth/order/wechatCallback mch.notify_url=https://pd.shxrtech.com/aidea/mobile/auth/order/wechatPayCallback
#\u5546\u6237\u53F7\u9000\u6B3E\u6210\u529F\u56DE\u8C03url
mch.refund_notify_url=https://pd.shxrtech.com/aidea/mobile/auth/order/wechatRefundCallback
#\u8BC1\u4E66\u5E8F\u5217\u53F7
mch.queue_no=4CB908135B122F41E127F6B60E41349E43A725C7
#\u8BC1\u4E66\u8DEF\u5F84
mch.cert_path=/mydata/wechatSdk/apiclient_cert.p12
#\u4ED8\u6B3E\u754C\u9762\u6807\u9898 #\u4ED8\u6B3E\u754C\u9762\u6807\u9898
mch.title=\u8BFA\u5EB7\u5927\u836F\u623F\u54A8\u8BE2\u5E73\u53F0 mch.title=\u8BFA\u5EB7\u5927\u836F\u623F\u54A8\u8BE2\u5E73\u53F0
......
...@@ -129,8 +129,18 @@ mch.mch_id=1604243615 ...@@ -129,8 +129,18 @@ mch.mch_id=1604243615
mch.spbill_id=58.220.99.125 mch.spbill_id=58.220.99.125
#\u5546\u6237\u53F7\u5BC6\u94A5 #\u5546\u6237\u53F7\u5BC6\u94A5
mch.secret_key=4bcd5546d65f4d88bf1ba549436e0e9f mch.secret_key=4bcd5546d65f4d88bf1ba549436e0e9f
#\u5546\u6237\u53F7\u652F\u4ED8\u63A5\u53E3
mch.pay_url=https://api.mch.weixin.qq.com/pay/unifiedorder
#\u5546\u6237\u53F7\u9000\u6B3E\u63A5\u53E3
msh.refund_url=https://api.mch.weixin.qq.com/secapi/pay/refund
#\u5546\u6237\u53F7\u4ED8\u6B3E\u6210\u529F\u56DE\u8C03url #\u5546\u6237\u53F7\u4ED8\u6B3E\u6210\u529F\u56DE\u8C03url
mch.notify_url=https://pe.aidea.com.cn/aidea/mobile/auth/order/wechatCallback mch.notify_url=https://pd.shxrtech.com/aidea/mobile/auth/order/wechatPayCallback
#\u5546\u6237\u53F7\u9000\u6B3E\u6210\u529F\u56DE\u8C03url
mch.refund_notify_url=https://pd.shxrtech.com/aidea/mobile/auth/order/wechatRefundCallback
#\u8BC1\u4E66\u5E8F\u5217\u53F7
mch.queue_no=4CB908135B122F41E127F6B60E41349E43A725C7
#\u8BC1\u4E66\u8DEF\u5F84
mch.cert_path=/mydata/wechatSdk/apiclient_cert.p12
#\u4ED8\u6B3E\u754C\u9762\u6807\u9898 #\u4ED8\u6B3E\u754C\u9762\u6807\u9898
mch.title=\u8BFA\u5EB7\u5927\u836F\u623F\u54A8\u8BE2\u5E73\u53F0 mch.title=\u8BFA\u5EB7\u5927\u836F\u623F\u54A8\u8BE2\u5E73\u53F0
......
...@@ -41,6 +41,7 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -41,6 +41,7 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
private CfarticleMapper cfarticleMapper; private CfarticleMapper cfarticleMapper;
@Autowired @Autowired
private MpAccountsService mpAccountsService; private MpAccountsService mpAccountsService;
@Override @Override
public GenericDao<Cfarticle> getGenericMapper() { public GenericDao<Cfarticle> getGenericMapper() {
return cfarticleMapper; return cfarticleMapper;
...@@ -91,9 +92,9 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -91,9 +92,9 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
long recommended = jsonObject.getLong("recommended"); long recommended = jsonObject.getLong("recommended");
long whetherBanner = jsonObject.getLong("whetherBanner"); long whetherBanner = jsonObject.getLong("whetherBanner");
long article = jsonObject.getLong("article"); long article = jsonObject.getLong("article");
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String updateTime = format.format(new Date()); String updateTime = format.format(new Date());
Integer integer = cfarticleMapper.updatecom(id, recommended, whetherBanner,article,updateTime); Integer integer = cfarticleMapper.updatecom(id, recommended, whetherBanner, article, updateTime);
if (integer > 0) { if (integer > 0) {
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
rtnJson.put("errorMsg", "修改成功"); rtnJson.put("errorMsg", "修改成功");
...@@ -105,12 +106,12 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -105,12 +106,12 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
} }
@Override @Override
public JSONObject recommended(Long id,String appId) { public JSONObject recommended(Long id, String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId); MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<CfarticleVO> recommended = cfarticleMapper.recommended(id); List<CfarticleVO> recommended = cfarticleMapper.recommended(id);
if (recommended.size()>0) { if (recommended.size() > 0) {
for (CfarticleVO cfarticleVO : recommended) { for (CfarticleVO cfarticleVO : recommended) {
String contents = ESAPI.encoder().decodeForHTML(cfarticleVO.getContent()); String contents = ESAPI.encoder().decodeForHTML(cfarticleVO.getContent());
String unCond = HtmlUtils.htmlUnescape(contents); String unCond = HtmlUtils.htmlUnescape(contents);
...@@ -130,9 +131,10 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -130,9 +131,10 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
return rtnJson; return rtnJson;
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public JSONObject reading(Long id,String appId) { public JSONObject reading(Long id, String appId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
int count = 1; int count = 1;
try { try {
...@@ -140,18 +142,18 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -140,18 +142,18 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
CfarticleVO reading = cfarticleMapper.saveReading(id); CfarticleVO reading = cfarticleMapper.saveReading(id);
Long recommended = reading.getRecommended(); Long recommended = reading.getRecommended();
Long redings = reading.getReading(); Long redings = reading.getReading();
if (redings==null){ if (redings == null) {
count+=0; count += 0;
}else{ } else {
count+=redings; count += redings;
} }
Integer integer = cfarticleMapper.reading(id,count); Integer integer = cfarticleMapper.reading(id, count);
if (integer>0){ if (integer > 0) {
CfarticleVO saveReading = cfarticleMapper.saveReading(id); CfarticleVO saveReading = cfarticleMapper.saveReading(id);
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
rtnJson.put("data", saveReading.getReading()); rtnJson.put("data", saveReading.getReading());
} }
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "系统异常"); rtnJson.put("errorMsg", "系统异常");
...@@ -160,20 +162,20 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -160,20 +162,20 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
} }
@Override @Override
public JSONObject geteway(String title,String appId,Long page,Long pageSize) { public JSONObject geteway(String title, String appId, Long page, Long pageSize) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId); MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<Cfarticle> cfarticles = cfarticleMapper.gateway(title,page,pageSize); List<Cfarticle> cfarticles = cfarticleMapper.gateway(title, page, pageSize);
if (cfarticles==null){ if (cfarticles == null) {
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg","查询失败"); rtnJson.put("errorMsg", "查询失败");
return rtnJson; return rtnJson;
} }
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
rtnJson.put("errorMsg",cfarticles); rtnJson.put("data", cfarticles);
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "系统异常"); rtnJson.put("errorMsg", "系统异常");
...@@ -187,15 +189,15 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -187,15 +189,15 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
try { try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId); MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<columnVO> column = cfarticleMapper.column(); List<columnVO> column = cfarticleMapper.column();
if (column==null){ if (column == null) {
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg","查询失败"); rtnJson.put("errorMsg", "查询失败");
return rtnJson; return rtnJson;
} }
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
rtnJson.put("errorMsg",column); rtnJson.put("data", column);
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "系统异常"); rtnJson.put("errorMsg", "系统异常");
...@@ -204,20 +206,20 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -204,20 +206,20 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
} }
@Override @Override
public JSONObject columnDetails(Long id,String appId,Long page,Long pageSize,String title) { public JSONObject columnDetails(Long id, String appId, Long page, Long pageSize, String title) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId); MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<CfarticleVO> cfarticleVOS = cfarticleMapper.columnDetails(id,page,pageSize,title); List<CfarticleVO> cfarticleVOS = cfarticleMapper.columnDetails(id, page, pageSize, title);
if (cfarticleVOS==null){ if (cfarticleVOS == null) {
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg","查询失败"); rtnJson.put("errorMsg", "查询失败");
return rtnJson; return rtnJson;
} }
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
rtnJson.put("data",cfarticleVOS); rtnJson.put("data", cfarticleVOS);
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
rtnJson.put("errorNo", "1"); rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "系统异常"); rtnJson.put("errorMsg", "系统异常");
...@@ -232,7 +234,7 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -232,7 +234,7 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
Integer integer = cfarticleMapper.selectcom(); Integer integer = cfarticleMapper.selectcom();
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
rtnJson.put("data",integer); rtnJson.put("data", integer);
return rtnJson; return rtnJson;
} }
...@@ -242,7 +244,7 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen ...@@ -242,7 +244,7 @@ public class CfarticleServiceImpl extends GenericServiceImpl<Cfarticle> implemen
Integer banner = cfarticleMapper.selectBanner(); Integer banner = cfarticleMapper.selectBanner();
rtnJson.put("errorNo", "0"); rtnJson.put("errorNo", "0");
rtnJson.put("data",banner); rtnJson.put("data", banner);
return rtnJson; return rtnJson;
} }
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
media_id = #{media_id, jdbcType=VARCHAR}, media_id = #{media_id, jdbcType=VARCHAR},
</if> </if>
<if test="update_time != null"> <if test="update_time != null">
update_time = #{update_time, jdbcType=DATETIME}, update_time = #{update_time, jdbcType=TIMESTAMP},
</if> </if>
<if test="news_item != null"> <if test="news_item != null">
news_item = #{news_item}, news_item = #{news_item},
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
status = #{status, jdbcType=VARCHAR}, status = #{status, jdbcType=VARCHAR},
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
create_time = #{createTime, jdbcType=DATETIME}, create_time = #{createTime, jdbcType=TIMESTAMP},
</if> </if>
<if test="description != null"> <if test="description != null">
description = #{description, jdbcType=VARCHAR}, description = #{description, jdbcType=VARCHAR},
......
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
status = #{status, jdbcType=VARCHAR}, status = #{status, jdbcType=VARCHAR},
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
create_time = #{createTime, jdbcType=DATETIME}, create_time = #{createTime, jdbcType=TIMESTAMP},
</if> </if>
<if test="description != null"> <if test="description != null">
description = #{description, jdbcType=VARCHAR}, description = #{description, jdbcType=VARCHAR},
......
...@@ -144,6 +144,7 @@ ...@@ -144,6 +144,7 @@
<antisamy.version>1.5.7</antisamy.version> <antisamy.version>1.5.7</antisamy.version>
<joda.version>2.9.6</joda.version> <joda.version>2.9.6</joda.version>
<kaptcha.version>0.0.9</kaptcha.version> <kaptcha.version>0.0.9</kaptcha.version>
<hutool.version>5.7.11</hutool.version>
</properties> </properties>
<dependencies> <dependencies>
...@@ -935,6 +936,12 @@ ...@@ -935,6 +936,12 @@
<version>V1.1.1</version> <version>V1.1.1</version>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<resources> <resources>
......
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