Merge remote-tracking branch 'origin/master'

master
jiakun.lin 4 years ago
commit 32fe3af1fd
  1. 12
      src/main/java/com/yipin/liuwanr/controller/StaffGradeController.java
  2. 2
      src/main/java/com/yipin/liuwanr/mapper/CourseMapper.java
  3. 2
      src/main/java/com/yipin/liuwanr/mapper/OrderMapper.java
  4. 26
      src/main/java/com/yipin/liuwanr/mapper/StaffGradeMapper.java
  5. 3
      src/main/java/com/yipin/liuwanr/mapper/StaffMapper.java
  6. 22
      src/main/java/com/yipin/liuwanr/service/StaffGradeService.java
  7. 20
      src/main/java/com/yipin/liuwanr/service/StaffProfessionalArchitectureService.java
  8. 4
      src/main/java/com/yipin/liuwanr/service/UserInfoService.java
  9. 49
      src/main/resources/application-keda.properties
  10. 18
      src/test/java/com/yipin/liuwanr/service/StaffGradServiceTest.java

@ -1,6 +1,7 @@
package com.yipin.liuwanr.controller; package com.yipin.liuwanr.controller;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
@ -103,11 +104,20 @@ public class StaffGradeController {
Response deleteStaffGrade(@RequestBody StaffGrade staffGrade) { Response deleteStaffGrade(@RequestBody StaffGrade staffGrade) {
Response resp = new Response(); Response resp = new Response();
Integer staffGradeId = staffGrade.getStaffGradeId(); Integer staffGradeId = staffGrade.getStaffGradeId();
HashMap<String, Object> ret = new HashMap<>();
HashMap<String, Object> ret2 = new HashMap<>();
if (staffGradeId==null) { if (staffGradeId==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("Parameter Invalid"); resp.setErrmessage("Parameter Invalid");
} else { } else {
HashMap<String, Object> ret = staffGradeService.deleteStaffGrade(staffGradeId); List<Integer> userIds = staffGradeService.queryUserIdsByGradeId(staffGradeId);
if(userIds.size()>0){
ret2 = staffGradeService.deleteStaffGrade(userIds);
ret = staffGradeService.deleteStaffGradePs(staffGradeId);
}else{//如果组织架构下面没有员工,则只删除组织架构
ret = staffGradeService.deleteStaffGradePs(staffGradeId);
}
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);

@ -94,7 +94,7 @@ public interface CourseMapper {
//删除课程 //删除课程
@Update({"<script>", @Update({"<script>",
"UPDATE course SET isdel = 1 where courseId in " "UPDATE course SET isdel = 1 where courseId in "
+ "<foreach collection = 'list' item='c' open='(' separator=',' close=')'>" + "<foreach collection = 'courseId' item='c' open='(' separator=',' close=')'>"
+ " #{c}" + " #{c}"
+ "</foreach>", + "</foreach>",
"</script> "}) "</script> "})

@ -54,7 +54,7 @@ public interface OrderMapper {
" <if test='cityId !=null'>and o.cityId = #{cityId} </if>", " <if test='cityId !=null'>and o.cityId = #{cityId} </if>",
" <if test='orderType !=null'>and o.orderType = #{orderType} </if>", " <if test='orderType !=null'>and o.orderType = #{orderType} </if>",
" <if test='orderStatus !=null'>and o.orderStatus = #{orderStatus} </if>", " <if test='orderStatus !=null'>and o.orderStatus = #{orderStatus} </if>",
" <if test='searchContent!=null'> and o.orderNumber like CONCAT('%',#{searchContent},'%') or c.customerName like CONCAT('%',#{searchContent},'%')</if>", " <if test='searchContent!=null'> and (o.orderNumber like CONCAT('%',#{searchContent},'%') or c.customerName like CONCAT('%',#{searchContent},'%'))</if>",
"order by o.orderDate desc", "order by o.orderDate desc",
"</script> "}) "</script> "})
List<Order> queryOrder(Order order); List<Order> queryOrder(Order order);

@ -2,10 +2,8 @@ package com.yipin.liuwanr.mapper;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Insert; import com.yipin.liuwanr.entity.Student;
import org.apache.ibatis.annotations.Options; import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import com.yipin.liuwanr.entity.Staff; import com.yipin.liuwanr.entity.Staff;
import com.yipin.liuwanr.entity.StaffGrade; import com.yipin.liuwanr.entity.StaffGrade;
@ -21,8 +19,17 @@ public interface StaffGradeMapper {
"</script> "}) "</script> "})
List<StaffGrade> queryStaffGrade(Integer staffProfessionalArchitectureId); List<StaffGrade> queryStaffGrade(Integer staffProfessionalArchitectureId);
@Update({"<script>",
"UPDATE staff s,hr_user_info u SET s.isdel = 1,u.isdel = 1 WHERE s.userId = u.userId AND s.userId IN"
+ "<foreach collection='userIds' item='stu' open='(' separator=',' close=')'>"
+ "#{stu}"
+ "</foreach> ",
"</script>"})
void deleteStaffGrade(@Param("userIds") List<Integer> userIds);
@Update("UPDATE staff_grade SET isdel = 1 where staffGradeId = #{staffGradeId}") @Update("UPDATE staff_grade SET isdel = 1 where staffGradeId = #{staffGradeId}")
void deleteStaffGrade(Integer staffGradeId); void deleteStaffGradePs(Integer staffGradeId);
@Select({"<script>", @Select({"<script>",
"SELECT staffGradeId,staffGradeName,staffProfessionalArchitectureId from staff_grade where isdel = 0 and staffGradeId = #{staffGradeId}", "SELECT staffGradeId,staffGradeName,staffProfessionalArchitectureId from staff_grade where isdel = 0 and staffGradeId = #{staffGradeId}",
@ -31,4 +38,13 @@ public interface StaffGradeMapper {
@Update("UPDATE staff_grade SET staffGradeName = #{staffGradeName},staffProfessionalArchitectureId = #{staffProfessionalArchitectureId} where staffGradeId = #{staffGradeId}") @Update("UPDATE staff_grade SET staffGradeName = #{staffGradeName},staffProfessionalArchitectureId = #{staffProfessionalArchitectureId} where staffGradeId = #{staffGradeId}")
void updateStaffGrade(StaffGrade staffGrade); void updateStaffGrade(StaffGrade staffGrade);
@Select("select userId from staff where staffGradeId =#{staffGradeId} and isdel = 0")
List<Integer> queryUserIdsByGradeId(Integer staffGradeId);
@Update("UPDATE staff_grade SET isdel = 1 where staffProfessionalArchitectureId = #{staffProfessionalArchitectureId}")
void delStaffGradeByArchId(Integer staffProfessionalArchitectureId);
@Update("UPDATE staff_grade SET isdel = 1 where staffProfessionalArchitectureId = #{staffProfessionalArchitectureId}")
void deleteStaffArch(Integer staffProfessionalArchitectureId);
} }

@ -123,4 +123,7 @@ public interface StaffMapper {
@Select("select schoolId,staffId FROM staff WHERE userId = #{userId} AND isdel = 0 GROUP BY schoolId ORDER BY staffId limit 1") @Select("select schoolId,staffId FROM staff WHERE userId = #{userId} AND isdel = 0 GROUP BY schoolId ORDER BY staffId limit 1")
Integer querySchoolId(Integer userId); Integer querySchoolId(Integer userId);
@Select("select userId from staff where staffProfessionalArchitectureId =#{staffProfessionalArchitectureId} and isdel = 0")
List<Integer> queryUserIdsByArchId(Integer staffProfessionalArchitectureId);
} }

@ -1,6 +1,7 @@
package com.yipin.liuwanr.service; package com.yipin.liuwanr.service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -47,10 +48,24 @@ public class StaffGradeService {
return resp; return resp;
} }
public HashMap<String, Object> deleteStaffGrade(Integer staffGradeId){ public HashMap<String, Object> deleteStaffGrade(List<Integer> userIds){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
staffGradeMapper.deleteStaffGrade(staffGradeId); staffGradeMapper.deleteStaffGrade(userIds);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
return resp;
}
return resp;
}
public HashMap<String, Object> deleteStaffGradePs(Integer staffGradeId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
staffGradeMapper.deleteStaffGradePs(staffGradeId);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -89,4 +104,7 @@ public class StaffGradeService {
return resp; return resp;
} }
public List<Integer> queryUserIdsByGradeId(Integer staffGradeId) {
return staffGradeMapper.queryUserIdsByGradeId(staffGradeId);
}
} }

@ -1,7 +1,10 @@
package com.yipin.liuwanr.service; package com.yipin.liuwanr.service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import com.yipin.liuwanr.mapper.StaffGradeMapper;
import com.yipin.liuwanr.mapper.StaffMapper;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -17,6 +20,11 @@ public class StaffProfessionalArchitectureService {
@Autowired @Autowired
private StaffProfessionalArchitectureMapper staffProfessionalArchitectureMapper; private StaffProfessionalArchitectureMapper staffProfessionalArchitectureMapper;
@Autowired
private StaffGradeMapper staffGradeMapper;
@Autowired
private StaffMapper staffMapper;
public HashMap<String, Object> addStaffProfessionalArchitecture(StaffProfessionalArchitecture staffProfessionalArchitecture){ public HashMap<String, Object> addStaffProfessionalArchitecture(StaffProfessionalArchitecture staffProfessionalArchitecture){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
@ -78,7 +86,19 @@ public class StaffProfessionalArchitectureService {
public HashMap<String, Object> deleteStaffProfessionalArchitecture(Integer staffProfessionalArchitectureId){ public HashMap<String, Object> deleteStaffProfessionalArchitecture(Integer staffProfessionalArchitectureId){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
//删除员工专业一级组织架构
staffProfessionalArchitectureMapper.deleteStaffProfessionalArchitecture(staffProfessionalArchitectureId); staffProfessionalArchitectureMapper.deleteStaffProfessionalArchitecture(staffProfessionalArchitectureId);
//根据一级架构id删除staff_grade表中二级组织架构(假删)
staffGradeMapper.delStaffGradeByArchId(staffProfessionalArchitectureId);
//根据staffProfessionalArchitectureId查询staff表中的userId,然后调用批量删除员工信息接口
List<Integer> userIds =staffMapper.queryUserIdsByArchId(staffProfessionalArchitectureId);
if(userIds.size()>0){//说明年级架构下面存在用户
staffGradeMapper.deleteStaffGrade(userIds);
staffGradeMapper.deleteStaffArch(staffProfessionalArchitectureId);
}else{//如果组织架构下面没有员工,则只删除组织架构
staffGradeMapper.deleteStaffArch(staffProfessionalArchitectureId);
}
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());

@ -127,13 +127,13 @@ public class UserInfoService {
userInfoMapper.userAddStudent(student); userInfoMapper.userAddStudent(student);
} }
int size = userProfilesList.size(); int size = userProfilesList.size();
if (size<=0){ // if (size<=0){
for (int i = 0;i<size; i++){ for (int i = 0;i<size; i++){
UserProfiles userProfiles = userProfilesList.get(i); UserProfiles userProfiles = userProfilesList.get(i);
userProfiles.setUserId(userId); userProfiles.setUserId(userId);
userInfoMapper.addPersonalFile(userProfiles); userInfoMapper.addPersonalFile(userProfiles);
} }
} // }
int staffListSize = staffList.size(); int staffListSize = staffList.size();
for (int i = 0;i<staffListSize;i++){ for (int i = 0;i<staffListSize;i++){
Staff staff = staffList.get(i); Staff staff = staffList.get(i);

@ -0,0 +1,49 @@
server.port=8090
server.servlet.context-path=/liuwanr
#\u79D1\u5927\u6B63\u5F0F\u6570\u636E\u5E93\u8FDE\u63A5
spring.datasource.url=jdbc:mysql://192.168.0.99:3306/keda?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=mssdk@028
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#redis\u914D\u7F6E
spring.redis.database=0
spring.redis.host=127.0.0.1
spring.redis.password=msdw@2021
spring.redis.port=6379
spring.redis.timeout=3000
spring.redis.jedis.pool.max-idle=500
spring.redis.jedis.pool.min-idle=50
spring.redis.jedis.pool.max-active=2000
spring.redis.jedis.pool.max-wait=1000
#redis-cluster
redis.cluster.maxTotal=200
redis.cluster.maxIdle=8
redis.cluster.minIdle=3
redis.cluster.nodes=192.168.136.191:8000,192.168.136.191:8001,192.168.136.191:8002
spring.mina.port=9123
spring.mina.buffersize=2048
spring.mina.idletime=15
spring.main.show-banner=false
#\u65E5\u5FD7\u7EA7\u522B
logging.level.jdbc=OFF
logging.level.jdbc.sqltiming=DEBUG
logging.level.jdbc.resultsettable=DEBUG
logging.level.com.yipin.liuwar.mapper=DEBUG
logging.level.com.yipin.liuwanr.mapper=DEBUG
spring.elasticsearch.rest.uris=http://es-cn-v641e944a0006xtwy.elasticsearch.aliyuncs.com:9200
spring.elasticsearch.rest.username=elastic
spring.elasticsearch.rest.password=1qaz@WSX
# maxFileSize \u5355\u4E2A\u6570\u636E\u5927\u5C0F
spring.servlet.multipart.maxFileSize = 1024MB
# maxRequestSize \u662F\u603B\u6570\u636E\u5927\u5C0F
spring.servlet.multipart.maxRequestSize=10240MB
pagehelper.reasonable=false

@ -52,15 +52,15 @@ public class StaffGradServiceTest {
/** /**
* 删除员工年级 * 删除员工年级
*/ */
@Test // @Test
@Transactional // @Transactional
public void deleteStaffGradeTest(){ // public void deleteStaffGradeTest(){
Integer staffGradeId = 1; // Integer staffGradeId = 1;
HashMap<String, Object> staffGrade = staffGradeService.deleteStaffGrade(staffGradeId); // HashMap<String, Object> staffGrade = staffGradeService.deleteStaffGrade(staffGradeId);
for (String s : staffGrade.keySet()) { // for (String s : staffGrade.keySet()) {
System.out.println("key:" + s + "," + "value:" + staffGrade.get(s)); // System.out.println("key:" + s + "," + "value:" + staffGrade.get(s));
} // }
} // }
/** /**
* 查询员工年级详情 * 查询员工年级详情

Loading…
Cancel
Save