Commit eb4420bc authored by qinhu's avatar qinhu

word补全页眉

parent c8caf835
...@@ -59,6 +59,14 @@ public class PlanEquipmentPurchaseController { ...@@ -59,6 +59,14 @@ public class PlanEquipmentPurchaseController {
} }
} }
@ApiOperation("设备采购计划列表导出(word)")
@PostMapping("/export/word")
public void exportWord(HttpServletResponse response){
equipmentPurchaseService.exportWord(response);
}
@ApiOperation(value = "新增设备采购计划") @ApiOperation(value = "新增设备采购计划")
@PostMapping("/create") @PostMapping("/create")
public BaseResponse create(@RequestBody PlanEquipmentPurchaseQuery query) { public BaseResponse create(@RequestBody PlanEquipmentPurchaseQuery query) {
......
...@@ -27,4 +27,5 @@ public interface PlanConsumablesPurchaseMapper extends BaseMapper<PlanConsumable ...@@ -27,4 +27,5 @@ public interface PlanConsumablesPurchaseMapper extends BaseMapper<PlanConsumable
PlanConsumablesPurchaseVo getDetail(Integer id); PlanConsumablesPurchaseVo getDetail(Integer id);
List<PlanConsumablesPurchaseVo> exportWordList(@Param("params") Map<String, Object> params);
} }
...@@ -27,4 +27,8 @@ public interface PlanEquipmentPurchaseMapper extends BaseMapper<PlanEquipmentPur ...@@ -27,4 +27,8 @@ public interface PlanEquipmentPurchaseMapper extends BaseMapper<PlanEquipmentPur
PlanEquipmentPurchaseVo getDetail(Integer id); PlanEquipmentPurchaseVo getDetail(Integer id);
/**
* @return
*/
List<PlanEquipmentPurchaseVo> exportWordList(@Param("params") Map<String, Object> params);
} }
...@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -24,41 +25,41 @@ import java.util.Map; ...@@ -24,41 +25,41 @@ import java.util.Map;
*/ */
public interface SampleMapper extends BaseMapper<Sample> { public interface SampleMapper extends BaseMapper<Sample> {
IPage<SampleVo> getPage(@Param("page") Page page, @Param("params") Map<String, Object> params); IPage<SampleVo> getPage(@Param("page") Page page, @Param("params") Map<String, Object> params);
List<Map<String, Object>> exportList(@Param("params") Map<String, Object> params); List<Map<String, Object>> exportList(@Param("params") Map<String, Object> params);
SampleVo getDetail(Integer id); SampleVo getDetail(Integer id);
@Select("select max(parallel_code) from sample") @Select("select max(parallel_code) from sample")
String getMaxCementCode(); String getMaxCementCode();
@Select("select * from sample where cement_code = parallel_code and entrust_id = #{entrustId}" + @Select("select * from sample where cement_code = parallel_code and entrust_id = #{entrustId}" +
" order by id asc ") " order by id asc ")
List<Sample> getSampleList(Integer entrustId); List<Sample> getSampleList(Integer entrustId);
@Select("select * from sample where cement_code = parallel_code and entrust_id = #{entrustId} " + @Select("select * from sample where cement_code = parallel_code and entrust_id = #{entrustId} " +
" and is_handle != 1 order by id asc") " and is_handle != 1 order by id asc")
List<Sample> getNoHandleList(Integer entrustId); List<Sample> getNoHandleList(Integer entrustId);
@Select("select * from sample where entrust_id = #{entrustId} and is_distribution != 1 order by id asc") @Select("select * from sample where entrust_id = #{entrustId} and is_distribution != 1 order by id asc")
List<Sample> getNoDistributionList(Integer entrustId); List<Sample> getNoDistributionList(Integer entrustId);
//校核详情样品列表(不展示平行样副样) //校核详情样品列表(不展示平行样副样)
@Select("select * from sample where cement_code = parallel_code and entrust_id = #{entrustId} " + @Select("select * from sample where cement_code = parallel_code and entrust_id = #{entrustId} " +
"and is_handle = 1 and is_distribution = 1 order by id asc") "and is_handle = 1 and is_distribution = 1 order by id asc")
List<Sample> getCheckSampleList(Integer entrustId); List<Sample> getCheckSampleList(Integer entrustId);
@Select("select * from sample where entrust_id = #{entrustId} and is_check != 1 order by id asc") @Select("select * from sample where entrust_id = #{entrustId} and is_check != 1 order by id asc")
List<Sample> getNoCheckList(Integer entrustId); List<Sample> getNoCheckList(Integer entrustId);
@Select("select * from sample where entrust_id = #{entrustId} and cement_code= #{cementCode}") @Select("select * from sample where entrust_id = #{entrustId} and cement_code= #{cementCode}")
List<Sample> getByCementCode(@Param("entrustId") Integer entrustId, @Param("cementCode") String cementCode); List<Sample> getByCementCode(@Param("entrustId") Integer entrustId, @Param("cementCode") String cementCode);
@Select("select * from sample where entrust_id = #{entrustId} order by id asc") @Select("select * from sample where entrust_id = #{entrustId} order by id asc")
List<Sample> getSampleCheckList(Integer entrustId); List<Sample> getSampleCheckList(Integer entrustId);
List<SampleSaveDto> getSampleSaveList(); List<SampleSaveDto> getSampleSaveList();
List<SampleWord> exportWordList(); List<SampleWord> exportWordList(@Param("start") Date start, @Param("end") Date end);
} }
...@@ -12,6 +12,23 @@ ...@@ -12,6 +12,23 @@
</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">
SELECT t.*, su.name as purchaserName SELECT t.*, su.name as purchaserName
...@@ -48,4 +65,12 @@ ...@@ -48,4 +65,12 @@
WHERE t.id = #{id} WHERE t.id = #{id}
</select> </select>
<select id="exportWordList" resultType="cn.wise.sc.cement.business.model.vo.PlanConsumablesPurchaseVo">
SELECT t.*, su.name as purchaserName
FROM plan_consumables_purchase t
left join sys_user su on su.id = t.purchaser_id
<include refid="whereNew"/>
ORDER BY t.id DESC
</select>
</mapper> </mapper>
...@@ -13,6 +13,23 @@ ...@@ -13,6 +13,23 @@
</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
FROM plan_equipment_purchase t FROM plan_equipment_purchase t
...@@ -48,5 +65,13 @@ ...@@ -48,5 +65,13 @@
WHERE t.id = #{id} WHERE t.id = #{id}
</select> </select>
<select id="exportWordList" resultType="cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo">
SELECT t.*, su.name as purchaserName
FROM plan_equipment_purchase t
left join sys_user su on su.id = t.purchaser_id
<include refid="whereNew"/>
ORDER BY t.id DESC
</select>
</mapper> </mapper>
...@@ -101,6 +101,8 @@ ...@@ -101,6 +101,8 @@
`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}
and s.create_time <![CDATA[<=]]> #{end}
</select> </select>
......
...@@ -63,4 +63,6 @@ public class PlanConsumablesPurchaseVo { ...@@ -63,4 +63,6 @@ public class PlanConsumablesPurchaseVo {
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;
private String createTimeStr;
} }
...@@ -63,4 +63,6 @@ public class PlanEquipmentPurchaseVo { ...@@ -63,4 +63,6 @@ public class PlanEquipmentPurchaseVo {
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;
private String createTimeStr;
} }
...@@ -35,4 +35,5 @@ public interface IPlanEquipmentPurchaseService extends IService<PlanEquipmentPur ...@@ -35,4 +35,5 @@ public interface IPlanEquipmentPurchaseService extends IService<PlanEquipmentPur
BaseResponse<String> delete(Integer id); BaseResponse<String> delete(Integer id);
void exportWord(HttpServletResponse response);
} }
...@@ -236,8 +236,9 @@ public class PlanConsumablesPurchaseServiceImpl extends ServiceImpl<PlanConsumab ...@@ -236,8 +236,9 @@ public class PlanConsumablesPurchaseServiceImpl extends ServiceImpl<PlanConsumab
Map<String, Object> beanParams = new HashMap<>(); Map<String, Object> beanParams = new HashMap<>();
records.add(records.get(0)); records.add(records.get(0));
beanParams.put("list", records); beanParams.put("list", records);
beanParams.put("fileNo","");
beanParams.put("year", DateUtil.year(DateUtil.date()) +""); beanParams.put("year", DateUtil.year(DateUtil.date()) +"");
WordUtil.writeWordReport("消耗品采购计划.docx", "消耗品采购计划 .ftl", beanParams, response, FileExt.DOC); WordUtil.writeWordReport("消耗品采购计划.docx", "消耗品采购计划.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.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.wise.sc.cement.business.entity.Sample; import cn.wise.sc.cement.business.entity.Sample;
import cn.wise.sc.cement.business.enumation.FileExt; import cn.wise.sc.cement.business.enumation.FileExt;
...@@ -28,6 +29,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -28,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -277,7 +279,10 @@ public class SampleServiceImpl extends ServiceImpl<SampleMapper, Sample> impleme ...@@ -277,7 +279,10 @@ public class SampleServiceImpl extends ServiceImpl<SampleMapper, Sample> impleme
@Override @Override
public void exportWord(HttpServletResponse response) { public void exportWord(HttpServletResponse response) {
List<SampleWord> list = sampleMapper.exportWordList(); Date start = DateUtil.beginOfYear(DateUtil.date());
Date end = DateUtil.endOfYear(DateUtil.date());
List<SampleWord> list = sampleMapper.exportWordList(start, end);
if (CollectionUtil.isEmpty(list)) { if (CollectionUtil.isEmpty(list)) {
log.debug("没找到数据!"); log.debug("没找到数据!");
...@@ -285,6 +290,7 @@ public class SampleServiceImpl extends ServiceImpl<SampleMapper, Sample> impleme ...@@ -285,6 +290,7 @@ 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","");
WordUtil.writeWordReport("原料存放、销毁记录", "原料存放、销毁记录.ftl", params, response, FileExt.DOC); WordUtil.writeWordReport("原料存放、销毁记录", "原料存放、销毁记录.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