Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
Aidea
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sa_aidea
Aidea
Commits
dc664365
Commit
dc664365
authored
Mar 18, 2021
by
谢希宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Submit by Strive
Date 2021/03/18
parent
c29b84c8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1169 additions
and
48 deletions
+1169
-48
consultSheetform.html
...n/webapp/WEB-INF/views/consultSheet/consultSheetform.html
+3
-3
consultSheetlist.html
...n/webapp/WEB-INF/views/consultSheet/consultSheetlist.html
+4
-3
CouponrecordServiceImpl.java
...ch/couponrecord/service/impl/CouponrecordServiceImpl.java
+5
-3
orderlist.html
...le-web/src/main/webapp/WEB-INF/views/order/orderlist.html
+4
-4
productBatchform.html
...c/main/webapp/WEB-INF/views/product/productBatchform.html
+279
-0
productBatchlist.html
...c/main/webapp/WEB-INF/views/product/productBatchlist.html
+350
-0
productlist.html
...eb/src/main/webapp/WEB-INF/views/product/productlist.html
+1
-1
ProductBatchMapper.java
.../main/java/com/cftech/product/dao/ProductBatchMapper.java
+15
-0
ProductBatchMapper.xml
...c/main/java/com/cftech/product/dao/ProductBatchMapper.xml
+175
-0
ProductBatch.java
.../src/main/java/com/cftech/product/model/ProductBatch.java
+57
-0
ProductBatchService.java
.../java/com/cftech/product/service/ProductBatchService.java
+16
-0
ProductBatchServiceImpl.java
.../cftech/product/service/impl/ProductBatchServiceImpl.java
+31
-0
ProductBatchController.java
...n/java/com/cftech/product/web/ProductBatchController.java
+192
-0
ProductController.java
...c/main/java/com/cftech/product/web/ProductController.java
+37
-34
No files found.
aidea-modules/consult-module-web/src/main/webapp/WEB-INF/views/consultSheet/consultSheetform.html
View file @
dc664365
...
...
@@ -226,9 +226,9 @@
<input
type=
"text"
id=
"hospital"
name=
"hospital"
value=
"$!{data.hospital}"
class=
"form-control selHospital"
readonly
>
<span
class=
"input-group-btn"
>
<button
type=
"button"
name=
"selHospital"
id=
"selHospital"
class=
"btn btn-info btn-flat selHospital"
>
选择
</button>
</span>
<button
type=
"button"
name=
"selHospital"
id=
"selHospital"
class=
"btn btn-info btn-flat selHospital"
>
选择
</button>
</span>
</div>
#end
</div>
...
...
aidea-modules/consult-module-web/src/main/webapp/WEB-INF/views/consultSheet/consultSheetlist.html
View file @
dc664365
...
...
@@ -219,8 +219,8 @@
<!-- SlimScroll -->
<script
src=
"plugins/slimScroll/jquery.slimscroll.min.js"
></script>
<
!--<script src="plugins/bootstrap-dateTimePicker/bootstrap-datetimepicker.js"></script>--
>
<
!--<script src="plugins/bootstrap-dataTimePicker/bootstrap-datetimepicker.zh-CN.js"></script>--
>
<
script
src=
"plugins/bootstrap-dateTimePicker/bootstrap-datetimepicker.js"
></script
>
<
script
src=
"plugins/bootstrap-dataTimePicker/bootstrap-datetimepicker.zh-CN.js"
></script
>
<!-- FastClick -->
<script
src=
"plugins/fastclick/fastclick.min.js"
></script>
<!--fileinput js-->
...
...
@@ -234,7 +234,8 @@
<!-- AdminLTE for demo purposes -->
<script
src=
"common/js/cfapp.js"
></script>
<script
src=
"js/moment.min.js"
></script>
<script
type=
"text/javascript"
src=
"plugins/daterangepicker/daterangepicker.js"
></script>
<script
type=
"text/javascript"
src=
"plugins/daterangepicker/daterangepicker.js"
></script>
<script>
function
formatDates
(
now
)
{
var
now
=
new
Date
(
now
);
...
...
aidea-modules/couponrecord-module/src/main/java/com/cftech/couponrecord/service/impl/CouponrecordServiceImpl.java
View file @
dc664365
...
...
@@ -110,7 +110,7 @@ public class CouponrecordServiceImpl extends GenericServiceImpl<Couponrecord> im
Couponrecord
lastCouponrecord
=
findCouponrecordBySort
(
null
,
openid
).
get
(
0
);
//获取最后一张券
if
(
StringUtils
.
equals
(
lastCouponrecord
.
getType
(),
"2"
))
{
//获取最后一张券失效时间购买数量
number
=
buyingMedicineNumber
(
openid
,
lastCouponrecord
.
get
ExpireDat
e
());
number
=
buyingMedicineNumber
(
openid
,
lastCouponrecord
.
get
CreateTim
e
());
if
(
number
>=
3
)
{
//赠送第一张
String
no
=
codingruleUtils
.
getPrimaryKey
(
CodingruleUtils
.
COUPON_KEY
);
...
...
@@ -152,8 +152,8 @@ public class CouponrecordServiceImpl extends GenericServiceImpl<Couponrecord> im
couponrecordMapper
.
save
(
couponrecord
);
}
}
else
if
(
StringUtils
.
equals
(
lastCouponrecord
.
getType
(),
"1"
))
{
//通过第一张开始时间获取购买数量
List
<
Couponrecord
>
fir
stCouponrecordList
=
findCouponrecordBySort
(
"2"
,
openid
);
number
=
buyingMedicineNumber
(
openid
,
firstCouponrecordList
.
get
(
0
).
getExpireDat
e
());
//获取最后一张券购买数量
List
<
Couponrecord
>
la
stCouponrecordList
=
findCouponrecordBySort
(
"2"
,
openid
);
number
=
buyingMedicineNumber
(
openid
,
lastCouponrecordList
.
get
(
0
).
getCreateTim
e
());
//获取最后一张券购买数量
//通过第一张最后购买数量,所以只需赠送第二章
if
(
number
>=
6
)
{
//赠送第二张
...
...
@@ -201,6 +201,8 @@ public class CouponrecordServiceImpl extends GenericServiceImpl<Couponrecord> im
conds
.
equal
(
"d.drugs_id"
,
SystemConfig
.
p
.
getProperty
(
"THREE_DRUGS_ID"
));
if
(
date
!=
null
)
{
conds
.
greatEqual
(
"t.pay_time"
,
date
);
}
else
{
conds
.
equal
(
"DATE_FORMAT(t.pay_time, '%Y')"
,
new
Date
().
getYear
());
}
conds
.
in
(
"t.status"
,
new
String
[]{
"2"
,
"3"
,
"4"
});
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
...
...
aidea-modules/order-module-web/src/main/webapp/WEB-INF/views/order/orderlist.html
View file @
dc664365
...
...
@@ -607,13 +607,13 @@
}
else
if
(
a
==
'1'
)
{
return
"<span style='color:RGB(255,51,0)'>待付款</span>"
;
}
else
if
(
a
==
'2'
)
{
return
"<span
style='color:#06f'
>待发货</span>"
;
return
"<span>待发货</span>"
;
}
else
if
(
a
==
'3'
)
{
return
"<span
style='color:#06f
'>待收货</span>"
;
return
"<span'>待收货</span>"
;
}
else
if
(
a
==
'4'
)
{
return
"<span
style='color:#06f'
>已完成</span>"
;
return
"<span>已完成</span>"
;
}
else
if
(
a
==
'5'
)
{
return
"<span
style='color:#06f'
>已取消</span>"
;
return
"<span>已取消</span>"
;
}
}
},
...
...
aidea-modules/product-module-web/src/main/webapp/WEB-INF/views/product/productBatchform.html
0 → 100644
View file @
dc664365
This diff is collapsed.
Click to expand it.
aidea-modules/product-module-web/src/main/webapp/WEB-INF/views/product/productBatchlist.html
0 → 100644
View file @
dc664365
This diff is collapsed.
Click to expand it.
aidea-modules/product-module-web/src/main/webapp/WEB-INF/views/product/productlist.html
View file @
dc664365
...
...
@@ -312,7 +312,7 @@
"aTargets"
:
[
10
],
"mData"
:
"id"
,
"mRender"
:
function
(
a
,
b
,
c
,
d
)
{
var
html
=
'#if($shiro.hasPermission("qy:product:edit"))'
;
//
var
html
=
'#if($shiro.hasPermission("qy:product:edit"))'
;
html
+=
'<a href="#springUrl("/a/product/form?id='
+
a
+
'")" data-id="'
+
a
+
'" data-action="view" class="btn green">修改</a>'
;
html
+=
'<a href="javascript:void(0);" data-id="'
+
a
+
'" data-action="remove" onclick="removeData('
+
a
+
')" class="btn red">删除</a>'
;
html
+=
'#end'
;
...
...
aidea-modules/product-module/src/main/java/com/cftech/product/dao/ProductBatchMapper.java
0 → 100644
View file @
dc664365
package
com
.
cftech
.
product
.
dao
;
import
com.cftech.core.generic.GenericDao
;
import
com.cftech.product.model.ProductBatch
;
/**
* 产品批次Mapper
*
* @author Strive
* @date: 2021-03-18 14:30
*/
public
interface
ProductBatchMapper
extends
GenericDao
<
ProductBatch
>
{
}
\ No newline at end of file
aidea-modules/product-module/src/main/java/com/cftech/product/dao/ProductBatchMapper.xml
0 → 100644
View file @
dc664365
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.cftech.product.dao.ProductBatchMapper"
>
<resultMap
id=
"resultMap"
type=
"com.cftech.product.model.ProductBatch"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"number"
property=
"number"
/>
<result
column=
"batch_no"
property=
"batchNo"
/>
<result
column=
"product_id"
property=
"productId"
/>
<result
column=
"accounts_id"
property=
"accountsId"
/>
<result
column=
"del_flag"
property=
"delFlag"
/>
<result
column=
"status"
property=
"status"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"description"
property=
"description"
/>
<result
column=
"create_by"
property=
"createBy"
/>
<result
column=
"update_by"
property=
"updateBy"
/>
<result
column=
"productCode"
property=
"productCode"
/>
<result
column=
"productName"
property=
"productName"
/>
<result
column=
"commonName"
property=
"commonName"
/>
</resultMap>
<sql
id=
"sqlWhere"
>
<if
test=
"conds!=null"
>
<trim
prefix=
"WHERE"
prefixOverrides=
"AND|OR"
>
<foreach
collection=
"conds.conds"
index=
"index"
item=
"cond"
>
${cond.linkType}
<if
test=
"cond.condType == 'EQUAL'"
>
${cond.param} = #{cond.value}
</if>
<if
test=
"cond.condType == 'NOTEQUAL'"
>
${cond.param}
<>
#{cond.value}
</if>
<if
test=
"cond.condType == 'GREATEQUAL'"
>
${cond.param}
>
= #{cond.value}
</if>
<if
test=
"cond.condType == 'GREATTHAN'"
>
${cond.param}
>
#{cond.value}
</if>
<if
test=
"cond.condType == 'LESSEQUAL'"
>
${cond.param}
<
= #{cond.value}
</if>
<if
test=
"cond.condType == 'LESSTHAN'"
>
${cond.param}
<
#{cond.value}
</if>
<if
test=
"cond.condType == 'BETWEEN'"
>
${cond.param} BETWEEN #{cond.startValue} AND
#{cond.endValue}
</if>
<if
test=
"cond.condType == 'ISNULL'"
>
${cond.param} IS NULL
</if>
<if
test=
"cond.condType == 'NOTNULL'"
>
${cond.param} IS NOT NULL
</if>
<if
test=
"cond.condType == 'LIKE'"
>
${cond.param} LIKE #{cond.value}
</if>
<if
test=
"cond.condType == 'IN'"
>
${cond.param} IN
<foreach
item=
"item"
index=
"index"
collection=
"cond.value"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</foreach>
</trim>
</if>
</sql>
<sql
id=
"sqlColumns"
>
id,
number,
batch_no,
product_id,
accounts_id,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by
</sql>
<insert
id=
"save"
parameterType=
"com.cftech.product.model.ProductBatch"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into t_aidea_product_batch
(
<include
refid=
"sqlColumns"
/>
)
values
(
#{id, jdbcType=BIGINT},
#{number, jdbcType=VARCHAR},
#{batchNo, jdbcType=VARCHAR},
#{productId, jdbcType=VARCHAR},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
</insert>
<select
id=
"fetchById"
parameterType=
"java.lang.Long"
resultMap=
"resultMap"
>
SELECT
<include
refid=
"sqlColumns"
/>
,
p.product_number productCode,
p.product_name productName,
p.common_name commonName
FROM t_aidea_product_batch t
WHERE t.id=#{id}
</select>
<select
id=
"count"
parameterType=
"java.util.Map"
resultType=
"java.lang.Integer"
>
SELECT COUNT(1) FROM t_aidea_product_batch t
LEFT JOIN t_aidea_product p ON t.product_id = p.id
<include
refid=
"sqlWhere"
/>
</select>
<select
id=
"fetchSearchByPage"
parameterType=
"java.util.Map"
resultMap=
"resultMap"
>
SELECT
t.id,
t.number,
t.batch_no,
t.product_id,
t.accounts_id,
t.del_flag,
t.status,
t.create_time,
t.update_time,
t.description,
t.create_by,
t.update_by,
p.product_number productCode,
p.product_name productName,
p.common_name commonName
FROM t_aidea_product_batch t
LEFT JOIN t_aidea_product p ON t.product_id = p.id
<include
refid=
"sqlWhere"
/>
<if
test=
"sort!=null"
>
ORDER BY ${sort.param} ${sort.type}
</if>
<if
test=
"limit>0"
>
limit #{offset},#{limit}
</if>
</select>
<update
id=
"update"
parameterType=
"com.cftech.product.model.ProductBatch"
>
update t_aidea_product_batch
<set>
<if
test=
"id != null"
>
id = #{id, jdbcType=BIGINT},
</if>
<if
test=
"number != null"
>
number = #{number, jdbcType=VARCHAR},
</if>
<if
test=
"batchNo != null"
>
batch_no = #{batchNo, jdbcType=VARCHAR},
</if>
<if
test=
"productId != null"
>
product_id = #{productId, jdbcType=VARCHAR},
</if>
<if
test=
"accountsId != null"
>
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if
test=
"delFlag != null"
>
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if
test=
"status != null"
>
status = #{status, jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if
test=
"description != null"
>
description = #{description, jdbcType=VARCHAR},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
<update
id=
"delete"
parameterType=
"java.lang.Long"
>
update t_aidea_product_batch
set del_flag=1
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
aidea-modules/product-module/src/main/java/com/cftech/product/model/ProductBatch.java
0 → 100644
View file @
dc664365
package
com
.
cftech
.
product
.
model
;
import
com.cftech.core.poi.ExportConfig
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 产品批次
*
* @author Strive
* @date: 2021-03-18 14:30
*/
@Data
public
class
ProductBatch
implements
Serializable
{
/* 主键id */
private
Long
id
;
/* 编码 */
@ExportConfig
(
value
=
"编码"
,
width
=
100
,
showLevel
=
1
)
private
String
number
;
/* 产品批次号 */
@ExportConfig
(
value
=
"产品批次号"
,
width
=
100
,
showLevel
=
1
)
private
String
batchNo
;
/* 产品Id */
@ExportConfig
(
value
=
"产品Id"
,
width
=
100
,
showLevel
=
1
)
private
String
productId
;
/* 所属的账号 */
private
Long
accountsId
;
/* 删除标识 */
private
boolean
delFlag
;
/* 状态 */
private
String
status
;
/* 创建时间 */
private
Date
createTime
;
/* 更新时间 */
private
Date
updateTime
;
/* 备注 */
private
String
description
;
/* 创建人 */
private
Long
createBy
;
/* 更新人 */
private
Long
updateBy
;
private
String
productName
;
private
String
productCode
;
private
String
commonName
;
public
ProductBatch
()
{
this
.
delFlag
=
false
;
this
.
status
=
"0"
;
}
}
\ No newline at end of file
aidea-modules/product-module/src/main/java/com/cftech/product/service/ProductBatchService.java
0 → 100644
View file @
dc664365
package
com
.
cftech
.
product
.
service
;
import
com.cftech.core.generic.GenericService
;
import
com.cftech.product.model.ProductBatch
;
/**
* 产品批次Service
*
* @author Strive
* @date: 2021-03-18 14:30
*/
public
interface
ProductBatchService
extends
GenericService
<
ProductBatch
>
{
}
aidea-modules/product-module/src/main/java/com/cftech/product/service/impl/ProductBatchServiceImpl.java
0 → 100644
View file @
dc664365
package
com
.
cftech
.
product
.
service
.
impl
;
import
com.cftech.core.generic.GenericDao
;
import
com.cftech.core.generic.GenericServiceImpl
;
import
com.cftech.product.dao.ProductBatchMapper
;
import
com.cftech.product.model.ProductBatch
;
import
com.cftech.product.service.ProductBatchService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Service
;
/**
* 产品批次ServiceImpl
*
* @author Strive
* @date: 2021-03-18 14:30
*/
@Service
(
"productBatchService"
)
public
class
ProductBatchServiceImpl
extends
GenericServiceImpl
<
ProductBatch
>
implements
ProductBatchService
{
@Autowired
@Qualifier
(
"productBatchMapper"
)
private
ProductBatchMapper
productBatchMapper
;
@Override
public
GenericDao
<
ProductBatch
>
getGenericMapper
()
{
return
productBatchMapper
;
}
}
\ No newline at end of file
aidea-modules/product-module/src/main/java/com/cftech/product/web/ProductBatchController.java
0 → 100644
View file @
dc664365
package
com
.
cftech
.
product
.
web
;
import
com.alibaba.fastjson.JSONObject
;
import
com.cftech.core.poi.ExcelKit
;
import
com.cftech.core.scope.OrderType
;
import
com.cftech.core.sql.Conds
;
import
com.cftech.core.sql.Sort
;
import
com.cftech.core.util.Constants
;
import
com.cftech.product.model.ProductBatch
;
import
com.cftech.product.service.ProductBatchService
;
import
com.cftech.sys.security.UserUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
/**
* 产品批次Controller
* <p>
* 权限字符串说明:
* 查看:public static final String PRODUCTBATCH_VIEW = "qy:productBatch:view"
* 查看:public static final String PRODUCTBATCH_EDIT = "qy:productBatch:edit"
*
* @author Strive
* @date: 2021-03-18 14:30
*/
@Slf4j
@Controller
@RequestMapping
(
"/a/productBatch"
)
public
class
ProductBatchController
{
public
static
final
String
PRODUCTBATCH_VIEW
=
"qy:productBatch:view"
;
public
static
final
String
PRODUCTBATCH_EDIT
=
"qy:productBatch:edit"
;
@Autowired
private
ProductBatchService
productBatchService
;
//列表页面
@RequiresPermissions
(
value
=
PRODUCTBATCH_VIEW
)
@RequestMapping
(
"/list"
)
public
String
list
(
HttpServletRequest
request
,
Model
model
)
{
Long
accountId
=
UserUtils
.
getmpaccounts
(
request
);
model
.
addAttribute
(
"accountId"
,
accountId
);
return
"product/productBatchlist"
;
}
//编辑页面(新增、修改)
@RequiresPermissions
(
value
=
PRODUCTBATCH_VIEW
)
@RequestMapping
(
"/form"
)
public
String
form
(
HttpServletRequest
request
,
String
id
,
Model
model
)
{
if
(!
StringUtils
.
isEmpty
(
id
))
{
ProductBatch
productBatch
=
productBatchService
.
fetchById
(
id
);
model
.
addAttribute
(
"data"
,
productBatch
);
}
return
"product/productBatchform"
;
}
//提交数据(新增、修改)
@RequiresPermissions
(
value
=
PRODUCTBATCH_EDIT
)
@RequestMapping
(
"/formData"
)
@ResponseBody
public
JSONObject
formData
(
ProductBatch
productBatch
,
Model
model
,
HttpServletRequest
request
)
{
Long
accountsId
=
UserUtils
.
getmpaccounts
(
request
);
JSONObject
rtnJson
=
new
JSONObject
();
try
{
if
(
productBatch
!=
null
&&
productBatch
.
getId
()
!=
null
)
{
productBatch
.
setUpdateBy
(
UserUtils
.
getUser
().
getId
());
productBatchService
.
update
(
productBatch
);
rtnJson
.
put
(
"errorNo"
,
0
);
}
else
{
productBatch
.
setAccountsId
(
accountsId
);
productBatch
.
setDelFlag
(
false
);
productBatch
.
setAccountsId
(
UserUtils
.
getmpaccounts
(
request
));
productBatch
.
setCreateBy
(
UserUtils
.
getUser
().
getId
());
productBatch
.
setUpdateBy
(
UserUtils
.
getUser
().
getId
());
productBatchService
.
save
(
productBatch
);
rtnJson
.
put
(
"errorNo"
,
2
);
}
}
catch
(
Exception
e
)
{
rtnJson
.
put
(
"errorNo"
,
1
);
}
return
rtnJson
;
}
//获取列表数据
@RequiresPermissions
(
value
=
PRODUCTBATCH_VIEW
)
@RequestMapping
(
value
=
"/listData"
)
@ResponseBody
public
JSONObject
listData
(
int
iDisplayStart
,
int
iDisplayLength
,
ProductBatch
productBatch
,
HttpServletRequest
request
)
{
Long
accountsId
=
UserUtils
.
getmpaccounts
(
request
);
Conds
conds
=
new
Conds
();
conds
.
equal
(
"t.del_flag"
,
Constants
.
DEL_FLAG_0
);
conds
.
equal
(
"t.accounts_id"
,
accountsId
);
if
(!
StringUtils
.
isEmpty
(
productBatch
.
getProductName
()))
{
conds
.
like
(
"p.product_name"
,
productBatch
.
getProductName
());
}
if
(!
StringUtils
.
isEmpty
(
productBatch
.
getProductCode
()))
{
conds
.
equal
(
"p.product_number"
,
productBatch
.
getProductCode
());
}
Sort
sort
=
new
Sort
(
"t.create_time"
,
OrderType
.
DESC
);
List
<
ProductBatch
>
list
=
productBatchService
.
fetchSearchByPage
(
conds
,
sort
,
iDisplayStart
,
iDisplayLength
);
Integer
counts
=
productBatchService
.
count
(
conds
);
JSONObject
rtnJson
=
new
JSONObject
();
rtnJson
.
put
(
"iTotalRecords"
,
counts
);
rtnJson
.
put
(
"iTotalDisplayRecords"
,
counts
);
rtnJson
.
put
(
"aaData"
,
list
);
return
rtnJson
;
}
//删除数据
@RequiresPermissions
(
value
=
PRODUCTBATCH_EDIT
)
@RequestMapping
(
"/delete"
)
@ResponseBody
public
JSONObject
delete
(
String
id
)
{
JSONObject
rtnJosn
=
new
JSONObject
();
try
{
productBatchService
.
delete
(
id
);
rtnJosn
.
put
(
"errorNo"
,
0
);
}
catch
(
Exception
e
)
{
rtnJosn
.
put
(
"errorNo"
,
1
);
}
return
rtnJosn
;
}
@RequestMapping
(
"/exportExcel"
)
@RequiresPermissions
(
value
=
PRODUCTBATCH_VIEW
)
public
void
exportExcel
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Long
accountId
=
UserUtils
.
getmpaccounts
(
request
);
Sort
sort
=
new
Sort
(
"create_time"
,
OrderType
.
ASC
);
Conds
conds
=
new
Conds
();
conds
.
equal
(
"del_flag"
,
0
);
conds
.
equal
(
"accounts_id"
,
accountId
);
List
<
ProductBatch
>
list
=
productBatchService
.
fetchSearchByPage
(
conds
,
sort
,
0
,
0
);
ExcelKit
.
$Export
(
ProductBatch
.
class
,
response
).
toExcel
(
list
,
"产品批次信息"
);
}
@RequestMapping
(
"/templateExcel"
)
@RequiresPermissions
(
value
=
PRODUCTBATCH_VIEW
)
public
void
templateExcel
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
ExcelKit
.
$Export
(
ProductBatch
.
class
,
response
).
toExcel
(
null
,
"产品批次信息"
);
}
@RequestMapping
(
"/importExcel"
)
@RequiresPermissions
(
value
=
PRODUCTBATCH_EDIT
)
public
String
importExcel
(
HttpServletRequest
request
,
MultipartFile
file
,
Model
model
)
{
Long
accountId
=
UserUtils
.
getmpaccounts
(
request
);
if
(
file
==
null
)
{
return
list
(
request
,
model
);
}
// 构造临时路径来存储上传的文件
String
uploadPath
=
System
.
getProperty
(
"java.io.tmpdir"
);
File
uploadDir
=
new
File
(
uploadPath
);
if
(!
uploadDir
.
exists
())
{
uploadDir
.
mkdir
();
}
String
fileName
=
file
.
getOriginalFilename
();
String
filePath
=
uploadPath
+
File
.
separator
+
fileName
;
File
storeFile
=
new
File
(
filePath
);
try
{
file
.
transferTo
(
storeFile
);
ExcelKit
.
$Import
().
setEmptyCellValue
(
""
).
readExcel
(
storeFile
,
rowData
->
{
if
(!
StringUtils
.
isEmpty
(
rowData
.
get
(
0
)))
{
ProductBatch
productBatch
=
new
ProductBatch
();
productBatch
.
setAccountsId
(
accountId
);
productBatchService
.
save
(
productBatch
);
}
});
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
());
}
return
list
(
request
,
model
);
}
}
aidea-modules/product-module/src/main/java/com/cftech/product/web/ProductController.java
View file @
dc664365
...
...
@@ -65,10 +65,10 @@ public class ProductController {
public
String
list
(
HttpServletRequest
request
,
Model
model
)
{
Long
accountId
=
UserUtils
.
getmpaccounts
(
request
);
Conds
conds
=
new
Conds
();
conds
.
equal
(
"a.del_flag"
,
0
);
Sort
sort
=
new
Sort
(
"a.create_time"
,
OrderType
.
DESC
);
List
<
Productclassify
>
list
=
productclassifyService
.
fetchSearchByPage
(
conds
,
sort
,
0
,
0
);
model
.
addAttribute
(
"list"
,
list
);
conds
.
equal
(
"a.del_flag"
,
0
);
Sort
sort
=
new
Sort
(
"a.create_time"
,
OrderType
.
DESC
);
List
<
Productclassify
>
list
=
productclassifyService
.
fetchSearchByPage
(
conds
,
sort
,
0
,
0
);
model
.
addAttribute
(
"list"
,
list
);
model
.
addAttribute
(
"accountId"
,
accountId
);
return
"product/productlist"
;
}
...
...
@@ -82,10 +82,10 @@ public class ProductController {
model
.
addAttribute
(
"data"
,
product
);
}
Conds
conds
=
new
Conds
();
conds
.
equal
(
"a.del_flag"
,
0
);
Sort
sort
=
new
Sort
(
"a.create_time"
,
OrderType
.
DESC
);
List
<
Productclassify
>
list
=
productclassifyService
.
fetchSearchByPage
(
conds
,
sort
,
0
,
0
);
model
.
addAttribute
(
"list"
,
list
);
conds
.
equal
(
"a.del_flag"
,
0
);
Sort
sort
=
new
Sort
(
"a.create_time"
,
OrderType
.
DESC
);
List
<
Productclassify
>
list
=
productclassifyService
.
fetchSearchByPage
(
conds
,
sort
,
0
,
0
);
model
.
addAttribute
(
"list"
,
list
);
return
"product/productform"
;
}
...
...
@@ -115,7 +115,7 @@ public class ProductController {
product
.
setAccountsId
(
accountsId
);
product
.
setDelFlag
(
false
);
if
(
StringUtils
.
isBlank
(
product
.
getProductNumber
()))
{
product
.
setProductNumber
(
codingruleUtils
.
getNumber
(
accountsId
,
Product
.
class
.
getName
()));
product
.
setProductNumber
(
codingruleUtils
.
getNumber
(
accountsId
,
Product
.
class
.
getName
()));
}
product
.
setAccountsId
(
UserUtils
.
getmpaccounts
(
request
));
product
.
setCreateBy
(
UserUtils
.
getUser
().
getId
());
...
...
@@ -140,16 +140,19 @@ public class ProductController {
conds
.
equal
(
"a.del_flag"
,
Constants
.
DEL_FLAG_0
);
conds
.
equal
(
"a.accounts_id"
,
accountsId
);
List
<
String
>
classifyId
=
null
;
if
(!
StringUtils
.
isEmpty
(
product
.
getProductName
()))
{
conds
.
like
(
"a.product_name"
,
product
.
getProductName
());
if
(!
StringUtils
.
isEmpty
(
product
.
getProductName
()))
{
conds
.
like
(
"a.product_name"
,
product
.
getProductName
());
}
if
(!
StringUtils
.
isEmpty
(
product
.
getClassifyId
())){
classifyId
=
Arrays
.
asList
(
product
.
getClassifyId
().
split
(
","
));
if
(!
StringUtils
.
isEmpty
(
product
.
getCommonName
()))
{
conds
.
like
(
"a.common_name"
,
product
.
getCommonName
());
}
if
(!
StringUtils
.
isEmpty
(
product
.
getClassifyId
()))
{
classifyId
=
Arrays
.
asList
(
product
.
getClassifyId
().
split
(
","
));
}
Sort
sort
=
new
Sort
(
"a.create_time"
,
OrderType
.
DESC
);
List
<
Product
>
list
=
productService
.
selectProduct
(
conds
,
sort
,
iDisplayStart
,
iDisplayLength
,
classifyId
);
List
<
Product
>
list
=
productService
.
selectProduct
(
conds
,
sort
,
iDisplayStart
,
iDisplayLength
,
classifyId
);
Integer
counts
=
productService
.
count
(
conds
);
JSONObject
rtnJson
=
new
JSONObject
();
rtnJson
.
put
(
"iTotalRecords"
,
counts
);
...
...
@@ -175,21 +178,21 @@ public class ProductController {
@RequestMapping
(
"/exportExcel"
)
@RequiresPermissions
(
value
=
PRODUCT_VIEW
)
public
void
exportExcel
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Product
product
)
{
public
void
exportExcel
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Product
product
)
{
Long
accountsId
=
UserUtils
.
getmpaccounts
(
request
);
Conds
conds
=
new
Conds
();
conds
.
equal
(
"a.del_flag"
,
Constants
.
DEL_FLAG_0
);
conds
.
equal
(
"a.accounts_id"
,
accountsId
);
List
<
String
>
classifyId
=
null
;
if
(!
StringUtils
.
isEmpty
(
product
.
getProductName
()))
{
conds
.
like
(
"a.product_name"
,
product
.
getProductName
());
if
(!
StringUtils
.
isEmpty
(
product
.
getProductName
()))
{
conds
.
like
(
"a.product_name"
,
product
.
getProductName
());
}
if
(!
StringUtils
.
isEmpty
(
product
.
getClassifyId
()))
{
if
(!
StringUtils
.
isEmpty
(
product
.
getClassifyId
()))
{
classifyId
=
Arrays
.
asList
(
product
.
getClassifyId
().
split
(
","
));
}
Sort
sort
=
new
Sort
(
"a.create_time"
,
OrderType
.
DESC
);
List
<
Product
>
list
=
productService
.
selectProduct
(
conds
,
sort
,
0
,
0
,
classifyId
);
List
<
Product
>
list
=
productService
.
selectProduct
(
conds
,
sort
,
0
,
0
,
classifyId
);
ExcelKit
.
$Export
(
Product
.
class
,
response
).
toExcel
(
list
,
"产品信息"
);
}
...
...
@@ -227,9 +230,9 @@ public class ProductController {
file
.
transferTo
(
storeFile
);
ExcelKit
.
$Import
().
setEmptyCellValue
(
""
).
readExcel
(
storeFile
,
rowData
->
{
Product
product
=
new
Product
();
if
(!
StringUtils
.
isEmpty
(
rowData
.
get
(
0
)))
{
String
ids
=
productclassifyService
.
selectIdsByNumber
(
rowData
.
get
(
0
));
if
(
ids
!=
null
)
{
if
(!
StringUtils
.
isEmpty
(
rowData
.
get
(
0
)))
{
String
ids
=
productclassifyService
.
selectIdsByNumber
(
rowData
.
get
(
0
));
if
(
ids
!=
null
)
{
//产品分类ID
product
.
setClassifyId
(
ids
);
product
.
setClassifyNumber
(
rowData
.
get
(
0
));
...
...
@@ -238,13 +241,13 @@ public class ProductController {
product
.
setAccountsId
(
accountId
);
//产品编码
Conds
conds
=
new
Conds
();
conds
.
equal
(
"a.product_number"
,
rowData
.
get
(
1
).
trim
());
conds
.
equal
(
"a.del_flag"
,
0
);
conds
.
equal
(
"a.product_number"
,
rowData
.
get
(
1
).
trim
());
conds
.
equal
(
"a.del_flag"
,
0
);
Product
listProduct
=
productService
.
fetchSearchByConds
(
conds
);
if
(
listProduct
==
null
)
{
if
(
listProduct
==
null
)
{
sbProduct
.
append
(
rowData
.
get
(
1
));
return
;
}
else
{
}
else
{
product
.
setProductNumber
(
rowData
.
get
(
1
).
trim
());
}
//产品名称
...
...
@@ -272,14 +275,14 @@ public class ProductController {
//服用数量
product
.
setTakeAmount
(
rowData
.
get
(
13
));
//库存
if
(
StringUtils
.
isEmpty
(
rowData
.
get
(
14
))
||
rowData
.
get
(
14
).
contains
(
"-"
))
{
if
(
StringUtils
.
isEmpty
(
rowData
.
get
(
14
))
||
rowData
.
get
(
14
).
contains
(
"-"
))
{
sbClassify
.
append
(
rowData
.
get
(
1
));
return
;
}
else
{
}
else
{
product
.
setStock
(
Long
.
valueOf
(
rowData
.
get
(
14
)));
}
//价格
if
(!
StringUtils
.
isEmpty
(
rowData
.
get
(
15
)))
{
if
(!
StringUtils
.
isEmpty
(
rowData
.
get
(
15
)))
{
product
.
setPrice
(
Double
.
valueOf
(
rowData
.
get
(
15
)));
}
//是否为处方药
...
...
@@ -296,11 +299,11 @@ public class ProductController {
}
retJson
.
put
(
"errorNo"
,
"0"
);
if
(
sbClassify
.
length
()>
0
)
{
retJson
.
put
(
"errorMsg"
,
"部分导入失败,产品编码有:"
+
sbClassify
.
toString
()+
"; 失败原因:库存不能为空或者为负数"
);
}
else
if
(
sbProduct
.
length
()
>
0
)
{
retJson
.
put
(
"errorMsg"
,
"部分导入失败,产品编码有:"
+
sbProduct
.
toString
()+
"; 失败原因:错误产品编码"
);
}
else
{
if
(
sbClassify
.
length
()
>
0
)
{
retJson
.
put
(
"errorMsg"
,
"部分导入失败,产品编码有:"
+
sbClassify
.
toString
()
+
"; 失败原因:库存不能为空或者为负数"
);
}
else
if
(
sbProduct
.
length
()
>
0
)
{
retJson
.
put
(
"errorMsg"
,
"部分导入失败,产品编码有:"
+
sbProduct
.
toString
()
+
"; 失败原因:错误产品编码"
);
}
else
{
retJson
.
put
(
"errorMsg"
,
"导入成功"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment