仓储接收租赁装备推送逻辑优化,租赁退租时,查询装备状态以及修改装备状态的接口编写
This commit is contained in:
parent
39ad23571f
commit
abf9a77602
|
|
@ -267,4 +267,7 @@ public class MaMachine extends BaseEntity {
|
|||
|
||||
@ApiModelProperty(value = "Iot定位设备编号")
|
||||
private String iotCode;
|
||||
|
||||
@ApiModelProperty(value = "推送到租赁标识0:未推送 1:推送")
|
||||
private Integer pushStatus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.sgzb.app.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.bonus.sgzb.app.domain.LeaseApplyDetails;
|
||||
import com.bonus.sgzb.app.domain.TmTask;
|
||||
import com.bonus.sgzb.app.mapper.LeaseApplyDetailsMapper;
|
||||
|
|
@ -11,18 +12,18 @@ import com.bonus.sgzb.base.mapper.MaLabelBindMapper;
|
|||
import com.bonus.sgzb.base.mapper.MaMachineMapper;
|
||||
import com.bonus.sgzb.base.vo.MaLabelBindVO;
|
||||
import com.bonus.sgzb.common.core.constant.Constants;
|
||||
import com.bonus.sgzb.common.core.utils.HttpHelper;
|
||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Description: 领料出库详情接口实现类
|
||||
|
|
@ -45,6 +46,9 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
@Resource
|
||||
private MaLabelBindMapper maLabelBindMapper;
|
||||
|
||||
@Value("${sgzb.updateItemStatusUrl}")
|
||||
private String updateItemStatus;
|
||||
|
||||
/**
|
||||
* 根据任务id查询出库数据
|
||||
*
|
||||
|
|
@ -144,7 +148,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult submitOut(LeaseOutDetails record) {
|
||||
int res = 0;
|
||||
try {
|
||||
|
|
@ -241,6 +245,22 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
}
|
||||
// 更新 (ma_machine 设备表)的状态
|
||||
leaseOutDetailsMapper.updateMaMachineStatus(record);
|
||||
//同步租赁商城机具状态
|
||||
try {
|
||||
MaMachine maMachine = new MaMachine();
|
||||
maMachine.setMaId(record.getMaId());
|
||||
// 15---1在库,16---2已出库
|
||||
maMachine.setMaStatus("2");
|
||||
String content = JSONObject.toJSONString(maMachine);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("body", content);
|
||||
String body = JSONObject.toJSONString(map);
|
||||
String data = HttpHelper.sendHttpPost(updateItemStatus, body);
|
||||
log.info("dataString-=========:" + data);
|
||||
} catch (Exception e) {
|
||||
log.error("同步租赁商城机具状态失败");
|
||||
throw new RuntimeException("同步租赁商城机具状态失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ public class MaReceiveController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "修改租赁设备状态")
|
||||
@GetMapping("/updateItemStatus")
|
||||
public AjaxResult updateItemStatus(Long itemId) {
|
||||
Integer itemStatus = maReceiveService.updateItemStatus(itemId);
|
||||
public AjaxResult updateItemStatus(DataReceiveDetail dataReceiveDetail) {
|
||||
Integer itemStatus = maReceiveService.updateItemStatus(dataReceiveDetail);
|
||||
return success(itemStatus);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,14 +56,14 @@ public class MaTypeKeeperController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "查询库管员信息")
|
||||
@PostMapping("/getMaTypeKeeper")
|
||||
public AjaxResult getMaTypeKeeper(SysDept sysDept){
|
||||
public AjaxResult getMaTypeKeeper(@RequestBody String sysDept){
|
||||
List<MaKeeperUser> maTypeList = maTypeKeeperService.getMaTypeKeeper(sysDept);
|
||||
return AjaxResult.success(maTypeList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询公司信息")
|
||||
@PostMapping("/getEnterprise")
|
||||
public AjaxResult getEnterprise(SysDept sysDept){
|
||||
public AjaxResult getEnterprise(@RequestBody String sysDept){
|
||||
SysDept sysDeptRes = maTypeKeeperService.getEnterprise(sysDept);
|
||||
return AjaxResult.success(sysDeptRes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.sgzb.base.mapper;
|
|||
|
||||
import com.bonus.sgzb.system.api.domain.SysDept;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -9,5 +10,5 @@ import java.util.List;
|
|||
public interface DeptMapper {
|
||||
public List<SysDept> getDeptList();
|
||||
|
||||
SysDept getDeptBySocialCreditCode(SysDept sysDept);
|
||||
SysDept getDeptBySocialCreditCode(@Param("socialCreditCode") String socialCreditCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.sgzb.base.mapper;
|
|||
|
||||
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementApply;
|
||||
import com.bonus.sgzb.base.domain.DataReceiveDetail;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -51,5 +52,5 @@ public interface MaMachineMapper {
|
|||
|
||||
Long selectMaMachineByItemId(Long itemId);
|
||||
|
||||
Integer updateItemStatus(Long itemId);
|
||||
Integer updateItemStatus(DataReceiveDetail dataReceiveDetail);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,4 +26,6 @@ public interface MaReceiveMapper {
|
|||
List<DataReceiveDetail> getDateReceiveMachine(DataReceiveDetail dataReceiveDetail);
|
||||
|
||||
int updateInfoStatus(@Param("id") Integer id);
|
||||
|
||||
Integer updateOrderOverTime(DataReceiveDetail dataReceiveDetail);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ public interface IMaTypeKeeperService {
|
|||
* 查询全部库管员信息
|
||||
* @return
|
||||
*/
|
||||
List<MaKeeperUser> getMaTypeKeeper(SysDept sysDept);
|
||||
List<MaKeeperUser> getMaTypeKeeper(String sysDept);
|
||||
|
||||
/**
|
||||
* 查询企业信息
|
||||
* @param sysDept
|
||||
* @return
|
||||
*/
|
||||
SysDept getEnterprise(SysDept sysDept);
|
||||
SysDept getEnterprise(String sysDept);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,5 +23,5 @@ public interface MaReceiveService {
|
|||
|
||||
Long getItemStatus(Long itemId);
|
||||
|
||||
Integer updateItemStatus(Long itemId);
|
||||
Integer updateItemStatus(DataReceiveDetail dataReceiveDetail);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ public class MaMachineServiceImpl implements MaMachineService {
|
|||
* @param machine
|
||||
* @return
|
||||
*/
|
||||
|
||||
private void getType(MaMachine machine) {
|
||||
long typeId = machine.getTypeId();
|
||||
// 规格型号
|
||||
|
|
@ -117,6 +118,7 @@ public class MaMachineServiceImpl implements MaMachineService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int remove(Long[] maIds) {
|
||||
int res = 0;
|
||||
if (maIds != null || maIds.length > 0) {
|
||||
|
|
@ -191,14 +193,20 @@ public class MaMachineServiceImpl implements MaMachineService {
|
|||
String encrypt;
|
||||
try {
|
||||
//encrypt = RsaUtil.encryptByPublicKey(content, Constants.publicKey);
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("body", content);
|
||||
String body = JSONObject.toJSONString(map);
|
||||
String data = HttpHelper.sendHttpPost(zlptUrl, body);
|
||||
log.info("dataString-=========:" + data);
|
||||
//对返回的结果进行处理
|
||||
// resultDataHandler(data);
|
||||
|
||||
//修改设备状态,防止重复推送
|
||||
for (MaMachine maMachine:maMachineList) {
|
||||
MaMachine maMachine1 = new MaMachine();
|
||||
maMachine1.setMaId(maMachine.getMaId());
|
||||
maMachine1.setPushStatus(1);
|
||||
maMachineMapper.updateMaMachine(maMachine1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
return AjaxResult.error("推送失败!");
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.bonus.sgzb.base.mapper.MaMachineMapper;
|
|||
import com.bonus.sgzb.base.mapper.MaReceiveMapper;
|
||||
import com.bonus.sgzb.base.mapper.MaTypeMapper;
|
||||
import com.bonus.sgzb.base.service.MaReceiveService;
|
||||
import com.bonus.sgzb.material.config.FieldGenerator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -108,7 +109,7 @@ public class MaReceiveServiceImpl implements MaReceiveService {
|
|||
public int saveMachine(DataReceiveInfo dataReceiveInfo) {
|
||||
for (DataReceiveDetail dataReceiveDetail : dataReceiveInfo.getDataReceiveDetailList()) {
|
||||
MaMachine maMachine = new MaMachine();
|
||||
maMachine.setMaCode(dataReceiveDetail.getMaCode());
|
||||
maMachine.setMaCode(FieldGenerator.generateField());
|
||||
maMachine.setTypeId(dataReceiveDetail.getTypeId());
|
||||
maMachine.setMaStatus("15");
|
||||
maMachine.setCreateTime(new Date());
|
||||
|
|
@ -153,8 +154,14 @@ public class MaReceiveServiceImpl implements MaReceiveService {
|
|||
return maMachineMapper.selectMaMachineByItemId(itemId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateItemStatus(Long itemId) {
|
||||
return maMachineMapper.updateItemStatus(itemId);
|
||||
|
||||
|
||||
public Integer updateItemStatus(DataReceiveDetail dataReceiveDetail) {
|
||||
if (dataReceiveDetail!=null && dataReceiveDetail.getOrderOverTime()!= null){
|
||||
return maReceiveMapper.updateOrderOverTime(dataReceiveDetail);
|
||||
}else {
|
||||
return maMachineMapper.updateItemStatus(dataReceiveDetail);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.sgzb.base.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.sgzb.base.domain.MaKeeperUser;
|
||||
import com.bonus.sgzb.base.mapper.DeptMapper;
|
||||
import com.bonus.sgzb.base.mapper.MaTypeKeeperMapper;
|
||||
|
|
@ -58,20 +59,24 @@ public class MaTypeKeeperServiceImpl implements IMaTypeKeeperService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MaKeeperUser> getMaTypeKeeper(SysDept sysDept) {
|
||||
public List<MaKeeperUser> getMaTypeKeeper(String sysDept) {
|
||||
log.info("MaTypeKeeperServiceImpl getMaTypeKeeper {}", sysDept);
|
||||
JSONObject object = JSONObject.parseObject(sysDept);
|
||||
String socialCreditCode = object.getString("body");
|
||||
//根据企业机构代码(统一社会信用代码)获取企业信息
|
||||
sysDept = deptMapper.getDeptBySocialCreditCode(sysDept);
|
||||
SysDept newSysDept = deptMapper.getDeptBySocialCreditCode(socialCreditCode);
|
||||
//获取该企业下的库管员
|
||||
return maTypeKeeperMapper.getMaTypeKeeper(sysDept.getDeptId());
|
||||
return maTypeKeeperMapper.getMaTypeKeeper(newSysDept.getDeptId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysDept getEnterprise(SysDept sysDept) {
|
||||
public SysDept getEnterprise(String sysDept) {
|
||||
log.info("MaTypeKeeperServiceImpl getEnterprise {}", sysDept);
|
||||
JSONObject object = JSONObject.parseObject(sysDept);
|
||||
String socialCreditCode = object.getString("body");
|
||||
//根据企业机构代码(统一社会信用代码)获取企业信息
|
||||
sysDept = deptMapper.getDeptBySocialCreditCode(sysDept);
|
||||
return sysDept;
|
||||
SysDept newSysDept = deptMapper.getDeptBySocialCreditCode(socialCreditCode);
|
||||
return newSysDept;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 192.168.0.119:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_nwjj
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 192.168.0.119:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_nwjj
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
|
|
@ -38,8 +38,9 @@ sgzb:
|
|||
job:
|
||||
settlementJobDay: 1
|
||||
settlementJobCron: "0 0 1 1 * ?"
|
||||
zlptUrl: http://test-rental.zhgkxt.com/proxy/item-center/supply/item/pushNotifications
|
||||
intelligentUrl: http://www.zhgkxt.com/api/clientapi/public/externalApi
|
||||
zlptUrl: https://test-rental.zhgkxt.com/proxy/item-center/supply/item/pushNotifications
|
||||
updateItemStatusUrl: https://test-rental.zhgkxt.com/proxy/item-center/supply/item/updateItemStatus
|
||||
intelligentUrl: https://sit.zhgkxt.com/api/clientapi/public/externalApi/acceptExternalMechanical
|
||||
intelligentAppKey: abc123
|
||||
intelligentAesKey: abcdefghijklmnop
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
create_by, create_time, update_by, update_time
|
||||
from sys_dept
|
||||
</select>
|
||||
<select id="getDeptBySocialCreditCode" resultType="com.bonus.sgzb.system.api.domain.SysDept">
|
||||
<select id="getDeptBySocialCreditCode" resultMap="sysDeptResult">
|
||||
select * from sys_dept where social_credit_code = #{socialCreditCode}
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
m.ma_vender, m.out_fac_time, m.out_fac_code, m.assets_code, m.check_man, m.this_check_time, m.next_check_time,
|
||||
m.gps_code, m.rfid_code, m.erp_code, m.transfer_code,m.create_time ,m.in_out_num, m.buy_task, m.own_house ,
|
||||
m.company_id ,mt.type_name specificationType,mt1.type_name deviceType, mt2.type_name itemType,
|
||||
mmb.label_code labelCode,mhi.house_name ownHouseName
|
||||
mmb.label_code labelCode,mhi.house_name ownHouseName,m.push_status
|
||||
from ma_machine m
|
||||
left join (select id,p_id,name from sys_dic where p_id in (select id from sys_dic where value = 'ma_status')) dic on m.ma_status = dic.id
|
||||
left join ma_type mt on m.type_id = mt.type_id
|
||||
|
|
@ -265,6 +265,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="buyTask != null and buyTask != ''">buy_task = #{buyTask},</if>
|
||||
<if test="ownHouse != null and ownHouse != ''">own_house = #{ownHouse},</if>
|
||||
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
|
||||
<if test="pushStatus != null and pushStatus != ''">push_status = #{pushStatus},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where ma_id = #{maId}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
SET receive_status = 1
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateOrderOverTime">
|
||||
UPDATE data_receive_detail
|
||||
SET order_over_time = #{orderOverTime}
|
||||
where item_id = #{itemId}
|
||||
</update>
|
||||
<select id="getDataReceive" resultType="com.bonus.sgzb.base.domain.DataReceiveInfo">
|
||||
select * from data_receive_info where 1=1
|
||||
<if test="receiveStatus != null">
|
||||
|
|
|
|||
Loading…
Reference in New Issue