投递单审核

master
guochaojie 4 months ago
parent be85299f34
commit 5e9871cea8

@ -0,0 +1,19 @@
<?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="jnpf.mapper.RecycleCleanOrderMapper">
<update id="auditBatch">
UPDATE NX_RECYCLE_DELIVERY_ORDER
SET
ADJUST_WEIGHT = REPORT_WEIGHT,
ADJUST_PRICE = TOTAL_PRICE,
ADJUST_STATUS = #{batch.adjustStatus},
ADJUST_COMM = #{batch.adjustComm},
F_LAST_MODIFY_TIME = #{batch.lastModifyTime},
F_LAST_MODIFY_USER_ID = #{batch.lastModifyUserId}
WHERE ID IN
<foreach collection="batch.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

@ -3,6 +3,8 @@ package jnpf.mapper;
import jnpf.entity.RecycleDeliveryOrderEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jnpf.model.recycledeliveryorder.DeliveryAuditBatch;
import org.apache.ibatis.annotations.Param;
/**
*
@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface RecycleDeliveryOrderMapper extends BaseMapper<RecycleDeliveryOrderEntity> {
int auditBatch(@Param("bacth") DeliveryAuditBatch batch);
}

@ -2,7 +2,9 @@ package jnpf.service;
import jnpf.model.recycledeliveryorder.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -16,7 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
public interface RecycleDeliveryOrderService extends IService<RecycleDeliveryOrderEntity> {
List<RecycleDeliveryOrderEntity> getList(RecycleDeliveryOrderPagination recycleDeliveryOrderPagination);
List<RecycleDeliveryOrderEntity> getTypeList(RecycleDeliveryOrderPagination recycleDeliveryOrderPagination,String dataType);
List<RecycleDeliveryOrderEntity> getTypeList(RecycleDeliveryOrderPagination recycleDeliveryOrderPagination, String dataType);
RecycleDeliveryOrderEntity getInfo(String id);
@ -28,8 +30,14 @@ public interface RecycleDeliveryOrderService extends IService<RecycleDeliveryOrd
//子表方法
//副表数据方法
String checkForm(RecycleDeliveryOrderForm form,int i);
String checkForm(RecycleDeliveryOrderForm form, int i);
void saveOrUpdate(RecycleDeliveryOrderForm recycleDeliveryOrderForm, String id, boolean isSave) throws Exception;
//审核
boolean audit(DeliveryAuditForm form);
void saveOrUpdate(RecycleDeliveryOrderForm recycleDeliveryOrderForm,String id, boolean isSave) throws Exception;
//批量审核
int batchAudit(DeliveryAuditBatch batch);
}

@ -1,37 +1,37 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.RecycleDeliveryOrderMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.recycledeliveryorder.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel;
import jnpf.database.model.superQuery.SuperJsonModel;
import jnpf.entity.RecycleCleanOrderEntity;
import jnpf.entity.RecycleDeliveryOrderEntity;
import jnpf.mapper.RecycleDeliveryOrderMapper;
import jnpf.model.QueryModel;
import jnpf.model.recycledeliveryorder.*;
import jnpf.permission.entity.UserEntity;
import jnpf.service.RecycleDeliveryOrderService;
import jnpf.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
*
*
* V3.5
* https://www.jnpfsoft.com
@ -39,462 +39,504 @@ import jnpf.permission.entity.UserEntity;
* 2024-06-18
*/
@Service
public class RecycleDeliveryOrderServiceImpl extends ServiceImpl<RecycleDeliveryOrderMapper, RecycleDeliveryOrderEntity> implements RecycleDeliveryOrderService{
public class RecycleDeliveryOrderServiceImpl extends ServiceImpl<RecycleDeliveryOrderMapper, RecycleDeliveryOrderEntity> implements RecycleDeliveryOrderService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Resource
private RecycleDeliveryOrderMapper deliveryOrderMapper;
@Override
public List<RecycleDeliveryOrderEntity> getList(RecycleDeliveryOrderPagination recycleDeliveryOrderPagination){
return getTypeList(recycleDeliveryOrderPagination,recycleDeliveryOrderPagination.getDataType());
public List<RecycleDeliveryOrderEntity> getList(RecycleDeliveryOrderPagination recycleDeliveryOrderPagination) {
return getTypeList(recycleDeliveryOrderPagination, recycleDeliveryOrderPagination.getDataType());
}
/** 列表查询 */
/**
*
*/
@Override
public List<RecycleDeliveryOrderEntity> getTypeList(RecycleDeliveryOrderPagination recycleDeliveryOrderPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList =new ArrayList<>();
public List<RecycleDeliveryOrderEntity> getTypeList(RecycleDeliveryOrderPagination recycleDeliveryOrderPagination, String dataType) {
String userId = userProvider.get().getUserId();
List<String> AllIdList = new ArrayList();
List<List<String>> intersectionList = new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? RecycleDeliveryOrderConstant.getAppColumnData() : RecycleDeliveryOrderConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int recycleDeliveryOrderNum =0;
QueryWrapper<RecycleDeliveryOrderEntity> recycleDeliveryOrderQueryWrapper=new QueryWrapper<>();
int total = 0;
int recycleDeliveryOrderNum = 0;
QueryWrapper<RecycleDeliveryOrderEntity> recycleDeliveryOrderQueryWrapper = new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getSuperQueryJson())){
String superOp = "";
if (ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = recycleDeliveryOrderPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<RecycleDeliveryOrderEntity> recycleDeliveryOrderSuperWrapper = new QueryWrapper<>();
recycleDeliveryOrderSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(recycleDeliveryOrderSuperWrapper,RecycleDeliveryOrderEntity.class,queryJson,"0"));
recycleDeliveryOrderSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(recycleDeliveryOrderSuperWrapper, RecycleDeliveryOrderEntity.class, queryJson, "0"));
int recycleDeliveryOrderNum1 = recycleDeliveryOrderSuperWrapper.getExpression().getNormal().size();
if (recycleDeliveryOrderNum1>0){
List<String> recycleDeliveryOrderList =this.list(recycleDeliveryOrderSuperWrapper).stream().map(RecycleDeliveryOrderEntity::getId).collect(Collectors.toList());
if (recycleDeliveryOrderNum1 > 0) {
List<String> recycleDeliveryOrderList = this.list(recycleDeliveryOrderSuperWrapper).stream().map(RecycleDeliveryOrderEntity::getId).collect(Collectors.toList());
allSuperList.addAll(recycleDeliveryOrderList);
intersectionSuperList.add(recycleDeliveryOrderList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if(superOp.equalsIgnoreCase("and")){
if (superOp.equalsIgnoreCase("and")) {
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
}else{
} else {
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp ="";
if (ObjectUtil.isNotEmpty(ruleJson)){
String ruleOp = "";
if (ObjectUtil.isNotEmpty(ruleJson)) {
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<RecycleDeliveryOrderEntity> recycleDeliveryOrderSuperWrapper = new QueryWrapper<>();
recycleDeliveryOrderSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(recycleDeliveryOrderSuperWrapper,RecycleDeliveryOrderEntity.class,ruleJson,"0"));
recycleDeliveryOrderSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(recycleDeliveryOrderSuperWrapper, RecycleDeliveryOrderEntity.class, ruleJson, "0"));
int recycleDeliveryOrderNum1 = recycleDeliveryOrderSuperWrapper.getExpression().getNormal().size();
if (recycleDeliveryOrderNum1>0){
List<String> recycleDeliveryOrderList =this.list(recycleDeliveryOrderSuperWrapper).stream().map(RecycleDeliveryOrderEntity::getId).collect(Collectors.toList());
if (recycleDeliveryOrderNum1 > 0) {
List<String> recycleDeliveryOrderList = this.list(recycleDeliveryOrderSuperWrapper).stream().map(RecycleDeliveryOrderEntity::getId).collect(Collectors.toList());
allRuleList.addAll(recycleDeliveryOrderList);
intersectionRuleList.add(recycleDeliveryOrderList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
if (ruleOp.equalsIgnoreCase("and")) {
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
} else {
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object recycleDeliveryOrderObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(recycleDeliveryOrderQueryWrapper,RecycleDeliveryOrderEntity.class,recycleDeliveryOrderPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(recycleDeliveryOrderObj)){
return new ArrayList<>();
} else {
recycleDeliveryOrderQueryWrapper = (QueryWrapper<RecycleDeliveryOrderEntity>)recycleDeliveryOrderObj;
if( recycleDeliveryOrderQueryWrapper.getExpression().getNormal().size()>0){
recycleDeliveryOrderNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object recycleDeliveryOrderObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(recycleDeliveryOrderQueryWrapper,RecycleDeliveryOrderEntity.class,recycleDeliveryOrderPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(recycleDeliveryOrderObj)){
return new ArrayList<>();
} else {
recycleDeliveryOrderQueryWrapper = (QueryWrapper<RecycleDeliveryOrderEntity>)recycleDeliveryOrderObj;
if( recycleDeliveryOrderQueryWrapper.getExpression().getNormal().size()>0){
recycleDeliveryOrderNum++;
}
boolean pcPermission = false;
boolean appPermission = false;
if (isPc && pcPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object recycleDeliveryOrderObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(recycleDeliveryOrderQueryWrapper, RecycleDeliveryOrderEntity.class, recycleDeliveryOrderPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(recycleDeliveryOrderObj)) {
return new ArrayList<>();
} else {
recycleDeliveryOrderQueryWrapper = (QueryWrapper<RecycleDeliveryOrderEntity>) recycleDeliveryOrderObj;
if (recycleDeliveryOrderQueryWrapper.getExpression().getNormal().size() > 0) {
recycleDeliveryOrderNum++;
}
}
}
}
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object recycleDeliveryOrderObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(recycleDeliveryOrderQueryWrapper, RecycleDeliveryOrderEntity.class, recycleDeliveryOrderPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(recycleDeliveryOrderObj)) {
return new ArrayList<>();
} else {
recycleDeliveryOrderQueryWrapper = (QueryWrapper<RecycleDeliveryOrderEntity>) recycleDeliveryOrderObj;
if (recycleDeliveryOrderQueryWrapper.getExpression().getNormal().size() > 0) {
recycleDeliveryOrderNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getOrderNo())){
recycleDeliveryOrderNum++;
}
}
if (isPc) {
if (ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getOrderNo())) {
recycleDeliveryOrderNum++;
String value = recycleDeliveryOrderPagination.getOrderNo() instanceof List ?
JsonUtil.getObjectToString(recycleDeliveryOrderPagination.getOrderNo()) :
String.valueOf(recycleDeliveryOrderPagination.getOrderNo());
recycleDeliveryOrderQueryWrapper.lambda().like(RecycleDeliveryOrderEntity::getOrderNo,value);
JsonUtil.getObjectToString(recycleDeliveryOrderPagination.getOrderNo()) :
String.valueOf(recycleDeliveryOrderPagination.getOrderNo());
recycleDeliveryOrderQueryWrapper.lambda().like(RecycleDeliveryOrderEntity::getOrderNo, value);
}
if(ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getAdjustStatus())){
recycleDeliveryOrderNum++;
if (ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getAdjustStatus())) {
recycleDeliveryOrderNum++;
recycleDeliveryOrderQueryWrapper.lambda().eq(RecycleDeliveryOrderEntity::getAdjustStatus,recycleDeliveryOrderPagination.getAdjustStatus());
recycleDeliveryOrderQueryWrapper.lambda().eq(RecycleDeliveryOrderEntity::getAdjustStatus, recycleDeliveryOrderPagination.getAdjustStatus());
}
if(ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getPhone())){
recycleDeliveryOrderNum++;
if (ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getPhone())) {
recycleDeliveryOrderNum++;
String value = recycleDeliveryOrderPagination.getPhone() instanceof List ?
JsonUtil.getObjectToString(recycleDeliveryOrderPagination.getPhone()) :
String.valueOf(recycleDeliveryOrderPagination.getPhone());
recycleDeliveryOrderQueryWrapper.lambda().like(RecycleDeliveryOrderEntity::getPhone,value);
JsonUtil.getObjectToString(recycleDeliveryOrderPagination.getPhone()) :
String.valueOf(recycleDeliveryOrderPagination.getPhone());
recycleDeliveryOrderQueryWrapper.lambda().like(RecycleDeliveryOrderEntity::getPhone, value);
}
if(ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getDeviceCode())){
recycleDeliveryOrderNum++;
List<String> idList = new ArrayList<>();
try {
String[][] deviceCode = JsonUtil.getJsonToBean(recycleDeliveryOrderPagination.getDeviceCode(),String[][].class);
for(int i=0;i<deviceCode.length;i++){
if(deviceCode[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(deviceCode[i])));
}
}
}catch (Exception e1){
try {
List<String> deviceCode = JsonUtil.getJsonToList(recycleDeliveryOrderPagination.getDeviceCode(),String.class);
if(deviceCode.size()>0){
idList.addAll(deviceCode);
}
}catch (Exception e2){
idList.add(String.valueOf(recycleDeliveryOrderPagination.getDeviceCode()));
}
}
recycleDeliveryOrderQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(RecycleDeliveryOrderEntity::getDeviceCode, tt).or();
});
});
if (ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getDeviceCode())) {
recycleDeliveryOrderNum++;
List<String> idList = new ArrayList<>();
try {
String[][] deviceCode = JsonUtil.getJsonToBean(recycleDeliveryOrderPagination.getDeviceCode(), String[][].class);
for (int i = 0; i < deviceCode.length; i++) {
if (deviceCode[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(deviceCode[i])));
}
}
} catch (Exception e1) {
try {
List<String> deviceCode = JsonUtil.getJsonToList(recycleDeliveryOrderPagination.getDeviceCode(), String.class);
if (deviceCode.size() > 0) {
idList.addAll(deviceCode);
}
} catch (Exception e2) {
idList.add(String.valueOf(recycleDeliveryOrderPagination.getDeviceCode()));
}
}
recycleDeliveryOrderQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(RecycleDeliveryOrderEntity::getDeviceCode, tt).or();
});
});
}
if(ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getDoorNum())){
recycleDeliveryOrderNum++;
List<String> idList = new ArrayList<>();
try {
String[][] doorNum = JsonUtil.getJsonToBean(recycleDeliveryOrderPagination.getDoorNum(),String[][].class);
for(int i=0;i<doorNum.length;i++){
if(doorNum[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(doorNum[i])));
}
}
}catch (Exception e1){
try {
List<String> doorNum = JsonUtil.getJsonToList(recycleDeliveryOrderPagination.getDoorNum(),String.class);
if(doorNum.size()>0){
idList.addAll(doorNum);
}
}catch (Exception e2){
idList.add(String.valueOf(recycleDeliveryOrderPagination.getDoorNum()));
}
}
recycleDeliveryOrderQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(RecycleDeliveryOrderEntity::getDoorNum, tt).or();
});
});
if (ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getDoorNum())) {
recycleDeliveryOrderNum++;
List<String> idList = new ArrayList<>();
try {
String[][] doorNum = JsonUtil.getJsonToBean(recycleDeliveryOrderPagination.getDoorNum(), String[][].class);
for (int i = 0; i < doorNum.length; i++) {
if (doorNum[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(doorNum[i])));
}
}
} catch (Exception e1) {
try {
List<String> doorNum = JsonUtil.getJsonToList(recycleDeliveryOrderPagination.getDoorNum(), String.class);
if (doorNum.size() > 0) {
idList.addAll(doorNum);
}
} catch (Exception e2) {
idList.add(String.valueOf(recycleDeliveryOrderPagination.getDoorNum()));
}
}
recycleDeliveryOrderQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(RecycleDeliveryOrderEntity::getDoorNum, tt).or();
});
});
}
if(ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getBucketCode())){
recycleDeliveryOrderNum++;
List<String> idList = new ArrayList<>();
try {
String[][] bucketCode = JsonUtil.getJsonToBean(recycleDeliveryOrderPagination.getBucketCode(),String[][].class);
for(int i=0;i<bucketCode.length;i++){
if(bucketCode[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(bucketCode[i])));
}
}
}catch (Exception e1){
try {
List<String> bucketCode = JsonUtil.getJsonToList(recycleDeliveryOrderPagination.getBucketCode(),String.class);
if(bucketCode.size()>0){
idList.add(JsonUtil.getObjectToString(bucketCode));
}
}catch (Exception e2){
idList.add(String.valueOf(recycleDeliveryOrderPagination.getBucketCode()));
}
}
recycleDeliveryOrderQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(RecycleDeliveryOrderEntity::getBucketCode, tt).or();
});
});
if (ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getBucketCode())) {
recycleDeliveryOrderNum++;
List<String> idList = new ArrayList<>();
try {
String[][] bucketCode = JsonUtil.getJsonToBean(recycleDeliveryOrderPagination.getBucketCode(), String[][].class);
for (int i = 0; i < bucketCode.length; i++) {
if (bucketCode[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(bucketCode[i])));
}
}
} catch (Exception e1) {
try {
List<String> bucketCode = JsonUtil.getJsonToList(recycleDeliveryOrderPagination.getBucketCode(), String.class);
if (bucketCode.size() > 0) {
idList.add(JsonUtil.getObjectToString(bucketCode));
}
} catch (Exception e2) {
idList.add(String.valueOf(recycleDeliveryOrderPagination.getBucketCode()));
}
}
recycleDeliveryOrderQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(RecycleDeliveryOrderEntity::getBucketCode, tt).or();
});
});
}
if(ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getBagNo())){
recycleDeliveryOrderNum++;
if (ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getBagNo())) {
recycleDeliveryOrderNum++;
String value = recycleDeliveryOrderPagination.getBagNo() instanceof List ?
JsonUtil.getObjectToString(recycleDeliveryOrderPagination.getBagNo()) :
String.valueOf(recycleDeliveryOrderPagination.getBagNo());
recycleDeliveryOrderQueryWrapper.lambda().like(RecycleDeliveryOrderEntity::getBagNo,value);
JsonUtil.getObjectToString(recycleDeliveryOrderPagination.getBagNo()) :
String.valueOf(recycleDeliveryOrderPagination.getBagNo());
recycleDeliveryOrderQueryWrapper.lambda().like(RecycleDeliveryOrderEntity::getBagNo, value);
}
if(ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getCompanyId())){
recycleDeliveryOrderNum++;
List<String> idList = new ArrayList<>();
try {
String[][] companyId = JsonUtil.getJsonToBean(recycleDeliveryOrderPagination.getCompanyId(),String[][].class);
for(int i=0;i<companyId.length;i++){
if(companyId[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(companyId[i])));
}
}
}catch (Exception e1){
try {
List<String> companyId = JsonUtil.getJsonToList(recycleDeliveryOrderPagination.getCompanyId(),String.class);
if(companyId.size()>0){
idList.add(companyId.get(companyId.size()-1));
}
}catch (Exception e2){
idList.add(String.valueOf(recycleDeliveryOrderPagination.getCompanyId()));
}
}
recycleDeliveryOrderQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(RecycleDeliveryOrderEntity::getCompanyId, tt).or();
});
});
if (ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getCompanyId())) {
recycleDeliveryOrderNum++;
List<String> idList = new ArrayList<>();
try {
String[][] companyId = JsonUtil.getJsonToBean(recycleDeliveryOrderPagination.getCompanyId(), String[][].class);
for (int i = 0; i < companyId.length; i++) {
if (companyId[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(companyId[i])));
}
}
} catch (Exception e1) {
try {
List<String> companyId = JsonUtil.getJsonToList(recycleDeliveryOrderPagination.getCompanyId(), String.class);
if (companyId.size() > 0) {
idList.add(companyId.get(companyId.size() - 1));
}
} catch (Exception e2) {
idList.add(String.valueOf(recycleDeliveryOrderPagination.getCompanyId()));
}
}
recycleDeliveryOrderQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(RecycleDeliveryOrderEntity::getCompanyId, tt).or();
});
});
}
if(ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getCleanerPhone())){
recycleDeliveryOrderNum++;
if (ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getCleanerPhone())) {
recycleDeliveryOrderNum++;
String value = recycleDeliveryOrderPagination.getCleanerPhone() instanceof List ?
JsonUtil.getObjectToString(recycleDeliveryOrderPagination.getCleanerPhone()) :
String.valueOf(recycleDeliveryOrderPagination.getCleanerPhone());
recycleDeliveryOrderQueryWrapper.lambda().like(RecycleDeliveryOrderEntity::getCleanerPhone,value);
JsonUtil.getObjectToString(recycleDeliveryOrderPagination.getCleanerPhone()) :
String.valueOf(recycleDeliveryOrderPagination.getCleanerPhone());
recycleDeliveryOrderQueryWrapper.lambda().like(RecycleDeliveryOrderEntity::getCleanerPhone, value);
}
if(ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getCleanStatus())){
recycleDeliveryOrderNum++;
if (ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getCleanStatus())) {
recycleDeliveryOrderNum++;
recycleDeliveryOrderQueryWrapper.lambda().eq(RecycleDeliveryOrderEntity::getCleanStatus,recycleDeliveryOrderPagination.getCleanStatus());
recycleDeliveryOrderQueryWrapper.lambda().eq(RecycleDeliveryOrderEntity::getCleanStatus, recycleDeliveryOrderPagination.getCleanStatus());
}
if(ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getCleanNo())){
recycleDeliveryOrderNum++;
if (ObjectUtil.isNotEmpty(recycleDeliveryOrderPagination.getCleanNo())) {
recycleDeliveryOrderNum++;
String value = recycleDeliveryOrderPagination.getCleanNo() instanceof List ?
JsonUtil.getObjectToString(recycleDeliveryOrderPagination.getCleanNo()) :
String.valueOf(recycleDeliveryOrderPagination.getCleanNo());
recycleDeliveryOrderQueryWrapper.lambda().like(RecycleDeliveryOrderEntity::getCleanNo,value);
JsonUtil.getObjectToString(recycleDeliveryOrderPagination.getCleanNo()) :
String.valueOf(recycleDeliveryOrderPagination.getCleanNo());
recycleDeliveryOrderQueryWrapper.lambda().like(RecycleDeliveryOrderEntity::getCleanNo, value);
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
if (total > 0) {
if (intersection.size() == 0) {
intersection.add("jnpfNullList");
}
recycleDeliveryOrderQueryWrapper.lambda().in(RecycleDeliveryOrderEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
recycleDeliveryOrderQueryWrapper.lambda().and(t->t.in(RecycleDeliveryOrderEntity::getId, finalAllSuperIDlist));
recycleDeliveryOrderQueryWrapper.lambda().and(t -> t.in(RecycleDeliveryOrderEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
recycleDeliveryOrderQueryWrapper.lambda().and(t->t.in(RecycleDeliveryOrderEntity::getId, finalAllRuleIDlist));
recycleDeliveryOrderQueryWrapper.lambda().and(t -> t.in(RecycleDeliveryOrderEntity::getId, finalAllRuleIDlist));
}
//排序
if(StringUtil.isEmpty(recycleDeliveryOrderPagination.getSidx())){
if (StringUtil.isEmpty(recycleDeliveryOrderPagination.getSidx())) {
recycleDeliveryOrderQueryWrapper.lambda().orderByDesc(RecycleDeliveryOrderEntity::getId);
}else{
} else {
try {
String sidx = recycleDeliveryOrderPagination.getSidx();
String[] strs= sidx.split("_name");
String[] strs = sidx.split("_name");
RecycleDeliveryOrderEntity recycleDeliveryOrderEntity = new RecycleDeliveryOrderEntity();
Field declaredField = recycleDeliveryOrderEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
recycleDeliveryOrderQueryWrapper="asc".equals(recycleDeliveryOrderPagination.getSort().toLowerCase())?recycleDeliveryOrderQueryWrapper.orderByAsc(value):recycleDeliveryOrderQueryWrapper.orderByDesc(value);
recycleDeliveryOrderQueryWrapper = "asc".equals(recycleDeliveryOrderPagination.getSort().toLowerCase()) ? recycleDeliveryOrderQueryWrapper.orderByAsc(value) : recycleDeliveryOrderQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<RecycleDeliveryOrderEntity> page=new Page<>(recycleDeliveryOrderPagination.getCurrentPage(), recycleDeliveryOrderPagination.getPageSize());
IPage<RecycleDeliveryOrderEntity> userIPage=this.page(page, recycleDeliveryOrderQueryWrapper);
return recycleDeliveryOrderPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<RecycleDeliveryOrderEntity> page = new Page<>(recycleDeliveryOrderPagination.getCurrentPage(), recycleDeliveryOrderPagination.getPageSize());
IPage<RecycleDeliveryOrderEntity> userIPage = this.page(page, recycleDeliveryOrderQueryWrapper);
return recycleDeliveryOrderPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<RecycleDeliveryOrderEntity> list = new ArrayList();
return recycleDeliveryOrderPagination.setData(list, list.size());
}
}else{
} else {
return this.list(recycleDeliveryOrderQueryWrapper);
}
}
@Override
public RecycleDeliveryOrderEntity getInfo(String id){
QueryWrapper<RecycleDeliveryOrderEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(RecycleDeliveryOrderEntity::getId,id);
public RecycleDeliveryOrderEntity getInfo(String id) {
QueryWrapper<RecycleDeliveryOrderEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(RecycleDeliveryOrderEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(RecycleDeliveryOrderEntity entity){
public void create(RecycleDeliveryOrderEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, RecycleDeliveryOrderEntity entity){
public boolean update(String id, RecycleDeliveryOrderEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(RecycleDeliveryOrderEntity entity){
if(entity!=null){
public void delete(RecycleDeliveryOrderEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
/**
* i-0-1
*/
@Override
public String checkForm(RecycleDeliveryOrderForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
public String checkForm(RecycleDeliveryOrderForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = "";
String countRecover = "";
if (isUp){
if (isUp) {
id = form.getId();
}
//主表字段验证
if(StringUtil.isEmpty(form.getPhone())){
return "投递人手机不能为空";
}
if(StringUtil.isEmpty(form.getReportWeight())){
return "上报重量不能为空";
}
if(StringUtil.isEmpty(form.getPrice())){
return "单价不能为空";
}
if(StringUtil.isNotEmpty(form.getPrice())){
if(!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getPrice())).matches()){
return "请输入正确的金额";
if (StringUtil.isEmpty(form.getPhone())) {
return "投递人手机不能为空";
}
}
if(StringUtil.isEmpty(form.getTotalPrice())){
return "总价不能为空";
}
if(StringUtil.isNotEmpty(form.getTotalPrice())){
if(!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getTotalPrice())).matches()){
return "请输入正确的重量";
if (StringUtil.isEmpty(form.getReportWeight())) {
return "上报重量不能为空";
}
}
if(StringUtil.isEmpty(form.getOriginalWeight())){
return "桶内原重不能为空";
}
if(StringUtil.isNotEmpty(form.getAdjustWeight())){
if(!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getAdjustWeight())).matches()){
return "请输入正确的重量";
if (StringUtil.isEmpty(form.getPrice())) {
return "单价不能为空";
}
}
if(StringUtil.isEmpty(form.getAdjustPrice())){
return "审核总价不能为空";
}
if(StringUtil.isNotEmpty(form.getAdjustPrice())){
if(!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getAdjustPrice())).matches()){
return "请输入正确的重量";
if (StringUtil.isNotEmpty(form.getPrice())) {
if (!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getPrice())).matches()) {
return "请输入正确的金额";
}
}
}
if(StringUtil.isEmpty(form.getDeviceOrderNo())){
return "机柜单号不能为空";
}
if(StringUtil.isEmpty(form.getBagNo())){
return "垃圾袋编号不能为空";
}
if(StringUtil.isNotEmpty(form.getCleanerPhone())){
if(!Pattern.compile("^1[3456789]\\d{9}$").matcher(String.valueOf(form.getCleanerPhone())).matches()){
return "请输入正确的手机号码";
if (StringUtil.isEmpty(form.getTotalPrice())) {
return "总价不能为空";
}
if (StringUtil.isNotEmpty(form.getTotalPrice())) {
if (!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getTotalPrice())).matches()) {
return "请输入正确的重量";
}
}
if (StringUtil.isEmpty(form.getOriginalWeight())) {
return "桶内原重不能为空";
}
if (StringUtil.isNotEmpty(form.getAdjustWeight())) {
if (!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getAdjustWeight())).matches()) {
return "请输入正确的重量";
}
}
if (StringUtil.isEmpty(form.getAdjustPrice())) {
return "审核总价不能为空";
}
if (StringUtil.isNotEmpty(form.getAdjustPrice())) {
if (!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getAdjustPrice())).matches()) {
return "请输入正确的重量";
}
}
if (StringUtil.isEmpty(form.getDeviceOrderNo())) {
return "机柜单号不能为空";
}
if (StringUtil.isEmpty(form.getBagNo())) {
return "垃圾袋编号不能为空";
}
if (StringUtil.isNotEmpty(form.getCleanerPhone())) {
if (!Pattern.compile("^1[3456789]\\d{9}$").matcher(String.valueOf(form.getCleanerPhone())).matches()) {
return "请输入正确的手机号码";
}
}
}
return countRecover;
}
/**
* ()
* @param id
* @param recycleDeliveryOrderForm
* @return
*/
* ()
*
* @param id
* @param recycleDeliveryOrderForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(RecycleDeliveryOrderForm recycleDeliveryOrderForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
public void saveOrUpdate(RecycleDeliveryOrderForm recycleDeliveryOrderForm, String id, boolean isSave) throws Exception {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
recycleDeliveryOrderForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(RecycleDeliveryOrderConstant.getFormData(),recycleDeliveryOrderForm),RecycleDeliveryOrderForm.class);
generaterSwapUtil.swapDatetime(RecycleDeliveryOrderConstant.getFormData(), recycleDeliveryOrderForm), RecycleDeliveryOrderForm.class);
RecycleDeliveryOrderEntity entity = JsonUtil.getJsonToBean(recycleDeliveryOrderForm, RecycleDeliveryOrderEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setOrderNo(generaterSwapUtil.getBillNumber("deliveryOrderCode", false));
entity.setCompanyId(generaterSwapUtil.getCurrentOrgIds(userInfo.getOrganizeId(),"all"));
entity.setLastModifyTime(null);
entity.setLastModifyUserId(null);
entity.setOrganizeJsonId(generaterSwapUtil.getCurrentOrgIds(userInfo.getOrganizeId(),"all"));
entity.setCreatorTime(DateUtil.getNowDate());
entity.setCreatorUserId(userInfo.getUserId());
if (isSave) {
String mainId = RandomUtil.uuId();
entity.setOrderNo(generaterSwapUtil.getBillNumber("deliveryOrderCode", false));
entity.setCompanyId(generaterSwapUtil.getCurrentOrgIds(userInfo.getOrganizeId(), "all"));
entity.setLastModifyTime(null);
entity.setLastModifyUserId(null);
entity.setOrganizeJsonId(generaterSwapUtil.getCurrentOrgIds(userInfo.getOrganizeId(), "all"));
entity.setCreatorTime(DateUtil.getNowDate());
entity.setCreatorUserId(userInfo.getUserId());
entity.setId(mainId);
}else{
entity.setOrderNo(generaterSwapUtil.getBillNumber("deliveryOrderCode", false));
entity.setCompanyId(generaterSwapUtil.getCurrentOrgIds(userInfo.getOrganizeId(),"all"));
entity.setLastModifyTime(null);
entity.setLastModifyUserId(null);
entity.setOrganizeJsonId(generaterSwapUtil.getCurrentOrgIds(userInfo.getOrganizeId(),"all"));
entity.setCreatorTime(DateUtil.getNowDate());
entity.setCreatorUserId(userInfo.getUserId());
} else {
entity.setOrderNo(generaterSwapUtil.getBillNumber("deliveryOrderCode", false));
entity.setCompanyId(generaterSwapUtil.getCurrentOrgIds(userInfo.getOrganizeId(), "all"));
entity.setLastModifyTime(null);
entity.setLastModifyUserId(null);
entity.setOrganizeJsonId(generaterSwapUtil.getCurrentOrgIds(userInfo.getOrganizeId(), "all"));
entity.setCreatorTime(DateUtil.getNowDate());
entity.setCreatorUserId(userInfo.getUserId());
}
this.saveOrUpdate(entity);
}
@Override
@Transactional
public boolean audit(DeliveryAuditForm form) {
UserInfo userInfo = userProvider.get();
form.setLastModifyUserId(userInfo.getUserId());
form.setLastModifyTime(LocalDateTime.now());
UpdateWrapper<RecycleDeliveryOrderEntity> wrapper = new UpdateWrapper<>();
wrapper.lambda()
.set(RecycleDeliveryOrderEntity::getAdjustStatus, form.getAdjustStatus())
.set(RecycleDeliveryOrderEntity::getAdjustWeight, form.getAdjustWeight())
.set(RecycleDeliveryOrderEntity::getAdjustPrice, form.getAdjustPrice())
.set(RecycleDeliveryOrderEntity::getAdjustComm, form.getAdjustComm())
.set(RecycleDeliveryOrderEntity::getLastModifyUserId, form.getLastModifyUserId())
.set(RecycleDeliveryOrderEntity::getLastModifyTime, form.getLastModifyTime())
.eq(RecycleDeliveryOrderEntity::getId, form.getId());
return this.update(wrapper);
}
@Override
@Transactional
public int batchAudit(DeliveryAuditBatch batch) {
UserInfo userInfo = userProvider.get();
batch.setLastModifyUserId(userInfo.getUserId());
batch.setLastModifyTime(LocalDateTime.now());
int update = deliveryOrderMapper.auditBatch(batch);
return update;
}
}

@ -222,7 +222,7 @@ public class RecycleCleanOrderController {
* @return
*/
@Operation(summary = "批量审核")
@PostMapping("/audit")
@PostMapping("/auditBatch")
public ActionResult AuditBatch(CleanAuditBatch batch) {
int up = recycleCleanOrderService.auditBatch(batch);
if (up > 0) return ActionResult.success("审核操作成功");

@ -1,36 +1,31 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.entity.RecycleDeliveryOrderEntity;
import jnpf.model.recycledeliveryorder.*;
import jnpf.service.RecycleDeliveryOrderService;
import jnpf.util.GeneraterSwapUtil;
import jnpf.util.JsonUtil;
import jnpf.util.StringUtil;
import jnpf.util.UserProvider;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
@ -38,7 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Slf4j
@RestController
@Tag(name = "投递清单" , description = "scm")
@Tag(name = "投递清单", description = "scm")
@RequestMapping("/api/scm/RecycleDeliveryOrder")
public class RecycleDeliveryOrderController {
@ -52,27 +47,26 @@ public class RecycleDeliveryOrderController {
private RecycleDeliveryOrderService recycleDeliveryOrderService;
/**
*
*
* @param recycleDeliveryOrderPagination
* @return
*/
*
*
* @param recycleDeliveryOrderPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody RecycleDeliveryOrderPagination recycleDeliveryOrderPagination)throws IOException{
List<RecycleDeliveryOrderEntity> list= recycleDeliveryOrderService.getList(recycleDeliveryOrderPagination);
List<Map<String, Object>> realList=new ArrayList<>();
public ActionResult list(@RequestBody RecycleDeliveryOrderPagination recycleDeliveryOrderPagination) throws IOException {
List<RecycleDeliveryOrderEntity> list = recycleDeliveryOrderService.getList(recycleDeliveryOrderPagination);
List<Map<String, Object>> realList = new ArrayList<>();
for (RecycleDeliveryOrderEntity entity : list) {
Map<String, Object> recycleDeliveryOrderMap=JsonUtil.entityToMap(entity);
recycleDeliveryOrderMap.put("id", recycleDeliveryOrderMap.get("id"));
//副表数据
//子表数据
Map<String, Object> recycleDeliveryOrderMap = JsonUtil.entityToMap(entity);
recycleDeliveryOrderMap.put("id", recycleDeliveryOrderMap.get("id"));
//副表数据
//子表数据
realList.add(recycleDeliveryOrderMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, RecycleDeliveryOrderConstant.getFormData(), RecycleDeliveryOrderConstant.getColumnData(), recycleDeliveryOrderPagination.getModuleId(),false);
realList = generaterSwapUtil.swapDataList(realList, RecycleDeliveryOrderConstant.getFormData(), RecycleDeliveryOrderConstant.getColumnData(), recycleDeliveryOrderPagination.getModuleId(), false);
//返回对象
PageListVO vo = new PageListVO();
@ -81,110 +75,137 @@ public class RecycleDeliveryOrderController {
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param recycleDeliveryOrderForm
* @return
*/
*
*
* @param recycleDeliveryOrderForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid RecycleDeliveryOrderForm recycleDeliveryOrderForm) {
String b = recycleDeliveryOrderService.checkForm(recycleDeliveryOrderForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
String b = recycleDeliveryOrderService.checkForm(recycleDeliveryOrderForm, 0);
if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
try{
recycleDeliveryOrderService.saveOrUpdate(recycleDeliveryOrderForm, null ,true);
}catch(Exception e){
try {
recycleDeliveryOrderService.saveOrUpdate(recycleDeliveryOrderForm, null, true);
} catch (Exception e) {
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
*
* @param id
* @param recycleDeliveryOrderForm
* @return
*/
*
*
* @param id
* @param recycleDeliveryOrderForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid RecycleDeliveryOrderForm recycleDeliveryOrderForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid RecycleDeliveryOrderForm recycleDeliveryOrderForm,
@RequestParam(value = "isImport", required = false) boolean isImport) {
recycleDeliveryOrderForm.setId(id);
if (!isImport) {
String b = recycleDeliveryOrderService.checkForm(recycleDeliveryOrderForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
String b = recycleDeliveryOrderService.checkForm(recycleDeliveryOrderForm, 1);
if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
}
RecycleDeliveryOrderEntity entity= recycleDeliveryOrderService.getInfo(id);
if(entity!=null){
try{
recycleDeliveryOrderService.saveOrUpdate(recycleDeliveryOrderForm,id,false);
}catch(Exception e){
RecycleDeliveryOrderEntity entity = recycleDeliveryOrderService.getInfo(id);
if (entity != null) {
try {
recycleDeliveryOrderService.saveOrUpdate(recycleDeliveryOrderForm, id, false);
} catch (Exception e) {
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
}else{
} else {
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
* @param id
* @return
*/
*
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
RecycleDeliveryOrderEntity entity= recycleDeliveryOrderService.getInfo(id);
if(entity!=null){
public ActionResult delete(@PathVariable("id") String id) {
RecycleDeliveryOrderEntity entity = recycleDeliveryOrderService.getInfo(id);
if (entity != null) {
//主表数据删除
recycleDeliveryOrderService.delete(entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
* ()
* 使-
*
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
RecycleDeliveryOrderEntity entity= recycleDeliveryOrderService.getInfo(id);
if(entity==null){
public ActionResult detailInfo(@PathVariable("id") String id) {
RecycleDeliveryOrderEntity entity = recycleDeliveryOrderService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> recycleDeliveryOrderMap=JsonUtil.entityToMap(entity);
Map<String, Object> recycleDeliveryOrderMap = JsonUtil.entityToMap(entity);
recycleDeliveryOrderMap.put("id", recycleDeliveryOrderMap.get("id"));
//副表数据
//子表数据
recycleDeliveryOrderMap = generaterSwapUtil.swapDataDetail(recycleDeliveryOrderMap,RecycleDeliveryOrderConstant.getFormData(),"565540808741097605",false);
recycleDeliveryOrderMap = generaterSwapUtil.swapDataDetail(recycleDeliveryOrderMap, RecycleDeliveryOrderConstant.getFormData(), "565540808741097605", false);
return ActionResult.success(recycleDeliveryOrderMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
* ()
* 使-
*
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
RecycleDeliveryOrderEntity entity= recycleDeliveryOrderService.getInfo(id);
if(entity==null){
public ActionResult info(@PathVariable("id") String id) {
RecycleDeliveryOrderEntity entity = recycleDeliveryOrderService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> recycleDeliveryOrderMap=JsonUtil.entityToMap(entity);
Map<String, Object> recycleDeliveryOrderMap = JsonUtil.entityToMap(entity);
recycleDeliveryOrderMap.put("id", recycleDeliveryOrderMap.get("id"));
//副表数据
//子表数据
recycleDeliveryOrderMap = generaterSwapUtil.swapDataForm(recycleDeliveryOrderMap,RecycleDeliveryOrderConstant.getFormData(),RecycleDeliveryOrderConstant.TABLEFIELDKEY,RecycleDeliveryOrderConstant.TABLERENAMES);
recycleDeliveryOrderMap = generaterSwapUtil.swapDataForm(recycleDeliveryOrderMap, RecycleDeliveryOrderConstant.getFormData(), RecycleDeliveryOrderConstant.TABLEFIELDKEY, RecycleDeliveryOrderConstant.TABLERENAMES);
return ActionResult.success(recycleDeliveryOrderMap);
}
//审核
@Operation(summary = "审核")
@PostMapping("/audit")
public ActionResult audit(@RequestBody DeliveryAuditForm form) {
boolean audit = recycleDeliveryOrderService.audit(form);
if (audit) return ActionResult.success("审核成功");
else return ActionResult.fail("审核失败");
}
//批量审核
@Operation(summary = "审核")
@PostMapping("/auditBatch")
public ActionResult auditBatch(@RequestBody DeliveryAuditBatch batch) {
int update = recycleDeliveryOrderService.batchAudit(batch);
if (update <= 0) return ActionResult.fail("审核失败");
return ActionResult.success("审核成功");
}
}

@ -4,38 +4,21 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
//审核表单
@Data
public class DeliveryAuditBatch {
/** 主键 */
private String id;
/** 清运单号 **/
@JsonProperty("orderNo")
private String orderNo;
@JsonProperty("deviceOrderNo")
private String deviceOrderNo;
/** 单价 **/
@JsonProperty("price")
private BigDecimal price;
/** 清运重量 **/
@JsonProperty("weight")
private BigDecimal weight;
/** 总价 **/
@JsonProperty("totalPrice")
private BigDecimal totalPrice;
/** 审核后重量 **/
@JsonProperty("adjustWeight")
private BigDecimal adjustWeight;
/** 审核后总价 **/
@JsonProperty("reportTime")
private String reportTime;
/** 审核状态 **/
@JsonProperty("adjustStatus")
private List<String> ids;
@JsonProperty("adjustStatus")//审核状态
private String adjustStatus;
/** 入库状态 **/
@JsonProperty("entryStatus")
private String entryStatus;
/** 审核说明 **/
@JsonProperty("adjustComm")
private String adjustComm;//审核备注
@JsonProperty("lastModifyUserId")
private String lastModifyUserId;
@JsonProperty("lastModifyTime")
private LocalDateTime lastModifyTime;
}

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
//审核表单
@Data
@ -11,31 +12,17 @@ public class DeliveryAuditForm {
/** 主键 */
private String id;
/** 清运单号 **/
@JsonProperty("orderNo")
private String orderNo;
@JsonProperty("deviceOrderNo")
private String deviceOrderNo;
/** 单价 **/
@JsonProperty("price")
private BigDecimal price;
/** 清运重量 **/
@JsonProperty("weight")
private BigDecimal weight;
/** 总价 **/
@JsonProperty("totalPrice")
private BigDecimal totalPrice;
/** 审核后重量 **/
@JsonProperty("adjustWeight")
private BigDecimal adjustWeight;
/** 审核后总价 **/
@JsonProperty("reportTime")
private String reportTime;
/** 审核状态 **/
@JsonProperty("adjustStatus")
@JsonProperty("adjustStatus")//审核状态
private String adjustStatus;
/** 入库状态 **/
@JsonProperty("entryStatus")
private String entryStatus;
/** 审核说明 **/
@JsonProperty("adjustWeight")//审核重量
private BigDecimal adjustWeight;
@JsonProperty("adjustPrice")
private BigDecimal adjustPrice;//审核价格
@JsonProperty("adjustComm")
private String adjustComm;//审核备注
@JsonProperty("lastModifyUserId")
private String lastModifyUserId;
@JsonProperty("lastModifyTime")
private LocalDateTime lastModifyTime;
}

Loading…
Cancel
Save