Commit e20087bd authored by 赵啸非's avatar 赵啸非

添加样表皮肤管理

parent 99542ef3
......@@ -13,6 +13,7 @@ import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDService;
import com.mortals.framework.service.IUser;
import com.mortals.xhx.base.system.menu.model.MenuEntity;
import com.mortals.xhx.base.system.user.dao.UserDao;
import com.mortals.xhx.base.system.user.model.UserEntity;
import java.util.List;
......@@ -112,4 +113,8 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @throws AppException
*/
public boolean updateUserPwd(String loginName, String oldPwd, String newPwd) throws AppException;
UserDao getUserDao();
}
\ No newline at end of file
......@@ -95,6 +95,8 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
Map<String, DeviceEntity> oldDeviceMap = oldDeviceList.stream().collect(Collectors.toMap(x -> x.getDeviceCode(), y -> y, (o, n) -> n));
Map<String, DeviceEntity> newDeviceMap = newDeviceList.stream().collect(Collectors.toMap(x -> x.getDeviceCode(), y -> y, (o, n) -> n));
log.info("oldDeviceMap:{}", JSON.toJSONString(oldDeviceMap));
List<DeviceEntity> updateDeviceLsit = newDeviceList.stream().map(item -> {
if (oldDeviceMap.containsKey(item.getDeviceCode())) {
item.setId(oldDeviceMap.get(item.getDeviceCode()).getId());
......@@ -108,6 +110,7 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
}).filter(f -> f != null).collect(Collectors.toList());
List<DeviceEntity> saveDeviceList = newDeviceList.stream().map(item -> {
log.info("deviceCode:{},oldDeviceMap:{}",item.getDeviceCode(),oldDeviceMap.containsKey(item.getDeviceCode()));
if (!oldDeviceMap.containsKey(item.getDeviceCode())) {
item.setDeviceId(item.getId());
item.setCreateUserId(1L);
......@@ -128,7 +131,7 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
if (!ObjectUtils.isEmpty(updateDeviceLsit)) {
log.info("设备更新,size:{}", updateDeviceLsit.size());
deviceService.update(updateDeviceLsit);
// deviceService.update(updateDeviceLsit);
}
if (!ObjectUtils.isEmpty(saveDeviceList)) {
......
package com.mortals.xhx.daemon.task;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.feign.user.IUserFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.List;
/**
* 同步用户,唯一标识为用户名。
*/
@Slf4j
@Service("SyncUserTask")
@ConditionalOnExpression("'${platform.type:null}'=='cloud'")
public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired
private IUserFeign userFeign;
@Autowired
private UserService userService;
@Override
public void excuteTask(ITask task) throws AppException {
log.info("同步用户任务");
UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> resp = userFeign.list(userPdu);
if (resp.getCode() == YesNoEnum.YES.getValue()) {
//同步更新用户,以loginname为唯一标识,密码默认与用户相同
resp.getData().getData().forEach(user -> {
log.info("loginName:{}", user.getLoginName());
UserEntity tempEntity = userService.selectOne(new UserQuery().loginName(user.getLoginName()));
if (ObjectUtils.isEmpty(tempEntity)) {
UserEntity userEntity = new UserEntity();
BeanUtils.copyProperties(user, userEntity, new String[]{"id","lastLoginTime", "lastLoginAddress"});
log.info("新增:{}", JSON.toJSONString(userEntity));
userService.getUserDao().insert(userEntity);
}else {
//更新基本信息
UserEntity userEntity = new UserEntity();
BeanUtils.copyProperties(user, userEntity, new String[]{"loginPwd","userType","status","lastLoginTime", "lastLoginAddress"});
log.info("更新:{}", JSON.toJSONString(userEntity));
userService.getUserDao().update(userEntity);
}
});
}
// log.info("syncUserResp:{}", JSON.toJSONString(resp));
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
......@@ -24,8 +24,4 @@ public class DeviceServiceImpl extends AbstractCRUDServiceImpl<DeviceDao, Device
@Autowired
private MatterDatumService matterDatumService;
@Override
protected void saveBefore(DeviceEntity entity, Context context) throws AppException {
super.saveBefore(entity, context);
}
}
\ No newline at end of file
......@@ -6,8 +6,11 @@ import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.sample.model.SampleBillEntity;
import com.mortals.xhx.module.sample.service.SampleBillService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -46,6 +49,8 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
private ParamService paramService;
@Autowired
private SampleBillService sampleBillService;
@Autowired
private MatterService matterService;
public MatterDatumController() {
super.setModuleDesc("事项申请材料");
......@@ -125,8 +130,13 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
sampleBillEntity.initAttrValue();
sampleBillEntity.setSiteId(entity.getSiteId());
sampleBillEntity.setMaterialName(entity.getMaterialName());
sampleBillEntity.setMaterialFullName(entity.getMateriaFullName());
sampleBillEntity.setMatterName(entity.getMatterName());
if(!ObjectUtils.isEmpty(entity.getMatterId())){
MatterEntity matterEntity = matterService.get(entity.getMatterId());
sampleBillEntity.setMatterName(matterEntity.getMatterName());
sampleBillEntity.setMatterFullName(matterEntity.getMatterFullName());
}
sampleBillEntity.setMatterFullName(entity.getMatterName());
sampleBillEntity.setOperTime(new Date());
sampleBillService.save(sampleBillEntity,context);
......
package com.mortals.xhx.module.sample.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceQuery;
import com.mortals.xhx.module.device.service.DeviceService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.sample.model.SampleBillEntity;
import com.mortals.xhx.module.sample.service.SampleBillService;
......@@ -19,26 +26,31 @@ import com.mortals.framework.util.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 样报服务
*
* @author zxfei
* @date 2023-02-23
*/
* 样报服务
*
* @author zxfei
* @date 2023-02-23
*/
@RestController
@RequestMapping("sample/bill")
public class SampleBillController extends BaseCRUDJsonBodyMappingController<SampleBillService,SampleBillEntity,Long> {
public class SampleBillController extends BaseCRUDJsonBodyMappingController<SampleBillService, SampleBillEntity, Long> {
@Autowired
private ParamService paramService;
public SampleBillController(){
super.setModuleDesc( "样报服务");
@Autowired
public DeviceService deviceService;
public SampleBillController() {
super.setModuleDesc("样报服务");
}
@Override
......@@ -58,6 +70,13 @@ public class SampleBillController extends BaseCRUDJsonBodyMappingController<Samp
@Override
@UnAuth
public String save(@RequestBody SampleBillEntity entity) {
if (ObjectUtils.isEmpty(entity.getDeviceName()) && !ObjectUtils.isEmpty(entity.getDeviceCode())) {
DeviceEntity deviceEntity = deviceService.selectOne(new DeviceQuery().deviceCode(entity.getDeviceCode()));
entity.setDeviceName(deviceEntity.getDeviceName());
}
entity.setMatterFullName(entity.getMaterialName());
entity.setMaterialFullName(entity.getMaterialFullName());
return super.save(entity);
}
}
\ No newline at end of file
......@@ -48,10 +48,6 @@ public class SkinServiceImpl extends AbstractCRUDServiceImpl<SkinDao, SkinEntity
@Override
protected void updateAfter(SkinEntity entity, Context context) throws AppException {
super.updateAfter(entity, context);
//推送皮肤更新消息
DeviceMsgReqPdu deviceMsgReqPdu = new DeviceMsgReqPdu();
deviceMsgReqPdu.setSiteid(entity.getSiteId());
......
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