14 changed files with 498 additions and 32 deletions
-
186archives/src/main/java/com/storeroom/modules/archives/controller/StorageController.java
-
2archives/src/main/java/com/storeroom/modules/archives/controller/TagController.java
-
49archives/src/main/java/com/storeroom/modules/archives/domain/StorageLog.java
-
31archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseRepository.java
-
20archives/src/main/java/com/storeroom/modules/archives/repository/StorageLogRepository.java
-
15archives/src/main/java/com/storeroom/modules/archives/service/ArchivesCaseService.java
-
3archives/src/main/java/com/storeroom/modules/archives/service/ArchivesService.java
-
104archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesCaseServiceImpl.java
-
7archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java
-
79archives/src/main/java/com/storeroom/modules/archives/util/HttpUtil.java
-
8common/src/main/java/com/storeroom/utils/enums/ResponseStatus.java
-
9storeroom/src/main/java/com/storeroom/modules/device/repository/DeviceArchivesTagRepository.java
-
8storeroom/src/main/java/com/storeroom/modules/device/service/DeviceArchivesTagService.java
-
9storeroom/src/main/java/com/storeroom/modules/device/service/impl/DeviceArchivesTagImpl.java
@ -0,0 +1,49 @@ |
|||||
|
package com.storeroom.modules.archives.domain; |
||||
|
|
||||
|
import com.storeroom.base.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Getter; |
||||
|
import lombok.Setter; |
||||
|
|
||||
|
import javax.persistence.*; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
@Entity |
||||
|
@Getter |
||||
|
@Setter |
||||
|
@Table(name = "storage_log") |
||||
|
public class StorageLog extends BaseEntity implements Serializable { |
||||
|
|
||||
|
@Id |
||||
|
@GeneratedValue(strategy= GenerationType.IDENTITY) |
||||
|
private Integer id; |
||||
|
|
||||
|
@Column(name = "case_id") |
||||
|
@ApiModelProperty(value = "盒id") |
||||
|
private String caseId; |
||||
|
|
||||
|
@Column(name = "case_name") |
||||
|
@ApiModelProperty(value = "盒名称") |
||||
|
private String caseName; |
||||
|
|
||||
|
@Column(name = "deposit_num") |
||||
|
@ApiModelProperty(value = "存放数量") |
||||
|
private Integer depositNum; |
||||
|
|
||||
|
@Column(name = "tid") |
||||
|
@ApiModelProperty(value = "标签id") |
||||
|
private String tid; |
||||
|
|
||||
|
@Column(name = "barcode") |
||||
|
@ApiModelProperty(value = "条形码") |
||||
|
private String barcode; |
||||
|
|
||||
|
@Column(name = "storage_type") |
||||
|
@ApiModelProperty(value = "存放状态 1.待入 2.已入 3.待出 4.已出") |
||||
|
private Integer storageType; |
||||
|
|
||||
|
@Column(name = "folder_location_details") |
||||
|
@ApiModelProperty(value = "存放位置") |
||||
|
private String folderLocationDetails; |
||||
|
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package com.storeroom.modules.archives.repository; |
||||
|
|
||||
|
import com.storeroom.modules.archives.domain.StorageLog; |
||||
|
import org.springframework.data.domain.Page; |
||||
|
import org.springframework.data.domain.Pageable; |
||||
|
import org.springframework.data.jpa.repository.JpaRepository; |
||||
|
import org.springframework.data.jpa.repository.Query; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface StorageLogRepository extends JpaRepository<StorageLog, Integer>{ |
||||
|
|
||||
|
@Query(nativeQuery = true, |
||||
|
value = "select * from storage_log where if(?1 is null,1=1,storage_type = ?1) " + |
||||
|
"and if(?2 is null,1=1,case_name like ?2) " + |
||||
|
"and if(?3 is null,1=1,tid like ?3) " + |
||||
|
"and if(?4 is null,1=1,barcode like ?4) ") |
||||
|
Page<StorageLog> initStorageLogList(Integer storageType, String caseName, String tid, String barcode, Pageable page); |
||||
|
|
||||
|
} |
@ -0,0 +1,79 @@ |
|||||
|
package com.storeroom.modules.archives.util; |
||||
|
|
||||
|
|
||||
|
import cn.hutool.http.HttpRequest; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import org.apache.http.HttpEntity; |
||||
|
import org.apache.http.client.ResponseHandler; |
||||
|
import org.apache.http.client.methods.CloseableHttpResponse; |
||||
|
import org.apache.http.client.methods.HttpPost; |
||||
|
import org.apache.http.entity.StringEntity; |
||||
|
import org.apache.http.impl.client.BasicResponseHandler; |
||||
|
import org.apache.http.impl.client.CloseableHttpClient; |
||||
|
import org.apache.http.impl.client.HttpClients; |
||||
|
import org.apache.http.util.EntityUtils; |
||||
|
//import cn.hutool.json.JSONObject; |
||||
|
|
||||
|
import java.io.IOException; |
||||
|
import java.sql.Timestamp; |
||||
|
import java.util.HashMap; |
||||
|
|
||||
|
public class HttpUtil { |
||||
|
|
||||
|
public static String wlwHttpURLConnection(String url, JSONObject reqBody, String appid, String appSecret, String sign){ |
||||
|
// 获得http请求 |
||||
|
String httpRes= HttpRequest.post(url) |
||||
|
.body(reqBody.toString()) |
||||
|
.header("Content-Type", "application/json;charset=utf-8") |
||||
|
// .header("appid",appid) |
||||
|
.header("timestamp",new Timestamp(System.currentTimeMillis()).toString()) |
||||
|
// .header("sign",sign) |
||||
|
.execute().body(); |
||||
|
return httpRes; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static String request(String url,HashMap<String,Object> paramMap){ |
||||
|
//map转json |
||||
|
String json = JSONObject.toJSONString(paramMap); |
||||
|
String returnValue = "这是默认返回值,接口调用失败"; |
||||
|
CloseableHttpClient httpClient = HttpClients.createDefault(); |
||||
|
CloseableHttpResponse response = null; |
||||
|
HttpEntity entity = null; |
||||
|
ResponseHandler<String> responseHandler = new BasicResponseHandler(); |
||||
|
try{ |
||||
|
//第一步:创建HttpClient对象 |
||||
|
httpClient = HttpClients.createDefault(); |
||||
|
//第二步:创建httpPost对象 |
||||
|
HttpPost httpPost = new HttpPost(url); |
||||
|
//第三步:设置请求头 |
||||
|
httpPost.addHeader("Content-Type","application/json;charset=utf-8"); |
||||
|
//第四步:给httpPost设置JSON格式的参数 |
||||
|
StringEntity requestEntity = new StringEntity(json,"UTF-8"); |
||||
|
requestEntity.setContentEncoding("UTF-8"); |
||||
|
httpPost.setHeader("Content-type", "application/json"); |
||||
|
httpPost.setEntity(requestEntity); |
||||
|
//第五步:发送HttpPost请求,获取返回值 |
||||
|
response = httpClient.execute(httpPost); //调接口获取返回值时,必须用此方法 |
||||
|
returnValue = httpClient.execute(httpPost,responseHandler); //调接口获取返回值时,必须用此方法 |
||||
|
|
||||
|
entity = response.getEntity(); |
||||
|
returnValue = EntityUtils.toString(entity, "UTF-8"); |
||||
|
} |
||||
|
catch(Exception e) |
||||
|
{ |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
finally { |
||||
|
try { |
||||
|
httpClient.close(); |
||||
|
} catch (IOException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
//第六步:处理返回值 |
||||
|
System.out.println(returnValue); |
||||
|
return returnValue; |
||||
|
} |
||||
|
|
||||
|
} |
@ -1,7 +1,9 @@ |
|||||
package com.storeroom.modules.device.service; |
package com.storeroom.modules.device.service; |
||||
|
|
||||
public interface DeviceArchivesTagService { |
|
||||
|
|
||||
|
import com.storeroom.modules.device.domain.DeviceArchivesTag; |
||||
|
|
||||
Boolean findByDeviceInfoIdAndPosition(String deviceInfoId,String position); |
|
||||
|
public interface DeviceArchivesTagService { |
||||
|
//根据层架位id获取设备id |
||||
|
String findDeviceIdByShelfId(String shelfId); |
||||
|
DeviceArchivesTag findByDeviceInfoIdAndPosition(String deviceInfoId, String position); |
||||
} |
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue