Commit da2fd0e2 authored by 竹天卫's avatar 竹天卫

产值功能

parent dad5859d
package cn.wise.sc.cement.business.controller;
import cn.wise.sc.cement.business.entity.NonStandardApply;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.NonStandardApplyQuery;
......
......@@ -40,10 +40,9 @@ public class NonStandardValueController {
@Autowired
private INonStandardValueService inonStandardValueService;
@ApiOperation(value = "非标产值分页")
@GetMapping("/getPage")
public BaseResponse getPage(PageQuery pageQuery, Integer userId, String name,String start, String end) {
try {
@GetMapping("/user_id")
@ApiOperation("产值统计-非标产值")
public BaseResponse nonValue(PageQuery pageQuery, String start, String end, Integer groups,String name) {
Date startParse = null;
if (StrUtil.isNotBlank(start)) {
startParse = DateUtil.parse(start);
......@@ -52,16 +51,20 @@ public class NonStandardValueController {
if (StrUtil.isNotBlank(end)) {
endParse = DateUtil.parse(end);
}
return inonStandardValueService.getPage(pageQuery, userId, name,startParse,endParse);
} catch (Exception e) {
log.debug("非标产值分页列表{}", e);
//将list拆分成分页
BaseResponse<List<NonStandardValue>> baseResponse = inonStandardValueService.nonValue(startParse, endParse, groups,name);
List<NonStandardValue> data = baseResponse.getData();
if (data.size() != 0) {
Page<NonStandardValue> rts = PageUtil.listConvertToPage(data, pageQuery);
return BaseResponse.okData(rts);
}
return BaseResponse.errorMsg("失败!");
return baseResponse;
}
@GetMapping("/user_id")
@ApiOperation("非标产值统计")
public BaseResponse nonValue(PageQuery pageQuery, String start, String end, Integer groups,String name) {
@ApiOperation(value = "产值统计-非标产值-产看明细")
@GetMapping("/getPage")
public BaseResponse getPage(PageQuery pageQuery, Integer userId, String name,String start, String end) {
try {
Date startParse = null;
if (StrUtil.isNotBlank(start)) {
startParse = DateUtil.parse(start);
......@@ -70,14 +73,11 @@ public class NonStandardValueController {
if (StrUtil.isNotBlank(end)) {
endParse = DateUtil.parse(end);
}
//将list拆分成分页
BaseResponse<List<NonStandardValue>> baseResponse = inonStandardValueService.nonValue(startParse, endParse, groups,name);
List<NonStandardValue> data = baseResponse.getData();
if (data.size() != 0) {
Page<NonStandardValue> rts = PageUtil.listConvertToPage(data, pageQuery);
return BaseResponse.okData(rts);
return inonStandardValueService.getPage(pageQuery, userId, name,startParse,endParse);
} catch (Exception e) {
log.debug("非标产值分页列表{}", e);
}
return baseResponse;
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "获取所有已通过的非标产值")
......@@ -99,21 +99,6 @@ public class NonStandardValueController {
return BaseResponse.errorMsg("失败!");
}
// @ApiOperation(value = "根据用户id查询指定非标产值信息")
// @GetMapping("/{userId}")
// public BaseResponse getByUserId(@PathVariable Integer userId) {
// try {
// BaseResponse<List<NonStandardValueVo>> e = inonStandardValueService.getByUserId(userId);
// if (e == null) {
// return BaseResponse.errorMsg("信息错误!");
// }
// return BaseResponse.okData(e);
// } catch (Exception e) {
// log.debug("通过用户id查询非标产值信息{}", e);
// }
// return BaseResponse.errorMsg("失败!");
// }
@ApiOperation("非标产值信息导出列表")
@PostMapping("/exportList")
public void exportList(String filename, Integer userId, String name, HttpServletResponse response) {
......
package cn.wise.sc.cement.business.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.wise.sc.cement.business.entity.NormProduction;
import cn.wise.sc.cement.business.entity.NormProductionStatistics;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.vo.NormProductionVo;
import cn.wise.sc.cement.business.model.vo.ProductionVo;
import cn.wise.sc.cement.business.model.vo.WorkloadStatisticsVo;
import cn.wise.sc.cement.business.service.INonStandardValueService;
import cn.wise.sc.cement.business.service.INormProductionService;
import cn.wise.sc.cement.business.service.IPrecipriceService;
import cn.wise.sc.cement.business.util.PageUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* <p>
* 前端控制器
* </p>
*
* @author ztw
* @since 2020-11-02
*/
@RestController
@Api(hidden = true)
@RequestMapping("/business/preciprice")
public class PrecipriceController {
@Autowired
IPrecipriceService iNormProductionService;
@Autowired
INonStandardValueService inonStandardValueService;
@GetMapping("/ddd")
@ApiOperation("aaa")
public void add(){
iNormProductionService.createPreciprice(1,1,1,1,1,true);
}
@GetMapping("/statistics")
@ApiOperation("标准产值统计")
public BaseResponse<Page<NormProductionStatistics>> normProductionStatistics(String start, String end, String name, Integer groupId, PageQuery pageQuery) {
Long startTime = null;
Long endTime = null;
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).getTime();
}
//将list拆分成分页
BaseResponse<List<NormProductionStatistics>> baseResponse = iNormProductionService
.normProductionStatistics(startTime, endTime, name, groupId);
if (baseResponse.getCode() == 200) {
List<NormProductionStatistics> data = baseResponse.getData();
if (data.size() != 0) {
Page<NormProductionStatistics> rts = PageUtil.listConvertToPage(data, pageQuery);
return BaseResponse.okData(rts);
}
}
return BaseResponse.okData(null);
}
@GetMapping("/statistics/detail")
@ApiOperation("标准产值详情")
public BaseResponse<Page<NormProduction.NormProductionDetail>> normProductionDetails(Integer userId, String start,
String end, PageQuery pageQuery) {
Long startTime = null;
Long endTime = null;
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).getTime();
}
List<NormProduction.NormProductionDetail> data = iNormProductionService.normProductionDetails(userId, startTime, endTime);
List<NormProduction.NormProductionDetail> collect = data
.stream()
.filter(arg -> arg.getUserId().intValue() == userId)
.collect(Collectors.toList());
if (collect.size() != 0) {
Page<NormProduction.NormProductionDetail> rts = PageUtil.listConvertToPage(collect, pageQuery);
return BaseResponse.okData(rts);
}
return BaseResponse.okData(null);
}
@GetMapping("/total/production")
@ApiOperation("总产值统计")
public BaseResponse<Page<ProductionVo>> production(PageQuery pageQuery, String name, String start, String end, Integer groupId) {
Long startTime = null;
Long endTime = null;
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).getTime();
}
List<ProductionVo> rts = iNormProductionService.production(name, startTime, endTime, groupId);
if (!CollectionUtil.isEmpty(rts)) {
Set<Integer> ids = new HashSet<>();
for (ProductionVo productionVo : rts) {
Integer groupId1 = productionVo.getGroupId();
ids.add(groupId1);
}
List<ProductionVo> newRts = new ArrayList<>();
for (Integer groupId1 : ids) {
ProductionVo finalNormProduction = new ProductionVo();
for (ProductionVo productionVo : rts) {
if (productionVo.getGroupId().intValue() == groupId1) {
finalNormProduction.setUserId(productionVo.getUserId());
finalNormProduction.setUserName(productionVo.getUserName());
finalNormProduction.setAccount(productionVo.getAccount());
finalNormProduction.setPositionId(productionVo.getPositionId());
finalNormProduction.setPosition(productionVo.getPosition());
finalNormProduction.setTime(productionVo.getTime());
finalNormProduction.setGroupId(productionVo.getGroupId());
finalNormProduction.setGroupName(productionVo.getGroupName());
Double newFinalValue = productionVo.getProductionTotalValue() + finalNormProduction.getProductionTotalValue();
finalNormProduction.setProductionTotalValue(newFinalValue);
Double newNonProductionValue = productionVo.getNonProductionValue() + finalNormProduction.getNonProductionValue();
finalNormProduction.setNonProductionValue(newNonProductionValue);
Double newProductionValue = productionVo.getProductionValue() + finalNormProduction.getProductionValue();
finalNormProduction.setProductionValue(newProductionValue);
}
}
newRts.add(finalNormProduction);
}
rts = newRts;
}
return BaseResponse.okData(PageUtil.listConvertToPage(rts, pageQuery));
}
@PostMapping("/export/statistics")
@ApiOperation("导出标准产值列表")
public void exportNormProductionStatistics(String start, String end, String name, Integer groupId, HttpServletResponse response) {
Long startTime = null;
Long endTime = null;
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).getTime();
}
iNormProductionService.exportNormProductionStatistics(startTime, endTime, name, groupId, response);
}
@PostMapping("/export/statistics/detail")
@ApiOperation("导出个人标准产值详情列表")
public void exportNormProductionDetails(Integer userId, String start,
String end, HttpServletResponse response) {
Long startTime = null;
Long endTime = null;
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).getTime();
}
iNormProductionService.exportNormProductionDetail(userId, startTime, endTime, response);
}
@PostMapping("/export/total/production")
@ApiOperation("导出总产值")
public void exportProduction(String name, String start, String end, Integer groupId, HttpServletResponse response) {
Long startTime = null;
Long endTime = null;
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start).getTime();
endTime = DateUtil.parseDate(end).getTime();
}
iNormProductionService.exportProduction(name, startTime, endTime, groupId, response);
}
@GetMapping("/workload/statistics")
@ApiOperation("工作量统计")
public BaseResponse<List<WorkloadStatisticsVo>> workloadStatistics(String start, String end, Integer userId) {
Date startTime = null;
Date endTime = DateUtil.date();
if (StrUtil.isNotBlank(start) && StrUtil.isNotBlank(end)) {
startTime = DateUtil.parseDate(start);
endTime = DateUtil.parseDate(end);
}
return BaseResponse.okData(iNormProductionService.workloadStatistics(startTime, endTime, userId));
}
}
......@@ -36,13 +36,13 @@ public class NormProduction implements Serializable {
/**
* 检查组id
*/
@ApiModelProperty("检查组id")
@ApiModelProperty("对象id")
private Integer assessId;
/**
* 类型 1:检测组 0:处理
* 类型 0:处理项 1:检测组 2:检测
*/
@ApiModelProperty("类型 1:检测组 0:处理项")
@ApiModelProperty("类型 0:处理项 1:检测组 2:检测项")
private Integer type;
/**
......@@ -99,31 +99,43 @@ public class NormProduction implements Serializable {
@ApiModelProperty("状态")
private Integer status;
/**
* 标准产值详情
* 标准产值-人员详情(对象的数量)
*/
@Data
public static class NormProductionUserDetail implements Serializable{
private static final long serialVersionUID = 42L;
private Integer type;
private String userName;
private Integer objId;
private String objName;
private Integer countNums;
private BigDecimal countPricel;
}
/**
* 标准产值-检测项目详情(对象的具体信息)
*/
@Data
public static class NormProductionDetail implements Serializable{
private static final long serialVersionUID = 42L;
private String userName;
private Integer distributionId;
private Integer userId;
private Integer entrustId;
private Integer assessId;
private LocalDateTime checkTime;
private Double analyseRate;
private Double separateRate;
private Double assessRate;
private Double reportedResultRate;
private String objName;
private String projectName;
private String sampleName;
private String projectCode;
private String entrustCode;
private Integer sampleId;
private BigDecimal workTimeCoefficient;
private Integer type;
private String groupTeamName;
private LocalDateTime checkTime;
private BigDecimal countPricel;
private String cementCode;
}
}
......@@ -45,12 +45,12 @@ public class Preciprice implements Serializable {
private Integer sampleId;
/**
* 检测/处理Id
* 处理/检测组/检测项Id
*/
private Integer targetId;
/**
* 检测:1 处理:0
* 处理:0 检测组:1 检测项:2
*/
private Integer type;
......@@ -112,11 +112,17 @@ public class Preciprice implements Serializable {
/**
* 项目id
*/
private String entrustName;
private String projectName;
/**
* 项目编号
*/
private String projectCode;
/**
* 委托单号
*/
private String entrustCode;
/**
......@@ -137,7 +143,7 @@ public class Preciprice implements Serializable {
private String userName;
/**
* 检测组
* 对象
*/
private String groupTeamName;
/**
......
package cn.wise.sc.cement.business.mapper;
import cn.wise.sc.cement.business.entity.Preciprice;
import cn.wise.sc.cement.business.model.vo.EntrustVo;
import cn.wise.sc.cement.business.model.vo.NormProductionStatisticsVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* <p>
* Mapper 接口
......@@ -15,4 +22,8 @@ import org.apache.ibatis.annotations.Param;
public interface PrecipriceMapper extends BaseMapper<Preciprice> {
void updateStatusByEntrustId(@Param("param") Integer entrustId);
IPage<NormProductionStatisticsVo> getStatisticsPage(@Param("page") Page page, @Param("params") Map<String, Object> params);
List<NormProductionStatisticsVo> getStatisticsList(@Param("params") Map<String, Object> params);
}
......@@ -34,6 +34,9 @@ public interface SampleDistributionMapper extends BaseMapper<SampleDistribution>
List<SampleTeamGroupUserVo> getDistributionTeamGroupList(@Param("sampleId") Integer sampleId,
@Param("userId") Integer userId);
List<SampleCheckGroupVo> getSampleCheckGroupList(@Param("sampleId") Integer sampleId);
List<EntrustSample> getEntrustSample();
......
......@@ -17,7 +17,5 @@ import java.util.List;
*/
public interface TeamGroupMapper extends BaseMapper<TeamGroup> {
@Select("select id, name from team_group")
List<SummaryVo> fetchList();
}
......@@ -43,6 +43,7 @@ public interface TeamMapper extends BaseMapper<Team> {
SummaryListVo getSummaryList2();
List<Integer> getIdForGroup(Integer groupId);
......
......@@ -3,8 +3,91 @@
<mapper namespace="cn.wise.sc.cement.business.mapper.PrecipriceMapper">
<update id="updateStatusByEntrustId">
UPDATE preciprice SET `status` =1 WHERE entrust_id = #{param}
</update>
<select id="getStatisticsPage" resultType="cn.wise.sc.cement.business.model.vo.NormProductionStatisticsVo">
select
su.id as userId,su.name as userName, su.username as account,
(
CASE su.sex
WHEN 0 THEN '女'
WHEN 1 THEN '男'
ELSE NULL
END
) as sex,
(select count(*) from preciprice pp where pp.user_id = su.id
<if test="params.startDate != null">
and pp.create_time &gt;= #{params.startDate}
</if>
<if test="params.endDate != null">
and pp.create_time &lt;= #{params.endDate}
</if>
) as count,
(select IF(ISNULL(sum(pp.preciprice)),0,sum(pp.preciprice)) from preciprice pp where pp.user_id = su.id
<if test="params.startDate != null">
and pp.create_time &gt;= #{params.startDate}
</if>
<if test="params.endDate != null">
and pp.create_time &lt;= #{params.endDate}
</if>
) as coefficient
from sys_user su
left join sys_group sg on sg.id = su.group_id
where su.is_delete = 1 and sg.name = '实验室组'
<if test="params.userName != null and params.userName != ''">
and su.name like concat('%', #{params.userName}, '%')
</if>
<if test="params.userId != null">
and su.id = #{params.userId}
</if>
<if test="params.groupId != null">
and su.group_id = #{params.groupId}
</if>
order by su.id asc
</select>
<select id="getStatisticsList" resultType="cn.wise.sc.cement.business.model.vo.NormProductionStatisticsVo">
select
su.id as userId,su.name as userName, su.username as account,
(
CASE su.sex
WHEN 0 THEN '女'
WHEN 1 THEN '男'
ELSE NULL
END
) as sex,
(select count(*) from preciprice pp where pp.user_id = su.id
<if test="params.startDate != null">
and pp.create_time &gt;= #{params.startDate}
</if>
<if test="params.endDate != null">
and pp.create_time &lt;= #{params.endDate}
</if>
) as count,
(select IF(ISNULL(sum(pp.preciprice)),0,sum(pp.preciprice)) from preciprice pp where pp.user_id = su.id
<if test="params.startDate != null">
and pp.create_time &gt;= #{params.startDate}
</if>
<if test="params.endDate != null">
and pp.create_time &lt;= #{params.endDate}
</if>
) as coefficient
from sys_user su
left join sys_group sg on sg.id = su.group_id
where su.is_delete = 1 and sg.name = '实验室组'
<if test="params.userName != null and params.userName != ''">
and su.name like concat('%', #{params.userName}, '%')
</if>
<if test="params.userId != null">
and su.id = #{params.userId}
</if>
<if test="params.groupId != null">
and su.group_id = #{params.groupId}
</if>
order by su.id asc
</select>
</mapper>
......@@ -104,21 +104,18 @@
</select>
<select id="getDistributionTeamGroupList" resultType="cn.wise.sc.cement.business.model.vo.SampleTeamGroupUserVo">
select su.id as userId,
t.team_group_id as teamGroupId
select
t.user_id as userId,
t.team_group_id as teamGroupId,
t.team_id as teamId
from sample_distribution t
left join sys_user su on su.id = t.user_id
left join team s on s.id = t.team_id
left join team_group tg on tg.id = t.team_group_id
where t.sample_id = #{sampleId}
<if test="userId != null">
and t.user_id = #{userId}
</if>
group by t.team_group_id
group by t.team_group_id,t.team_id
</select>
<select id="getSampleCheckGroupList" resultType="cn.wise.sc.cement.business.model.vo.SampleCheckGroupVo">
......
......@@ -137,4 +137,21 @@
</select>
<select id="getIdForGroup" resultType="java.lang.Integer">
select t.id as name from team t where t.group_id = #{groupId} order by t.sort_no asc;
</select>
</mapper>
package cn.wise.sc.cement.business.entity;
package cn.wise.sc.cement.business.model.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @description: 标准产值统计对象
* @author: qh
* @create: 2020-09-23 18:18
* @author: ztw
* @create: 2021-03-24
**/
@Data
public class NormProductionStatistics implements Serializable {
public class NormProductionStatisticsVo implements Serializable {
private static final long serialVersionUID = 42L;
private String userName;
@ApiModelProperty("用户id")
private String userId;
@ApiModelProperty("姓名")
private String userName;
@ApiModelProperty("账户")
private String account;
@ApiModelProperty("性别")
private String sex;
private String position;
private String time;
@ApiModelProperty("检测项目数")
private Long count;
@ApiModelProperty("产值绩效")
private Double coefficient;
private Integer groupId;
private String groupName;
}
......@@ -22,13 +22,13 @@ public class NormProductionVo {
/**
* 检查组id
*/
@ApiModelProperty("检查组id")
@ApiModelProperty("对象id")
private Integer assessId;
/**
* 类型 1:检测组 0:处理
* 类型 0:处理项 1:检测组 2:检测
*/
@ApiModelProperty("类型 1:检测组 0:处理项")
@ApiModelProperty("类型 0:处理项 1:检测组 2:检测项")
private String type;
/**
......
......@@ -8,8 +8,8 @@ import java.io.Serializable;
/**
* @description:
* @author: qh
* @create: 2020-09-30 14:16
* @author: ztw
* @create: 2021-03-24
**/
@Data
@ApiModel("总产值统计")
......@@ -19,26 +19,26 @@ public class ProductionVo implements Serializable {
/**
* 主键
*/
private Integer id;
@ApiModelProperty("用户id")
private String userId;
@ApiModelProperty("用户名")
@ApiModelProperty("姓名")
private String userName;
@ApiModelProperty("账号")
@ApiModelProperty("账户")
private String account;
@ApiModelProperty("职位id")
private Integer positionId;
@ApiModelProperty("职位")
private String position;
@ApiModelProperty("统计时间")
private String time;
@ApiModelProperty("性别")
private String sex;
@ApiModelProperty("标准产值")
private Double productionValue = 0D;
@ApiModelProperty("非标准产值")
@ApiModelProperty("非标产值")
private Double nonProductionValue = 0D;
@ApiModelProperty("总产值")
@ApiModelProperty("产值合计")
private Double productionTotalValue = 0D;
@ApiModelProperty("部门id")
private Integer groupId;
@ApiModelProperty("部门名")
private String groupName;
}
......@@ -21,6 +21,9 @@ public class SampleTeamGroupUserVo {
@ApiModelProperty("检测组id")
private Integer teamGroupId;
@ApiModelProperty("检测项id")
private Integer teamId;
}
......@@ -3,7 +3,6 @@ package cn.wise.sc.cement.business.service;
import cn.wise.sc.cement.business.entity.NonStandardValue;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.vo.NonStandardApplyVo;
import cn.wise.sc.cement.business.model.vo.NonStandardValueVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
......@@ -29,19 +28,9 @@ public interface INonStandardValueService extends IService<NonStandardValue> {
*/
BaseResponse<IPage<NonStandardValueVo>> getPage(PageQuery pageQuery, Integer userId, String name,Date startParse,Date endParse);
/* //计算每个用户提交的非标产值
BaseResponse<List<NonStandardValue>> nonValue(Integer userId);*/
//计算每个用户提交的非标产值
BaseResponse<List<NonStandardValue>> nonValue(Date start, Date end, Integer groups,String name);
// /**
// * 通过用户id查询非标产值信息
// *
// * @return List
// */
// BaseResponse<List<NonStandardValueVo>> getByUserId(Integer userId);
/**
* 获取所有非标产值信息
......
package cn.wise.sc.cement.business.service;
import cn.wise.sc.cement.business.entity.NormProduction;
import cn.wise.sc.cement.business.entity.NormProductionStatistics;
import cn.wise.sc.cement.business.model.vo.NormProductionStatisticsVo;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.vo.NormProductionVo;
......@@ -24,102 +24,15 @@ import java.util.List;
*/
public interface INormProductionService extends IService<NormProduction> {
/**
* 创建新的标准产值配置
*
* @param normProduction 标准产值
* @return BaseResponse
*/
BaseResponse<NormProduction> addObj(NormProduction normProduction);
/**
* 分页查询
*
* @param pageQuery 分页条件
* @return 数据
*/
BaseResponse<IPage<NormProductionVo>> getPage(PageQuery pageQuery);
BaseResponse<NormProduction> addObj(NormProduction normProduction);
/**
* 编辑标准产值
*
* @param production 标准产值
* @return bool
*/
BaseResponse<Boolean> edit(NormProduction production);
/**
* 启用禁用标准产值
*
* @param id id
* @return bool
*/
BaseResponse<Integer> activeOrForbidden(Integer id);
/**
* 标准产值统计
*
* @param start 开始时间
* @param end 结束时间
* @param groupId 部门id
* @return BaseResponse
*/
BaseResponse<List<NormProductionStatistics>> normProductionStatistics(Long start, Long end, String name, Integer groupId);
BaseResponse<IPage<NormProductionVo>> getPage(PageQuery pageQuery, Integer type);
/**
* 标准产值统计 单人详情
*
* @param userId 用户id
* @param start 开始时间
* @param end 结束时间
* @return 详细信息
*/
List<NormProduction.NormProductionDetail> normProductionDetails(Integer userId,
Long start, Long end);
/**
* 总产值统计
*
* @param name 用户
* @param start 开始时间
* @param end 结束时间
* @return 详细信息
*/
List<ProductionVo> production(String name,Long start,Long end,Integer groupId);
/**
* 导出标准统计
* @param start 开始时间
* @param end 结束时间
* @param name 人员名字
* @param groupId 部门id
* @param response 响应体
*/
void exportNormProductionStatistics(Long start, Long end,String name,Integer groupId, HttpServletResponse response);
/**
* 导出个人标准产值详情列表
* @param userId 用户id
* @param startTime 开始时间
* @param endTime 结束时间
* @param response 响应体
*/
void exportNormProductionDetail(Integer userId, Long startTime, Long endTime, HttpServletResponse response);
BaseResponse<Integer> activeOrForbidden(Integer id);
/**
* 导出产值总统计列表
* @param name 名字检索
* @param startTime 开始时间
* @param endTime 结束时间
* @param response 响应体
*/
void exportProduction(String name, Long startTime, Long endTime,Integer groupId,HttpServletResponse response);
/**
* 统计工作量
* @param startTime 开始时间
* @param endTime 结束时间
* @return 统计对象
*/
List<WorkloadStatisticsVo> workloadStatistics(Date startTime, Date endTime,Integer userId);
}
package cn.wise.sc.cement.business.service;
import cn.wise.sc.cement.business.entity.NormProduction;
import cn.wise.sc.cement.business.entity.NormProductionStatistics;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.vo.NormProductionStatisticsVo;
import cn.wise.sc.cement.business.entity.Preciprice;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.vo.ProductionVo;
import cn.wise.sc.cement.business.model.vo.WorkloadStatisticsVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
......@@ -25,82 +26,16 @@ public interface IPrecipriceService extends IService<Preciprice> {
final Integer targetId, final Integer type,
final Integer sampleId, boolean isUrgent);
/**
* 标准产值统计
*
* @param start 开始时间
* @param end 结束时间
* @param groupId 部门id
* @return BaseResponse
*/
BaseResponse<List<NormProductionStatistics>> normProductionStatistics(Long start, Long end, String name, Integer groupId);
/**
* 标准产值统计 单人详情
*
* @param userId 用户id
* @param start 开始时间
* @param end 结束时间
* @return 详细信息
*/
List<NormProduction.NormProductionDetail> normProductionDetails(Integer userId,
Long start, Long end);
/**
* 总产值统计
*
* @param name 用户
* @param start 开始时间
* @param end 结束时间
* @return 详细信息
*/
List<ProductionVo> production(String name, Long start, Long end, Integer groupId);
/**
* 导出标准统计
*
* @param start 开始时间
* @param end 结束时间
* @param name 人员名字
* @param groupId 部门id
* @param response 响应体
*/
void exportNormProductionStatistics(Long start, Long end, String name, Integer groupId, HttpServletResponse response);
BaseResponse<IPage<NormProductionStatisticsVo>> normProductionStatistics(PageQuery pageQuery, String startDate, String endDate, String userName);
BaseResponse<List<NormProductionStatisticsVo>> statisticsList(String startDate, String endDate,String userName);
/**
* 导出个人标准产值详情列表
*
* @param userId 用户id
* @param startTime 开始时间
* @param endTime 结束时间
* @param response 响应体
*/
void exportNormProductionDetail(Integer userId, Long startTime, Long endTime, HttpServletResponse response);
BaseResponse<IPage<NormProduction.NormProductionUserDetail>>normProductionDetails(PageQuery pageQuery, String startDate, String endDate, Integer userId);
/**
* 导出产值总统计列表
*
* @param name 名字检索
* @param startTime 开始时间
* @param endTime 结束时间
* @param response 响应体
*/
void exportProduction(String name, Long startTime, Long endTime, Integer groupId, HttpServletResponse response);
BaseResponse<IPage<NormProduction.NormProductionDetail>>normProductionSpecificDetails(PageQuery pageQuery,
String startDate, String endDate, Integer userId, Integer type, Integer objId);
/**
* 统计工作量
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return 统计对象
*/
List<WorkloadStatisticsVo> workloadStatistics(Date startTime, Date endTime, Integer userId);
List<ProductionVo> production(String name, Long start, Long end, Integer groupId);
/**
* 根据报告id更新
*
* @param entrustId
* @return
*/
boolean updateStatusByEntrustId(Integer entrustId);
}
......@@ -141,6 +141,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
private ITeamService teamService;
@Resource
private ISampleDistributionService sampleDistributionService;
@Resource
private NormProductionMapper normProductionMapper;
/**
* 委托分页
......@@ -1451,7 +1453,6 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
sampleHandleEnclosureMapper.insert(sampleHandleEnclosure);*/
//获取产值信息
QueryWrapper<NormProduction> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("assess_id", handle.getId());
queryWrapper.eq("type", 0);
queryWrapper.eq("status", 1);
List<NormProduction> normProduction = iNormProductionService.list(queryWrapper);
......@@ -1460,7 +1461,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
sampleMapper.deleteBatchIds(sampleList);
//还原本所编号最大值
redisUtil.setString("maxCementCode", redisMaxCementCode);
return BaseResponse.errorMsg("请配置处理项名称为" + handle.getName() + "的产值信息!");
return BaseResponse.errorMsg("请配置处理项的产值信息!");
}
}
//消息推送
......@@ -1601,7 +1602,6 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
//获取产值信息
QueryWrapper<NormProduction> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("assess_id", handle.getId());
queryWrapper.eq("type", 0);
queryWrapper.eq("status", 1);
List<NormProduction> normProduction = iNormProductionService.list(queryWrapper);
......@@ -1610,7 +1610,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
sampleMapper.deleteBatchIds(sampleList);
//还原本所编号最大值
// redisUtil.setString("maxCementCode", redisMaxCementCode);
return BaseResponse.errorMsg("请配置处理项名称为" + handle.getName() + "的产值信息!");
return BaseResponse.errorMsg("请配置处理项的产值信息!");
}
}
//消息推送
......@@ -2078,12 +2078,22 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
//计算产值
if (sampleHandle.getHandleId() != null) {
try {
iPrecipriceService.createPreciprice(sampleHandle.getUserId(), entrust.getId(), sampleHandle.getHandleId(), 0, sample.getId(), false);
//判断该样品是否已经计算产值,如果参与过计算不进行再次的产值计算
QueryWrapper<Preciprice> ppWrapper = new QueryWrapper<>();
ppWrapper.eq("type", 0);
ppWrapper.eq("entrust_id", entrust.getId());
ppWrapper.eq("sample_id", sample.getId());
ppWrapper.eq("user_id", sampleHandle.getUserId());
List<Preciprice> ppList = iPrecipriceService.list(ppWrapper);
if(ppList == null || ppList.size()==0){
iPrecipriceService.createPreciprice(sampleHandle.getUserId(), entrust.getId(), null, 0, sample.getId(), false);
}
} catch (Exception e) {
System.out.println(e.getMessage());
return BaseResponse.errorMsg(e.getMessage());
}
}
QueryWrapper<SampleHandle> sampleHandleWrapper = new QueryWrapper<>();
sampleHandleWrapper.eq("sample_id", sample.getId());
sampleHandleWrapper.ne("status", 2);
......@@ -2485,10 +2495,21 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
queryWrapper.eq("type", 1);
queryWrapper.eq("status", 1);
List<NormProduction> normProduction = iNormProductionService.list(queryWrapper);
if (normProduction == null || normProduction.size() != 1) {
if (normProduction == null || normProduction.size() == 0 ) {
//获取产值信息
QueryWrapper<NormProduction> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("assess_id", distributionTeamQuery.getTeamId());
queryWrapper2.eq("type", 2);
queryWrapper2.eq("status", 1);
List<NormProduction> normProduction2 = iNormProductionService.list(queryWrapper2);
TeamGroup teamGroup = teamGroupMapper.selectById(distributionTeamQuery.getTeamGroupId());
return BaseResponse.errorMsg("联系管理员.配置检测组名称为" + teamGroup.getName() + "产值信息!");
Team team = teamMapper.selectById(distributionTeamQuery.getTeamId());
if (normProduction2 == null || normProduction2.size() == 0 ) {
return BaseResponse.errorMsg("联系管理员.配置检测组名称为" + teamGroup.getName() + "或者检测项名称为"+ team.getName() +"产值信息!");
}
}
//消息推送
BaseResponse wrapper = userMessageService.sendMessage(distributionTeamQuery.getUserId(), "您有一条样品检测信息等待检测", entrust.getId(), SysUserMessage.MessageType.ENTRUST);
if (wrapper.getCode() != 200) {
......@@ -2895,12 +2916,53 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
//计算产值
List<SampleTeamGroupUserVo> sampleDistributionTeamGroupVoList = distributionMapper.getDistributionTeamGroupList(sample.getId(), loginUser.getId());
if (sampleDistributionTeamGroupVoList != null && sampleDistributionTeamGroupVoList.size() > 0) {
List<Integer> teamGroupIdList = new ArrayList<>();
for (SampleTeamGroupUserVo sdVo : sampleDistributionTeamGroupVoList) {
try {
if (sdVo.getTeamGroupId() == null) {
return BaseResponse.errorMsg("当前登录人没有该样品的检测权限");
}
//先判断该检测是按照检测组计算产值 还是按照检测项计算产值
//如果时按照检测项,直接计算,如果是按照检测组,则需要判断检测组是否计算过,去除重复的检测组计算。
//然后判断是否已经参与过产值计算,如果参与过,不用再进行计算
//判断检测组是否配置
QueryWrapper<NormProduction> qw = new QueryWrapper<>();
qw.eq("type", 1);
qw.eq("assess_id", sdVo.getTeamGroupId());
List<NormProduction> npList = normProductionMapper.selectList(qw);
if (npList != null && npList.size() > 0) {
//判断该样品是否已经计算产值,如果参与过计算不进行再次的产值计算
QueryWrapper<Preciprice> ppWrapper = new QueryWrapper<>();
ppWrapper.eq("type", 1);
ppWrapper.eq("entrust_id", entrust.getId());
ppWrapper.eq("sample_id", sample.getId());
ppWrapper.eq("target_id", sdVo.getTeamGroupId());
ppWrapper.eq("user_id", sdVo.getUserId());
List<Preciprice> ppList = iPrecipriceService.list(ppWrapper);
if(ppList == null || ppList.size()==0){
iPrecipriceService.createPreciprice(sdVo.getUserId(), entrust.getId(), sdVo.getTeamGroupId(), 1, sample.getId(), false);
}
}else{
QueryWrapper<NormProduction> qw2 = new QueryWrapper<>();
qw2.eq("type", 2);
qw2.eq("assess_id", sdVo.getTeamId());
List<NormProduction> npList2 = normProductionMapper.selectList(qw2);
if (npList2 != null && npList2.size() > 0) {
//判断该样品是否已经计算产值,如果参与过计算不进行再次的产值计算
QueryWrapper<Preciprice> ppWrapper = new QueryWrapper<>();
ppWrapper.eq("type", 2);
ppWrapper.eq("entrust_id", entrust.getId());
ppWrapper.eq("sample_id", sample.getId());
ppWrapper.eq("target_id", sdVo.getTeamId());
ppWrapper.eq("user_id", sdVo.getUserId());
List<Preciprice> ppList = iPrecipriceService.list(ppWrapper);
if(ppList == null || ppList.size()==0){
iPrecipriceService.createPreciprice(sdVo.getUserId(), entrust.getId(), sdVo.getTeamId(), 2, sample.getId(), false);
}
}
}
} catch (Exception e) {
return BaseResponse.errorMsg(e.getMessage());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment