platform/.env.development
@@ -7,4 +7,9 @@ # 任康 # VUE_APP_API = 'http://192.168.0.15:10017/' # ç¦æ¾ VUE_APP_API = 'http://192.168.0.36:10011' # æ±è VUE_APP_API = 'http://192.168.0.35:10011' #æµè¯æå¡å¨ # VUE_APP_API = 'https://dmtest.ahapp.net/preselect_admin_interface' platform/src/components/business/OperaGoodsWindow.vue
@@ -118,6 +118,8 @@ if (target == null) { this.$nextTick(() => { this.$refs.form.resetFields() this.form.imgurl = '' this.form.imgfullurl = '' this.form.multifileList = [] this.form.baseGoodsParamList = [] this.form[this.configData['field.id']] = null platform/src/views/business/baseData.vue
@@ -23,46 +23,35 @@ </el-form-item> <section> <el-button type="primary" @click="search">æç´¢</el-button> <!-- <el-button type="primary" :loading="isWorking.export" v-permissions="['business:basedata:exportExcel']" @click="exportExcel">导åº</el-button> --> <el-button @click="reset">éç½®</el-button> </section> </el-form> <!-- è¡¨æ ¼åå页 --> <template v-slot:table-wrap> <ul class="toolbar" v-permissions="['business:basedata:create', 'business:basedata:delete']"> <!-- <li><el-button type="primary" @click="$refs.operaBaseDataWindow.open('æ°å»ºååæºæ°æ®ä¿¡æ¯è¡¨')" icon="el-icon-plus" v-permissions="['business:basedata:create']">æ°å»º</el-button></li> --> <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:basedata:delete']">æ¹éå é¤</el-button></li> <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:basedata:delete']">æ¹éå é¤</el-button></li> </ul> <el-table v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange" > <el-table v-loading="isWorking.search" :data="tableData.list" border stripe @selection-change="handleSelectionChange"> <el-table-column type="selection" width="55"></el-table-column> <el-table-column prop="id" label="主é®" min-width="100px"></el-table-column> <el-table-column prop="createDate" label="å建æ¶é´" min-width="100px"></el-table-column> <el-table-column prop="name" label="åå主å¾" min-width="80px"> <template slot-scope="{row}"> <a :href="`${row.url}`" target="_blank"> <div style="display: flex; align-items: center;"> <div style="width: 70px; height: 70px; flex-shrink: 0;"> <el-image v-if="row.imgurl" style="width: 70px; height: 70px" :src="row.imgurl" :preview-src-list="[row.imgurl]" fit="cover"></el-image> </div> </div> </a> <div style="display: flex; align-items: center;"> <div style="width: 70px; height: 70px; flex-shrink: 0;"> <el-image v-if="row.imgurl" style="width: 70px; height: 70px" :src="row.imgurl" :preview-src-list="[row.imgurl]" fit="cover"></el-image> </div> </div> </template> </el-table-column> <el-table-column prop="name" label="åååç§°" min-width="150px"> <template slot-scope="{row}"> <a :href="`${row.url}`" target="_blank">{{row.name}}</a> <a :href="`${row.url}`" target="_blank">{{ row.name }}</a> </template> </el-table-column> <!-- <el-table-column prop="title" label="æ é¢" min-width="100px"></el-table-column>--> <!-- <el-table-column prop="title" label="æ é¢" min-width="100px"></el-table-column>--> <el-table-column prop="sku" label="京ä¸sku" min-width="100px"></el-table-column> <el-table-column prop="brand" label="åç" min-width="120px"></el-table-column> <el-table-column prop="category" label="ç±»å«" min-width="100px"></el-table-column> @@ -71,76 +60,43 @@ <el-table-column prop="haveStock" label="åºåæ åµ" min-width="100px"></el-table-column> <el-table-column prop="bgImgs" label="大å¾" min-width="80px"> <template slot-scope="{row}"> <div style="display: flex; align-items: center;"> <el-button type="text" @click="showImage(row.bgImgs)">æ¥ç大å¾</el-button> <!-- <div style="display: flex; align-items: center;"> <div style="width: 70px; height: 70px; flex-shrink: 0;"> <el-image v-if="row.bgImgs" style="width: 70px; height: 70px" :src="row.bgImgs" :preview-src-list="row.bgImgs" fit="cover"></el-image> :preview-src-list="row.bgImgs" fit="cover"></el-image> </div> </div> </div> --> </template> </el-table-column> <!-- <el-table-column prop="attr1" label="屿§1" min-width="100px"></el-table-column> <el-table-column prop="attr2" label="屿§2" min-width="100px"></el-table-column> <el-table-column prop="attr3" label="屿§3" min-width="100px"></el-table-column> <el-table-column prop="attr4" label="屿§4" min-width="100px"></el-table-column> <el-table-column prop="attr5" label="屿§5" min-width="100px"></el-table-column> <el-table-column prop="attr6" label="屿§6" min-width="100px"></el-table-column> <el-table-column prop="attr7" label="屿§7" min-width="100px"></el-table-column> <el-table-column prop="attr8" label="屿§8" min-width="100px"></el-table-column> <el-table-column prop="attr9" label="屿§9" min-width="100px"></el-table-column> <el-table-column prop="attr10" label="屿§10" min-width="100px"></el-table-column> <el-table-column prop="attr11" label="屿§11" min-width="100px"></el-table-column> <el-table-column prop="attr12" label="屿§12" min-width="100px"></el-table-column> <el-table-column prop="attr13" label="屿§13" min-width="100px"></el-table-column> <el-table-column prop="attr14" label="屿§14" min-width="100px"></el-table-column> <el-table-column prop="attr15" label="屿§15" min-width="100px"></el-table-column> <el-table-column prop="attr16" label="屿§16" min-width="100px"></el-table-column> <el-table-column prop="attr17" label="屿§17" min-width="100px"></el-table-column> <el-table-column prop="attr18" label="屿§18" min-width="100px"></el-table-column> <el-table-column prop="attr19" label="屿§19" min-width="100px"></el-table-column> <el-table-column prop="attr20" label="屿§20" min-width="100px"></el-table-column> <el-table-column prop="attr21" label="屿§21" min-width="100px"></el-table-column> <el-table-column prop="attr22" label="屿§22" min-width="100px"></el-table-column> <el-table-column prop="attr23" label="屿§23" min-width="100px"></el-table-column> <el-table-column prop="attr24" label="屿§24" min-width="100px"></el-table-column> <el-table-column prop="attr25" label="屿§25" min-width="100px"></el-table-column> <el-table-column prop="attr26" label="屿§26" min-width="100px"></el-table-column> <el-table-column prop="attr27" label="屿§27" min-width="100px"></el-table-column> <el-table-column prop="attr28" label="屿§28" min-width="100px"></el-table-column> <el-table-column prop="attr29" label="屿§29" min-width="100px"></el-table-column> <el-table-column prop="attr30" label="屿§30" min-width="100px"></el-table-column> <el-table-column prop="attr31" label="屿§31" min-width="100px"></el-table-column> <el-table-column prop="attr32" label="屿§32" min-width="100px"></el-table-column> <el-table-column prop="attr33" label="屿§33" min-width="100px"></el-table-column> <el-table-column prop="attr34" label="屿§34" min-width="100px"></el-table-column> --><el-table-column prop="status" label="å¤çç¶æ" min-width="100px"> <template slot-scope="{row}"> {{row.status==1?"å·²å¤ç":"æªå¤ç"}} </template> </el-table-column> <el-table-column v-if="containPermissions(['business:basedata:update', 'business:basedata:delete'])" label="æä½" min-width="80" fixed="right" > <el-table-column prop="status" label="å¤çç¶æ" min-width="100px"> <template slot-scope="{row}"> <!-- {{ row.status == 1 ? "å·²å¤ç" : "æªå¤ç" }} </template> </el-table-column> <el-table-column v-if="containPermissions(['business:basedata:update', 'business:basedata:delete'])" label="æä½" min-width="80" fixed="right"> <template slot-scope="{row}"> <!-- <el-button type="text" @click="$refs.operaBaseDataWindow.open('ç¼è¾ååæºæ°æ®ä¿¡æ¯è¡¨', row)" icon="el-icon-edit" v-permissions="['business:basedata:update']">ç¼è¾</el-button> --> <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:basedata:delete']">å é¤</el-button> <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:basedata:delete']">å é¤</el-button> </template> </el-table-column> </el-table> <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination" > <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> </pagination> </template> <!-- æ°å»º/ä¿®æ¹ --> <OperaBaseDataWindow ref="operaBaseDataWindow" @success="handlePageChange"/> <OperaBaseDataWindow ref="operaBaseDataWindow" @success="handlePageChange" /> <el-image-viewer v-if="showViewer" :on-close="closeViewer" :initialIndex="0" :url-list="srcList" :z-index="3000" /> </TableLayout> </template> @@ -149,12 +105,15 @@ import TableLayout from '@/layouts/TableLayout' import Pagination from '@/components/common/Pagination' import OperaBaseDataWindow from '@/components/business/OperaBaseDataWindow' import ElImageViewer from 'element-ui/packages/image/src/image-viewer' export default { name: 'BaseData', extends: BaseTable, components: { TableLayout, Pagination, OperaBaseDataWindow }, data () { components: { TableLayout, Pagination, OperaBaseDataWindow, ElImageViewer }, data() { return { showViewer: false, srcList: [], // æç´¢ searchForm: { name: '', @@ -169,7 +128,7 @@ ] } }, created () { created() { this.config({ module: 'ååæºæ°æ®ä¿¡æ¯è¡¨', api: '/business/baseData', @@ -177,6 +136,17 @@ 'field.main': 'id' }) this.search() } }, methods: { showImage(imgs) { this.srcList = [] this.srcList = imgs this.showViewer = true }, closeViewer() { this.showViewer = false } }, } </script> platform/src/views/business/company.vue
@@ -35,6 +35,7 @@ <el-table v-loading="isWorking.search" :data="tableData.list" border stripe @selection-change="handleSelectionChange"> <!-- <el-table-column type="selection" width="55" align="center"></el-table-column> --> <el-table-column prop="id" label="ä¼ä¸ç¼å·" min-width="80px" align="center"></el-table-column> <el-table-column prop="name" label="ä¼ä¸åç§°" min-width="100px" align="center"></el-table-column> <el-table-column prop="managerUserName" label="管çåè´¦å·" min-width="100px" align="center"></el-table-column> <el-table-column prop="linkname" label="è系人" min-width="100px" align="center"></el-table-column> server/company/src/main/java/com/doumee/api/business/CategoryController.java
@@ -13,6 +13,7 @@ import com.doumee.dao.business.model.BaseCateParam; import com.doumee.dao.business.model.BaseCategory; import com.doumee.dao.business.model.Category; import com.doumee.service.CateParamSelectService; import com.doumee.service.business.BaseCateParamService; import com.doumee.service.business.BaseCategoryService; import com.doumee.service.business.CategoryService; @@ -45,6 +46,8 @@ @Autowired private BaseCateParamService baseCateParamService; @Autowired private CateParamSelectService cateParamSelectService; @PreventRepeat @ApiOperation("æ°å»º") @@ -97,6 +100,7 @@ @RequiresPermissions("business:category:update") public ApiResponse companyUpdateById(@RequestBody Category category) { categoryService.companyUpdateById(category); cateParamSelectService.dealCateParamSelect(); return ApiResponse.success(null); } @@ -156,7 +160,6 @@ BaseCategory baseCategory = new BaseCategory(); baseCategory.setIsdeleted(Constants.ZERO); baseCategory.setStatus(Constants.ZERO); baseCategoryService.findList(baseCategory); List list = baseCategoryService.findList(baseCategory); return ApiResponse.success(list); } server/company/src/main/java/com/doumee/api/business/GoodsController.java
@@ -13,6 +13,7 @@ import com.doumee.service.CateParamSelectService; import com.doumee.service.business.GoodsService; import io.swagger.annotations.*; import lombok.extern.java.Log; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -56,7 +57,7 @@ // @RequiresPermissions("business:goods:create") public ApiResponse companyCreate(@RequestBody Goods goods) { goodsService.companyCreate(goods); cateParamSelectService.dealGroupVals(goods.getCompanyId()); cateParamSelectService.dealCateParamSelect(); return ApiResponse.success("æä½æå"); } @@ -65,7 +66,9 @@ @PostMapping("/createPlat") @RequiresPermissions("business:goods:create") public ApiResponse createPlat(@RequestBody GoodCreatePlatRequest param) { return ApiResponse.success(goodsService.createPlat(param)); goodsService.createPlat(param); cateParamSelectService.dealCateParamSelect(); return ApiResponse.success("æä½æå"); } @ApiOperation("æ ¹æ®IDå é¤") @@ -73,6 +76,7 @@ @RequiresPermissions("business:goods:delete") public ApiResponse deleteById(@PathVariable Integer id) { goodsService.deleteById(id); cateParamSelectService.dealCateParamSelect(); return ApiResponse.success(null); } @@ -86,6 +90,7 @@ idList.add(Integer.valueOf(id)); } goodsService.deleteByIdInBatch(idList); cateParamSelectService.dealCateParamSelect(); return ApiResponse.success(null); } @@ -102,6 +107,7 @@ @RequiresPermissions("business:goods:update") public ApiResponse companyUpdateById(@RequestBody Goods goods) { goodsService.companyUpdateById(goods); cateParamSelectService.dealCateParamSelect(); return ApiResponse.success(null); } @@ -135,7 +141,9 @@ }) // @RequiresPermissions("business:goods:create") public ApiResponse<Integer> importExcel (@ApiParam(value = "file") MultipartFile file) { return ApiResponse.success(goodsService.importBatch(file)); Integer val = goodsService.importBatch(file); cateParamSelectService.dealCateParamSelect(); return ApiResponse.success(val); } server/company/src/main/java/com/doumee/config/shiro/ShiroRealm.java
@@ -4,9 +4,12 @@ import com.doumee.core.exception.BusinessException; import com.doumee.core.model.LoginUserInfo; import com.doumee.core.utils.Constants; import com.doumee.core.utils.DateUtil; import com.doumee.dao.business.model.Company; import com.doumee.dao.system.model.SystemPermission; import com.doumee.dao.system.model.SystemRole; import com.doumee.dao.system.model.SystemUser; import com.doumee.service.business.CompanyService; import com.doumee.service.system.SystemDataPermissionService; import com.doumee.service.system.SystemPermissionService; import com.doumee.service.system.SystemRoleService; @@ -23,6 +26,7 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import java.util.Date; import java.util.List; /** @@ -48,6 +52,10 @@ @Autowired private SystemPermissionService systemPermissionService; @Lazy @Autowired private CompanyService companyService; /** * æéå¤ç * @author Eva.Caesar Liu @@ -69,7 +77,7 @@ * @date 2022/03/15 09:54 */ @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException{ // è·åç¨æ·å String username = authenticationToken.getPrincipal().toString(); // æ ¹æ®ç¨æ·åæ¥è¯¢ç¨æ·å¯¹è±¡ @@ -86,6 +94,15 @@ if(!Constants.equalsInteger(user.getStatus(),Constants.ZERO)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·ï¼è´¦å·ä¿¡æ¯å·²è¢«ç¦ç¨ï¼å¦æçé®è¯·è系系ç»ç®¡çåï¼"); } if(!user.getType().equals(Constants.UserType.SYSTEM)){ Company company = companyService.findById(user.getCompanyId()); if(company.getStatus().equals(Constants.ONE)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·ï¼ä¼ä¸ä¿¡æ¯å·²è¢«ç¦ç¨ï¼å¦æçé®è¯·è系系ç»ç®¡çåï¼"); } if(DateUtil.compareDate(new Date(),DateUtil.addDaysToDate(company.getOepnValidDate(),1))<=Constants.ZERO){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·ï¼ä¼ä¸ä¿¡æ¯å·²è¿æï¼å¦æçé®è¯·è系系ç»ç®¡çåï¼"); } } // è·åç»å½ç¨æ·ä¿¡æ¯ List<SystemRole> roles = systemRoleService.findByUserId(user.getId()); server/platform/pom.xml
@@ -47,11 +47,6 @@ </execution> </executions> </plugin> <!--<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.6</version> </plugin>--> </plugins> </build> server/platform/src/main/java/com/doumee/task/ScheduleTool.java
@@ -24,7 +24,7 @@ * 宿¶å¤çç¬è«æºæ°æ®ï¼çæç´ æåºæ°æ® * @throws Exception */ @Scheduled(fixedDelay=10*60*1000) @Scheduled(fixedDelay=30*60*1000) public void dealBaseData() throws Exception { baseDataService.dealBaseData(); } server/pom.xml
@@ -9,13 +9,13 @@ <packaging>pom</packaging> <name>preselect</name> <description></description> <modules> <module>platform</module> <module>service</module> <module>company</module> </modules> <modules> <module>platform</module> <module>service</module> <module>company</module> </modules> <parent> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.5.RELEASE</version> @@ -34,7 +34,6 @@ <oshi.version>5.7.0</oshi.version> <jna.version>5.7.0</jna.version> <poi.version>5.0.0</poi.version> <maven.build.timestamp.format>yyyy-MM-dd-HH-mm</maven.build.timestamp.format> </properties> <dependencies> @@ -202,26 +201,7 @@ <artifactId>jxl</artifactId> <version>2.6.12</version> </dependency> </dependencies> <profiles> <profile> <id>dev</id> <properties> <evn>dev</evn> </properties> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> <profile> <id>test</id> <properties> <evn>test</evn> </properties> </profile> </profiles> <build> <plugins> <plugin> @@ -234,28 +214,4 @@ </plugin> </plugins> </build> <!--<build> <finalName>${project.artifactId}</finalName> <resources> <resource> <directory>service/src/main/resources</directory> <!– <filtering>true</filtering>–> </resource> </resources> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>com.doumee.Application</mainClass> </configuration> </plugin> </plugins> </build>--> </project> server/service/src/main/java/com/doumee/biz/system/impl/SystemUserBizImpl.java
@@ -7,11 +7,13 @@ import com.doumee.core.model.LoginUserInfo; import com.doumee.core.utils.Constants; import com.doumee.core.utils.Utils; import com.doumee.dao.business.model.Company; import com.doumee.dao.system.dto.*; import com.doumee.dao.system.model.SystemDepartment; import com.doumee.dao.system.model.SystemDepartmentUser; import com.doumee.dao.system.model.SystemUser; import com.doumee.dao.system.model.SystemUserRole; import com.doumee.service.business.CompanyService; import com.doumee.service.system.*; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; @@ -32,6 +34,9 @@ @Autowired private SystemUserService systemUserService; @Autowired private CompanyService companyService; @Autowired private SystemUserRoleService systemUserRoleService; @@ -247,6 +252,16 @@ if (user != null) { throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "ç¨æ·åå·²åå¨"); } if(createCompanyUserDTO.getType().equals(Constants.UserType.ZHUBO.getKey())){ Company company = companyService.findById(loginUserInfo.getCompanyId()); SystemUser zbUserNum = new SystemUser(); zbUserNum.setCompanyId(loginUserInfo.getCompanyId()); zbUserNum.setDeleted(Boolean.FALSE); zbUserNum.setType(Constants.UserType.ZHUBO.getKey()); if(systemUserService.findList(zbUserNum).size()>=company.getUserNum()){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·ï¼å·²è¶ åºä¼ä¸å¯åé ä¸»ææ°éï¼å¦æçé®è¯·è系系ç»ç®¡çåï¼"); } } SystemUser systemUser = new SystemUser(); BeanUtils.copyProperties(createCompanyUserDTO,systemUser); systemUser.setCompanyId(loginUserInfo.getCompanyId()); server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -29,6 +29,7 @@ public static final String TOP_IMG = "TOP_IMG"; public static final String PK_IMG = "PK_IMG"; public static final String RANGE_SIZE = "RANGE_SIZE"; public static final String CATE_PARAM_OPEN = "_CATE_PARAM_OPEN"; public static final String SYSTEM ="SYSTEM"; server/service/src/main/java/com/doumee/dao/business/CateParamSelectMapper.java
@@ -3,10 +3,14 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.doumee.dao.business.model.CateParamSelect; import java.util.List; /** * @author æ±è¹è¹ * @date 2023/09/11 14:45 */ public interface CateParamSelectMapper extends BaseMapper<CateParamSelect> { void insertBatch(Integer companyId,Integer userId); } server/service/src/main/java/com/doumee/service/CateParamSelectService.java
@@ -1,5 +1,6 @@ package com.doumee.service; import com.doumee.core.model.LoginUserInfo; import com.doumee.core.model.PageData; import com.doumee.core.model.PageWrap; import com.doumee.dao.business.model.CateParamSelect; @@ -96,5 +97,5 @@ */ long count(CateParamSelect cateParamSelect); void dealGroupVals(Integer companyId); void dealCateParamSelect(); } server/service/src/main/java/com/doumee/service/business/impl/BaseCategoryServiceImpl.java
@@ -257,8 +257,9 @@ @Override public List<BaseCategory> findList(BaseCategory baseCategory) { baseCategory.setIsdeleted(Constants.ZERO); QueryWrapper<BaseCategory> wrapper = new QueryWrapper<>(baseCategory); wrapper.eq("ISDELETED",Constants.ZERO); wrapper.eq("STATUS",Constants.ZERO); List<BaseCategory> list = baseCategoryMapper.selectList(wrapper); list.forEach(i->{ if(StringUtils.isNotBlank(i.getImgurl())){ server/service/src/main/java/com/doumee/service/business/impl/BaseDataServiceImpl.java
@@ -22,6 +22,7 @@ import org.springframework.context.annotation.Lazy; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -313,7 +314,6 @@ } public static boolean IS_RUNNING = false; @Override @Transactional @Async public void dealBaseData() { if(IS_RUNNING){ @@ -350,48 +350,7 @@ OssModel ossModel = initOssModel(); Date date = new Date(); for(BaseData data : allLis){ BaseGoods goods = new BaseGoods(); goods.setBaseDataId(data.getId()); goods.setIsdeleted(Constants.ZERO); if(baseGoodsMapper.selectCount(new QueryWrapper<>(goods)) >0){ //妿已ç»åå¨ï¼é»è¾å 餿§çååæ°æ® UpdateWrapper<BaseGoods> updateModel = new UpdateWrapper<>(); updateModel.lambda().set(BaseGoods::getIsdeleted,Constants.ONE); updateModel.lambda().set(BaseGoods::getEditDate, new Date()); updateModel.lambda().eq(BaseGoods::getBaseDataId, data.getId()); baseGoodsMapper.update(null, updateModel); } goods.setCreateDate(date); goods.setName(StringUtils.defaultString(data.getName(),data.getTitle())); goods.setRemark(data.getTitle()); goods.setContent(data.getTitle()); goods.setStatus(Constants.ZERO); goods.setShortPinyin(PinYinUtil.getFirstSpell(goods.getName())); goods.setPinyin(PinYinUtil.getFullSpell(goods.getName())); goods.setZdPrice(data.getPrice()); //å¤çåçæ°æ® Brand bModel = getBrandModelFromList(data.getBrand(),brandList); if(bModel!= null){ goods.setBrandId(bModel.getId()); } //å¤çåè¡¨æ°æ® BaseCategory cModel = getCateModelFromList(rate,data.getCategory(),ossModel,data.getCategoryImg(), cateList); if(cModel!= null){ goods.setCategoryId(cModel.getId()); } goods.setImgurl(getOssImgurl(ossModel,ossModel.getGoodsFolder(), data.getImgurl())); goods.setPrice(Constants.formatBigdecimal(data.getSaleprice()).multiply(Constants.formatBigdecimal(cModel.getPriceRate()))); //æå ¥æ°ååæ°æ® baseGoodsMapper.insert(goods); //å¤çåç±»å±æ§ dealCateParamAll(cModel.getId(),goods.getId(),data,paramList); //å¤çèæ¯å¾ dealBgImgAll(ossModel,goods.getId(),data); data.setEditDate(new Date()); data.setStatus(Constants.ONE); //æ´æ°æ°æ®å¤çç¶æ baseDataMapper.updateById(data); dealPerData(ossModel,rate,date,data,cateList,brandList,paramList); } log.info("å¼å§å¤çæºæ°æ®=================success================å¤çæ°æ®å ±ï¼"+allLis.size()+"ï¼ä¸ª==="); }catch (Exception e){ @@ -403,6 +362,52 @@ } } @Transactional(isolation = Isolation.READ_UNCOMMITTED) private void dealPerData(OssModel ossModel, BigDecimal rate, Date date, BaseData data, List<BaseCategory> cateList, List<Brand> brandList, List<BaseCateParam> paramList) { BaseGoods goods = new BaseGoods(); goods.setBaseDataId(data.getId()); goods.setIsdeleted(Constants.ZERO); if(baseGoodsMapper.selectCount(new QueryWrapper<>(goods)) >0){ //妿已ç»åå¨ï¼é»è¾å 餿§çååæ°æ® UpdateWrapper<BaseGoods> updateModel = new UpdateWrapper<>(); updateModel.lambda().set(BaseGoods::getIsdeleted,Constants.ONE); updateModel.lambda().set(BaseGoods::getEditDate, new Date()); updateModel.lambda().eq(BaseGoods::getBaseDataId, data.getId()); baseGoodsMapper.update(null, updateModel); } goods.setCreateDate(date); goods.setName(StringUtils.defaultString(data.getName(),data.getTitle())); goods.setRemark(data.getTitle()); goods.setContent(data.getTitle()); goods.setStatus(Constants.ZERO); goods.setShortPinyin(PinYinUtil.getFirstSpell(goods.getName())); goods.setPinyin(PinYinUtil.getFullSpell(goods.getName())); goods.setZdPrice(data.getPrice()); //å¤çåçæ°æ® Brand bModel = getBrandModelFromList(data.getBrand(),brandList); if(bModel!= null){ goods.setBrandId(bModel.getId()); } //å¤çåè¡¨æ°æ® BaseCategory cModel = getCateModelFromList(rate,data.getCategory(),ossModel,data.getCategoryImg(), cateList); if(cModel!= null){ goods.setCategoryId(cModel.getId()); } goods.setImgurl(getOssImgurl(ossModel,ossModel.getGoodsFolder(), data.getImgurl())); goods.setPrice(Constants.formatBigdecimal(data.getSaleprice()).multiply(Constants.formatBigdecimal(cModel.getPriceRate()))); //æå ¥æ°ååæ°æ® baseGoodsMapper.insert(goods); //å¤çåç±»å±æ§ dealCateParamAll(cModel.getId(),goods.getId(),data,paramList); //å¤çèæ¯å¾ dealBgImgAll(ossModel,goods.getId(),data); data.setEditDate(new Date()); data.setStatus(Constants.ONE); //æ´æ°æ°æ®å¤çç¶æ baseDataMapper.updateById(data); } private void dealBgImgAll(OssModel ossModel, Integer id, BaseData data) { int i =0; server/service/src/main/java/com/doumee/service/business/impl/BaseGoodsServiceImpl.java
@@ -94,7 +94,8 @@ insert.setIsdeleted(Constants.ZERO); insert.setRemark(baseGoods.getRemark()); insert.setName(baseGoods.getName()); insert.setStatus(Constants.ZERO); //é»è®¤ä¸æ¶ insert.setStatus(Constants.ONE); insert.setSortnum(integer+Constants.ONE); insert.setImgurl(baseGoods.getImgurl()); insert.setCategoryId(baseGoods.getCategoryId()); server/service/src/main/java/com/doumee/service/business/impl/BrandServiceImpl.java
@@ -159,7 +159,7 @@ wrapper.lambda().eq(Brand::getType,Constants.ONE); }else { wrapper.lambda().and(i->i.eq(Brand::getCompanyId,user.getCompanyId()) .or().eq(Brand::getType,Constants.ZERO) .or().eq(Brand::getType,Constants.ONE) ); } List<Brand> list = brandMapper.selectList(wrapper); @@ -186,6 +186,9 @@ if (pageWrap.getModel().getStatus() != null) { queryWrapper.lambda().eq(Brand::getStatus, pageWrap.getModel().getStatus()); } if (pageWrap.getModel().getType() != null) { queryWrapper.lambda().eq(Brand::getType, pageWrap.getModel().getType()); } // ç±»å 0ä¼ä¸ 1å¹³å° if (Objects.isNull(user.getCompanyId())) { queryWrapper.lambda().eq(Brand::getType,Constants.ONE); server/service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java
@@ -279,7 +279,8 @@ @Override public void companyUpdateById(Category category) { LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); if(categoryMapper.selectCount(new QueryWrapper<Category>().eq("ISDELETED",Constants.ZERO).ne("id",category.getId()).eq("name",category.getName()))>0){ if(categoryMapper.selectCount(new QueryWrapper<Category>().eq("ISDELETED",Constants.ZERO).eq("COMPANY_ID",user.getCompanyId()) .ne("id",category.getId()).eq("name",category.getName()))>0){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ã"+category.getName()+"ãå·²åå¨"); }; category.setStatus(Constants.ZERO); @@ -489,9 +490,11 @@ @Override public List<Category> findListForGoods(Integer goodsId) { LoginUserInfo loginUserInfo = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal(); QueryWrapper<Category> wrapper = new QueryWrapper<Category>() .eq("STATUS",Constants.ZERO) .eq("ISDELETED",Constants.ZERO) .eq("COMPANY_ID",loginUserInfo.getCompanyId()) .orderByAsc(" SORTNUM "); List<Category> list = categoryMapper.selectList(wrapper); String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() @@ -521,6 +524,9 @@ if (pageWrap.getModel().getStatus() != null) { queryWrapper.lambda().eq(Category::getStatus, pageWrap.getModel().getStatus()); } if (pageWrap.getModel().getType() != null) { queryWrapper.lambda().eq(Category::getType, pageWrap.getModel().getType()); } if (pageWrap.getModel().getCompanyId() != null) { queryWrapper.lambda().eq(Category::getCompanyId, pageWrap.getModel().getCompanyId()); } server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
@@ -223,19 +223,19 @@ goodsParamMapper.insert(goodsParam); //åå¨ cate_param_select æ¥è¯¢æ¯å¦å·²åå¨ if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ CateParamSelect cateParamSelect = new CateParamSelect(); cateParamSelect.setCreator(user.getId()); cateParamSelect.setCreateDate(new Date()); cateParamSelect.setName(goodsParam.getVal()); cateParamSelect.setIsdeleted(Constants.ZERO); cateParamSelect.setStatus(Constants.ZERO); cateParamSelect.setParamId(goodsParam.getPramaId()); cateParamSelect.setCategoryId(goods.getCategoryId()); cateParamSelect.setStatus(Constants.ZERO); cateParamSelectMapper.insert(cateParamSelect); }; // if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() // .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ // CateParamSelect cateParamSelect = new CateParamSelect(); // cateParamSelect.setCreator(user.getId()); // cateParamSelect.setCreateDate(new Date()); // cateParamSelect.setName(goodsParam.getVal()); // cateParamSelect.setIsdeleted(Constants.ZERO); // cateParamSelect.setStatus(Constants.ZERO); // cateParamSelect.setParamId(goodsParam.getPramaId()); // cateParamSelect.setCategoryId(goods.getCategoryId()); // cateParamSelect.setStatus(Constants.ZERO); // cateParamSelectMapper.insert(cateParamSelect); // }; } } @@ -360,19 +360,19 @@ goodsParam.setGoodsId(goods.getId()); goodsParamMapper.insert(goodsParam); //åå¨ cate_param_select æ¥è¯¢æ¯å¦å·²åå¨ if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ CateParamSelect cateParamSelect = new CateParamSelect(); cateParamSelect.setCreator(user.getId()); cateParamSelect.setCreateDate(new Date()); cateParamSelect.setName(goodsParam.getVal()); cateParamSelect.setIsdeleted(Constants.ZERO); cateParamSelect.setStatus(Constants.ZERO); cateParamSelect.setParamId(goodsParam.getPramaId()); cateParamSelect.setCategoryId(goods.getCategoryId()); cateParamSelect.setStatus(Constants.ZERO); cateParamSelectMapper.insert(cateParamSelect); }; // if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() // .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ // CateParamSelect cateParamSelect = new CateParamSelect(); // cateParamSelect.setCreator(user.getId()); // cateParamSelect.setCreateDate(new Date()); // cateParamSelect.setName(goodsParam.getVal()); // cateParamSelect.setIsdeleted(Constants.ZERO); // cateParamSelect.setStatus(Constants.ZERO); // cateParamSelect.setParamId(goodsParam.getPramaId()); // cateParamSelect.setCategoryId(goods.getCategoryId()); // cateParamSelect.setStatus(Constants.ZERO); // cateParamSelectMapper.insert(cateParamSelect); // }; } } return goods.getId(); @@ -469,7 +469,8 @@ goods.setShortPinyin(PinYinUtil.getFirstSpell(goods.getName())); goodsMapper.updateById(goods); multifileMapper.delete(new QueryWrapper<Multifile>().eq("OBJ_ID",goods.getId())); multifileMapper.delete(new QueryWrapper<Multifile>().eq("OBJ_ID",goods.getId()) .eq("OBJ_TYPE",0).eq("COMPANY_ID",user.getCompanyId())); List<Multifile> multifileList = goods.getMultifileList(); if(!Objects.isNull(multifileList)&&multifileList.size()>Constants.ZERO){ for (int i = 0; i < multifileList.size(); i++) { @@ -497,19 +498,19 @@ goodsParam.setGoodsId(goods.getId()); goodsParamMapper.insert(goodsParam); //åå¨ cate_param_select æ¥è¯¢æ¯å¦å·²åå¨ if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ CateParamSelect cateParamSelect = new CateParamSelect(); cateParamSelect.setCreator(user.getId()); cateParamSelect.setCreateDate(new Date()); cateParamSelect.setName(goodsParam.getVal()); cateParamSelect.setIsdeleted(Constants.ZERO); cateParamSelect.setStatus(Constants.ZERO); cateParamSelect.setParamId(goodsParam.getPramaId()); cateParamSelect.setCategoryId(goods.getCategoryId()); cateParamSelect.setStatus(Constants.ZERO); cateParamSelectMapper.insert(cateParamSelect); }; // if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() // .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ // CateParamSelect cateParamSelect = new CateParamSelect(); // cateParamSelect.setCreator(user.getId()); // cateParamSelect.setCreateDate(new Date()); // cateParamSelect.setName(goodsParam.getVal()); // cateParamSelect.setIsdeleted(Constants.ZERO); // cateParamSelect.setStatus(Constants.ZERO); // cateParamSelect.setParamId(goodsParam.getPramaId()); // cateParamSelect.setCategoryId(goods.getCategoryId()); // cateParamSelect.setStatus(Constants.ZERO); // cateParamSelectMapper.insert(cateParamSelect); // }; } } } @@ -677,7 +678,9 @@ if (pageWrap.getModel().getStatus() != null) { queryWrapper.eq(Goods::getStatus, pageWrap.getModel().getStatus()); } if (pageWrap.getModel().getType() != null) { queryWrapper.eq(Goods::getType, pageWrap.getModel().getType()); } if (pageWrap.getModel().getCategoryId() != null) { queryWrapper.eq(Goods::getCategoryId, pageWrap.getModel().getCategoryId()); } @@ -693,10 +696,6 @@ + systemDictDataBiz.queryByCode(Constants.OSS, Constants.GOODS_IMG).getCode(); goodsIPage.getRecords().forEach(i->{ i.setPrefixUrl(prefixUrl); if(i.getType().equals(Constants.ONE)){ i.setBasePrice(i.getBasePrice().multiply(i.getBasePriceRate())); } }); return PageData.from(goodsIPage); } @@ -875,19 +874,19 @@ //æå ¥äº§ååæ°å ³è表 goodsParamMapper.insert(gp); //åå¨ cate_param_select æ¥è¯¢æ¯å¦å·²åå¨ if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() .eq("PARAM_ID",gp.getPramaId()).eq("NAME",gp.getName()))<=Constants.ZERO){ CateParamSelect cateParamSelect = new CateParamSelect(); cateParamSelect.setCreator(user.getId()); cateParamSelect.setCreateDate(new Date()); cateParamSelect.setName(gp.getVal()); cateParamSelect.setIsdeleted(Constants.ZERO); cateParamSelect.setStatus(Constants.ZERO); cateParamSelect.setParamId(gp.getPramaId()); cateParamSelect.setCategoryId(newModel.getCategoryId()); cateParamSelect.setStatus(Constants.ZERO); cateParamSelectMapper.insert(cateParamSelect); }; // if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() // .eq("PARAM_ID",gp.getPramaId()).eq("NAME",gp.getName()))<=Constants.ZERO){ // CateParamSelect cateParamSelect = new CateParamSelect(); // cateParamSelect.setCreator(user.getId()); // cateParamSelect.setCreateDate(new Date()); // cateParamSelect.setName(gp.getVal()); // cateParamSelect.setIsdeleted(Constants.ZERO); // cateParamSelect.setStatus(Constants.ZERO); // cateParamSelect.setParamId(gp.getPramaId()); // cateParamSelect.setCategoryId(newModel.getCategoryId()); // cateParamSelect.setStatus(Constants.ZERO); // cateParamSelectMapper.insert(cateParamSelect); // }; } } if(mulFiles !=null && mulFiles.size()>0){ server/service/src/main/java/com/doumee/service/impl/CateParamSelectServiceImpl.java
@@ -4,12 +4,15 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.doumee.core.model.LoginUserInfo; import com.doumee.core.model.PageData; import com.doumee.core.model.PageWrap; import com.doumee.core.utils.Constants; import com.doumee.core.utils.Utils; import com.doumee.dao.business.CateParamSelectMapper; import com.doumee.dao.business.model.CateParamSelect; import com.doumee.service.CateParamSelectService; import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.scheduling.annotation.Async; @@ -28,6 +31,7 @@ @Autowired private RedisTemplate redisTemplate; @Autowired private CateParamSelectMapper cateParamSelectMapper; @@ -149,19 +153,22 @@ @Override @Async public void dealGroupVals(Integer companyId) { Boolean isGrouping = (Boolean)redisTemplate.opsForValue().get(companyId+"_isGrouping"); public void dealCateParamSelect() { LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); Boolean isGrouping = (Boolean)redisTemplate.opsForValue().get(loginUserInfo.getCompanyId()+Constants.CATE_PARAM_OPEN); if(isGrouping!=null && isGrouping ){ return; } redisTemplate.opsForValue().set(companyId+"_isGrouping",true); redisTemplate.opsForValue().set(loginUserInfo.getCompanyId()+Constants.CATE_PARAM_OPEN,true); try { //---------TODO-------任康 //å é¤ä¼ä¸ä¸å岿°æ® cateParamSelectMapper.delete(new QueryWrapper<CateParamSelect>().exists(" select 1 from category c where c.id = cate_param_select.category_id and c.company_id = "+loginUserInfo.getCompanyId()+" ")); //æ°å¢å½åä¼ä¸å¯ä»¥ä½¿ç¨çæ°æ® cateParamSelectMapper.insertBatch(loginUserInfo.getCompanyId(),loginUserInfo.getId()); }catch (Exception e){ }finally { redisTemplate.opsForValue().set(companyId+"_isGrouping",false); redisTemplate.opsForValue().set(loginUserInfo.getCompanyId()+Constants.CATE_PARAM_OPEN,false); } } } server/service/src/main/java/com/doumee/service/system/impl/SystemLoginServiceImpl.java
@@ -1,5 +1,6 @@ package com.doumee.service.system.impl; import com.baomidou.mybatisplus.extension.api.R; import com.doumee.core.constants.ResponseStatus; import com.doumee.core.exception.BusinessException; import com.doumee.core.model.LoginUserInfo; @@ -21,6 +22,7 @@ import javax.servlet.http.HttpServletRequest; import java.util.Date; import java.util.Objects; @Slf4j @Service @@ -77,7 +79,7 @@ loginLog.setReason(e.getMessage().length() > 200 ? (e.getMessage().substring(0, 190) + "...") : e.getMessage()); loginLog.setSuccess(Boolean.FALSE); systemLoginLogService.create(loginLog); throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT.getCode(), Objects.isNull(e.getCause())?ResponseStatus.ACCOUNT_INCORRECT.getMessage():e.getCause().getMessage()); } } } server/service/src/main/resources/mappers/CateParamSelectMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.doumee.dao.business.CateParamSelectMapper"> <insert id="insertBatch" > INSERT INTO `cate_param_select` (`CREATOR`, `CREATE_DATE`, `EDITOR`, `EDIT_DATE`, `ISDELETED`, `REMARK`, `NAME`, `PARAM_ID`, `CATEGORY_ID`, `STATUS`, `SORTNUM`) select #{userId} , now(),null , null , 0 , null , a.VAL , a.PRAMA_ID , b.CATEGORY_ID , 0 , null from goods_param a inner join goods b on a.GOODS_ID = b.ID and a.PRAMA_ID is not null AND a.VAL is not null and a.ISDELETED = 0 and a.`STATUS` = 0 and b.`STATUS` = 0 and b.ISDELETED = 0 AND b.company_id = #{companyId} </insert> </mapper>