wanghongzhi 1 年間 前
コミット
1830956617

+ 87 - 11
src/main/java/com/qdport/controller/ImportDataController.java

@@ -6,11 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qdport.annotation.WebLog;
 import com.qdport.core.tool.api.R;
 import com.qdport.core.tool.utils.DateUtil;
+import com.qdport.entity.PolicyShare;
 import com.qdport.entity.PolicyStrive;
 import com.qdport.enums.QDPortEnum;
 import com.qdport.modules.system.entity.SysUser;
 import com.qdport.modules.system.service.TSysUserService;
-import com.qdport.service.PolicyLogService;
 import com.qdport.service.PolicyShareService;
 import com.qdport.service.PolicyStriveService;
 import com.qdport.service.impl.PolicySystemService;
@@ -27,7 +27,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -46,6 +45,14 @@ public class ImportDataController {
     private TSysUserService sysUserService;
     @Resource
     private PolicySystemService policySystemService;
+    private final static String errorMsg_null = "excel中缺失有效数据";
+    private final static String errorMsg_hang = "该行数据存在必填字段未输入";
+    private final static String errorMsg_docNo = "政策文号已经存在,请勿重复填写";
+    private final static String errorMsg_docNo_2 = "政策文号填写错误,查不到对应的政策分享数据";
+    private final static String errorMsg_createName = "填报人或者填报人联系方式填写错误";
+    private final static String errorMsg_yjTime = "预计完成时间格式填写错误";
+    private final static String errorMsg_sjTime = "实际完成时间格式填写错误";
+    private final static String errorMsg_businessNo = "项目编号填写错误,查不到对应的政策争取";
 
 
     @PostMapping("/policyShare")
@@ -56,21 +63,34 @@ public class ImportDataController {
         List<PolicyShareExcelVO> list = ExcelUtil.readPolicyShareFromXls(byteFromUrl);
 
         if (list.isEmpty()) {
-            throw new Exception("excel中缺失有效数据");
+            throw new Exception(errorMsg_null);
         }
         list = list.stream().filter(model -> StringUtil.isNotEmpty(model.getIndex())).collect(Collectors.toList());
         List<PolicyShareExcelVO> excelVOList = new ArrayList<>();
         for (PolicyShareExcelVO model : list) {
             try {
+                if (!StringUtil.checkFieldsNotEmpty(model)) {
+                    throw new Exception(errorMsg_hang);
+                }
+
                 PolicyShareVO shareVO = new PolicyShareVO();
                 BeanUtils.copyProperties(model, shareVO);
 
                 shareVO.setStatus(QDPortEnum.POLICY_SHARE_STATUS_ACTIVE.getValue());
 
+                QueryWrapper<PolicyShare> wrapper = new QueryWrapper<>();
+                wrapper.eq("DOC_NO", model.getDocNo());
+                long count = policyShareService.count(wrapper);
+                if (count > 0) {
+                    throw new Exception(errorMsg_docNo);
+                }
                 QueryWrapper<SysUser> userWrapper = new QueryWrapper<>();
                 userWrapper.eq("MOBILE", model.getContactPhone());
                 userWrapper.eq("NAME", model.getCreateName());
                 SysUser createUser = sysUserService.getOne(userWrapper);
+                if (StringUtil.isEmpty(createUser.getId())) {
+                    throw new Exception(errorMsg_createName);
+                }
                 shareVO.setCreateId(Long.valueOf(createUser.getId()));
                 shareVO.setUpdateId(Long.valueOf(createUser.getId()));
                 shareVO.setCreateName(createUser.getName());
@@ -80,7 +100,12 @@ public class ImportDataController {
                 shareVO.setCompanyId(Long.valueOf(map.get("companyId")));
 
                 policyShareService.save(shareVO);
+
+                model.setIsSuccess(true);
+                excelVOList.add(model);
             } catch (Exception e) {
+                model.setIsSuccess(false);
+                model.setErrorMsg(e.getMessage());
                 excelVOList.add(model);
             }
         }
@@ -95,24 +120,43 @@ public class ImportDataController {
         List<PolicyStriveExcelVO> list = ExcelUtil.readPolicyStriveFromXls(byteFromUrl);
 
         if (list.isEmpty()) {
-            throw new Exception("excel中缺失有效数据");
+            throw new Exception(errorMsg_null);
         }
         list = list.stream().filter(model -> StringUtil.isNotEmpty(model.getIndex())).collect(Collectors.toList());
         List<PolicyStriveExcelVO> excelVOList = new ArrayList<>();
         for (PolicyStriveExcelVO model : list) {
             try {
+                if(!StringUtil.checkFieldsNotEmpty(model)){
+                    throw new Exception(errorMsg_hang);
+                }
+
                 PolicyStriveVO striveVO = new PolicyStriveVO();
                 BeanUtils.copyProperties(model, striveVO);
 
-                Date yjFinishTime = DateUtil.parse(model.getYjFinishTime(), DateUtil.PATTERN_DATE);
-                striveVO.setYjFinishTime(yjFinishTime);
+                try {
+                    Date yjFinishTime = DateUtil.parse(model.getYjFinishTime(), DateUtil.PATTERN_DATE);
+                    striveVO.setYjFinishTime(yjFinishTime);
+                } catch (RuntimeException re) {
+                    throw new Exception(errorMsg_yjTime);
+                }
+
 
                 striveVO.setStatus(QDPortEnum.POLICY_SHARE_STATUS_ACTIVE.getValue());
 
+                QueryWrapper<PolicyShare> wrapper = new QueryWrapper<>();
+                wrapper.eq("DOC_NO", model.getDocNo());
+                long count = policyShareService.count(wrapper);
+                if (count == 0) {
+                    throw new Exception(errorMsg_docNo_2);
+                }
+
                 QueryWrapper<SysUser> userWrapper = new QueryWrapper<>();
                 userWrapper.eq("MOBILE", model.getContactPhone());
                 userWrapper.eq("NAME", model.getCreateName());
                 SysUser createUser = sysUserService.getOne(userWrapper);
+                if (StringUtil.isEmpty(createUser.getId())) {
+                    throw new Exception(errorMsg_createName);
+                }
                 striveVO.setCreateId(Long.valueOf(createUser.getId()));
                 striveVO.setUpdateId(Long.valueOf(createUser.getId()));
                 striveVO.setCreateName(createUser.getName());
@@ -122,7 +166,12 @@ public class ImportDataController {
                 striveVO.setCompanyId(Long.valueOf(map.get("companyId")));
 
                 policyStriveService.save(striveVO);
+
+                model.setIsSuccess(true);
+                excelVOList.add(model);
             } catch (Exception e) {
+                model.setIsSuccess(false);
+                model.setErrorMsg(e.getMessage());
                 excelVOList.add(model);
             }
         }
@@ -134,29 +183,48 @@ public class ImportDataController {
     @WebLog(operateName = "导入政策争取月度excel", operateType = "policy_strive")
     public R policyStriveMonth(@RequestBody PolicyStriveVO vo) throws Exception {
         byte[] byteFromUrl = HttpsUtil.getByteFromUrl(vo.getExcelUrl());
-        List<PolicyStriveExcelVO> list = ExcelUtil.readPolicyStriveMonthFromXls(byteFromUrl);
+        List<PolicyStriveMonthExcelVO> list = ExcelUtil.readPolicyStriveMonthFromXls(byteFromUrl);
 
         if (list.isEmpty()) {
-            throw new Exception("excel中缺失有效数据");
+            throw new Exception(errorMsg_null);
         }
         list = list.stream().filter(model -> StringUtil.isNotEmpty(model.getIndex())).collect(Collectors.toList());
-        List<PolicyStriveExcelVO> excelVOList = new ArrayList<>();
-        for (PolicyStriveExcelVO model : list) {
+        List<PolicyStriveMonthExcelVO> excelVOList = new ArrayList<>();
+        for (PolicyStriveMonthExcelVO model : list) {
             try {
+                if (!StringUtil.checkFieldsNotEmpty(model)) {
+                    throw new Exception(errorMsg_hang);
+                }
+
                 PolicyStriveVO striveVO = new PolicyStriveVO();
                 BeanUtils.copyProperties(model, striveVO);
 
                 QueryWrapper<PolicyStrive> striveWrapper = new QueryWrapper<>();
                 striveWrapper.eq("BUSINESS_NO", model.getBusinessNo());
                 PolicyStrive existStrive = policyStriveService.getOne(striveWrapper);
+                if(StringUtil.isEmpty(existStrive.getId())){
+                    throw new Exception(errorMsg_businessNo);
+                }
                 striveVO.setId(existStrive.getId());
 
                 if ("是".equals(model.getIsLand())) {
                     striveVO.setIsLand(1);
+                    try {
+                        Date sjFinishTime = DateUtil.parse(model.getSjFinishTime(), DateUtil.PATTERN_DATE);
+                        striveVO.setSjFinishTime(sjFinishTime);
+                    } catch (RuntimeException re) {
+                        throw new Exception(errorMsg_sjTime);
+                    }
                 } else {
                     striveVO.setIsLand(0);
                 }
-                String[] partSplit = model.getPartPersonArr().split(",");
+                String[] partSplit = new String[]{};
+                String partPersonArr = model.getPartPersonArr();
+                if (partPersonArr.contains(",")) {
+                    partSplit = model.getPartPersonArr().split(",");
+                } else if (partPersonArr.contains(",")) {
+                    partSplit = model.getPartPersonArr().split(",");
+                }
                 JSONArray array = new JSONArray();
                 for (String partName : partSplit) {
                     JSONObject partObj = new JSONObject();
@@ -169,11 +237,19 @@ public class ImportDataController {
                 userWrapper.eq("MOBILE", model.getContactPhone());
                 userWrapper.eq("NAME", model.getCreateName());
                 SysUser createUser = sysUserService.getOne(userWrapper);
+                if (StringUtil.isEmpty(createUser.getId())) {
+                    throw new Exception(errorMsg_createName);
+                }
                 striveVO.setUpdateId(Long.valueOf(createUser.getId()));
                 striveVO.setUpdateTime(new Date());
 
                 policyStriveService.updateById(striveVO);
+
+                model.setIsSuccess(true);
+                excelVOList.add(model);
             } catch (Exception e) {
+                model.setIsSuccess(false);
+                model.setErrorMsg(e.getMessage());
                 excelVOList.add(model);
             }
         }

+ 1 - 1
src/main/java/com/qdport/controller/PolicyCaseController.java

@@ -181,7 +181,7 @@ public class PolicyCaseController extends QdportController {
     @WebLog(operateName = "重新上报", operateType = "policy_case")
     public R resubmit(@RequestBody @Valid PolicyCaseVO vo) throws ExecutionException, InterruptedException {
         vo.setStatus(QDPortEnum.POLICY_CASE_STATUS_APPROVE.getValue());
-        policyCaseService.approve(vo);
+        policyCaseService.resubmit(vo);
         policyTodoService.save(vo);
         return R.success("重新发起成功");
     }

+ 4 - 4
src/main/java/com/qdport/controller/PolicyConditionController.java

@@ -23,7 +23,7 @@ import javax.validation.Valid;
 @Api(value = "系统配置", tags = "系统配置")
 public class PolicyConditionController extends QdportController {
     @Resource
-    private QdportRedis redis;
+    private QdportRedis qdportRedis;
 
 
     /**
@@ -32,7 +32,7 @@ public class PolicyConditionController extends QdportController {
     @PostMapping("/update")
     @WebLog(operateName = "修改", operateType = "policy_condition")
     public R update(@RequestBody @Valid PolicyConditionQuery query) {
-        redis.set("ytbDate", query.getYtbDate());
+        qdportRedis.set("ytbDate", query.getYtbDate());
         return R.success("更新成功");
     }
 
@@ -43,8 +43,8 @@ public class PolicyConditionController extends QdportController {
     @ApiOperation(value = "详情", notes = "id")
     public R<Integer> get() {
         Integer ytbDate = 0;
-        if (redis.exists("ytbDate")) {
-            ytbDate = redis.get("ytbDate");
+        if (qdportRedis.exists("ytbDate")) {
+            ytbDate = qdportRedis.get("ytbDate");
         }
         return R.data(ytbDate);
     }

+ 0 - 2
src/main/java/com/qdport/controller/PolicyLogController.java

@@ -35,8 +35,6 @@ import java.util.List;
 public class PolicyLogController extends QdportController {
     @Resource
     private PolicyLogService policyLogService;
-    @Resource
-    private TSysUserService sysUserService;
 
     /**
      * 分页

+ 1 - 1
src/main/java/com/qdport/controller/PolicyShareController.java

@@ -160,7 +160,7 @@ public class PolicyShareController extends QdportController {
     @WebLog(operateName = "重新上报", operateType = "policy_share")
     public R resubmit(@RequestBody @Valid PolicyShareVO vo) throws ExecutionException, InterruptedException {
         vo.setStatus(QDPortEnum.POLICY_SHARE_STATUS_APPROVE.getValue());
-        policyShareService.approve(vo);
+        policyShareService.resubmit(vo);
         policyTodoService.save(vo);
         return R.success("重新发起成功");
     }

+ 1 - 1
src/main/java/com/qdport/controller/PolicyStriveController.java

@@ -200,7 +200,7 @@ public class PolicyStriveController extends QdportController {
     @WebLog(operateName = "重新上报", operateType = "policy_strive")
     public R resubmit(@RequestBody @Valid PolicyStriveVO vo) throws ExecutionException, InterruptedException {
         vo.setStatus(QDPortEnum.POLICY_STRIVE_STATUS_APPROVE.getValue());
-        policyStriveService.approve(vo);
+        policyStriveService.resubmit(vo);
         policyTodoService.save(vo);
         return R.success("重新发起成功");
     }

+ 5 - 4
src/main/java/com/qdport/listener/PolicyStriveMonthReadListener.java

@@ -5,15 +5,16 @@ import com.alibaba.excel.metadata.CellData;
 import com.alibaba.excel.metadata.CellExtra;
 import com.alibaba.excel.read.listener.ReadListener;
 import com.qdport.vo.PolicyStriveExcelVO;
+import com.qdport.vo.PolicyStriveMonthExcelVO;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
-public class PolicyStriveMonthReadListener implements ReadListener<PolicyStriveExcelVO> {
-    private List<PolicyStriveExcelVO> list = new ArrayList<>();
+public class PolicyStriveMonthReadListener implements ReadListener<PolicyStriveMonthExcelVO> {
+    private List<PolicyStriveMonthExcelVO> list = new ArrayList<>();
 
-    public List<PolicyStriveExcelVO> getList() {
+    public List<PolicyStriveMonthExcelVO> getList() {
         return list;
     }
 
@@ -27,7 +28,7 @@ public class PolicyStriveMonthReadListener implements ReadListener<PolicyStriveE
     }
 
     @Override
-    public void invoke(PolicyStriveExcelVO xls, AnalysisContext analysisContext) {
+    public void invoke(PolicyStriveMonthExcelVO xls, AnalysisContext analysisContext) {
         list.add(xls);
     }
 

+ 2 - 0
src/main/java/com/qdport/service/PolicyCaseService.java

@@ -26,6 +26,8 @@ public interface PolicyCaseService  extends IService<PolicyCase> {
 
     void approve(PolicyCaseVO vo);
 
+    void resubmit(PolicyCaseVO vo);
+
     void refuse(PolicyCaseVO vo);
 
     void withdraw(PolicyCaseVO vo);

+ 2 - 0
src/main/java/com/qdport/service/PolicyShareService.java

@@ -30,6 +30,8 @@ public interface PolicyShareService  extends IService<PolicyShare> {
 
     void approve(PolicyShareVO vo);
 
+    void resubmit(PolicyShareVO vo);
+
     void refuse(PolicyShareVO vo);
 
     void withdraw(PolicyShareVO vo);

+ 2 - 0
src/main/java/com/qdport/service/PolicyStriveService.java

@@ -29,6 +29,8 @@ public interface PolicyStriveService  extends IService<PolicyStrive> {
 
     void approve(PolicyStriveVO vo);
 
+    void resubmit(PolicyStriveVO vo);
+
     void refuse(PolicyStriveVO vo);
 
     void withdraw(PolicyStriveVO vo);

+ 12 - 0
src/main/java/com/qdport/service/impl/PolicyCaseServiceImpl.java

@@ -135,6 +135,11 @@ public class PolicyCaseServiceImpl extends ServiceImpl<PolicyCaseMapper, PolicyC
             strive.setIsCase(0);
             policyStriveService.updateById(strive);
         }
+
+        QueryWrapper<PolicyTodo> todoQueryWrapper = new QueryWrapper<>();
+        todoQueryWrapper.in("REF_ID", idList);
+        todoQueryWrapper.eq("REF_TYPE", QDPortEnum.POLICY_TODO_REFTYPE_POLICY_CASE.getValue());
+        policyTodoMapper.delete(todoQueryWrapper);
     }
 
     @Override
@@ -188,6 +193,13 @@ public class PolicyCaseServiceImpl extends ServiceImpl<PolicyCaseMapper, PolicyC
         vo.setPolicyStrive(striveVO);
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void resubmit(PolicyCaseVO vo) {
+        approve(vo);
+        update(vo);
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void refuse(PolicyCaseVO vo) {

+ 12 - 0
src/main/java/com/qdport/service/impl/PolicyShareServiceImpl.java

@@ -136,6 +136,11 @@ public class PolicyShareServiceImpl extends ServiceImpl<PolicyShareMapper, Polic
         fileWrapper.in("REF_ID", idList);
         fileWrapper.eq("REF_TYPE", QDPortEnum.POLICY_FILE_REFTYPE_POLICY_SHARE.getValue());
         policyFileService.remove(fileWrapper);
+
+        QueryWrapper<PolicyTodo> todoQueryWrapper = new QueryWrapper<>();
+        todoQueryWrapper.in("REF_ID", idList);
+        todoQueryWrapper.eq("REF_TYPE", QDPortEnum.POLICY_TODO_REFTYPE_POLICY_SHARE.getValue());
+        policyTodoMapper.delete(todoQueryWrapper);
     }
 
     @Override
@@ -180,6 +185,13 @@ public class PolicyShareServiceImpl extends ServiceImpl<PolicyShareMapper, Polic
 
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void resubmit(PolicyShareVO vo) {
+        approve(vo);
+        update(vo);
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void refuse(PolicyShareVO vo) {

+ 12 - 0
src/main/java/com/qdport/service/impl/PolicyStriveServiceImpl.java

@@ -152,6 +152,11 @@ public class PolicyStriveServiceImpl extends ServiceImpl<PolicyStriveMapper, Pol
     @Transactional(rollbackFor = Exception.class)
     public void delete(List<String> idList) {
         removeByIds(idList);
+
+        QueryWrapper<PolicyTodo> todoQueryWrapper = new QueryWrapper<>();
+        todoQueryWrapper.in("REF_ID", idList);
+        todoQueryWrapper.eq("REF_TYPE", QDPortEnum.POLICY_TODO_REFTYPE_POLICY_STRIVE.getValue());
+        policyTodoMapper.delete(todoQueryWrapper);
     }
 
     @Override
@@ -195,6 +200,13 @@ public class PolicyStriveServiceImpl extends ServiceImpl<PolicyStriveMapper, Pol
         updateById(vo);
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void resubmit(PolicyStriveVO vo) {
+        approve(vo);
+        update(vo);
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void refuse(PolicyStriveVO vo) {

+ 6 - 5
src/main/java/com/qdport/util/ExcelUtil.java

@@ -7,6 +7,7 @@ import com.qdport.listener.PolicyStriveMonthReadListener;
 import com.qdport.listener.PolicyStriveReadListener;
 import com.qdport.vo.PolicyShareExcelVO;
 import com.qdport.vo.PolicyStriveExcelVO;
+import com.qdport.vo.PolicyStriveMonthExcelVO;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
@@ -24,7 +25,7 @@ public class ExcelUtil {
     public static List<PolicyShareExcelVO> readPolicyShareFromXls(byte[] dataArray) {
         InputStream is = new ByteArrayInputStream(dataArray);
         PolicyShareReadListener readListener = new PolicyShareReadListener();
-        EasyExcel.read(is, PolicyShareExcelVO.class, readListener).sheet().headRowNumber(1).doRead();
+        EasyExcel.read(is, PolicyShareExcelVO.class, readListener).sheet().headRowNumber(3).doRead();
         List<PolicyShareExcelVO> list = readListener.getList();
         return list;
     }
@@ -32,16 +33,16 @@ public class ExcelUtil {
     public static List<PolicyStriveExcelVO> readPolicyStriveFromXls(byte[] dataArray) {
         InputStream is = new ByteArrayInputStream(dataArray);
         PolicyStriveReadListener readListener = new PolicyStriveReadListener();
-        EasyExcel.read(is, PolicyStriveExcelVO.class, readListener).sheet().headRowNumber(1).doRead();
+        EasyExcel.read(is, PolicyStriveExcelVO.class, readListener).sheet().headRowNumber(3).doRead();
         List<PolicyStriveExcelVO> list = readListener.getList();
         return list;
     }
 
-    public static List<PolicyStriveExcelVO> readPolicyStriveMonthFromXls(byte[] dataArray) {
+    public static List<PolicyStriveMonthExcelVO> readPolicyStriveMonthFromXls(byte[] dataArray) {
         InputStream is = new ByteArrayInputStream(dataArray);
         PolicyStriveMonthReadListener readListener = new PolicyStriveMonthReadListener();
-        EasyExcel.read(is, PolicyStriveExcelVO.class, readListener).sheet().headRowNumber(1).doRead();
-        List<PolicyStriveExcelVO> list = readListener.getList();
+        EasyExcel.read(is, PolicyStriveMonthExcelVO.class, readListener).sheet().headRowNumber(3).doRead();
+        List<PolicyStriveMonthExcelVO> list = readListener.getList();
         return list;
     }
 }

+ 57 - 47
src/main/java/com/qdport/util/StringUtil.java

@@ -1,17 +1,18 @@
 package com.qdport.util;
 
+import java.lang.reflect.Field;
 import java.util.*;
 
 /**
  * 字符串工具类
- * 
+ *
  * @author Ready 2012-10-17
  */
 public class StringUtil {
 
     /**
      * 如果字符串为空,则返回空字符""
-     * 
+     *
      * @param str
      * @return
      */
@@ -21,7 +22,7 @@ public class StringUtil {
 
     /**
      * 如果字符串为空,则返回null
-     * 
+     *
      * @param str
      * @return
      */
@@ -48,7 +49,7 @@ public class StringUtil {
 
     /**
      * 是否为空,如果为null或者"",返回false,不为空返回true
-     * 
+     *
      * @param target
      * @return
      */
@@ -62,7 +63,7 @@ public class StringUtil {
 
     /**
      * 判断字符串是否为空,如果为空返回true
-     * 
+     *
      * @param target
      * @return
      */
@@ -71,10 +72,10 @@ public class StringUtil {
     }
 
     /**
+     * @return String
      * @author jchen.Kevin
      * @date 2015年04月04日
      * @description 生成长度为length的随机数
-     * @return String
      * @version 1.0.0
      */
     public static String getRandom(int length) {
@@ -90,10 +91,10 @@ public class StringUtil {
     }
 
     /**
+     * @return String
      * @author lkang
      * @date 2014年5月27日
      * @description 生成长度为length的16进制字符串验证码
-     * @return String
      * @version 1.0.0
      */
     public static String getValidateString(int length) {
@@ -115,10 +116,10 @@ public class StringUtil {
     }
 
     /**
+     * @return String
      * @author lkang
      * @date 2014年5月27日
      * @description 生成长度为length的16进制数字验证码
-     * @return String
      * @version 1.0.0
      */
     public static String getValidateNumber(int length) {
@@ -140,17 +141,14 @@ public class StringUtil {
     }
 
     /**
+     * @param source     要填充的字符串
+     * @param length     字符串填充后满足的长度
+     * @param fillString 填充物
+     * @return 填充后的字符串
+     * @throws
      * @author yldong.water
      * @date 2014年8月25日
      * @description 填充特定字符串以满足指定长度
-     * @exception
-     * @param source
-     *            要填充的字符串
-     * @param length
-     *            字符串填充后满足的长度
-     * @param fillString
-     *            填充物
-     * @return 填充后的字符串
      * @version 1.0.0
      */
     public static String fill(String source, int length, String fillString) {
@@ -159,8 +157,7 @@ public class StringUtil {
             if (sourceLength < length) {
                 source = getPre(length - sourceLength, fillString) + source;
             }
-        }
-        else {
+        } else {
             source = getPre(length, fillString);
         }
         return source;
@@ -168,7 +165,7 @@ public class StringUtil {
 
     /**
      * 格式化文件大小
-     * 
+     *
      * @return
      */
     public static String formatFileSize(double size) {
@@ -177,8 +174,7 @@ public class StringUtil {
             size /= 1024;
             double a = Math.round(size * 100);
             return a / 100 + "MB";
-        }
-        else {
+        } else {
             double a = Math.round(size * 100);
             return a / 100 + "KB";
         }
@@ -186,7 +182,7 @@ public class StringUtil {
 
     /**
      * 校验中英文的长度
-     * 
+     *
      * @return
      */
     public static int lenString(String str) {
@@ -195,21 +191,19 @@ public class StringUtil {
             for (int i = 0; i < str.length(); i++) {
                 if (str.charAt(i) < 255) {
                     l++;
-                }
-                else {
+                } else {
                     l += 2;
                 }
             }
             return l;
-        }
-        else {
+        } else {
             return 0;
         }
     }
 
     /**
      * 截取字符串
-     * 
+     *
      * @return
      */
     public static String splitString(String str, int len, boolean flag) {
@@ -220,8 +214,7 @@ public class StringUtil {
                 for (int i = 0; i < str.length(); i++) {
                     if (str.charAt(i) < 255) {
                         l++;
-                    }
-                    else {
+                    } else {
                         l += 2;
                     }
                     if (l >= len) {
@@ -231,25 +224,22 @@ public class StringUtil {
                 }
                 if (flag) {
                     return str.substring(0, splitLen + 1);
-                }
-                else {
+                } else {
                     return str.substring(0, splitLen + 1) + "...";
                 }
-            }
-            else {
+            } else {
                 return str;
             }
-        }
-        else {
+        } else {
             return null;
         }
     }
 
     /**
+     * @return boolean
      * @author jchen.Kevin
      * @date 2015年01月28日
      * @description 判断是否是固定电话
-     * @return boolean
      * @version 1.0.0
      */
     public static boolean isTel(String str) {
@@ -258,10 +248,10 @@ public class StringUtil {
     }
 
     /**
+     * @return boolean
      * @author jchen.Kevin
      * @date 2015年01月28日
      * @description 判断是否是手机号码
-     * @return boolean
      * @version 1.0.0
      */
     public static boolean isPhone(String str) {
@@ -269,10 +259,10 @@ public class StringUtil {
     }
 
     /**
+     * @return boolean
      * @author jchen.Kevin
      * @date 2015年01月28日
      * @description 判断是否是邮箱
-     * @return boolean
      * @version 1.0.0
      */
     public static boolean isEmail(String str) {
@@ -281,10 +271,10 @@ public class StringUtil {
     }
 
     /**
+     * @return boolean
      * @author jchen.Kevin
      * @date 2015年01月28日
      * @description 判断是否是中国邮政编码(6位)
-     * @return boolean
      * @version 1.0.0
      */
     public static boolean isZipCode(String str) {
@@ -292,10 +282,10 @@ public class StringUtil {
     }
 
     /**
+     * @return boolean
      * @author jchen.Kevin
      * @date 2015年01月28日
      * @description 判断是否是腾讯QQ号
-     * @return boolean
      * @version 1.0.0
      */
     public static boolean isQQ(String str) {
@@ -303,10 +293,10 @@ public class StringUtil {
     }
 
     /**
+     * @return boolean
      * @author jchen.Kevin
      * @date 2015年01月28日
      * @description 判断是否是身份证(15位或18位)
-     * @return boolean
      * @version 1.0.0
      */
     public static boolean isIdcard(String str) {
@@ -328,9 +318,10 @@ public class StringUtil {
 
         return sames;
     }
+
     /*
-    * 得到两个数组中相同元素
-    */
+     * 得到两个数组中相同元素
+     */
     public static Set<Integer> getDefferent(Integer[] a, Integer[] b) {
         Set<Integer> defferents = new HashSet<Integer>();
         Set<Integer> set = new HashSet<Integer>(Arrays.asList(a));
@@ -345,12 +336,31 @@ public class StringUtil {
 
     /*
      * String数组转int数组
-    */
-    public static Integer[] StringToInt(String[] stringArr){
-        Integer [] intArr = new Integer[stringArr.length];
-        for(int i = 0; i < stringArr.length; i++){
+     */
+    public static Integer[] StringToInt(String[] stringArr) {
+        Integer[] intArr = new Integer[stringArr.length];
+        for (int i = 0; i < stringArr.length; i++) {
             intArr[i] = Integer.parseInt(stringArr[i]);
         }
         return intArr;
     }
+
+    public static boolean checkFieldsNotEmpty(Object obj) throws IllegalAccessException {
+        Class<?> clazz = obj.getClass();
+        Field[] fields = clazz.getDeclaredFields();
+
+        for (Field field : fields) {
+            field.setAccessible(true);
+            Object value = field.get(obj);
+
+            if (isEmpty(value)) {
+                return false;
+            }
+            if (field.getType().getSimpleName().equals(String.class.getSimpleName())) {
+                field.set(obj, value.toString().trim());
+            }
+        }
+
+        return true;
+    }
 }

+ 7 - 1
src/main/java/com/qdport/vo/PolicyShareExcelVO.java

@@ -1,5 +1,6 @@
 package com.qdport.vo;
 
+import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
 import lombok.Data;
 
@@ -17,8 +18,13 @@ public class PolicyShareExcelVO {
     private String zcType;
     @ExcelProperty("政策文号")
     private String docNo;
-    @ExcelProperty("联系方式")
+    @ExcelProperty("填报人联系方式")
     private String contactPhone;
     @ExcelProperty("序号")
     private Integer index;
+
+    @ExcelIgnore
+    private String errorMsg = "success";
+    @ExcelIgnore
+    private Boolean isSuccess = false;
 }

+ 8 - 11
src/main/java/com/qdport/vo/PolicyStriveExcelVO.java

@@ -1,6 +1,8 @@
 package com.qdport.vo;
 
+import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
@@ -20,24 +22,19 @@ public class PolicyStriveExcelVO {
     private String zcType;
     @ExcelProperty("政策文号")
     private String docNo;
-    @ExcelProperty("联系方式")
+    @ExcelProperty("填报人联系方式")
     private String contactPhone;
     @ExcelProperty("预计争取金额")
     private BigDecimal yjStriveAmount;
     @ExcelProperty("预计完成时间")
     private String yjFinishTime;
-    @ExcelProperty("月度情况说明")
-    private String monthSituation;
-    @ExcelProperty("是否已落地")
-    private String isLand;
-    @ExcelProperty("落地金额")
-    private BigDecimal landAmount;
-    @ExcelProperty("参与人")
-    private String partPersonArr;
-    @ExcelProperty("政策编号")
-    private String businessNo;
     @ExcelProperty("序号")
     private Integer index;
     @ExcelProperty("政策考核类别")
     private Integer rewardType;
+
+    @ExcelIgnore
+    private String errorMsg = "success";
+    @ExcelIgnore
+    private Boolean isSuccess = false;
 }

+ 34 - 0
src/main/java/com/qdport/vo/PolicyStriveMonthExcelVO.java

@@ -0,0 +1,34 @@
+package com.qdport.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class PolicyStriveMonthExcelVO {
+    @ExcelProperty("填报人")
+    private String createName;
+    @ExcelProperty("填报人联系方式")
+    private String contactPhone;
+    @ExcelProperty("月度情况说明")
+    private String monthSituation;
+    @ExcelProperty("是否已落地")
+    private String isLand;
+    @ExcelProperty("落地金额")
+    private BigDecimal landAmount;
+    @ExcelProperty("参与人")
+    private String partPersonArr;
+    @ExcelProperty("项目编号")
+    private String businessNo;
+    @ExcelProperty("序号")
+    private Integer index;
+    @ExcelProperty("实际完成日期")
+    private String sjFinishTime;
+
+    @ExcelIgnore
+    private String errorMsg = "success";
+    @ExcelIgnore
+    private Boolean isSuccess = false;
+}