同步功能修改

master
anthonywj 2 years ago
parent 872c4e5167
commit 75d388e121

@ -71,24 +71,24 @@ public class SysUserController extends BaseController {
AuthAdminResponse authAdminResponse = new AuthAdminResponse();
BeanUtils.copyProperties(item, authAdminResponse);
List<Long> roles = sysRoleService.selectRoleListByUserId(authAdminResponse.getId());
List<DeptUserResponse> deptUserResponses=null;
if("key".equals(filterAuthUserRequest.getKey())){
deptUserResponses = deptUserService.selectByUserIdKey(authAdminResponse.getId());
}else{
List<DeptUserResponse> deptUserResponses = null;
if ("key".equals(filterAuthUserRequest.getKey())) {
deptUserResponses = deptUserService.selectByUserIdKey(authAdminResponse.getId());
} else {
deptUserResponses = deptUserService.selectByUserId(authAdminResponse.getId());
}
if (CollUtil.isNotEmpty(deptUserResponses)) {
List<Long> depts = new ArrayList<>();
String deptName = "";
for (DeptUserResponse deptUserResponse : deptUserResponses) {
if(deptUserResponse.getDeptId()!=1){
if (deptUserResponse.getDeptId() != 1) {
depts.add(deptUserResponse.getDeptId());
deptName = deptName + "," + deptUserResponse.getDeptName();
}
}
if(deptName.length()!=0){
if (deptName.length() != 0) {
authAdminResponse.setDeptName(deptName.substring(1));
}else{
} else {
authAdminResponse.setDeptName(deptName);
}
authAdminResponse.setDepts(depts);
@ -190,9 +190,9 @@ public class SysUserController extends BaseController {
}
//默认插入第一部门
List<Long> deptCodeList=authUserSaveRequest.getDepts();
if(deptCodeList == null){
deptCodeList=new ArrayList<>();
List<Long> deptCodeList = authUserSaveRequest.getDepts();
if (deptCodeList == null) {
deptCodeList = new ArrayList<>();
}
deptCodeList.add(1L);
authUserSaveRequest.setDepts(deptCodeList);
@ -261,7 +261,7 @@ public class SysUserController extends BaseController {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
// 修改角色
// userService.insertUserAuth(authAdmin.getId(), authUserSaveRequest.getRoles());
// userService.insertUserAuth(authAdmin.getId(), authUserSaveRequest.getRoles());
userService.updateAuthAdmin(authAdmin);
@ -270,19 +270,19 @@ public class SysUserController extends BaseController {
FilterDeptUserReqeust filterDeptUserReqeust = new FilterDeptUserReqeust();
filterDeptUserReqeust.setUserId(authUserSaveRequest.getId());
List<DeptUserEntity> deptUserEntities = deptUserService.selectDeptUser(filterDeptUserReqeust);
if(deptUserEntities == null){
if (deptUserEntities == null) {
deptCodeList.add(1L);
authUserSaveRequest.setDepts(deptCodeList);
}else{
Boolean checkDeptId=false;
} else {
Boolean checkDeptId = false;
for (DeptUserEntity deptUserEntity : deptUserEntities) {
if(deptUserEntity.getDeptId() == 1){
checkDeptId=true;
}else{
if (deptUserEntity.getDeptId() == 1) {
checkDeptId = true;
} else {
deptCodeList.add(deptUserEntity.getDeptId());
}
}
if(checkDeptId==false){
if (checkDeptId == false) {
deptCodeList.add(1L);
authUserSaveRequest.setDepts(deptCodeList);
}

@ -90,7 +90,7 @@ public class ThrDeptController {
@PostMapping("/spms/thrsys/warehouse/edit")
public BaseResponse edit(@RequestBody @Valid ThrDeptEntity thrDeptEntity,
BindingResult bindingResult,FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest,FilterThrDeptRequest filterThrDeptRequest) {
BindingResult bindingResult, FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest, FilterThrDeptRequest filterThrDeptRequest) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
@ -108,13 +108,12 @@ public class ThrDeptController {
//修改仓库
thrInvWarehouseService.updateThrInvWarehouse(thrInvWarehouseEntity);
}
//判断部门是否存在
//判断部门是否存在
filterThrDeptRequest.setCode(thrDeptEntity.getCode());
filterThrDeptRequest.setName(thrDeptEntity.getName());
filterThrDeptRequest.setThirdSysFk(thrDeptEntity.getThirdSysFk());
filterThrDeptRequest.setStatus(thrDeptEntity.getStatus());
List<ThrDeptEntity> thrDeptEntities = thrDeptService.filterThrInvWarehouse(filterThrDeptRequest);
if(thrDeptEntities.size()==0 ){
if (!thrDeptService.editExit(thrDeptEntity.getCode(), thrDeptEntity.getCode(), thrDeptEntity.getId())) {
thrDeptEntity.setPid(null); // 不能修改父级 pid
thrDeptEntity.setUpdateTime(new Date());
boolean b = thrDeptService.updateInvWarehouse(thrDeptEntity);
@ -122,7 +121,7 @@ public class ThrDeptController {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success();
}else{
} else {
return ResultVOUtils.error(ResultEnum.DATA_REPEAT);
}
@ -158,7 +157,7 @@ public class ThrDeptController {
// }
// filterThrSubInvWarehouseRequest.setParentId((String) thirdId);
filterThrSubInvWarehouseRequest.setStatus(0);
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = thrInvWarehouseService.selectByThrDeptCode(filterThrSubInvWarehouseRequest);
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = thrInvWarehouseService.selectByThrDeptCode(filterThrSubInvWarehouseRequest);
PageInfo<ThrInvWarehouseEntity> pageInfo;
pageInfo = new PageInfo<>(thrInvWarehouseEntities);
PageSimpleResponse<ThrInvWarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();

@ -12,13 +12,11 @@ import java.util.List;
@Mapper
public interface InvSpaceDao extends BaseMapperPlus<InvSpace, InvSpace, InvSpace> {
int deleteByPrimaryKey(Integer id);
int insertEntity(InvSpace record);
int insertSelective(InvSpace record);
InvSpace selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(InvSpace record);

@ -154,11 +154,17 @@ public class SpGetHttpClient {
public BaseResponse<String> updateSynsSet(SyncDataSetResponse syncDataSetResponse) {
String json = JSONUtil.toJsonStr(syncDataSetResponse);
String result = okHttpCli.doPostJson(getIpUrl() + "/directToSpms" + "/system/param/syncData/save", json, buildHeader());
BaseResponse<String> response =
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
});
return response;
try {
String result = okHttpCli.doPostJson(getIpUrl() + "/directToSpms" + "/system/param/syncData/save", json, buildHeader());
BaseResponse<String> response =
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
});
return response;
} catch (Exception e) {
e.printStackTrace();
}
return ResultVOUtils.error(500, "连接上级服务失败");
}

@ -1,6 +1,7 @@
package com.glxp.api.service.auth.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
@ -68,7 +69,8 @@ public class InvSpaceServiceImpl extends ServiceImpl<InvSpaceDao, InvSpace> impl
invSpace.setUpdateTime(date);
invSpace.setCreateUser(user.getUserName());
invSpace.setUpdateUser(user.getUserName());
invSpaceDao.insertEntity(invSpace);
invSpace.setId(IdUtil.getSnowflakeNextId());
invSpaceDao.insert(invSpace);
return ResultVOUtils.success();
}
@ -92,8 +94,8 @@ public class InvSpaceServiceImpl extends ServiceImpl<InvSpaceDao, InvSpace> impl
@Override
public BaseResponse deleteSpace(String id) {
//校验此货位是否已经被使用,如果已经被使用,不能删除
Integer spaceId = Integer.valueOf(id);
InvSpace invSpace = invSpaceDao.selectByPrimaryKey(spaceId);
Long spaceId = Long.valueOf(id);
InvSpace invSpace = invSpaceDao.selectById(spaceId);
//todo 代码迁移,后面记得修改
@ -108,7 +110,7 @@ public class InvSpaceServiceImpl extends ServiceImpl<InvSpaceDao, InvSpace> impl
// if (count > 0) {
// return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "此货位已被使用,无法删除!");
// }
invSpaceDao.deleteByPrimaryKey(spaceId);
invSpaceDao.deleteById(spaceId);
return ResultVOUtils.success();
}

@ -122,7 +122,7 @@ public class InvWarehouseServiceImpl extends ServiceImpl<InvWarehouseDao, InvWar
@Override
public boolean insertInvSubWarehouse(InvWarehouseEntity invWarehouseEntity) {
return invWarehouseDao.insertInvSubWarehouse(invWarehouseEntity);
return invWarehouseDao.insert(invWarehouseEntity) > 0;
}
@Override

@ -247,7 +247,7 @@ public class HeartService {
}
break;
case USER_DATA:
if (!needExec(info.getBasicDept(), info.getBasicInv(), info.getSysUser())) {
if (needExec(info.getBasicDept(), info.getBasicInv(), info.getSysUser())) {
uploadData(exportType, taskId, x -> x.getUserData(info, taskId, now, syncTime));
}
break;
@ -758,7 +758,7 @@ public class HeartService {
syncTimeMap.put("oldDate", syncTime);
//确认有开启第三方部门信息同步
if (needExec(info.getBasicThirdDept())) {
if (needExec(info.getBasicThirdInv())) {
Map<String, Object> map;
if (syncTime == null) {
map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.THR_DEPT);

@ -14,6 +14,8 @@ public interface ThrDeptService extends IService<ThrDeptEntity> {
ThrDeptEntity findDefault(Boolean advaceType, Boolean isDefault);
boolean editExit(String code, String thirdSysFk, Long id);
List<ThrDeptEntity> filterThrInvWarehouse(FilterThrDeptRequest filterThrDeptRequest);
List<ThrDeptEntity> filterGroupInvWarehouse(FilterThrDeptRequest filterThrDeptRequest);

@ -2,6 +2,7 @@ package com.glxp.api.service.thrsys.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.common.res.BaseResponse;
@ -27,7 +28,7 @@ import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrDeptServiceImpl extends ServiceImpl<ThrDeptDao,ThrDeptEntity> implements ThrDeptService {
public class ThrDeptServiceImpl extends ServiceImpl<ThrDeptDao, ThrDeptEntity> implements ThrDeptService {
@Resource
private ThrDeptDao thrDeptDao;
@ -48,6 +49,11 @@ public class ThrDeptServiceImpl extends ServiceImpl<ThrDeptDao,ThrDeptEntity> im
return null;
}
@Override
public boolean editExit(String code, String thirdSysFk, Long id) {
return thrDeptDao.exists(new QueryWrapper<ThrDeptEntity>().eq("code", code).eq("thirdSysFk", thirdSysFk).ne("id", id));
}
@Override
public List<ThrDeptEntity> filterThrInvWarehouse(FilterThrDeptRequest filterThrDeptRequest) {
if (filterThrDeptRequest == null) {

@ -60,7 +60,7 @@ public class SyncHeartTask implements SchedulingConfigurer {
//定时上传最近更新基础数据至上游轮询时间
long timeInterval1 = syncDataSetEntity.getSyncTime() * 60 * 1000L;
long timeInterval1 = syncDataSetEntity.getSyncTime() * 6 * 1000L;
long curTime1 = System.currentTimeMillis();
Long lastTime1 = (Long) redisUtil.get("SPS_SYNC_UPLOAD_DATA");
if (lastTime1 == null) {

@ -31,25 +31,13 @@
remark
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from auth_space
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from auth_space
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insertEntity" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.auth.InvSpace"
useGeneratedKeys="true">
insert into auth_space (code, `name`, type, invStorageCode,
invWarehouseCode, `status`, createTime,
updateTime, `createUser`, updateUser,
remark)
invWarehouseCode, `status`, createTime,
updateTime, `createUser`, updateUser,
remark)
values (#{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{invStorageCode,jdbcType=VARCHAR},
#{invWarehouseCode,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
@ -255,9 +243,9 @@
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
insert into auth_space
(code, `name`, type, invStorageCode, invWarehouseCode, `status`, createTime, updateTime,
`createUser`, updateUser, remark)
values
(code, `name`, type, invStorageCode, invWarehouseCode, `status`, createTime, updateTime,
`createUser`, updateUser, remark)
values
<foreach collection="list" item="item" separator=",">
(#{item.code,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR},
#{item.invStorageCode,jdbcType=VARCHAR},
@ -269,13 +257,14 @@
</foreach>
</insert>
<select id="filterList" parameterType="com.glxp.api.req.auth.FilterInvSpaceRequest" resultType="com.glxp.api.res.auth.InvSpaceResponse">
<select id="filterList" parameterType="com.glxp.api.req.auth.FilterInvSpaceRequest"
resultType="com.glxp.api.res.auth.InvSpaceResponse">
select s.*,
w.name invStorageName,
iws.name invSubStorageName
from auth_space s
left join auth_dept w on s.invStorageCode = w.code
left join auth_warehouse iws on s.invWarehouseCode = iws.code
left join auth_dept w on s.invStorageCode = w.code
left join auth_warehouse iws on s.invWarehouseCode = iws.code
<where>
<if test="invStorageCode != null and invStorageCode != ''">
AND s.invStorageCode = #{invStorageCode}
@ -318,8 +307,8 @@
<select id="selectSpaceCodeList" resultType="com.glxp.api.res.auth.InvSpaceResponse">
select auth_space.code, auth_space.name, iws.name invSubStorageName, iw.name invStorageName
from auth_space
left join auth_warehouse iws on iws.code = auth_space.invWarehouseCode
left join auth_dept iw on iw.code = auth_space.invStorageCode
left join auth_warehouse iws on iws.code = auth_space.invWarehouseCode
left join auth_dept iw on iw.code = auth_space.invStorageCode
<where>
<if test="invStorageCode != null and invStorageCode != ''">
AND auth_space.invStorageCode = #{invStorageCode}
@ -385,7 +374,7 @@
<select id="selectExistByName" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from auth_space
<where>
<if test="invStorageCode != null and invStorageCode != ''">
@ -401,7 +390,8 @@
</select>
<select id="getMaxSpaceCode" resultType="java.lang.String">
select max(code) from auth_space
select max(code)
from auth_space
<where>
<if test="invCode != null and invCode != ''">
and invWarehouseCode = #{invCode}

@ -217,6 +217,9 @@
<if test="advanceType != null">
advanceType=#{advanceType},
</if>
<if test="updateTime != null">
updateTime=#{updateTime},
</if>
<if test="spUse != null">
spUse=#{spUse},
</if>

@ -388,4 +388,4 @@ CALL Pro_Temp_ColumnWork('thr_corp', 'id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('auth_dept_user', 'userId', 'bigint', 2);
CALL Pro_Temp_ColumnWork('auth_dept_user', 'deptId', 'bigint', 2);
CALL Pro_Temp_ColumnWork('basic_bustype_pre', 'Id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('basic_export_status', 'remark', 'varchar(2048)', 2);

Loading…
Cancel
Save