浏览代码

Merge branch 'dev-mysql' into feature_release-tomysql

wangdy 8 年之前
父节点
当前提交
434c9e0d30

+ 11 - 8
src/main/java/com/uas/platform/b2c/common/account/controller/AuthenticationController.java

@@ -10,6 +10,8 @@ import com.uas.platform.b2c.common.account.model.UserQuestion;
 import com.uas.platform.b2c.common.account.service.UserQuestionService;
 import com.uas.platform.b2c.common.account.service.UserService;
 import com.uas.platform.b2c.core.support.SystemSession;
+
+import java.util.Collection;
 import java.util.List;
 
 import com.uas.platform.core.model.Constant;
@@ -48,15 +50,16 @@ public class AuthenticationController {
 		List<UserQuestion> userQuestion = userQuestionService.findUserQuestionByUserUUOrderBySortAsc(sysUser.getUserUU());
 		User user = userService.findUserByUserUU(sysUser.getUserUU());
 		user.setEnterprise(sysUser.getEnterprise());
-		if (user.getEnterprise().getEnAdminuu().equals(user.getUserUU())) {
-			user.setIssys(Constant.YES);
-		}
-		UserInfo userInfo = new UserInfo(user);
-		if(userQuestion!=null){
-			if(userQuestion.size()>0){
-				userInfo.setHaveUserQuestion(true);
-				userInfo.setSecLevel((short)(1+userInfo.getSecLevel()));
+		try{
+			if (user.getEnterprise().getEnAdminuu().equals(user.getUserUU())) {
+				user.setIssys(Constant.YES);
 			}
+		} catch (NullPointerException e) { }
+
+		UserInfo userInfo = new UserInfo(user);
+		if (!CollectionUtils.isEmpty(userQuestion)) {
+			userInfo.setHaveUserQuestion(true);
+			userInfo.setSecLevel((short)(1+userInfo.getSecLevel()));
 		}
 		return userInfo;
 	}

+ 14 - 3
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java

@@ -613,9 +613,20 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			}
 			aProduct.setReserveByExcel(reserveValue);
 
-			Object produceValue = readWorkBookCell(row.getCell(UploadConstant.PRODUCE_DATE), Cell.CELL_TYPE_STRING,
-					rowNum, UploadConstant.PRODUCE_DATE);
-			aProduct.setProductDateByExcel(produceValue);
+			Cell productCell = row.getCell(UploadConstant.PRODUCE_DATE);
+			if (productCell.getCellType() == 0) {
+				if (HSSFDateUtil.isCellDateFormatted(productCell)) {
+					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+					String productStr = sdf.format(productCell.getDateCellValue());
+					aProduct.setProductDateByExcel(productStr);
+				} else {
+					aProduct.setProductDateByExcel("");
+				}
+			} else {
+				Object produceValue = readWorkBookCell(row.getCell(UploadConstant.PRODUCE_DATE), Cell.CELL_TYPE_STRING,
+						rowNum, UploadConstant.PRODUCE_DATE);
+				aProduct.setProductDateByExcel(produceValue);
+			}
 
 			Object packageMethodValue = readWorkBookCell(row.getCell(UploadConstant.PACKAGE_METHOD), Cell.CELL_TYPE_STRING,
 					rowNum, UploadConstant.PACKAGE_METHOD);

+ 26 - 3
src/main/java/com/uas/platform/b2c/trade/seek/service/impl/SeekPurchaseBomServiceImpl.java

@@ -109,7 +109,7 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
 
     private int mallColNum = 8;
     private int mallRowNum = 500;
-    private int startRow = 3;
+    private int startRow = 2;
 
     /**
      * 导入bom
@@ -134,8 +134,6 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         // 插入Bom求购中
         SeekPurchaseBom seekPurchaseBom = new SeekPurchaseBom();
         seekPurchaseBom.setReleaseDate(new Date(System.currentTimeMillis()));
-//        seekPurchaseBom.setEnuu(user.getEnterprise().getUu());
-//        seekPurchaseBom.setUu(user.getUserUU());
         seekPurchaseBom.setName(bomName);
         seekPurchaseBom.setStatus(0);
         seekPurchaseBom = seekPurchaseBomDao.save(seekPurchaseBom);
@@ -149,9 +147,13 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
                 return new ResultMap(CodeType.PARAMETER_ERROR, "您上传的信息列信息不正确,请与模板的列做比较");
             }
             List<SeekPurchaseByBatch> seekPurchaseByBatchList = new ArrayList<>();
+            if (vaidSample(sheet.getRow(startRow))) {
+                startRow = 3;
+            }
             for (int r = startRow; r <= rowNum; r++) {
                 Row row = sheet.getRow(r);
                 if (row != null) {
+
                     SeekPurchaseByBatch seekPurchaseByBatch = new SeekPurchaseByBatch();
                     blankNum = convertValueToSeekPurchaseByBatch(row, seekPurchaseByBatch, r);
                     if (blankNum >= 3) {
@@ -167,6 +169,27 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         return ResultMap.success(seekPurchaseBom.getId());
     }
 
+    /**
+     * 校验第二行是否为商城示例
+     * @param row
+     * @return
+     */
+    private boolean vaidSample(Row row) {
+        Object codeCellObj = readWorkBookCell(row.getCell(0), Cell.CELL_TYPE_STRING,
+                0, 0);
+        String codeString = StringUtilB2C.getStr(codeCellObj);
+        Object brandCellObj = readWorkBookCell(row.getCell(1), Cell.CELL_TYPE_STRING,
+                0, 1);
+        String brandString = StringUtilB2C.getStr(brandCellObj);
+        Object produceDateCellObj = readWorkBookCell(row.getCell(7), Cell.CELL_TYPE_STRING,
+                0, 7);
+        String produceDateString = StringUtilB2C.getStr(produceDateCellObj);
+        if ("只能填数字、英文、英文特殊符号".equals(codeString) || "请勿用中文特殊符号".equals(brandCellObj) || "不超过6个汉字或12个字符".equals(produceDateString)) {
+            return true;
+        }
+        return false;
+    }
+
     /**
      * 验证是否为商城模板
      * @param headerRow

+ 1 - 1
src/main/webapp/resources/view/vendor/forstore/vendor_upload.html

@@ -661,7 +661,7 @@
                             </tbody>
                         </table>
                         <div style="margin-top: -40px;" ng-if="$$productOn.tab == 'bathOn'">3、如核对信息无误之后,点击确认发布</div>
-                        <span class="blue-bg publish" href="javascript:void(0)" ng-click="publish($event)" ng-disabled="!pageParams.totalElements" ng-show="$$productOn.tab == 'bathOn'"><span>确认上架</span></>
+                        <span class="blue-bg publish" href="javascript:void(0)" ng-click="publish($event)" ng-disabled="!pageParams.totalElements" ng-show="$$productOn.tab == 'bathOn'"><span>确认上架</span></span>
                     </div>
                 </div>
                 <!--<div class="load_next">-->