Browse Source

7.26 更新商品的导入导出

Mechrevo 2 năm trước cách đây
mục cha
commit
6bad694de5

+ 21 - 18
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/MethodGoodsTransitService.java

@@ -66,52 +66,55 @@ public class MethodGoodsTransitService {
                 tbGoodsTransit.setPrice(cell6.getNumericCellValue());
 
             if(row.getCell(7) != null && !row.getCell(7).toString().trim().equals(""))
-                tbGoodsTransit.setPlaceOrigin(row.getCell(7).getStringCellValue());
+                tbGoodsTransit.setDeclareOdd(row.getCell(7).getStringCellValue());
 
             if(row.getCell(8) != null && !row.getCell(8).toString().trim().equals(""))
-                tbGoodsTransit.setDescription(row.getCell(8).getStringCellValue()   );
+                tbGoodsTransit.setPlaceOrigin(row.getCell(8).getStringCellValue());
 
-            HSSFCell cell9 = row.getCell(9);
+            if(row.getCell(9) != null && !row.getCell(9).toString().trim().equals(""))
+                tbGoodsTransit.setDescription(row.getCell(9).getStringCellValue()   );
+
+            HSSFCell cell9 = row.getCell(10);
             if (cell9 != null && (cell9.getCellType() == CellType.NUMERIC || cell9.getCellType() == CellType.FORMULA))
                 tbGoodsTransit.setStock((int)cell9.getNumericCellValue());
 
-            HSSFCell cell10 = row.getCell(10);
+            HSSFCell cell10 = row.getCell(11);
             if (cell10 != null && (cell10.getCellType() == CellType.NUMERIC || cell10.getCellType() == CellType.FORMULA))
                 tbGoodsTransit.setGoodsStatus((int)cell10.getNumericCellValue());
 
-            HSSFCell cell11 = row.getCell(11);
+            HSSFCell cell11 = row.getCell(12);
             if (cell11 != null && (cell11.getCellType() == CellType.NUMERIC || cell11.getCellType() == CellType.FORMULA))
                 tbGoodsTransit.setAuditStatus((int) cell11.getNumericCellValue());
 
-            HSSFCell cell2 = row.getCell(12);
+            HSSFCell cell2 = row.getCell(13);
             if (cell2 != null && cell2.getCellType() == CellType.NUMERIC && DateUtil.isCellDateFormatted(cell2))
-                if(row.getCell(12) != null && !row.getCell(12).toString().trim().equals(""))
+                if(row.getCell(13) != null && !row.getCell(13).toString().trim().equals(""))
                     tbGoodsTransit.setAuditTime(cell2.getDateCellValue());
 
-            if(row.getCell(13) != null && !row.getCell(13).toString().trim().equals(""))
-                tbGoodsTransit.setRemark(row.getCell(13).getStringCellValue());
+            if(row.getCell(14) != null && !row.getCell(14).toString().trim().equals(""))
+                tbGoodsTransit.setRemark(row.getCell(14).getStringCellValue());
 
             //公共字段
-            HSSFCell cell4 = row.getCell(14);
+            HSSFCell cell4 = row.getCell(15);
             if (cell4 != null && cell4.getCellType() == CellType.NUMERIC && DateUtil.isCellDateFormatted(cell4)) {
                 tbGoodsTransit.setCreateTime(cell4.getDateCellValue());
             }
 
-            if(row.getCell(15) != null && !row.getCell(15).toString().trim().equals(""))
-                tbGoodsTransit.setCreateBy(row.getCell(15).getStringCellValue());
-
             if(row.getCell(16) != null && !row.getCell(16).toString().trim().equals(""))
-                tbGoodsTransit.setCreateName(row.getCell(16).getStringCellValue());
+                tbGoodsTransit.setCreateBy(row.getCell(16).getStringCellValue());
 
             if(row.getCell(17) != null && !row.getCell(17).toString().trim().equals(""))
-                tbGoodsTransit.setUpdateBy(row.getCell(17).getStringCellValue());
+                tbGoodsTransit.setCreateName(row.getCell(17).getStringCellValue());
 
             if(row.getCell(18) != null && !row.getCell(18).toString().trim().equals(""))
-                tbGoodsTransit.setUpdateName(row.getCell(18).getStringCellValue());
+                tbGoodsTransit.setUpdateBy(row.getCell(18).getStringCellValue());
+
+            if(row.getCell(19) != null && !row.getCell(19).toString().trim().equals(""))
+                tbGoodsTransit.setUpdateName(row.getCell(19).getStringCellValue());
 
-            HSSFCell cell3 = row.getCell(19);
+            HSSFCell cell3 = row.getCell(20);
             if (cell3 != null && cell3.getCellType() == CellType.NUMERIC && DateUtil.isCellDateFormatted(cell3)) {
-                tbGoodsTransit.setUpdateTime(row.getCell(19).getDateCellValue());
+                tbGoodsTransit.setUpdateTime(cell3.getDateCellValue());
             }
             //删除状态,默认可用
             tbGoodsTransit.setDeleteStatus(1);

+ 6 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransit.java

@@ -79,7 +79,12 @@ public class TbGoodsTransit extends Model<TbGoodsTransit> implements Serializabl
 	/**
 	 * 商品价格 
 	 */
-	private Double price;	
+	private Double price;
+
+	/**
+	 * 海关申报单号
+	 */
+	private String declareOdd;
 
 	/**
 	 * 产地(国家) 

+ 16 - 14
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransitService.java

@@ -170,20 +170,21 @@ public class TbGoodsTransitService extends ServiceImpl<TbGoodsTransitMapper, TbG
 		row.createCell(4).setCellValue("商品名称");
 		row.createCell(5).setCellValue("商品单位");
 		row.createCell(6).setCellValue("商品价格");
-		row.createCell(7).setCellValue("产地(国家)");
-		row.createCell(8).setCellValue("商品描述");
-		row.createCell(9).setCellValue("库存数量");
-		row.createCell(10).setCellValue("商品状态");
-		row.createCell(11).setCellValue("审核状态");
-		row.createCell(12).setCellValue("审核时间");
-		row.createCell(13).setCellValue("审核意见");
-		row.createCell(14).setCellValue("创建时间");
-		row.createCell(15).setCellValue("创建人编号");
-		row.createCell(16).setCellValue("创建人名称");
-		row.createCell(17).setCellValue("更新时间");
-		row.createCell(18).setCellValue("更新人编号");
-		row.createCell(19).setCellValue("更新人名称");
-		row.createCell(20).setCellValue("删除状态");
+		row.createCell(7).setCellValue("海关申报单号");
+		row.createCell(8).setCellValue("产地(国家)");
+		row.createCell(9).setCellValue("商品描述");
+		row.createCell(10).setCellValue("库存数量");
+		row.createCell(11).setCellValue("商品状态");
+		row.createCell(12).setCellValue("审核状态");
+		row.createCell(13).setCellValue("审核时间");
+		row.createCell(14).setCellValue("审核意见");
+		row.createCell(15).setCellValue("创建时间");
+		row.createCell(16).setCellValue("创建人编号");
+		row.createCell(17).setCellValue("创建人名称");
+		row.createCell(18).setCellValue("更新时间");
+		row.createCell(19).setCellValue("更新人编号");
+		row.createCell(20).setCellValue("更新人名称");
+		row.createCell(21).setCellValue("删除状态");
 
 		//定义计数器
 		int count = 0;
@@ -197,6 +198,7 @@ public class TbGoodsTransitService extends ServiceImpl<TbGoodsTransitMapper, TbG
 			sheetRow.createCell(4).setCellValue((selectedList.get(i).getGoodsName() + "").equals("null")? "": selectedList.get(i).getGoodsName() + "");
 			sheetRow.createCell(5).setCellValue((selectedList.get(i).getGoodsUnits() + "").equals("null")? "": selectedList.get(i).getGoodsUnits() + "");
 			sheetRow.createCell(6).setCellValue((selectedList.get(i).getPrice() + "").equals("null")? "": selectedList.get(i).getPrice() + "");
+			sheetRow.createCell(6).setCellValue((selectedList.get(i).getDeclareOdd() + "").equals("null")? "": selectedList.get(i).getDeclareOdd() + "");
 			sheetRow.createCell(7).setCellValue((selectedList.get(i).getPlaceOrigin() + "").equals("null")? "": selectedList.get(i).getPlaceOrigin() + "");
 			sheetRow.createCell(8).setCellValue((selectedList.get(i).getDescription() + "" ).equals("null")? "": selectedList.get(i).getDescription() + "");
 			sheetRow.createCell(9).setCellValue((selectedList.get(i).getStock() + "").equals("null")? "": selectedList.get(i).getStock() + "");

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_goods_units/TbGoodsUnitsService.java

@@ -97,7 +97,7 @@ public class TbGoodsUnitsService extends ServiceImpl<TbGoodsUnitsMapper, TbGoods
 	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
 		//导出的文件的路径
-		if(filepath == null){
+		if(filepath == null || filepath.trim().equals("")){
 			// 获取当前用户的桌面路径
 			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
 			filepath = fileSystemView.getHomeDirectory().getPath();

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupService.java

@@ -221,7 +221,7 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
 		//导出的文件的路径
-		if(filepath == null){
+		if(filepath == null || filepath.trim().equals("")){
 			// 获取当前用户的桌面路径
 			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
 			filepath = fileSystemView.getHomeDirectory().getPath();

+ 12 - 4
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleService.java

@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.pj.api.client.admin.AdminInterface;
+import com.pj.api.dto.AppUserDto;
+import com.pj.current.satoken.StpUserUtil;
 import com.pj.enummj.DeleteStatus;
 import com.pj.enummj.IsLock;
 import com.pj.enummj.People;
@@ -53,6 +55,7 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 	@Autowired
 	private AdminInterface adminInterface;
 
+
 	@Autowired
 	TbGroupMapper tbGroupMapper;
 	/** 增 */
@@ -87,19 +90,24 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 	 */
 	boolean judge(TbPeople tbPeople){
 		//获取当前登陆人 todo:
-		String loginUser = "admin";
+//		String loginUser = "admin";
+		Long id = StpUserUtil.getLoginIdAsLong();
+		//获取登录人
+		AppUserDto appUserById = adminInterface.getAppUserById(id);
+		if(appUserById == null)throw new RuntimeException("当前登录人账号已失效,请重新登录~");
+		String loginUser = appUserById.getName();
 		//获取当前被审核人的编号和审核情况
-		Long id = tbPeople.getId();
+		Long currId = tbPeople.getId();
 		Integer judgeStatus = tbPeople.getJudgeStatus();
 		//获取被审核人
-		TbPeople tbPeople1 = tbPeopleMapper.selectById(id);
+		TbPeople tbPeople1 = tbPeopleMapper.selectById(currId);
 		if(tbPeople1 == null)throw new RuntimeException("审核用户不存在,请检查!");
 		//判断删除状态
 		Integer deleteStatus = tbPeople1.getDeleteStatus();
 		if(deleteStatus == 0)throw new RuntimeException("该用户已被删除,无法进行审核");
 		//设置审核状态
 		tbPeople1.setJudgeStatus(judgeStatus);
-		if(id == 0) tbPeople1.setJudgeContent(tbPeople.getJudgeContent());
+		if(currId == 0) tbPeople1.setJudgeContent(tbPeople.getJudgeContent());
 		//设置审核人
 		tbPeople1.setPersonId(loginUser);
 		//审核时间

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShopService.java

@@ -97,7 +97,7 @@ public class TbShopService extends ServiceImpl<TbShopMapper, TbShop> implements
 	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
 		//导出的文件的路径
-		if(filepath == null){
+		if(filepath == null || filepath.trim().equals("")){
 			// 获取当前用户的桌面路径
 			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
 			filepath = fileSystemView.getHomeDirectory().getPath();

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaService.java

@@ -165,7 +165,7 @@ public class TbTradeAreaService extends ServiceImpl<TbTradeAreaMapper, TbTradeAr
 	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
 		//导出的文件的路径
-		if(filepath == null){
+		if(filepath == null || filepath.trim().equals("")){
 			// 获取当前用户的桌面路径
 			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
 			filepath = fileSystemView.getHomeDirectory().getPath();

+ 7 - 2
sp-service/sp-admin/src/main/java/com/pj/project/app_menu/AppMenu.java

@@ -1,8 +1,11 @@
 package com.pj.project.app_menu;
 
 import java.io.Serializable;
+import java.util.Date;
+
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -78,7 +81,8 @@ public class AppMenu extends Model<AppMenu> implements Serializable {
 	/**
 	 * 创建时间 
 	 */
-	private String createTime;	
+	@JsonFormat(pattern = "yyyy-MM-dd")
+	private Date createTime;
 
 	/**
 	 * 创建人编号 
@@ -93,7 +97,8 @@ public class AppMenu extends Model<AppMenu> implements Serializable {
 	/**
 	 * 更新时间 
 	 */
-	private String updateTime;	
+	@JsonFormat(pattern = "yyyy-MM-dd")
+	private Date updateTime;
 
 	/**
 	 * 更新人编号 

+ 1 - 0
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java

@@ -148,6 +148,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 
 	/** 用户登录 */
 	AjaxJson login(String phone, String password){
+		//判断入参有效性
 		if(!StringUtils.isNotBlank(phone) || !StringUtils.isNotBlank(password))
 			return AjaxJson.getError("错误登录!");
 		//登陆查询