Commit 0944b317 by 赵剑炜

Merge branch 'develop' of http://gitlab.sothing.top/843502640/jyzb_platformV2 into develop-zhaojw

parents e3846c8d 06613496
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3,6 +3,7 @@ package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Data
......@@ -20,6 +21,7 @@ public class OrgDto {
private Integer statusFlag;
private Integer delFlag;
private Integer childCount;
private Date updateTime;
private List<OrgDto> children = new ArrayList<>();
public void addChild(OrgDto child) {
......
......@@ -12,4 +12,6 @@ public class SizeAndTypeDto {
private List<TypeDto> typeList;
private List<OrgDto> orgList;
}
......@@ -21,5 +21,9 @@ public class QueryEquipmentTypeReq {
private String typeName;
private String nickName;
private Date updateTime;
/**
* 是否需要添加组织机构返回
*/
private Boolean flag;
}
......@@ -47,6 +47,13 @@ public class DeviceConfigController {
public ApiRes<Boolean> updateDeviceConfig(@RequestBody UpdateDeivceConfigReq req){
return ApiRes.success(deviceConfigService.updateDeviceConfig(req));
}
//删除配置(通道和本地主机配置)
@PostMapping(path="/delDeviceConfig",name="删除配置#logType=30")
@ApiOperation("删除配置")
public ApiRes<Boolean> delDeviceConfig(@RequestBody UpdateDeivceConfigReq req){
return ApiRes.success(deviceConfigService.delDeviceConfig(req));
}
//查询配置Page(通道和本地主机配置)
@PostMapping(path="/showDeviceConfigPage",name="查询配置Page#enable")
@ApiOperation("查询配置Page")
......@@ -72,6 +79,13 @@ public class DeviceConfigController {
public ApiRes<Boolean> updateWarehouseDev(@RequestBody UpdateWarehouseDevReq req){
return ApiRes.success(warehouseDevService.updateWarehouseDev(req));
}
//删除除湿机配置
@PostMapping(path="/delWarehouseDev",name="删除除湿机配置#logType=30")
@ApiOperation("删除除湿机配置")
public ApiRes<Boolean> delWarehouseDev(@RequestBody UpdateWarehouseDevReq req){
return ApiRes.success(warehouseDevService.delWarehouseDev(req));
}
//查看除湿机配置
@PostMapping(path="/showWarehouseDevList",name="查看除湿机配置#enable")
@ApiOperation("查看除湿机配置")
......
......@@ -19,7 +19,13 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Base64;
import java.util.List;
@RestController
......@@ -110,10 +116,12 @@ public class EquipmentTypeController {
return ApiRes.success(equipmentTypeService.alignTypeInfo(req));
}
@PostMapping(path = "/exportSizeAndType",name = "导出指定时间后的类型号型#enable")
@ApiOperation("导出指定时间后的类型号型")
@PostMapping(path = "/exportSizeAndType",name = "导出指定时间后的类型号型组织机构#enable")
@ApiOperation("导出指定时间后的类型号型组织机构")
public ApiRes<String> exportSizeAndType(@RequestBody QueryEquipmentTypeReq req){
return ApiRes.success(equipmentTypeService.exportSizeAndType(req));
}
}
......@@ -34,12 +34,6 @@ public class InventoryController {
public InventorySummaryService inventorySummaryService;
@Resource
public MQProductService mqProductService;
@GetMapping("/TestSum")
@ApiOperation("根据组织机构查询库存信息")
public ApiRes<Boolean> TestSum( ) {
inventorySummaryService.MonthStartSum();
return ApiRes.success();
}
@GetMapping("/testMQ")
@ApiOperation("根据组织机构查询库存信息")
......@@ -49,20 +43,6 @@ public class InventoryController {
}
//填充汇总信息(根据base_inventory表中数据汇总同步)--第一次进行数据同步,适用于3.0初始化inventory_summary表
//该方法只有插入语句,要注意inventory_summary表中没有数据,仅有结构,否则数据不准确
@PostMapping(path="/SetInventoryMsg",name="填充汇总表信息#logType=30")
@ApiOperation("填充汇总表信息")
public ApiRes<Boolean> setInventoryMsg(InventorySumReq req) {
boolean result = inventoryService.setInventoryMsg(req);
if (!result){
return ApiRes.failure("汇总失败");
}
return ApiRes.success(result);
}
//装备绑定箱门
@PostMapping(path="/EquipmentBind",name="装备绑定箱门#logType=30")
......
......@@ -313,9 +313,14 @@ public class PoliceController {
return ApiRes.success(policemanService.alignUserInfo(req));
}
// @PostMapping(path = "/oneClickAccountCreation",name = "一键生成账号(运维,管理,审核)#logType=30")
// public ApiRes<Boolean> oneClickAccountCreation(@RequestBody PubOrg pubOrg) throws IOException {
// return ApiRes.success(policemanService.oneClickAccountCreation(pubOrg));
// }
@PostMapping(path = "/oneClickAccountCreation",name = "一键生成账号(运维,管理,审核)#logType=30")
public ApiRes<Boolean> oneClickAccountCreation(@RequestBody PubOrg pubOrg) throws IOException {
return ApiRes.success(policemanService.oneClickAccountCreation(pubOrg));
return ApiRes.success(policemanService.oneClickAccountCreation1(pubOrg));
}
}
......@@ -91,7 +91,8 @@ public class TjController {
@PostMapping("/TjOrgPrice")
@ApiOperation("/财务统计报表")
public ApiRes<PageResult<TjOrgPriceDto>> TjOrgPrice(@RequestBody TjOrgPriceReq req){
return ApiRes.success(tjService.TjOrgPrice(req));
PageResult<TjOrgPriceDto> tjOrgPriceDtoPageResult = tjService.TjOrgPrice(req);
return ApiRes.success(tjOrgPriceDtoPageResult);
}
@PostMapping("/TjOrgPriceSum")
@ApiOperation("/财务统计报表汇总")
......
......@@ -139,6 +139,7 @@ import static com.junmp.junmpProcess.common.CommonConstants.*;
List<OrderDetail> list = orderDetailService.list(new LambdaQueryWrapper<OrderDetail>()
.eq(OrderDetail::getOrderId, updateOrderReq.getId()));
updateOrderReq.setId(existOrder.getId());
existOrder.setActualQuantity(0);
orderMainService.updateById(existOrder);
// orderMainService.ChangeOrderState(updateOrderReq);
List<UpdateOrderDetailReq> collect = list.stream().map(orderDetail -> {
......@@ -148,8 +149,11 @@ import static com.junmp.junmpProcess.common.CommonConstants.*;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
updateOrderDetailReq.setProductionDate(format.format(orderDetail.getProductionDate()));
}
orderDetail.setActualNum(0);
orderDetail.setModifyQuantity(0);
return updateOrderDetailReq;
}).collect(Collectors.toList());
orderDetailService.updateBatchById(list);
updateOrderReq.setDetailList(collect);
//将单据上传到rabbitmq
orderMainService.AddFinishOrder(updateOrderReq);
......
......@@ -89,8 +89,5 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
// IPage<InventoryDto> GetDetailByTerms(@Param("page") Page<Object> defaultPage, @Param("req") InventoryReq req);
void reSetInventory(@Param("summaryTableName") String baseInventorySummary,
@Param("sourceTableName") String baseInventory,
@Param("warrantyThreshold") Integer brokenNumberDays,
@Param("sql") String sql);
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ import com.junmp.jyzb.entity.InventorySummary;
import com.junmp.jyzb.entity.Policeman;
import com.junmp.v2.sys.api.bean.user.SysUserDto;
import com.junmp.v2.sys.api.bean.user.req.SysUserReq;
import com.junmp.v2.sys.user.entity.SysUser;
import liquibase.pro.packaged.S;
import org.apache.ibatis.annotations.Mapper;
......@@ -64,4 +65,7 @@ public interface PolicemanMapper extends BaseMapper<Policeman> {
List<UserDto> alignUserInfo(@Param("orgId") Long orgId, @Param("date")String date);
List<UserDto> oneClickAccountCreation(@Param("orgId") Long orgId,@Param("account")String account,@Param("roleId")Long roleId);
List<UserDto> oneClickAccountCreation1(@Param("orgId") Long orgId);
void insertSysUser(@Param("userList") List<SysUser> sysUserList);
}
\ No newline at end of file
......@@ -13,20 +13,7 @@ import java.util.List;
public interface PriceSumSummaryMapper extends BaseMapper<PriceSumSummary> {
/**
* 存储过程-月初金额数量统计
*/
void MonthStart ();
/**
* 存储过程-月末金额数量统计
*/
void MonthEnd ();
/**
* 存储过程-月末差值计算统计
*/
void MonthDifference ();
TjOrgPriceDto TjOrgPrice(@Param("orgId") String orgId,
@Param("year") Integer year,
......
......@@ -29,4 +29,6 @@ public interface DeviceConfigService extends IService<DeviceConfig> {
List<String> alignDeviceConfigInfo(UpdateDeivceConfigReq req);
boolean delDeviceConfig(UpdateDeivceConfigReq req);
}
......@@ -34,4 +34,5 @@ public interface EquipmentTypeService extends IService<EquipmentType> {
List<TypeDto> alignTypeInfo(UpdateEquipmentTypeReq req);
String exportSizeAndType(QueryEquipmentTypeReq req);
}
......@@ -21,8 +21,6 @@ public interface InventoryService extends IService<Inventory> {
InventoryDto getInventoryDetail(InventoryReq msg);
//计算更新库存汇总表信息
boolean setInventoryMsg(InventorySumReq req);
boolean UpdateWarehouseInsNum(WarehouseReq req);
......
......@@ -13,8 +13,6 @@ import java.util.List;
public interface InventorySummaryService extends IService<InventorySummary> {
void MonthStartSum();
void MonthEndSum();
//根据条件查询库存汇总信息
PageResult<InventorySummary> getEquipmentInfo(InventorySumReq req);
......@@ -44,10 +42,7 @@ public interface InventorySummaryService extends IService<InventorySummary> {
List<InventorySumDto> selectTotalNum(SelectTotalNumReq req);
/**
* 更新使用次数和维修次数
*/
void updateCount();
//根据条件查询库存汇总信息(仅类型)
PageResult<InventorySummary> GetEquipmentSummary(InventorySumReq req);
......
......@@ -124,5 +124,7 @@ public interface PolicemanService extends IService<Policeman> {
List<UserDto> alignUserInfo(PolicemanReq req);
boolean oneClickAccountCreation(PubOrg pubOrg) throws IOException;
// boolean oneClickAccountCreation(PubOrg pubOrg) throws IOException;
boolean oneClickAccountCreation1(PubOrg pubOrg) throws IOException;
}
......@@ -21,4 +21,6 @@ public interface WarehouseDevService extends IService<WarehouseDev> {
List<WarehouseDev> showWarehouseDevList(UpdateWarehouseDevReq req);
List<WarehouseDevInfoDto> alignWarehouseDevInfo(UpdateWarehouseDevReq req);
boolean delWarehouseDev(UpdateWarehouseDevReq req);
}
......@@ -10,6 +10,7 @@ import com.junmp.jyzb.api.bean.dto.MQDto;
import com.junmp.jyzb.api.bean.query.QueryDeviceConfigReq;
import com.junmp.jyzb.api.bean.req.UpdateDeivceConfigReq;
import com.junmp.jyzb.api.bean.req.UpdateWarehouseDevReq;
import com.junmp.jyzb.api.exception.enums.CabinetExceptionEnum;
import com.junmp.jyzb.entity.DeviceConfig;
import com.junmp.jyzb.entity.WarehouseDev;
import com.junmp.jyzb.mapper.WarehouseDevMapper;
......@@ -18,6 +19,7 @@ import com.junmp.jyzb.mapper.DeviceConfigMapper;
import com.junmp.jyzb.service.WarehouseDevService;
import com.junmp.jyzb.utils.DateTimeUtil;
import com.junmp.jyzb.utils.RabbitMQSendMsg;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil;
import com.junmp.v2.db.api.factory.PageFactory;
import com.junmp.v2.db.api.factory.PageResultFactory;
......@@ -124,6 +126,14 @@ public class DeviceConfigServiceImpl extends ServiceImpl<DeviceConfigMapper, Dev
return deviceConfigList;
}
@Override
public boolean delDeviceConfig(UpdateDeivceConfigReq req) {
if (ObjectUtil.isNull(req.getId())){
throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR);
}
return this.removeById(req.getId());
}
}
......
......@@ -66,11 +66,18 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E
private RabbitMQSendMsg MQ;
@Resource
private PubOrgService pubOrgService;
@Resource
private EquipmentSizeService equipmentSizeService;
private static final String REDIS_TYPE = "Type_";
private List<EquipmentTypeDto> typeDto;
private ArrayList<String> ids;
private static final String DES_ALGORITHM = "DES";
private static final String CBC_PADDING = "DES/CBC/PKCS5Padding";
private static final int CHUNK_SIZE = 8;
//查询出类别表中数据的所有装备信息(入库时调用)
public List<EquipmentTypeDto> getEquipmentList(QueryEquipmentTypeReq req) {
List<EquipmentType> list = list(new LambdaQueryWrapper<EquipmentType>()
......@@ -537,6 +544,18 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E
return sizeDto;
}).collect(Collectors.toList());
sizeAndType.setSizeList(CollectionUtil.isNotEmpty(collect1)?collect1:new ArrayList<>());
if (req.getFlag()){
List<PubOrg> pubList = pubOrgService.list(new LambdaQueryWrapper<PubOrg>().ge(PubOrg::getUpdateTime, req.getUpdateTime())
.eq(PubOrg::getDelFlag,1));
List<OrgDto> collect2 = pubList.stream().map(pubOrg -> {
OrgDto orgDto = new OrgDto();
BeanPlusUtil.copyProperties(pubOrg, orgDto);
return orgDto;
}).collect(Collectors.toList());
sizeAndType.setOrgList(CollectionUtil.isNotEmpty(collect2)?collect2:new ArrayList<>());
}
String jsonString = JSONObject.toJSONString(sizeAndType);
try {
......@@ -562,12 +581,41 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E
// 对加密结果进行Base64编码并返回
return Base64.getEncoder().encodeToString(encryptedBytes);
// byte[] byKey = Arrays.copyOf("junmp888".getBytes(StandardCharsets.UTF_8), 8);
// byte[] iv = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x90, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF };
//
// SecretKeySpec secretKeySpec = new SecretKeySpec(byKey, DES_ALGORITHM);
// IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
//
// Cipher desCipher = Cipher.getInstance(CBC_PADDING);
// desCipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);
//
// byte[] inputByteArray = jsonString.getBytes(StandardCharsets.UTF_8);
// int offset = 0;
//
// StringBuilder encryptedString = new StringBuilder();
//
// while (offset < inputByteArray.length) {
// int length = Math.min(CHUNK_SIZE, inputByteArray.length - offset);
// byte[] chunk = new byte[length];
// System.arraycopy(inputByteArray, offset, chunk, 0, length);
//
// byte[] encryptedChunk = desCipher.doFinal(chunk);
// String base64EncodedChunk = Base64.getEncoder().encodeToString(encryptedChunk);
// encryptedString.append(base64EncodedChunk);
//
// offset += CHUNK_SIZE;
// }
// return encryptedString.toString();
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
}
......@@ -131,31 +131,6 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean setInventoryMsg(InventorySumReq req){
//查询字典表中的临近报废天数
SysDictItem sysDictItem = sysDictItemService.getOne(new LambdaQueryWrapper<SysDictItem>()
.eq(SysDictItem::getItemText, "brokenNumber"));
//如果配置找不到,那就默认设置为15天为临近报废(如果装备的质保期小于15天了,就是为临近报废)
Integer brokenNumberDays;
if (ObjectUtil.isNotNull(sysDictItem)){
brokenNumberDays=15;
}else {
brokenNumberDays=Integer.parseInt(sysDictItem.getItemValue());
}
boolean b = inventorySummaryService.remove(new LambdaQueryWrapper<InventorySummary>().eq(InventorySummary::getOrgId, req.getOrgId()));
// //放入仓库区域信息汇总
// boolean b1 = inventoryMapper.SetWarehouseInventory(brokenNumberDays);
// //放入单警柜信息汇总
// boolean b = inventoryMapper.SetCabinetInventory(brokenNumberDays);
String sql="and bi.org_id_int = "+req.getOrgId();
inventoryMapper.reSetInventory("base_inventory_summary","base_inventory",brokenNumberDays,sql);
return (b);
}
//设置仓库库存数量(总数,在库数,出库数,价格)
@Override
......
......@@ -75,16 +75,6 @@ public class InventorySummaryServiceImpl extends ServiceImpl<InventorySummaryMa
private EquipmentTypeService equipmentTypeService;
@Override
public void MonthStartSum() {
PriceSumSummaryMapper.MonthStart();
}
@Override
public void MonthEndSum() {
PriceSumSummaryMapper.MonthEnd();
PriceSumSummaryMapper.MonthDifference();
}
//根据条件查询库存汇总信息
@Override
public PageResult<InventorySummary> getEquipmentInfo(InventorySumReq req) {
......@@ -405,20 +395,6 @@ public class InventorySummaryServiceImpl extends ServiceImpl<InventorySummaryMa
return inventorySumDtoList;
}
/**
* 更新使用次数和维修次数
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateCount() {
//先统计上一个月的使用次数和维修次数,然后再进行置零,开始计算下一个月的数据
equipmentCountSummaryMapper.deleteAll(null);
equipmentCountSummaryMapper.addInfo(" 1=1");
LambdaUpdateWrapper<InventorySummary> eq = new LambdaUpdateWrapper<InventorySummary>()
.set(InventorySummary::getUseCount,0).set(InventorySummary::getFixCount,0);
update(eq);
}
private LambdaQueryWrapper<InventorySummary> createWrapper(InventorySumReq req) {
......
......@@ -142,6 +142,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
private RabbitMQSendMsg MQ;
@Resource
private EquipmentTypeService equipmentTypeService;
@Resource
private WarehouseInventoryService warehouseInventoryService;
......@@ -1061,25 +1064,41 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
if (ObjectUtil.isNull(detailJsonReq.getModifyQuantity())){
detailJsonReq.setModifyQuantity(uploadDetailReq.getModifyQuantity());
}
int subNum=detailJsonReq.getModifyQuantity()-detailJsonReq.getNum();
int subNum=detailJsonReq.getModifyQuantity()-(ObjectUtil.isNull(detailJsonReq.getNum())?0:detailJsonReq.getNum());
detailJsonReq.setSizeName(uploadDetailReq.getSizeName());
detailJsonReq.setTypeName(uploadDetailReq.getTypeName());
//添加list为修改库存Summary
UpdateOrderDetailReq data = new UpdateOrderDetailReq();
data.setActualNum(detailJsonReq.getNum());
data.setActualNum(ObjectUtil.isNull(detailJsonReq.getNum())?0:detailJsonReq.getNum());
data.setWarehouseId(detailJsonReq.getLocationId());
data.setWarehouseName(detailJsonReq.getLocationName());
data.setSizeId(detailJsonReq.getSizeId());
data.setTypeId(detailJsonReq.getTypeId());
data.setPrice(detailJsonReq.getPrice().toString());
data.setProperty(detailJsonReq.getProperty());
data.setSizeId(ObjectUtil.isNull(detailJsonReq.getSizeId())? uploadDetailReq.getSizeId():detailJsonReq.getSizeId());
data.setTypeId(ObjectUtil.isNull(detailJsonReq.getTypeId())? uploadDetailReq.getTypeId():detailJsonReq.getTypeId());
BigDecimal price=BigDecimal.ZERO;
if (ObjectUtil.isNull(detailJsonReq.getPrice())){
price=equipmentTypeService.getOne(new LambdaQueryWrapper<EquipmentType>()
.eq(EquipmentType::getId,uploadDetailReq.getTypeId()))
.getPrice();
}
data.setPrice(ObjectUtil.isNull(detailJsonReq.getPrice())? price.toString() :detailJsonReq.getPrice().toString());
data.setProperty(ObjectUtil.isNull(detailJsonReq.getProperty())?0:detailJsonReq.getProperty());
data.setSizeName(detailJsonReq.getSizeName());
data.setTypeName(detailJsonReq.getTypeName());
data.setModifyQuantity(detailJsonReq.getModifyQuantity());
orderDetailReqList.add(data);
//添加出入库日志记录
s = s+detailJsonReq.getLocationName()+"--"+detailJsonReq.getTypeName()+"【"+
detailJsonReq.getSizeName()+"】,单价:"+detailJsonReq.getPrice()+",数量实入:"+detailJsonReq.getNum()+",记账:"+ detailJsonReq.getModifyQuantity()+"\n";
if (orderMain.getOrderType().equals("in")){
s = s+detailJsonReq.getLocationName()+"--"+detailJsonReq.getTypeName()+"【"+
detailJsonReq.getSizeName()+"】,单价:"+(ObjectUtil.isNull(detailJsonReq.getPrice())?price:detailJsonReq.getPrice())
+",数量实入:"+(ObjectUtil.isNull(detailJsonReq.getNum())?0:detailJsonReq.getNum())+",记账:"+ detailJsonReq.getModifyQuantity()+"\n";
}else {
s = s+detailJsonReq.getLocationName()+"--"+detailJsonReq.getTypeName()+"【"+
detailJsonReq.getSizeName()+"】,单价:"+(ObjectUtil.isNull(detailJsonReq.getPrice())?price:detailJsonReq.getPrice())
+",数量实出:"+(ObjectUtil.isNull(detailJsonReq.getNum())?0:detailJsonReq.getNum())+",记账:"+ detailJsonReq.getModifyQuantity()+"\n";
}
if (subNum>0){
//实际出库或者入库数量大于实际数量,则对空数据进行增删改查
......@@ -1087,17 +1106,17 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
for (int j = 0; j < subNum; j++) {
inventory.setEpc("0");
inventory.setLocationId(detailJsonReq.getLocationId());
inventory.setSizeId(detailJsonReq.getSizeId());
inventory.setTypeId(detailJsonReq.getTypeId());
inventory.setSizeId(ObjectUtil.isNull(detailJsonReq.getSizeId())? uploadDetailReq.getSizeId():detailJsonReq.getSizeId());
inventory.setTypeId(ObjectUtil.isNull(detailJsonReq.getTypeId())? uploadDetailReq.getTypeId():detailJsonReq.getTypeId());
inventory.setOrgId(orderMain.getEndOrgId());
inventory.setLocationType(0);
inventory.setPrice(detailJsonReq.getPrice());
inventory.setPrice(ObjectUtil.isNull(detailJsonReq.getPrice())?price:detailJsonReq.getPrice());
inventory.setProperty(0);
addInvList.add(inventory);
warehouseInventory.setOrgId(orderMain.getEndOrgId());
warehouseInventory.setLocationId(detailJsonReq.getLocationId());
warehouseInventory.setTypeId(detailJsonReq.getTypeId());
warehouseInventory.setSizeId(detailJsonReq.getSizeId());
warehouseInventory.setTypeId(ObjectUtil.isNull(detailJsonReq.getTypeId())? uploadDetailReq.getTypeId():detailJsonReq.getTypeId());
warehouseInventory.setSizeId(ObjectUtil.isNull(detailJsonReq.getSizeId())? uploadDetailReq.getSizeId():detailJsonReq.getSizeId());
warehouseInventory.setLocationType("0");
addWareInvList.add(warehouseInventory);
}
......@@ -1105,17 +1124,17 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
List<Inventory> list1 = inventoryService.list(new LambdaQueryWrapper<Inventory>()
.eq(Inventory::getEpc, "0")
.eq(Inventory::getLocationId, detailJsonReq.getLocationId())
.eq(Inventory::getSizeId, detailJsonReq.getSizeId())
.eq(Inventory::getSizeId, ObjectUtil.isNull(detailJsonReq.getSizeId())? uploadDetailReq.getSizeId():detailJsonReq.getSizeId())
.eq(Inventory::getOrgId, orderMain.getStartOrgId())
.eq(Inventory::getTypeId, detailJsonReq.getTypeId())
.eq(Inventory::getTypeId, ObjectUtil.isNull(detailJsonReq.getTypeId())? uploadDetailReq.getTypeId():detailJsonReq.getTypeId())
.eq(Inventory::getPrice, detailJsonReq.getPrice())
.eq(Inventory::getLocationType, "0"));
List<WarehouseInventory> list2 = warehouseInventoryService.list(new LambdaQueryWrapper<WarehouseInventory>()
.eq(WarehouseInventory::getEpc, "0")
.eq(WarehouseInventory::getLocationId, detailJsonReq.getLocationId())
.eq(WarehouseInventory::getOrgId, orderMain.getStartOrgId())
.eq(WarehouseInventory::getSizeId, detailJsonReq.getSizeId())
.eq(WarehouseInventory::getTypeId, detailJsonReq.getTypeId()));
.eq(WarehouseInventory::getSizeId, ObjectUtil.isNull(detailJsonReq.getSizeId())? uploadDetailReq.getSizeId():detailJsonReq.getSizeId())
.eq(WarehouseInventory::getTypeId,ObjectUtil.isNull(detailJsonReq.getTypeId())? uploadDetailReq.getTypeId():detailJsonReq.getTypeId()));
if (list1.size()>0){
......@@ -1329,7 +1348,6 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
}
SysUser sysUser = sysUserService.getById(userId);
orderLog.setCreateUser(sysUser.getNickName());
orderLog.setCreateUser(req.getUserId());
orderLog.setCreateTime(DateTimeUtil.getCurrentDateTime());
orderLog.setProcessType("accounting");
//将记账记录保存
......@@ -1465,8 +1483,8 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
inventorySummary.setOutboundNumber(0);
inventorySummary.setUseNumber(0);
inventorySummary.setStockNumber(upReq.getModifyQuantity());
addList.add(inventorySummary);
}
addList.add(inventorySummary);
}
}
......
......@@ -58,6 +58,7 @@ import com.junmp.v2.sys.user.factory.SysUserCreateFactory;
import com.junmp.v2.sys.user.service.SysUserOrgService;
import com.junmp.v2.sys.user.service.SysUserRoleService;
import com.junmp.v2.sys.user.service.SysUserService;
import com.sun.jna.platform.win32.OaIdl;
import com.sun.org.apache.bcel.internal.generic.SWITCH;
import liquibase.pro.packaged.O;
import lombok.extern.slf4j.Slf4j;
......@@ -1237,6 +1238,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
public boolean UpdateFaceInfo(UpdatePolicemanReq req) {
Policeman police = PoliceExist(req.getId());
police.setFaceInfo(req.getFaceInfo());
police.setPhoto(req.getFaceInfo());
police.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return updateById(police);
......@@ -2070,9 +2072,298 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
return policemanMapper.alignUserInfo(orgId,date);
}
@Override
// @Override
// @Transactional(rollbackFor = Exception.class)
// public boolean oneClickAccountCreation(PubOrg pubOrg) throws IOException {
// //一次性创建一个组织机构下的三种系统账号(运维,仓管员,审核员)
// //先判断一下前端是否传递组织机构编号(如果传递,指定创建该组织机构下的三种账号)
// List<String> userAccountList=new ArrayList<>();
// userAccountList.add("yw");
// userAccountList.add("sh");
// userAccountList.add("gl");
// List<Long> userRoleList=new ArrayList<>();
// userRoleList.add(1663372027127402498L);
// userRoleList.add(1663372320355389441L);
// userRoleList.add(1528003832557232130L);
// List<SysUserRole> sysUserRoleList=new ArrayList<>() ;
// List<SysUserOrg> sysUserOrgList=new ArrayList<>() ;
// SysUser sysUser = new SysUser();
// boolean ywExists = false;
// boolean shExists = false;
// boolean glExists = false;
// if (ObjectUtil.isNull(pubOrg.getOrgCode()) || pubOrg.getOrgCode().trim().isEmpty()){
// //如果没有组织机构编号,需要判断全部组织机构下面是否已经存在对应的账号,如果存在则不创建账号,否则创建指定账号
// //将未被禁用的组织机构全部查询出来
//// List<PubOrg> orgList = pubOrgService.list(new LambdaQueryWrapper<PubOrg>().eq(PubOrg::getDelFlag, 1).eq(PubOrg::getStatusFlag, 1));
// List<PubOrg> orgList=searchAll(0, 3000);
//
// List<UserDto> userDtoYW = policemanMapper.oneClickAccountCreation(null,userAccountList.get(0)+"33%",userRoleList.get(0));
// List<UserDto> userDtosSH = policemanMapper.oneClickAccountCreation(null,userAccountList.get(1)+"33%",userRoleList.get(1));
// List<UserDto> userDtosGL = policemanMapper.oneClickAccountCreation(null,userAccountList.get(2)+"33%",userRoleList.get(2));
// List<CompletableFuture<Void>> futures = new ArrayList<>();
// List<CompletableFuture<Void>> futures1 = new ArrayList<>();
// List<CompletableFuture<Void>> futures2 = new ArrayList<>();
//
// for (PubOrg one: orgList) {
// CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
// Map<String, List<?>> map = addRoleAndOrgYW(userDtoYW, one, ywExists, sysUser,
// sysUserOrgList, userRoleList, userAccountList, sysUserRoleList);
// List<SysUserOrg> userlist1 = (List<SysUserOrg>) map.get("sysUserOrgList");
// sysUserOrgList.addAll(userlist1);
// List<SysUserRole> roleList1 = (List<SysUserRole>) map.get("sysUserRoleList");
// sysUserRoleList.addAll(roleList1);
// });
//
// futures.add(future);
// }
// CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
//
//
// for (PubOrg one: orgList) {
// CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
// Map<String, List<?>> map = addRoleAndOrgSH(userDtosSH, one, shExists, sysUser,
// sysUserOrgList, userRoleList, userAccountList, sysUserRoleList);
// List<SysUserOrg> userlist1 = (List<SysUserOrg>) map.get("sysUserOrgList");
// sysUserOrgList.addAll(userlist1);
// List<SysUserRole> roleList1 = (List<SysUserRole>) map.get("sysUserRoleList");
// sysUserRoleList.addAll(roleList1);
// });
//
// futures1.add(future);
// }
// CompletableFuture.allOf(futures1.toArray(new CompletableFuture[0])).join();
//
//
// for (PubOrg one: orgList) {
// CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
// Map<String, List<?>> map = addRoleAndOrgGL(userDtosGL, one, glExists, sysUser,
// sysUserOrgList, userRoleList, userAccountList, sysUserRoleList);
// List<SysUserOrg> userlist1 = (List<SysUserOrg>) map.get("sysUserOrgList");
// sysUserOrgList.addAll(userlist1);
// List<SysUserRole> roleList1 = (List<SysUserRole>) map.get("sysUserRoleList");
// sysUserRoleList.addAll(roleList1);
// });
//
// futures2.add(future);
// }
//
// // 等待所有异步任务完成
// CompletableFuture.allOf(futures2.toArray(new CompletableFuture[0])).join();
//
//
// }else {
// //如果有组织机构编号,则判断该组织机构下面是否已经存在账号,如果存在,则不进行创建,否则进行创建
// PubOrg one = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>()
// .eq(PubOrg::getOrgCode, pubOrg.getOrgCode()));
// if (ObjectUtil.isNull(one)){
// throw new ServiceException(OrgExceptionEnum.ORG_NOT_EXIST);
// }
// List<UserDto> userDtos = policemanMapper.oneClickAccountCreation(one.getOrgId(),null,null);
//
// if (CollectionUtil.isEmpty(userDtos)){
// for (int i = 0; i < userAccountList.size(); i++) {
// sysUser.setUserId(null);
// //创建用户信息
// Long userId = addUser(sysUser, userAccountList.get(i), one);
// //创建关联表数据
// SysUserOrg sysUserOrg = new SysUserOrg();
// sysUserOrg.setOrgId(one.getOrgId());
// sysUserOrg.setUserId(userId);
// sysUserOrgList.add(sysUserOrg);
// //创建角色表数据
// SysUserRole sysUserRole = new SysUserRole();
// sysUserRole.setRoleId(userRoleList.get(i));
// sysUserRole.setUserId(userId);
// sysUserRole.setCreateTime(DateTimeUtil.getCurrentDateTime());
// sysUserRoleList.add(sysUserRole);
// }
//
// }else {
// Map<String, List<?>> mapYw = addRoleAndOrgYW(userDtos, one, ywExists, sysUser,
// sysUserOrgList, userRoleList, userAccountList, sysUserRoleList);
// List<SysUserOrg> userlist1=(List<SysUserOrg>)mapYw.get("sysUserOrgList");
// sysUserOrgList.addAll(userlist1);
// List<SysUserRole> roleList1 =(List<SysUserRole>) mapYw.get("sysUserRoleList");
// sysUserRoleList.addAll(roleList1);
//
// Map<String, List<?>> mapSh = addRoleAndOrgSH(userDtos, one, shExists, sysUser,
// sysUserOrgList, userRoleList, userAccountList, sysUserRoleList);
// List<SysUserOrg> userlist2=(List<SysUserOrg>)mapSh.get("sysUserOrgList");
// sysUserOrgList.addAll(userlist2);
// List<SysUserRole> roleList2 =(List<SysUserRole>) mapSh.get("sysUserRoleList");
// sysUserRoleList.addAll(roleList2);
//
// Map<String, List<?>> mapGl = addRoleAndOrgGL(userDtos, one, glExists, sysUser,
// sysUserOrgList, userRoleList, userAccountList, sysUserRoleList);
// List<SysUserOrg> userlist3=(List<SysUserOrg>)mapGl.get("sysUserOrgList");
// sysUserOrgList.addAll(userlist3);
// List<SysUserRole> roleList3 =(List<SysUserRole>) mapGl.get("sysUserRoleList");
// sysUserRoleList.addAll(roleList3);
//
// }
//
// sysUserOrgService.saveBatch(sysUserOrgList);
// sysUserRoleService.saveBatch(sysUserRoleList);
//
// }
//
// return true;
// }
// private Map<String,List<?>> addRoleAndOrgYW(List<UserDto> userDtos,PubOrg one,Boolean ywExists,SysUser sysUser,
// List<SysUserOrg> sysUserOrgList,List<Long> userRoleList,
// List<String> userAccountList,List<SysUserRole> sysUserRoleList){
// Map<String,List<?>> map=new HashMap<>();
// for (UserDto user:userDtos) {
// if (user.getAccount().equals("yw"+one.getOrgCode())){
// ywExists=true;
// break;
// }
// }
// if (!ywExists){
// sysUser.setUserId(null);
// Long userId = addUser(sysUser, userAccountList.get(0), one);
// //创建关联表数据
// SysUserOrg sysUserOrg = new SysUserOrg();
// sysUserOrg.setOrgId(one.getOrgId());
// sysUserOrg.setUserId(userId);
// sysUserOrgList.add(sysUserOrg);
// //创建角色表数据
// SysUserRole sysUserRole = new SysUserRole();
// sysUserRole.setRoleId(userRoleList.get(0));
// sysUserRole.setUserId(userId);
// sysUserRole.setCreateTime(DateTimeUtil.getCurrentDateTime());
// sysUserRoleList.add(sysUserRole);
// }
// map.put("sysUserRoleList",sysUserRoleList);
// map.put("sysUserOrgList",sysUserOrgList);
// return map;
// }
//
// private Map<String,List<?>> addRoleAndOrgSH(List<UserDto> userDtos,PubOrg one,Boolean shExists,SysUser sysUser,
// List<SysUserOrg> sysUserOrgList,List<Long> userRoleList,
// List<String> userAccountList,List<SysUserRole> sysUserRoleList){
// Map<String,List<?>> map=new HashMap<>();
// for (UserDto user:userDtos) {
// if (user.getAccount().equals("sh"+one.getOrgCode())){
// shExists=true;
// break;
// }
// }
// if (!shExists){
// sysUser.setUserId(null);
// Long userId = addUser(sysUser, userAccountList.get(1), one);
// //创建关联表数据
// SysUserOrg sysUserOrg = new SysUserOrg();
// sysUserOrg.setOrgId(one.getOrgId());
// sysUserOrg.setUserId(userId);
// sysUserOrgList.add(sysUserOrg);
// //创建角色表数据
// SysUserRole sysUserRole = new SysUserRole();
// sysUserRole.setRoleId(userRoleList.get(1));
// sysUserRole.setUserId(userId);
// sysUserRole.setCreateTime(DateTimeUtil.getCurrentDateTime());
// sysUserRoleList.add(sysUserRole);
// }
// map.put("sysUserRoleList",sysUserRoleList);
// map.put("sysUserOrgList",sysUserOrgList);
// return map;
// }
//
// private Map<String,List<?>> addRoleAndOrgGL(List<UserDto> userDtos,PubOrg one,Boolean glExists,SysUser sysUser,
// List<SysUserOrg> sysUserOrgList,List<Long> userRoleList,
// List<String> userAccountList,List<SysUserRole> sysUserRoleList){
// Map<String,List<?>> map=new HashMap<>();
// for (UserDto user:userDtos) {
// if (user.getAccount().equals("gl"+one.getOrgCode())){
// glExists = true;
// break;
// }
//
// }
// if (!glExists){
// sysUser.setUserId(null);
// Long userId = addUser(sysUser, userAccountList.get(2), one);
// SysUserOrg sysUserOrg = new SysUserOrg();
// sysUserOrg.setOrgId(one.getOrgId());
// sysUserOrg.setUserId(userId);
// sysUserOrgList.add(sysUserOrg);
// //创建角色表数据
// SysUserRole sysUserRole = new SysUserRole();
// sysUserRole.setRoleId(userRoleList.get(2));
// sysUserRole.setUserId(userId);
// sysUserRole.setCreateTime(DateTimeUtil.getCurrentDateTime());
// sysUserRoleList.add(sysUserRole);
// }
// map.put("sysUserRoleList",sysUserRoleList);
// map.put("sysUserOrgList",sysUserOrgList);
// return map;
// }
private Long addUser(SysUser sysUser,String i,PubOrg pubOrg){
if (i.equals("yw")) {
sysUser.setNickName(pubOrg.getDName()+"运维人员");
sysUser.setRealName(pubOrg.getDName()+"运维人员");
}
if (i.equals("sh")) {
sysUser.setNickName(pubOrg.getDName()+"审核员");
sysUser.setRealName(pubOrg.getDName()+"审核员");
}
if (i.equals("gl")) {
sysUser.setNickName(pubOrg.getDName()+"仓管员");
sysUser.setRealName(pubOrg.getDName()+"仓管员");
}
sysUser.setAccount(i+pubOrg.getOrgCode());
SysUserCreateFactory.fillAddSysUser(sysUser);
sysUser.setAvatar(FileConstant.DEFAULT_AVATAR_FILE_ID);
sysUser.setDelFlag(LogicDelEnum.N.getCode());
sysUser.setCreateTime(DateTime.now());
sysUser.setUpdateTime(DateTime.now());
sysUserService.save(sysUser);
return sysUser.getUserId();
}
public List<PubOrg> searchAll(Integer pageNum, Integer pageSize ) throws IOException {
if (pageNum < 0) pageNum = 0;
SearchRequest request = new SearchRequest("org_pinyin");
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.from(pageNum);
builder.size(pageSize);
// 添加过滤条件,只获取 delFlag 为 1 的数据
builder.postFilter(QueryBuilders.termQuery("delFlag", 1));
builder.timeout(new TimeValue(60, TimeUnit.SECONDS));
request.source(builder);
SearchResponse searchResponse = client.search(request, RequestOptions.DEFAULT);
List<PubOrg> pubOrgList = new ArrayList<>();
for (SearchHit documentFields : searchResponse.getHits().getHits()) {
Map<String, Object> sourceAsMap = documentFields.getSourceAsMap();
PubOrg pubOrg = this.fromMap(sourceAsMap);
// 添加到结果列表
pubOrgList.add(pubOrg);
}
return pubOrgList;
}
public static PubOrg fromMap(Map<String, Object> map) {
PubOrg pubOrg = new PubOrg();
BeanPlusUtil.copyProperties(map, pubOrg);
// pubOrg.setOrgName((String) map.get("orgName"));
// 可以设置其他字段...
return pubOrg;
}
// @Override
@Transactional(rollbackFor = Exception.class)
public boolean oneClickAccountCreation(PubOrg pubOrg) throws IOException {
public boolean oneClickAccountCreation1(PubOrg pubOrg) throws IOException {
//一次性创建一个组织机构下的三种系统账号(运维,仓管员,审核员)
//先判断一下前端是否传递组织机构编号(如果传递,指定创建该组织机构下的三种账号)
List<String> userAccountList=new ArrayList<>();
......@@ -2085,6 +2376,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
userRoleList.add(1528003832557232130L);
List<SysUserRole> sysUserRoleList=new ArrayList<>() ;
List<SysUserOrg> sysUserOrgList=new ArrayList<>() ;
List<SysUser> sysUserList=new ArrayList<>();
SysUser sysUser = new SysUser();
boolean ywExists = false;
boolean shExists = false;
......@@ -2095,60 +2387,16 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
// List<PubOrg> orgList = pubOrgService.list(new LambdaQueryWrapper<PubOrg>().eq(PubOrg::getDelFlag, 1).eq(PubOrg::getStatusFlag, 1));
List<PubOrg> orgList=searchAll(0, 3000);
List<UserDto> userDtoYW = policemanMapper.oneClickAccountCreation(null,userAccountList.get(0)+"33%",userRoleList.get(0));
List<UserDto> userDtosSH = policemanMapper.oneClickAccountCreation(null,userAccountList.get(1)+"33%",userRoleList.get(1));
List<UserDto> userDtosGL = policemanMapper.oneClickAccountCreation(null,userAccountList.get(2)+"33%",userRoleList.get(2));
List<CompletableFuture<Void>> futures = new ArrayList<>();
List<CompletableFuture<Void>> futures1 = new ArrayList<>();
List<CompletableFuture<Void>> futures2 = new ArrayList<>();
for (PubOrg one: orgList) {
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
Map<String, List<?>> map = addRoleAndOrgYW(userDtoYW, one, ywExists, sysUser,
sysUserOrgList, userRoleList, userAccountList, sysUserRoleList);
List<SysUserOrg> userlist1 = (List<SysUserOrg>) map.get("sysUserOrgList");
sysUserOrgList.addAll(userlist1);
List<SysUserRole> roleList1 = (List<SysUserRole>) map.get("sysUserRoleList");
sysUserRoleList.addAll(roleList1);
});
futures.add(future);
}
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
for (PubOrg one: orgList) {
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
Map<String, List<?>> map = addRoleAndOrgSH(userDtosSH, one, shExists, sysUser,
sysUserOrgList, userRoleList, userAccountList, sysUserRoleList);
List<SysUserOrg> userlist1 = (List<SysUserOrg>) map.get("sysUserOrgList");
sysUserOrgList.addAll(userlist1);
List<SysUserRole> roleList1 = (List<SysUserRole>) map.get("sysUserRoleList");
sysUserRoleList.addAll(roleList1);
});
futures1.add(future);
}
CompletableFuture.allOf(futures1.toArray(new CompletableFuture[0])).join();
for (PubOrg one: orgList) {
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
Map<String, List<?>> map = addRoleAndOrgGL(userDtosGL, one, glExists, sysUser,
sysUserOrgList, userRoleList, userAccountList, sysUserRoleList);
List<SysUserOrg> userlist1 = (List<SysUserOrg>) map.get("sysUserOrgList");
sysUserOrgList.addAll(userlist1);
List<SysUserRole> roleList1 = (List<SysUserRole>) map.get("sysUserRoleList");
sysUserRoleList.addAll(roleList1);
});
futures2.add(future);
List<UserDto> userDto = policemanMapper.oneClickAccountCreation1(null);
for (PubOrg one:orgList) {
Map<String, List<?>> map = addRoleAndOrg(userDto, one, ywExists, shExists,glExists,sysUser,
sysUserOrgList, userRoleList, userAccountList, sysUserRoleList);
List<SysUserOrg> userlist=(List<SysUserOrg>)map.get("sysUserOrgList");
sysUserOrgList.addAll(userlist);
List<SysUserRole> roleList =(List<SysUserRole>) map.get("sysUserRoleList");
sysUserRoleList.addAll(roleList);
}
// 等待所有异步任务完成
CompletableFuture.allOf(futures2.toArray(new CompletableFuture[0])).join();
}else {
//如果有组织机构编号,则判断该组织机构下面是否已经存在账号,如果存在,则不进行创建,否则进行创建
PubOrg one = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>()
......@@ -2177,26 +2425,13 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
}
}else {
Map<String, List<?>> mapYw = addRoleAndOrgYW(userDtos, one, ywExists, sysUser,
sysUserOrgList, userRoleList, userAccountList, sysUserRoleList);
List<SysUserOrg> userlist1=(List<SysUserOrg>)mapYw.get("sysUserOrgList");
sysUserOrgList.addAll(userlist1);
List<SysUserRole> roleList1 =(List<SysUserRole>) mapYw.get("sysUserRoleList");
sysUserRoleList.addAll(roleList1);
Map<String, List<?>> mapSh = addRoleAndOrgSH(userDtos, one, shExists, sysUser,
Map<String, List<?>> map = addRoleAndOrg(userDtos, one, ywExists,shExists,glExists, sysUser,
sysUserOrgList, userRoleList, userAccountList, sysUserRoleList);
List<SysUserOrg> userlist2=(List<SysUserOrg>)mapSh.get("sysUserOrgList");
sysUserOrgList.addAll(userlist2);
List<SysUserRole> roleList2 =(List<SysUserRole>) mapSh.get("sysUserRoleList");
sysUserRoleList.addAll(roleList2);
List<SysUserOrg> userlist=(List<SysUserOrg>)map.get("sysUserOrgList");
sysUserOrgList.addAll(userlist);
List<SysUserRole> roleList =(List<SysUserRole>) map.get("sysUserRoleList");
sysUserRoleList.addAll(roleList);
Map<String, List<?>> mapGl = addRoleAndOrgGL(userDtos, one, glExists, sysUser,
sysUserOrgList, userRoleList, userAccountList, sysUserRoleList);
List<SysUserOrg> userlist3=(List<SysUserOrg>)mapGl.get("sysUserOrgList");
sysUserOrgList.addAll(userlist3);
List<SysUserRole> roleList3 =(List<SysUserRole>) mapGl.get("sysUserRoleList");
sysUserRoleList.addAll(roleList3);
}
......@@ -2207,16 +2442,29 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
return true;
}
private Map<String,List<?>> addRoleAndOrgYW(List<UserDto> userDtos,PubOrg one,Boolean ywExists,SysUser sysUser,
List<SysUserOrg> sysUserOrgList,List<Long> userRoleList,
List<String> userAccountList,List<SysUserRole> sysUserRoleList){
private Map<String,List<?>> addRoleAndOrg(List<UserDto> userDtos,PubOrg one,Boolean ywExists,Boolean shExists,Boolean glExists,SysUser sysUser,
List<SysUserOrg> sysUserOrgList,List<Long> userRoleList,
List<String> userAccountList,List<SysUserRole> sysUserRoleList){
Map<String,List<?>> map=new HashMap<>();
for (UserDto user:userDtos) {
if (user.getAccount().equals("yw"+one.getOrgCode())){
ywExists=true;
break;
continue;
}
if (user.getAccount().equals("sh"+one.getOrgCode())){
shExists=true;
continue;
}
if (user.getAccount().equals("gl"+one.getOrgCode())){
glExists = true;
if (ywExists && shExists ){
break;
}
}
}
if (!ywExists){
sysUser.setUserId(null);
Long userId = addUser(sysUser, userAccountList.get(0), one);
......@@ -2232,24 +2480,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
sysUserRole.setCreateTime(DateTimeUtil.getCurrentDateTime());
sysUserRoleList.add(sysUserRole);
}
map.put("sysUserRoleList",sysUserRoleList);
map.put("sysUserOrgList",sysUserOrgList);
return map;
}
private Map<String,List<?>> addRoleAndOrgSH(List<UserDto> userDtos,PubOrg one,Boolean shExists,SysUser sysUser,
List<SysUserOrg> sysUserOrgList,List<Long> userRoleList,
List<String> userAccountList,List<SysUserRole> sysUserRoleList){
Map<String,List<?>> map=new HashMap<>();
for (UserDto user:userDtos) {
if (user.getAccount().equals("sh"+one.getOrgCode())){
shExists=true;
break;
}
}
if (!shExists){
sysUser.setUserId(null);
Long userId = addUser(sysUser, userAccountList.get(1) , one);
Long userId = addUser(sysUser, userAccountList.get(1), one);
//创建关联表数据
SysUserOrg sysUserOrg = new SysUserOrg();
sysUserOrg.setOrgId(one.getOrgId());
......@@ -2262,26 +2495,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
sysUserRole.setCreateTime(DateTimeUtil.getCurrentDateTime());
sysUserRoleList.add(sysUserRole);
}
map.put("sysUserRoleList",sysUserRoleList);
map.put("sysUserOrgList",sysUserOrgList);
return map;
}
private Map<String,List<?>> addRoleAndOrgGL(List<UserDto> userDtos,PubOrg one,Boolean glExists,SysUser sysUser,
List<SysUserOrg> sysUserOrgList,List<Long> userRoleList,
List<String> userAccountList,List<SysUserRole> sysUserRoleList){
Map<String,List<?>> map=new HashMap<>();
for (UserDto user:userDtos) {
if (user.getAccount().equals("gl"+one.getOrgCode())){
glExists = true;
break;
}
}
if (!glExists){
sysUser.setUserId(null);
Long userId = addUser(sysUser, userAccountList.get(2), one);
//创建关联表数据
SysUserOrg sysUserOrg = new SysUserOrg();
sysUserOrg.setOrgId(one.getOrgId());
sysUserOrg.setUserId(userId);
......@@ -2298,64 +2515,4 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
return map;
}
private Long addUser(SysUser sysUser,String i,PubOrg pubOrg){
if (i.equals("yw")) {
sysUser.setNickName(pubOrg.getDName()+"运维人员");
sysUser.setRealName(pubOrg.getDName()+"运维人员");
}
if (i.equals("sh")) {
sysUser.setNickName(pubOrg.getDName()+"审核员");
sysUser.setRealName(pubOrg.getDName()+"审核员");
}
if (i.equals("gl")) {
sysUser.setNickName(pubOrg.getDName()+"仓管员");
sysUser.setRealName(pubOrg.getDName()+"仓管员");
}
sysUser.setAccount(i+pubOrg.getOrgCode());
SysUserCreateFactory.fillAddSysUser(sysUser);
sysUser.setAvatar(FileConstant.DEFAULT_AVATAR_FILE_ID);
sysUser.setDelFlag(LogicDelEnum.N.getCode());
sysUser.setCreateTime(DateTime.now());
sysUser.setUpdateTime(DateTime.now());
sysUserService.save(sysUser);
return sysUser.getUserId();
}
public List<PubOrg> searchAll(Integer pageNum, Integer pageSize ) throws IOException {
if (pageNum < 0) pageNum = 0;
SearchRequest request = new SearchRequest("org_pinyin");
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.from(pageNum);
builder.size(pageSize);
// 添加过滤条件,只获取 delFlag 为 1 的数据
builder.postFilter(QueryBuilders.termQuery("delFlag", 1));
builder.timeout(new TimeValue(60, TimeUnit.SECONDS));
request.source(builder);
SearchResponse searchResponse = client.search(request, RequestOptions.DEFAULT);
List<PubOrg> pubOrgList = new ArrayList<>();
for (SearchHit documentFields : searchResponse.getHits().getHits()) {
Map<String, Object> sourceAsMap = documentFields.getSourceAsMap();
PubOrg pubOrg = this.fromMap(sourceAsMap);
// 添加到结果列表
pubOrgList.add(pubOrg);
}
return pubOrgList;
}
public static PubOrg fromMap(Map<String, Object> map) {
PubOrg pubOrg = new PubOrg();
BeanPlusUtil.copyProperties(map, pubOrg);
// pubOrg.setOrgName((String) map.get("orgName"));
// 可以设置其他字段...
return pubOrg;
}
}
......@@ -5,11 +5,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.dto.FetchingDataDto.WarehouseDevInfoDto;
import com.junmp.jyzb.api.bean.dto.MQDto;
import com.junmp.jyzb.api.bean.req.UpdateWarehouseDevReq;
import com.junmp.jyzb.api.exception.enums.CabinetExceptionEnum;
import com.junmp.jyzb.entity.WarehouseDev;
import com.junmp.jyzb.service.WarehouseDevService;
import com.junmp.jyzb.mapper.WarehouseDevMapper;
import com.junmp.jyzb.utils.DateTimeUtil;
import com.junmp.jyzb.utils.RabbitMQSendMsg;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -86,6 +88,14 @@ public class WarehouseDevServiceImpl extends ServiceImpl<WarehouseDevMapper, War
return warehouseDevMapper.alignWarehouseDevInfo(req.getOrgId(),date);
}
@Override
public boolean delWarehouseDev(UpdateWarehouseDevReq req) {
if (ObjectUtil.isNull(req.getId())){
throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR);
}
return warehouseDevService.removeById(req.getId());
}
}
......
package com.junmp.jyzb.task;
import com.junmp.jyzb.mapper.EquipmentCountSummaryMapper;
import com.junmp.jyzb.service.InventorySummaryService;
import com.junmp.v2.job.api.JobAction;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Slf4j
@Component
public class EquipmentCountAction implements JobAction {
private InventorySummaryService inventorySummaryService;
@Override
public void action() {
inventorySummaryService.updateCount();
}
}
package com.junmp.jyzb.task;
import com.junmp.jyzb.service.InventorySummaryService;
import com.junmp.v2.job.api.JobAction;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Slf4j
@Component
public class MonthEnd implements JobAction{
@Resource
public InventorySummaryService inventorySummaryService;
//月末执行以计算金额
@Override
public void action() {
// inventorySummaryService.MonthEndSum();
}
}
package com.junmp.jyzb.task;
import com.junmp.jyzb.service.InventorySummaryService;
import com.junmp.v2.job.api.JobAction;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Slf4j
@Component
public class MonthStart implements JobAction{
@Resource
public InventorySummaryService inventorySummaryService;
//月初执行
@Override
public void action() {
// inventorySummaryService.MonthStartSum();
}
}
package com.junmp.jyzb.task;
import com.junmp.jyzb.service.InventoryService;
import com.junmp.v2.job.api.JobAction;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
public class UpdateSummaryAction implements JobAction {
@Resource
private InventoryService inventoryService;
public void action(){
// inventoryService.setInventoryMsg();
}
}
......@@ -215,9 +215,7 @@
GROUP BY type_id,size_id,bi.org_id_int,location_id,bi.price) as t
GROUP BY t.locationId,t.type_id,t.size_id,t.orgId,t.unitPrice
</insert>
<insert id="reSetInventory">
{CALL InsertInventorySummary(#{summaryTableName,mode=IN},#{sourceTableName,mode=IN},#{warrantyThreshold,mode=IN},#{sql,mode=IN})}
</insert>
<select id="getSumByShelf" resultType="com.junmp.jyzb.entity.InventorySummary"
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.PolicemanMapper">
<insert id="insertSysUser" useGeneratedKeys="true" keyProperty="user_id" parameterType="java.util.List">
insert into sys_user(
nick_name,real_name,account,password,avatar,del_flag,creatie_time,update_time
)
<foreach collection="userList" item="item" separator=",">
(
#{item.nickName}, #{item.realName}, #{item.account}, #{item.password}, #{item.avatar},
#{item.delFlag}, #{item.createTime}, #{item.updateTime}
)
</foreach>
</insert>
<!--<resultMap id="PolicemanMap" type="Map">-->
......@@ -382,6 +393,19 @@ WHERE o.org_id IN
</if>
order by uo.org_id
</select>
<select id="oneClickAccountCreation1" resultType="com.junmp.jyzb.api.bean.dto.FetchingDataDto.UserDto">
select t.*,uo.org_id FROM (
SELECT u.* FROM `sys_user` u
where u.account like "gl33%" or u.account like "yw33%" or u.account like "sh33%"
) as t
join sys_user_org uo on t.user_id=uo.user_id
<if test="orgId != null and orgId != ''">
and uo.org_id=#{orgId}
</if>
join sys_user_role ur on t.user_id=ur.user_id
join sys_role r on ur.role_id=r.role_id and r.role_id in ("1528003832557232130","1663372320355389441","1663372027127402498")
order by uo.org_id
</select>
</mapper>
\ No newline at end of file
......@@ -27,47 +27,10 @@
<!-- WHERE add_price IS NULL OR add_num IS NULL;-->
<!-- </update>-->
<select id="MonthStart" statementType="CALLABLE" >
{call UpdateStartSummary()}
</select>
<select id="MonthEnd" statementType="CALLABLE" >
{call UpdateEndSummary()}
</select>
<select id="MonthDifference" statementType="CALLABLE" >
{call UpdatePriceSummary()}
</select>
<select id="TjOrgPrice" resultType="com.junmp.jyzb.api.bean.dto.TjDto.TjOrgPriceDto">
<!-- select t1.org_id,t1.org_code,t1.org_name,t1.d_name,-->
<!-- t2.start_num,t2.start_price,t2.end_num,t2.end_price,t2.add_num,t2.add_price,t2.destory_num,t2.destory_price-->
<!-- FROM(-->
<!-- SELECT-->
<!-- `org_id`, `org_code`, `org_name`, `d_name`-->
<!-- FROM `pub_org`-->
<!-- WHERE org_id=#{orgId}-->
<!-- ) as t1-->
<!-- CROSS JOIN (select sum(COALESCE(vpss.start_num,0)) as start_num,sum(COALESCE(vpss.start_price,0)) as start_price,-->
<!-- sum(COALESCE(vpss.end_num,0)) as end_num,sum(COALESCE(vpss.end_price,0)) as end_price,-->
<!-- sum(COALESCE(vpss.add_num,0)) as add_num,sum(COALESCE(vpss.destory_num,0)) as destory_num,-->
<!-- sum(COALESCE(vpss.add_price,0)) as add_price,sum(COALESCE(vpss.destory_price,0)) as destory_price-->
<!-- FROM vie_price_sum_summary vpss-->
<!-- left join pub_org po on vpss.org_id_int=po.org_id-->
<!-- where vpss.`year`= #{year} and po.del_flag=1 and (po.org_id=#{orgId} or po.org_parent_ids like CONCAT('%', #{orgId}, '%'))-->
<!-- <if test="typeIdsList!=null and typeIdsList.size() > 0">-->
<!-- and type_id in-->
<!-- <foreach collection="typeIdsList" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="sizeNameList!=null and sizeNameList.size() > 0">-->
<!-- AND-->
<!-- <foreach collection="sizeNameList " item="item" open="(" separator="or" close=")">-->
<!-- size_name like CONCAT('%', #{item}, '%')-->
<!-- </foreach>-->
<!-- </if>-->
<!-- ) as t2-->
<select id="TjOrgPrice" resultType="com.junmp.jyzb.api.bean.dto.TjDto.TjOrgPriceDto">
SELECT
t3.org_id,t3.org_code,t3.org_name,t3.d_name,coalesce(t4.start_num,0) as start_num,
......
package com.junmp.police.test;
import org.apache.tomcat.util.digester.DocumentProperties;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
public class Base64Test {
public static void main(String args[]){
// String str = "abc";
// byte[] val = str.getBytes(StandardCharsets.UTF_8);
// String base64EncodedChunk = Base64.getEncoder().encodeToString(val);
// System.out.println(base64EncodedChunk);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论