|
|
@@ -14,6 +14,7 @@ import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.DateUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.modules.pl.product.entity.ProductEntity;
|
|
|
@@ -86,21 +87,40 @@ public class ProductReworkApiController {
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiOperation(value = "分页", notes = "传入product")
|
|
|
public R<Object> countProduct(@ApiIgnore @RequestParam Map<String, Object> productRework, Query query) {
|
|
|
- BladeUser user = AuthUtil.getUser();
|
|
|
- productRework.put("factoryId",user.getFactoryId());
|
|
|
- QueryWrapper<ProductReworkEntity> wrapper = Condition.getQueryWrapper(productRework,ProductReworkEntity.class);
|
|
|
- long countAll = productReworkService.count(wrapper);
|
|
|
- productRework.put("status","2");
|
|
|
- wrapper = Condition.getQueryWrapper(productRework,ProductReworkEntity.class);
|
|
|
- long countSucceed = productReworkService.count(wrapper);
|
|
|
- productRework.put("status","3");
|
|
|
- wrapper = Condition.getQueryWrapper(productRework,ProductReworkEntity.class);
|
|
|
- long countCheck = productReworkService.count(wrapper);
|
|
|
-
|
|
|
Map<String,Object> result = new HashMap<>();
|
|
|
- result.put("countAll",countAll);
|
|
|
- result.put("countSucceed",countSucceed);
|
|
|
- result.put("countCheck",countCheck);
|
|
|
+ if(productRework.get("status")!=null && "-1".equals(productRework.get("status"))){
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ productRework.put("factoryId_equal",user.getFactoryId());
|
|
|
+ if(productRework.get("auditDate")==null){
|
|
|
+ productRework.put("auditDate", DateUtil.formatDate(new Date()));
|
|
|
+ }
|
|
|
+ QueryWrapper<ProductReworkEntity> wrapper = Condition.getQueryWrapper(productRework,ProductReworkEntity.class);
|
|
|
+ long countNow = productReworkService.count(wrapper);
|
|
|
+ productRework.remove("auditDate");
|
|
|
+ wrapper = Condition.getQueryWrapper(productRework,ProductReworkEntity.class);
|
|
|
+ long countAll = productReworkService.count(wrapper);
|
|
|
+ result.put("countAll",countAll);
|
|
|
+ result.put("countNow",countNow);
|
|
|
+
|
|
|
+ }else{
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ productRework.put("factoryId_equal",user.getFactoryId());
|
|
|
+ QueryWrapper<ProductReworkEntity> wrapper = Condition.getQueryWrapper(productRework,ProductReworkEntity.class);
|
|
|
+ long countAll = productReworkService.count(wrapper);
|
|
|
+ productRework.put("status_equal","2");
|
|
|
+ wrapper = Condition.getQueryWrapper(productRework,ProductReworkEntity.class);
|
|
|
+ long countSucceed = productReworkService.count(wrapper);
|
|
|
+ productRework.put("status_equal","3");
|
|
|
+ wrapper = Condition.getQueryWrapper(productRework,ProductReworkEntity.class);
|
|
|
+ long countCheck = productReworkService.count(wrapper);
|
|
|
+ productRework.put("status_equal","-1");
|
|
|
+ wrapper = Condition.getQueryWrapper(productRework,ProductReworkEntity.class);
|
|
|
+ long countInvalid = productReworkService.count(wrapper);
|
|
|
+ result.put("countAll",countAll);
|
|
|
+ result.put("countSucceed",countSucceed);
|
|
|
+ result.put("countCheck",countCheck);
|
|
|
+ result.put("countInvalid",countInvalid);
|
|
|
+ }
|
|
|
return R.data(result);
|
|
|
}
|
|
|
|
|
|
@@ -179,6 +199,11 @@ public class ProductReworkApiController {
|
|
|
productEntity.setId(detail.getProductId());
|
|
|
productEntity.setStatus(2);
|
|
|
productService.updateById(productEntity);
|
|
|
+ }else if(productRework.getStatus() ==-1 ){
|
|
|
+ ProductEntity productEntity = new ProductEntity();
|
|
|
+ productEntity.setId(detail.getProductId());
|
|
|
+ productEntity.setStatus(0);
|
|
|
+ productService.updateById(productEntity);
|
|
|
}
|
|
|
return R.success("操作成功");
|
|
|
}
|