chb 7 lat temu
rodzic
commit
decaf443ad

+ 1 - 1
saicLogistics/src/main/java/com/fuzamei/entity/PlannerSupplier.java

@@ -3,7 +3,7 @@ package com.fuzamei.entity;
 import java.util.List;
 
 //计划员供应商表
-public class PlannerSupplier {
+public class PlannerSupplier extends  User{
 	private  Integer id;         //主键id
 	private  String plannerId; //计划员id
 	private  String supplierId;//供应商id

+ 1 - 1
saicLogistics/src/main/java/com/fuzamei/mapper/UserMapper.xml

@@ -78,7 +78,7 @@
 	
 	<!--根据用户id修改角色,账号,密码,名称  -->
 	<update id="updateAccountByUserId" parameterType="com.fuzamei.entity.User">
-		update users set  username=#{username} , password=#{password} , person_name=#{personName},update_time=#{updateTime} where user_id=#{userId}
+		update users set  username=#{username} , password=#{password} , person_name=#{personName},update_time=#{updateTime} where user_id=#{userIdb}
 	</update>
 	
 	<!--参数类型为1001,1002,1003等, 批量删除 -->

+ 9 - 10
saicLogistics/src/main/java/com/fuzamei/service/serviceImpl/PlannerServiceImpl.java

@@ -47,6 +47,7 @@ public class PlannerServiceImpl implements  PlannerService{
 	@Override
 	@Transactional(rollbackFor=Exception.class)
 	public void insertAgainSupplier(PlannerSupplier  pp) {//得到前端传来所有得供应商ID 做插入操作
+		//下面是【先删除原先的,在添加传来的供应商id】
 		String[] str=pp.getSupplierId().split(",");
 		for (int i = 0; i < str.length; i++) {
 			pp.setSupplierId(str[i]);
@@ -54,21 +55,19 @@ public class PlannerServiceImpl implements  PlannerService{
 		}
 		
 		
-		
-		//下面待改动   XXX
+		//下面待改动   
 		//下面往【操作记录】表插入数据
 		Long currentTime = System.currentTimeMillis();//得到当前系统时间
-		User user=new  User();
-		String sign = user.getSign();
+		String sign = pp.getSign();
 		@SuppressWarnings("unchecked")
 		Map<String,Object> map = JSON.parseObject(sign, Map.class);
 		String hash = (String) map.get("sid");
-		user.setOperatorId(user.getUserId());//操作人id
-		user.setOperationTypeId(OperationType.EDIT);//操作类型 (编辑修改)
-		user.setBeOperatedId(user.getUserId());//被操作人账号id  TODO??????????????待
-		user.setOperationTime(currentTime);//操作时间
-		user.setHash(hash);//操作hash
-		userMapper.insertOperationHistory(user);//插入到操作记录表去
+		pp.setUserId(pp.getUserId());//操作人(管理员)
+		pp.setOperationTypeId(OperationType.ADD);//操作类型 (编辑配置后在添加)
+		pp.setUserIdb(pp.getUserIdb());//被操作人账号  ??????????????待
+		pp.setOperationTime(currentTime);//操作时间
+		pp.setHash(hash);//操作hash
+		userMapper.insertOperationHistory(pp);//插入到操作记录表去
 		
 		/*boolean flag = blockChainUtil.sendBlockChain(user.getSign());//发送签名直接转发到区块链
 		if(!flag) {

+ 4 - 3
saicLogistics/src/main/java/com/fuzamei/web/PlannerAction.java

@@ -115,10 +115,10 @@ public class PlannerAction {
 			@SuppressWarnings("unchecked")
 			Integer user_id = ValidationUtil.checkAndAssignInt(req.getHeader("Authorization").split("&")[1]);
 			userAuthoricationService.queryUserAuthority(user_id, Roles.ADMIN);
-			Integer plannerId = ValidationUtil.checkAndAssignInt(pp.getPlannerId());//得到前端传来的计划员id
-			
+			Integer plannerId = ValidationUtil.checkAndAssignInt(pp.getPlannerId());//得到前端传来的计划员id(校验)
+			ValidationUtil.checkBlankAndAssignString(pp.getSign());//校验前端传来的签名
 		    if(pp.getSupplierId().equals("")) {//如果传过来得到的供应商是空的 (点击配置后,什么操作都没做) 就报异常    不让删除原先得供应商
-			 throw  new  RuntimeException("操作异常");
+			 throw  new  RuntimeException("不能操作");
 			   
 		    }else {//否则就做先删除原先得  在添加新得到id做插入操作
 		    	plannerService.deleteBeforeSupplierByUserId(plannerId);//(前端传来的计划员id)根据计划员id先删除之前所对应的供应商
@@ -127,6 +127,7 @@ public class PlannerAction {
 			 
 			return  JSONUtil.getJsonMap(200, true, HintMSG.OPERATION_SUCCESS,pp);//待
 		} catch (Exception e) {
+			e.printStackTrace();
 			return JSONUtil.getJsonMap(500, false, HintMSG.OPERATION_FAIL+":"+e.getMessage(), null);
 		}
 		

+ 2 - 2
saicLogistics/src/main/resources/spring-mvc.xml

@@ -35,11 +35,11 @@
 	<tx:annotation-driven transaction-manager="transactionManager"
 		proxy-target-class="true" />
 	<!-- 对token拦截验证 (为方便测试,测试环境给注释掉) -->
-   	<mvc:interceptors>
+  <!--  	<mvc:interceptors>
 		<mvc:interceptor>
 			<mvc:mapping path="/**" />
 			<mvc:exclude-mapping path="/login"/>
 			<bean class="com.fuzamei.interceptor.TokenInterceptor" />
 		</mvc:interceptor>
-	</mvc:interceptors>   
+	</mvc:interceptors>  -->  
 </beans>