|
|
@@ -1,6 +1,7 @@
|
|
|
package org.springblade.project.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.obs.services.internal.security.EcsSecurityUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
@@ -19,8 +20,11 @@ import org.springblade.project.entity.ServiceProjectItem;
|
|
|
import org.springblade.project.service.ServiceProjectFilesService;
|
|
|
import org.springblade.project.service.ServiceProjectItemService;
|
|
|
import org.springblade.project.service.ServiceProjectService;
|
|
|
+import org.springblade.project.utils.DateUtil;
|
|
|
import org.springblade.system.entity.Dept;
|
|
|
+import org.springblade.system.entity.Tenant;
|
|
|
import org.springblade.system.feign.ISysClient;
|
|
|
+import org.springblade.system.feign.ITenantClient;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -49,6 +53,8 @@ public class ProjectController {
|
|
|
private ServiceProjectFilesService serviceProjectFilesService;
|
|
|
@Autowired
|
|
|
private IUserClient userClient;
|
|
|
+ @Autowired
|
|
|
+ private ITenantClient iTenantClient;
|
|
|
@Autowired
|
|
|
private ICorpsDescClient corpsDescClient;//获取客户信息
|
|
|
@Autowired
|
|
|
@@ -183,6 +189,49 @@ public class ProjectController {
|
|
|
return R.success("删除成功");
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/countByDate")
|
|
|
+ public R countByDate(@RequestParam(name = "type") Integer type)
|
|
|
+ {
|
|
|
+ String beginTime;
|
|
|
+ String endTime;
|
|
|
+
|
|
|
+ if (type == 4) {
|
|
|
+ beginTime = DateUtil.beginYear();
|
|
|
+ endTime = DateUtil.endYear();
|
|
|
+ } else if (type == 3) {
|
|
|
+ beginTime = DateUtil.beginMonth();
|
|
|
+ endTime = DateUtil.endMonth();
|
|
|
+ } else if (type == 2) {
|
|
|
+ beginTime = DateUtil.beginWeek();
|
|
|
+ endTime = DateUtil.endWeek();
|
|
|
+ } else {
|
|
|
+ beginTime = DateUtil.beginDay();
|
|
|
+ endTime = DateUtil.endDay();
|
|
|
+ }
|
|
|
+
|
|
|
+ QueryWrapper<ServiceProjectItem> amountQueryWrapper = new QueryWrapper<>();
|
|
|
+ amountQueryWrapper.select("ifnull(sum(service_charge), 0) as income", "ifnull(sum(amount), 0) as amount")
|
|
|
+ .between("create_time", beginTime, endTime);
|
|
|
+ Map<String, Object> amountMap = serviceProjectItemService.getMap(amountQueryWrapper);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<ServiceProjectItem> countLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ countLambdaQueryWrapper.between(ServiceProjectItem::getCreateTime, beginTime, endTime);
|
|
|
+ int allOrders = serviceProjectItemService.count(countLambdaQueryWrapper);
|
|
|
+
|
|
|
+ countLambdaQueryWrapper.eq(ServiceProjectItem::getStatus, 4);
|
|
|
+ int openOrders = serviceProjectItemService.count(countLambdaQueryWrapper);
|
|
|
+
|
|
|
+ Tenant tenant = iTenantClient.tenantMessage(SecureUtil.getTenantId());
|
|
|
+
|
|
|
+ return R.data(new HashMap<String, Object>() {{
|
|
|
+ this.put("tenantName", tenant.getTenantName());
|
|
|
+ this.put("income", amountMap.get("income"));
|
|
|
+ this.put("amount", amountMap.get("amount"));
|
|
|
+ this.put("allOrders", allOrders);
|
|
|
+ this.put("openOrders", openOrders);
|
|
|
+ }});
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("findById")
|
|
|
public R<?> findById(@RequestParam(name = "id", required = true) Long id,
|
|
|
@RequestParam(name = "itemStatus", required = true) String itemStatus)
|