1.调整代码,移除部分手写单表操作,更换为mybatis plus自带的方法

2.规范部分实体类ID字段类型
3.添加刷新单据库存相关数据的测试接口
master
x_z 3 years ago
parent bcc101718e
commit 5ec1c1be42

@ -0,0 +1,90 @@
package com.glxp.udi.admin.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.udi.admin.dao.inout.UdiInfoDao;
import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.mongo.service.*;
import com.glxp.udi.admin.req.inout.FilterErpOrderRequest;
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
import com.glxp.udi.admin.req.inventory.FilterInvProductRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@Slf4j
@RestController
public class TestController {
@Resource
private OrderMdService orderMdService;
@Resource
private OrderDetailMdService orderDetailMdService;
@Resource
private InvProductMdService invProductMdService;
@Resource
private InvProductDetailMdService invProductDetailMdService;
@Resource
private UdiInfoDao udiInfoDao;
@GetMapping("/test/refreshOrderData")
private String refreshOrderData() {
try {
//刷新订单详情表的数据
List<ErpOrderEntity> erpOrderEntities = orderDetailMdService.filterOrderDetails(new FilterErpOrderRequest());
/*erpOrderEntities.forEach(orderDetail -> {
String orderId = orderDetail.getOrderIdFk();
if (StrUtil.isNotBlank(orderId)) {
OrderMdEntity order = orderMdService.findByOne(orderId);
if (null != order) {
UdiInfoEntity udiInfoEntity = udiInfoDao.selectOne(new QueryWrapper<UdiInfoEntity>().eq(StrUtil.isNotBlank(orderDetail.getUuidFk()), "uuid", orderDetail.getUuidFk())
.eq(null != order.getCustomerId(), "customerId", order.getCustomerId())
.eq(StrUtil.isNotBlank(orderDetail.getPackSpec()), "ggxh", orderDetail.getPackSpec())
);
if (udiInfoEntity != null) {
orderDetail.setRelId(String.valueOf(udiInfoEntity.getId()));
log.info("刷新单据详情");
orderDetailMdService.updateOrderDetail(orderDetail);
}
}
}
});*/
//刷新库存表的数据
List<InvProductEntity> invProductEntities = invProductMdService.filterInvProductList(new FilterInvProductRequest());
invProductEntities.forEach(invProductEntity -> {
UdiInfoEntity udiInfoEntity = udiInfoDao.selectOne(new QueryWrapper<UdiInfoEntity>().eq(StrUtil.isNotBlank(invProductEntity.getRelIdFk()), "uuid", invProductEntity.getRelIdFk())
.eq(StrUtil.isNotBlank(invProductEntity.getCustomerId()), "customerId", invProductEntity.getCustomerId())
.eq(StrUtil.isNotBlank(invProductEntity.getGgxh()), "ggxh", invProductEntity.getGgxh())
);
if (null != udiInfoEntity) {
invProductEntity.setRelIdFk(String.valueOf(udiInfoEntity.getId()));
log.info("刷新库存");
invProductMdService.updateInvProduct(invProductEntity);
}
});
//刷新库存详情表数据
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(new FilterInvProductDetailRequest());
invProductDetailEntities.forEach(invProductDetailEntity -> {
UdiInfoEntity udiInfoEntity = udiInfoDao.selectOne(new QueryWrapper<UdiInfoEntity>().eq(StrUtil.isNotBlank(invProductDetailEntity.getProductIdFk()), "uuid", invProductDetailEntity.getProductIdFk())
.eq(StrUtil.isNotBlank(invProductDetailEntity.getCustomerId()), "customerId", invProductDetailEntity.getCustomerId())
);
if (null != udiInfoEntity) {
invProductDetailEntity.setProductIdFk(String.valueOf(udiInfoEntity.getId()));
log.info("刷新库存详情");
invProductDetailMdService.updateInvProduct(invProductDetailEntity);
}
});
return "success";
} catch (Exception e) {
e.printStackTrace();
}
return "error";
}
}

@ -231,10 +231,7 @@ public class InvWarehouseController {
return ResultVOUtils.error(500, "请先移除该仓库关联用户和单据类型!");
}
boolean b = invWarehouseService.deleteById(deleteRequest.getId());
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
invWarehouseService.deleteById(deleteRequest.getId());
return ResultVOUtils.success();
}

@ -160,11 +160,7 @@ public class SystemPDFModuleController {
@AuthRuleAnnotation("system/pdf/module/delete")
@GetMapping("/system/pdf/module/delete")
public BaseResponse deleteById(@RequestParam("id") Integer id) {
boolean b = systemPDFModuleService.deleteById(id);
if (b) {
return ResultVOUtils.success("删除成功");
} else {
return ResultVOUtils.error(500, "删除失败");
}
systemPDFModuleService.deleteById(id);
return ResultVOUtils.success("删除成功");
}
}

@ -12,14 +12,6 @@ import java.util.List;
public interface AuthAdminDao extends BaseMapper<AuthAdmin> {
/**
* id
*
* @param id id
* @return
*/
AuthAdmin findById(Long id);
/**
* id password
*
@ -57,14 +49,6 @@ public interface AuthAdminDao extends BaseMapper<AuthAdmin> {
*/
boolean updateAuthAdmin(AuthAdmin authAdmin);
/**
*
*
* @param id
* @return
*/
boolean deleteById(Long id);
boolean deleteByCustomerId(Long customerId);
/**

@ -24,10 +24,6 @@ public interface InvWarehouseDao extends BaseMapper<InvWarehouseEntity> {
boolean updateInvWarehouse(InvWarehouseEntity InvWarehouseEntity);
InvWarehouseEntity selectById(@Param("id") String id);
boolean deleteById(@Param("id") String id);
String getNameByCode(@Param("fromCorpId") String fromCorpId);
/**

@ -12,7 +12,7 @@ public interface StockPrintTempDao extends BaseMapper<StockPrintTempEntity> {
Page<StockPrintTempEntity> filterStockPrintTempEntity(Page<StockPrintTempEntity> page, FilterStPrintTempRequest filterStockprintRequest);
boolean deleteById(DeleteStPrintTempRequest deleteStPrintTempRequest);
boolean delete(DeleteStPrintTempRequest deleteStPrintTempRequest);
boolean insertStockPrintTempEntity(StockPrintTempEntity stockPrintEntity);

@ -20,5 +20,4 @@ public interface SystemExcelTemplateDao extends BaseMapper<SystemExcelTemplateEn
boolean insertSystemExcelTemplate(SystemExcelTemplateEntity companyCertEntity);
boolean deleteById(String id);
}

@ -20,5 +20,4 @@ public interface SystemPDFModuleDao extends BaseMapper<SystemPDFModuleEntity> {
boolean insertData(SystemPDFModuleEntity systemPDFModuleEntity);
boolean deleteById(Integer id);
}

@ -18,8 +18,6 @@ public interface SystemPDFTemplateDao extends BaseMapper<SystemPDFTemplateEntity
boolean insertData(SystemPDFTemplateEntity systemPDFTemplateEntity);
boolean deleteById(Integer id);
/**
*
*

@ -13,7 +13,6 @@ import java.util.List;
@Mapper
public interface SystemPDFTemplateRelevanceDao extends BaseMapper<SystemPDFTemplateRelevanceEntity> {
/**
* customerId
*
@ -49,13 +48,6 @@ public interface SystemPDFTemplateRelevanceDao extends BaseMapper<SystemPDFTempl
boolean insertData(SystemPDFTemplateRelevanceEntity systemPDFTemplateRelevanceEntity);
/**
* customerId
*
* @return
*/
boolean deleteById(Integer id);
boolean udpateRl(SystemPDFTemplateRelevanceEntity systemPDFTemplateRelevanceEntity);
IPage<SystemPDFTemplateRelevanceResponse> filterList(IPage<SystemPDFTemplateRelevanceResponse> page, Integer moduleId, String localAction, String customerId);

@ -9,9 +9,6 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface SystemParamConfigCustomerDao extends BaseMapper<SystemParamConfigCustomerEntity> {
int deleteByPrimaryKey(Integer id);
int insert(SystemParamConfigCustomerEntity record);
int insertSelective(SystemParamConfigCustomerEntity record);

@ -16,8 +16,6 @@ public interface SystemParamConfigDao extends BaseMapper<SystemParamConfigEntity
SystemParamConfigEntity selectByParamName(SystemParamConfigRequest systemParamConfigRequest);
boolean updateById(SystemParamConfigSaveRequest systemParamConfigSaveRequest);
boolean updateParentId(SystemParamConfigSaveRequest systemParamConfigSaveRequest);
boolean insertData(SystemParamConfigEntity systemParamConfigEntity);

@ -7,7 +7,7 @@ import lombok.Data;
@TableName("scheduled")
public class ScheduledEntity {
private int id;
private Integer id;
private String cronName;

@ -7,7 +7,7 @@ import lombok.Data;
@TableName("customer_set")
public class SetupEntity {
private int id;
private Integer id;
private boolean erpSaleOutModify;

@ -84,4 +84,7 @@ public class ErpOrderEntity {
//开票日期
private String invoiceDate;
//产品编码
private String relId;
}

@ -10,7 +10,7 @@ import java.util.Date;
@TableName("system_pdf_module")
public class SystemPDFModuleEntity {
private int id;
private Integer id;
private String name;

@ -10,7 +10,7 @@ import java.util.Date;
@TableName("system_pdf_template")
public class SystemPDFTemplateEntity {
private int id;
private Integer id;
@TableField("`name`")
private String name;

@ -10,7 +10,7 @@ import lombok.Data;
@TableName("system_pdf_template_relevance")
public class SystemPDFTemplateRelevanceEntity {
private int id;
private Integer id;
private Integer templateId;

@ -7,7 +7,7 @@ import lombok.Data;
@TableName("system_param_config")
public class SystemParamConfigEntity {
private int id;
private Integer id;
private int parentId;

@ -54,8 +54,7 @@ public class WarehouseTempMdService {
public void insertTempWarehouses(List<WarehousetempEntity> warehouseEntities) {
if (warehouseEntities != null) {
Collection<WarehousetempEntity> warehousetempEntityCollection = new ArrayList<>();
warehousetempEntityCollection.addAll(warehouseEntities);
Collection<WarehousetempEntity> warehousetempEntityCollection = new ArrayList<>(warehouseEntities);
mongoTemplate.insert(warehousetempEntityCollection, MongoDBName.NAME_CODE_TEMP);
}
}

@ -59,7 +59,7 @@ public class AuthAdminService {
* @return
*/
public AuthAdmin findById(Long id) {
return authAdminDao.findById(id);
return authAdminDao.selectById(id);
}
/**
@ -108,7 +108,11 @@ public class AuthAdminService {
* @return
*/
public boolean deleteById(Long id) {
return authAdminDao.deleteById(id);
int i = authAdminDao.deleteById(id);
if (i > 0) {
return true;
}
return false;
}
public boolean deleteByCustomerId(Long customerId) {
@ -137,7 +141,7 @@ public class AuthAdminService {
throw new JsonException(ResultEnum.NOT_NETWORK);
}
String userId = attributes.getRequest().getHeader("ADMIN_ID");
return authAdminDao.findById(Long.parseLong(userId));
return authAdminDao.selectById(Long.valueOf(userId));
}
public String getCurrentUserCustomerId() {

@ -108,8 +108,8 @@ public class InvWarehouseService {
return invWarehouseDao.selectOne(new QueryWrapper<InvWarehouseEntity>().eq("code", code));
}
public boolean deleteById(String id) {
return invWarehouseDao.deleteById(id);
public void deleteById(String id) {
invWarehouseDao.deleteById(id);
}
/**

@ -32,7 +32,7 @@ public class StockPrintTempService {
}
public boolean deleteById(DeleteStPrintTempRequest deleteStPrintTempRequest) {
return stockPrintTempDao.deleteById(deleteStPrintTempRequest);
return stockPrintTempDao.delete(deleteStPrintTempRequest);
}
public boolean insertStockPrintTempEntity(StockPrintTempEntity stockPrintEntity) {

@ -49,7 +49,7 @@ public class SystemPDFModuleService {
return systemPDFModuleDao.insertData(systemPDFModuleEntity);
}
public boolean deleteById(Integer id) {
return systemPDFModuleDao.deleteById(id);
public void deleteById(Integer id) {
systemPDFModuleDao.deleteById(id);
}
}

@ -12,7 +12,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
@ -39,53 +38,10 @@ public class SystemPDFTemplateRelevanceService {
}
}
/**
*
*
* @param systemPDFTemplateRelevanceEntityList
* @return
*/
public int insertSystemPDFTemplateRelevanceAll(List<SystemPDFTemplateRelevanceEntity> systemPDFTemplateRelevanceEntityList) {
if (systemPDFTemplateRelevanceEntityList == null || systemPDFTemplateRelevanceEntityList.isEmpty()) {
return 0;
}
return systemPDFTemplateRelevanceDao.insertSystemPDFTemplateRelevanceAll(systemPDFTemplateRelevanceEntityList);
}
public boolean insert(SystemPDFTemplateRelevanceEntity systemPDFTemplateRelevanceEntity) {
return systemPDFTemplateRelevanceDao.insertData(systemPDFTemplateRelevanceEntity);
}
/**
* ids customerId
*
* @param templates
* @param customerId
* @return
*/
public int insertRolesCustomerIdAll(List<Integer> templates, Long customerId) {
List<SystemPDFTemplateRelevanceEntity> systemPDFTemplateRelevanceEntityList = templates.stream().map(aLong -> {
SystemPDFTemplateRelevanceEntity systemPDFTemplateRelevanceEntity = new SystemPDFTemplateRelevanceEntity();
systemPDFTemplateRelevanceEntity.setTemplateId(aLong);
systemPDFTemplateRelevanceEntity.setCustomerId(customerId);
return systemPDFTemplateRelevanceEntity;
}).collect(Collectors.toList());
if (!systemPDFTemplateRelevanceEntityList.isEmpty()) {
return insertSystemPDFTemplateRelevanceAll(systemPDFTemplateRelevanceEntityList);
}
return 0;
}
/**
* customerId
*
* @param customerId
* @return
*/
public boolean deleteByCustomerId(Integer customerId) {
return systemPDFTemplateRelevanceDao.deleteById(customerId);
}
public boolean udpateRl(SystemPDFTemplateRelevanceEntity systemPDFTemplateRelevanceEntity) {
return systemPDFTemplateRelevanceDao.udpateRl(systemPDFTemplateRelevanceEntity);
}

@ -48,7 +48,11 @@ public class SystemPDFTemplateService {
}
public boolean deleteById(Integer id) {
return systemPDFTemplateDao.deleteById(id);
int i = systemPDFTemplateDao.deleteById(id);
if (i > 0) {
return true;
}
return false;
}
/**

@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.udi.admin.dao.param.SystemParamConfigCustomerDao;
import com.glxp.udi.admin.dao.param.SystemParamConfigDao;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.req.param.SystemParamConfigSaveRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -27,10 +26,6 @@ public class SystemParamConfigService {
return systemParamConfigDao.selectOne(new QueryWrapper<SystemParamConfigEntity>().eq("paramKey", key));
}
public boolean updateById(SystemParamConfigSaveRequest systemParamConfigSaveRequest) {
return systemParamConfigDao.updateById(systemParamConfigSaveRequest);
}
public boolean insert(SystemParamConfigEntity systemParamConfigEntity) {
return systemParamConfigDao.insertData(systemParamConfigEntity);
}

@ -88,7 +88,7 @@ public class SystemParamCustomerConfigService {
* @return
*/
public BaseResponse deleteParam(Integer id) {
int i = systemParamConfigCustomerDao.deleteByPrimaryKey(id);
int i = systemParamConfigCustomerDao.deleteById(id);
if (i == 1) {
return ResultVOUtils.success("删除成功");
}

@ -65,7 +65,7 @@ public class InvProductsTrService {
InvProductEntity invProductEntity = invProductService.selectByUuid(udiInfoEntity.getUuid(), erpOrderEntity.getLotno(), orderEntity.getCustomerId() + "", orderEntity.getLocStorageCode());
if (invProductEntity == null) {
invProductEntity = new InvProductEntity();
invProductEntity.setRelIdFk(udiInfoEntity.getUuid());
invProductEntity.setRelIdFk(String.valueOf(udiInfoEntity.getId()));
invProductEntity.setBatchNo(erpOrderEntity.getLotno());
invProductEntity.setCustomerId(orderEntity.getCustomerId() + "");
invProductEntity.setExpireDate(erpOrderEntity.getExpireDate());

@ -216,10 +216,8 @@ public class InoutUtils {
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
UdiInfoEntity udiInfo = getUdiInfo(udiInfoService, udiRelevanceService, warehouseEntity);
BeanUtil.copyProperties(udiInfo, udiInfoEntity);
if (udiInfoEntity != null) {
udiInfoEntity.setCount(getActCount(udiInfoEntity) * warehouseEntity.getCount());
udiInfoEntities.add(udiInfoEntity);
}
udiInfoEntity.setCount(getActCount(udiInfoEntity) * warehouseEntity.getCount());
udiInfoEntities.add(udiInfoEntity);
}
List<UdiInfoEntity> returnOrderDetail = new ArrayList<>();
@ -250,7 +248,8 @@ public class InoutUtils {
erpOrderEntity.setOrderIdFk(warehouseEntityList.get(0).getOrderId());
erpOrderEntity.setProductCompany(erpDetailCodeEntity.getYlqxzcrbarmc());
erpOrderEntity.setAuthCode(erpDetailCodeEntity.getZczbhhzbapzbh());
erpOrderEntity.setUuidFk(erpDetailCodeEntity.getUuid());
erpOrderEntity.setUuidFk(erpOrderEntity.getUuidFk());
erpOrderEntity.setRelId(String.valueOf(erpDetailCodeEntity.getId()));
erpOrderEntity.setPackSpec(erpDetailCodeEntity.getGgxh());
erpOrderEntities.add(erpOrderEntity);
}

@ -31,15 +31,6 @@
LIMIT 1
</select>
<select id="findById" parameterType="hashmap" resultType="com.glxp.udi.admin.entity.auth.AuthAdmin">
SELECT *
FROM auth_user
<where>
id = #{id}
</where>
LIMIT 1
</select>
<select id="findPwdById" parameterType="hashmap" resultType="com.glxp.udi.admin.entity.auth.AuthAdmin">
SELECT passWord
FROM auth_user
@ -113,13 +104,6 @@
WHERE id=#{id}
</update>
<delete id="deleteById" parameterType="java.lang.Long">
delete
from auth_user
where id = #{id}
</delete>
<delete id="deleteByCustomerId" parameterType="java.lang.Long">
delete
from auth_user

@ -79,15 +79,6 @@
</select>
<select id="selectById" parameterType="Map"
resultType="com.glxp.udi.admin.entity.inventory.InvWarehouseEntity">
SELECT *
FROM inv_warehouse
WHERE id = #{id}
</select>
<select id="selectMaxCode" parameterType="com.glxp.udi.admin.req.inventory.FilterInvWarehouseRequest"
resultType="com.glxp.udi.admin.entity.inventory.InvWarehouseEntity">
select max(code) as code from inv_warehouse
@ -175,12 +166,6 @@
#{customerId})
</insert>
<delete id="deleteById" parameterType="Map">
DELETE
FROM inv_warehouse
WHERE id = #{id}
</delete>
<update id="updateInvWarehouse" parameterType="com.glxp.udi.admin.entity.inventory.InvWarehouseEntity">
UPDATE inv_warehouse
<trim prefix="set" suffixOverrides=",">

@ -32,7 +32,7 @@
</insert>
<delete id="deleteById" parameterType="com.glxp.udi.admin.req.inventory.DeleteStPrintTempRequest">
<delete id="delete" parameterType="com.glxp.udi.admin.req.inventory.DeleteStPrintTempRequest">
DELETE
FROM inv_stockprint_pdf_temp
<where>

@ -55,9 +55,4 @@
#{update_time})
</insert>
<delete id="deleteById" parameterType="Map">
DELETE
FROM system_excel_template
WHERE id = #{id}
</delete>
</mapper>

@ -76,7 +76,4 @@
FROM system_pdf_module
</select>
<delete id="deleteById" parameterType="java.lang.Integer">
delete from system_pdf_module where id = #{id}
</delete>
</mapper>

@ -82,9 +82,4 @@
where name = #{name}
</select>
<delete id="deleteById" parameterType="java.lang.Integer">
delete
from system_pdf_template
where id = #{id}
</delete>
</mapper>

@ -99,6 +99,7 @@
#{localAction}
)
</insert>
<update id="udpateRl" parameterType="com.glxp.udi.admin.entity.param.SystemPDFTemplateRelevanceEntity">
UPDATE system_pdf_template_relevance
<trim prefix="set" suffixOverrides=",">
@ -130,9 +131,5 @@
</trim>
WHERE id = #{id}
</update>
<delete id="deleteById" parameterType="java.lang.Integer">
delete
from system_pdf_template_relevance
where id = #{id}
</delete>
</mapper>

@ -24,18 +24,6 @@
from system_param_config_customer
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from system_param_config_customer
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glxp.udi.admin.entity.param.SystemParamConfigCustomerEntity" useGeneratedKeys="true">
insert into system_param_config_customer (parentId, paramName, paramKey,
paramValue, paramStatus, paramType,
paramExplain, customerId)
values (#{parentId,jdbcType=INTEGER}, #{paramName,jdbcType=VARCHAR}, #{paramKey,jdbcType=VARCHAR},
#{paramValue,jdbcType=VARCHAR}, #{paramStatus,jdbcType=INTEGER}, #{paramType,jdbcType=INTEGER},
#{paramExplain,jdbcType=VARCHAR}, #{customerId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.glxp.udi.admin.entity.param.SystemParamConfigCustomerEntity" useGeneratedKeys="true">
insert into system_param_config_customer
<trim prefix="(" suffix=")" suffixOverrides=",">

@ -14,31 +14,6 @@
SELECT * FROM system_param_config WHERE paramName=#{paramName}
</select>
<update id="updateById" parameterType="com.glxp.udi.admin.entity.param.SystemParamConfigEntity">
UPDATE system_param_config
<set>
<if test="paramName != null">
paramName=#{paramName},
</if>
<if test="paramKey != null">
paramKey=#{paramKey},
</if>
<if test="paramValue != null">
paramValue=#{paramValue},
</if>
<if test="paramStatus != null">
paramStatus=#{paramStatus},
</if>
<if test="paramType != null">
paramType=#{paramType},
</if>
<if test="paramExplain != null">
paramExplain=#{paramExplain},
</if>
</set>
WHERE id=#{id}
</update>
<update id="updateParentId" parameterType="com.glxp.udi.admin.entity.param.SystemParamConfigEntity">
UPDATE system_param_config
<set>

Loading…
Cancel
Save