Commit ac5f58cd by 吴迪

【新增】修改代码

parent b18c4f67
...@@ -228,6 +228,11 @@ public class GLNController { ...@@ -228,6 +228,11 @@ public class GLNController {
@RequestMapping("/api/domesticCodeProductionNews") @RequestMapping("/api/domesticCodeProductionNews")
public R domesticCodeProductionNews(@RequestBody DomesticCodeVo domesticCodeVo, HttpServletRequest request) { public R domesticCodeProductionNews(@RequestBody DomesticCodeVo domesticCodeVo, HttpServletRequest request) {
if(StringUtils.isNotBlank(domesticCodeVo.getCode())) {
if(domesticCodeVo.getCode().length()<13) {
return R.error("商品条码卡位数太少!请输入正确的13位或14位商品条码!");
}
SearchgtinlogEntity searchgtinlogEntity = new SearchgtinlogEntity(); SearchgtinlogEntity searchgtinlogEntity = new SearchgtinlogEntity();
searchgtinlogEntity.setCreatedate(new Date()); searchgtinlogEntity.setCreatedate(new Date());
searchgtinlogEntity.setIp(IPUtils.getIpAddr(request)); searchgtinlogEntity.setIp(IPUtils.getIpAddr(request));
...@@ -269,6 +274,9 @@ public class GLNController { ...@@ -269,6 +274,9 @@ public class GLNController {
} }
} }
} }
}
return R.error("查询失败!"); return R.error("查询失败!");
} }
......
...@@ -67,9 +67,6 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -67,9 +67,6 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
@Value("${uploadFileQYOne}") @Value("${uploadFileQYOne}")
String uploadFileQYOne; String uploadFileQYOne;
@Autowired
private DomainListProperties domainListProperties;
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<TycpdmFirmEntity> page = this.page( IPage<TycpdmFirmEntity> page = this.page(
...@@ -632,7 +629,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -632,7 +629,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
String phone_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(phone.getBytes(),"loginkey".getBytes())); String phone_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(phone.getBytes(),"loginkey".getBytes()));
String password = memberUser.getPassword();//名文密码 String password = memberUser.getPassword();//名文密码
String password_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(password.getBytes(),"loginkey".getBytes())); String password_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(password.getBytes(),"loginkey".getBytes()));
String url=domainListProperties.getDomain()+"redirectBusinessHall/anccoh/login?method=gdsLoginSSO&gdsCode="+phone_M+"&password="+password_M; String url="http://wsdt.gs1cn.org/anccoh/login?method=gdsLoginSSO&gdsCode="+phone_M+"&password="+password_M;
return url; return url;
}else if (userType==3){ }else if (userType==3){
phone=memberUser.getPhone();//手机号 phone=memberUser.getPhone();//手机号
...@@ -641,7 +638,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -641,7 +638,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
} }
String phone_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(phone.getBytes(),"loginkey".getBytes())); String phone_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(phone.getBytes(),"loginkey".getBytes()));
String url=domainListProperties.getDomain()+"redirectBusinessHall/anccoh/login?method=phoneSSO&phone="+phone_M; String url="http://wsdt.gs1cn.org/anccoh/login?method=phoneSSO&phone="+phone_M;
return url; return url;
} }
......
...@@ -72,18 +72,25 @@ public class DESUtils { ...@@ -72,18 +72,25 @@ public class DESUtils {
} }
public static void main(String[] args) { public static void main(String[] args) {
String userName="test_tru"; //http://wsdt.ancc.org.cn/anccoh/loginOper.jsp?method=AppLogin&identity=AFE77D5AB4599C4E82D4ACAB169A4DB6&pwd=e10adc3949ba59abbe56e057f20f883e&code=
String password="123123";
String userName="18810209356";
String password="123qwe";
String card="1165004";
String password_MD5="4297f44b13955235245b2497399d7a93"; String password_MD5="4297f44b13955235245b2497399d7a93";
System.out.println(MD5Util.unicodeToString("123qwe"));;
String userName_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(userName.getBytes(),"appsGdsn".getBytes())); String userName_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(userName.getBytes(),"appsGdsn".getBytes()));
String password_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(password.getBytes(),"appsGdsn".getBytes())); String password_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(password.getBytes(),"appsGdsn".getBytes()));
String password_M_MD5 = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(password_MD5.getBytes(),"appsGdsn".getBytes())); String password_M_MD5 = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(password_MD5.getBytes(),"appsGdsn".getBytes()));
String card_M_MD5 = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(card.getBytes(),"appsGdsn".getBytes()));
System.out.println(userName_M); System.out.println(userName_M);
System.out.println(password_M); System.out.println(password_M);
System.out.println(password_M_MD5); System.out.println(password_M_MD5);
System.out.println(card_M_MD5);
String aaa="88DA15B9F9F602F0D32D46808652B06DC6E939D1424CE39F69A2AC39743F7ED7591975685B543E1D"; String aaa="AFE77D5AB4599C4E82D4ACAB169A4DB6";
//String s = new String(DESUtils.DES_CBC_Decrypt(aaa, "appsGdsn".getBytes())); //String s = new String(DESUtils.DES_CBC_Decrypt(aaa, "appsGdsn".getBytes()));
String s = new String(DESUtils.DES_CBC_Decrypt(aaa, "appsGdsn".getBytes())); String s = new String(DESUtils.DES_CBC_Decrypt(aaa, "appsGdsn".getBytes()));
......
...@@ -27,4 +27,9 @@ public class HttpUtlis { ...@@ -27,4 +27,9 @@ public class HttpUtlis {
throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
} }
} }
} }
package io.office.modules.manage.webservice; package io.office.modules.manage.webservice;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import io.office.modules.manage.webservice.newWebservice.JaxbUtil;
import io.office.modules.manage.webservice.newWebservice.ProductInformationLink;
import org.jdom.Document; import org.jdom.Document;
import org.jdom.Element; import org.jdom.Element;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
...@@ -28,38 +30,22 @@ public class Test { ...@@ -28,38 +30,22 @@ public class Test {
public static void main(String[] args) throws JAXBException, IOException { public static void main(String[] args) throws JAXBException, IOException {
String smsTemplateXml = WebServiceXmlTemplate.SEND_MESSAGE_TEMPLATE.replaceAll("\\$\\{cascade\\}", "9").replaceAll("\\$\\{requestedKeyCode\\}", "GLN")
.replaceAll("\\$\\{requestedKeyValue\\}", "6973947140013").replaceAll("\\$\\{requestedLanguage\\}", "en"); String url = "http://api.chinatrace.org/AAQI/v1/ProductData/gtin/6920582200169?targetMarket=156&dataVersion=1.1&clientGln=6901234503814&mac=F562D581607A5582187B4231B2CEFC7BB94EC11FF5F0D0082AD013F2254103E1";
String url = "http://webservice.anccnet.com:8080/gepir4/gepirv4.asmx";
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
//创建请求头 //创建请求头
//创建请求头 //创建请求头
HttpHeaders headers = new HttpHeaders(); ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
headers.set("Content-Type","text/xml; charset=utf-8");
HttpEntity<String> entity = new HttpEntity<>(smsTemplateXml, headers);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, entity, String.class);
if (responseEntity.getStatusCode().value() == 200) { if (responseEntity.getStatusCode().value() == 200) {
// 下面的是通过解析xml字符串的 // 下面的是通过解析xml字符串的
Document doc = null; Document doc = null;
String returnObjs = responseEntity.getBody().substring(responseEntity.getBody().indexOf("<partyDataLine>"),responseEntity.getBody().indexOf("</gepirParty>"));//注意 获取根节点的时候要查看返回的xml参数的形式是否为一个根节点 String returnObjs = responseEntity.getBody().substring(responseEntity.getBody().indexOf("<productInformationLink>"),responseEntity.getBody().lastIndexOf("</productInformationLink>")+"</productInformationLink>".length());//注意 获取根节点的时候要查看返回的xml参数的形式是否为一个根节点
System.out.println(returnObjs); System.out.println(returnObjs);
Object xmlObject = null; ProductInformationLink book = JaxbUtil.converyToJavaBean(returnObjs, ProductInformationLink.class);
Reader reader = null; book.getUrl();
//利用JAXBContext将类转为一个实例 System.out.println(JSONUtil.toJsonStr(book));
JAXBContext context = JAXBContext.newInstance(PartyDataLine.class); System.out.println(book.getUrl());
//XMl 转为对象的接口
Unmarshaller unmarshaller = context.createUnmarshaller();
reader = new StringReader(returnObjs);
xmlObject = unmarshaller.unmarshal(reader);
if (reader != null) {
reader.close();
}
System.out.println(JSONUtil.toJsonStr(xmlObject));
/*Object xmlObject = null; /*Object xmlObject = null;
Reader reader = null; Reader reader = null;
......
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