小票打印bug修复

This commit is contained in:
谭凯凯
2024-11-29 09:56:45 +08:00
committed by Tankaikai
parent fa09fd2997
commit 136e119a2b
3 changed files with 19 additions and 34 deletions

View File

@@ -106,7 +106,7 @@ public abstract class PrinterHandler {
if (isTemporary == 0 && sku == null) { if (isTemporary == 0 && sku == null) {
log.error("商品不存在, id: {}", item.getProductSkuId()); log.error("商品不存在, id: {}", item.getProductSkuId());
return; return;
} else { } else if(isTemporary == 1){
sku = new TbProductSkuWithBLOBs(); sku = new TbProductSkuWithBLOBs();
} }
if (StrUtil.isEmpty(machine.getClassifyPrint())) { if (StrUtil.isEmpty(machine.getClassifyPrint())) {

View File

@@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
@@ -375,44 +376,26 @@ public class PrinterUtils {
Map<String, String> param = getToken(time, uuid); Map<String, String> param = getToken(time, uuid);
//参数 //参数
//MultiValueMap<String, Object> multiValueMap = new LinkedMultiValueMap<>(); MultiValueMap<String, Object> multiValueMap = new LinkedMultiValueMap<>();
Map<String, Object> map = new HashMap<>(); multiValueMap.add("token", param.get("TOKEN"));
map.put("token", param.get("TOKEN")); multiValueMap.add("devName", devName);
map.put("devName", devName); multiValueMap.add("actWay", actWay);
map.put("money", null); multiValueMap.add("cn", cn);
map.put("content", "收款100元"); multiValueMap.add("data", data);
map.put("broadCastType", "1"); multiValueMap.add("voiceJson", voiceJson);
//multiValueMap.put("actWay", actWay); multiValueMap.add("appId", APP_ID);
//multiValueMap.put("cn", cn); multiValueMap.add("timestamp", time);
//multiValueMap.put("data", data); multiValueMap.add("requestId", uuid);
//multiValueMap.put("voiceJson", voiceJson); multiValueMap.add("userCode", USER_CODE);
map.put("appId", APP_ID);
map.put("timestamp", time);
map.put("requestId", uuid);
map.put("userCode", USER_CODE);
map.put("bizType", "2");
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
HttpHeaders header = new HttpHeaders(); HttpHeaders header = new HttpHeaders();
header.setContentType(MediaType.APPLICATION_FORM_URLENCODED); header.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
String s = HttpUtil.get("https://ioe.car900.com/v1/openApi/dev/controlDevice.json", map, 50000); HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(multiValueMap, header);
System.out.println(s); String httpResponse = restTemplate.postForObject(URL_STR,
httpEntity, String.class);
HttpEntity<MultiValueMap<String, Object>> httpEntity = null; System.out.println("map" + httpResponse);
String httpResponse;
try {
httpResponse = restTemplate.getForObject("https://ioe.car900.com/v1/openApi/dev/registerCloud.json",
String.class);
System.out.println("map" + httpResponse);
return httpResponse;
} catch (Exception e) {
if (StrUtil.containsAny(e.getMessage(), "timed out")) {
log.error("请求云享印超时,请稍后再试");
httpResponse = "{\"code\":-1, \"msg\":\"请求云享印超时,请稍后再试\"}";
} else {
httpResponse = "{\"code\":-2, \"msg\":\"请求云享印出错,请稍后再试\"}";
}
}
return httpResponse; return httpResponse;
} }

View File

@@ -543,11 +543,13 @@
group by shop_id,product_id group by shop_id,product_id
</select> </select>
<!--
<update id="updateStockById"> <update id="updateStockById">
update tb_product update tb_product
set stock_number = stock_number - #{num,jdbcType=INTEGER} set stock_number = stock_number - #{num,jdbcType=INTEGER}
where id = #{productId} where id = #{productId}
</update> </update>
-->
<select id="selectBySkuId" resultType="com.chaozhanggui.system.cashierservice.entity.po.ProConsSkuInfo"> <select id="selectBySkuId" resultType="com.chaozhanggui.system.cashierservice.entity.po.ProConsSkuInfo">
SELECT SELECT