第三方服务修改,新增设备审核,第三方仓库,仓库字典修改,第三方单据类型修改,业务单据提交修改等等
parent
286573c7ba
commit
c2c7d8ae49
@ -0,0 +1,128 @@
|
||||
package com.glxp.api.admin.controller.info;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.api.admin.entity.info.DeviceKeyEntity;
|
||||
import com.glxp.api.admin.req.info.FilterDeviceKeyRequest;
|
||||
import com.glxp.api.admin.req.inout.DeleteRequest;
|
||||
import com.glxp.api.admin.res.PageSimpleResponse;
|
||||
import com.glxp.api.admin.service.auth.DeviceKeyService;
|
||||
import com.glxp.api.admin.util.DateUtil;
|
||||
import com.glxp.api.common.enums.ResultEnum;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class DeviceKeyController {
|
||||
// @Value("${spring.mail.username}")
|
||||
// private String mail;
|
||||
// @Value("${toMail}")
|
||||
// private String toMail;
|
||||
@Resource
|
||||
DeviceKeyService deviceKeyService;
|
||||
// @Resource
|
||||
// private JavaMailSender javaMailSender;
|
||||
|
||||
@GetMapping("sale/device/registerList")
|
||||
public BaseResponse registerList(FilterDeviceKeyRequest filterDeviceKeyRequest) {
|
||||
List<DeviceKeyEntity> deviceKeyEntities = deviceKeyService.findDeviceKey(filterDeviceKeyRequest);
|
||||
PageInfo<DeviceKeyEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(deviceKeyEntities);
|
||||
PageSimpleResponse<DeviceKeyEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(deviceKeyEntities);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("sale/device/check")
|
||||
public BaseResponse checkRegister(@RequestBody @Valid DeviceKeyEntity deviceKeyEntity,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
deviceKeyEntity.setDate(DateUtil.getDate());
|
||||
deviceKeyService.updateDeviceKey(deviceKeyEntity);
|
||||
return ResultVOUtils.success("审核成功");
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/sale/info/registerKey")
|
||||
public BaseResponse registerKey(@RequestBody DeviceKeyEntity deviceKeyEntity) {
|
||||
String key = md5("glxp2020" + deviceKeyEntity.getImei());
|
||||
FilterDeviceKeyRequest filterDeviceKeyRequest = new FilterDeviceKeyRequest();
|
||||
filterDeviceKeyRequest.setImei(deviceKeyEntity.getImei());
|
||||
DeviceKeyEntity deviceKeyEntity1 = deviceKeyService.findDeviceByImei(filterDeviceKeyRequest);
|
||||
if (deviceKeyEntity1 == null) {
|
||||
return ResultVOUtils.success("1");
|
||||
} else if (deviceKeyEntity1.getIsCheck() == 0) {
|
||||
return ResultVOUtils.success("0");
|
||||
} else {
|
||||
return ResultVOUtils.success(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/sale/info/deleterKey")
|
||||
public BaseResponse deleterKey(@RequestBody DeleteRequest deleteRequest) {
|
||||
|
||||
deviceKeyService.deleteDeviceKey(deleteRequest);
|
||||
return ResultVOUtils.success("删除成功");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("sale/device/register")
|
||||
public BaseResponse saveRegister(@RequestBody DeviceKeyEntity deviceKeyEntity,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
deviceKeyEntity.setDate(DateUtil.getDateTime());
|
||||
deviceKeyEntity.setIsCheck(0);
|
||||
deviceKeyService.insertDeviceKey(deviceKeyEntity);
|
||||
return ResultVOUtils.success("1");
|
||||
}
|
||||
|
||||
// public void sendMail(String title, String content, String to) {
|
||||
// SimpleMailMessage message = new SimpleMailMessage();
|
||||
// message.setFrom(mail);
|
||||
// message.setTo(to);
|
||||
// message.setSubject(title);
|
||||
// message.setText(content);
|
||||
// javaMailSender.send(message);
|
||||
// }
|
||||
|
||||
public String md5(String password) {
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("MD5");
|
||||
byte[] bytes = digest.digest(password.getBytes());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte b : bytes) {
|
||||
int c = b & 0xff; //负数转换成正数
|
||||
String result = Integer.toHexString(c); //把十进制的数转换成十六进制的书
|
||||
if (result.length() < 2) {
|
||||
sb.append(0); //让十六进制全部都是两位数
|
||||
}
|
||||
sb.append(result);
|
||||
}
|
||||
return sb.toString(); //返回加密后的密文
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.glxp.api.admin.dao.auth;
|
||||
|
||||
import com.glxp.api.admin.entity.info.DeviceKeyEntity;
|
||||
import com.glxp.api.admin.req.info.FilterDeviceKeyRequest;
|
||||
import com.glxp.api.admin.req.inout.DeleteRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DeviceKeyDao {
|
||||
DeviceKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest);
|
||||
|
||||
List<DeviceKeyEntity> findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest);
|
||||
|
||||
void insertDeviceKey(DeviceKeyEntity deviceKeyEntity);
|
||||
|
||||
void updateDeviceKey(DeviceKeyEntity deviceKeyEntity);
|
||||
|
||||
void updateDeviceKeyByImei(DeviceKeyEntity deviceKeyEntity);
|
||||
|
||||
void deleteDeviceKey(DeleteRequest deleteRequest);
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.glxp.api.admin.entity.info;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DeviceKeyEntity {
|
||||
private String id;
|
||||
private String imei;
|
||||
private int isCheck;
|
||||
private String companyName;
|
||||
private String phone;
|
||||
private String contact;
|
||||
private String imeiKey;
|
||||
private String date;
|
||||
private String creditNum;
|
||||
private int checkCode;
|
||||
private String rgType;
|
||||
private String remark;
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.glxp.api.admin.httpclient;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UdiwmsOrderResponse {
|
||||
private String thirdBillNo;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.glxp.api.admin.req.auth;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ConnectRequest {
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.glxp.api.admin.req.info;
|
||||
|
||||
import com.glxp.api.admin.req.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FilterDeviceKeyRequest extends ListPageRequest {
|
||||
private String imei;
|
||||
private String isCheck;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.glxp.api.admin.service.auth;
|
||||
|
||||
|
||||
import com.glxp.api.admin.entity.info.DeviceKeyEntity;
|
||||
import com.glxp.api.admin.req.info.FilterDeviceKeyRequest;
|
||||
import com.glxp.api.admin.req.inout.DeleteRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DeviceKeyService {
|
||||
List<DeviceKeyEntity> findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest);
|
||||
|
||||
DeviceKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest);
|
||||
|
||||
DeviceKeyEntity findDeviceByImei(String imei);
|
||||
|
||||
void insertDeviceKey(DeviceKeyEntity deviceKeyEntity);
|
||||
|
||||
void updateDeviceKeyByImei(DeviceKeyEntity deviceKeyEntity);
|
||||
|
||||
void updateDeviceKey(DeviceKeyEntity deviceKeyEntity);
|
||||
|
||||
void deleteDeviceKey(DeleteRequest deleteRequest);
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.glxp.api.admin.service.auth.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.admin.dao.auth.DeviceKeyDao;
|
||||
import com.glxp.api.admin.entity.info.DeviceKeyEntity;
|
||||
import com.glxp.api.admin.req.info.FilterDeviceKeyRequest;
|
||||
import com.glxp.api.admin.req.inout.DeleteRequest;
|
||||
import com.glxp.api.admin.service.auth.DeviceKeyService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DeviceKeyServiceImpl implements DeviceKeyService {
|
||||
|
||||
@Resource
|
||||
DeviceKeyDao deviceKeyDao;
|
||||
|
||||
@Override
|
||||
public List<DeviceKeyEntity> findDeviceKey(FilterDeviceKeyRequest filterDeviceKeyRequest) {
|
||||
if (filterDeviceKeyRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
int offset = (filterDeviceKeyRequest.getPage() - 1) * filterDeviceKeyRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterDeviceKeyRequest.getLimit());
|
||||
return deviceKeyDao.findDeviceKey(filterDeviceKeyRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceKeyEntity findDeviceByImei(FilterDeviceKeyRequest filterDeviceKeyRequest) {
|
||||
return deviceKeyDao.findDeviceByImei(filterDeviceKeyRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceKeyEntity findDeviceByImei(String imei) {
|
||||
FilterDeviceKeyRequest filterDeviceKeyRequest = new FilterDeviceKeyRequest();
|
||||
filterDeviceKeyRequest.setImei(imei);
|
||||
DeviceKeyEntity deviceKeyEntity = deviceKeyDao.findDeviceByImei(filterDeviceKeyRequest);
|
||||
return deviceKeyEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertDeviceKey(DeviceKeyEntity deviceKeyEntity) {
|
||||
deviceKeyDao.insertDeviceKey(deviceKeyEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeviceKeyByImei(DeviceKeyEntity deviceKeyEntity) {
|
||||
deviceKeyDao.updateDeviceKeyByImei(deviceKeyEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeviceKey(DeviceKeyEntity deviceKeyEntity) {
|
||||
deviceKeyDao.updateDeviceKey(deviceKeyEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDeviceKey(DeleteRequest deleteRequest) {
|
||||
deviceKeyDao.deleteDeviceKey(deleteRequest);
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
<?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.glxp.api.admin.dao.auth.DeviceKeyDao">
|
||||
|
||||
|
||||
<select id="findDeviceKey" parameterType="com.glxp.api.admin.req.info.FilterDeviceKeyRequest"
|
||||
resultType="com.glxp.api.admin.entity.info.DeviceKeyEntity">
|
||||
SELECT * FROM device_check
|
||||
<where>
|
||||
<if test="imei != null and imei != ''">
|
||||
and imei = #{imei}
|
||||
</if>
|
||||
<if test="isCheck != null and isCheck != ''">
|
||||
and isCheck = #{isCheck}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="findDeviceByImei" parameterType="com.glxp.api.admin.req.info.FilterDeviceKeyRequest"
|
||||
resultType="com.glxp.api.admin.entity.info.DeviceKeyEntity">
|
||||
SELECT * FROM device_check
|
||||
<where>
|
||||
<if test="imei != null and imei != ''">
|
||||
and imei = #{imei}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateDeviceKey" parameterType="com.glxp.api.admin.entity.info.DeviceKeyEntity">
|
||||
|
||||
UPDATE device_check
|
||||
<set>
|
||||
<if test="isCheck != null">isCheck=#{isCheck},</if>
|
||||
<if test="companyName != null">companyName=#{companyName},</if>
|
||||
<if test="phone != null">phone=#{phone},</if>
|
||||
<if test="contact != null">contact=#{contact},</if>
|
||||
<if test="imeiKey != null">imeiKey=#{imeiKey},</if>
|
||||
<if test="date != null">date=#{date},</if>
|
||||
<if test="creditNum != null">creditNum=#{creditNum},</if>
|
||||
<if test="rgType != null">rgType=#{rgType},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
|
||||
</set>
|
||||
WHERE id=#{id}
|
||||
|
||||
</update>
|
||||
|
||||
<update id="updateDeviceKeyByImei" parameterType="com.glxp.api.admin.entity.info.DeviceKeyEntity">
|
||||
|
||||
UPDATE device_check
|
||||
<set>
|
||||
<if test="isCheck != null">isCheck=#{isCheck},</if>
|
||||
<if test="companyName != null">companyName=#{companyName},</if>
|
||||
<if test="phone != null">phone=#{phone},</if>
|
||||
<if test="contact != null">contact=#{contact},</if>
|
||||
<if test="imeiKey != null">imeiKey=#{imeiKey},</if>
|
||||
<if test="date != null">date=#{date},</if>
|
||||
<if test="imei != null">imei=#{imei},</if>
|
||||
<if test="creditNum != null">creditNum=#{creditNum},</if>
|
||||
<if test="rgType != null">rgType=#{rgType},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
</set>
|
||||
WHERE imei=#{imei}
|
||||
</update>
|
||||
|
||||
<insert id="insertDeviceKey" parameterType="com.glxp.api.admin.entity.info.DeviceKeyEntity">
|
||||
replace INTO device_check(
|
||||
imei,
|
||||
isCheck,
|
||||
companyName,
|
||||
phone,
|
||||
contact,
|
||||
date,
|
||||
imeiKey,creditNum,rgType,remark) values
|
||||
(
|
||||
#{imei},
|
||||
#{isCheck},
|
||||
#{companyName},
|
||||
#{phone},
|
||||
#{contact},
|
||||
#{date},
|
||||
#{imeiKey},#{creditNum},#{rgType},#{remark}
|
||||
|
||||
)
|
||||
</insert>
|
||||
<delete id="deleteDeviceKey" parameterType="Map">
|
||||
DELETE FROM device_check WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue