Commit 083058b2 authored by 马超's avatar 马超

feat(微问诊): 上传成功后更新药品上传状态

parent 73b231dc
...@@ -129,6 +129,13 @@ public class CdfortisServiceImpl implements CdfortisService { ...@@ -129,6 +129,13 @@ public class CdfortisServiceImpl implements CdfortisService {
return JSONObject.parseObject(data, FbusiDetail.class); return JSONObject.parseObject(data, FbusiDetail.class);
} }
/**
* 通过订单号获取图文详情
*
* @param orderId
* @return
* @throws Exception
*/
@Override @Override
public FbusiDetail getFbusiDetailByOrderId(String orderId) throws Exception { public FbusiDetail getFbusiDetailByOrderId(String orderId) throws Exception {
String getFbusiInfoByOrderIdUrl = SystemConfig.p.getProperty("cdfortis.get_fbusi_info_by_order_id_url"); String getFbusiInfoByOrderIdUrl = SystemConfig.p.getProperty("cdfortis.get_fbusi_info_by_order_id_url");
......
...@@ -8,11 +8,15 @@ import com.cftech.cdfortis.util.CdfortisTokenUtil; ...@@ -8,11 +8,15 @@ import com.cftech.cdfortis.util.CdfortisTokenUtil;
import com.cftech.prescription.model.Prescription; import com.cftech.prescription.model.Prescription;
import com.cftech.prescription.service.PrescriptionService; 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 lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 微问诊相关接口调用Controller * 微问诊相关接口调用Controller
...@@ -35,6 +39,9 @@ public class CdfortisController { ...@@ -35,6 +39,9 @@ public class CdfortisController {
@Autowired @Autowired
PrescriptionService prescriptionService; PrescriptionService prescriptionService;
@Autowired
ProductService productService;
/** /**
* 获取微问诊token * 获取微问诊token
* *
...@@ -69,6 +76,17 @@ public class CdfortisController { ...@@ -69,6 +76,17 @@ public class CdfortisController {
Object data = ""; Object data = "";
if (!isAllSuccess) { if (!isAllSuccess) {
JSONArray failedDataArr = dataJsonObj.getJSONArray("failedData"); JSONArray failedDataArr = dataJsonObj.getJSONArray("failedData");
// List转map,key是productNumber、value是product本身
List<String> productNumberList = productList.stream()
.map(Product::getProductNumber)
.collect(Collectors.toList());
// 遍历上传失败的数据,排除掉
for (int i = 0; i < failedDataArr.size(); i++) {
String erpId = failedDataArr.getJSONObject(i).getString("erpId");
productNumberList.remove(erpId);
}
productService.updateUploadFlag(productNumberList, true);
data = failedDataArr; data = failedDataArr;
} }
setSuccResult(rtnJson, data); setSuccResult(rtnJson, data);
......
...@@ -7,12 +7,22 @@ Content-Type: application/json ...@@ -7,12 +7,22 @@ Content-Type: application/json
[ [
{ {
"id": "22",
"approveNumber": "国药准字Z10910006", "approveNumber": "国药准字Z10910006",
"format": "10g/袋", "format": "10g/袋",
"price": "39.80", "price": "39.80",
"productNumber": "PD202011040006", "productNumber": "PD202011040006",
"productName": "番泻叶颗粒", "productName": "番泻叶颗粒",
"manufacturer": "江苏艾迪药业股份有限公司" "manufacturer": "江苏艾迪药业股份有限公司"
},
{
"id": "24",
"approveNumber": "国药准字XXXX",
"format": "75mg/片",
"price": "1.00",
"productNumber": "6901028193498",
"productName": "艾邦德®",
"manufacturer": "江苏艾迪药业股份有限公司"
} }
] ]
......
...@@ -30,4 +30,10 @@ public interface ProductMapper extends GenericDao<Product> { ...@@ -30,4 +30,10 @@ public interface ProductMapper extends GenericDao<Product> {
* @return * @return
*/ */
List<Product> selectProduct(Map<String,Object> params); List<Product> selectProduct(Map<String,Object> params);
/**
*
* @param productNumberList
*/
void updateUploadFlag(@Param("productNumberList") List<String> productNumberList,@Param("uploadFlag") int uploadFlag);
} }
\ No newline at end of file
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<result column="unit" property="unit"/> <result column="unit" property="unit"/>
<result column="invoice_code" property="invoiceCode"/> <result column="invoice_code" property="invoiceCode"/>
<result column="deviation" property="deviation"/> <result column="deviation" property="deviation"/>
<result column="upload_flag" property="uploadFlag"/>
</resultMap> </resultMap>
<sql id="sqlWhere"> <sql id="sqlWhere">
...@@ -98,7 +99,8 @@ ...@@ -98,7 +99,8 @@
isreading, isreading,
unit, unit,
invoice_code, invoice_code,
deviation deviation,
upload_flag
</sql> </sql>
<sql id="productList"> <sql id="productList">
...@@ -127,7 +129,8 @@ ...@@ -127,7 +129,8 @@
t.reading, t.reading,
t.isreading, t.isreading,
t.invoice_code invoiceCode, t.invoice_code invoiceCode,
t.deviation t.deviation,
t.upload_flag AS uploadFlag
</sql> </sql>
<insert id="save" parameterType="com.cftech.product.model.Product" useGeneratedKeys="true" <insert id="save" parameterType="com.cftech.product.model.Product" useGeneratedKeys="true"
...@@ -171,6 +174,7 @@ ...@@ -171,6 +174,7 @@
#{unit,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR},
#{invoiceCode,jdbcType=VARCHAR}, #{invoiceCode,jdbcType=VARCHAR},
#{deviation, jdbcType=BIGINT} #{deviation, jdbcType=BIGINT}
#{uploadFlag, jdbcType=TINYINT}
) )
</insert> </insert>
...@@ -220,7 +224,8 @@ ...@@ -220,7 +224,8 @@
a.is_rs isRs, a.is_rs isRs,
a.reading reading, a.reading reading,
a.invoice_code, a.invoice_code,
a.deviation a.deviation,
a.upload_flag uploadFlag
FROM FROM
t_aidea_product a t_aidea_product a
LEFT JOIN t_aidea_product_classify b ON a.classify_id = b.id LEFT JOIN t_aidea_product_classify b ON a.classify_id = b.id
...@@ -260,7 +265,8 @@ ...@@ -260,7 +265,8 @@
a.product_number productNumber, a.product_number productNumber,
a.is_rs isRs, a.is_rs isRs,
a.reading reading, a.reading reading,
a.invoice_code a.invoice_code,
a.upload_flag uploadFlag
FROM FROM
t_aidea_product a t_aidea_product a
LEFT JOIN t_aidea_product_classify b ON FIND_IN_SET(b.id,a.classify_id) LEFT JOIN t_aidea_product_classify b ON FIND_IN_SET(b.id,a.classify_id)
...@@ -376,6 +382,9 @@ ...@@ -376,6 +382,9 @@
<if test="deviation != null"> <if test="deviation != null">
deviation = #{deviation, jdbcType=BIGINT} deviation = #{deviation, jdbcType=BIGINT}
</if> </if>
<if test="uploadFlag != null">
upload_flag = #{uploadFlag, jdbcType=TINYINT}
</if>
</set> </set>
where id=#{id,jdbcType=BIGINT} where id=#{id,jdbcType=BIGINT}
</update> </update>
...@@ -383,6 +392,14 @@ ...@@ -383,6 +392,14 @@
<update id="delete" parameterType="java.lang.Long"> <update id="delete" parameterType="java.lang.Long">
update t_aidea_product set del_flag=1 where id=#{id,jdbcType=BIGINT} update t_aidea_product set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update> </update>
<update id="updateUploadFlag">
update t_aidea_product set upload_flag=#{uploadFlag} where product_number IN
<foreach item="item" index="index" collection="productNumberList" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<!-- 根据ID查询商品详情!--> <!-- 根据ID查询商品详情!-->
<select id="product" resultType="com.cftech.product.model.ProductVO"> <select id="product" resultType="com.cftech.product.model.ProductVO">
select select
......
...@@ -164,6 +164,8 @@ public class Product implements Serializable { ...@@ -164,6 +164,8 @@ public class Product implements Serializable {
private Long updateBy; private Long updateBy;
/* 偏移量 */ /* 偏移量 */
private Long deviation; private Long deviation;
/* 上传标识 */
private boolean uploadFlag;
public Product() { public Product() {
this.delFlag = false; this.delFlag = false;
......
...@@ -43,4 +43,12 @@ public interface ProductService extends GenericService<Product> { ...@@ -43,4 +43,12 @@ public interface ProductService extends GenericService<Product> {
* @return * @return
*/ */
List<Product> selectProduct(Conds conds, Sort sort,int pageSize,int pageNo,List<String> classifyId); List<Product> selectProduct(Conds conds, Sort sort,int pageSize,int pageNo,List<String> classifyId);
/**
* 更新上传标识
*
* @param productNumberList
* @param uploadFlag
*/
void updateUploadFlag(List<String> productNumberList, boolean uploadFlag);
} }
...@@ -200,5 +200,10 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P ...@@ -200,5 +200,10 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P
return productMapper.selectProduct(params); return productMapper.selectProduct(params);
} }
@Override
public void updateUploadFlag(List<String> productNumberList, boolean uploadFlag) {
productMapper.updateUploadFlag(productNumberList, uploadFlag ? 1 : 0);
}
} }
\ No newline at end of file
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