9 changed files with 359 additions and 2 deletions
-
39src/main/java/com/xujie/sys/modules/pms/controller/EamReportController.java
-
171src/main/java/com/xujie/sys/modules/pms/data/EamObjectSumReportData.java
-
20src/main/java/com/xujie/sys/modules/pms/mapper/EamMapper.java
-
26src/main/java/com/xujie/sys/modules/pms/mapper/EamReportMapper.java
-
19src/main/java/com/xujie/sys/modules/pms/service/EamReportService.java
-
24src/main/java/com/xujie/sys/modules/pms/service/Impl/EamReportServiceImpl.java
-
10src/main/java/com/xujie/sys/modules/pms/service/Impl/EamServiceImpl.java
-
10src/main/resources/mapper/pms/EamMapper.xml
-
42src/main/resources/mapper/pms/EamReportMapper.xml
@ -0,0 +1,39 @@ |
|||||
|
package com.xujie.sys.modules.pms.controller; |
||||
|
|
||||
|
import com.xujie.sys.common.utils.PageUtils; |
||||
|
import com.xujie.sys.common.utils.R; |
||||
|
import com.xujie.sys.modules.pms.data.EamFamilyData; |
||||
|
import com.xujie.sys.modules.pms.data.EamObjectSumReportData; |
||||
|
import com.xujie.sys.modules.pms.service.EamReportService; |
||||
|
import com.xujie.sys.modules.pms.service.EamService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* @Classname EamReportController |
||||
|
* @Description 设备报表模块 |
||||
|
* @Date 2023/2/16 17:24 |
||||
|
* @Created by rq |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("/pms/eamReport") |
||||
|
public class EamReportController { |
||||
|
@Autowired |
||||
|
private EamReportService eamReportService; |
||||
|
/** |
||||
|
* @Description TODO |
||||
|
* @Title eamFamilySearch |
||||
|
* @param data |
||||
|
* @author rq |
||||
|
* @date 2023/3/30 16:49 |
||||
|
* @return R |
||||
|
* @throw |
||||
|
*/ |
||||
|
@PostMapping(value="/searchEamObjectSumReport") |
||||
|
@ResponseBody |
||||
|
public R searchEamObjectSumReport(@RequestBody EamObjectSumReportData data){ |
||||
|
PageUtils page = eamReportService.searchEamObjectSumReport(data); |
||||
|
return R.ok().put("page", page); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,171 @@ |
|||||
|
package com.xujie.sys.modules.pms.data; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.xujie.sys.common.utils.QueryPage; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.type.Alias; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
@Alias("EamObjectSumReportData") |
||||
|
public class EamObjectSumReportData extends QueryPage { |
||||
|
private String site; |
||||
|
private String objectID; |
||||
|
private String objectDesc; |
||||
|
private String operator; |
||||
|
private String operatorName; |
||||
|
private String functionType; |
||||
|
private Integer qtyAll; |
||||
|
private Integer qtyFinished; |
||||
|
private Integer qtyUnFinishied; |
||||
|
private Integer qtycancelled; |
||||
|
private Double finishPercent; |
||||
|
|
||||
|
private String familyID; |
||||
|
private String groupID; |
||||
|
private String familyDesc; |
||||
|
private String groupDesc; |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
private Date startDate; |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
private Date endDate; |
||||
|
|
||||
|
public String getSite() { |
||||
|
return site; |
||||
|
} |
||||
|
|
||||
|
public void setSite(String site) { |
||||
|
this.site = site; |
||||
|
} |
||||
|
|
||||
|
public String getObjectID() { |
||||
|
return objectID; |
||||
|
} |
||||
|
|
||||
|
public void setObjectID(String objectID) { |
||||
|
this.objectID = objectID; |
||||
|
} |
||||
|
|
||||
|
public String getObjectDesc() { |
||||
|
return objectDesc; |
||||
|
} |
||||
|
|
||||
|
public void setObjectDesc(String objectDesc) { |
||||
|
this.objectDesc = objectDesc; |
||||
|
} |
||||
|
|
||||
|
public String getOperator() { |
||||
|
return operator; |
||||
|
} |
||||
|
|
||||
|
public void setOperator(String operator) { |
||||
|
this.operator = operator; |
||||
|
} |
||||
|
|
||||
|
public String getOperatorName() { |
||||
|
return operatorName; |
||||
|
} |
||||
|
|
||||
|
public void setOperatorName(String operatorName) { |
||||
|
this.operatorName = operatorName; |
||||
|
} |
||||
|
|
||||
|
public String getFunctionType() { |
||||
|
return functionType; |
||||
|
} |
||||
|
|
||||
|
public void setFunctionType(String functionType) { |
||||
|
this.functionType = functionType; |
||||
|
} |
||||
|
|
||||
|
public Integer getQtyAll() { |
||||
|
return qtyAll; |
||||
|
} |
||||
|
|
||||
|
public void setQtyAll(Integer qtyAll) { |
||||
|
this.qtyAll = qtyAll; |
||||
|
} |
||||
|
|
||||
|
public Integer getQtyFinished() { |
||||
|
return qtyFinished; |
||||
|
} |
||||
|
|
||||
|
public void setQtyFinished(Integer qtyFinished) { |
||||
|
this.qtyFinished = qtyFinished; |
||||
|
} |
||||
|
|
||||
|
public Integer getQtyUnFinishied() { |
||||
|
return qtyUnFinishied; |
||||
|
} |
||||
|
|
||||
|
public void setQtyUnFinishied(Integer qtyUnFinishied) { |
||||
|
this.qtyUnFinishied = qtyUnFinishied; |
||||
|
} |
||||
|
|
||||
|
public Integer getQtycancelled() { |
||||
|
return qtycancelled; |
||||
|
} |
||||
|
|
||||
|
public void setQtycancelled(Integer qtycancelled) { |
||||
|
this.qtycancelled = qtycancelled; |
||||
|
} |
||||
|
|
||||
|
public Double getFinishPercent() { |
||||
|
return finishPercent; |
||||
|
} |
||||
|
|
||||
|
public void setFinishPercent(Double finishPercent) { |
||||
|
this.finishPercent = finishPercent; |
||||
|
} |
||||
|
|
||||
|
public String getFamilyID() { |
||||
|
return familyID; |
||||
|
} |
||||
|
|
||||
|
public void setFamilyID(String familyID) { |
||||
|
this.familyID = familyID; |
||||
|
} |
||||
|
|
||||
|
public String getGroupID() { |
||||
|
return groupID; |
||||
|
} |
||||
|
|
||||
|
public void setGroupID(String groupID) { |
||||
|
this.groupID = groupID; |
||||
|
} |
||||
|
|
||||
|
public Date getStartDate() { |
||||
|
return startDate; |
||||
|
} |
||||
|
|
||||
|
public void setStartDate(Date startDate) { |
||||
|
this.startDate = startDate; |
||||
|
} |
||||
|
|
||||
|
public Date getEndDate() { |
||||
|
return endDate; |
||||
|
} |
||||
|
|
||||
|
public void setEndDate(Date endDate) { |
||||
|
this.endDate = endDate; |
||||
|
} |
||||
|
|
||||
|
public String getFamilyDesc() { |
||||
|
return familyDesc; |
||||
|
} |
||||
|
|
||||
|
public void setFamilyDesc(String familyDesc) { |
||||
|
this.familyDesc = familyDesc; |
||||
|
} |
||||
|
|
||||
|
public String getGroupDesc() { |
||||
|
return groupDesc; |
||||
|
} |
||||
|
|
||||
|
public void setGroupDesc(String groupDesc) { |
||||
|
this.groupDesc = groupDesc; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.xujie.sys.modules.pms.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.xujie.sys.modules.pms.data.EamFamilyData; |
||||
|
import com.xujie.sys.modules.pms.data.EamObjectSumReportData; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.springframework.stereotype.Repository; |
||||
|
|
||||
|
@Mapper |
||||
|
@Repository |
||||
|
public interface EamReportMapper { |
||||
|
|
||||
|
/** |
||||
|
* @Description TODO |
||||
|
* @Title searchEamObjectSumReport |
||||
|
* @param page |
||||
|
* @param inData |
||||
|
* @author rq |
||||
|
* @date 2023/3/30 17:51 |
||||
|
* @return IPage<EamObjectSumReportData> |
||||
|
* @throw |
||||
|
*/ |
||||
|
IPage<EamObjectSumReportData> searchEamObjectSumReport(Page<EamObjectSumReportData> page, @Param("query") EamObjectSumReportData inData); |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
package com.xujie.sys.modules.pms.service; |
||||
|
|
||||
|
import com.xujie.sys.common.utils.PageUtils; |
||||
|
import com.xujie.sys.modules.pms.data.EamFamilyData; |
||||
|
import com.xujie.sys.modules.pms.data.EamObjectSumReportData; |
||||
|
|
||||
|
public interface EamReportService { |
||||
|
|
||||
|
/** |
||||
|
* @Description 设备报表 |
||||
|
* @Title searchEamObjectSumReport |
||||
|
* @param inData |
||||
|
* @author rq |
||||
|
* @date 2023/3/30 16:59 |
||||
|
* @return PageUtils |
||||
|
* @throw |
||||
|
*/ |
||||
|
PageUtils searchEamObjectSumReport(EamObjectSumReportData inData); |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.xujie.sys.modules.pms.service.Impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.xujie.sys.common.utils.PageUtils; |
||||
|
import com.xujie.sys.modules.pms.data.EamFamilyData; |
||||
|
import com.xujie.sys.modules.pms.data.EamObjectSumReportData; |
||||
|
import com.xujie.sys.modules.pms.mapper.EamReportMapper; |
||||
|
import com.xujie.sys.modules.pms.service.EamReportService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
@Service |
||||
|
public class EamReportServiceImpl implements EamReportService { |
||||
|
@Autowired |
||||
|
private EamReportMapper eamReportMapper; |
||||
|
|
||||
|
@Override |
||||
|
public PageUtils searchEamObjectSumReport(EamObjectSumReportData inData){ |
||||
|
IPage<EamObjectSumReportData> eamFamilyList = this.eamReportMapper.searchEamObjectSumReport( |
||||
|
new Page<EamObjectSumReportData>(inData.getPage(), inData.getLimit()), inData); |
||||
|
return new PageUtils(eamFamilyList); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,42 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.xujie.sys.modules.pms.mapper.EamReportMapper"> |
||||
|
<select id="searchEamObjectSumReport" resultType="EamObjectSumReportData"> |
||||
|
select a.Site,a.ObjectID,a.ObjectDesc,a.FamilyID,c.FamilyDesc,a.GroupID,d.GroupDesc,sum(qtyAll) qtyAll |
||||
|
,sum(qtyFinished) qtyFinished,sum(qtyUnFinishied) qtyUnFinishied,sum(qtycancelled) qtycancelled |
||||
|
, Round(sum(qtyFinished) *100.0/sum(qtyAll),2) as finishPercent |
||||
|
from ( |
||||
|
select a.Site,a.ObjectID,b.ObjectDesc,b.FamilyID,b.GroupID,1 as qtyAll,case WHEN a.Status='已完工' then 1 else 0 end as qtyFinished, case WHEN a.Status='未开工' then 1 else 0 end as qtyUnFinishied, case WHEN a.Status='已取消' then 1 else 0 end as qtycancelled |
||||
|
from eam_workOrder a left join eam_object b on a.Site=b.Site and a.ObjectID =b.ObjectID |
||||
|
<where> |
||||
|
<if test="query.site != null and query.site != ''"> |
||||
|
AND site = #{query.site} |
||||
|
</if> |
||||
|
<if test="query.objectID != null and query.objectID != ''"> |
||||
|
AND a.ObjectID like '%' + #{query.objectID} +'%' |
||||
|
</if> |
||||
|
<if test="query.objectDesc != null and query.objectDesc != ''"> |
||||
|
AND b.ObjectDesc like '%' + #{query.objectDesc} +'%' |
||||
|
</if> |
||||
|
<if test="query.familyID != null and query.familyID != ''"> |
||||
|
AND b.FamilyID like '%' + #{query.familyID}+'%' |
||||
|
</if> |
||||
|
<if test="query.groupID != null and query.groupID != ''"> |
||||
|
AND b.GroupID = #{query.groupID} |
||||
|
</if> |
||||
|
<if test="query.startDate != null "> |
||||
|
AND a.PlanDate >= #{query.startDate} |
||||
|
</if> |
||||
|
<if test="query.endDate != null "> |
||||
|
AND #{query.endDate} >= a.PlanDate |
||||
|
</if> |
||||
|
</where> |
||||
|
|
||||
|
) a left join eam_family c on a.Site=c.Site and a.FamilyID=c.FamilyID |
||||
|
left join eam_group d on a.Site=d.Site and a.GroupID=d.GroupID |
||||
|
|
||||
|
Group by a.Site,a.ObjectID,a.ObjectDesc,a.FamilyID,c.FamilyDesc,a.GroupID,d.GroupDesc |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue