Commit 477f2972 authored by 竹天卫's avatar 竹天卫

模板导出整理完成

parent 44414469
...@@ -51,16 +51,16 @@ public class EntrustController { ...@@ -51,16 +51,16 @@ public class EntrustController {
"3样品处理中,4样品处理完成," + "3样品处理中,4样品处理完成," +
"5样品检测中,6样品检测完成," + "5样品检测中,6样品检测完成," +
"7校核中,8校核完成)", paramType = "query", dataType = "Integer"), "7校核中,8校核完成)", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "clientId", value = "委托单位id", paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "clientName", value = "委托单位id", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "projectCode", value = "项目编号", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "projectCode", value = "项目编号", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "isUrgent", value = "(1加急,0不加急)", paramType = "query", dataType = "Integer") @ApiImplicitParam(name = "isUrgent", value = "(1加急,0不加急)", paramType = "query", dataType = "Integer")
}) })
@GetMapping("/getPage") @GetMapping("/getPage")
public BaseResponse getPage(PageQuery pageQuery, String startDate, String endDate, Integer status, public BaseResponse getPage(PageQuery pageQuery, String startDate, String endDate, Integer status,
Integer clientId, String projectName, String projectCode, Integer isUrgent) { String clientName, String projectName, String projectCode, Integer isUrgent) {
try { try {
return entrustService.getPage(pageQuery, startDate, endDate, status, clientId, projectName, projectCode, isUrgent); return entrustService.getPage(pageQuery, startDate, endDate, status, clientName, projectName, projectCode, isUrgent);
} catch (Exception e) { } catch (Exception e) {
log.debug("委托分页列表{}", e); log.debug("委托分页列表{}", e);
} }
......
...@@ -63,8 +63,8 @@ public class PlanConsumablesPurchaseController { ...@@ -63,8 +63,8 @@ public class PlanConsumablesPurchaseController {
@PostMapping("/export/word") @PostMapping("/export/word")
@ApiOperation("消耗品采购计划列表导出(word)") @ApiOperation("消耗品采购计划列表导出(word)")
public void exportWord(HttpServletResponse response){ public void exportWord(String name, String fileName, Integer status, HttpServletResponse response){
consumablesPurchaseService.exportWord(response); consumablesPurchaseService.exportWord(name, fileName, status, response);
} }
@ApiOperation(value = "新增消耗品采购计划") @ApiOperation(value = "新增消耗品采购计划")
......
package cn.wise.sc.cement.business.controller; 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.enumation.FileExt;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.PlanEquipmentMaintainQuery; import cn.wise.sc.cement.business.model.query.PlanEquipmentMaintainQuery;
import cn.wise.sc.cement.business.model.query.PlanEquipmentPurchaseQuery; import cn.wise.sc.cement.business.model.query.PlanEquipmentPurchaseQuery;
import cn.wise.sc.cement.business.model.query.PlanFinishQuery; import cn.wise.sc.cement.business.model.query.PlanFinishQuery;
import cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo;
import cn.wise.sc.cement.business.service.IPlanEquipmentMaintainService; import cn.wise.sc.cement.business.service.IPlanEquipmentMaintainService;
import cn.wise.sc.cement.business.util.WordUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
...@@ -16,6 +22,11 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -16,6 +22,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
...@@ -59,6 +70,14 @@ public class PlanEquipmentMaintainController { ...@@ -59,6 +70,14 @@ public class PlanEquipmentMaintainController {
} }
} }
@ApiOperation("设备维护计划列表导出(word)")
@PostMapping("/export/word")
public void exportWord(String name, String fileName, HttpServletResponse response){
equipmentMaintainService.exportWord(name, fileName, response);
}
@ApiOperation(value = "新增设设备维护计划分页列表") @ApiOperation(value = "新增设设备维护计划分页列表")
@PostMapping("/create") @PostMapping("/create")
public BaseResponse create(@RequestBody PlanEquipmentMaintainQuery query) { public BaseResponse create(@RequestBody PlanEquipmentMaintainQuery query) {
...@@ -114,5 +133,14 @@ public class PlanEquipmentMaintainController { ...@@ -114,5 +133,14 @@ public class PlanEquipmentMaintainController {
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
} }
...@@ -63,8 +63,8 @@ public class PlanEquipmentPurchaseController { ...@@ -63,8 +63,8 @@ public class PlanEquipmentPurchaseController {
@ApiOperation("设备采购计划列表导出(word)") @ApiOperation("设备采购计划列表导出(word)")
@PostMapping("/export/word") @PostMapping("/export/word")
public void exportWord(HttpServletResponse response){ public void exportWord(String name, String fileName, Integer status, HttpServletResponse response){
equipmentPurchaseService.exportWord(response); equipmentPurchaseService.exportWord(name, fileName, status, response);
} }
......
...@@ -59,6 +59,12 @@ public class PlanEquipmentRepairController { ...@@ -59,6 +59,12 @@ public class PlanEquipmentRepairController {
} }
} }
@ApiOperation("设备维修计划列表导出(word)")
@PostMapping("/export/word")
public void exportWord(String name, String fileName, HttpServletResponse response){
equipmentRepairService.exportWord(name, fileName, response);
}
@ApiOperation(value = "新增设备维修计划") @ApiOperation(value = "新增设备维修计划")
@PostMapping("/create") @PostMapping("/create")
public BaseResponse create(@RequestBody PlanEquipmentRepairQuery query) { public BaseResponse create(@RequestBody PlanEquipmentRepairQuery query) {
......
...@@ -63,8 +63,8 @@ public class PlanStandardPurchaseController { ...@@ -63,8 +63,8 @@ public class PlanStandardPurchaseController {
@ApiOperation("标样采购计划列表导出(word)") @ApiOperation("标样采购计划列表导出(word)")
@PostMapping("/export/word") @PostMapping("/export/word")
public void exportWord(HttpServletResponse response) { public void exportWord(String name, String fileName, Integer status, HttpServletResponse response) {
standardPurchaseService.exportWord(response); standardPurchaseService.exportWord(name, fileName, status, response);
} }
......
...@@ -83,8 +83,10 @@ public class SampleController { ...@@ -83,8 +83,10 @@ public class SampleController {
@ApiOperation("样品列表导出(word)") @ApiOperation("样品列表导出(word)")
@PostMapping("/export/word") @PostMapping("/export/word")
public void exportWord(HttpServletResponse response){ public void exportWord(String sampleName, String cementCode,
sampleService.exportWord(response); String fileName,HttpServletResponse response){
sampleService.exportWord(sampleName, cementCode,
fileName,response);
} }
@ApiOperation(value = "样品详情") @ApiOperation(value = "样品详情")
......
...@@ -27,4 +27,6 @@ public interface PlanEquipmentMaintainMapper extends BaseMapper<PlanEquipmentMai ...@@ -27,4 +27,6 @@ public interface PlanEquipmentMaintainMapper extends BaseMapper<PlanEquipmentMai
PlanEquipmentMaintainVo getDetail(Integer id); PlanEquipmentMaintainVo getDetail(Integer id);
List<PlanEquipmentMaintainVo> exportWordList(@Param("params") Map<String, Object> params);
} }
...@@ -27,4 +27,10 @@ public interface PlanEquipmentRepairMapper extends BaseMapper<PlanEquipmentRepai ...@@ -27,4 +27,10 @@ public interface PlanEquipmentRepairMapper extends BaseMapper<PlanEquipmentRepai
PlanEquipmentRepairVo getDetail(Integer id); PlanEquipmentRepairVo getDetail(Integer id);
/**
* @return
*/
List<PlanEquipmentRepairVo> exportWordList(@Param("params") Map<String, Object> params);
} }
...@@ -3,6 +3,7 @@ package cn.wise.sc.cement.business.mapper; ...@@ -3,6 +3,7 @@ package cn.wise.sc.cement.business.mapper;
import cn.wise.sc.cement.business.entity.Sample; import cn.wise.sc.cement.business.entity.Sample;
import cn.wise.sc.cement.business.model.SampleSaveDto; import cn.wise.sc.cement.business.model.SampleSaveDto;
import cn.wise.sc.cement.business.model.SampleWord; import cn.wise.sc.cement.business.model.SampleWord;
import cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo;
import cn.wise.sc.cement.business.model.vo.SampleManageVo; import cn.wise.sc.cement.business.model.vo.SampleManageVo;
import cn.wise.sc.cement.business.model.vo.SampleVo; import cn.wise.sc.cement.business.model.vo.SampleVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -61,5 +62,13 @@ public interface SampleMapper extends BaseMapper<Sample> { ...@@ -61,5 +62,13 @@ public interface SampleMapper extends BaseMapper<Sample> {
List<SampleSaveDto> getSampleSaveList(); List<SampleSaveDto> getSampleSaveList();
List<SampleWord> exportWordList(@Param("start") Date start, @Param("end") Date end); // List<SampleWord> exportWordList(@Param("start") Date start, @Param("end") Date end);
/**
* @return
*/
List<SampleWord> exportWordList(@Param("params") Map<String, Object> params);
} }
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
<if test="params.status != null"> <if test="params.status != null">
and e.status = #{params.status} and e.status = #{params.status}
</if> </if>
<if test="params.clientId != null"> <if test="params.clientName != null and params.clientName != ''">
and e.client_id = #{params.clientId} and c.name like concat('%', #{params.clientName}, '%')
</if> </if>
<if test="params.projectName != null and params.projectName != ''"> <if test="params.projectName != null and params.projectName != ''">
and p.name like concat('%', #{params.projectName}, '%') and p.name like concat('%', #{params.projectName}, '%')
......
...@@ -12,22 +12,7 @@ ...@@ -12,22 +12,7 @@
</if> </if>
</where> </where>
</sql> </sql>
<sql id="whereNew">
<where>
<if test="params.status != null">
and t.status = #{params.status}
</if>
<if test="params.name != null and params.name != ''">
and t.name like concat('%', #{params.name}, '%')
</if>
<if test="params.start !=null">
and t.create_time <![CDATA[>=]]> #{params.start}
</if>
<if test="params.end !=null">
and t.create_time <![CDATA[<=]]> #{params.end}
</if>
</where>
</sql>
<select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.PlanConsumablesPurchaseVo"> <select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.PlanConsumablesPurchaseVo">
...@@ -65,6 +50,23 @@ ...@@ -65,6 +50,23 @@
WHERE t.id = #{id} WHERE t.id = #{id}
</select> </select>
<sql id="whereNew">
<where>
<if test="params.status != null">
and t.status = #{params.status}
</if>
<if test="params.name != null and params.name != ''">
and t.name like concat('%', #{params.name}, '%')
</if>
<if test="params.start !=null">
and t.create_time <![CDATA[>=]]> #{params.start}
</if>
<if test="params.end !=null">
and t.create_time <![CDATA[<=]]> #{params.end}
</if>
</where>
</sql>
<select id="exportWordList" resultType="cn.wise.sc.cement.business.model.vo.PlanConsumablesPurchaseVo"> <select id="exportWordList" resultType="cn.wise.sc.cement.business.model.vo.PlanConsumablesPurchaseVo">
SELECT t.*, su.name as purchaserName SELECT t.*, su.name as purchaserName
FROM plan_consumables_purchase t FROM plan_consumables_purchase t
......
...@@ -47,4 +47,26 @@ ...@@ -47,4 +47,26 @@
WHERE t.id = #{id} WHERE t.id = #{id}
</select> </select>
<sql id="whereNew">
<where>
<if test="params.name != null and params.name != ''">
and t.name like concat('%', #{params.name}, '%')
</if>
<if test="params.start !=null">
and t.create_time <![CDATA[>=]]> #{params.start}
</if>
<if test="params.end !=null">
and t.create_time <![CDATA[<=]]> #{params.end}
</if>
</where>
</sql>
<select id="exportWordList" resultType="cn.wise.sc.cement.business.model.vo.PlanEquipmentMaintainVo">
SELECT t.*, su.name as maintainerName
FROM plan_equipment_maintain t
left join sys_user su on su.id = t.maintainer_id
<include refid="whereNew"/>
ORDER BY t.id DESC
</select>
</mapper> </mapper>
...@@ -13,22 +13,7 @@ ...@@ -13,22 +13,7 @@
</where> </where>
</sql> </sql>
<sql id="whereNew">
<where>
<if test="params.status != null">
and t.status = #{params.status}
</if>
<if test="params.name != null and params.name != ''">
and t.name like concat('%', #{params.name}, '%')
</if>
<if test="params.start !=null">
and t.create_time <![CDATA[>=]]> #{params.start}
</if>
<if test="params.end !=null">
and t.create_time <![CDATA[<=]]> #{params.end}
</if>
</where>
</sql>
<select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo"> <select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo">
SELECT t.*, su.name as purchaserName SELECT t.*, su.name as purchaserName
...@@ -65,6 +50,23 @@ ...@@ -65,6 +50,23 @@
WHERE t.id = #{id} WHERE t.id = #{id}
</select> </select>
<sql id="whereNew">
<where>
<if test="params.status != null">
and t.status = #{params.status}
</if>
<if test="params.name != null and params.name != ''">
and t.name like concat('%', #{params.name}, '%')
</if>
<if test="params.start !=null">
and t.create_time <![CDATA[>=]]> #{params.start}
</if>
<if test="params.end !=null">
and t.create_time <![CDATA[<=]]> #{params.end}
</if>
</where>
</sql>
<select id="exportWordList" resultType="cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo"> <select id="exportWordList" resultType="cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo">
SELECT t.*, su.name as purchaserName SELECT t.*, su.name as purchaserName
FROM plan_equipment_purchase t FROM plan_equipment_purchase t
......
...@@ -46,5 +46,21 @@ ...@@ -46,5 +46,21 @@
WHERE t.id = #{id} WHERE t.id = #{id}
</select> </select>
<sql id="whereNew">
<where>
<if test="params.name != null and params.name != ''">
and t.name like concat('%', #{params.name}, '%')
</if>
</where>
</sql>
<select id="exportWordList" resultType="cn.wise.sc.cement.business.model.vo.PlanEquipmentRepairVo">
SELECT t.*, su.name as repairerName
FROM plan_equipment_repair t
left join sys_user su on su.id = t.repairer_id
<include refid="whereNew"/>
ORDER BY t.id DESC
</select>
</mapper> </mapper>
...@@ -16,23 +16,6 @@ ...@@ -16,23 +16,6 @@
</where> </where>
</sql> </sql>
<sql id="whereNew">
<where>
<if test="params.status != null">
and t.status = #{params.status}
</if>
<if test="params.name != null and params.name != ''">
and t.name like concat('%', #{params.name}, '%')
</if>
<if test="params.start !=null">
and t.create_time <![CDATA[>=]]> #{params.start}
</if>
<if test="params.end !=null">
and t.create_time <![CDATA[<=]]> #{params.end}
</if>
</where>
</sql>
<select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.PlanStandardPurchaseVo"> <select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.PlanStandardPurchaseVo">
SELECT t.*, su.name as purchaserName SELECT t.*, su.name as purchaserName
FROM plan_standard_purchase t FROM plan_standard_purchase t
...@@ -64,6 +47,23 @@ ...@@ -64,6 +47,23 @@
left join sys_user su2 on su2.id = t.user_id left join sys_user su2 on su2.id = t.user_id
WHERE t.id = #{id} WHERE t.id = #{id}
</select> </select>
<sql id="whereNew">
<where>
<if test="params.status != null">
and t.status = #{params.status}
</if>
<if test="params.name != null and params.name != ''">
and t.name like concat('%', #{params.name}, '%')
</if>
<if test="params.start !=null">
and t.create_time <![CDATA[>=]]> #{params.start}
</if>
<if test="params.end !=null">
and t.create_time <![CDATA[<=]]> #{params.end}
</if>
</where>
</sql>
<select id="wordList" resultType="cn.wise.sc.cement.business.model.vo.PlanStandardPurchaseVo"> <select id="wordList" resultType="cn.wise.sc.cement.business.model.vo.PlanStandardPurchaseVo">
SELECT t.*, su.name as purchaserName SELECT t.*, su.name as purchaserName
FROM plan_standard_purchase t FROM plan_standard_purchase t
......
...@@ -23,31 +23,20 @@ ...@@ -23,31 +23,20 @@
<select id="exportList" resultType="java.util.HashMap"> <select id="exportList" resultType="java.util.HashMap">
SELECT SELECT
(@i:=@i+1) as 序号, e.project_name as 项目名称,
e.project_code as 项目编号,
s.name as 样品名称, s.name as 样品名称,
s.cement_code as 样品本所编号, s.sample_form as 样品状态,
e.project_name as 所属项目, s.sample_code as 来样编号,
IF(ISNULL(s.little_position),'',s.little_position) 小样信息, s.cement_code as 本所编号,
IF(ISNULL(s.original_position),'',s.original_position) 原样存储, IF(ISNULL(s.original_position),'',s.original_position) 小样保存位置,
s.weight as 样品重量(kg), IF(ISNULL(s.register_time),'',s.register_time) as 保存日期,
( IF(ISNULL(s.destruction_time),'',s.destruction_time) as 销毁日期,
CASE s.is_parallel IF(ISNULL(su.name),'',su.name) as 批准人,
WHEN 1 THEN '是' IF(ISNULL(s.remark),'',s.remark) as 备注
WHEN 0 THEN '否'
ELSE ''
END
) as 是否为平行样,
(
CASE s.status
WHEN 0 THEN '未领用'
WHEN 1 THEN '已领用'
WHEN 2 THEN '已销毁'
ELSE ''
END
) as 状态
from sample s from sample s
left join entrust e on e.id = s.entrust_id left join entrust e on e.id = s.entrust_id
,(select @i:=0)s left join sys_user su on su.id = s.operator_id
<include refid="where"/> <include refid="where"/>
order by s.create_time desc order by s.create_time desc
</select> </select>
...@@ -85,24 +74,43 @@ ...@@ -85,24 +74,43 @@
ON su.id = s.operator_id ON su.id = s.operator_id
</select> </select>
<sql id="whereNew">
<where>
and s.parallel_code = s.cement_code
<if test="params.sampleName != null and params.sampleName != ''">
and s.name like concat('%', #{params.sampleName}, '%')
</if>
<if test="params.cementCode != null and params.cementCode != ''">
and s.cement_code = #{params.cementCode}
</if>
<if test="params.start !=null">
and s.create_time <![CDATA[>=]]> #{params.start}
</if>
<if test="params.end !=null">
and s.create_time <![CDATA[<=]]> #{params.end}
</if>
</where>
</sql>
<select id="exportWordList" resultType="cn.wise.sc.cement.business.model.SampleWord"> <select id="exportWordList" resultType="cn.wise.sc.cement.business.model.SampleWord">
SELECT SELECT
e.project_name AS project_name, e.project_name AS project_name,
e.entrust_code, e.entrust_code,
s.`name`, s.name,
s.cement_code, s.cement_code,
s.weight, s.weight,
s.original_position, s.original_position,
date_format(s.create_time, '%Y/%m/%d') as create_time, date_format(s.create_time, '%Y/%m/%d') as create_time,
s.remark, s.remark,
date_format(s.destruction_time, '%Y/%m/%d') as destruction_time, date_format(s.destruction_time, '%Y/%m/%d') as destruction_time,
su.`name` AS user_name su.name AS user_name
FROM FROM
`sample` s sample s
LEFT JOIN entrust e ON s.entrust_id = e.id LEFT JOIN entrust e ON s.entrust_id = e.id
LEFT JOIN sys_user su ON su.id = s.operator_id LEFT JOIN sys_user su ON su.id = s.operator_id
where s.create_time <![CDATA[>=]]> #{start} <include refid="whereNew"/>
and s.create_time <![CDATA[<=]]> #{end}
</select> </select>
......
...@@ -69,7 +69,11 @@ public class PlanEquipmentMaintainVo { ...@@ -69,7 +69,11 @@ public class PlanEquipmentMaintainVo {
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
private String createTimeStr;
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;
} }
...@@ -66,6 +66,7 @@ public class PlanEquipmentPurchaseVo { ...@@ -66,6 +66,7 @@ public class PlanEquipmentPurchaseVo {
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;
private String purchaseDateStr;
private String createTimeStr; private String createTimeStr;
} }
...@@ -29,7 +29,7 @@ import java.util.Map; ...@@ -29,7 +29,7 @@ import java.util.Map;
public interface IEntrustService extends IService<Entrust> { public interface IEntrustService extends IService<Entrust> {
BaseResponse<IPage<EntrustVo>> getPage(PageQuery pageQuery, String startDate, String endDate, Integer status, BaseResponse<IPage<EntrustVo>> getPage(PageQuery pageQuery, String startDate, String endDate, Integer status,
Integer clientId, String projectName, String projectCode, Integer isUrgent); String clientName, String projectName, String projectCode, Integer isUrgent);
BaseResponse<String> setTopping(Integer id); BaseResponse<String> setTopping(Integer id);
......
...@@ -39,5 +39,5 @@ public interface IPlanConsumablesPurchaseService extends IService<PlanConsumable ...@@ -39,5 +39,5 @@ public interface IPlanConsumablesPurchaseService extends IService<PlanConsumable
* 导出word * 导出word
* @param response * @param response
*/ */
void exportWord(HttpServletResponse response); void exportWord(String name, String fileName, Integer status, HttpServletResponse response);
} }
...@@ -35,4 +35,6 @@ public interface IPlanEquipmentMaintainService extends IService<PlanEquipmentMai ...@@ -35,4 +35,6 @@ public interface IPlanEquipmentMaintainService extends IService<PlanEquipmentMai
BaseResponse<String> delete(Integer id); BaseResponse<String> delete(Integer id);
void exportWord(String name, String fileName,HttpServletResponse response);
} }
...@@ -35,5 +35,5 @@ public interface IPlanEquipmentPurchaseService extends IService<PlanEquipmentPur ...@@ -35,5 +35,5 @@ public interface IPlanEquipmentPurchaseService extends IService<PlanEquipmentPur
BaseResponse<String> delete(Integer id); BaseResponse<String> delete(Integer id);
void exportWord(HttpServletResponse response); void exportWord(String name, String fileName, Integer status, HttpServletResponse response);
} }
...@@ -36,4 +36,5 @@ public interface IPlanEquipmentRepairService extends IService<PlanEquipmentRepai ...@@ -36,4 +36,5 @@ public interface IPlanEquipmentRepairService extends IService<PlanEquipmentRepai
BaseResponse<String> delete(Integer id); BaseResponse<String> delete(Integer id);
void exportWord(String name, String fileName,HttpServletResponse response);
} }
...@@ -35,5 +35,5 @@ public interface IPlanStandardPurchaseService extends IService<PlanStandardPurch ...@@ -35,5 +35,5 @@ public interface IPlanStandardPurchaseService extends IService<PlanStandardPurch
BaseResponse<String> delete(Integer id); BaseResponse<String> delete(Integer id);
void exportWord(HttpServletResponse response); void exportWord(String name, String fileName, Integer status, HttpServletResponse response);
} }
...@@ -57,5 +57,6 @@ public interface ISampleService extends IService<Sample> { ...@@ -57,5 +57,6 @@ public interface ISampleService extends IService<Sample> {
* 导出样品销毁记录 word * 导出样品销毁记录 word
* @param response * @param response
*/ */
void exportWord(HttpServletResponse response); void exportWord(String sampleName, String cementCode,
String fileName, HttpServletResponse response);
} }
...@@ -135,13 +135,13 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -135,13 +135,13 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
* @param startDate * @param startDate
* @param endDate * @param endDate
* @param status * @param status
* @param clientId * @param clientName
* @param projectName * @param projectName
* @return * @return
*/ */
@Override @Override
public BaseResponse<IPage<EntrustVo>> getPage(PageQuery pageQuery, String startDate, String endDate, Integer status, public BaseResponse<IPage<EntrustVo>> getPage(PageQuery pageQuery, String startDate, String endDate, Integer status,
Integer clientId, String projectName, String projectCode, Integer isUrgent) { String clientName, String projectName, String projectCode, Integer isUrgent) {
LoginUser loginUser = userService.getLoginUser(); LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) { if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号"); return BaseResponse.errorMsg("请登录账号");
...@@ -150,7 +150,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -150,7 +150,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
params.put("startDate", startDate); params.put("startDate", startDate);
params.put("endDate", endDate); params.put("endDate", endDate);
params.put("status", status); params.put("status", status);
params.put("clientId", clientId); params.put("clientName", clientName);
params.put("projectName", projectName); params.put("projectName", projectName);
params.put("projectCode", projectCode); params.put("projectCode", projectCode);
params.put("isUrgent", isUrgent); params.put("isUrgent", isUrgent);
...@@ -427,6 +427,18 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -427,6 +427,18 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
List<EntrustApproval> approvalList = approvalMapper.selectList(approvalWrapper); List<EntrustApproval> approvalList = approvalMapper.selectList(approvalWrapper);
EntrustApproval approval = approvalList.get(0); EntrustApproval approval = approvalList.get(0);
entrustVo.setOpinion(approval.getOpinion()); entrustVo.setOpinion(approval.getOpinion());
//查询报告,如果有上传的委托报告,用户可已进行下载
QueryWrapper<EntityEnclosure> wrapper = new QueryWrapper<>();
wrapper.eq("entity_type", EntityEnclosure.EntityType.ENTRUST_REPORT);
wrapper.eq("entity_id", entrustVo.getId());
wrapper.eq("is_deleted", 1);
List<EntityEnclosure> entityEnclosureList = entityEnclosureMapper.selectList(wrapper);
if(entityEnclosureList != null && entityEnclosureList.size()>0 ){
EntityEnclosure entityEnclosure = entityEnclosureList.get(0);
entrustVo.setAlias(entityEnclosure.getAlias());
entrustVo.setEnclosureUrl(entityEnclosure.getPdfUrl());
entrustVo.setExtName(entityEnclosure.getExtName());
}
} else { } else {
QueryWrapper<SampleTmp> queryWrapper = new QueryWrapper<>(); QueryWrapper<SampleTmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entrust_id", entrustVo.getId()); queryWrapper.eq("entrust_id", entrustVo.getId());
......
...@@ -2,6 +2,7 @@ package cn.wise.sc.cement.business.service.impl; ...@@ -2,6 +2,7 @@ package cn.wise.sc.cement.business.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.wise.sc.cement.business.entity.PlanConsumablesPurchase; import cn.wise.sc.cement.business.entity.PlanConsumablesPurchase;
import cn.wise.sc.cement.business.entity.PlanEquipmentPurchase; import cn.wise.sc.cement.business.entity.PlanEquipmentPurchase;
import cn.wise.sc.cement.business.enumation.FileExt; import cn.wise.sc.cement.business.enumation.FileExt;
...@@ -13,6 +14,7 @@ import cn.wise.sc.cement.business.model.query.PlanConsumablesPurchaseQuery; ...@@ -13,6 +14,7 @@ import cn.wise.sc.cement.business.model.query.PlanConsumablesPurchaseQuery;
import cn.wise.sc.cement.business.model.query.PlanEquipmentPurchaseQuery; import cn.wise.sc.cement.business.model.query.PlanEquipmentPurchaseQuery;
import cn.wise.sc.cement.business.model.query.PlanFinishQuery; import cn.wise.sc.cement.business.model.query.PlanFinishQuery;
import cn.wise.sc.cement.business.model.vo.PlanConsumablesPurchaseVo; import cn.wise.sc.cement.business.model.vo.PlanConsumablesPurchaseVo;
import cn.wise.sc.cement.business.model.vo.PlanEquipmentMaintainVo;
import cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo; import cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo;
import cn.wise.sc.cement.business.service.IPlanConsumablesPurchaseService; import cn.wise.sc.cement.business.service.IPlanConsumablesPurchaseService;
import cn.wise.sc.cement.business.service.ISysUserService; import cn.wise.sc.cement.business.service.ISysUserService;
...@@ -31,10 +33,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -31,10 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
...@@ -226,21 +225,32 @@ public class PlanConsumablesPurchaseServiceImpl extends ServiceImpl<PlanConsumab ...@@ -226,21 +225,32 @@ public class PlanConsumablesPurchaseServiceImpl extends ServiceImpl<PlanConsumab
} }
@Override @Override
public void exportWord(HttpServletResponse response) { public void exportWord(String name, String fileName, Integer status, HttpServletResponse response) {
Map<String, Object> params = new HashMap<>(); Date start = DateUtil.beginOfYear(DateUtil.date());
Page page = new Page(); Date end = DateUtil.endOfYear(DateUtil.date());
page.setSize(-1); Map<String, Object> map = new HashMap<>(3);
List<PlanConsumablesPurchaseVo> records = consumablesPurchaseMapper.getPage(page, params).getRecords(); map.put("start", start);
map.put("end", end);
map.put("name", name);
map.put("status", status);
List<PlanConsumablesPurchaseVo> list = consumablesPurchaseMapper.exportWordList(map);
if (CollectionUtil.isEmpty(records)) { if (CollectionUtil.isEmpty(list)) {
log.debug("没有找到数据!"); log.debug("没有找到数据!");
} }
list.forEach(arg -> {
if (StrUtil.isEmpty(arg.getRemark())) {
arg.setRemark("");
}
if (StrUtil.isEmpty(arg.getImplementation())) {
arg.setImplementation("");
}
});
Map<String, Object> beanParams = new HashMap<>(); Map<String, Object> beanParams = new HashMap<>();
// records.add(records.get(0)); beanParams.put("list", list);
beanParams.put("list", records);
beanParams.put("fileNo","41-4051-2001"); beanParams.put("fileNo","41-4051-2001");
beanParams.put("year", DateUtil.year(DateUtil.date()) +""); beanParams.put("year", DateUtil.year(DateUtil.date()) +"");
WordUtil.writeWordReport("采购维修计划.docx", "消耗品采购计划.ftl", beanParams, response, FileExt.DOC); WordUtil.writeWordReport(fileName, "消耗品采购计划.ftl", beanParams, response, FileExt.DOC);
} }
} }
package cn.wise.sc.cement.business.service.impl; package cn.wise.sc.cement.business.service.impl;
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.PlanEquipmentMaintain; import cn.wise.sc.cement.business.entity.PlanEquipmentMaintain;
import cn.wise.sc.cement.business.entity.PlanEquipmentPurchase; import cn.wise.sc.cement.business.entity.PlanEquipmentPurchase;
import cn.wise.sc.cement.business.enumation.FileExt;
import cn.wise.sc.cement.business.mapper.PlanEquipmentMaintainMapper; import cn.wise.sc.cement.business.mapper.PlanEquipmentMaintainMapper;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.LoginUser; import cn.wise.sc.cement.business.model.LoginUser;
...@@ -14,6 +18,7 @@ import cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo; ...@@ -14,6 +18,7 @@ import cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo;
import cn.wise.sc.cement.business.service.IPlanEquipmentMaintainService; import cn.wise.sc.cement.business.service.IPlanEquipmentMaintainService;
import cn.wise.sc.cement.business.service.ISysUserService; import cn.wise.sc.cement.business.service.ISysUserService;
import cn.wise.sc.cement.business.util.ExcelUtil; import cn.wise.sc.cement.business.util.ExcelUtil;
import cn.wise.sc.cement.business.util.WordUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -27,10 +32,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -27,10 +32,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.time.format.DateTimeFormatter;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
...@@ -221,4 +224,43 @@ public class PlanEquipmentMaintainServiceImpl extends ServiceImpl<PlanEquipmentM ...@@ -221,4 +224,43 @@ public class PlanEquipmentMaintainServiceImpl extends ServiceImpl<PlanEquipmentM
return BaseResponse.okData("删除成功"); return BaseResponse.okData("删除成功");
} }
/**
* 设备维护计划列表导出(word)
* @param name
* @param fileName
* @param response
*/
public void exportWord(String name, String fileName,HttpServletResponse response) {
Date start = DateUtil.beginOfYear(DateUtil.date());
Date end = DateUtil.endOfYear(DateUtil.date());
Map<String, Object> map = new HashMap<>(3);
map.put("start", start);
map.put("end", end);
map.put("name", name);
List<PlanEquipmentMaintainVo> list = equipmentMaintainMapper.exportWordList(map);
if (CollectionUtil.isEmpty(list)) {
log.debug("设备维护计划为空!");
return;
}
// DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
list.forEach(arg -> {
if (StrUtil.isEmpty(arg.getRemark())) {
arg.setRemark("");
}
if (StrUtil.isEmpty(arg.getImplementation())) {
arg.setImplementation("");
}
// arg.setCreateTimeStr(arg.getCreateTime().format(dateTimeFormatter));
});
Map<String, Object> params = new HashMap<>(5);
params.put("list", list);
params.put("fileNo", "41-4051-2001");
params.put("year", DateUtil.year(DateUtil.date()));
WordUtil.writeWordReport(fileName, "设备维护计划.ftl", params, response, FileExt.DOC);
}
} }
...@@ -235,19 +235,27 @@ public class PlanEquipmentPurchaseServiceImpl extends ServiceImpl<PlanEquipmentP ...@@ -235,19 +235,27 @@ public class PlanEquipmentPurchaseServiceImpl extends ServiceImpl<PlanEquipmentP
return BaseResponse.okData("删除成功"); return BaseResponse.okData("删除成功");
} }
/**
* 设备采购计划列表导出(word)
* @param name
* @param fileName
* @param status
* @param response
*/
@Override @Override
public void exportWord(HttpServletResponse response) { public void exportWord(String name, String fileName, Integer status, HttpServletResponse response) {
Date start = DateUtil.beginOfYear(DateUtil.date()); Date start = DateUtil.beginOfYear(DateUtil.date());
Date end = DateUtil.endOfYear(DateUtil.date()); Date end = DateUtil.endOfYear(DateUtil.date());
Map<String, Object> map = new HashMap<>(2); Map<String, Object> map = new HashMap<>(2);
map.put("start", start); map.put("start", start);
map.put("end", end); map.put("end", end);
map.put("name", name);
map.put("status", status);
List<PlanEquipmentPurchaseVo> list = equipmentPurchaseMapper.exportWordList(map); List<PlanEquipmentPurchaseVo> list = equipmentPurchaseMapper.exportWordList(map);
if (CollectionUtil.isEmpty(list)) { if (CollectionUtil.isEmpty(list)) {
log.debug("采购计划为空!"); log.debug("设备采购计划为空!");
return; return;
} }
...@@ -256,14 +264,18 @@ public class PlanEquipmentPurchaseServiceImpl extends ServiceImpl<PlanEquipmentP ...@@ -256,14 +264,18 @@ public class PlanEquipmentPurchaseServiceImpl extends ServiceImpl<PlanEquipmentP
if (StrUtil.isEmpty(arg.getRemark())) { if (StrUtil.isEmpty(arg.getRemark())) {
arg.setRemark(""); arg.setRemark("");
} }
arg.setCreateTimeStr(arg.getCreateTime().format(dateTimeFormatter)); if (StrUtil.isEmpty(arg.getImplementation())) {
arg.setImplementation("");
}
// arg.setCreateTimeStr(arg.getCreateTime().format(dateTimeFormatter));
arg.setPurchaseDateStr(arg.getPurchaseDate().format(dateTimeFormatter));
}); });
Map<String, Object> params = new HashMap<>(5); Map<String, Object> params = new HashMap<>(5);
params.put("list", list); params.put("list", list);
params.put("fileNo", ""); params.put("fileNo", "41-4051-2001");
params.put("year", DateUtil.year(DateUtil.date())); params.put("year", DateUtil.year(DateUtil.date()));
WordUtil.writeWordReport("消耗品采购计划", "消耗品采购计划.ftl", params, response, FileExt.DOC); WordUtil.writeWordReport(fileName, "采购维修计划.ftl", params, response, FileExt.DOC);
} }
......
package cn.wise.sc.cement.business.service.impl; package cn.wise.sc.cement.business.service.impl;
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.PlanEquipmentPurchase; import cn.wise.sc.cement.business.entity.PlanEquipmentPurchase;
import cn.wise.sc.cement.business.entity.PlanEquipmentRepair; import cn.wise.sc.cement.business.entity.PlanEquipmentRepair;
import cn.wise.sc.cement.business.enumation.FileExt;
import cn.wise.sc.cement.business.mapper.PlanEquipmentRepairMapper; import cn.wise.sc.cement.business.mapper.PlanEquipmentRepairMapper;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.LoginUser; import cn.wise.sc.cement.business.model.LoginUser;
...@@ -9,11 +13,13 @@ import cn.wise.sc.cement.business.model.PageQuery; ...@@ -9,11 +13,13 @@ import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.PlanEquipmentPurchaseQuery; import cn.wise.sc.cement.business.model.query.PlanEquipmentPurchaseQuery;
import cn.wise.sc.cement.business.model.query.PlanEquipmentRepairQuery; import cn.wise.sc.cement.business.model.query.PlanEquipmentRepairQuery;
import cn.wise.sc.cement.business.model.query.PlanFinishQuery; import cn.wise.sc.cement.business.model.query.PlanFinishQuery;
import cn.wise.sc.cement.business.model.vo.PlanEquipmentMaintainVo;
import cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo; import cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo;
import cn.wise.sc.cement.business.model.vo.PlanEquipmentRepairVo; import cn.wise.sc.cement.business.model.vo.PlanEquipmentRepairVo;
import cn.wise.sc.cement.business.service.IPlanEquipmentRepairService; import cn.wise.sc.cement.business.service.IPlanEquipmentRepairService;
import cn.wise.sc.cement.business.service.ISysUserService; import cn.wise.sc.cement.business.service.ISysUserService;
import cn.wise.sc.cement.business.util.ExcelUtil; import cn.wise.sc.cement.business.util.ExcelUtil;
import cn.wise.sc.cement.business.util.WordUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -27,10 +33,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -27,10 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
...@@ -220,4 +223,51 @@ public class PlanEquipmentRepairServiceImpl extends ServiceImpl<PlanEquipmentRep ...@@ -220,4 +223,51 @@ public class PlanEquipmentRepairServiceImpl extends ServiceImpl<PlanEquipmentRep
return BaseResponse.okData("删除成功"); return BaseResponse.okData("删除成功");
} }
/**
* 设备维修计划列表导出(word)
* @param name
* @param fileName
* @param response
*/
public void exportWord(String name, String fileName,HttpServletResponse response) {
Date start = DateUtil.beginOfYear(DateUtil.date());
Date end = DateUtil.endOfYear(DateUtil.date());
Map<String, Object> map = new HashMap<>(2);
map.put("start", start);
map.put("end", end);
map.put("name", name);
List<PlanEquipmentRepairVo> list = equipmentRepairMapper.exportWordList(map);
if (CollectionUtil.isEmpty(list)) {
log.debug("设备维修计划为空!");
return;
}
// DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
list.forEach(arg -> {
if (StrUtil.isEmpty(arg.getRemark())) {
arg.setRemark("");
}
if (StrUtil.isEmpty(arg.getImplementation())) {
arg.setImplementation("");
}
// arg.setCreateTimeStr(arg.getCreateTime().format(dateTimeFormatter));
});
Map<String, Object> params = new HashMap<>(5);
params.put("list", list);
params.put("fileNo", "41-4051-2001");
params.put("year", DateUtil.year(DateUtil.date()));
WordUtil.writeWordReport(fileName, "设备维修计划.ftl", params, response, FileExt.DOC);
}
} }
...@@ -227,7 +227,7 @@ public class PlanStandardPurchaseServiceImpl extends ServiceImpl<PlanStandardPur ...@@ -227,7 +227,7 @@ public class PlanStandardPurchaseServiceImpl extends ServiceImpl<PlanStandardPur
} }
@Override @Override
public void exportWord(HttpServletResponse response) { public void exportWord(String name, String fileName, Integer status, HttpServletResponse response) {
Date start = DateUtil.beginOfYear(DateUtil.date()); Date start = DateUtil.beginOfYear(DateUtil.date());
Date end = DateUtil.endOfYear(DateUtil.date()); Date end = DateUtil.endOfYear(DateUtil.date());
...@@ -235,6 +235,8 @@ public class PlanStandardPurchaseServiceImpl extends ServiceImpl<PlanStandardPur ...@@ -235,6 +235,8 @@ public class PlanStandardPurchaseServiceImpl extends ServiceImpl<PlanStandardPur
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("start", start); map.put("start", start);
map.put("end", end); map.put("end", end);
map.put("name", name);
map.put("status", status);
List<PlanStandardPurchaseVo> planStandardPurchaseVos = standardPurchaseMapper.wordList(map); List<PlanStandardPurchaseVo> planStandardPurchaseVos = standardPurchaseMapper.wordList(map);
...@@ -252,9 +254,9 @@ public class PlanStandardPurchaseServiceImpl extends ServiceImpl<PlanStandardPur ...@@ -252,9 +254,9 @@ public class PlanStandardPurchaseServiceImpl extends ServiceImpl<PlanStandardPur
Map<String, Object> params = new HashMap<>(1); Map<String, Object> params = new HashMap<>(1);
params.put("list", planStandardPurchaseVos); params.put("list", planStandardPurchaseVos);
params.put("fileNo", "2020-000001"); params.put("fileNo", "41-5042-2001");
params.put("year", DateUtil.year(DateUtil.date()) + ""); params.put("year", DateUtil.year(DateUtil.date()) + "");
WordUtil.writeWordReport("标准物质采购计划", "标准物质采购计划.ftl", params, response, FileExt.DOC); WordUtil.writeWordReport(fileName, "标准物质采购计划.ftl", params, response, FileExt.DOC);
} }
......
...@@ -152,24 +152,24 @@ public class SampleServiceImpl extends ServiceImpl<SampleMapper, Sample> impleme ...@@ -152,24 +152,24 @@ public class SampleServiceImpl extends ServiceImpl<SampleMapper, Sample> impleme
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
Map<String, Object> map = list.get(0); Map<String, Object> map = list.get(0);
String[] headers = new String[map.size()]; String[] headers = new String[map.size()];
headers[0] = "序号"; headers[0] = "项目名称";
headers[1] = "样品名称"; headers[1] = "项目编号";
headers[2] = "样品本所编号"; headers[2] = "样品名称";
headers[3] = "所属项目"; headers[3] = "样品状态";
headers[4] = "小样信息"; headers[4] = "来样编号";
headers[5] = "原样存储"; headers[5] = "本所编号";
headers[6] = "样品重量(kg)"; headers[6] = "小样保存位置";
headers[7] = "是否为平行样"; headers[7] = "保存日期";
headers[8] = "状态"; headers[8] = "销毁日期";
headers[9] = "批准人";
headers[10] = "备注";
List<Object[]> datas = new ArrayList<>(headers.length); List<Object[]> datas = new ArrayList<>(headers.length);
for (Map<String, Object> m : list) { for (Map<String, Object> m : list) {
Object[] objects = new Object[headers.length]; Object[] objects = new Object[headers.length];
for (int j = 0; j < headers.length; j++) { for (int j = 0; j < headers.length; j++) {
String obj = m.get(headers[j]).toString(); String obj = "";
//如果序号带小数点 去除.0,保留整数 obj = m.get(headers[j])!= null? m.get(headers[j]).toString() : "" ;
if (j == 0) {
obj = obj.split("\\.")[0];
}
objects[j] = obj; objects[j] = obj;
} }
datas.add(objects); datas.add(objects);
...@@ -276,13 +276,25 @@ public class SampleServiceImpl extends ServiceImpl<SampleMapper, Sample> impleme ...@@ -276,13 +276,25 @@ public class SampleServiceImpl extends ServiceImpl<SampleMapper, Sample> impleme
} }
} }
/**
* 样品列表导出(word)
* @param sampleName
* @param cementCode
* @param fileName
* @param response
*/
@Override @Override
public void exportWord(HttpServletResponse response) { public void exportWord(String sampleName, String cementCode,
String fileName, HttpServletResponse response) {
Date start = DateUtil.beginOfYear(DateUtil.date()); Date start = DateUtil.beginOfYear(DateUtil.date());
Date end = DateUtil.endOfYear(DateUtil.date()); Date end = DateUtil.endOfYear(DateUtil.date());
Map<String, Object> map = new HashMap<>(3);
List<SampleWord> list = sampleMapper.exportWordList(start, end); map.put("start", start);
map.put("end", end);
map.put("name", sampleName);
map.put("cementCode", cementCode);
List<SampleWord> list = sampleMapper.exportWordList(map);
if (CollectionUtil.isEmpty(list)) { if (CollectionUtil.isEmpty(list)) {
log.debug("没找到数据!"); log.debug("没找到数据!");
...@@ -290,9 +302,9 @@ public class SampleServiceImpl extends ServiceImpl<SampleMapper, Sample> impleme ...@@ -290,9 +302,9 @@ public class SampleServiceImpl extends ServiceImpl<SampleMapper, Sample> impleme
Map<String, Object> params = new HashMap<>(1); Map<String, Object> params = new HashMap<>(1);
params.put("list", list); params.put("list", list);
params.put("fileNo",""); params.put("fileNo","41-5062-1801");
WordUtil.writeWordReport("原料存放、销毁记录", "原料存放、销毁记录.ftl", params, response, FileExt.DOC); WordUtil.writeWordReport(fileName, "原料存放、销毁记录.ftl", params, response, FileExt.DOC);
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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