Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
d47e1c6f
由
张雷
编写于
2024-10-25 20:14:41 +0800
浏览文件
选项
浏览文件
标签
下载
差异文件
Merge remote-tracking branch 'origin/master' into master
2 个父辈
26b853ff
8b84e0e0
隐藏空白字符变更
内嵌
并排
正在显示
29 个修改的文件
包含
569 行增加
和
166 行删除
sk-base-common/src/main/java/com/skua/common/report/ReportViewUtil.java
sk-base-common/src/main/java/com/skua/modules/common/mapper/CommonSqlMapper.java
sk-base-common/src/main/java/com/skua/modules/common/mapper/xml/CommonSqlMapper.xml
sk-base-common/src/main/java/com/skua/modules/common/service/ICommonSqlService.java
sk-base-common/src/main/java/com/skua/modules/common/service/impl/CommonSqlServiceImpl.java
sk-base-common/src/main/java/com/skua/modules/common/vo/DateVO.java
sk-base-common/src/main/java/com/skua/tool/util/DateUtils.java
sk-module-biz/src/main/java/com/skua/modules/erp/controller/MaterialINController.java
sk-module-biz/src/main/java/com/skua/modules/erp/mapper/xml/DistributMaterialMapper.xml
sk-module-biz/src/main/java/com/skua/modules/erp/mapper/xml/ERPPurchaseContractMapper.xml
sk-module-biz/src/main/java/com/skua/modules/erp/service/IMaterialINService.java
sk-module-biz/src/main/java/com/skua/modules/erp/service/impl/DistributContractServiceImpl.java
sk-module-biz/src/main/java/com/skua/modules/erp/service/impl/ERPPurchaseContractServiceImpl.java
sk-module-biz/src/main/java/com/skua/modules/erp/service/impl/MaterialINServiceImpl.java
sk-module-biz/src/main/java/com/skua/modules/guest/util/DateUtil.java
sk-module-biz/src/main/java/com/skua/modules/quartz/util/BaseUtil.java
sk-module-biz/src/main/java/com/skua/modules/threedimensional/controller/JTDisplayScreenController.java
sk-module-biz/src/main/java/com/skua/modules/threedimensional/service/IJTDisplayScreenService.java
sk-module-biz/src/main/java/com/skua/modules/threedimensional/service/impl/JTDisplayScreenServiceImpl.java
sk-module-biz/src/main/java/com/skua/modules/threedimensional/vo/ProjectOperationInfoVO.java
sk-module-biz/src/main/java/com/skua/modules/threedimensional/vo/SysFactoryInfoVO.java
sk-module-datafill/src/main/java/com/skua/modules/dataAnalysis/service/impl/FactoryCenterServiceImpl.java
sk-module-datafill/src/main/java/com/skua/modules/report/vo/DataVO.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/entity/EquipmentInChild.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/entity/EquipmentOutChild.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/impl/EquipmentInServiceImpl.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/impl/EquipmentOutServiceImpl.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/vo/DrugConsumptionVO.java
sk-module-system/src/main/java/com/skua/config/mybatis/MybatisInterceptor.java
sk-base-common/src/main/java/com/skua/common/report/ReportViewUtil.java
查看文件 @
d47e1c6
...
...
@@ -217,17 +217,31 @@ public class ReportViewUtil {
return
sb
.
toString
();
}
/*****************************************************/
/***
* 构造填报报表视图:按照部门分组统计
* @param reportId 报表编号
* @param fields 查询字段
* @param startTime 开始时间
* @param endTime 结束时间
/**
* 构造填报报表视图,时间模糊搜索
* * </pre>
* * @param reportId 报表id
* * @param fields 查询字段
* * @param departIds 厂站集合
* * @param dataTime 开始时间
* * @param dataTime 结束时间
* @param operatorSign 运算符号 avg sum max min
* @return
*/
public
static
String
buildViewByStatistics
(
String
reportId
,
String
fields
,
String
startTime
,
String
endTime
)
{
public
static
String
buildViewLike
(
String
reportId
,
String
fields
,
String
departIds
,
String
startTime
,
String
endTime
,
String
operatorSign
)
{
//运算符号operatorSign
if
(
StringUtils
.
isEmpty
(
operatorSign
))
operatorSign
=
"sum"
;
String
inSqlPart
=
""
;
String
inItemSqlPart
=
""
;
if
(
StringUtils
.
isNotEmpty
(
departIds
)){
String
[]
departIdArray
=
departIds
.
split
(
","
);
for
(
String
departId
:
departIdArray
)
{
inSqlPart
=
inSqlPart
+
",'"
+
departId
+
"'"
;
}
inSqlPart
=
inSqlPart
.
substring
(
1
);
}
if
(!
StringUtils
.
isEmpty
(
fields
))
{
String
[]
fieldArray
=
fields
.
split
(
","
);
for
(
String
field
:
fieldArray
)
{
...
...
@@ -242,6 +256,7 @@ public class ReportViewUtil {
}
inItemSqlPart
=
inItemSqlPart
.
substring
(
1
);
}
JdbcTemplate
masterDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"master"
);
String
itemSql
=
"select item_code,id from f_report_item where report_id = '"
+
reportId
+
"' and required = 1 "
;
if
(!
StringUtils
.
isEmpty
(
inItemSqlPart
))
{
...
...
@@ -256,18 +271,27 @@ public class ReportViewUtil {
for
(
Map
<
String
,
Object
>
itemMap
:
itemList
)
{
itemCodes
=
itemCodes
+
",'"
+
itemMap
.
get
(
"item_code"
)+
"'"
;
itemIds
=
itemIds
+
",'"
+
itemMap
.
get
(
"id"
)+
"'"
;
sb
.
append
(
"sum
(if((`d`.`item_code` = '"
+
itemMap
.
get
(
"item_code"
)+
"'),`a`.`item_value`,NULL)) AS `"
+
itemMap
.
get
(
"item_code"
)+
"`,"
);
sb
.
append
(
operatorSign
+
"
(if((`d`.`item_code` = '"
+
itemMap
.
get
(
"item_code"
)+
"'),`a`.`item_value`,NULL)) AS `"
+
itemMap
.
get
(
"item_code"
)+
"`,"
);
}
if
(!
StringUtils
.
isEmpty
(
itemIds
))
{
itemIds
=
itemIds
.
substring
(
1
);
}
sb
.
append
(
"`a`.`depart_id` AS `depart_id` from (( "
);
sb
.
append
(
"`a`.`depart_id` AS `depart_id` from (( "
);
sb
.
append
(
"SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv WHERE 1=1 "
);
sb
.
append
(
"SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv v WHERE 1=1 "
);
if
(!
StringUtils
.
isEmpty
(
departIds
))
{
sb
.
append
(
" and depart_id in ("
+
inSqlPart
+
")"
);
}
if
(!
StringUtils
.
isEmpty
(
startTime
))
{
sb
.
append
(
"and data_time
>='"
+
startTime
+
"' and data_time<='"
+
endTime
+
"'
"
);
sb
.
append
(
"and data_time
>='"
+
startTime
+
"'
"
);
}
sb
.
append
(
"and reit_id in ("
+
itemIds
+
")) `a` left join `f_report_item` `d` on(`a`.`reit_id` = `d`.`id`)) where 1=1 group by `a`.`depart_id`)"
);
if
(!
StringUtils
.
isEmpty
(
endTime
))
{
sb
.
append
(
"and data_time <='"
+
endTime
+
"'"
);
}
sb
.
append
(
"and reit_id in ("
+
itemIds
+
")"
);
sb
.
append
(
") `a` left join `f_report_item` `d` on((`a`.`reit_id` = `d`.`id`))) where 1=1 group by `a`.`depart_id`)"
);
return
sb
.
toString
();
}
}
...
...
sk-base-common/src/main/java/com/skua/modules/common/mapper/CommonSqlMapper.java
查看文件 @
d47e1c6
...
...
@@ -27,11 +27,18 @@ public interface CommonSqlMapper {
Page
<
Map
<
String
,
Object
>>
queryWrapperForPage
(
Page
<?>
page
,
@Param
(
"sql"
)
String
sql
,
@Param
(
Constants
.
WRAPPER
)
QueryWrapper
<?>
queryWrapper
);
@Anonymous
List
<
Map
<
String
,
Object
>>
queryForList
(
@Param
(
"sql"
)
String
sql
);
List
<
Map
<
String
,
Object
>>
queryWrapperForList
(
@Param
(
"sql"
)
String
sql
,
@Param
(
Constants
.
WRAPPER
)
QueryWrapper
<?>
queryWrapper
);
String
queryForString
(
@Param
(
"sql"
)
String
sql
);
String
queryWrapperForString
(
@Param
(
"sql"
)
String
sql
,
@Param
(
Constants
.
WRAPPER
)
QueryWrapper
<?>
queryWrapper
);
Integer
update
(
@Param
(
"sql"
)
String
sql
);
Integer
updateWrapper
(
@Param
(
"tableName"
)
String
tableName
,
@Param
(
Constants
.
WRAPPER
)
UpdateWrapper
<?>
updateWrapper
);
...
...
sk-base-common/src/main/java/com/skua/modules/common/mapper/xml/CommonSqlMapper.xml
查看文件 @
d47e1c6
...
...
@@ -26,6 +26,14 @@
${sql} ${ew.customSqlSegment}
</select>
<select
id=
"queryForString"
resultType=
"java.lang.String"
>
${sql}
</select>
<select
id=
"queryWrapperForString"
resultType=
"java.lang.String"
parameterType=
"java.lang.String"
>
${sql} ${ew.customSqlSegment}
</select>
<update
id=
"update"
>
${sql}
</update>
...
...
sk-base-common/src/main/java/com/skua/modules/common/service/ICommonSqlService.java
查看文件 @
d47e1c6
...
...
@@ -28,6 +28,10 @@ public interface ICommonSqlService {
List
<
Map
<
String
,
Object
>>
queryWrapperForList
(
String
sql
,
QueryWrapper
<?>
queryWrapper
);
String
queryForString
(
String
sql
);
String
queryWrapperForString
(
String
sql
,
QueryWrapper
<?>
queryWrapper
);
Integer
update
(
String
sql
);
Integer
updateWrapper
(
String
tableName
,
UpdateWrapper
<?>
updateWrapper
);
...
...
sk-base-common/src/main/java/com/skua/modules/common/service/impl/CommonSqlServiceImpl.java
查看文件 @
d47e1c6
...
...
@@ -46,12 +46,23 @@ public class CommonSqlServiceImpl implements ICommonSqlService {
return
commonSqlMapper
.
queryForList
(
sql
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryWrapperForList
(
String
sql
,
QueryWrapper
<?>
queryWrapper
)
{
return
commonSqlMapper
.
queryWrapperForList
(
sql
,
queryWrapper
);
}
@Override
public
String
queryForString
(
String
sql
)
{
return
commonSqlMapper
.
queryForString
(
sql
);
}
@Override
public
String
queryWrapperForString
(
String
sql
,
QueryWrapper
<?>
queryWrapper
)
{
return
commonSqlMapper
.
queryWrapperForString
(
sql
,
queryWrapper
);
}
@Override
public
Integer
update
(
String
sql
)
{
return
commonSqlMapper
.
update
(
sql
);
}
...
...
sk-base-common/src/main/java/com/skua/modules/common/vo/DateVO.java
0 → 100644
查看文件 @
d47e1c6
package
com
.
skua
.
modules
.
common
.
vo
;
import
com.skua.core.util.DateUtils
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
@Data
public
class
DateVO
{
@ApiModelProperty
(
value
=
"去年(yyyy)"
)
private
int
lastYear
;
@ApiModelProperty
(
value
=
"去年(yyyy-MM)"
)
private
String
lastYearMonth
;
@ApiModelProperty
(
value
=
"去年(yyyy-MM-dd)"
)
private
String
lastYearStartDate
;
@ApiModelProperty
(
value
=
"去年(yyyy-MM-dd)"
)
private
String
lastYearEndDate
;
@ApiModelProperty
(
value
=
"上月(yyyy-MM)"
)
private
String
lastMonth
;
@ApiModelProperty
(
value
=
"上月(yyyy-MM-dd)"
)
private
String
lastMonthDay
;
@ApiModelProperty
(
value
=
"昨天"
)
private
String
yesterday
;
@ApiModelProperty
(
value
=
"当月(yyyy)"
)
private
int
nowYear
;
@ApiModelProperty
(
value
=
"当月(yyyy-MM)"
)
private
String
nowMonth
;
@ApiModelProperty
(
value
=
"当月(yyyy-MM-dd)"
)
private
String
nowMonthStartDate
;
@ApiModelProperty
(
value
=
"当月(yyyy-MM-dd)"
)
private
String
nowMonthEndDate
;
@ApiModelProperty
(
value
=
"当月(yyyy-MM-dd)"
)
private
String
nowYearStartDate
;
@ApiModelProperty
(
value
=
"当月(yyyy-MM-dd)"
)
private
String
nowYearEndDate
;
public
DateVO
(
String
currentDate
)
{
this
.
nowMonth
=
DateUtils
.
dateformat
(
currentDate
,
"yyyy-MM"
);
this
.
nowMonthStartDate
=
nowMonth
+
"-01"
;
this
.
nowMonthEndDate
=
nowMonth
+
"-31"
;
//this.lastYear = getYear(nowMonth,"yyyy-MM")-1;
//this.lastMonth = DateUtils.getLastMonthOfMonth(nowMonth);
nowYear
=
Integer
.
parseInt
(
DateUtils
.
dateformat
(
currentDate
,
"yyyy"
)
)
;
nowYearStartDate
=
nowYear
+
"-01-01"
;
nowYearEndDate
=
nowYear
+
"-12-31"
;
/* this.lastMonthStartTime = lastMonth+"-01";
this.lastMonthEndTime = lastMonth+"-31";
this.lastYearStartTime = lastYear+"-01";
this.lastYearEndTime = lastYear +"-31";*/
}
}
sk-base-common/src/main/java/com/skua/tool/util/DateUtils.java
查看文件 @
d47e1c6
package
com
.
skua
.
tool
.
util
;
import
com.skua.constant.BaseConstant
;
import
java.math.BigDecimal
;
import
java.text.ParseException
;
import
java.text.ParsePosition
;
import
java.text.SimpleDateFormat
;
import
java.time.DayOfWeek
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.YearMonth
;
import
java.time.format.DateTimeFormatter
;
...
...
sk-module-biz/src/main/java/com/skua/modules/erp/controller/MaterialINController.java
查看文件 @
d47e1c6
...
...
@@ -339,10 +339,12 @@ public class MaterialINController {
Result
<
MaterialINVO
>
result
=
new
Result
<
MaterialINVO
>();
try
{
materialINService
.
auditMaterialINVO
(
materialINVO
);
}
catch
(
Exception
e
)
{
log
.
error
(
"审批失败"
,
e
.
getMessage
());
result
.
setResult
(
materialINVO
);
result
.
setSuccess
(
true
);
}
catch
(
Exception
e
)
{
log
.
error
(
"审批失败"
,
e
.
getMessage
());
result
.
error500
(
"审批失败:"
+
e
.
getMessage
());
}
return
result
;
}
...
...
sk-module-biz/src/main/java/com/skua/modules/erp/mapper/xml/DistributMaterialMapper.xml
查看文件 @
d47e1c6
...
...
@@ -25,7 +25,9 @@
<!-- 校验货号是否唯一 -->
<select
id=
"checkGoodCodeAndDepartId"
resultType=
"java.lang.Integer"
>
select count(1) from erp_distribut_material
where good_code = #{goodCode} and depart_id = #{departId}
where good_code = #{goodCode}
<if
test=
"departId != null and departId !=''"
>
a and depart_id = #{departId}
</if>
</select>
...
...
sk-module-biz/src/main/java/com/skua/modules/erp/mapper/xml/ERPPurchaseContractMapper.xml
查看文件 @
d47e1c6
...
...
@@ -6,7 +6,7 @@
<select
id=
"getListByDistributId"
resultType=
"com.skua.modules.erp.entity.ERPPurchaseContract"
>
select pc.* from erp_purchase_contract pc where pc.id in (
select DISTINCT pm.contract_id from erp_purchase_material pm , erp_distribut_material dm
where
dm.good_code = dm.good_code and dm.contract_id = '1849328644967497730'
where
pm.good_code = dm.good_code and dm.contract_id = #{distributContractId}
)
and pc.status = 3
order by pc.create_time desc
...
...
sk-module-biz/src/main/java/com/skua/modules/erp/service/IMaterialINService.java
查看文件 @
d47e1c6
...
...
@@ -17,7 +17,7 @@ public interface IMaterialINService extends IService<MaterialIN> {
* 审核药剂入库单
* @param materialINVO
*/
String
auditMaterialINVO
(
MaterialINVO
materialINVO
);
String
auditMaterialINVO
(
MaterialINVO
materialINVO
)
throws
Exception
;
/***
* 列表查询到货记录列表
...
...
sk-module-biz/src/main/java/com/skua/modules/erp/service/impl/DistributContractServiceImpl.java
查看文件 @
d47e1c6
...
...
@@ -13,6 +13,7 @@ import com.skua.modules.erp.service.IDistributContractService;
import
com.skua.modules.erp.vo.DistributContractVO
;
import
com.skua.modules.erp.vo.PurchasePlanVO
;
import
com.skua.modules.system.mapper.SysDepartMapper
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -47,26 +48,34 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM
String
goodsCode
=
checkSameGoodCode
(
distributContractVO
.
getMaterialList
());
if
(
goodsCode
!=
null
){
errMsg
=
"操作失败,货号["
+
goodsCode
+
"]重复!"
;
return
errMsg
;
}
int
count
=
0
;
if
(!
distributContractVO
.
getContractCode
().
equals
(
oldContractCode
)){
if
(
StringUtils
.
isNotEmpty
(
oldContractCode
))
{
if
(!
oldContractCode
.
equals
(
distributContractVO
.
getContractCode
()))
{
//修改
count
=
this
.
baseMapper
.
checkContractCode
(
distributContractVO
.
getContractCode
()
);
if
(
count
>
0
){
errMsg
=
"合同编号["
+
distributContractVO
.
getContractCode
()+
"]重复"
;
}
}
}
else
{
//新增
count
=
this
.
baseMapper
.
checkContractCode
(
distributContractVO
.
getContractCode
()
);
if
(
count
>
checkCount
){
if
(
count
>
0
){
errMsg
=
"合同编号["
+
distributContractVO
.
getContractCode
()+
"]重复"
;
}
}
if
(
errMsg
==
null
&&
distributContractVO
.
getMaterialList
()
!=
null
&&
!
distributContractVO
.
getMaterialList
().
isEmpty
()){
if
(
distributContractVO
.
getMaterialList
()
!=
null
&&
!
distributContractVO
.
getMaterialList
().
isEmpty
()){
for
(
DistributMaterial
material
:
distributContractVO
.
getMaterialList
()){
//根据deptid与goodscode校验
count
=
checkGoodCodeAndDepartId
(
material
.
getGoodCode
(),
distributContractVO
.
getDepartId
()
);
if
(
count
>
0
){
count
=
checkGoodCodeAndDepartId
(
material
.
getGoodCode
(),
null
);
if
(
count
>
checkCount
){
errMsg
=
"所属厂站["
+
departMapper
.
selectById
(
distributContractVO
.
getDepartId
()).
getDepartName
()+
"]下的货号["
+
material
.
getGoodCode
()+
"]已经分销过!"
;
break
;
}
}
}
return
errMsg
;
}
...
...
sk-module-biz/src/main/java/com/skua/modules/erp/service/impl/ERPPurchaseContractServiceImpl.java
查看文件 @
d47e1c6
...
...
@@ -51,17 +51,25 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr
String
result
=
null
;
int
count
=
0
;
if
(!
purchaseContractVO
.
getContractCode
().
equals
(
oldContractCode
)){
if
(
StringUtils
.
isNotEmpty
(
oldContractCode
)){
if
(
!
oldContractCode
.
equals
(
purchaseContractVO
.
getContractCode
()
)){
count
=
purchaseMaterialMapper
.
checkContractCode
(
purchaseContractVO
.
getContractCode
()
);
if
(
count
>
0
){
result
=
"合同编号["
+
purchaseContractVO
.
getContractCode
()+
"]重复"
;
return
result
;
}
}
}
else
{
count
=
purchaseMaterialMapper
.
checkContractCode
(
purchaseContractVO
.
getContractCode
()
);
if
(
count
>
checkCount
){
if
(
count
>
0
){
result
=
"合同编号["
+
purchaseContractVO
.
getContractCode
()+
"]重复"
;
return
result
;
}
}
if
(
result
==
null
&&
purchaseContractVO
.
getMaterialList
()!=
null
&&
!
purchaseContractVO
.
getMaterialList
().
isEmpty
()){
if
(
purchaseContractVO
.
getMaterialList
()!=
null
&&
!
purchaseContractVO
.
getMaterialList
().
isEmpty
()){
for
(
PurchaseMaterial
purchaseMaterial
:
purchaseContractVO
.
getMaterialList
()){
if
(
StringUtils
.
isNotEmpty
(
purchaseMaterial
.
getGoodCode
())){
count
=
purchaseMaterialMapper
.
checkGoodCode
(
purchaseMaterial
.
getId
()
,
purchaseMaterial
.
getGoodCode
());
count
=
purchaseMaterialMapper
.
checkGoodCode
(
null
,
purchaseMaterial
.
getGoodCode
());
if
(
count
>
checkCount
){
result
=
"校验失败,货号[ "
+
purchaseMaterial
.
getGoodCode
()+
" ]已经存在!"
;
break
;
...
...
sk-module-biz/src/main/java/com/skua/modules/erp/service/impl/MaterialINServiceImpl.java
查看文件 @
d47e1c6
...
...
@@ -6,20 +6,27 @@ import com.skua.core.context.BaseContextHandler;
import
com.skua.core.context.SpringContextUtils
;
import
com.skua.modules.equipment.dto.EquipmentInDTO
;
import
com.skua.modules.equipment.dto.EquipmentOutDTO
;
import
com.skua.modules.equipment.entity.EquipmentIn
;
import
com.skua.modules.equipment.entity.EquipmentInChild
;
import
com.skua.modules.equipment.entity.EquipmentOutChild
;
import
com.skua.modules.equipment.service.IEquipmentInService
;
import
com.skua.modules.equipment.service.IEquipmentOutService
;
import
com.skua.modules.erp.entity.ApproveRecord
;
import
com.skua.modules.erp.entity.ERPPurchaseContract
;
import
com.skua.modules.erp.entity.MaterialIN
;
import
com.skua.modules.erp.mapper.ApproveRecordMapper
;
import
com.skua.modules.erp.mapper.ERPPurchaseContractMapper
;
import
com.skua.modules.erp.mapper.MaterialINMapper
;
import
com.skua.modules.erp.service.IERPPurchaseContractService
;
import
com.skua.modules.erp.service.IMaterialINService
;
import
com.skua.modules.erp.vo.ArrivalRecordExcelExportVO
;
import
com.skua.modules.erp.vo.MaterialINVO
;
import
com.skua.modules.guest.util.DateUtil
;
import
com.skua.modules.quartz.util.BaseUtil
;
import
com.skua.modules.supplies.entity.SuppliesWarehouse
;
import
com.skua.modules.supplies.service.ISuppliesWarehouseService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.hibernate.service.spi.ServiceException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
...
...
@@ -41,6 +48,8 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
@Resource
private
ApproveRecordMapper
recordMapper
;
@Autowired
private
IERPPurchaseContractService
purchaseContractService
;
@Autowired
private
IEquipmentInService
equipmentInService
;
@Autowired
private
IEquipmentOutService
equipmentOutService
;
...
...
@@ -52,7 +61,7 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
* @param materialINVO
*/
@Transactional
public
String
auditMaterialINVO
(
MaterialINVO
materialINVO
){
public
String
auditMaterialINVO
(
MaterialINVO
materialINVO
)
throws
Exception
{
boolean
inAndOutStock
=
false
;
String
errMsg
=
null
;
QueryWrapper
<
SuppliesWarehouse
>
queryWrapper
=
new
QueryWrapper
<
SuppliesWarehouse
>();
...
...
@@ -68,32 +77,29 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
return
"所属厂站["
+
departName
+
"]下没有找到仓库信息!"
;
}
//保存
MaterialIN
materialINTemp
=
this
.
baseMapper
.
selectById
(
materialINVO
.
getId
());
//purchasePlan.getApproveState() 审批状态 1通过2不通过
if
(
"1"
.
equals
(
materialINVO
.
getApproveState
()
)){
materialIN
VO
.
setAuditStatus
(
"3"
);
materialIN
Temp
.
setAuditStatus
(
"3"
);
inAndOutStock
=
true
;
}
if
(
"2"
.
equals
(
materialINVO
.
getApproveState
()
)){
materialIN
VO
.
setAuditStatus
(
"2"
);
materialIN
Temp
.
setAuditStatus
(
"2"
);
}
this
.
baseMapper
.
updateById
(
materialINVO
)
;
//审批记录
ApproveRecord
record
=
new
ApproveRecord
(
"YJIN"
,
materialINVO
.
getApplyUser
(),
materialINVO
.
getId
(),
BaseContextHandler
.
getUserId
(),
materialINVO
.
getApproveMessage
(),
materialINVO
.
getApproveState
());
recordMapper
.
insert
(
record
)
;
// 审核通过,生成入库单据、物料单
if
(
inAndOutStock
){
try
{
//出库
syncEquipmentOut
(
materialINVO
);
//入库
syncEquipmentIn
(
materialINVO
,
inWarehouseId
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
//出库
errMsg
=
syncEquipmentOut
(
materialINTemp
);
//入库
errMsg
=
syncEquipmentIn
(
materialINTemp
,
inWarehouseId
);
}
this
.
baseMapper
.
updateById
(
materialINTemp
)
;
//审批记录
ApproveRecord
record
=
new
ApproveRecord
(
"YJIN"
,
materialINVO
.
getApplyUser
(),
materialINVO
.
getId
(),
BaseContextHandler
.
getUserId
(),
materialINVO
.
getApproveMessage
(),
materialINVO
.
getApproveState
());
recordMapper
.
insert
(
record
)
;
return
errMsg
;
}
...
...
@@ -130,12 +136,55 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
* 出库
* @return
*/
public
int
syncEquipmentOut
(
MaterialINVO
materialINVO
){
public
String
syncEquipmentOut
(
MaterialIN
materialINTemp
)
throws
Exception
{
String
errMsg
=
null
;
EquipmentOutDTO
equipmentOutDTO
=
new
EquipmentOutDTO
();
try
{
ERPPurchaseContract
erpPurchaseContract
=
purchaseContractService
.
getById
(
materialINTemp
.
getPurchaseContractId
());
if
(
erpPurchaseContract
!=
null
){
if
(
StringUtils
.
isNotEmpty
(
erpPurchaseContract
.
getEquipmentInId
())){
EquipmentIn
equipmentIn
=
equipmentInService
.
getById
(
erpPurchaseContract
.
getEquipmentInId
()
);
equipmentOutDTO
.
setDepartId
(
equipmentIn
.
getDepartId
()
)
;
equipmentOutDTO
.
setOutType
(
"9"
);
//
equipmentOutDTO
.
setRemark
(
materialINTemp
.
getRemark
()
);
equipmentOutDTO
.
setChooseTime
(
BaseUtil
.
getCurrentDate
());
//经办时间
equipmentOutDTO
.
setUseBy
(
BaseContextHandler
.
getUserId
()
);
//使用人
equipmentOutDTO
.
setOutDate
(
BaseUtil
.
getCurrentDate
()
);
equipmentOutDTO
.
setInventoryUpdateTimeEnd
(
BaseUtil
.
getCurrentDate
());
equipmentOutDTO
.
setSuppliesWarehouseId
(
equipmentIn
.
getSuppliesWarehouseId
()
);
// this.suppliesWarehouseId = suppliesWarehouseId;//所属仓库
//this.outOrder = outOrder;
// this.recipient = recipient;//领用人
equipmentOutDTO
.
setRecipient
(
materialINTemp
.
getReceiver
());
//收货人,领用人
EquipmentOutChild
equipmentOutChild
=
new
EquipmentOutChild
();
equipmentOutChild
.
setSparepartId
(
materialINTemp
.
getSparepartId
()
);
//
equipmentOutChild
.
setOutNum
(
new
BigDecimal
(
materialINTemp
.
getMaterialNum
()
)
)
;
//出库数量
equipmentOutChild
.
setTotalPrice
(
new
BigDecimal
(
materialINTemp
.
getDistributTotalPrice
()
)
);
//总价格
equipmentOutChild
.
setBatchNum
(
materialINTemp
.
getGoodCode
()
);
//批次号
List
<
EquipmentOutChild
>
outChildList
=
new
ArrayList
<
EquipmentOutChild
>();
outChildList
.
add
(
equipmentOutChild
);
equipmentOutDTO
.
setEquipmentOutChildList
(
outChildList
);
// 创建出库单
equipmentOutService
.
saveEquipmentOut
(
equipmentOutDTO
);
materialINTemp
.
setEquipmentOutId
(
equipmentOutDTO
.
getId
());
}
else
{
throw
new
ServiceException
(
"未找到统购合同的入库信息"
);
}
}
else
{
throw
new
ServiceException
(
"统购合同不存在"
);
}
}
catch
(
ServiceException
e
){
e
.
printStackTrace
();
throw
new
ServiceException
(
"入库失败:"
+
e
.
getMessage
());
}
//equipmentOutService.saveEquipmentOut(equipmentOutDTO);
return
1
;
return
errMsg
;
}
/***
...
...
@@ -143,7 +192,8 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
* @param materialINVO
* @return
*/
public
int
syncEquipmentIn
(
MaterialINVO
materialINVO
,
String
inWarehouseId
)
throws
Exception
{
public
String
syncEquipmentIn
(
MaterialIN
materialINVO
,
String
inWarehouseId
)
throws
Exception
{
String
errMsg
=
null
;
EquipmentInDTO
equipmentInDTO
=
new
EquipmentInDTO
();
// EquipmentIn equipmentIn = new EquipmentIn();
//入库类型
...
...
@@ -152,7 +202,7 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
equipmentInDTO
.
setSuppliesWarehouseId
(
inWarehouseId
)
;
//入库仓库
equipmentInDTO
.
setInDate
(
DateUtil
.
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
equipmentInDTO
.
setUseBy
(
BaseContextHandler
.
getUserId
()
)
;
//经办人
equipmentInDTO
.
setUseBy
(
materialINVO
.
getReceiver
()
)
;
//经办人(收货人)
equipmentInDTO
.
setChooseTime
(
DateUtil
.
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
)
);
//经办时间
equipmentInDTO
.
setRemark
(
materialINVO
.
getRemark
()
);
//备注
...
...
@@ -160,12 +210,12 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
EquipmentInChild
equipmentInChild
=
new
EquipmentInChild
();
//
equipmentInChild
.
setSparepartId
(
materialINVO
.
getSparepartId
());
//物料编号
equipmentInChild
.
setInNum
(
new
BigDecimal
(
materialINVO
.
getMaterialNum
()));
//物料数量
equipmentInChild
.
setBatchNum
(
materialINVO
.
getGoodCode
()
)
;
//批次号
equipmentInChildrenList
.
add
(
equipmentInChild
)
;
equipmentInDTO
.
setEquipmentInChildList
(
equipmentInChildrenList
);
//调用接口入库
equipmentInService
.
saveEquipmentIn
(
equipmentInDTO
)
;
...
...
@@ -175,9 +225,10 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
if(erpPurchaseContract == null ){
throw new Exception("采购合同记录不存在");
}*/
materialINVO
.
setEquipmentInId
(
equipmentInDTO
.
getId
()
)
;
//记录入库单号
materialINVO
.
setEquipmentInId
(
equipmentInDTO
.
getId
()
)
;
//记录入库编号
materialINVO
.
setInOrder
(
equipmentInDTO
.
getInOrder
()
)
;
// 入库单号
log
.
debug
(
"记录入库单号{"
+
equipmentInDTO
.
getId
()+
"},入库单号:"
+
equipmentInDTO
.
getInOrder
());
this
.
baseMapper
.
updateById
(
materialINVO
)
;
return
1
;
return
errMsg
;
}
}
...
...
sk-module-biz/src/main/java/com/skua/modules/guest/util/DateUtil.java
查看文件 @
d47e1c6
...
...
@@ -310,4 +310,41 @@ public class DateUtil {
}
return
date
;
}
/**
* 格式化
* @param date
* @param format
* @return
*/
public
static
String
dateformat
(
String
date
,
String
format
)
{
SimpleDateFormat
sformat
=
new
SimpleDateFormat
(
format
);
Date
_date
=
null
;
try
{
_date
=
sformat
.
parse
(
date
);
}
catch
(
ParseException
var5
)
{
var5
.
printStackTrace
();
}
return
sformat
.
format
(
_date
);
}
/***
* 两个时间差
* @param date1
* @param date2
* @return
*/
public
static
int
differenceTime
(
String
date1
,
String
date2
){
int
daysDifference
=
1
;
try
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
// 计算两个日期之间的差值
daysDifference
=
org
.
apache
.
commons
.
lang3
.
time
.
DateUtils
.
toCalendar
(
sdf
.
parse
(
date2
)).
get
(
Calendar
.
DAY_OF_YEAR
)
-
org
.
apache
.
commons
.
lang3
.
time
.
DateUtils
.
toCalendar
(
sdf
.
parse
(
date1
)).
get
(
Calendar
.
DAY_OF_YEAR
);
// 直接计算天数差值
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
daysDifference
;
}
}
...
...
sk-module-biz/src/main/java/com/skua/modules/quartz/util/BaseUtil.java
查看文件 @
d47e1c6
...
...
@@ -14,6 +14,17 @@ import java.util.regex.Matcher;
import
java.util.regex.Pattern
;
public
class
BaseUtil
{
public
static
String
dateformat
(
String
date
,
String
format
)
{
SimpleDateFormat
sformat
=
new
SimpleDateFormat
(
format
);
Date
_date
=
null
;
try
{
_date
=
sformat
.
parse
(
date
);
}
catch
(
ParseException
var5
)
{
var5
.
printStackTrace
();
}
return
sformat
.
format
(
_date
);
}
/**
* 保留两位小数方法
*
...
...
@@ -419,6 +430,8 @@ public class BaseUtil {
return
calendar
.
get
(
Calendar
.
SECOND
);
}
/**
* 过滤html标签
* @param htmlStr
...
...
sk-module-biz/src/main/java/com/skua/modules/threedimensional/controller/JTDisplayScreenController.java
查看文件 @
d47e1c6
...
...
@@ -23,12 +23,12 @@ public class JTDisplayScreenController {
@Autowired
private
IJTDisplayScreenService
displayScreenService
;
@AutoLog
(
value
=
"厂站
记录
"
)
@ApiOperation
(
value
=
"厂长
列表"
,
notes
=
"厂长
列表"
)
@AutoLog
(
value
=
"厂站
地图列表
"
)
@ApiOperation
(
value
=
"厂长
地图列表"
,
notes
=
"厂长地图
列表"
)
@GetMapping
(
value
=
"/factoryList"
)
public
Result
<
List
<
SysFactoryInfoVO
>>
factoryList
(
String
time
)
{
public
Result
<
List
<
SysFactoryInfoVO
>>
factoryList
()
{
Result
<
List
<
SysFactoryInfoVO
>>
result
=
new
Result
<>();
List
<
SysFactoryInfoVO
>
list
=
displayScreenService
.
getFactoryList
(
time
);
List
<
SysFactoryInfoVO
>
list
=
displayScreenService
.
getFactoryList
();
result
.
setResult
(
list
);
return
result
;
}
...
...
sk-module-biz/src/main/java/com/skua/modules/threedimensional/service/IJTDisplayScreenService.java
查看文件 @
d47e1c6
package
com
.
skua
.
modules
.
threedimensional
.
service
;
import
com.skua.modules.threedimensional.vo.ProjectOperationInfoVO
;
import
com.skua.modules.threedimensional.vo.SysFactoryInfoVO
;
import
java.util.List
;
/**
* 对外展示集团大屏
*/
public
interface
IJTDisplayScreenService
{
/***
* 厂站列表
* @param time
* 厂站列表 以及出水量统计
* @return
*/
List
<
SysFactoryInfoVO
>
getFactoryList
(
String
time
);
List
<
SysFactoryInfoVO
>
getFactoryList
(
);
/**
*对外展示集团大屏 : 项目运营情况
* @return
*/
ProjectOperationInfoVO
getProjectOperationInfo
();
}
...
...
sk-module-biz/src/main/java/com/skua/modules/threedimensional/service/impl/JTDisplayScreenServiceImpl.java
查看文件 @
d47e1c6
...
...
@@ -2,13 +2,25 @@ package com.skua.modules.threedimensional.service.impl;
import
com.skua.common.report.ReportViewUtil
;
import
com.skua.core.context.SpringContextUtils
;
import
com.skua.core.util.ConvertUtils
;
import
com.skua.core.util.DateUtils
;
import
com.skua.modules.common.mapper.CommonSqlMapper
;
import
com.skua.modules.common.service.ICommonSqlService
;
import
com.skua.modules.common.vo.DateVO
;
import
com.skua.modules.guest.util.DateUtil
;
import
com.skua.modules.threedimensional.service.IJTDisplayScreenService
;
import
com.skua.modules.threedimensional.vo.ProjectOperationInfoVO
;
import
com.skua.modules.threedimensional.vo.SysFactoryInfoVO
;
import
com.skua.tool.util.DigitalUtils
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -16,32 +28,83 @@ import java.util.List;
*/
@Service
public
class
JTDisplayScreenServiceImpl
implements
IJTDisplayScreenService
{
@Autowired
private
ICommonSqlService
commonSqlService
;
private
static
String
view2119
=
"2119ecbf53a1d2d0708258ff67cfd9e1"
;
/***
*
*
厂站列表 以及出水量统计
* @return
*/
public
List
<
SysFactoryInfoVO
>
getFactoryList
(
String
time
){
public
List
<
SysFactoryInfoVO
>
getFactoryList
(
){
List
<
SysFactoryInfoVO
>
factoryInfoVOList
=
null
;
String
startDate
=
time
+
"-01"
;
String
endDate
=
time
+
"-31"
;;
String
departId
=
null
;
Map
<
String
,
SysFactoryInfoVO
>
factoryInfoMap
=
new
HashMap
<>();
SysFactoryInfoVO
factoryInfoVO
=
null
;
String
yesterday
=
DateUtils
.
getYesterday
();
String
lastDay
=
DateUtils
.
getLastDay
();
//昨天
String
currentDate
=
DateUtil
.
getCurrentDate
();
//今天
DateVO
dateVO
=
new
DateVO
(
DateUtil
.
getCurrentDate
()
);
//时间差
int
differenceTime
=
DateUtil
.
differenceTime
(
dateVO
.
getNowYearStartDate
(),
currentDate
);
//主库数据源
JdbcTemplate
masterDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"master"
);
//
String
factorySql
=
"select fi.id,fi.depart_id,d.depart_name, fi.pro_longitude,fi.pro_latitude from sys_factory_info fi ,sys_depart d where fi.depart_id = d.id and d.depart_type =1"
;
List
<
Map
<
String
,
Object
>>
dataList
=
masterDB
.
queryForList
(
factorySql
);
for
(
Map
<
String
,
Object
>
dataMap
:
dataList
)
{
// resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title")));
factoryInfoVO
=
new
SysFactoryInfoVO
(
dataMap
.
get
(
"id"
)+
""
,
dataMap
.
get
(
"depart_id"
).
toString
(),
dataMap
.
get
(
"depart_name"
).
toString
(),
dataMap
.
get
(
"pro_longitude"
).
toString
(),
dataMap
.
get
(
"pro_latitude"
).
toString
());
factoryInfoMap
.
put
(
factoryInfoVO
.
getDepartId
(),
factoryInfoVO
);
}
//查询部门集合
String
departIdSql
=
"select GROUP_CONCAT(fi.depart_id ) from sys_factory_info fi ,sys_depart d where fi.depart_id = d.id and d.depart_type =1 "
;
String
departIds
=
null
;
String
dataViewName2119
=
ReportViewUtil
.
buildViewLike
(
view2119
,
"CSL"
,
departIds
,
startDate
,
endDate
);
System
.
out
.
println
(
"********************************************"
);
System
.
out
.
println
(
dataViewName2119
);
String
departIds
=
masterDB
.
queryForObject
(
departIdSql
,
String
.
class
);
//主库数据源
JdbcTemplate
masterDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"master"
);
//昨天处理水量(m³)
String
dataViewName2119
=
ReportViewUtil
.
buildViewLike
(
view2119
,
"CSL"
,
departIds
,
lastDay
,
lastDay
);
//depart_id CSL
dataList
=
masterDB
.
queryForList
(
dataViewName2119
);
for
(
Map
<
String
,
Object
>
dataMap
:
dataList
)
{
factoryInfoVO
=
factoryInfoMap
.
get
(
dataMap
.
get
(
"depart_id"
).
toString
());
if
(
factoryInfoVO
!=
null
)
factoryInfoVO
.
setCsl_lastDay
(
dataMap
.
get
(
"CSL"
).
toString
()
)
;
// resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title")));
}
//本月处理水量(m³)
dataViewName2119
=
ReportViewUtil
.
buildViewLike
(
view2119
,
"CSL"
,
departIds
,
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
dataList
=
masterDB
.
queryForList
(
dataViewName2119
);
for
(
Map
<
String
,
Object
>
dataMap
:
dataList
)
{
factoryInfoVO
=
factoryInfoMap
.
get
(
dataMap
.
get
(
"depart_id"
).
toString
());
if
(
factoryInfoVO
!=
null
)
factoryInfoVO
.
setCsl_month
(
dataMap
.
get
(
"CSL"
).
toString
()
)
;
// resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title")));
}
//本年处理水量(万m³)
dataViewName2119
=
ReportViewUtil
.
buildViewLike
(
view2119
,
"CSL"
,
departIds
,
dateVO
.
getNowYearStartDate
(),
currentDate
);
dataList
=
masterDB
.
queryForList
(
dataViewName2119
);
for
(
Map
<
String
,
Object
>
dataMap
:
dataList
)
{
factoryInfoVO
=
factoryInfoMap
.
get
(
dataMap
.
get
(
"depart_id"
).
toString
());
if
(
factoryInfoVO
!=
null
){
factoryInfoVO
.
setCsl_year
(
dataMap
.
get
(
"CSL"
).
toString
()
)
;
factoryInfoVO
.
setCsl_avg_day
(
DigitalUtils
.
division
(
dataMap
.
get
(
"CSL"
).
toString
()
,
differenceTime
+
""
)
);
}
// resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title")));
}
factoryInfoVOList
=
new
ArrayList
(
factoryInfoMap
.
values
());
return
factoryInfoVOList
;
}
String
sql
=
"select "
+
" sum(v1.CSL)/10000 "
+
" from "
+
dataViewName2119
+
" v1 "
;
/**
*对外展示集团大屏 : 项目运营情况
* @return
*/
public
ProjectOperationInfoVO
getProjectOperationInfo
(){
ProjectOperationInfoVO
projectOperationInfoVO
=
new
ProjectOperationInfoVO
();
return
factoryInfoVOList
;
return
projectOperationInfoVO
;
}
}
...
...
sk-module-biz/src/main/java/com/skua/modules/threedimensional/vo/ProjectOperationInfoVO.java
0 → 100644
查看文件 @
d47e1c6
package
com
.
skua
.
modules
.
threedimensional
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* 对外展示集团大屏
*/
@Data
@ApiModel
(
value
=
"对外展示集团大屏:项目运营情况"
,
description
=
"对外展示集团大屏:项目运营情况"
)
public
class
ProjectOperationInfoVO
{
@ApiModelProperty
(
value
=
"水厂数"
)
private
String
departCount
;
@ApiModelProperty
(
value
=
"污水处理能力"
)
private
String
wsclnl
;
@ApiModelProperty
(
value
=
"月产水量"
)
private
String
ycsl
;
@ApiModelProperty
(
value
=
"水质综合达标率"
)
private
String
szzhdbl
;
@ApiModelProperty
(
value
=
"运行负荷率"
)
private
String
yxfhl
;
@ApiModelProperty
(
value
=
"污泥含水率"
)
private
String
wnhsl
;
}
sk-module-biz/src/main/java/com/skua/modules/threedimensional/vo/SysFactoryInfoVO.java
查看文件 @
d47e1c6
...
...
@@ -15,6 +15,9 @@ public class SysFactoryInfoVO {
private
String
id
;
@ApiModelProperty
(
value
=
"水厂名称"
)
private
String
departId
;
@ApiModelProperty
(
value
=
"水厂名称"
)
private
String
departName
;
@ApiModelProperty
(
value
=
"经度"
)
...
...
@@ -35,4 +38,15 @@ public class SysFactoryInfoVO {
@ApiModelProperty
(
value
=
"本年处理水量"
)
private
String
csl_year
;
public
SysFactoryInfoVO
()
{
}
public
SysFactoryInfoVO
(
String
id
,
String
departId
,
String
departName
,
String
proLongitude
,
String
proLatitude
)
{
this
.
id
=
id
;
this
.
departId
=
departId
;
this
.
departName
=
departName
;
this
.
proLongitude
=
proLongitude
;
this
.
proLatitude
=
proLatitude
;
}
}
...
...
sk-module-datafill/src/main/java/com/skua/modules/dataAnalysis/service/impl/FactoryCenterServiceImpl.java
查看文件 @
d47e1c6
...
...
@@ -48,7 +48,7 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
List
<
WaterQualityMonitoringDetailVO
>
list
=
new
ArrayList
<>();
Map
<
String
,
Object
>
monitorTagMap
=
new
HashMap
<
String
,
Object
>();
QueryWrapper
<
SysMonitorMetricInfo
>
qw
=
new
QueryWrapper
<>();
qw
.
in
(
"metric_uid_tag"
,
"JSTP,JSTN,JSPH,JSNH3N,JSCOD,CSTP,CSTN,CSPH,CSNH3N,CSCOD"
.
split
(
","
));
qw
.
in
(
"metric_uid_tag"
,
"JSTP,JSTN,JSPH,JSNH3N,JSCOD,CSTP,CSTN,CSPH,CSNH3N,CSCOD"
.
split
(
","
));
//CSLL 出水瞬时流量() CSLJLL出水流量累计JSLL(JSLJLL) JSSS 进水浊度 CSSS 出水浊度
qw
.
eq
(
"depart_id"
,
departId
);
qw
.
groupBy
(
"depart_id"
,
"metric_uid_tag"
);
List
<
SysMonitorMetricInfo
>
monitorList
=
sysMonitorMetricInfoService
.
list
(
qw
);
...
...
sk-module-datafill/src/main/java/com/skua/modules/report/vo/DataVO.java
查看文件 @
d47e1c6
...
...
@@ -49,7 +49,5 @@ public class DataVO {
this
.
lastYearStartTime
=
lastYear
+
"-01"
;
this
.
lastYearEndTime
=
lastYear
+
"-31"
;
}
}
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/entity/EquipmentInChild.java
查看文件 @
d47e1c6
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.skua.core.aspect.annotation.Dict
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
@@ -42,6 +43,7 @@ public class EquipmentInChild {
*/
@Excel
(
name
=
"备品备件id"
,
width
=
15
)
@ApiModelProperty
(
value
=
"备品备件id"
)
@Dict
(
dictTable
=
"equipment_sparepart_supplies"
,
dicCode
=
"id"
,
dicText
=
"sparepart_name"
)
private
String
sparepartId
;
/**
* 入库数量
...
...
@@ -117,4 +119,4 @@ public class EquipmentInChild {
/**税率*/
private
BigDecimal
taxRate
;
}
\ No newline at end of file
}
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/entity/EquipmentOutChild.java
查看文件 @
d47e1c6
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.skua.core.aspect.annotation.Dict
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
@@ -42,6 +43,7 @@ public class EquipmentOutChild {
*/
@Excel
(
name
=
"备品备件id"
,
width
=
15
)
@ApiModelProperty
(
value
=
"备品备件id"
)
@Dict
(
dictTable
=
"equipment_sparepart_supplies"
,
dicCode
=
"id"
,
dicText
=
"sparepart_name"
)
private
String
sparepartId
;
/**
* 出库数量
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/impl/EquipmentInServiceImpl.java
查看文件 @
d47e1c6
...
...
@@ -77,7 +77,6 @@ public class EquipmentInServiceImpl extends ServiceImpl<EquipmentInMapper, Equip
public
int
saveEquipmentIn
(
EquipmentInDTO
equipmentInDTO
)
throws
Exception
{
List
<
SuppliesWarehouse
>
suppliesWarehouseList
=
suppliesWarehouseService
.
list
();
//供应商列表
Map
<
String
,
String
>
warehouseDictMap
=
suppliesWarehouseList
.
stream
().
collect
(
Collectors
.
toMap
(
SuppliesWarehouse:
:
getId
,
SuppliesWarehouse:
:
getDepartId
));
if
(
equipmentInDTO
.
getEquipmentInChildList
()
==
null
||
equipmentInDTO
.
getEquipmentInChildList
().
isEmpty
())
{
throw
new
JeecgBootException
(
"请选择入库备件!"
);
}
...
...
@@ -102,7 +101,7 @@ public class EquipmentInServiceImpl extends ServiceImpl<EquipmentInMapper, Equip
this
.
baseMapper
.
insert
(
equipmentIn
);
return
1
;
}));
CountDownLatch
countDownLatch
=
new
CountDownLatch
(
equipmentInDTO
.
getEquipmentInChildList
().
size
());
//
CountDownLatch countDownLatch = new CountDownLatch(equipmentInDTO.getEquipmentInChildList().size());
/* //如果是采购入库
Map<String, PurchaseInfoDetail> purchaseMap = Maps.newHashMap();
if ("cg".equals(equipmentInDTO.getInType()) && StringUtils.isNotEmpty(equipmentInDTO.getPurchaseCode())) {
...
...
@@ -115,8 +114,7 @@ public class EquipmentInServiceImpl extends ServiceImpl<EquipmentInMapper, Equip
}*/
for
(
EquipmentInChild
equipmentInChild
:
equipmentInDTO
.
getEquipmentInChildList
())
{
equipmentInChild
.
setInId
(
inId
);
taskExecutor
.
execute
(()
->
{
try
{
// taskExecutor.execute(() -> {
String
sparepartId
=
equipmentInChild
.
getSparepartId
();
String
suppliesWarehouseId
=
equipmentInDTO
.
getSuppliesWarehouseId
();
//根据物资id和仓库id获取库存
...
...
@@ -167,15 +165,10 @@ public class EquipmentInServiceImpl extends ServiceImpl<EquipmentInMapper, Equip
//=============
return
1
;
});
}
catch
(
Exception
e1
)
{
e1
.
printStackTrace
();
// log.error("异常error: {}", e1.getMessage());
}
finally
{
countDownLatch
.
countDown
();
}
});
// });
}
countDownLatch
.
await
();
//
countDownLatch.await();
return
1
;
}
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/impl/EquipmentOutServiceImpl.java
查看文件 @
d47e1c6
...
...
@@ -20,9 +20,8 @@ import com.skua.tool.util.UniqIdUtils;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.support.TransactionTemplate
;
import
javax.annotation.Resource
;
...
...
@@ -37,10 +36,6 @@ import java.util.concurrent.CountDownLatch;
*/
@Service
public
class
EquipmentOutServiceImpl
extends
ServiceImpl
<
EquipmentOutMapper
,
EquipmentOut
>
implements
IEquipmentOutService
{
@Autowired
@Qualifier
(
"taskExecutor"
)
private
ThreadPoolTaskExecutor
taskExecutor
;
@Resource
private
EquipmentOutMapper
equipmentOutMapper
;
...
...
@@ -63,78 +58,78 @@ public class EquipmentOutServiceImpl extends ServiceImpl<EquipmentOutMapper, Equ
* @param equipmentOutDTO
* @return
*/
@Transactional
public
String
saveEquipmentOut
(
EquipmentOutDTO
equipmentOutDTO
)
throws
Exception
{
String
errMsg
=
null
;
if
(
equipmentOutDTO
.
getEquipmentOutChildList
()
==
null
||
equipmentOutDTO
.
getEquipmentOutChildList
().
isEmpty
())
{
errMsg
=
"请选择出库备件"
;
return
errMsg
;
}
// 出库单号
if
(
StringUtils
.
isEmpty
(
equipmentOutDTO
.
getOutOrder
()))
{
String
outOrder
=
"CK-"
+
DateUtils
.
format
(
new
Date
(),
"YYYYMMdd"
+
"-"
+
System
.
currentTimeMillis
());
equipmentOutDTO
.
setOutOrder
(
outOrder
);
}
// 出库表主键
String
outId
=
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
);
equipmentOutDTO
.
setId
(
outId
);
EquipmentOut
equipmentOut
=
BeanExtUtils
.
bean2Bean
(
equipmentOutDTO
,
EquipmentOut
.
class
);
equipmentOut
.
setInventoryUpdateTime
(
new
Date
()
);
this
.
baseMapper
.
insert
(
equipmentOut
);
CountDownLatch
countDownLatch
=
new
CountDownLatch
(
equipmentOutDTO
.
getEquipmentOutChildList
().
size
()
);
for
(
EquipmentOutChild
equipmentOutChild
:
equipmentOutDTO
.
getEquipmentOutChildList
())
{
equipmentOutChild
.
setId
(
UniqIdUtils
.
getInstance
().
getUniqID
());
equipmentOutChild
.
setOutId
(
outId
);
taskExecutor
.
execute
(()
->
{
try
{
String
sparepartId
=
equipmentOutChild
.
getSparepartId
();
String
suppliesWarehouseId
=
equipmentOutDTO
.
getSuppliesWarehouseId
();
try
{
if
(
equipmentOutDTO
.
getEquipmentOutChildList
()
==
null
||
equipmentOutDTO
.
getEquipmentOutChildList
().
isEmpty
())
{
errMsg
=
"请选择出库备件"
;
return
errMsg
;
}
// 出库单号
if
(
StringUtils
.
isEmpty
(
equipmentOutDTO
.
getOutOrder
()))
{
String
outOrder
=
"CK-"
+
DateUtils
.
format
(
new
Date
(),
"YYYYMMdd"
+
"-"
+
System
.
currentTimeMillis
()
);
equipmentOutDTO
.
setOutOrder
(
outOrder
);
}
// 出库表主键
String
outId
=
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
);
equipmentOutDTO
.
setId
(
outId
);
EquipmentOut
equipmentOut
=
BeanExtUtils
.
bean2Bean
(
equipmentOutDTO
,
EquipmentOut
.
class
);
equipmentOut
.
setInventoryUpdateTime
(
new
Date
()
);
this
.
baseMapper
.
insert
(
equipmentOut
);
// CountDownLatch countDownLatch = new CountDownLatch(equipmentOutDTO.getEquipmentOutChildList().size());
for
(
EquipmentOutChild
equipmentOutChild
:
equipmentOutDTO
.
getEquipmentOutChildList
())
{
equipmentOutChild
.
setId
(
UniqIdUtils
.
getInstance
().
getUniqID
()
);
equipmentOutChild
.
setOutId
(
outId
);
// taskExecutor.execute(() ->
{
String
sparepartId
=
equipmentOutChild
.
getSparepartId
();
String
suppliesWarehouseId
=
equipmentOutDTO
.
getSuppliesWarehouseId
();
//根据物资id和仓库id获取库存
QueryWrapper
<
EquipmentSparepart
>
sparepartQueryWrapper
=
new
QueryWrapper
<>();
sparepartQueryWrapper
.
eq
(
"supplies_id"
,
sparepartId
).
eq
(
"supplies_warehouse_id"
,
suppliesWarehouseId
);
EquipmentSparepart
equipmentSparepart
=
iEquipmentSparepartService
.
getOne
(
sparepartQueryWrapper
);
if
(
ObjectUtil
.
isEmpty
(
equipmentSparepart
))
{
//物料信息
EquipmentSparepartSupplies
supplies
=
sparepartSuppliesService
.
getById
(
sparepartId
);
equipmentSparepart
=
new
EquipmentSparepart
();
//根据物资id和仓库id获取库存
QueryWrapper
<
EquipmentSparepart
>
sparepartQueryWrapper
=
new
QueryWrapper
<>();
sparepartQueryWrapper
.
eq
(
"supplies_id"
,
sparepartId
).
eq
(
"supplies_warehouse_id"
,
suppliesWarehouseId
);
EquipmentSparepart
equipmentSparepart
=
iEquipmentSparepartService
.
getOne
(
sparepartQueryWrapper
);
if
(
ObjectUtil
.
isEmpty
(
equipmentSparepart
))
{
//物料信息
EquipmentSparepartSupplies
supplies
=
sparepartSuppliesService
.
getById
(
sparepartId
);
equipmentSparepart
=
new
EquipmentSparepart
();
if
(
supplies
!=
null
){
BeanUtils
.
copyProperties
(
supplies
,
equipmentSparepart
);
equipmentSparepart
.
setId
(
null
);
equipmentSparepart
.
setStorageNum
(
BigDecimal
.
ZERO
);
equipmentSparepart
.
setSuppliesId
(
sparepartId
);
equipmentSparepart
.
setSuppliesWarehouseId
(
suppliesWarehouseId
);
//如果没有物料库存信息,新增库存信息为0
iEquipmentSparepartService
.
saveOrUpdate
(
equipmentSparepart
);
equipmentSparepart
=
iEquipmentSparepartService
.
getOne
(
sparepartQueryWrapper
);
}
BigDecimal
resetStorageNum
=
equipmentSparepart
.
getStorageNum
().
subtract
(
equipmentOutChild
.
getOutNum
());
if
(
resetStorageNum
.
doubleValue
()
<
0
)
{
return
;
}
Integer
version
=
equipmentSparepart
.
getVersion
();
String
id
=
equipmentSparepart
.
getId
();
Integer
executeRes
=
transactionTemplate
.
execute
(
transactionStatus
->
{
int
val0
=
iEquipmentSparepartService
.
updateStorageNumById
(
id
,
resetStorageNum
.
doubleValue
(),
version
);
if
(
val0
==
1
&&
iEquipmentOutChildService
.
saveOrUpdate
(
equipmentOutChild
))
{
return
1
;
}
else
{
transactionStatus
.
setRollbackOnly
();
return
0
;
}
});
// if (executeRes != null && executeRes == 1) {
//
// }
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
//log.error("异常error: {}", e.getMessage());
}
finally
{
countDownLatch
.
countDown
();
equipmentSparepart
.
setId
(
null
);
equipmentSparepart
.
setStorageNum
(
BigDecimal
.
ZERO
);
equipmentSparepart
.
setSuppliesId
(
sparepartId
);
equipmentSparepart
.
setSuppliesWarehouseId
(
suppliesWarehouseId
);
//如果没有物料库存信息,新增库存信息为0
iEquipmentSparepartService
.
saveOrUpdate
(
equipmentSparepart
);
equipmentSparepart
=
iEquipmentSparepartService
.
getOne
(
sparepartQueryWrapper
);
}
BigDecimal
resetStorageNum
=
equipmentSparepart
.
getStorageNum
().
subtract
(
equipmentOutChild
.
getOutNum
());
if
(
resetStorageNum
.
doubleValue
()
<
0
)
{
continue
;
//return;
}
});
Integer
version
=
equipmentSparepart
.
getVersion
();
String
id
=
equipmentSparepart
.
getId
();
Integer
executeRes
=
transactionTemplate
.
execute
(
transactionStatus
->
{
int
val0
=
iEquipmentSparepartService
.
updateStorageNumById
(
id
,
resetStorageNum
.
doubleValue
(),
version
);
if
(
val0
==
1
&&
iEquipmentOutChildService
.
saveOrUpdate
(
equipmentOutChild
))
{
return
1
;
}
else
{
transactionStatus
.
setRollbackOnly
();
return
0
;
}
});
// });
}
// countDownLatch.await();
}
catch
(
Exception
e
){
e
.
printStackTrace
();
throw
new
Exception
(
"出库失败:"
+
e
.
getMessage
());
}
countDownLatch
.
await
();
return
errMsg
;
}
}
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/vo/DrugConsumptionVO.java
0 → 100644
查看文件 @
d47e1c6
package
com
.
skua
.
modules
.
equipment
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @auther kangwei
* @create 2024-10-25-9:30
*/
@Data
@ApiModel
public
class
DrugConsumptionVO
{
@ApiModelProperty
(
value
=
"总药耗"
)
private
String
zyh
;
@ApiModelProperty
(
value
=
"同比去年总药耗"
)
private
String
tbqnzyh
;
@ApiModelProperty
(
value
=
"同比去年总药耗"
)
private
String
tbqnzyhsl
;
@ApiModelProperty
(
value
=
"同比去年总药耗"
)
private
String
tbqnzyhbl
;
@ApiModelProperty
(
value
=
"环比上月总药耗"
)
private
String
hbsyzyh
;
@ApiModelProperty
(
value
=
"环比上月总药耗"
)
private
String
hbsyzyhsl
;
@ApiModelProperty
(
value
=
"环比上月总药耗"
)
private
String
hbsyzyhbl
;
@ApiModelProperty
(
value
=
"目标吨水药耗"
)
private
String
dsyh
;
@ApiModelProperty
(
value
=
"tbqndsyhsl"
)
private
String
tbqndsyhsl
;
@ApiModelProperty
(
value
=
"tbqndsyhbl"
)
private
String
tbqndsyhbl
;
}
sk-module-system/src/main/java/com/skua/config/mybatis/MybatisInterceptor.java
查看文件 @
d47e1c6
...
...
@@ -94,7 +94,8 @@ public class MybatisInterceptor implements Interceptor {
add
(
"erp_distribut_material"
);
//共享风险库
add
(
"danger_level_manage_share"
);
// 库存表
add
(
"equipment_sparepart"
);
}};
//过滤不需要走部门ID查询的URL
...
...
@@ -152,6 +153,8 @@ public class MybatisInterceptor implements Interceptor {
||
"com.skua.modules.erp.mapper.DistributContractMapper.selectList"
.
equals
(
sqlId
)
//分销合同列表
||
"com.skua.modules.erp.mapper.ERPPurchaseContractMapper.getListByDistributId"
.
equals
(
sqlId
)
||
"com.skua.modules.system.datestandard.mapper.SysMonitorMetricInfoMapper.selectList"
.
equals
(
sqlId
)
//点表
||
"com.skua.modules.equipment.mapper.EquipmentSparepartMapper.selectOne"
.
equals
(
sqlId
)
||
"com.skua.modules.supplies.mapper.EquipmentSparepartSuppliesMapper.selectById"
.
equals
(
sqlId
)
)
{
log
.
debug
(
"************************------sqlId------**************************"
+
sqlId
);
return
invocation
.
proceed
();
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论