Commit dc664365 authored by 谢希宇's avatar 谢希宇

Submit by Strive

Date 2021/03/18
parent c29b84c8
......@@ -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>
......
......@@ -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);
......
......@@ -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.getExpireDate());
number = buyingMedicineNumber(openid, lastCouponrecord.getCreateTime());
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> firstCouponrecordList = findCouponrecordBySort("2", openid);
number = buyingMedicineNumber(openid, firstCouponrecordList.get(0).getExpireDate());//获取最后一张券购买数量
List<Couponrecord> lastCouponrecordList = findCouponrecordBySort("2", openid);
number = buyingMedicineNumber(openid, lastCouponrecordList.get(0).getCreateTime());//获取最后一张券购买数量
//通过第一张最后购买数量,所以只需赠送第二章
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<>();
......
......@@ -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>";
}
}
},
......
......@@ -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';
......
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
<?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} &lt;&gt; #{cond.value}</if>
<if test="cond.condType == 'GREATEQUAL'">${cond.param} &gt;= #{cond.value}</if>
<if test="cond.condType == 'GREATTHAN'">${cond.param} &gt; #{cond.value}</if>
<if test="cond.condType == 'LESSEQUAL'">${cond.param} &lt;= #{cond.value}</if>
<if test="cond.condType == 'LESSTHAN'">${cond.param} &lt; #{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
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
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> {
}
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
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);
}
}
......@@ -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", "导入成功");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment