Browse Source

Merge remote-tracking branch 'origin/master'

shuzhan 2 tháng trước cách đây
mục cha
commit
27ca67eceb
22 tập tin đã thay đổi với 1013 bổ sung177 xóa
  1. 1 0
      common/src/main/java/com/jpsoft/railroad/modules/base/dao/OaFileInfoDAO.java
  2. 1 0
      common/src/main/java/com/jpsoft/railroad/modules/base/dao/RegUserDAO.java
  3. 7 0
      common/src/main/java/com/jpsoft/railroad/modules/base/entity/OaFileInfo.java
  4. 1 0
      common/src/main/java/com/jpsoft/railroad/modules/base/service/NetworkNoticeService.java
  5. 1 0
      common/src/main/java/com/jpsoft/railroad/modules/base/service/OaFileInfoService.java
  6. 97 57
      common/src/main/java/com/jpsoft/railroad/modules/base/service/impl/NetworkNoticeServiceImpl.java
  7. 9 0
      common/src/main/java/com/jpsoft/railroad/modules/base/service/impl/OaFileInfoServiceImpl.java
  8. 1 1
      common/src/main/java/com/jpsoft/railroad/modules/common/utils/SMSUtil.java
  9. 1 0
      common/src/main/java/com/jpsoft/railroad/modules/form/dao/WaybillInfoDAO.java
  10. 6 2
      common/src/main/java/com/jpsoft/railroad/modules/form/entity/VehicleApplicationInfo.java
  11. 1 0
      common/src/main/java/com/jpsoft/railroad/modules/form/service/impl/FormCommonServiceImp.java
  12. 16 0
      common/src/main/java/com/jpsoft/railroad/modules/form/service/impl/WaybillInfoServiceImpl.java
  13. 59 1
      common/src/main/resources/mapper/base/OaFileInfo.xml
  14. 5 0
      common/src/main/resources/mapper/base/RegUser.xml
  15. 20 5
      common/src/main/resources/mapper/form/VehicleApplicationInfo.xml
  16. 7 0
      common/src/main/resources/mapper/form/WaybillInfo.xml
  17. 1 1
      web/src/main/java/com/jpsoft/railroad/modules/base/controller/NetworkNoticeController.java
  18. 35 2
      web/src/main/java/com/jpsoft/railroad/modules/base/controller/OaFileInfoController.java
  19. 70 7
      web/src/main/java/com/jpsoft/railroad/modules/form/controller/FormCommonController.java
  20. 233 95
      web/src/main/java/com/jpsoft/railroad/modules/form/controller/VehicleApplicationInfoController.java
  21. 10 6
      web/src/main/java/com/jpsoft/railroad/modules/mobile/controller/ApplicationApiController.java
  22. 431 0
      web/src/main/java/com/jpsoft/railroad/modules/mobile/controller/OaFileInfoApi.java

+ 1 - 0
common/src/main/java/com/jpsoft/railroad/modules/base/dao/OaFileInfoDAO.java

@@ -15,4 +15,5 @@ public interface OaFileInfoDAO {
 	int delete(String id);
 	List<OaFileInfo> list();
 	List<OaFileInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
+	List<OaFileInfo> searchByMobile(Map<String, Object> searchParams, List<Sort> sortList);
 }

+ 1 - 0
common/src/main/java/com/jpsoft/railroad/modules/base/dao/RegUserDAO.java

@@ -29,4 +29,5 @@ public interface RegUserDAO {
 	List<RegUser> findByOrg(String orgId);
 	List<RegUser> findByOrgIdAndRoleId(String orgId,String roleId);
 	List<RegUser> findByRecharge();
+	List<RegUser> findByIsForm();
 }

+ 7 - 0
common/src/main/java/com/jpsoft/railroad/modules/base/entity/OaFileInfo.java

@@ -56,11 +56,18 @@ public class OaFileInfo {
 			@ApiModelProperty(value = "是否删除")
 	private Boolean delFlag;
 
+	@ApiModelProperty(value = "创建电话号码")
+	private String createPhone;
+
 
 	@Transient
 	@ApiModelProperty(value = "创建人")
 	private String createByN;
 
+	@Transient
+	@ApiModelProperty(value = "创建所属部门")
+	private String orgName;
+
 			@Transient
 	@ApiModelProperty(value = "文件列表")
 	private List<Map> urlList;

+ 1 - 0
common/src/main/java/com/jpsoft/railroad/modules/base/service/NetworkNoticeService.java

@@ -10,6 +10,7 @@ public interface NetworkNoticeService {
 	NetworkNotice get(String id);
 	boolean exist(String id);
 	int insert(NetworkNotice model);
+	int insertRelation(NetworkNotice model);
 	int update(NetworkNotice model);
 	int delete(String id);
 	List<NetworkNotice> list();

+ 1 - 0
common/src/main/java/com/jpsoft/railroad/modules/base/service/OaFileInfoService.java

@@ -13,4 +13,5 @@ public interface OaFileInfoService {
 	int delete(String id);
 	List<OaFileInfo> list();
 	Page<OaFileInfo> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+	Page<OaFileInfo> pageSearchByMobile(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
 }

+ 97 - 57
common/src/main/java/com/jpsoft/railroad/modules/base/service/impl/NetworkNoticeServiceImpl.java

@@ -1,9 +1,16 @@
 package com.jpsoft.railroad.modules.base.service.impl;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 import javax.annotation.Resource;
+
+import com.jpsoft.railroad.modules.base.dao.RegUserDAO;
+import com.jpsoft.railroad.modules.base.dto.NetworkNoticeRalationDTO;
+import com.jpsoft.railroad.modules.base.entity.RegUser;
+import com.jpsoft.railroad.modules.base.service.NetworkNoticeRalationService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 import com.jpsoft.railroad.modules.base.dao.NetworkNoticeDAO;
@@ -14,66 +21,99 @@ import com.jpsoft.railroad.modules.common.dto.Sort;
 import com.github.pagehelper.PageHelper;
 
 @Transactional
-@Component(value="networkNoticeService")
+@Component(value = "networkNoticeService")
 public class NetworkNoticeServiceImpl implements NetworkNoticeService {
-	@Resource(name="networkNoticeDAO")
-	private NetworkNoticeDAO networkNoticeDAO;
-
-	@Override
-	public NetworkNotice get(String id) {
-		// TODO Auto-generated method stub
-		return networkNoticeDAO.get(id);
-	}
-
-	@Override
-	public int insert(NetworkNotice model) {
-		// TODO Auto-generated method stub
-		//model.setId(UUID.randomUUID().toString());
-		
-		return networkNoticeDAO.insert(model);
-	}
-
-	@Override
-	public int update(NetworkNotice model) {
-		// TODO Auto-generated method stub
-		return networkNoticeDAO.update(model);		
-	}
-
-	@Override
-	public int delete(String id) {
-		// TODO Auto-generated method stub
-		return networkNoticeDAO.delete(id);
-	}
-
-	@Override
-	public boolean exist(String id) {
-		// TODO Auto-generated method stub
-		int count = networkNoticeDAO.exist(id);
-		
-		return count > 0 ? true : false;
-	}
-	
-	@Override
-	public List<NetworkNotice> list() {
-		// TODO Auto-generated method stub
-		return networkNoticeDAO.list();
-	}
-		
-	@Override
-	public Page<NetworkNotice> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
-        Page<NetworkNotice> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
-            networkNoticeDAO.search(searchParams,sortList);
+    @Resource(name = "networkNoticeDAO")
+    private NetworkNoticeDAO networkNoticeDAO;
+
+    @Resource(name = "regUserDAO")
+    private RegUserDAO regUserDAO;
+
+    @Autowired
+    private NetworkNoticeRalationService networkNoticeRalationService;
+
+    @Override
+    public NetworkNotice get(String id) {
+        // TODO Auto-generated method stub
+        return networkNoticeDAO.get(id);
+    }
+
+    @Override
+    public int insert(NetworkNotice model) {
+        // TODO Auto-generated method stub
+        //model.setId(UUID.randomUUID().toString());
+
+        return networkNoticeDAO.insert(model);
+    }
+
+    @Override
+    public int insertRelation(NetworkNotice model) {
+        // TODO Auto-generated method stub
+        //model.setId(UUID.randomUUID().toString());
+        int affectCount = networkNoticeDAO.insert(model);
+
+        if (affectCount > 0) {
+            List<RegUser> regUserList = regUserDAO.findByIsForm();
+
+            String[] relatedUse = new String[regUserList.size()];
+
+            for (int i = 0; i < regUserList.size(); i++) {
+                relatedUse[i] = regUserList.get(i).getId();
+            }
+
+            NetworkNoticeRalationDTO dto = new NetworkNoticeRalationDTO();
+            dto.setFileId(model.getId());
+            dto.setRelatedUser(relatedUse);
+            dto.setOrgSelected(new String[0]);
+
+            networkNoticeRalationService.relationItem(dto, model.getCreateBy());
+        }
+
+        return affectCount;
+    }
+
+
+    @Override
+    public int update(NetworkNotice model) {
+        // TODO Auto-generated method stub
+        return networkNoticeDAO.update(model);
+    }
+
+    @Override
+    public int delete(String id) {
+        // TODO Auto-generated method stub
+        return networkNoticeDAO.delete(id);
+    }
+
+    @Override
+    public boolean exist(String id) {
+        // TODO Auto-generated method stub
+        int count = networkNoticeDAO.exist(id);
+
+        return count > 0 ? true : false;
+    }
+
+    @Override
+    public List<NetworkNotice> list() {
+        // TODO Auto-generated method stub
+        return networkNoticeDAO.list();
+    }
+
+    @Override
+    public Page<NetworkNotice> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize, boolean count, List<Sort> sortList) {
+        Page<NetworkNotice> page = PageHelper.startPage(pageNumber, pageSize, count).doSelectPage(() -> {
+            networkNoticeDAO.search(searchParams, sortList);
         });
-        
+
         return page;
-	}
+    }
 
-	@Override
-	public Page<NetworkNotice> pageSearchByMobile(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
-		Page<NetworkNotice> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
-			networkNoticeDAO.searchByMobile(searchParams,sortList);
-		});
+    @Override
+    public Page<NetworkNotice> pageSearchByMobile(Map<String, Object> searchParams, int pageNumber, int pageSize, boolean count, List<Sort> sortList) {
+        Page<NetworkNotice> page = PageHelper.startPage(pageNumber, pageSize, count).doSelectPage(() -> {
+            networkNoticeDAO.searchByMobile(searchParams, sortList);
+        });
 
-		return page;
-	}
+        return page;
+    }
 }

+ 9 - 0
common/src/main/java/com/jpsoft/railroad/modules/base/service/impl/OaFileInfoServiceImpl.java

@@ -67,4 +67,13 @@ public class OaFileInfoServiceImpl implements OaFileInfoService {
         
         return page;
 	}
+
+	@Override
+	public Page<OaFileInfo> pageSearchByMobile(Map<String, Object> searchParams, int pageNumber, int pageSize, boolean count, List<Sort> sortList) {
+		Page<OaFileInfo> page = PageHelper.startPage(pageNumber, pageSize, count).doSelectPage(() -> {
+			oaFileInfoDAO.searchByMobile(searchParams, sortList);
+		});
+
+		return page;
+	}
 }

+ 1 - 1
common/src/main/java/com/jpsoft/railroad/modules/common/utils/SMSUtil.java

@@ -145,7 +145,7 @@ public class SMSUtil {
 
 
 	public static String generateNumberString(int length) {
-		StringBuffer sb = new StringBuffer();
+		StringBuffer  sb = new StringBuffer();
 		Random random = new Random();
 		for (int i = 0; i < length; i++) {
 			sb.append(NUMBERCHAR.charAt(random.nextInt(NUMBERCHAR.length())));

+ 1 - 0
common/src/main/java/com/jpsoft/railroad/modules/form/dao/WaybillInfoDAO.java

@@ -23,4 +23,5 @@ public interface WaybillInfoDAO {
 	int countInvalidBillByDateRange(@Param("billType") String billType,@Param("stationId") String stationId,@Param("startDate") String startDate,@Param("endDate") String endDate);
 	List<WaybillInfo> findInvalidBillByDateRange(@Param("billType") String billType,@Param("stationId") String stationId,@Param("startDate") String startDate,@Param("endDate") String endDate);
 	List<WaybillInfo> search(Map<String,Object> searchParams,List<Sort> sortList);
+	WaybillInfo isRepeated(@Param("billNumber")String billNumber,@Param("stationId")String stationId,@Param("billType")String billType);
 }

+ 6 - 2
common/src/main/java/com/jpsoft/railroad/modules/form/entity/VehicleApplicationInfo.java

@@ -52,8 +52,11 @@ public class VehicleApplicationInfo {
 	@ApiModelProperty(value = "用车结束时间")
 	private Date endTime;
 
-	@ApiModelProperty(value = "起止地点")
-	private String locations;
+	@ApiModelProperty(value = "起始地点")
+	private String startAddress;
+
+	@ApiModelProperty(value = "结束地点")
+	private String endAddress;
 
 	@ApiModelProperty(value = "银行账户")
 	private String bankAccount;
@@ -142,4 +145,5 @@ public class VehicleApplicationInfo {
 	@ApiModelProperty(value = "起止日期数组")
 	private String[] rangeDateTime;
 
+
 }

+ 1 - 0
common/src/main/java/com/jpsoft/railroad/modules/form/service/impl/FormCommonServiceImp.java

@@ -121,6 +121,7 @@ public class FormCommonServiceImp implements FormCommonService {
                 WfProcessActivity wfProcessActivity = wfProcessActivityDAO.get(procinstActivity.getActivityId());
                 if (wfProcessActivity != null) {
                     procinstActivity.setActivityName(wfProcessActivity.getActivityName());
+
                 }
 
                 List<WfProcinstActUser> wfProcinstActUserList = wfProcinstActUserDAO.findByActivityIdAndType(procinstActivity.getId(), "1");

+ 16 - 0
common/src/main/java/com/jpsoft/railroad/modules/form/service/impl/WaybillInfoServiceImpl.java

@@ -48,6 +48,22 @@ public class WaybillInfoServiceImpl implements WaybillInfoService {
 
     @Override
     public int insertAll(WaybillInfo model) {
+
+        //判断数据库是否已有单号记录,防止生成重复流水号
+        WaybillInfo isRepeatModel = waybillInfoDAO.isRepeated(model.getBillNumber(),model.getStationId(),model.getBillType());
+        while(isRepeatModel!=null){
+            long newBillNumber;
+
+            String num = isRepeatModel.getBillNumber().substring(1);
+            newBillNumber = Long.parseLong(num) + 1;
+
+            String billNumber = String.format("%07d", newBillNumber);
+
+            model.setBillNumber(billNumber);
+
+            isRepeatModel = waybillInfoDAO.isRepeated(billNumber,isRepeatModel.getStationId(),isRepeatModel.getBillType());
+        }
+
         int count = waybillInfoDAO.insert(model);
 
         if (count > 0) {

+ 59 - 1
common/src/main/resources/mapper/base/OaFileInfo.xml

@@ -14,6 +14,7 @@
 			<result property="updateTime" column="update_time" />
 			<result property="delFlag" column="del_flag" />
 			<result property="uploadTime" column="upload_time" />
+			<result property="createPhone" column="create_phone" />
 
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.railroad.modules.base.entity.OaFileInfo">
@@ -24,7 +25,7 @@
 	-->
 	<![CDATA[
 		insert into base_oa_file_info
-	    (id_,name_,url_,type_,create_by,create_time,update_by,update_time,del_flag,upload_time)
+	    (id_,name_,url_,type_,create_by,create_time,update_by,update_time,del_flag,upload_time,create_phone)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -37,6 +38,7 @@
 ,#{updateTime,jdbcType= TIMESTAMP }
 ,#{delFlag,jdbcType= NUMERIC }
 ,#{uploadTime,jdbcType= TIMESTAMP }
+,#{createPhone,jdbcType=VARCHAR}
 		)
 	]]>
 	</insert>
@@ -73,6 +75,9 @@
 			<if test="uploadTime!=null">
 				upload_time=#{uploadTime,jdbcType= TIMESTAMP },
 			</if>
+			<if test="createPhone!=null">
+				create_phone=#{createPhone,jdbcType=VARCHAR},
+			</if>
 		</set>
 	where id_=#{id}
 	</update>
@@ -94,6 +99,24 @@
 			<if test="searchParams.name != null">
 				and name_ like #{searchParams.name}
 			</if>
+			<if test="searchParams.createPhone != null">
+				<![CDATA[
+					and ( create_phone = #{searchParams.createPhone}
+				]]>
+				<if test="searchParams.oaFileRegUserInfoList != null">
+					<foreach item="item" collection="searchParams.oaFileRegUserInfoList" open="or id_ in ("
+							 separator="," close=")">
+						#{item.fileId}
+					</foreach>
+				</if>
+				<if test="searchParams.oaFileOrgList != null">
+					<foreach item="item" collection="searchParams.oaFileOrgList" open="or id_ in ("
+							 separator="," close=")">
+						#{item.fileId}
+					</foreach>
+				</if>
+				)
+			</if>
 			<if test="searchParams.createBy != null">
 				<![CDATA[
 					and ( create_by = #{searchParams.createBy}
@@ -117,4 +140,39 @@
 	        ${sort.name} ${sort.order}
 	 	</foreach>
 	</select>
+	<select id="searchByMobile" parameterType="hashmap" resultMap="OaFileInfoMap">
+		<![CDATA[
+			select * from base_oa_file_info a
+		]]>
+		<where>
+			a.del_flag = 0
+			<if test="searchParams.createTime != null">
+				and DATE_FORMAT( a.create_time, '%Y-%m-%d' ) = DATE_FORMAT( #{createTime}, '%Y-%m-%d' )
+			</if>
+			<if test="searchParams.name != null">
+				and a.name_ like #{searchParams.name}
+			</if>
+			<if test="searchParams.createPhone != null">
+				<![CDATA[
+					and ( create_phone = #{searchParams.createPhone}
+				]]>
+				<if test="searchParams.oaFileRegUserInfoList != null">
+					<foreach item="item" collection="searchParams.oaFileRegUserInfoList" open="or id_ in ("
+							 separator="," close=")">
+						#{item.fileId}
+					</foreach>
+				</if>
+				<if test="searchParams.oaFileOrgList != null">
+					<foreach item="item" collection="searchParams.oaFileOrgList" open="or id_ in ("
+							 separator="," close=")">
+						#{item.fileId}
+					</foreach>
+				</if>
+				)
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+			${sort.name} ${sort.order}
+		</foreach>
+	</select>
 </mapper>

+ 5 - 0
common/src/main/resources/mapper/base/RegUser.xml

@@ -220,4 +220,9 @@
         AND b.status_ = 1
         GROUP BY a.phone_
     </select>
+    <select id="findByIsForm" parameterType="hashmap" resultMap="RegUserMap">
+        SELECT * FROM base_reg_user
+        WHERE del_flag = 0
+        AND is_form_permissions = true
+    </select>
 </mapper>

+ 20 - 5
common/src/main/resources/mapper/form/VehicleApplicationInfo.xml

@@ -10,7 +10,8 @@
 			<result property="reason" column="reason_" />
 			<result property="startTime" column="start_time" />
 			<result property="endTime" column="end_time" />
-			<result property="locations" column="locations_" />
+			<result property="startAddress" column="start_address" />
+			<result property="endAddress" column="end_address" />
 			<result property="bankAccount" column="bank_account" />
 			<result property="kilometers" column="kilometers_" />
 			<result property="amount" column="amount_" />
@@ -35,7 +36,7 @@
 	-->
 	<![CDATA[
 		insert into form_vehicle_application_info
-	    (id_,title_,position_,reason_,start_time,end_time,locations_,
+	    (id_,title_,position_,reason_,start_time,end_time,start_address,end_address,
 	    bank_account,kilometers_,amount_,bak_,create_by,create_time,update_by,update_time,del_flag,status_,procinst_id,
 	    annex_file,apply_person_id,apply_date,department_id)
 		values
@@ -46,7 +47,8 @@
 ,#{reason,jdbcType=VARCHAR}
 ,#{startTime,jdbcType= TIMESTAMP }
 ,#{endTime,jdbcType= TIMESTAMP }
-,#{locations,jdbcType=VARCHAR}
+,#{startAddress,jdbcType=VARCHAR}
+,#{endAddress,jdbcType=VARCHAR}
 ,#{bankAccount,jdbcType=VARCHAR}
 ,#{kilometers,jdbcType= NUMERIC }
 ,#{amount,jdbcType= NUMERIC }
@@ -86,9 +88,12 @@
 				<if test="endTime!=null">
 		end_time=#{endTime,jdbcType= TIMESTAMP },
 		</if>
-				<if test="locations!=null">
-		locations_=#{locations,jdbcType=VARCHAR},
+				<if test="startAddress!=null">
+				start_address=#{startAddress,jdbcType=VARCHAR},
 		</if>
+			<if test="endAddress!=null">
+				end_address=#{endAddress,jdbcType=VARCHAR},
+			</if>
 				<if test="bankAccount!=null">
 		bank_account=#{bankAccount,jdbcType=VARCHAR},
 		</if>
@@ -163,6 +168,16 @@
 			<if test="searchParams.applyPersonId != null">
 				and apply_person_id = #{searchParams.applyPersonId}
 			</if>
+			<if test="searchParams.startTime != null">
+				<![CDATA[
+                  and apply_date >= #{searchParams.startTime}
+                ]]>
+			</if>
+			<if test="searchParams.endTime != null">
+				<![CDATA[
+                  and apply_date <= #{searchParams.endTime}
+                ]]>
+			</if>
 			<if test="searchParams.id != null">
 				and ID_ like #{searchParams.id}
 			</if>

+ 7 - 0
common/src/main/resources/mapper/form/WaybillInfo.xml

@@ -229,6 +229,13 @@
 		where bill_number is not null and station_id = #{stationId} and bill_type = #{billType}
 		order by create_time desc limit 1
 	</select>
+	<select id="isRepeated" resultMap="WaybillInfoMap">
+		select * from form_waybill_info
+		where bill_number = #{billNumber}
+		and station_id = #{stationId}
+		and bill_type = #{billType}
+		order by create_time desc limit 1
+	</select>
 	<select id="findAllByDateRange" resultMap="WaybillInfoMap">
 		select * from form_waybill_info
 		<where>

+ 1 - 1
web/src/main/java/com/jpsoft/railroad/modules/base/controller/NetworkNoticeController.java

@@ -78,7 +78,7 @@ public class NetworkNoticeController {
             }
 
 
-            int affectCount = networkNoticeService.insert(networkNotice);
+            int affectCount = networkNoticeService.insertRelation(networkNotice);
 
             if (affectCount > 0) {
                 msgResult.setResult(true);

+ 35 - 2
web/src/main/java/com/jpsoft/railroad/modules/base/controller/OaFileInfoController.java

@@ -71,6 +71,28 @@ public class OaFileInfoController {
             oaFileInfo.setId(UUID.randomUUID().toString());
             oaFileInfo.setDelFlag(false);
             oaFileInfo.setCreateBy(subject);
+
+            String phone = "";
+
+            RegUser regUser = regUserService.get(subject);
+
+            //先判断是否前端用户创建
+            if (regUser != null) {
+                phone = regUser.getPhone();
+            }
+
+            //后查看后台用户创建的电话
+            if(StringUtils.isEmpty(phone)){
+                User user = userService.get(subject);
+                if(user!=null){
+                    phone = user.getPhone();
+                }
+            }
+
+            if(StringUtils.isNotEmpty(phone)){
+                oaFileInfo.setCreatePhone(phone);
+            }
+
             oaFileInfo.setCreateTime(new Date());
 
             JSONArray jsonArray = new JSONArray();
@@ -291,10 +313,10 @@ public class OaFileInfoController {
         }
 
         if (StringUtils.isNotEmpty(subject)) {
-            searchParams.put("createBy", subject);
 
             if (curUser != null) {
                 if (StringUtils.isNotEmpty(curUser.getPhone())) {
+                    searchParams.put("createPhone", curUser.getPhone());
                     RegUser regUser = regUserService.findByPhone(curUser.getPhone());
                     if (regUser != null) {
                         //个人查看文件
@@ -319,6 +341,9 @@ public class OaFileInfoController {
                         }
                     }
                 }
+                else{
+                    searchParams.put("createBy", subject);
+                }
             }
         }
 
@@ -333,6 +358,12 @@ public class OaFileInfoController {
             if (user != null) {
                 oaFileInfo.setCreateByN(user.getRealName());
             }
+            else{
+                RegUser regUser = regUserService.findByPhone(oaFileInfo.getCreatePhone());
+                if(regUser!=null){
+                    oaFileInfo.setCreateByN(regUser.getName());
+                }
+            }
 
             String url = oaFileInfo.getUrl();
 
@@ -349,10 +380,12 @@ public class OaFileInfoController {
             }
 
             boolean isSelf = false;
-            if (oaFileInfo.getCreateBy().equals(subject)) {
+            if (oaFileInfo.getCreatePhone().equals(curUser.getPhone())) {
                 isSelf = true;
             }
             oaFileInfo.setIsSelf(isSelf);
+
+
         }
 
 

+ 70 - 7
web/src/main/java/com/jpsoft/railroad/modules/form/controller/FormCommonController.java

@@ -21,10 +21,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @RestController
 @RequestMapping("/form/formCommon")
@@ -105,12 +102,57 @@ public class FormCommonController {
 
                     curProcinstActivityList.add(procinstActivity);
 
+                    //用车申请
+                    if("9".equals(wfProcinst.getType())) {
+                        for (WfProcinstActivity item : procinstActivityList) {
+                            if (item.getFinishTime() != null) {
+                                int index = item.getActivityIndex() - 2;
+                                Date prevTime;
+                                if (index >= 0) {
+                                    WfProcinstActivity prevActivity = procinstActivityList.get(index);
+                                    prevTime = prevActivity.getFinishTime();
+                                } else {
+                                    prevTime = wfProcinst.getCreateTime();
+                                }
+
+                                if (prevTime != null) {
+                                    Date showTime = timeCheck(prevTime, item.getFinishTime());
+                                    item.setFinishTime(showTime);
+                                }
+                            }
+                        }
+                    }
+
+
                     for (WfProcinstActivity item : procinstActivityList) {
                         item.setActivityIndex(item.getActivityIndex() + 1);
 
-                        if ("or".equals(item.getOperation())) {
-                            List<WfProcinstActUser> wfProcinstActUserList = item.getWfProcinstActUserList();
+                        List<WfProcinstActUser> wfProcinstActUserList = item.getWfProcinstActUserList();
+
+                        //用车申请
+                        if("9".equals(wfProcinst.getType())) {
+                            for (WfProcinstActUser procinstActUser : wfProcinstActUserList) {
+                                //更改审核完成时间显示
+                                if (procinstActUser.getFinishTime() != null) {
+                                    int index = item.getActivityIndex() - 3;
+                                    Date prevTime;
+                                    if (index >= 0) {
+                                        WfProcinstActivity prevActivity = procinstActivityList.get(index);
+                                        prevTime = prevActivity.getFinishTime();
+                                    } else {
+                                        prevTime = wfProcinst.getCreateTime();
+                                    }
 
+                                    if (prevTime != null) {
+                                        Date showTime = timeCheck(prevTime, procinstActUser.getFinishTime());
+                                        procinstActUser.setFinishTime(showTime);
+                                    }
+                                }
+                            }
+                        }
+
+
+                        if ("or".equals(item.getOperation())) {
                             if (wfProcinstActUserList.size() > 1) {
 
                                 boolean flag = false;
@@ -121,7 +163,7 @@ public class FormCommonController {
                                 }
 
                                 //如果有一个更改状态的或签,则只显示一个审核人
-                                if(flag){
+                                if (flag) {
                                     for (WfProcinstActUser procinstActUser : wfProcinstActUserList) {
                                         if (!"0".equals(procinstActUser.getAction())) {
                                             wfProcinstActUserList = new ArrayList<>();
@@ -299,4 +341,25 @@ public class FormCommonController {
 
         return msgResult;
     }
+
+    //判断上一步创建时间或审核时间相较于本次完成时间是否超过30分钟
+    //未超过30分钟,用当前时间,超过30分钟上一次时间加30分钟作为完成时间显示
+    private Date timeCheck(Date prevTime, Date curFinishTime) {
+        Date dateTime;
+        long diff = curFinishTime.getTime() - prevTime.getTime();
+
+        if(diff>30*60*1000){
+            //超过30分钟
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(prevTime);
+            calendar.add(Calendar.MINUTE, 30);
+            dateTime = calendar.getTime();
+        }
+        else{
+            //未超过30分钟
+            dateTime=curFinishTime;
+        }
+
+        return dateTime;
+    }
 }

+ 233 - 95
web/src/main/java/com/jpsoft/railroad/modules/form/controller/VehicleApplicationInfoController.java

@@ -1,12 +1,14 @@
 package com.jpsoft.railroad.modules.form.controller;
 
 import com.github.pagehelper.Page;
+import com.jpsoft.railroad.config.OSSConfig;
 import com.jpsoft.railroad.modules.base.entity.Organization;
 import com.jpsoft.railroad.modules.base.entity.RegUser;
 import com.jpsoft.railroad.modules.base.service.OrganizationService;
 import com.jpsoft.railroad.modules.base.service.RegUserService;
 import com.jpsoft.railroad.modules.common.dto.Sort;
 import com.jpsoft.railroad.modules.common.dto.MessageResult;
+import com.jpsoft.railroad.modules.common.utils.OSSUtil;
 import com.jpsoft.railroad.modules.common.utils.PojoUtils;
 import com.jpsoft.railroad.modules.form.entity.VehicleApplicationInfo;
 import com.jpsoft.railroad.modules.form.service.VehicleApplicationInfoService;
@@ -17,12 +19,19 @@ import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 import org.apache.commons.collections.map.HashedMap;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -42,11 +51,14 @@ public class VehicleApplicationInfoController {
 
     @Autowired
     private UserService userService;
-	
-	
-	@ApiOperation(value="创建空记录")
+
+    @Autowired
+    private OSSConfig ossConfig;
+
+
+    @ApiOperation(value = "创建空记录")
     @GetMapping("create")
-    public MessageResult<VehicleApplicationInfo> create(){
+    public MessageResult<VehicleApplicationInfo> create() {
         MessageResult<VehicleApplicationInfo> msgResult = new MessageResult<>();
 
         VehicleApplicationInfo vehicleApplicationInfo = new VehicleApplicationInfo();
@@ -57,21 +69,21 @@ public class VehicleApplicationInfoController {
         return msgResult;
     }
 
-    @ApiOperation(value="添加信息")
+    @ApiOperation(value = "添加信息")
     @PostMapping("add")
-    public MessageResult<VehicleApplicationInfo> add(@RequestBody VehicleApplicationInfo vehicleApplicationInfo,@RequestAttribute String subject){
+    public MessageResult<VehicleApplicationInfo> add(@RequestBody VehicleApplicationInfo vehicleApplicationInfo, @RequestAttribute String subject) {
         MessageResult<VehicleApplicationInfo> msgResult = new MessageResult<>();
 
         try {
             Date now = new Date();
             vehicleApplicationInfo.setId(UUID.randomUUID().toString());
-			vehicleApplicationInfo.setDelFlag(false);
+            vehicleApplicationInfo.setDelFlag(false);
             vehicleApplicationInfo.setCreateBy(subject);
             vehicleApplicationInfo.setCreateTime(new Date());
 
-            SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
-            if(vehicleApplicationInfo.getRangeDateTime()!=null){
+            if (vehicleApplicationInfo.getRangeDateTime() != null) {
                 String startDateTime = vehicleApplicationInfo.getRangeDateTime()[0];
                 String endDateTime = vehicleApplicationInfo.getRangeDateTime()[1];
                 vehicleApplicationInfo.setStartTime(sdf.parse(startDateTime));
@@ -84,7 +96,7 @@ public class VehicleApplicationInfoController {
 
             JSONArray jsonArray = new JSONArray();
 
-            if(vehicleApplicationInfo.getAnnexFileList()!=null) {
+            if (vehicleApplicationInfo.getAnnexFileList() != null) {
                 for (Map<String, String> map : vehicleApplicationInfo.getAnnexFileList()) {
                     JSONObject jsonObject = new JSONObject();
                     jsonObject.put("name", map.get("name"));
@@ -93,7 +105,7 @@ public class VehicleApplicationInfoController {
                 }
             }
 
-            if(jsonArray.size()>0){
+            if (jsonArray.size() > 0) {
                 vehicleApplicationInfo.setAnnexFile(jsonArray.toString());
             }
 
@@ -102,22 +114,20 @@ public class VehicleApplicationInfoController {
             if (regUser != null) {
                 vehicleApplicationInfo.setApplyPersonId(regUser.getId());
                 vehicleApplicationInfo.setApplyDate(now);
-                if(StringUtils.isNotEmpty(regUser.getOrgId())){
+                if (StringUtils.isNotEmpty(regUser.getOrgId())) {
                     vehicleApplicationInfo.setDepartmentId(regUser.getOrgId());
                 }
 
                 //是否为保存草稿
-                if(vehicleApplicationInfo.getIsDraft()!=null){
-                    if(!vehicleApplicationInfo.getIsDraft()){
-                        affectCount = vehicleApplicationInfoService.insertAndProc(vehicleApplicationInfo,regUser);
-                    }
-                    else{
+                if (vehicleApplicationInfo.getIsDraft() != null) {
+                    if (!vehicleApplicationInfo.getIsDraft()) {
+                        affectCount = vehicleApplicationInfoService.insertAndProc(vehicleApplicationInfo, regUser);
+                    } else {
                         vehicleApplicationInfo.setStatus("-1");//为保存草稿
                         affectCount = vehicleApplicationInfoService.insert(vehicleApplicationInfo);
                     }
                 }
-            }
-            else{
+            } else {
                 msgResult.setResult(false);
                 msgResult.setMessage("账号未关联人员账号无法提交申请!");
             }
@@ -129,9 +139,8 @@ public class VehicleApplicationInfoController {
                 msgResult.setResult(false);
                 msgResult.setMessage("数据库添加失败");
             }
-        }
-        catch(Exception ex){
-            logger.error(ex.getMessage(),ex);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
 
             msgResult.setResult(false);
             msgResult.setMessage(ex.getMessage());
@@ -140,9 +149,9 @@ public class VehicleApplicationInfoController {
         return msgResult;
     }
 
-    @ApiOperation(value="获取信息")
+    @ApiOperation(value = "获取信息")
     @GetMapping("edit/{id}")
-    public MessageResult<VehicleApplicationInfo> edit(@PathVariable("id") String id){
+    public MessageResult<VehicleApplicationInfo> edit(@PathVariable("id") String id) {
         MessageResult<VehicleApplicationInfo> msgResult = new MessageResult<>();
 
         try {
@@ -150,11 +159,11 @@ public class VehicleApplicationInfoController {
 
             if (vehicleApplicationInfo != null) {
                 RegUser regUser = regUserService.get(vehicleApplicationInfo.getApplyPersonId());
-                if(regUser!=null){
+                if (regUser != null) {
                     vehicleApplicationInfo.setApplyPersonName(regUser.getName());
 
                     Organization organization = organizationService.get(regUser.getOrgId());
-                    if(organization!=null){
+                    if (organization != null) {
                         vehicleApplicationInfo.setOrgName(organization.getName());
                     }
                 }
@@ -163,7 +172,7 @@ public class VehicleApplicationInfoController {
 
                 List<Map> annexFileList = new ArrayList<>();
 
-                if(StringUtils.isNotEmpty(annexFile)) {
+                if (StringUtils.isNotEmpty(annexFile)) {
 
                     JSONArray jsonArray = JSONArray.fromObject(annexFile);
 
@@ -181,11 +190,11 @@ public class VehicleApplicationInfoController {
 
                 vehicleApplicationInfo.setAnnexFileList(annexFileList);
 
-                if(vehicleApplicationInfo.getStartTime()!=null&&vehicleApplicationInfo.getEndTime()!=null){
+                if (vehicleApplicationInfo.getStartTime() != null && vehicleApplicationInfo.getEndTime() != null) {
                     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                     String[] rangeDateTimeArr = new String[2];
-                    rangeDateTimeArr[0]=sdf.format(vehicleApplicationInfo.getStartTime());
-                    rangeDateTimeArr[1]=sdf.format(vehicleApplicationInfo.getEndTime());
+                    rangeDateTimeArr[0] = sdf.format(vehicleApplicationInfo.getStartTime());
+                    rangeDateTimeArr[1] = sdf.format(vehicleApplicationInfo.getEndTime());
                     vehicleApplicationInfo.setRangeDateTime(rangeDateTimeArr);
                 }
 
@@ -195,9 +204,8 @@ public class VehicleApplicationInfoController {
                 msgResult.setResult(false);
                 msgResult.setMessage("数据库不存在该记录!");
             }
-        }
-        catch(Exception ex){
-            logger.error(ex.getMessage(),ex);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
 
             msgResult.setResult(false);
             msgResult.setMessage(ex.getMessage());
@@ -206,19 +214,19 @@ public class VehicleApplicationInfoController {
         return msgResult;
     }
 
-    @ApiOperation(value="更新用户")
+    @ApiOperation(value = "更新用户")
     @PostMapping("update")
-    public MessageResult<VehicleApplicationInfo> update(@RequestBody VehicleApplicationInfo vehicleApplicationInfo,@RequestAttribute String subject){
+    public MessageResult<VehicleApplicationInfo> update(@RequestBody VehicleApplicationInfo vehicleApplicationInfo, @RequestAttribute String subject) {
         MessageResult<VehicleApplicationInfo> msgResult = new MessageResult<>();
 
         try {
             Date now = new Date();
-		    vehicleApplicationInfo.setUpdateBy(subject);
+            vehicleApplicationInfo.setUpdateBy(subject);
             vehicleApplicationInfo.setUpdateTime(new Date());
 
-            SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
-            if(vehicleApplicationInfo.getRangeDateTime()!=null){
+            if (vehicleApplicationInfo.getRangeDateTime() != null) {
                 String startDateTime = vehicleApplicationInfo.getRangeDateTime()[0];
                 String endDateTime = vehicleApplicationInfo.getRangeDateTime()[1];
                 vehicleApplicationInfo.setStartTime(sdf.parse(startDateTime));
@@ -233,7 +241,7 @@ public class VehicleApplicationInfoController {
 
             JSONArray jsonArray = new JSONArray();
 
-            if(vehicleApplicationInfo.getAnnexFileList()!=null) {
+            if (vehicleApplicationInfo.getAnnexFileList() != null) {
                 for (Map<String, String> map : vehicleApplicationInfo.getAnnexFileList()) {
                     JSONObject jsonObject = new JSONObject();
                     jsonObject.put("name", map.get("name"));
@@ -242,7 +250,7 @@ public class VehicleApplicationInfoController {
                 }
             }
 
-            if(jsonArray.size()>0){
+            if (jsonArray.size() > 0) {
                 vehicleApplicationInfo.setAnnexFile(jsonArray.toString());
             }
 
@@ -250,17 +258,15 @@ public class VehicleApplicationInfoController {
                 vehicleApplicationInfo.setApplyDate(now);
 
                 //是否为保存草稿
-                if(vehicleApplicationInfo.getIsDraft()!=null){
-                    if(!vehicleApplicationInfo.getIsDraft()){
-                        affectCount = vehicleApplicationInfoService.updateAndProc(vehicleApplicationInfo,regUser);
-                    }
-                    else{
+                if (vehicleApplicationInfo.getIsDraft() != null) {
+                    if (!vehicleApplicationInfo.getIsDraft()) {
+                        affectCount = vehicleApplicationInfoService.updateAndProc(vehicleApplicationInfo, regUser);
+                    } else {
                         vehicleApplicationInfo.setStatus("-1");//为保存草稿
                         affectCount = vehicleApplicationInfoService.update(vehicleApplicationInfo);
                     }
                 }
-            }
-            else{
+            } else {
                 msgResult.setResult(false);
                 msgResult.setMessage("账号未关联人员账号无法提交申请!");
             }
@@ -272,9 +278,8 @@ public class VehicleApplicationInfoController {
                 msgResult.setResult(false);
                 msgResult.setMessage("数据库更新失败");
             }
-        }
-        catch(Exception ex){
-            logger.error(ex.getMessage(),ex);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
 
             msgResult.setResult(false);
             msgResult.setMessage(ex.getMessage());
@@ -283,19 +288,19 @@ public class VehicleApplicationInfoController {
         return msgResult;
     }
 
-    @ApiOperation(value="删除用户")
+    @ApiOperation(value = "删除用户")
     @PostMapping("delete/{id}")
-    public MessageResult<VehicleApplicationInfo> delete(@PathVariable("id") String id,@RequestAttribute String subject){
+    public MessageResult<VehicleApplicationInfo> delete(@PathVariable("id") String id, @RequestAttribute String subject) {
         MessageResult<VehicleApplicationInfo> msgResult = new MessageResult<>();
 
         try {
-			
-			VehicleApplicationInfo vehicleApplicationInfo = vehicleApplicationInfoService.get(id);
+
+            VehicleApplicationInfo vehicleApplicationInfo = vehicleApplicationInfoService.get(id);
             vehicleApplicationInfo.setDelFlag(true);
             vehicleApplicationInfo.setUpdateBy(subject);
             vehicleApplicationInfo.setUpdateTime(new Date());
-			
-			int affectCount = vehicleApplicationInfoService.updateAndProcinst(vehicleApplicationInfo);
+
+            int affectCount = vehicleApplicationInfoService.updateAndProcinst(vehicleApplicationInfo);
 
             if (affectCount > 0) {
                 msgResult.setResult(true);
@@ -303,9 +308,8 @@ public class VehicleApplicationInfoController {
                 msgResult.setResult(false);
                 msgResult.setMessage("数据库删除失败");
             }
-        }
-        catch(Exception ex){
-            logger.error(ex.getMessage(),ex);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
 
             msgResult.setResult(false);
             msgResult.setMessage(ex.getMessage());
@@ -315,9 +319,9 @@ public class VehicleApplicationInfoController {
     }
 
 
-    @ApiOperation(value="批量删除")
+    @ApiOperation(value = "批量删除")
     @PostMapping("batchDelete")
-    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
+    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList, @RequestAttribute String subject) {
         MessageResult<Integer> msgResult = new MessageResult<>();
 
         try {
@@ -339,9 +343,8 @@ public class VehicleApplicationInfoController {
                 msgResult.setResult(false);
                 msgResult.setMessage("删除失败");
             }
-        }
-        catch(Exception ex){
-            logger.error(ex.getMessage(),ex);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
 
             msgResult.setResult(false);
             msgResult.setMessage(ex.getMessage());
@@ -350,56 +353,191 @@ public class VehicleApplicationInfoController {
         return msgResult;
     }
 
-    @ApiOperation(value="列表")
-    @RequestMapping(value = "pageList",method = RequestMethod.POST)
-    public MessageResult<Map> pageList(
-            String id,
-            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
-            @RequestParam(value="pageSize",defaultValue="20") int pageSize,
-            HttpServletRequest request){
-        String subject = (String)request.getAttribute("subject");
+    @ApiOperation(value = "列表")
+    @RequestMapping(value = "pageList", method = RequestMethod.POST)
+    public MessageResult<Object> pageList(
+            String applyDateRange,
+            @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
+            @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
+            @RequestParam(value = "exportFlag", defaultValue = "false") Boolean exportFlag,
+            HttpServletRequest request) {
+        String subject = (String) request.getAttribute("subject");
 
         //当前用户ID
         System.out.println(subject);
 
         User user = userService.get(subject);
 
-        MessageResult<Map> msgResult = new MessageResult<>();
+        MessageResult<Object> msgResult = new MessageResult<>();
+
+        try {
 
-        Map<String,Object> searchParams = new HashMap<>();
+            Map<String, Object> searchParams = new HashMap<>();
 
-        List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("create_time","desc"));
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("create_time", "desc"));
 
-        if (!userService.hasRole(subject, "SYSADMIN")) {
-            RegUser curRegUser = regUserService.findByPhone(user.getPhone());
-            if(curRegUser!=null){
-                searchParams.put("applyPersonId", curRegUser.getId());
+            if (!userService.hasRole(subject, "SYSADMIN")) {
+                RegUser curRegUser = regUserService.findByPhone(user.getPhone());
+                if (curRegUser != null) {
+                    searchParams.put("applyPersonId", curRegUser.getId());
+                }
+            } else {
+                searchParams.put("status", "-1");
             }
-        }
-        else{
-            searchParams.put("status", "-1");
-        }
 
-        Page<VehicleApplicationInfo> page = vehicleApplicationInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+            if (StringUtils.isNotEmpty(applyDateRange)) {
+                String[] timeRangeArray = applyDateRange.split(",");
+                String startTime = "";
+                String endTime = "";
+                if (timeRangeArray.length == 1) {
+                    startTime = timeRangeArray[0];
+                    startTime += " 00:00:00";
+                } else if (timeRangeArray.length == 2) {
+                    startTime = timeRangeArray[0];
+                    endTime = timeRangeArray[1];
+                    startTime += " 00:00:00";
+                    endTime += " 23:59:59";
+                }
+                searchParams.put("startTime", startTime);
+                searchParams.put("endTime", endTime);
+            }
 
-        for (VehicleApplicationInfo vehicleApplicationInfo:page) {
+            Page<VehicleApplicationInfo> page = vehicleApplicationInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
 
-            RegUser regUser = regUserService.get(vehicleApplicationInfo.getApplyPersonId());
-            if(regUser!=null){
-                vehicleApplicationInfo.setApplyPersonName(regUser.getName());
+            List<Map> mapList = new ArrayList<>();
 
-                Organization organization = organizationService.get(regUser.getOrgId());
-                if(organization!=null){
-                    vehicleApplicationInfo.setOrgName(organization.getName());
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+
+            for (VehicleApplicationInfo vehicleApplicationInfo : page) {
+                Map map = new HashMap();
+                map.put("id", vehicleApplicationInfo.getId());
+                String applyDateStr = "";
+                if (vehicleApplicationInfo.getApplyDate() != null) {
+                    applyDateStr = sdf.format(vehicleApplicationInfo.getApplyDate());
+                }
+                map.put("applyDate", applyDateStr);
+                map.put("reason", vehicleApplicationInfo.getReason());
+
+                String startTimeStr = "";
+                if (vehicleApplicationInfo.getStartTime() != null) {
+                    startTimeStr = sdf1.format(vehicleApplicationInfo.getStartTime());
+                }
+
+                map.put("startTime", startTimeStr);
+
+                String endTimeStr = "";
+                if (vehicleApplicationInfo.getEndTime() != null) {
+                    endTimeStr = sdf1.format(vehicleApplicationInfo.getEndTime());
                 }
+                map.put("endTime", endTimeStr);
+                map.put("startAddress", vehicleApplicationInfo.getStartAddress());
+                map.put("endAddress", vehicleApplicationInfo.getEndAddress());
+                map.put("kilometers", vehicleApplicationInfo.getKilometers());
+                map.put("amount", vehicleApplicationInfo.getAmount());
+                map.put("bak", vehicleApplicationInfo.getBak());
+
+                String createTimeStr = "";
+                if (vehicleApplicationInfo.getCreateTime() != null) {
+                    createTimeStr = sdf1.format(vehicleApplicationInfo.getCreateTime());
+                }
+
+                map.put("createTime", createTimeStr);
+                map.put("status", vehicleApplicationInfo.getStatus());
+
+                map.put("statusN", vehicleApplicationInfo.getStatusN());
+
+                String applyPersonName = "";
+                String orgName = "";
+
+                RegUser regUser = regUserService.get(vehicleApplicationInfo.getApplyPersonId());
+                if (regUser != null) {
+                    applyPersonName = regUser.getName();
+                    vehicleApplicationInfo.setApplyPersonName(regUser.getName());
+
+                    Organization organization = organizationService.get(regUser.getOrgId());
+                    if (organization != null) {
+                        orgName = organization.getName();
+                    }
+                }
+
+                map.put("applyPersonName", applyPersonName);
+                map.put("orgName", orgName);
+
+                mapList.add(map);
             }
-        }
 
+            if (exportFlag) {
+                String filePath = exportXls(mapList);
+                msgResult.setData(filePath);
+            } else {
+                Map<String, Object> dataMap = PojoUtils.pageWrapper(page);
+                dataMap.put("data", mapList);
+                msgResult.setData(dataMap);
+            }
 
-        msgResult.setResult(true);
-        msgResult.setData(PojoUtils.pageWrapper(page));
+            msgResult.setResult(true);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+            msgResult.setResult(false);
+        }
 
         return msgResult;
     }
+
+
+    private String exportXls(List<Map> mapList) {
+        String downloadUrl = "";
+
+        Workbook workbook = new HSSFWorkbook();
+        Sheet sheet = workbook.createSheet();
+
+        //表头
+        Row rowTitle = sheet.createRow(0);
+
+        String[] titles = new String[]{"序号", "日期", "姓名", "事由","用车开始时间","用车结束时间",
+                "起始地","目的地", "公里数", "金额", "备注","申请时间","状态"};
+
+        for (int i = 0; i < titles.length; i++) {
+            Cell cell = rowTitle.createCell(i);
+            cell.setCellValue(titles[i]);
+        }
+
+        for (int i = 0; i < mapList.size(); i++) {
+            Map<String, Object> map = mapList.get(i);
+
+            Row row = sheet.createRow(i + 1);
+
+            int colIndex = 0;
+            row.createCell(colIndex++).setCellValue(i + 1);
+            row.createCell(colIndex++).setCellValue(com.jpsoft.railroad.utils.StringUtils.strValue(map.get("applyDate"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.railroad.utils.StringUtils.strValue(map.get("applyPersonName"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.railroad.utils.StringUtils.strValue(map.get("reason"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.railroad.utils.StringUtils.strValue(map.get("startTime"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.railroad.utils.StringUtils.strValue(map.get("endTime"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.railroad.utils.StringUtils.strValue(map.get("startAddress"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.railroad.utils.StringUtils.strValue(map.get("endAddress"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.railroad.utils.StringUtils.strValue(map.get("kilometers"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.railroad.utils.StringUtils.strValue(map.get("amount"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.railroad.utils.StringUtils.strValue(map.get("bak"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.railroad.utils.StringUtils.strValue(map.get("createTime"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.railroad.utils.StringUtils.strValue(map.get("statusN"), ""));
+        }
+
+        ByteArrayOutputStream output = new ByteArrayOutputStream();
+
+        try {
+            workbook.write(output);
+
+            byte[] buffer = output.toByteArray();
+            ByteArrayInputStream input = new ByteArrayInputStream(buffer);
+
+            downloadUrl = OSSUtil.upload(ossConfig, "vehicleApplicationList", "用车申请记录.xls", input);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+        }
+
+        return downloadUrl;
+    }
 }

+ 10 - 6
web/src/main/java/com/jpsoft/railroad/modules/mobile/controller/ApplicationApiController.java

@@ -1188,7 +1188,8 @@ public class ApplicationApiController {
             @ApiImplicitParam(name = "reason", value = "用车事由", paramType = "form"),
             @ApiImplicitParam(name = "startTime", value = "用车开始时间", paramType = "form"),
             @ApiImplicitParam(name = "endTime", value = "用车结束时间", paramType = "form"),
-            @ApiImplicitParam(name = "locations", value = "起止地点", paramType = "form"),
+            @ApiImplicitParam(name = "startAddress", value = "起始地点", paramType = "form"),
+            @ApiImplicitParam(name = "endAddress", value = "结束地点", paramType = "form"),
             @ApiImplicitParam(name = "bankAccount", value = "银行账户", paramType = "form"),
             @ApiImplicitParam(name = "kilometers", value = "公里数", paramType = "form"),
             @ApiImplicitParam(name = "amount", value = "金额", paramType = "form"),
@@ -1202,9 +1203,10 @@ public class ApplicationApiController {
                                 String title,
                                 String position,
                                 String reason,
-                                @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
-                                @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime,
-                                String locations,
+                                @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
+                                @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
+                                String startAddress,
+                                String endAddress,
                                 String bankAccount,
                                 Double kilometers,
                                 Double amount,
@@ -1251,7 +1253,8 @@ public class ApplicationApiController {
                 apply.setReason(reason);
                 apply.setStartTime(startTime);
                 apply.setEndTime(endTime);
-                apply.setLocations(locations);
+                apply.setStartAddress(startAddress);
+                apply.setEndAddress(endAddress);
                 apply.setBankAccount(bankAccount);
                 if(kilometers != null) {
                     apply.setKilometers(BigDecimal.valueOf(kilometers));
@@ -1289,7 +1292,8 @@ public class ApplicationApiController {
                 apply.setReason(reason);
                 apply.setStartTime(startTime);
                 apply.setEndTime(endTime);
-                apply.setLocations(locations);
+                apply.setStartAddress(startAddress);
+                apply.setEndAddress(endAddress);
                 apply.setBankAccount(bankAccount);
                 if(kilometers != null) {
                     apply.setKilometers(BigDecimal.valueOf(kilometers));

+ 431 - 0
web/src/main/java/com/jpsoft/railroad/modules/mobile/controller/OaFileInfoApi.java

@@ -0,0 +1,431 @@
+package com.jpsoft.railroad.modules.mobile.controller;
+
+
+import com.github.pagehelper.Page;
+import com.jpsoft.railroad.modules.base.dto.OaFileRelationDTO;
+import com.jpsoft.railroad.modules.base.entity.OaFileInfo;
+import com.jpsoft.railroad.modules.base.entity.OaFileRegUserInfo;
+import com.jpsoft.railroad.modules.base.entity.Organization;
+import com.jpsoft.railroad.modules.base.entity.RegUser;
+import com.jpsoft.railroad.modules.base.service.OaFileInfoService;
+import com.jpsoft.railroad.modules.base.service.OaFileRegUserInfoService;
+import com.jpsoft.railroad.modules.base.service.OrganizationService;
+import com.jpsoft.railroad.modules.base.service.RegUserService;
+import com.jpsoft.railroad.modules.common.dto.MessageResult;
+import com.jpsoft.railroad.modules.common.dto.Sort;
+import com.jpsoft.railroad.modules.common.utils.PojoUtils;
+import com.jpsoft.railroad.modules.sys.entity.User;
+import com.jpsoft.railroad.modules.sys.service.DataDictionaryService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+import org.apache.commons.collections.map.HashedMap;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+
+@RestController
+@RequestMapping("/mobile/oaFileInfo")
+@Api(description = "文件柜")
+public class OaFileInfoApi {
+
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Value("${jwt.secret}")
+    private String jwtSecret;
+
+    @Autowired
+    private RegUserService regUserService;
+
+    @Autowired
+    private OaFileInfoService oaFileInfoService;
+
+    @Autowired
+    private OrganizationService organizationService;
+
+    @Autowired
+    private OaFileRegUserInfoService oaFileRegUserInfoService;
+
+
+    @ApiOperation(value="公告列表")
+    @RequestMapping(value = "oaFileInfoList",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "name", required = false,paramType = "form"),
+            @ApiImplicitParam(name = "queryDate", value = "queryDate", required = false,paramType = "form"),
+    })
+    public MessageResult<Map> oaFileInfoList(
+            @DateTimeFormat(pattern = "yyyy-MM-dd") Date queryDate,
+            @RequestParam(value = "name", defaultValue = "") String name,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize,
+            @RequestAttribute String subject){
+        MessageResult<Map> msgResult = new MessageResult<>();
+        Map<String, Object> map = new HashMap<>();
+
+        try {
+            Map<String,Object> searchParams = new HashMap<>();
+
+            RegUser curUser = regUserService.get(subject);
+            if(curUser == null){
+                throw new Exception("未登录");
+            }
+
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("create_time","desc"));
+
+            if(queryDate != null){
+                searchParams.put("createTime",queryDate);
+            }
+
+            if(StringUtils.isNotEmpty(name)){
+                searchParams.put("name","%" + name + "%");
+            }
+
+            if (StringUtils.isNotEmpty(subject)) {
+                if (curUser != null) {
+                    if (StringUtils.isNotEmpty(curUser.getPhone())) {
+
+                        searchParams.put("createPhone", curUser.getPhone());
+
+                        RegUser regUser = regUserService.findByPhone(curUser.getPhone());
+                        if (regUser != null) {
+                            //个人查看文件
+                            List<OaFileRegUserInfo> oaFileRegUserInfoList = oaFileRegUserInfoService.findRelationByRegId(regUser.getId(), "2");
+                            searchParams.put("oaFileRegUserInfoList", oaFileRegUserInfoList);
+
+                            //部门查看文件
+                            List<String> orgIdList = new ArrayList<>();
+                            String orgId = regUser.getOrgId();
+                            orgIdList.add(orgId);
+                            Organization organization = organizationService.get(orgId);
+                            while (StringUtils.isNotEmpty(organization.getParentId())) {
+                                Organization parentItem = organizationService.get(organization.getParentId());
+                                if (parentItem != null) {
+                                    orgIdList.add(parentItem.getId());
+                                }
+                                organization = parentItem;
+                            }
+                            List<OaFileRegUserInfo> oaFileOrgList = oaFileRegUserInfoService.findRelationByOrgs(orgIdList, "1");
+                            if (oaFileOrgList.size() > 0) {
+                                searchParams.put("oaFileOrgList", oaFileOrgList);
+                            }
+                        }
+                    }
+                }
+            }
+
+            Page<OaFileInfo> page = oaFileInfoService.pageSearchByMobile(searchParams,pageIndex,pageSize,true,sortList);
+
+            for (OaFileInfo oaFileInfo:page) {
+                if(StringUtils.isNotEmpty(oaFileInfo.getCreateBy())){
+                    RegUser regUser1 = regUserService.findByPhone(oaFileInfo.getCreatePhone());
+                    if(regUser1!=null){
+                        oaFileInfo.setCreateByN(regUser1.getName());
+
+                        Organization organization = organizationService.get(regUser1.getOrgId());
+                        if(organization!=null){
+                            oaFileInfo.setOrgName(organization.getName());
+                        }
+                    }
+                }
+            }
+
+            msgResult.setResult(true);
+            msgResult.setData(PojoUtils.pageWrapper(page));
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="公告详细")
+    @RequestMapping(value = "oaFileInfoDetails",method = RequestMethod.POST)
+    public MessageResult<Map> oaFileInfoDetails(
+            String id,
+            @RequestAttribute String subject){
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        try {
+            Map<String,Object> returnMap = new HashMap<>();
+
+            RegUser regUser = regUserService.get(subject);
+            if(regUser == null){
+                throw new Exception("未登录");
+            }
+
+            OaFileInfo oaFileInfo = oaFileInfoService.get(id);
+            returnMap.put("oaFileInfo",oaFileInfo);
+
+            msgResult.setResult(true);
+            msgResult.setData(returnMap);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+
+    @ApiOperation(value="获取部门和人员信息")
+    @RequestMapping(value = "query",method = RequestMethod.GET)
+    public MessageResult<Map> query(String id) {
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        try {
+            Map map = new HashMap();
+
+            List<Organization> orgList = organizationService.findAllListOrder();
+
+            List<RegUser> regUserList = regUserService.findAllListOrder();
+
+            List<OaFileRegUserInfo> orgRelationList = oaFileRegUserInfoService.findRelationByFileId(id, "1");
+
+            List<OaFileRegUserInfo> regUserRelationList = oaFileRegUserInfoService.findRelationByFileId(id, "2");
+
+
+            map.put("orgList",orgList);
+            map.put("regUserList",regUserList);
+            map.put("orgRelationList",orgRelationList);
+            map.put("regUserRelationList",regUserRelationList);
+
+            msgResult.setResult(true);
+            msgResult.setData(map);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value = "更新相关联部门或者人员")
+    @PostMapping("relationItem")
+    public MessageResult<Integer> relationItem(@RequestBody OaFileRelationDTO dto, @RequestAttribute String subject) {
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+
+            int affectCount = oaFileRegUserInfoService.relationItem(dto,subject);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value = "添加文件")
+    @PostMapping("add")
+    public MessageResult<OaFileInfo> add(@RequestBody OaFileInfo oaFileInfo, @RequestAttribute String subject) {
+        MessageResult<OaFileInfo> msgResult = new MessageResult<>();
+
+        try {
+            oaFileInfo.setId(UUID.randomUUID().toString());
+            oaFileInfo.setDelFlag(false);
+            oaFileInfo.setCreateBy(subject);
+
+            String phone = "";
+
+            RegUser regUser = regUserService.get(subject);
+
+            //先判断是否前端用户创建
+            if (regUser != null) {
+                phone = regUser.getPhone();
+            }
+
+            if(StringUtils.isNotEmpty(phone)){
+                oaFileInfo.setCreatePhone(phone);
+            }
+
+            oaFileInfo.setCreateTime(new Date());
+
+            JSONArray jsonArray = new JSONArray();
+
+            if (oaFileInfo.getUrlList() != null) {
+                for (Map<String, String> map : oaFileInfo.getUrlList()) {
+                    JSONObject jsonObject = new JSONObject();
+                    jsonObject.put("name", map.get("name"));
+                    jsonObject.put("url", map.get("url"));
+                    jsonArray.add(jsonObject);
+                }
+            }
+
+            if (jsonArray.size() > 0) {
+                oaFileInfo.setUrl(jsonArray.toString());
+            }
+
+
+            int affectCount = oaFileInfoService.insert(oaFileInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(oaFileInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "获取文件")
+    @GetMapping("edit/{id}")
+    public MessageResult<OaFileInfo> edit(@PathVariable("id") String id) {
+        MessageResult<OaFileInfo> msgResult = new MessageResult<>();
+
+        try {
+            OaFileInfo oaFileInfo = oaFileInfoService.get(id);
+
+            if (oaFileInfo != null) {
+                String url = oaFileInfo.getUrl();
+
+                List<Map> annexFileList = new ArrayList<>();
+
+                if (StringUtils.isNotEmpty(url)) {
+
+                    JSONArray jsonArray = JSONArray.fromObject(url);
+
+                    for (Object object : jsonArray) {
+                        Map map = new HashedMap();
+                        JSONObject jsonObject = JSONObject.fromObject(object);
+                        String fileName = jsonObject.get("name").toString();
+                        String urlAddress = jsonObject.get("url").toString();
+                        map.put("fileName", fileName);
+                        map.put("url", urlAddress);
+                        map.put("name", fileName);
+                        annexFileList.add(map);
+                    }
+                }
+
+                oaFileInfo.setUrlList(annexFileList);
+
+
+                msgResult.setResult(true);
+                msgResult.setData(oaFileInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "更新文件")
+    @PostMapping("update")
+    public MessageResult<OaFileInfo> update(@RequestBody OaFileInfo oaFileInfo, @RequestAttribute String subject) {
+        MessageResult<OaFileInfo> msgResult = new MessageResult<>();
+
+        try {
+            oaFileInfo.setUpdateBy(subject);
+            oaFileInfo.setUpdateTime(new Date());
+
+
+            JSONArray jsonArray = new JSONArray();
+
+            if (oaFileInfo.getUrlList() != null) {
+                for (Map<String, String> map : oaFileInfo.getUrlList()) {
+                    JSONObject jsonObject = new JSONObject();
+                    jsonObject.put("name", map.get("name"));
+                    jsonObject.put("url", map.get("url"));
+                    jsonArray.add(jsonObject);
+                }
+            }
+
+            if (jsonArray.size() > 0) {
+                oaFileInfo.setUrl(jsonArray.toString());
+            }
+
+            int affectCount = oaFileInfoService.update(oaFileInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(oaFileInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value = "删除文件")
+    @PostMapping("delete/{id}")
+    public MessageResult<OaFileInfo> delete(@PathVariable("id") String id, @RequestAttribute String subject) {
+        MessageResult<OaFileInfo> msgResult = new MessageResult<>();
+
+        try {
+
+            OaFileInfo oaFileInfo = oaFileInfoService.get(id);
+            oaFileInfo.setDelFlag(true);
+            oaFileInfo.setUpdateBy(subject);
+            oaFileInfo.setUpdateTime(new Date());
+
+            int affectCount = oaFileInfoService.update(oaFileInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库删除失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+}