Commit 7073919d authored by hanshuai's avatar hanshuai

Merge branch 'V2.0.3' of ssh://103.249.252.28:10022/lcy/education

hanshuai
parent 7a9daab3
......@@ -116,8 +116,11 @@ public class BCompanyServiceImpl implements BCompanyService{
SysUser user = new SysUser();
user.setLoginName(nowStatus.getCode());
String uId = sysUserMapper.selectByLoginName(user.getLoginName());
user.setFlag(status);
sysUserMapper.stopOrStartUser(user);
user.setBusinessId(uId);
// sysUserMapper.stopOrStartUser(user);
sysUserMapper.updateByPrimaryKeySelective(user);
int line = bCompanyRepository.updateByPrimaryKeySelective(company);
return new PersistModel(line);
}
......
......@@ -17,6 +17,9 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
......@@ -41,6 +44,21 @@ public class BCourseCodeServiceImpl implements BCourseCodeService {
@Override
public PersistModel merge(BCourseCode bCourseCode){
UserUtil.setCurrentMergeOperation(bCourseCode);
Date date1 = null;
Date date2 = null;
SimpleDateFormat format1 = new SimpleDateFormat("HH:mm");
try {
date1 = format1.parse(bCourseCode.getStartDate());
date2 = format1.parse(bCourseCode.getEndDate());
} catch (ParseException e) {
e.printStackTrace();
}
if (date1.getTime() > date2.getTime()){
throw new ServiceException(ResultServiceEnums.STARTDATE_AFTER_ENDDATE);
}
if (date1.getTime() == date2.getTime()) {
throw new ServiceException(ResultServiceEnums.STARTDATE_EQUAL_ENDDATE);
}
int line = bCourseCodeRepository.updateByPrimaryKeySelective(bCourseCode);
log.info(UserUtil.getUserInfoProp(bCourseCode.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+
bCourseCode.getBusinessId()+"的信息");
......
......@@ -170,6 +170,9 @@ public enum ResultServiceEnums {
AGENCY_IS_USED(91,"该教学单位已被使用,不可删除"),
STARTDATE_AFTER_ENDDATE(93,"开始时间比结束时间晚"),
STARTDATE_EQUAL_ENDDATE(94,"开始时间等于结束时间"),
;
private Integer code;
......
......@@ -44,7 +44,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
"(#{businessId},#{userId},#{roleId})")
int insertUserRole(UserRole userRole);
@Select("SELECT u.business_id from s_user u left join ${tab} s on u.login_name = s.code where s.business_id = #{id}")
@Select("SELECT u.business_id from s_user u left join ${tab} s on u.login_name = s.code where s.business_id = #{id} and u.del_flag = 0 and u.flag = 1")
String selectUserIdByStuOrTeaId(@Param("id") String id, @Param("tab") String table);
@Update("update s_user set del_flag = 1, flag = 0 where login_name = #{code}")
......@@ -87,9 +87,12 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
@Select("select * from b_agency where code = #{agencyCode} and del_flag = 0 and flag = 1")
List<BAgency> checkTeacherAgency(String agencyCode);
@Update("update s_user set flag =#{flag} where login_name = #{loginName} and del_flag = 0 and flag = 1")
@Update("update s_user set flag =#{flag} where login_name = #{loginName} and del_flag = 0 and flag = 0")
int stopOrStartUser(SysUser user);
@Update("update s_user set flag =#{flag} where business_id = #{businessId} ")
int stopOrStartUserByUserBusinessId(SysUser sysUser);
@Select("select business_id from s_user where login_name = #{0} and del_flag = 0")
String selectByLoginName(String loginName);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment