Browse Source

公出详细列表修改

anderx 1 year ago
parent
commit
c97d428257

+ 5 - 2
src/main/java/com/goafanti/common/dao/PublicReleaseClockMapper.java

@@ -2,6 +2,8 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.PublicReleaseClock;
 
+import java.util.List;
+
 /**
 * @author Administrator
 * @description 针对表【public_release_clock(公出打卡表)】的数据库操作Mapper
@@ -10,16 +12,17 @@ import com.goafanti.common.model.PublicReleaseClock;
 */
 public interface PublicReleaseClockMapper {
 
-    int deleteByPrimaryKey(Long id);
+    int deleteByPrimaryKey(Integer id);
 
     int insert(PublicReleaseClock record);
 
     int insertSelective(PublicReleaseClock record);
 
-    PublicReleaseClock selectByPrimaryKey(Long id);
+    PublicReleaseClock selectByPrimaryKey(Integer id);
 
     int updateByPrimaryKeySelective(PublicReleaseClock record);
 
     int updateByPrimaryKey(PublicReleaseClock record);
 
+    List<PublicReleaseClock> selectList(List<Integer> list);
 }

+ 13 - 2
src/main/java/com/goafanti/common/mapper/PublicReleaseClockMapper.xml

@@ -18,14 +18,15 @@
         photo_url,clock_in_time,create_time
     </sql>
 
-    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
         select
         <include refid="Base_Column_List" />
         from public_release_clock
         where  id = #{id,jdbcType=INTEGER} 
     </select>
 
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
         delete from public_release_clock
         where  id = #{id,jdbcType=INTEGER} 
     </delete>
@@ -88,4 +89,14 @@
             create_time =  #{createTime,jdbcType=TIMESTAMP}
         where   id = #{id,jdbcType=INTEGER} 
     </update>
+
+    <select id="selectList" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from public_release_clock
+        where prid in
+        <foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </select>
 </mapper>

+ 1 - 1
src/main/java/com/goafanti/common/mapper/PublicReleaseMapper.xml

@@ -555,7 +555,7 @@
     </select>
 
     <select id="listPublicDtails" resultType="com.goafanti.weChat.bo.OutPublicDtails">
-        select b.id,a.district_name districtName ,c.name aname,a.duration ,b.status ,b.annex_url annexUrl,a.photo_url photoUrl,d.nickname userName,
+        select a.id prdId,b.id,a.district_name districtName ,c.name aname,a.duration ,b.status ,b.annex_url annexUrl,a.photo_url photoUrl,d.nickname userName,
         date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S') clockInTimes,a.clock_in clockIn ,b.remarks ,b.supplement ,b.`type` ,b.object_type objectType ,
         date_format(b.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,b.audit_info auditInfo,date_format(b.audit_time ,'%Y-%m-%d %H:%i:%S') auditTimes,
         date_format(b.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,date_format(b.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,

+ 3 - 0
src/main/java/com/goafanti/common/model/PublicReleaseClock.java

@@ -1,5 +1,7 @@
 package com.goafanti.common.model;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -99,6 +101,7 @@ public class PublicReleaseClock implements Serializable {
     /**
      * 打卡时间
      */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
     public Date getClockInTime() {
         return clockInTime;
     }

+ 5 - 0
src/main/java/com/goafanti/common/utils/DateUtils.java

@@ -416,6 +416,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
 		return format.format(date);
 	}
 
+	public static String formatDateYYYYMMddHHmm(Date date) {
+		SimpleDateFormat format = new SimpleDateFormat(parsePatterns[2]);
+		return format.format(date);
+	}
+
 	/**
 	 * 解析日期
 	 * @param source

+ 8 - 0
src/main/java/com/goafanti/weChat/bo/OutPublicDtails.java

@@ -7,6 +7,7 @@ import java.math.BigDecimal;
 public class OutPublicDtails  {
 
 	private Integer id;
+	private Integer prdId;
 	@Excel(name = "客户名称")
 	private String userName;
 	@Excel(name = "签单状态",readConverterExp = "0=未签单,1=已签单",width = 8)
@@ -68,6 +69,13 @@ public class OutPublicDtails  {
 	@Excel(name = "订单总金额" ,scale = 6)
 	private BigDecimal totalAmout;
 
+	public Integer getPrdId() {
+		return prdId;
+	}
+
+	public void setPrdId(Integer prdId) {
+		this.prdId = prdId;
+	}
 
 	public Integer getSignBills() {
 		return signBills;

+ 2 - 1
src/main/java/com/goafanti/weChat/controller/AdminReleaseApiController.java

@@ -263,7 +263,7 @@ public class AdminReleaseApiController extends CertifyApiController{
 	@RequestMapping(value = "/publicReleaseStatistics/export", method = RequestMethod.GET)
 	public Result publicReleaseStatisticsExport(InputPublicStatistics in,HttpServletResponse response){
 		List<OutPublicStatistics> list =publicReleaseService.publicReleaseStatisticsList(in);
-      	NewExcelUtil<OutPublicStatistics>excel=new NewExcelUtil<>(OutPublicStatistics.class);
+		NewExcelUtil<OutPublicStatistics>excel=new NewExcelUtil<>(OutPublicStatistics.class);
   		 return  excel.exportExcel(list,"公出统计列表",response);
 	}
 
@@ -293,6 +293,7 @@ public class AdminReleaseApiController extends CertifyApiController{
 	public Result publicReleaseListDtailsExport(InputPublicDtails in ,Integer exportType){
 		if (exportType==null)exportType=0;
 		List<OutPublicDtails> outList=publicReleaseService.publicReleaseListDtailsList(in);
+		publicReleaseService.pushOutPublicDtails(outList);
 		if (exportType==0){
             NewExcelUtil<OutPublicDtails>excel=new NewExcelUtil<>(OutPublicDtails.class);
 			return  excel.exportExcel(outList,"公出详细列表",uploadPath);

+ 3 - 0
src/main/java/com/goafanti/weChat/service/PublicReleaseService.java

@@ -66,4 +66,7 @@ public interface PublicReleaseService {
 	Object publicReleaseAndCount(InputPublicDtails in);
 
     Map checkOrderNoDuration( InputPublicRelease in);
+
+
+	void pushOutPublicDtails(List<OutPublicDtails> outList);
 }

+ 23 - 0
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -32,6 +32,7 @@ import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
 
 @Service
 public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper> implements PublicReleaseService {
@@ -1257,6 +1258,10 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		Map<String,Object> map =new HashMap<String, Object>();
 		addParams(in, map);
 		Pagination<OutPublicDtails> page = (Pagination<OutPublicDtails>) findPage("listPublicDtails", "countPublicDtails", map, in.getPageNo(), in.getPageSize());
+		List<OutPublicDtails> list = (List<OutPublicDtails>)page.getList();
+		List<Integer> collect = list.stream().map(OutPublicDtails::getId).collect(Collectors.toList());
+		List<PublicReleaseClock> publicReleaseClocks = publicReleaseClockMapper.selectList(collect);
+		pushiClockInTime(list, publicReleaseClocks);
 		return page;
 	}
 
@@ -1784,4 +1789,22 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	public Map checkOrderNoDuration( InputPublicRelease in){
 		return checkOrderNoDuration(in,null);
 	}
+
+	@Override
+	public void pushOutPublicDtails(List<OutPublicDtails> list) {
+		List<PublicReleaseClock> publicReleaseClocks = publicReleaseClockMapper.selectList(list.stream().map(OutPublicDtails::getId).collect(Collectors.toList()));
+		pushiClockInTime(list, publicReleaseClocks);
+	}
+
+	private void pushiClockInTime(List<OutPublicDtails> list, List<PublicReleaseClock> publicReleaseClocks) {
+		for (OutPublicDtails outPublicDtails : list) {
+			StringBuilder sb = new StringBuilder();
+			for (PublicReleaseClock e : publicReleaseClocks) {
+				if (outPublicDtails.getPrdId().equals(e.getPrdid())){
+					sb.append(DateUtils.formatDateYYYYMMddHHmm(e.getClockInTime())).append("\n");
+				}
+			}
+			outPublicDtails.setClockInTimes(sb.toString());
+		}
+	}
 }