|
@@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
@@ -99,13 +100,18 @@ public class ProductController {
|
|
|
msg.setError("产品编码为["+product.getProductCode()+"]的产品已存在");
|
|
|
return msg;
|
|
|
}
|
|
|
+ Integer id = product.getId();
|
|
|
+ if(!productService.saveOrUpdate(product)){
|
|
|
+ msg.setError("验证失败");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
//todo:生成操作记录
|
|
|
AuditLogCenter auditLogCenter =new AuditLogCenter();
|
|
|
auditLogCenter.setAuditorId(user.getId());
|
|
|
auditLogCenter.setAuditorName(user.getName());
|
|
|
auditLogCenter.setModuleId(product.getId());
|
|
|
auditLogCenter.setModuleCode("Product");
|
|
|
- if(product.getId()==null){
|
|
|
+ if(id==null){
|
|
|
auditLogCenter.setAuditorContent("创建了产品");
|
|
|
auditLogCenterService.save(auditLogCenter);
|
|
|
}else {
|
|
@@ -119,10 +125,6 @@ public class ProductController {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- if(!productService.saveOrUpdate(product)){
|
|
|
- msg.setError("验证失败");
|
|
|
- return msg;
|
|
|
- }
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
@@ -155,6 +157,7 @@ public class ProductController {
|
|
|
List<Product> productList = productService.list(new LambdaQueryWrapper<Product>().in(Product::getId, idList));
|
|
|
productList.forEach(p->{
|
|
|
p.setIsDelete(1);
|
|
|
+ p.setUpdateTime(LocalDateTime.now());
|
|
|
});
|
|
|
if(!productService.updateBatchById(productList)){
|
|
|
msg.setError("验证失败");
|
|
@@ -316,6 +319,7 @@ public class ProductController {
|
|
|
List<SalesOrder> orderList = salesOrderService.list(new LambdaQueryWrapper<SalesOrder>().in(SalesOrder::getId, orderIds));
|
|
|
List<SysDict> orderTypeList = sysDictService.list(new LambdaQueryWrapper<SysDict>().eq(SysDict::getCode, "OrderType"));
|
|
|
List<Integer> businessOpportunityIds = orderList.stream().map(SalesOrder::getBusinessOpportunityId).distinct().collect(Collectors.toList());
|
|
|
+ businessOpportunityIds.add(-1);
|
|
|
List<BusinessOpportunity> businessOpportunityList = businessOpportunityService.list(new LambdaQueryWrapper<BusinessOpportunity>().in(BusinessOpportunity::getId, businessOpportunityIds));
|
|
|
orderList.forEach(o->{
|
|
|
Optional<Custom> custom = customList.stream().filter(ct -> ct.getId().equals(o.getCustomId())).findFirst();
|
|
@@ -379,29 +383,30 @@ public class ProductController {
|
|
|
String[] idsSplit = ids.split(",");
|
|
|
List<String> splitList = Arrays.asList(idsSplit);
|
|
|
List<Integer> idList = splitList.stream().map(i -> Integer.valueOf(i)).collect(Collectors.toList());
|
|
|
- idList.add(-1);
|
|
|
- List<Product> productList = productService.list(new LambdaQueryWrapper<Product>().in(Product::getId, idList));
|
|
|
- if(productList.size()>0){
|
|
|
- productList.forEach(p->{
|
|
|
- p.setIsDelete(0);
|
|
|
- });
|
|
|
- productService.updateBatchById(productList);
|
|
|
- }
|
|
|
- List<AuditLogCenter> auditLogCenters =new ArrayList<>();
|
|
|
if(idList.size()>0){
|
|
|
- idList.forEach(i->{
|
|
|
- //todo: 生成操作记录
|
|
|
- AuditLogCenter auditLogCenter =new AuditLogCenter();
|
|
|
- auditLogCenter.setAuditorContent("恢复了产品");
|
|
|
- auditLogCenter.setAuditorId(user.getId());
|
|
|
- auditLogCenter.setAuditorName(user.getName());
|
|
|
- auditLogCenter.setModuleId(Integer.valueOf(i));
|
|
|
- auditLogCenter.setModuleCode("Product");
|
|
|
- auditLogCenters.add(auditLogCenter);
|
|
|
- });
|
|
|
- }
|
|
|
- if(auditLogCenters.size()>0){
|
|
|
- auditLogCenterService.saveBatch(auditLogCenters);
|
|
|
+ List<Product> productList = productService.list(new LambdaQueryWrapper<Product>().in(Product::getId, idList));
|
|
|
+ if(productList.size()>0){
|
|
|
+ productList.forEach(p->{
|
|
|
+ p.setIsDelete(0);
|
|
|
+ });
|
|
|
+ productService.updateBatchById(productList);
|
|
|
+ }
|
|
|
+ List<AuditLogCenter> auditLogCenters =new ArrayList<>();
|
|
|
+ if(idList.size()>0){
|
|
|
+ idList.forEach(i->{
|
|
|
+ //todo: 生成操作记录
|
|
|
+ AuditLogCenter auditLogCenter =new AuditLogCenter();
|
|
|
+ auditLogCenter.setAuditorContent("恢复了产品");
|
|
|
+ auditLogCenter.setAuditorId(user.getId());
|
|
|
+ auditLogCenter.setAuditorName(user.getName());
|
|
|
+ auditLogCenter.setModuleId(Integer.valueOf(i));
|
|
|
+ auditLogCenter.setModuleCode("Product");
|
|
|
+ auditLogCenters.add(auditLogCenter);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if(auditLogCenters.size()>0){
|
|
|
+ auditLogCenterService.saveBatch(auditLogCenters);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return msg;
|