发票,单据修改

pro
anthonywj 2 years ago
parent 62367e9acf
commit b4a00f5c51

@ -39,7 +39,9 @@ public class BaseController {
public String getCustomerId() {
AuthAdmin authAdmin = getUser();
return authAdmin.getCustomerId() + "";
if (authAdmin != null)
return authAdmin.getCustomerId() + "";
return "110";
}
public boolean isHosUser() {

@ -138,15 +138,15 @@ public class IoOrderController extends BaseController {
}
List<IoOrderResponse> list = orderService.getfilterList(filterOrderRequest);
for (IoOrderResponse ioOrderResponse : list) {
if(ioOrderResponse.getCheckStatus() == null){
ioOrderResponse.setCheckStatus(0+"");
if (ioOrderResponse.getCheckStatus() == null) {
ioOrderResponse.setCheckStatus(0 + "");
}
FilterOrderDetailCodeRequest filterOrderDetailCodeRequest = new FilterOrderDetailCodeRequest();
filterOrderDetailCodeRequest.setOrderIdFk(ioOrderResponse.getBillNo());
List<IoOrderDetailCodeResponse> ioOrderDetailCodeResponses = orderDetailBizService.getfilterList(filterOrderDetailCodeRequest);
BigDecimal amount=new BigDecimal(0.00);
BigDecimal amount = new BigDecimal(0.00);
for (IoOrderDetailCodeResponse ioOrderDetailCodeRespons : ioOrderDetailCodeResponses) {
if(ioOrderDetailCodeRespons.getCount() != 0 && ioOrderDetailCodeRespons.getPrice()!=null ) {
if (ioOrderDetailCodeRespons.getCount() != 0 && ioOrderDetailCodeRespons.getPrice() != null) {
amount = amount.add(new BigDecimal(ioOrderDetailCodeRespons.getCount()).multiply(ioOrderDetailCodeRespons.getPrice()));
}
}
@ -161,8 +161,6 @@ public class IoOrderController extends BaseController {
}
@AuthRuleAnnotation("")
@GetMapping("/udiwms/inout/preInorder/filter")
public BaseResponse filterPreInorder(FilterOrderRequest filterOrderRequest) {

@ -8,11 +8,15 @@ import com.glxp.api.annotation.Log;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.BusinessType;
import com.glxp.api.dao.inout.IoOrderDetailCodeDao;
import com.glxp.api.dao.inout.IoOrderInvoiceMapper;
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
import com.glxp.api.entity.inout.IoOrderInvoiceEntity;
import com.glxp.api.http.sync.SpGetHttpClient;
import com.glxp.api.idc.service.FileService;
import com.glxp.api.req.inout.RefreshInoiceRequest;
import com.glxp.api.res.inout.RefreshInoiceResponse;
import com.glxp.api.service.inout.IoOrderDetailCodeService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@ -29,14 +33,21 @@ public class IoOrderInvoiceController {
SpGetHttpClient spGetHttpClient;
@Resource
FileService fileService;
@Resource
IoOrderDetailCodeDao ioOrderDetailCodeDao;
@AuthRuleAnnotation("")
@PostMapping("/udiwms/inout/order/refrshInvoice")
@Log(title = "发票", businessType = BusinessType.INSERT)
public BaseResponse addBizProduct(@RequestBody RefreshInoiceRequest refreshInoiceRequest) {
BaseResponse baseResponse = spGetHttpClient.getIoOrderInvoices(refreshInoiceRequest);
BaseResponse<RefreshInoiceResponse> baseResponse = spGetHttpClient.getIoOrderInvoices(refreshInoiceRequest);
if (baseResponse.getCode() == 20000) {
List<IoOrderInvoiceEntity> orderInvoiceEntities = BeanUtil.toBean(baseResponse.getData(),List.class);
RefreshInoiceResponse refreshInoiceResponse = baseResponse.getData();
List<IoOrderDetailCodeEntity> orderDetailCodeEntities = refreshInoiceResponse.getOrderDetailCodeEntities();
ioOrderDetailCodeDao.insertOrUpdateBatch(orderDetailCodeEntities);
List<IoOrderInvoiceEntity> orderInvoiceEntities = refreshInoiceResponse.getOrderInvoiceEntities();
if (CollUtil.isNotEmpty(orderInvoiceEntities)) {
List<String> syncFiles = new ArrayList<>();
for (IoOrderInvoiceEntity orderInvoiceEntity : orderInvoiceEntities) {

@ -21,6 +21,7 @@ import com.glxp.api.req.sync.BasicExportStatusRequest;
import com.glxp.api.req.sync.OrderStatusFilterRequest;
import com.glxp.api.req.sync.SyncUpLoadRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.inout.RefreshInoiceResponse;
import com.glxp.api.res.sync.*;
import com.glxp.api.res.system.SyncDataSetResponse;
import com.glxp.api.service.sync.SyncDataSetService;
@ -140,7 +141,7 @@ public class SpGetHttpClient {
String json = JSONUtil.toJsonStr(refreshInoiceRequest);
String result = okHttpCli.doPostJson(getIpUrl() + "/directToSpms" + "/udiwms/inout/order/refrshInvoice", json, buildHeader());
BaseResponse response =
JSONObject.parseObject(result, new TypeReference<BaseResponse>() {
JSONObject.parseObject(result, new TypeReference<BaseResponse<RefreshInoiceResponse>>() {
});
return response;
}
@ -154,7 +155,7 @@ public class SpGetHttpClient {
header.add(userId);
String json = JSONUtil.toJsonStr(reviewFinishRequest);
String result = okHttpCli.doPostJson(getIpUrl() + "/directToSpms" + "/spms/inout/order/web/updateStatus", json, Convert.toStrArray(header));
String result = okHttpCli.doPostJson(getIpUrl() + "/directToSpms" + "/spms/inout/order/web/updateStatus", json, Convert.toStrArray(header));
BaseResponse<String> response =
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
});

@ -270,16 +270,16 @@ public class IdcServiceImpl implements IdcService {
if(dataList.get(k).get("tableName"+k) == null)
break;
if(dataList.get(k).get("data"+k)!=null && dataList.get(k).get("filePathColumn"+k)!=null) {
List<Map> childList = JSONObject.parseArray(JSON.toJSONString(dataList.get(i).get("data"+k)), Map.class);
for(int x =0 ;x <childList.size();x++) {
if (childList.get(x).get(dataList.get(k).get("filePathColumn"+k).toString()) != null) {
String[] str = childList.get(x).get(dataList.get(k).get("filePathColumn"+k).toString()).toString().split(",");
for (int s = 0; s < str.length; s++) {
if (!StringUtils.isEmpty(str[s]) && FileUtils.isFileExist(filePath + filePathSlash + imagePath + str[s]))
files.add(filePath + filePathSlash + imagePath + str[s]);
}
}
}
List<Map> childList = JSONObject.parseArray(JSON.toJSONString(dataList.get(i).get("data"+k)), Map.class);
for(int x =0 ;x <childList.size();x++) {
if (childList.get(x).get(dataList.get(k).get("filePathColumn"+k).toString()) != null) {
String[] str = childList.get(x).get(dataList.get(k).get("filePathColumn"+k).toString()).toString().split(",");
for (int s = 0; s < str.length; s++) {
if (!StringUtils.isEmpty(str[s]) && FileUtils.isFileExist(filePath + filePathSlash + imagePath + str[s]))
files.add(filePath + filePathSlash + imagePath + str[s]);
}
}
}
}
}
}
@ -328,52 +328,52 @@ public class IdcServiceImpl implements IdcService {
map.put("page", i * limit);
List<Map<String,Object>> list = dbDao.list(map);
if(list!=null&&map.size()>0) {
List<Map<String,Object>> data = new ArrayList<>();
for(int k=0;i<list.size();k++) {
String line = list.get(k).get("uniqueValue").toString();
JSONObject obj = JSON.parseObject(line);
String uniqueColumn = "";
for(String key : obj.keySet()){
uniqueColumn += uniqueColumn.length()>0 ? ","+key : key;
}
obj.put("uniqueColumn", uniqueColumn);
obj.put("operateMode", "D");
data.add(obj);
}
Map<String,Object> msg = new HashMap<String, Object>();
msg.put("messageId", CustomUtil.getId());
msg.put("messageType", tnames[9]+"(删除)");
msg.put("apiCode", "common");
msg.put("tableName", DBAUtils.tableAliasName(tnames[2]));
msg.put("sendTime", new Date());
msg.put("version", "1.0");
msg.put("total", data.size());
msg.put("data", data);
if (isUpload) {
String result = "";
try {
result = relay("", JSON.toJSONString(msg), null, syncIp);
} catch (Exception ex) {
}
if (IDCUtils.isJson(result)) {
JSONObject json = JSON.parseObject(result);
if (json.getInteger("code") == 20000) {
saveIdcLog(tnames[9], "", tnames[2] + ">success(delete)", i * limit, total);
} else {
success = false;
saveIdcLog(tnames[9], "", tnames[2] + ">" + result, i * limit, total);
}
} else {
success = false;
saveIdcLog(tnames[9], "", syncIp + ":" + tnames[2] + ">fail:上传地址未连通", i * limit, total);
}
} else {
saveIdcLog(tnames[9], "", tnames[2] + ">success(delete)", i * limit, total);
}
syncAddTaskStatus(msg, isUpload ? 1 : 0, true, startTime, isUpload,success);
List<Map<String,Object>> data = new ArrayList<>();
for(int k=0;i<list.size();k++) {
String line = list.get(k).get("uniqueValue").toString();
JSONObject obj = JSON.parseObject(line);
String uniqueColumn = "";
for(String key : obj.keySet()){
uniqueColumn += uniqueColumn.length()>0 ? ","+key : key;
}
obj.put("uniqueColumn", uniqueColumn);
obj.put("operateMode", "D");
data.add(obj);
}
Map<String,Object> msg = new HashMap<String, Object>();
msg.put("messageId", CustomUtil.getId());
msg.put("messageType", tnames[9]+"(删除)");
msg.put("apiCode", "common");
msg.put("tableName", DBAUtils.tableAliasName(tnames[2]));
msg.put("sendTime", new Date());
msg.put("version", "1.0");
msg.put("total", data.size());
msg.put("data", data);
if (isUpload) {
String result = "";
try {
result = relay("", JSON.toJSONString(msg), null, syncIp);
} catch (Exception ex) {
}
if (IDCUtils.isJson(result)) {
JSONObject json = JSON.parseObject(result);
if (json.getInteger("code") == 20000) {
saveIdcLog(tnames[9], "", tnames[2] + ">success(delete)", i * limit, total);
} else {
success = false;
saveIdcLog(tnames[9], "", tnames[2] + ">" + result, i * limit, total);
}
} else {
success = false;
saveIdcLog(tnames[9], "", syncIp + ":" + tnames[2] + ">fail:上传地址未连通", i * limit, total);
}
} else {
saveIdcLog(tnames[9], "", tnames[2] + ">success(delete)", i * limit, total);
}
syncAddTaskStatus(msg, isUpload ? 1 : 0, true, startTime, isUpload,success);
}
}
}
@ -1188,23 +1188,23 @@ public class IdcServiceImpl implements IdcService {
try (InputStream inputStream = result.body().byteStream()) {
FileOutputStream outputStream = new FileOutputStream(filePath + filePathSlash + imagePath+fileName);
FileOutputStream outputStream = new FileOutputStream(filePath + filePathSlash + imagePath+fileName);
byte b[] = new byte[1024];
byte b[] = new byte[1024];
int len = 0;
while ((len = inputStream.read(b)) != -1) {
total += len;
outputStream.write(b, 0, len);
int len = 0;
while ((len = inputStream.read(b)) != -1) {
total += len;
outputStream.write(b, 0, len);
}
}
outputStream.flush();
outputStream.close();
if(!(total>0)) {
new File(filePath + filePathSlash + imagePath+fileName).delete();
executeSql("delete from idc_file where filePath='"+fileName+"'");
}
outputStream.flush();
outputStream.close();
if(!(total>0)) {
new File(filePath + filePathSlash + imagePath+fileName).delete();
executeSql("delete from idc_file where filePath='"+fileName+"'");
}
} catch (Exception e) {
@ -1220,7 +1220,7 @@ public class IdcServiceImpl implements IdcService {
// TODO Auto-generated catch block
e.printStackTrace();
}
return (total>0);
return (total>0);
}
// @Override
// public boolean signleDownloadFile(String syncIp, String fileName) {
@ -1355,7 +1355,7 @@ public class IdcServiceImpl implements IdcService {
return systemParamConfigEntity;
}
/*把列数据转Map*/

@ -0,0 +1,14 @@
package com.glxp.api.res.inout;
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
import com.glxp.api.entity.inout.IoOrderInvoiceEntity;
import lombok.Data;
import java.util.List;
@Data
public class RefreshInoiceResponse {
List<IoOrderInvoiceEntity> orderInvoiceEntities;
List<IoOrderDetailCodeEntity> orderDetailCodeEntities;
}

@ -416,3 +416,4 @@ CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'spaceOut', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('io_order_detail_code', 'id', 'bigint ', 2);
CALL Pro_Temp_ColumnWork('io_order_detail_biz', 'id', 'bigint ', 2);
CALL Pro_Temp_ColumnWork('io_order_invoice', 'bizIdFk', 'bigint ', 2);

Loading…
Cancel
Save