1.保存代码

feature-order-fix
x_z 2 years ago
parent 7ba27b3445
commit 6ce835f118

@ -27,6 +27,16 @@ public class Constant {
*/ */
public static final String MA_ORDER = "MA"; public static final String MA_ORDER = "MA";
/**
*
*/
public static final String DEVICE_COLLECT_ORDER = "DCO";
/**
*
*/
public static final String DEVICE_MA_ORDER = "DMA";
public static final String dlThrProducts = "THR_DOWNLOAD_PRODUCTS"; public static final String dlThrProducts = "THR_DOWNLOAD_PRODUCTS";
public static final String dlThrInvProducts = "THR_DOWNLOAD_INV_PRODUCTS"; public static final String dlThrInvProducts = "THR_DOWNLOAD_INV_PRODUCTS";
public static final String dlThrOrders = "THR_DOWNLOAD_ORDERS"; public static final String dlThrOrders = "THR_DOWNLOAD_ORDERS";

@ -1,6 +1,11 @@
package com.glxp.api.admin.dao.inventory; package com.glxp.api.admin.dao.inventory;
import com.glxp.api.admin.entity.inventory.DeviceCollectOrderEntity; import com.glxp.api.admin.entity.inventory.DeviceCollectOrderEntity;
import com.glxp.api.admin.req.inventory.FilterDeviceCollectOrderRequest;
import com.glxp.api.admin.res.inventory.DeviceCollectOrderResponse;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface DeviceCollectOrderDao { public interface DeviceCollectOrderDao {
int deleteByPrimaryKey(Integer id); int deleteByPrimaryKey(Integer id);
@ -14,4 +19,14 @@ public interface DeviceCollectOrderDao {
int updateByPrimaryKeySelective(DeviceCollectOrderEntity record); int updateByPrimaryKeySelective(DeviceCollectOrderEntity record);
int updateByPrimaryKey(DeviceCollectOrderEntity record); int updateByPrimaryKey(DeviceCollectOrderEntity record);
List<DeviceCollectOrderResponse> filterList(FilterDeviceCollectOrderRequest deviceCollectOrderRequest);
/**
* ID
*
* @param id
* @return
*/
String selectOrderIdById(@Param("id") Integer id);
} }

@ -2,6 +2,8 @@ package com.glxp.api.admin.dao.inventory;
import com.glxp.api.admin.entity.inventory.DeviceCollectOrderDetailEntity; import com.glxp.api.admin.entity.inventory.DeviceCollectOrderDetailEntity;
import java.util.List;
public interface DeviceCollectOrderDetailDao { public interface DeviceCollectOrderDetailDao {
int deleteByPrimaryKey(Integer id); int deleteByPrimaryKey(Integer id);
@ -14,4 +16,6 @@ public interface DeviceCollectOrderDetailDao {
int updateByPrimaryKeySelective(DeviceCollectOrderDetailEntity record); int updateByPrimaryKeySelective(DeviceCollectOrderDetailEntity record);
int updateByPrimaryKey(DeviceCollectOrderDetailEntity record); int updateByPrimaryKey(DeviceCollectOrderDetailEntity record);
List<DeviceCollectOrderDetailEntity> selectByOrderId(String orderId);
} }

@ -45,5 +45,5 @@ public class DeviceCollectOrderEntity {
/** /**
* 0稿 1 2 * 0稿 1 2
*/ */
private Boolean status; private Integer status;
} }

@ -1,12 +1,13 @@
package com.glxp.api.admin.req.inventory; package com.glxp.api.admin.req.inventory;
import com.glxp.api.admin.req.ListPageRequest;
import lombok.Data; import lombok.Data;
/** /**
* *
*/ */
@Data @Data
public class FilterDeviceCollectOrderRequest { public class FilterDeviceCollectOrderRequest extends ListPageRequest {
/** /**
* ID * ID

@ -8,4 +8,10 @@ import lombok.Data;
*/ */
@Data @Data
public class DeviceCollectOrderResponse extends DeviceCollectOrderEntity { public class DeviceCollectOrderResponse extends DeviceCollectOrderEntity {
/**
*
*/
private String deptName;
} }

@ -1,17 +1,29 @@
package com.glxp.api.admin.service.inventory.impl; package com.glxp.api.admin.service.inventory.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.constant.Constant;
import com.glxp.api.admin.dao.inventory.DeviceCollectOrderDao; import com.glxp.api.admin.dao.inventory.DeviceCollectOrderDao;
import com.glxp.api.admin.dao.inventory.DeviceCollectOrderDetailDao; import com.glxp.api.admin.dao.inventory.DeviceCollectOrderDetailDao;
import com.glxp.api.admin.entity.inventory.DeviceCollectOrderDetailEntity;
import com.glxp.api.admin.entity.inventory.DeviceCollectOrderEntity; import com.glxp.api.admin.entity.inventory.DeviceCollectOrderEntity;
import com.glxp.api.admin.req.inventory.FilterDeviceCollectOrderRequest; import com.glxp.api.admin.req.inventory.FilterDeviceCollectOrderRequest;
import com.glxp.api.admin.res.inventory.DeviceCollectOrderResponse; import com.glxp.api.admin.res.inventory.DeviceCollectOrderResponse;
import com.glxp.api.admin.service.auth.CustomerService;
import com.glxp.api.admin.service.inventory.DeviceCollectOrderService; import com.glxp.api.admin.service.inventory.DeviceCollectOrderService;
import com.glxp.api.admin.util.DateUtil;
import com.glxp.api.admin.util.GennerOrderUtils;
import com.glxp.api.admin.util.OrderNoTypeBean;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
@ -23,25 +35,62 @@ public class DeviceCollectOrderServiceImpl implements DeviceCollectOrderService
private DeviceCollectOrderDao deviceCollectOrderDao; private DeviceCollectOrderDao deviceCollectOrderDao;
@Resource @Resource
private DeviceCollectOrderDetailDao deviceCollectOrderDetailDao; private DeviceCollectOrderDetailDao deviceCollectOrderDetailDao;
@Resource
private GennerOrderUtils gennerOrderUtils;
@Resource
private CustomerService customerService;
@Override @Override
public List<DeviceCollectOrderResponse> filterList(FilterDeviceCollectOrderRequest deviceCollectOrderRequest) { public List<DeviceCollectOrderResponse> filterList(FilterDeviceCollectOrderRequest deviceCollectOrderRequest) {
return null; if (null == deviceCollectOrderRequest) {
return Collections.emptyList();
}
if (null != deviceCollectOrderRequest.getPage() && null != deviceCollectOrderRequest.getLimit()) {
PageHelper.offsetPage((deviceCollectOrderRequest.getPage() - 1) * deviceCollectOrderRequest.getLimit(), deviceCollectOrderRequest.getLimit());
}
return deviceCollectOrderDao.filterList(deviceCollectOrderRequest);
} }
@Override @Override
public BaseResponse addDeviceCollectOrder(DeviceCollectOrderEntity deviceCollectOrderEntity) { public BaseResponse addDeviceCollectOrder(DeviceCollectOrderEntity deviceCollectOrderEntity) {
return null; if (null == deviceCollectOrderEntity) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
//生成单号
String orderId = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.DEVICE_COLLECT_ORDER, "yyyyMMdd"));
deviceCollectOrderEntity.setOrderId(orderId);
deviceCollectOrderEntity.setCreateTime(DateUtil.getDateTime());
deviceCollectOrderEntity.setStatus(0);
deviceCollectOrderEntity.setUpdateTime(DateUtil.getDateTime());
String userName = customerService.getUserBean().getUserName();
deviceCollectOrderEntity.setCreateUser(userName);
deviceCollectOrderDao.insert(deviceCollectOrderEntity);
return ResultVOUtils.success(deviceCollectOrderEntity);
} }
@Override @Override
public BaseResponse updateDeviceCollectOrder(DeviceCollectOrderEntity deviceCollectOrderEntity) { public BaseResponse updateDeviceCollectOrder(DeviceCollectOrderEntity deviceCollectOrderEntity) {
return null; if (null == deviceCollectOrderEntity || null == deviceCollectOrderEntity.getId() || StrUtil.isBlank(deviceCollectOrderEntity.getOrderId())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
deviceCollectOrderEntity.setUpdateTime(DateUtil.getDateTime());
deviceCollectOrderDao.updateByPrimaryKey(deviceCollectOrderEntity);
return ResultVOUtils.success("更新成功");
} }
@Override @Override
public BaseResponse submitAudit(Integer id) { public BaseResponse submitAudit(Integer id) {
return null; if (null == id) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
//查询设备领用记录详情,判断是否每个设备都可以分辨唯一,如果不能,则无法提交审核
String orderId = deviceCollectOrderDao.selectOrderIdById(id);
List<DeviceCollectOrderDetailEntity> detailList = deviceCollectOrderDetailDao.selectByOrderId(orderId);
if (CollUtil.isEmpty(detailList)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "请添加领用设备!");
}
return ResultVOUtils.success("提交成功!");
} }
@Override @Override

@ -9,7 +9,7 @@
<result column="auditUser" jdbcType="VARCHAR" property="auditUser"/> <result column="auditUser" jdbcType="VARCHAR" property="auditUser"/>
<result column="createTime" jdbcType="VARCHAR" property="createTime"/> <result column="createTime" jdbcType="VARCHAR" property="createTime"/>
<result column="updateTime" jdbcType="VARCHAR" property="updateTime"/> <result column="updateTime" jdbcType="VARCHAR" property="updateTime"/>
<result column="status" jdbcType="BOOLEAN" property="status"/> <result column="status" jdbcType="INTEGER" property="status"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
@ -43,7 +43,7 @@
`status`) `status`)
values (#{orderId,jdbcType=VARCHAR}, #{deptCode,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, values (#{orderId,jdbcType=VARCHAR}, #{deptCode,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
#{auditUser,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{updateTime,jdbcType=VARCHAR}, #{auditUser,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{updateTime,jdbcType=VARCHAR},
#{status,jdbcType=BOOLEAN}) #{status,jdbcType=INTEGER})
</insert> </insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" <insert id="insertSelective" keyColumn="id" keyProperty="id"
@ -92,7 +92,7 @@
#{updateTime,jdbcType=VARCHAR}, #{updateTime,jdbcType=VARCHAR},
</if> </if>
<if test="status != null"> <if test="status != null">
#{status,jdbcType=BOOLEAN}, #{status,jdbcType=INTEGER},
</if> </if>
</trim> </trim>
</insert> </insert>
@ -120,7 +120,7 @@
updateTime = #{updateTime,jdbcType=VARCHAR}, updateTime = #{updateTime,jdbcType=VARCHAR},
</if> </if>
<if test="status != null"> <if test="status != null">
`status` = #{status,jdbcType=BOOLEAN}, `status` = #{status,jdbcType=INTEGER},
</if> </if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
@ -134,7 +134,27 @@
auditUser = #{auditUser,jdbcType=VARCHAR}, auditUser = #{auditUser,jdbcType=VARCHAR},
createTime = #{createTime,jdbcType=VARCHAR}, createTime = #{createTime,jdbcType=VARCHAR},
updateTime = #{updateTime,jdbcType=VARCHAR}, updateTime = #{updateTime,jdbcType=VARCHAR},
`status` = #{status,jdbcType=BOOLEAN} `status` = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<select id="filterList" resultType="com.glxp.api.admin.res.inventory.DeviceCollectOrderResponse">
select dco.id,
orderId,
deptCode,
createUser,
auditUser,
createTime,
updateTime,
status,
auth_dept.name deptName
from device_collect_order dco
left join auth_dept on dco.deptCode = auth_dept.code
</select>
<select id="selectOrderIdById" resultType="java.lang.String">
select orderId
from device_collect_order
where id = #{id}
</select>
</mapper> </mapper>

@ -243,4 +243,11 @@
receiveSpaceCode = #{receiveSpaceCode,jdbcType=VARCHAR} receiveSpaceCode = #{receiveSpaceCode,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<select id="selectByOrderId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from device_collect_order_detail
where orderIdFk = #{orderId}
</select>
</mapper> </mapper>
Loading…
Cancel
Save