From b42aecb23d3b2baa52fd7474282dfc1018fd066e Mon Sep 17 00:00:00 2001
From: jiaosong <jiaosong6760@dingtalk.com>
Date: 星期五, 18 八月 2023 14:56:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
server/src/main/java/doumeemes/dao/business/dto/statistics/StatisticsPlanDataModel.java | 33 +++++
server/src/main/java/doumeemes/service/ext/StatisticsService.java | 35 +++++
server/src/main/java/doumeemes/dao/ext/dto/QueryWorkPlansDTO.java | 2
server/src/main/java/doumeemes/dao/ext/WorkPlansExtMapper.java | 3
server/src/main/java/doumeemes/dao/ext/WorkorderRecordExtMapper.java | 5
server/src/main/java/doumeemes/service/ext/impl/StatisticsServiceImpl.java | 131 +++++++++++++++++++++
server/src/main/java/doumeemes/api/ext/StatisticsController.java | 49 ++++++++
server/src/main/resources/mappers/WorkorderRecordExtMapper.xml | 21 +++
server/src/main/java/doumeemes/dao/business/dto/statistics/Unqualified7DayModel.java | 21 +++
server/src/main/resources/mappers/WorkPlansExtMapper.xml | 11 +
server/src/main/java/doumeemes/dao/business/dto/statistics/UserProduceTopModel.java | 24 ++++
11 files changed, 334 insertions(+), 1 deletions(-)
diff --git a/server/src/main/java/doumeemes/api/ext/StatisticsController.java b/server/src/main/java/doumeemes/api/ext/StatisticsController.java
new file mode 100644
index 0000000..b12b15a
--- /dev/null
+++ b/server/src/main/java/doumeemes/api/ext/StatisticsController.java
@@ -0,0 +1,49 @@
+package doumeemes.api.ext;
+
+import doumeemes.api.BaseController;
+import doumeemes.core.model.ApiResponse;
+import doumeemes.dao.business.dto.statistics.StatisticsPlanDataModel;
+import doumeemes.dao.business.dto.statistics.Unqualified7DayModel;
+import doumeemes.dao.business.dto.statistics.UserProduceTopModel;
+import doumeemes.service.ext.StatisticsService;
+import doumeemes.service.ext.WorkorderExtService;
+import doumeemes.service.ext.WorkorderRecordExtService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 澶у睆缁熻鏁版嵁鎺ュ彛
+ * @author 姹熻箘韫�
+ * @date 2022/04/20 10:56
+ */
+@RestController
+@RequestMapping("/ext/statistic")
+@Api(tags = "澶у睆鏁版嵁鐪嬫澘-缁熻鏁版嵁鎺ュ彛")
+public class StatisticsController extends BaseController {
+
+ @Autowired
+ private StatisticsService statisticsService;
+
+ @ApiOperation("鏁版嵁缁熻锛屾墽琛屼腑銆佸欢鏈熻鍒掓暟銆佷粖鏃ョ敓浜т汉鏁般�佷粖鏃ョ敓浜ц澶囨暟銆佷粖鏃ヤ笉鑹搧")
+ @GetMapping("/getPlanData/{companyId}/{departId}")
+ public ApiResponse<StatisticsPlanDataModel> getPlansData(@PathVariable Integer companyId, @PathVariable Integer departId) {
+ return ApiResponse.success(statisticsService.getPlansData(companyId,departId));
+ }
+
+ @ApiOperation("鍛樺伐浜у搧缁熻TOP10")
+ @GetMapping("/userProduceTop/{companyId}/{departId}")
+ public ApiResponse<List<UserProduceTopModel>> getUserProducceTop(@PathVariable Integer companyId, @PathVariable Integer departId) {
+ return ApiResponse.success(statisticsService.getUserProduceTopData(companyId,departId));
+ }
+ @ApiOperation("杩�7澶╀笉鑹搧鍒嗗竷-涓嶈壇鍝佹暟閲忕粺璁�")
+ @GetMapping("/getUnqualified7DayData/{companyId}/{departId}")
+ public ApiResponse<List<Unqualified7DayModel>> getUnqualified7DayData(@PathVariable Integer companyId, @PathVariable Integer departId) {
+ return ApiResponse.success(statisticsService.getUnqualified7DayData(companyId,departId));
+ }
+
+
+}
diff --git a/server/src/main/java/doumeemes/dao/business/dto/statistics/StatisticsPlanDataModel.java b/server/src/main/java/doumeemes/dao/business/dto/statistics/StatisticsPlanDataModel.java
new file mode 100644
index 0000000..92df52f
--- /dev/null
+++ b/server/src/main/java/doumeemes/dao/business/dto/statistics/StatisticsPlanDataModel.java
@@ -0,0 +1,33 @@
+package doumeemes.dao.business.dto.statistics;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@ApiModel("澶у睆鏁版嵁鐪嬫澘-浜у搧璁″垝缁熻杩斿洖鏁版嵁")
+/**
+ * 鎵ц涓鍒掓暟锛氱粺璁¤寖鍥翠负锛氭垚鍝佽鍒掞紱鐘舵�佷负銆愭墽琛屼腑銆戯紱
+ * 寤舵湡璁″垝鏁帮細缁熻鑼冨洿涓猴細鎴愬搧璁″垝锛涚姸鎬佷负銆愭墽琛屼腑銆戜笖褰撳墠鏃堕棿澶т簬璁″垝缁撴潫鏃堕棿锛�
+ * 浠婃棩鐢熶骇浜烘暟锛氭牴鎹粖鏃ユ姇鏂�/浜у嚭璁板綍琛ㄦ暟鎹紝缁熻浠婃棩鐨勭敓浜т汉鏁帮紙鍘婚噸锛夛紱缁熻鑼冨洿涓哄伐鍗曠姸鎬佷负銆愬凡鍒涘缓銆佸凡澶囨枡銆佺敓浜т腑銆佸凡妫�楠屻�佸凡瀹屽伐妫�銆佸凡鎶ュ伐銆戯紱
+ * 浠婃棩鐢熶骇璁惧锛氭牴鎹粖鏃ユ姇鏂�/浜у嚭璁板綍琛ㄥ叧鑱旂殑宸ュ崟鏁版嵁锛岀粺璁′粖鏃ョ殑鐢熶骇璁惧鏁帮紙鍘婚噸锛夛紱缁熻鑼冨洿涓哄伐鍗曠姸鎬佷负銆愬凡鍒涘缓銆佸凡澶囨枡銆佺敓浜т腑銆佸凡妫�楠屻�佸凡瀹屽伐妫�銆佸凡鎶ュ伐銆戯紱
+ * 浠婃棩涓嶈壇鍝佺巼锛氭牴鎹粖鏃ヤ骇鍑鸿褰曡〃鏁版嵁锛岀粺璁′粖鏃ヤ骇鍑轰笉鑹暟/浠婃棩浜у嚭鎬绘暟閲�*100%锛涚粺璁¤寖鍥翠负宸ュ崟鐘舵�佷负銆愬凡鎶ュ伐銆戯紱
+ */
+public class StatisticsPlanDataModel {
+ @ApiModelProperty(value = "鎵ц涓鍒掓暟", example = "1")
+ private Integer ingNum;
+ @ApiModelProperty(value = "寤舵湡璁″垝鏁�", example = "1")
+ private Integer delayNum;
+ @ApiModelProperty(value = "浠婃棩鐢熶骇浜烘暟", example = "1")
+ private Integer prouserNum;
+ @ApiModelProperty(value = "浠婃棩鐢熶骇璁惧鏁�", example = "1")
+ private Integer deviceNum;
+ @ApiModelProperty(value = "浠婃棩涓嶈壇鍝佺巼", example = "1")
+ private BigDecimal unqualifiedRate;
+ @ApiModelProperty(value = "浠婃棩涓嶈壇鍝佹暟", example = "1",hidden = true)
+ private BigDecimal unqualifiedNum;
+ @ApiModelProperty(value = "浠婃棩鎶ュ伐鏁�", example = "1",hidden = true)
+ private BigDecimal doneNUm;
+}
diff --git a/server/src/main/java/doumeemes/dao/business/dto/statistics/Unqualified7DayModel.java b/server/src/main/java/doumeemes/dao/business/dto/statistics/Unqualified7DayModel.java
new file mode 100644
index 0000000..21051f6
--- /dev/null
+++ b/server/src/main/java/doumeemes/dao/business/dto/statistics/Unqualified7DayModel.java
@@ -0,0 +1,21 @@
+package doumeemes.dao.business.dto.statistics;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@ApiModel("澶у睆鏁版嵁鐪嬫澘-鍛樺伐浜у搧缁熻TOP10")
+/**
+ * 缁熻鑼冨洿涓哄綋鏃ワ紱宸ュ崟鐘舵�佷负銆愬凡鎶ュ伐銆戯紱
+ * 鏍规嵁鍛樺伐鎶ュ伐鑹搧鏁扮粺璁℃帓搴忥紱
+ */
+public class Unqualified7DayModel {
+ @ApiModelProperty(value = "涓嶈壇鍝佹暟", example = "1")
+ private BigDecimal unqualifiedNum;
+ @ApiModelProperty(value = "鏃ユ湡")
+ private Date createTime;
+}
diff --git a/server/src/main/java/doumeemes/dao/business/dto/statistics/UserProduceTopModel.java b/server/src/main/java/doumeemes/dao/business/dto/statistics/UserProduceTopModel.java
new file mode 100644
index 0000000..28764d5
--- /dev/null
+++ b/server/src/main/java/doumeemes/dao/business/dto/statistics/UserProduceTopModel.java
@@ -0,0 +1,24 @@
+package doumeemes.dao.business.dto.statistics;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@ApiModel("澶у睆鏁版嵁鐪嬫澘-鍛樺伐浜у搧缁熻TOP10")
+/**
+ * 缁熻鑼冨洿涓哄綋鏃ワ紱宸ュ崟鐘舵�佷负銆愬凡鎶ュ伐銆戯紱
+ * 鏍规嵁鍛樺伐鎶ュ伐鑹搧鏁扮粺璁℃帓搴忥紱
+ */
+public class UserProduceTopModel {
+ @ApiModelProperty(value = "鍛樺伐缂栫爜", example = "1")
+ private Integer userId;
+ @ApiModelProperty(value = "鎶ュ伐鏁�", example = "1")
+ private BigDecimal doneNum;
+ @ApiModelProperty(value = "鍛樺伐濮撳悕", example = "1")
+ private String userName;
+ @ApiModelProperty(value = "鍛樺伐鐢佃瘽", example = "1")
+ private String phone;
+}
diff --git a/server/src/main/java/doumeemes/dao/ext/WorkPlansExtMapper.java b/server/src/main/java/doumeemes/dao/ext/WorkPlansExtMapper.java
index 8b0a712..a3b2bd4 100644
--- a/server/src/main/java/doumeemes/dao/ext/WorkPlansExtMapper.java
+++ b/server/src/main/java/doumeemes/dao/ext/WorkPlansExtMapper.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
+import doumeemes.dao.business.dto.statistics.StatisticsPlanDataModel;
import doumeemes.dao.business.model.WorkPlans;
import doumeemes.dao.business.vo.WorkPlansVO;
import doumeemes.dao.ext.dto.QueryWorkPlansDTO;
@@ -29,6 +30,8 @@
WorkPlansVO getWorkPlansVODetail(QueryWorkPlansDTO dto);
+ StatisticsPlanDataModel getPlansStaticticsData(QueryWorkPlansDTO workPlans);
+
// @Select(" SELECT" +
// " `a`.*, mmodel.CODE as materialCode, mmodel.NAME as materialName , fmodel.NAME as factoryName,usermodel.REALNAME as userName , usermodel.mobile as userMobile " +
// " FROM `work_plans` `a`" +
diff --git a/server/src/main/java/doumeemes/dao/ext/WorkorderRecordExtMapper.java b/server/src/main/java/doumeemes/dao/ext/WorkorderRecordExtMapper.java
index 6697c0b..b6f0d4e 100644
--- a/server/src/main/java/doumeemes/dao/ext/WorkorderRecordExtMapper.java
+++ b/server/src/main/java/doumeemes/dao/ext/WorkorderRecordExtMapper.java
@@ -1,5 +1,7 @@
package doumeemes.dao.ext;
+import doumeemes.dao.business.dto.statistics.Unqualified7DayModel;
+import doumeemes.dao.business.dto.statistics.UserProduceTopModel;
import doumeemes.dao.business.model.WorkorderRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import doumeemes.dao.ext.dto.QuerySalaryStatisticDTO;
@@ -37,4 +39,7 @@
List<UserSalaryListVO> userSalaryPage(QueryUserSalaryListDTO model);
+
+ List<UserProduceTopModel> getUserProduceTopData(QueryWorkorderRecordExtDTO param);
+ List<Unqualified7DayModel> getUnqualified7DayData(QueryWorkorderRecordExtDTO param);
}
diff --git a/server/src/main/java/doumeemes/dao/ext/dto/QueryWorkPlansDTO.java b/server/src/main/java/doumeemes/dao/ext/dto/QueryWorkPlansDTO.java
index ba03173..581f044 100644
--- a/server/src/main/java/doumeemes/dao/ext/dto/QueryWorkPlansDTO.java
+++ b/server/src/main/java/doumeemes/dao/ext/dto/QueryWorkPlansDTO.java
@@ -29,7 +29,7 @@
@ApiModelProperty(value = "璁″垝鏃ユ湡 缁撴潫", example = "1")
private String planDateEnd;
- @ApiModelProperty(value = "璁″垝鐘舵�� 0宸茬敓鎴愩��1宸插彂甯冦��2宸叉挙鍥炪��3宸插彇娑堛��4宸插垎閰嶃��5宸叉殏鍋溿��6宸插畬宸ャ��7宸插叆搴撱��8宸插叧闂�", example = "1")
+ @ApiModelProperty(value = "璁″垝鐘舵�� 0宸茬敓鎴愩��1宸插彂甯�(鎵ц涓級銆�2宸叉挙鍥炪��3宸插彇娑堛��4宸插垎閰嶃��5宸叉殏鍋溿��6宸插畬宸ャ��7宸插叆搴撱��8宸插叧闂�", example = "1")
private Integer planStatus;
@ApiModelProperty(value = "宸ュ巶涓婚敭", example = "1")
diff --git a/server/src/main/java/doumeemes/service/ext/StatisticsService.java b/server/src/main/java/doumeemes/service/ext/StatisticsService.java
new file mode 100644
index 0000000..69571bb
--- /dev/null
+++ b/server/src/main/java/doumeemes/service/ext/StatisticsService.java
@@ -0,0 +1,35 @@
+package doumeemes.service.ext;
+
+import doumeemes.core.model.ApiResponse;
+import doumeemes.core.model.LoginUserInfo;
+import doumeemes.core.model.PageData;
+import doumeemes.core.model.PageWrap;
+import doumeemes.dao.business.dto.statistics.StatisticsPlanDataModel;
+import doumeemes.dao.business.dto.statistics.Unqualified7DayModel;
+import doumeemes.dao.business.dto.statistics.UserProduceTopModel;
+import doumeemes.dao.business.model.Workorder;
+import doumeemes.dao.ext.bean.FinishedInBean;
+import doumeemes.dao.ext.bean.FinishedInNewBean;
+import doumeemes.dao.ext.dto.QueryWorkorderExtDTO;
+import doumeemes.dao.ext.vo.PlansExtListH5VO;
+import doumeemes.dao.ext.vo.WorkorderExtListCountVO;
+import doumeemes.dao.ext.vo.WorkorderExtListVO;
+import doumeemes.dao.ext.vo.WorkorderListModelVO;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 澶у睆缁熻淇℃伅Service瀹氫箟
+ * @author 姹熻箘韫�
+ * @date 2022/04/20 10:56
+ */
+@Service
+public interface StatisticsService {
+
+
+ StatisticsPlanDataModel getPlansData(Integer companyId, Integer departId);
+
+ List<UserProduceTopModel> getUserProduceTopData(Integer companyId, Integer departId);
+ List<Unqualified7DayModel> getUnqualified7DayData(Integer companyId, Integer departId);
+}
diff --git a/server/src/main/java/doumeemes/service/ext/impl/StatisticsServiceImpl.java b/server/src/main/java/doumeemes/service/ext/impl/StatisticsServiceImpl.java
new file mode 100644
index 0000000..23f8481
--- /dev/null
+++ b/server/src/main/java/doumeemes/service/ext/impl/StatisticsServiceImpl.java
@@ -0,0 +1,131 @@
+package doumeemes.service.ext.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import doumeemes.core.constants.ResponseStatus;
+import doumeemes.core.exception.BusinessException;
+import doumeemes.core.model.LoginUserInfo;
+import doumeemes.core.model.PageData;
+import doumeemes.core.model.PageWrap;
+import doumeemes.core.utils.Constants;
+import doumeemes.core.utils.DateUtil;
+import doumeemes.core.utils.redis.RedisUtil;
+import doumeemes.dao.business.WOutboundMapper;
+import doumeemes.dao.business.WTransferMapper;
+import doumeemes.dao.business.WorkorderMapper;
+import doumeemes.dao.business.dto.statistics.StatisticsPlanDataModel;
+import doumeemes.dao.business.dto.statistics.Unqualified7DayModel;
+import doumeemes.dao.business.dto.statistics.UserProduceTopModel;
+import doumeemes.dao.business.model.*;
+import doumeemes.dao.ext.*;
+import doumeemes.dao.ext.dto.QueryBarcodeParamExtDTO;
+import doumeemes.dao.ext.dto.QueryCompanyExtDTO;
+import doumeemes.dao.ext.dto.QueryWorkPlansDTO;
+import doumeemes.dao.ext.dto.QueryWorkorderRecordExtDTO;
+import doumeemes.dao.ext.vo.BarcodeParamContent;
+import doumeemes.dao.ext.vo.BarcodeParamExtListVO;
+import doumeemes.dao.ext.vo.CompanyExtListVO;
+import doumeemes.dao.ext.vo.DepartmentExtListVO;
+import doumeemes.service.ext.BarcodeParamExtService;
+import doumeemes.service.ext.DepartmentExtService;
+import doumeemes.service.ext.StatisticsService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 浜岀淮鐮佽缃甋ervice瀹炵幇
+ * @author 姹熻箘韫�
+ * @date 2022/04/20 11:01
+ */
+@Service
+public class StatisticsServiceImpl implements StatisticsService {
+
+ @Autowired
+ private RedisTemplate<String, Object> redisTemplate;
+ @Autowired
+ private WorkPlansExtMapper workPlansExtMapper;
+ @Autowired
+ private WorkorderRecordExtMapper workorderRecordExtMapper;
+ @Autowired
+ private DepartmentExtService departmentExtService;
+
+ @Override
+ public StatisticsPlanDataModel getPlansData(Integer companyId, Integer departId) {
+ DepartmentExtListVO department = departmentExtService.getModelById(companyId,departId);
+ if(department == null || Constants.equalsInteger(department.getDeleted(), Constants.ONE)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝浼佷笟鎴栬�呴儴闂ㄤ俊鎭笉鍚堟硶锛屽鏈夌枒闂紝璇疯仈绯荤郴缁熺鐞嗗憳");
+ }
+ QueryWorkPlansDTO workPlans = new QueryWorkPlansDTO();
+ workPlans.setRootDepartId(department.getRootId());
+ workPlans.setDepartId(departId);
+ //鏌ヨ缁熻缁撴灉
+ StatisticsPlanDataModel model = workPlansExtMapper.getPlansStaticticsData(workPlans);
+ model.setUnqualifiedNum(new BigDecimal(0));
+ if(model.getDoneNUm() !=null && model.getDoneNUm().compareTo(new BigDecimal(0)) != 0){
+ //涓嶈壇鍝佺巼
+ model.setUnqualifiedRate(model.getUnqualifiedNum().divide(model.getDoneNUm(),4).multiply(new BigDecimal(100)));
+ }
+ return model;
+ }
+ @Override
+ public List<UserProduceTopModel> getUserProduceTopData(Integer companyId, Integer departId) {
+ DepartmentExtListVO department = departmentExtService.getModelById(companyId,departId);
+ if(department == null || Constants.equalsInteger(department.getDeleted(), Constants.ONE)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝浼佷笟鎴栬�呴儴闂ㄤ俊鎭笉鍚堟硶锛屽鏈夌枒闂紝璇疯仈绯荤郴缁熺鐞嗗憳");
+ }
+ QueryWorkorderRecordExtDTO param = new QueryWorkorderRecordExtDTO();
+ param.setRootDepartId(department.getRootId());
+ param.setDepartId(departId);
+ //鏌ヨ缁熻缁撴灉
+ List<UserProduceTopModel> model = workorderRecordExtMapper.getUserProduceTopData(param);
+
+ return model;
+ }
+ @Override
+ public List<Unqualified7DayModel> getUnqualified7DayData(Integer companyId, Integer departId) {
+ DepartmentExtListVO department = departmentExtService.getModelById(companyId,departId);
+ if(department == null || Constants.equalsInteger(department.getDeleted(), Constants.ONE)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝浼佷笟鎴栬�呴儴闂ㄤ俊鎭笉鍚堟硶锛屽鏈夌枒闂紝璇疯仈绯荤郴缁熺鐞嗗憳");
+ }
+ QueryWorkorderRecordExtDTO param = new QueryWorkorderRecordExtDTO();
+ param.setRootDepartId(department.getRootId());
+ param.setDepartId(departId);
+ //鏌ヨ缁熻缁撴灉
+ List<Unqualified7DayModel> model = workorderRecordExtMapper.getUnqualified7DayData(param);
+ List<Unqualified7DayModel> result = new ArrayList<>();
+ Date date = DateUtil.getCurrentDate();
+ for (int i = 0; i < 7; i++) {
+ Date td = DateUtil.addDaysToDate(date, 7-i);
+ Unqualified7DayModel m = getReusltModelByDate(td,model);
+ if(m == null){
+ m = new Unqualified7DayModel();
+ m.setCreateTime(td);
+ m.setUnqualifiedNum(new BigDecimal(0));
+ }
+ result.add(m);
+ }
+
+ return model;
+ }
+
+ private Unqualified7DayModel getReusltModelByDate(Date td, List<Unqualified7DayModel> model ) {
+ if(model !=null){
+ for(Unqualified7DayModel m : model){
+ if(StringUtils.equals(DateUtil.getShortTime(td),DateUtil.getShortTime(m.getCreateTime()))){
+ return m;
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/server/src/main/resources/mappers/WorkPlansExtMapper.xml b/server/src/main/resources/mappers/WorkPlansExtMapper.xml
index 82f864a..9c06fd4 100644
--- a/server/src/main/resources/mappers/WorkPlansExtMapper.xml
+++ b/server/src/main/resources/mappers/WorkPlansExtMapper.xml
@@ -170,6 +170,17 @@
</where>
order by a.START_DATE desc, a.CREATE_TIME desc
</select>
+ <select id="getPlansStaticticsData" parameterType="doumeemes.dao.ext.dto.QueryWorkPlansDTO" resultType="doumeemes.dao.business.dto.statistics.StatisticsPlanDataModel">
+ SELECT count(a.id) as ingNum,
+ (select count(b.id) FROM `work_plans` b where b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND (b.`STATUS` = 1 and now() > b.plan_Date )) as delayNum,
+ (select count(distinct(b.CREATE_USER)) FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND c.status in (0,1,2,3,4,7)) as prouserNum,
+ (select count(distinct(b.PRO_DEVICE_ID)) FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND c.status in (0,1,2,3,4,7)) as deviceNum,
+ (select sum(ifnull(b.UNQUALIFIED_NUM,0)) FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND c.status=4) as unqualifiedRate,
+ (select sum(ifnull(b.NUM,0)) FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND c.status=4) as doneNum
+ FROM `work_plans` `a`
+ where
+ a.DELETED = 0 AND a.ROOT_DEPART_ID = #{rootDepartId} AND a.DEPART_ID = #{departId} AND a.`STATUS` = 1
+ </select>
<select id="getWorkPlansVODetail" parameterType="doumeemes.dao.ext.dto.QueryWorkPlansDTO" resultMap="WorkPlansVO">
diff --git a/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml b/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml
index b01670d..3090d9b 100644
--- a/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml
+++ b/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml
@@ -488,6 +488,27 @@
group by `CREATE_USER`
<!-- order by `CREATE_TIME` desc-->
</select>
+ <select id="getUserProduceTopData" parameterType="doumeemes.dao.ext.dto.QueryWorkorderRecordExtDTO"
+ resultType="doumeemes.dao.business.dto.statistics.UserProduceTopModel">
+ SELECT sum(a.num) as doneNum,b.user_id as userId,b.`NAME` as userName,b.PHONE
+ from workorder_record a
+ left join company_user b on b.DELETED=0 and b.user_id=a.CREATE_USER
+ left join workorder c on a.WORKORDER_ID=c.id
+ where a.deleted=0 and a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} and s.status=4
+ GROUP BY a.CREATE_USER
+ ORDER By doneNum desc
+ limit 10
+ </select>
+ <select id="getUnqualified7DayData" parameterType="doumeemes.dao.ext.dto.QueryWorkorderRecordExtDTO"
+ resultType="doumeemes.dao.business.dto.statistics.Unqualified7DayModel">
+ SELECT sum(a.UNQUALIFIED_NUM) as unqualifiedNum,a.CREATE_TIME
+ from workorder_record a
+ left join workorder c on a.WORKORDER_ID=c.id
+ where a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} and c.`STATUS`=4
+ and 7 > (TO_DAYS(now()) - TO_DAYS(a.CREATE_TIME) )
+ GROUP BY TO_DAYS(a.CREATE_TIME )
+
+ </select>
<select id="selectListNew" parameterType="doumeemes.dao.ext.dto.QueryWorkorderRecordExtDTO" resultMap="WorkorderRecordExtListVO">
SELECT
`a`.`ID`,
--
Gitblit v1.9.3