Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2026-01-20 18:12:44 +08:00
24 changed files with 317 additions and 159 deletions

View File

@ -1,5 +1,6 @@
package com.pictc.utils; package com.pictc.utils;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.shaded.com.google.common.collect.Lists; import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
@ -58,6 +59,8 @@ public class DataLogTools {
private static Map<String,Class<?>> entitys = Maps.newHashMap(); private static Map<String,Class<?>> entitys = Maps.newHashMap();
private static final String REDIS_CACHE_KEY = "TABLE_INFO:";
private static Set<String> logTables = null; private static Set<String> logTables = null;
private static Object lock = new Object(); private static Object lock = new Object();
@ -609,21 +612,23 @@ public class DataLogTools {
Object joinValue = tabInfo.getFieldValue(entity, join.getField()); Object joinValue = tabInfo.getFieldValue(entity, join.getField());
if(joinValue!=null && joinValue instanceof List) { if(joinValue!=null && joinValue instanceof List) {
List listValue = (List) joinValue; List listValue = (List) joinValue;
for (LogJoinColumn joinColumn : columns) { for (Object item : listValue) {
if (joinColumn.valueType() == JoinValueType.FEILD Long idValue2 = joinTable.getIdValue(item);
&& joinColumn.valueDirection() == ValueDirectionType.RIGHT) { if(idValue2==null || idValue2 <=0) {
Object joinFieldValue = tabInfo.getFieldValue(entity, joinColumn.field()); joinTable.setIdValue(item, IdWorker.getId());
for (Object item : listValue) { }
Long idValue2 = joinTable.getIdValue(item); for (LogJoinColumn joinColumn : columns) {
if(idValue2==null || idValue2 <=0) { if (joinColumn.valueType() == JoinValueType.FEILD
joinTable.setIdValue(item, IdWorker.getId()); && joinColumn.valueDirection() == ValueDirectionType.RIGHT) {
} Object joinFieldValue = tabInfo.getFieldValue(entity, joinColumn.field());
joinTable.setFieldValue(item, joinColumn.relatedField(), joinFieldValue);
}else if(joinColumn.valueType()==JoinValueType.STATIC){
Object joinFieldValue = Convert.convert(joinColumn.staticType(), joinColumn.staticValue());
joinTable.setFieldValue(item, joinColumn.relatedField(), joinFieldValue); joinTable.setFieldValue(item, joinColumn.relatedField(), joinFieldValue);
Set<Class<?>> joinClasses = SetUtils.ofCollection(classes);
initJoinValue(item,joinTable,joinClasses);
} }
} }
Set<Class<?>> joinClasses = SetUtils.ofCollection(classes);
initJoinValue(item,joinTable,joinClasses);
} }
}else { }else {
Long idValue2 = joinTable.getIdValue(joinValue); Long idValue2 = joinTable.getIdValue(joinValue);
@ -634,9 +639,16 @@ public class DataLogTools {
if(joinColumn.valueType()==JoinValueType.FEILD && joinColumn.valueDirection()==ValueDirectionType.LEFT) { if(joinColumn.valueType()==JoinValueType.FEILD && joinColumn.valueDirection()==ValueDirectionType.LEFT) {
Object joinFieldValue = joinTable.getFieldValue(joinValue, joinColumn.relatedField()); Object joinFieldValue = joinTable.getFieldValue(joinValue, joinColumn.relatedField());
tabInfo.setFieldValue(entity, joinColumn.field(),joinFieldValue); tabInfo.setFieldValue(entity, joinColumn.field(),joinFieldValue);
}else { }else if(joinColumn.valueType()==JoinValueType.FEILD){
Object joinFieldValue = tabInfo.getFieldValue(entity, joinColumn.field()); Object joinFieldValue = tabInfo.getFieldValue(entity, joinColumn.field());
joinTable.setFieldValue(joinValue, joinColumn.relatedField(), joinFieldValue); joinTable.setFieldValue(joinValue, joinColumn.relatedField(), joinFieldValue);
}else {
Object joinFieldValue = Convert.convert(joinColumn.staticType(), joinColumn.staticValue());
if(joinColumn.valueDirection()==ValueDirectionType.LEFT) {
tabInfo.setFieldValue(entity, joinColumn.field(),joinFieldValue);
}else {
joinTable.setFieldValue(joinValue, joinColumn.relatedField(), joinFieldValue);
}
} }
} }
Set<Class<?>> joinClasses = SetUtils.ofCollection(classes); Set<Class<?>> joinClasses = SetUtils.ofCollection(classes);

View File

@ -0,0 +1,46 @@
package com.pictc.utils;
import java.util.Enumeration;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.HandlerMapping;
public class RequestUtils {
private RequestUtils() {
super();
}
public static HttpServletRequest getRequest() {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
return servletRequestAttributes.getRequest();
}
@SuppressWarnings("unchecked")
public static Map<String, String> getPathValues(){
HttpServletRequest request = getRequest();
return (Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
}
public static String getPathValue(String name){
return getPathValues().get(name);
}
public static Map<String,Object> getParameters(HttpServletRequest request) {
Map<String,Object> parameters = CollectionUtils.newHashMap();
Enumeration<String> names = request.getParameterNames();
if(names!=null) {
while (names.hasMoreElements()) {
String name = names.nextElement();
parameters.put(name, request.getParameter(name));
}
}
return parameters;
}
}

View File

@ -3,6 +3,8 @@ package com.xjrsoft.module.approve;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @title: 审批通用类 * @title: 审批通用类
@ -36,5 +38,5 @@ public class ApproveDto<T> {
/** /**
* 操作数据 * 操作数据
*/ */
private T data; private List<T> data;
} }

View File

@ -80,7 +80,7 @@ public class LngPngApproPurVo extends com.xjrsoft.common.model.base.BaseModel{
* 采购合同名称 * 采购合同名称
*/ */
@ApiModelProperty("采购合同名称") @ApiModelProperty("采购合同名称")
private Long kpName; private String kpName;
/** /**

View File

@ -102,7 +102,7 @@ public class LngPngApproVo extends com.xjrsoft.common.model.base.BaseModel{
* 交易主体名称(天然气公司/惠贸) * 交易主体名称(天然气公司/惠贸)
*/ */
@ApiModelProperty("交易主体名称(天然气公司/惠贸)") @ApiModelProperty("交易主体名称(天然气公司/惠贸)")
private Long comName; private String comName;
/** /**

View File

@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.mdm.vo.LngBRegionVo;
/** /**
* @author: ksy * @author: ksy
@ -19,6 +20,6 @@ public interface ICountryRegionClient {
Map<String,String> getAllTranData(); Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngBRegionVo getTranById(@RequestParam("id")String id);
} }

View File

@ -1,6 +1,6 @@
package com.xjrsoft.module.mdm.client; package com.xjrsoft.module.mdm.client;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto; import com.xjrsoft.module.mdm.vo.LngBCurrencyVo;
/** /**
* @author: ksy * @author: ksy
@ -21,7 +21,7 @@ public interface ICurrencyClient {
Map<String,String> getAllTranData(); Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngBCurrencyVo getTranById(@RequestParam("id")String id);
} }

View File

@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto; import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
import com.xjrsoft.module.mdm.vo.LngBBankVo;
/** /**
* @author: ksy * @author: ksy
@ -21,7 +22,7 @@ public interface ILngBankClient {
Map<String,String> getAllTranData(); Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngBBankVo getTranById(@RequestParam("id")String id);
@GetMapping("/getTranByCodes") @GetMapping("/getTranByCodes")
List<UpdateLngBBankDto> getTranByCodes(@RequestParam("codes") List<String> codes); List<UpdateLngBBankDto> getTranByCodes(@RequestParam("codes") List<String> codes);

View File

@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.mdm.vo.LngBStationLngVo;
/** /**
* @author: ksy * @author: ksy
@ -15,10 +16,7 @@ import com.xjrsoft.common.constant.GlobalConstant;
@FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.MDM_MODULE_PREFIX + "/tran/lngStation") @FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.MDM_MODULE_PREFIX + "/tran/lngStation")
public interface ILngStationClient { public interface ILngStationClient {
@GetMapping("/getAllTranData")
Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngBStationLngVo getTranById(@RequestParam("id")String id);
} }

View File

@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.sales.vo.LngCustomerVo;
/** /**
* @author: ksy * @author: ksy
@ -15,10 +16,7 @@ import com.xjrsoft.common.constant.GlobalConstant;
@FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.SALES_MODULE_PREFIX + "/tran/customer") @FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.SALES_MODULE_PREFIX + "/tran/customer")
public interface ICustomerClient { public interface ICustomerClient {
@GetMapping("/getAllTranData")
Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngCustomerVo getTranById(@RequestParam("id")String id);
} }

View File

@ -1,12 +1,11 @@
package com.xjrsoft.module.sales.client; package com.xjrsoft.module.sales.client;
import java.util.Map;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.sales.vo.LngGradeSystemVo;
/** /**
* @author: ksy * @author: ksy
@ -15,10 +14,7 @@ import com.xjrsoft.common.constant.GlobalConstant;
@FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.SALES_MODULE_PREFIX + "/tran/gradeSystem") @FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.SALES_MODULE_PREFIX + "/tran/gradeSystem")
public interface IGradeSystemClient { public interface IGradeSystemClient {
@GetMapping("/getAllTranData")
Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngGradeSystemVo getTranById(@RequestParam("id")String id);
} }

View File

@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.supplier.vo.LngSupplierVo;
/** /**
* @author: ksy * @author: ksy
@ -19,6 +20,6 @@ public interface ISupplierClient {
Map<String,String> getAllTranData(); Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngSupplierVo getTranById(@RequestParam("id")String id);
} }

View File

@ -74,7 +74,15 @@ public class PngApproController {
@PostMapping(value = "/approveXS") @PostMapping(value = "/approveXS")
@SaCheckPermission("pngAppro:approveXS") @SaCheckPermission("pngAppro:approveXS")
public R approveXS(@Valid @RequestBody ApproveDto<UpdateLngPngApproDto> dto){ public R approveXS(@Valid @RequestBody ApproveDto<UpdateLngPngApproDto> dto){
pngApproService.approve(dto); pngApproService.approveXS(dto);
return R.ok();
}
@ApiOperation(value = "销售审批")
@PostMapping(value = "/batchApproveXS")
@SaCheckPermission("pngAppro:batchApproveXS")
public R batchApproveXS(@Valid @RequestBody ApproveDto<UpdateLngPngApproDto> dto){
pngApproService.approveXS(dto);
return R.ok(); return R.ok();
} }
@ -82,7 +90,7 @@ public class PngApproController {
@PostMapping(value = "/approveGD") @PostMapping(value = "/approveGD")
@SaCheckPermission("pngAppro:approveGD") @SaCheckPermission("pngAppro:approveGD")
public R approveGD(@Valid @RequestBody ApproveDto<UpdateLngPngApproDto> dto){ public R approveGD(@Valid @RequestBody ApproveDto<UpdateLngPngApproDto> dto){
pngApproService.approve(dto); pngApproService.approveGD(dto);
return R.ok(); return R.ok();
} }
@ -90,7 +98,7 @@ public class PngApproController {
@PostMapping(value = "/approveJSZ") @PostMapping(value = "/approveJSZ")
@SaCheckPermission("pngAppro:approveJSZ") @SaCheckPermission("pngAppro:approveJSZ")
public R approveJSZ(@Valid @RequestBody ApproveDto<UpdateLngPngApproDto> dto){ public R approveJSZ(@Valid @RequestBody ApproveDto<UpdateLngPngApproDto> dto){
pngApproService.approve(dto); pngApproService.approveJSZ(dto);
return R.ok(); return R.ok();
} }

View File

@ -25,12 +25,13 @@ import java.util.List;
public interface LngPngApproMapper extends MPJBaseMapper<LngPngAppro>, BaseMapper<LngPngAppro> { public interface LngPngApproMapper extends MPJBaseMapper<LngPngAppro>, BaseMapper<LngPngAppro> {
@Select("SELECT a.id, a.rule_user_id, a.demand_org_id, a.date_plan," + @Select("SELECT a.id, a.rule_user_id, a.demand_org_id, a.date_plan," +
" (CASE a.date_plan - CURRENT_DATE " + " (CASE EXTRACT(DAY FROM a.date_plan - CURRENT_DATE)" +
" WHEN 0 THEN '当日' " + " WHEN 0 THEN '当日' " +
" WHEN 1 THEN '次日' " + " WHEN 1 THEN '次日' " +
" ELSE IF(a.date_plan - CURRENT_DATE < 0,'',a.date_plan - CURRENT_DATE || '日后') " + " ELSE IF(EXTRACT(DAY FROM a.date_plan - CURRENT_DATE) < 0,''," +
" END) days_sign" + " EXTRACT(DAY FROM a.date_plan - CURRENT_DATE) || '日后') " +
" a.cu_code, cu.cu_name, cu.cu_sname, a.ver_no, a.point_dely_code, sp.full_name AS poin_dely_name," + " END) days_sign," +
" a.cu_code, cu.cu_name, cu.cu_sname, a.ver_no, a.point_dely_code, sp.full_name AS point_dely_name," +
" a.qty_demand_gj, a.qty_demand_m3/10000 AS qty_demand_m3," + " a.qty_demand_gj, a.qty_demand_m3/10000 AS qty_demand_m3," +
" a.qty_sales_gj, a.qty_sales_m3/10000 AS qty_sales_m3," + " a.qty_sales_gj, a.qty_sales_m3/10000 AS qty_sales_m3," +
" a.rate_k, a.rate_mp, a.rate_s, k.k_name, a.alter_sign, dd_iud.name AS alter_name," + " a.rate_k, a.rate_mp, a.rate_s, k.k_name, a.alter_sign, dd_iud.name AS alter_name," +
@ -50,12 +51,13 @@ public interface LngPngApproMapper extends MPJBaseMapper<LngPngAppro>, BaseMappe
IPage<LngPngApproVo> queryPage(IPage<LngPngApproPageDto> page, @Param(Constants.WRAPPER) QueryWrapper<LngPngAppro> queryWrapper); IPage<LngPngApproVo> queryPage(IPage<LngPngApproPageDto> page, @Param(Constants.WRAPPER) QueryWrapper<LngPngAppro> queryWrapper);
@Select("SELECT a.*," + @Select("SELECT a.*," +
" (CASE a.date_plan - CURRENT_DATE " + " (CASE EXTRACT(DAY FROM a.date_plan - CURRENT_DATE)" +
" WHEN 0 THEN '当日' " + " WHEN 0 THEN '当日' " +
" WHEN 1 THEN '次日' " + " WHEN 1 THEN '次日' " +
" ELSE IF(a.date_plan - CURRENT_DATE < 0,'',a.date_plan - CURRENT_DATE || '日后') " + " ELSE IF(EXTRACT(DAY FROM a.date_plan - CURRENT_DATE) < 0,''," +
" EXTRACT(DAY FROM a.date_plan - CURRENT_DATE) || '日后') " +
" END) days_sign," + " END) days_sign," +
" cu.cu_name, cu.cu_sname, sp.full_name AS poin_dely_name," + " cu.cu_name, cu.cu_sname, sp.full_name AS point_dely_name," +
" k.k_name, dd_iud.name AS alter_name," + " k.k_name, dd_iud.name AS alter_name," +
" com.name AS com_name, dd_a.name as appro_name" + " com.name AS com_name, dd_a.name as appro_name" +
" FROM lng_png_appro a" + " FROM lng_png_appro a" +
@ -71,12 +73,13 @@ public interface LngPngApproMapper extends MPJBaseMapper<LngPngAppro>, BaseMappe
LngPngApproVo getOneById(@Param("id") Long id); LngPngApproVo getOneById(@Param("id") Long id);
@Select("SELECT a.*," + @Select("SELECT a.*," +
" (CASE a.date_plan - CURRENT_DATE " + " (CASE EXTRACT(DAY FROM a.date_plan - CURRENT_DATE)" +
" WHEN 0 THEN '当日' " + " WHEN 0 THEN '当日' " +
" WHEN 1 THEN '次日' " + " WHEN 1 THEN '次日' " +
" ELSE IF(a.date_plan - CURRENT_DATE < 0,'',a.date_plan - CURRENT_DATE || '日后') " + " ELSE IF(EXTRACT(DAY FROM a.date_plan - CURRENT_DATE) < 0,''," +
" EXTRACT(DAY FROM a.date_plan - CURRENT_DATE) || '日后') " +
" END) days_sign," + " END) days_sign," +
" cu.cu_name, cu.cu_sname, sp.full_name AS poin_dely_name," + " cu.cu_name, cu.cu_sname, sp.full_name AS point_dely_name," +
" k.k_name, dd_iud.name AS alter_name," + " k.k_name, dd_iud.name AS alter_name," +
" com.name AS com_name, dd_a.name as appro_name" + " com.name AS com_name, dd_a.name as appro_name" +
" FROM lng_png_appro a" + " FROM lng_png_appro a" +

View File

@ -27,7 +27,11 @@ public interface IPngApproService extends MPJBaseService<LngPngAppro>, MPJDeepSe
LngPngApproVo getInfoById(Long id); LngPngApproVo getInfoById(Long id);
void approve(@Valid ApproveDto<UpdateLngPngApproDto> dto); void approveXS(@Valid ApproveDto<UpdateLngPngApproDto> dto);
void approveGD(@Valid ApproveDto<UpdateLngPngApproDto> dto);
void approveJSZ(@Valid ApproveDto<UpdateLngPngApproDto> dto);
List<LngPngApproVo> compare(Long orgId); List<LngPngApproVo> compare(Long orgId);
} }

View File

@ -3,6 +3,7 @@ package com.xjrsoft.module.dayPlan.service.impl;
import cn.dev33.satoken.session.SaSession; import cn.dev33.satoken.session.SaSession;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.yulichang.base.MPJBaseServiceImpl; import com.github.yulichang.base.MPJBaseServiceImpl;
@ -34,6 +35,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
@ -93,41 +95,130 @@ public class PngApproServiceImpl extends MPJBaseServiceImpl<LngPngApproMapper, L
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void approve(ApproveDto<UpdateLngPngApproDto> dto) { public void approveXS(ApproveDto<UpdateLngPngApproDto> dto) {
UpdateLngPngApproDto data = dto.getData(); List<UpdateLngPngApproDto> data = dto.getData();
LngPngAppro lngPngAppro = this.baseMapper.selectById(data.getId()); if (CollectionUtils.isEmpty(data)) {
if(lngPngAppro == null) { throw new BusinessException(BusinessCode.of(10500,"请选择审批数据"));
throw new BusinessException(BusinessCode.of(10500,"找不到此数据"));
}
lngPngAppro.setQtySalesGj(data.getQtySalesGj());
lngPngAppro.setQtySalesM3(data.getQtySalesM3());
this.baseMapper.updateById(lngPngAppro);
for (UpdateLngPngApproPurDto lngPngApproPurDto : data.getLngPngApproPurList()) {
LngPngApproPur lngPngApproPur = lngPngApproPurMapper.selectById(lngPngApproPurDto.getId());
if(lngPngApproPur == null) {
throw new BusinessException(BusinessCode.of(10500,"找不到此数据"));
}
lngPngApproPur.setQtySalesGj(lngPngApproPurDto.getQtySalesGj());
lngPngApproPur.setQtySalesM3(lngPngApproPurDto.getQtySalesM3());
lngPngApproPur.setNote(lngPngApproPurDto.getNote());
lngPngApproPurMapper.updateById(lngPngApproPur);
} }
String sql = com.pictc.utils.StringUtils.format("{? = call pc_{0}.f_approval(?, ?, ?, ?, ?)}", String sql = com.pictc.utils.StringUtils.format("{? = call pc_{0}.f_approval(?, ?, ?, ?, ?)}",
"lng_png_appro"); "lng_png_appro");
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofLong(data.getId()));
params.add(JdbcParam.ofString("XS"));
params.add(JdbcParam.ofString(dto.getResult()));
params.add(JdbcParam.ofString(dto.getRemark()));
SaSession tokenSession = StpUtil.getTokenSession(); SaSession tokenSession = StpUtil.getTokenSession();
UserDto user = tokenSession.get(GlobalConstant.LOGIN_USER_INFO_KEY, new UserDto()); UserDto user = tokenSession.get(GlobalConstant.LOGIN_USER_INFO_KEY, new UserDto());
params.add(JdbcParam.ofLong(user.getId())); for (UpdateLngPngApproDto lngPngApproDto : data) {
JdbcTools.call(sql,params); LngPngAppro lngPngAppro = this.baseMapper.selectById(lngPngApproDto.getId());
String error = outParam.getStringValue(); if(lngPngAppro == null) {
if (com.pictc.utils.StringUtils.isNotEmpty(error)) { throw new BusinessException(BusinessCode.of(10500,"找不到此数据"));
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error)); }
if (CollectionUtils.isEmpty(lngPngApproDto.getLngPngApproPurList())) {
List<LngPngApproPur> list = lngPngApproPurMapper.selectList(new LambdaQueryWrapper<LngPngApproPur>()
.eq(LngPngApproPur::getApproId, lngPngApproDto.getId()));
if (CollectionUtils.isEmpty(list)) {
throw new BusinessException(BusinessCode.of(10500,"找不到上载点数据"));
}
BigDecimal qtySalesGjTotal = BigDecimal.ZERO;
BigDecimal qtySalesM3Total = BigDecimal.ZERO;
for (LngPngApproPur lngPngApproPur : list) {
lngPngApproPur.setQtySalesGj(lngPngApproPur.getQtyDemandGj());
lngPngApproPur.setQtySalesM3(lngPngApproPur.getQtyDemandM3());
lngPngApproPurMapper.updateById(lngPngApproPur);
qtySalesGjTotal = qtySalesGjTotal.add(lngPngApproPur.getQtySalesGj());
qtySalesM3Total = qtySalesM3Total.add(lngPngApproPur.getQtySalesM3());
}
lngPngAppro.setQtySalesGj(qtySalesGjTotal);
lngPngAppro.setQtySalesM3(qtySalesM3Total);
this.baseMapper.updateById(lngPngAppro);
} else {
lngPngAppro.setQtySalesGj(lngPngApproDto.getQtySalesGj());
lngPngAppro.setQtySalesM3(lngPngApproDto.getQtySalesM3());
this.baseMapper.updateById(lngPngAppro);
for (UpdateLngPngApproPurDto lngPngApproPurDto : lngPngApproDto.getLngPngApproPurList()) {
LngPngApproPur lngPngApproPur = lngPngApproPurMapper.selectById(lngPngApproPurDto.getId());
if(lngPngApproPur == null) {
throw new BusinessException(BusinessCode.of(10500,"找不到上载点数据"));
}
lngPngApproPur.setQtySalesGj(lngPngApproPurDto.getQtySalesGj());
lngPngApproPur.setQtySalesM3(lngPngApproPurDto.getQtySalesM3());
lngPngApproPur.setNote(lngPngApproPurDto.getNote());
lngPngApproPurMapper.updateById(lngPngApproPur);
}
}
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofLong(lngPngApproDto.getId()));
params.add(JdbcParam.ofString("XS"));
params.add(JdbcParam.ofString(dto.getResult()));
params.add(JdbcParam.ofString(dto.getRemark()));
params.add(JdbcParam.ofLong(user.getId()));
JdbcTools.call(sql,params);
String error = outParam.getStringValue();
if (com.pictc.utils.StringUtils.isNotEmpty(error)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void approveGD(ApproveDto<UpdateLngPngApproDto> dto) {
List<UpdateLngPngApproDto> data = dto.getData();
if (CollectionUtils.isEmpty(data)) {
throw new BusinessException(BusinessCode.of(10500,"请选择审批数据"));
}
String sql = com.pictc.utils.StringUtils.format("{? = call pc_{0}.f_approval_gd(?, ?, ?, ?, ?)}",
"lng_png_appro");
SaSession tokenSession = StpUtil.getTokenSession();
UserDto user = tokenSession.get(GlobalConstant.LOGIN_USER_INFO_KEY, new UserDto());
for (UpdateLngPngApproDto lngPngApproDto : data) {
LngPngAppro lngPngAppro = this.baseMapper.selectById(lngPngApproDto.getId());
if(lngPngAppro == null) {
throw new BusinessException(BusinessCode.of(10500,"找不到此数据"));
}
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofString(user.getStaCode()));
params.add(JdbcParam.ofLocalDateTime(lngPngAppro.getDatePlan()));
params.add(JdbcParam.ofString(dto.getResult()));
params.add(JdbcParam.ofString(dto.getRemark()));
params.add(JdbcParam.ofLong(user.getId()));
JdbcTools.call(sql,params);
String error = outParam.getStringValue();
if (com.pictc.utils.StringUtils.isNotEmpty(error)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void approveJSZ(ApproveDto<UpdateLngPngApproDto> dto) {
List<UpdateLngPngApproDto> data = dto.getData();
if (CollectionUtils.isEmpty(data)) {
throw new BusinessException(BusinessCode.of(10500,"请选择审批数据"));
}
String sql = com.pictc.utils.StringUtils.format("{? = call pc_{0}.f_approval_jsz(?, ?, ?, ?, ?)}",
"lng_png_appro");
SaSession tokenSession = StpUtil.getTokenSession();
UserDto user = tokenSession.get(GlobalConstant.LOGIN_USER_INFO_KEY, new UserDto());
for (UpdateLngPngApproDto lngPngApproDto : data) {
LngPngAppro lngPngAppro = this.baseMapper.selectById(lngPngApproDto.getId());
if(lngPngAppro == null) {
throw new BusinessException(BusinessCode.of(10500,"找不到此数据"));
}
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofString(user.getStaCode()));
params.add(JdbcParam.ofLocalDateTime(lngPngAppro.getDatePlan()));
params.add(JdbcParam.ofString(dto.getResult()));
params.add(JdbcParam.ofString(dto.getRemark()));
params.add(JdbcParam.ofLong(user.getId()));
JdbcTools.call(sql,params);
String error = outParam.getStringValue();
if (com.pictc.utils.StringUtils.isNotEmpty(error)) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
}
} }
} }
} }

View File

@ -14,7 +14,9 @@ import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil; import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.mdm.entity.LngBRegion; import com.xjrsoft.module.mdm.entity.LngBRegion;
import com.xjrsoft.module.mdm.service.ICountryRegionService; import com.xjrsoft.module.mdm.service.ICountryRegionService;
import com.xjrsoft.module.mdm.vo.LngBRegionVo;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -43,9 +45,11 @@ public class CountryRegionClientImpl implements ICountryRegionClient {
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngBRegionVo getTranById(@RequestParam("id")String code) {
LngBRegion region = countryRegionService.getByCode(code); return TenantUtil.ignoreR(()->{
return region!=null?region.getFullPath():null; LngBRegion region = countryRegionService.getByCode(code);
return Convert.convert(LngBRegionVo.class, region);
});
} }
} }

View File

@ -9,16 +9,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil; import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
import com.xjrsoft.module.mdm.entity.LngBBank;
import com.xjrsoft.module.mdm.entity.LngBCurrency; import com.xjrsoft.module.mdm.entity.LngBCurrency;
import com.xjrsoft.module.mdm.entity.LngBStationLng;
import com.xjrsoft.module.mdm.service.IBankService;
import com.xjrsoft.module.mdm.service.ICurrencyService; import com.xjrsoft.module.mdm.service.ICurrencyService;
import com.xjrsoft.module.mdm.service.ILNGStationService; import com.xjrsoft.module.mdm.vo.LngBCurrencyVo;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -33,23 +31,22 @@ public class CurrencyClientImpl implements ICurrencyClient {
private final ICurrencyService currencyService; private final ICurrencyService currencyService;
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
try {
TenantUtil.ignore(true);
List<LngBCurrency> list = currencyService.list();
return list.stream().collect(Collectors.toMap(LngBCurrency::getCode,LngBCurrency::getFullName));
}finally {
TenantUtil.clear();
}
}
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngBCurrencyVo getTranById(@RequestParam("id")String code) {
LngBCurrency currency = currencyService.getByCode(code); return TenantUtil.ignoreR(()->{
return currency!=null?currency.getFullName():null; LngBCurrency currency = currencyService.getByCode(code);
return Convert.convert(LngBCurrencyVo.class, currency);
});
}
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
return TenantUtil.ignoreR(()->{
List<LngBCurrency> list = currencyService.list();
return list.stream().collect(Collectors.toMap(LngBCurrency::getCode,LngBCurrency::getFullName));
});
} }

View File

@ -16,7 +16,9 @@ import com.xjrsoft.module.mdm.entity.LngBBank;
import com.xjrsoft.module.mdm.entity.LngBStationLng; import com.xjrsoft.module.mdm.entity.LngBStationLng;
import com.xjrsoft.module.mdm.service.IBankService; import com.xjrsoft.module.mdm.service.IBankService;
import com.xjrsoft.module.mdm.service.ILNGStationService; import com.xjrsoft.module.mdm.service.ILNGStationService;
import com.xjrsoft.module.mdm.vo.LngBBankVo;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -45,9 +47,12 @@ public class LngBankClientImpl implements ILngBankClient {
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngBBankVo getTranById(@RequestParam("id")String code) {
LngBBank bank = lngBankService.getByCode(code);
return bank!=null?bank.getFullName():null; return TenantUtil.ignoreR(()->{
LngBBank bank = lngBankService.getByCode(code);
return Convert.convert(LngBBankVo.class,bank);
});
} }
@Override @Override

View File

@ -13,7 +13,9 @@ import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil; import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.mdm.entity.LngBStationLng; import com.xjrsoft.module.mdm.entity.LngBStationLng;
import com.xjrsoft.module.mdm.service.ILNGStationService; import com.xjrsoft.module.mdm.service.ILNGStationService;
import com.xjrsoft.module.mdm.vo.LngBStationLngVo;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -28,23 +30,13 @@ public class LngStationClientImpl implements ILngStationClient {
private final ILNGStationService lngStationService; private final ILNGStationService lngStationService;
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
try {
TenantUtil.ignore(true);
List<LngBStationLng> list = lngStationService.list();
return list.stream().collect(Collectors.toMap(LngBStationLng::getCode,LngBStationLng::getFullName));
}finally {
TenantUtil.clear();
}
}
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngBStationLngVo getTranById(@RequestParam("id")String code) {
LngBStationLng region = lngStationService.getByCode(code); return TenantUtil.ignoreR(()->{
return region!=null?region.getFullName():null; LngBStationLng region = lngStationService.getByCode(code);
return Convert.convert(LngBStationLngVo.class, region);
});
} }
} }

View File

@ -1,9 +1,5 @@
package com.xjrsoft.module.sales.client; package com.xjrsoft.module.sales.client;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -13,7 +9,9 @@ import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil; import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.sales.entity.LngCustomer; import com.xjrsoft.module.sales.entity.LngCustomer;
import com.xjrsoft.module.sales.service.ICustomerService; import com.xjrsoft.module.sales.service.ICustomerService;
import com.xjrsoft.module.sales.vo.LngCustomerVo;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -28,23 +26,13 @@ public class CustomerClientImpl implements ICustomerClient {
private final ICustomerService customerService; private final ICustomerService customerService;
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
try {
TenantUtil.ignore(true);
List<LngCustomer> list = customerService.list();
return list.stream().collect(Collectors.toMap(LngCustomer::getCuCode,LngCustomer::getCuName));
}finally {
TenantUtil.clear();
}
}
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngCustomerVo getTranById(@RequestParam("id")String code) {
LngCustomer cu = customerService.getByCode(code); return TenantUtil.ignoreR(()->{
return cu!=null?cu.getCuName():null; LngCustomer cu = customerService.getByCode(code);
return Convert.convert(LngCustomerVo.class, cu);
});
} }
} }

View File

@ -13,7 +13,9 @@ import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil; import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.sales.entity.LngGradeSystem; import com.xjrsoft.module.sales.entity.LngGradeSystem;
import com.xjrsoft.module.sales.service.IGradeSystemService; import com.xjrsoft.module.sales.service.IGradeSystemService;
import com.xjrsoft.module.sales.vo.LngGradeSystemVo;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -28,23 +30,13 @@ public class GradeSystemClientImpl implements IGradeSystemClient {
private final IGradeSystemService gradeSystemService; private final IGradeSystemService gradeSystemService;
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
try {
TenantUtil.ignore(true);
List<LngGradeSystem> list = gradeSystemService.list();
return list.stream().collect(Collectors.toMap(e -> String.valueOf(e.getId()),LngGradeSystem::getGsName));
}finally {
TenantUtil.clear();
}
}
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngGradeSystemVo getTranById(@RequestParam("id")String code) {
LngGradeSystem gs = gradeSystemService.getById(code); return TenantUtil.ignoreR(()->{
return gs!=null?gs.getGsName():null; return Convert.convert(LngGradeSystemVo.class, gradeSystemService.getById(code));
});
} }
} }

View File

@ -13,7 +13,9 @@ import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil; import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.supplier.entity.LngSupplier; import com.xjrsoft.module.supplier.entity.LngSupplier;
import com.xjrsoft.module.supplier.service.ISupplierService; import com.xjrsoft.module.supplier.service.ISupplierService;
import com.xjrsoft.module.supplier.vo.LngSupplierVo;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -42,9 +44,11 @@ public class SupplierClientImpl implements ISupplierClient {
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngSupplierVo getTranById(@RequestParam("id")String code) {
LngSupplier su = supplierService.getByCode(code); return TenantUtil.ignoreR(()->{
return su!=null?su.getSuName():null; LngSupplier su = supplierService.getByCode(code);
return Convert.convert(LngSupplierVo.class, su);
});
} }
} }

View File

@ -0,0 +1,15 @@
package com.xjrsoft.test;
import java.util.Map;
import cn.hutool.json.JSONUtil;
public class JsonTest {
public static void main(String[] args) {
String json = "{\"name\":\"John\",\"age\":30,\"city\":\"New York\"}";
Map<String,Object> bean = JSONUtil.toBean(json, Map.class, true);
System.out.println(bean);
}
}